Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
aaa0567c
Commit
aaa0567c
authored
Aug 11, 2015
by
danh-arm
Browse files
Merge pull request #356 from mtk09422/mt8173-support-v3
Mt8173 support v3
parents
c905376f
7d116dcc
Changes
45
Show whitespace changes
Inline
Side-by-side
plat/mediatek/mt8173/drivers/spm/spm_hotplug.c
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <mmio.h>
#include <mt8173_def.h>
#include <platform.h>
#include <spm.h>
#include <spm_hotplug.h>
#include <spm_mcdi.h>
/*
* System Power Manager (SPM) is a hardware module, which controls cpu or
* system power for different power scenarios using different firmware.
* This driver controls the cpu power in cpu hotplug flow.
*/
#define PCM_HOTPLUG_VALID_MASK 0x00ff0000
#define PCM_HOTPLUG_VALID_SHIFT 0x8
/**********************************************************
* PCM sequence for CPU hotplug
**********************************************************/
static
const
unsigned
int
hotplug_binary
[]
=
{
0x1900001f
,
0x1020020c
,
0x1950001f
,
0x1020020c
,
0xa9400005
,
0x00000001
,
0xe1000005
,
0x1910001f
,
0x10006720
,
0x814c9001
,
0xd82000e5
,
0x17c07c1f
,
0x1900001f
,
0x10001220
,
0x1950001f
,
0x10001220
,
0xa15f0405
,
0xe1000005
,
0x1900001f
,
0x10001228
,
0x1950001f
,
0x10001228
,
0x810f1401
,
0xd8200244
,
0x17c07c1f
,
0xe2e0006d
,
0xe2e0002d
,
0x1a00001f
,
0x100062b8
,
0x1910001f
,
0x100062b8
,
0xa9000004
,
0x00000001
,
0xe2000004
,
0x1910001f
,
0x100062b8
,
0x81142804
,
0xd8200444
,
0x17c07c1f
,
0xe2e0002c
,
0xe2e0003c
,
0xe2e0003e
,
0xe2e0003a
,
0xe2e00032
,
0x1910001f
,
0x1000660c
,
0x81079001
,
0x1950001f
,
0x10006610
,
0x81479401
,
0xa1001404
,
0xd8000584
,
0x17c07c1f
,
0x1900001f
,
0x10006404
,
0x1950001f
,
0x10006404
,
0xa1568405
,
0xe1000005
,
0xf0000000
,
0x17c07c1f
,
0x1900001f
,
0x10006404
,
0x1950001f
,
0x10006404
,
0x89400005
,
0x0000dfff
,
0xe1000005
,
0xe2e00036
,
0xe2e0003e
,
0x1910001f
,
0x1000660c
,
0x81079001
,
0x1950001f
,
0x10006610
,
0x81479401
,
0x81001404
,
0xd82008c4
,
0x17c07c1f
,
0xe2e0002e
,
0x1a00001f
,
0x100062b8
,
0x1910001f
,
0x100062b8
,
0x89000004
,
0x0000fffe
,
0xe2000004
,
0x1910001f
,
0x100062b8
,
0x81142804
,
0xd8000ae4
,
0x17c07c1f
,
0xe2e0006e
,
0xe2e0004e
,
0xe2e0004c
,
0xe2e0004d
,
0x1900001f
,
0x10001220
,
0x1950001f
,
0x10001220
,
0x89400005
,
0xbfffffff
,
0xe1000005
,
0x1900001f
,
0x10001228
,
0x1950001f
,
0x10001228
,
0x810f1401
,
0xd8000ce4
,
0x17c07c1f
,
0x1900001f
,
0x1020020c
,
0x1950001f
,
0x1020020c
,
0x89400005
,
0xfffffffe
,
0xe1000005
,
0xf0000000
,
0x17c07c1f
,
0x1212841f
,
0xe2e00036
,
0xe2e0003e
,
0x1380201f
,
0xe2e0003c
,
0xe2a00000
,
0x1b80001f
,
0x20000080
,
0xe2e0007c
,
0x1b80001f
,
0x20000003
,
0xe2e0005c
,
0xe2e0004c
,
0xe2e0004d
,
0xf0000000
,
0x17c07c1f
,
0xe2e0004f
,
0xe2e0006f
,
0xe2e0002f
,
0xe2a00001
,
0x1b80001f
,
0x20000080
,
0xe2e0002e
,
0xe2e0003e
,
0xe2e00032
,
0xf0000000
,
0x17c07c1f
,
0x1212841f
,
0xe2e00026
,
0xe2e0002e
,
0x1380201f
,
0x1a00001f
,
0x100062b4
,
0x1910001f
,
0x100062b4
,
0x81322804
,
0xe2000004
,
0x81202804
,
0xe2000004
,
0x1b80001f
,
0x20000034
,
0x1910001f
,
0x100062b4
,
0x81142804
,
0xd8001404
,
0x17c07c1f
,
0xe2e0000e
,
0xe2e0000c
,
0xe2e0000d
,
0xf0000000
,
0x17c07c1f
,
0xe2e0002d
,
0x1a00001f
,
0x100062b4
,
0x1910001f
,
0x100062b4
,
0xa1002804
,
0xe2000004
,
0xa1122804
,
0xe2000004
,
0x1b80001f
,
0x20000080
,
0x1910001f
,
0x100062b4
,
0x81142804
,
0xd82016a4
,
0x17c07c1f
,
0xe2e0002f
,
0xe2e0002b
,
0xe2e00023
,
0x1380201f
,
0xe2e00022
,
0xf0000000
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x1840001f
,
0x00000001
,
0x1840001f
,
0x00000001
,
0x1840001f
,
0x00000001
,
0xa1d48407
,
0x1b00001f
,
0x2f7be75f
,
0xe8208000
,
0x10006354
,
0xfffe7b47
,
0xa1d10407
,
0x1b80001f
,
0x20000020
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81461001
,
0xb14690a1
,
0xd82044e5
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81079001
,
0xd80044e4
,
0x17c07c1f
,
0x1990001f
,
0x10006b00
,
0x81421801
,
0x82429801
,
0x81402405
,
0xd80044e5
,
0x17c07c1f
,
0x1a40001f
,
0x100062b0
,
0x1280041f
,
0xc24007a0
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81449001
,
0xd8204be5
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81009001
,
0xd8204984
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81051001
,
0xd8204be4
,
0x17c07c1f
,
0x1910001f
,
0x10006720
,
0x81489001
,
0xd82046c5
,
0x17c07c1f
,
0x1a40001f
,
0x10006218
,
0x1a80001f
,
0x10006264
,
0xc24010e0
,
0x17c07c1f
,
0x1910001f
,
0x1000660c
,
0x81051001
,
0x1950001f
,
0x10006610
,
0x81451401
,
0xa1001404
,
0xd8004824
,
0x17c07c1f
,
0xd0004b00
,
0x17c07c1f
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81051001
,
0xd8004be4
,
0x17c07c1f
,
0x1a40001f
,
0x10006218
,
0x1a80001f
,
0x10006264
,
0xc2400ee0
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x89000004
,
0xfffffdff
,
0x1940001f
,
0x10006b00
,
0xe1400004
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81451001
,
0xd8205305
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81011001
,
0xd82050a4
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81059001
,
0xd8205304
,
0x17c07c1f
,
0x1910001f
,
0x10006720
,
0x81491001
,
0xd8204de5
,
0x17c07c1f
,
0x1a40001f
,
0x1000621c
,
0x1a80001f
,
0x1000626c
,
0xc24010e0
,
0x17c07c1f
,
0x1910001f
,
0x1000660c
,
0x81059001
,
0x1950001f
,
0x10006610
,
0x81459401
,
0xa1001404
,
0xd8004f44
,
0x17c07c1f
,
0xd0005220
,
0x17c07c1f
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81059001
,
0xd8005304
,
0x17c07c1f
,
0x1a40001f
,
0x1000621c
,
0x1a80001f
,
0x1000626c
,
0xc2400ee0
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x89000004
,
0xfffffbff
,
0x1940001f
,
0x10006b00
,
0xe1400004
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81459001
,
0xd8205a25
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81019001
,
0xd82057c4
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81061001
,
0xd8205a24
,
0x17c07c1f
,
0x1910001f
,
0x10006720
,
0x81499001
,
0xd8205505
,
0x17c07c1f
,
0x1a40001f
,
0x10006220
,
0x1a80001f
,
0x10006274
,
0xc24010e0
,
0x17c07c1f
,
0x1910001f
,
0x1000660c
,
0x81061001
,
0x1950001f
,
0x10006610
,
0x81461401
,
0xa1001404
,
0xd8005664
,
0x17c07c1f
,
0xd0005940
,
0x17c07c1f
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81061001
,
0xd8005a24
,
0x17c07c1f
,
0x1a40001f
,
0x10006220
,
0x1a80001f
,
0x10006274
,
0xc2400ee0
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x89000004
,
0xfffff7ff
,
0x1940001f
,
0x10006b00
,
0xe1400004
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81461001
,
0xd8206185
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81021001
,
0xd8205ec4
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81081001
,
0xd8206184
,
0x17c07c1f
,
0x1910001f
,
0x10006720
,
0x814a1001
,
0xd8205c25
,
0x17c07c1f
,
0x1a40001f
,
0x100062a0
,
0x1280041f
,
0xc2401540
,
0x17c07c1f
,
0x1910001f
,
0x1000660c
,
0x81081001
,
0x1950001f
,
0x10006610
,
0x81481401
,
0xa1001404
,
0xd8005d64
,
0x17c07c1f
,
0xd00060a0
,
0x17c07c1f
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81479001
,
0x81881001
,
0x69a00006
,
0x00000000
,
0x81401805
,
0xd8206185
,
0x17c07c1f
,
0x1a40001f
,
0x100062a0
,
0x1280041f
,
0xc2401240
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x89000004
,
0xffffefff
,
0x1940001f
,
0x10006b00
,
0xe1400004
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81469001
,
0xd82068e5
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81029001
,
0xd8206624
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81089001
,
0xd82068e4
,
0x17c07c1f
,
0x1910001f
,
0x10006720
,
0x814a9001
,
0xd8206385
,
0x17c07c1f
,
0x1a40001f
,
0x100062a4
,
0x1290841f
,
0xc2401540
,
0x17c07c1f
,
0x1910001f
,
0x1000660c
,
0x81089001
,
0x1950001f
,
0x10006610
,
0x81489401
,
0xa1001404
,
0xd80064c4
,
0x17c07c1f
,
0xd0006800
,
0x17c07c1f
,
0x17c07c1f
,
0x1910001f
,
0x10006610
,
0x81479001
,
0x81889001
,
0x69a00006
,
0x00000000
,
0x81401805
,
0xd82068e5
,
0x17c07c1f
,
0x1a40001f
,
0x100062a4
,
0x1290841f
,
0xc2401240
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x89000004
,
0xffffdfff
,
0x1940001f
,
0x10006b00
,
0xe1400004
,
0x1910001f
,
0x10006610
,
0x81479001
,
0x81881001
,
0x69600005
,
0x00000000
,
0xa1401805
,
0x81889001
,
0xa1401805
,
0xd8006bc5
,
0x17c07c1f
,
0x1910001f
,
0x10006b00
,
0x81421001
,
0x82429001
,
0x82802405
,
0xd8206bca
,
0x17c07c1f
,
0x1a40001f
,
0x100062b0
,
0x1280041f
,
0xc2400000
,
0x17c07c1f
,
0x1990001f
,
0x10006b00
,
0x89800006
,
0x00003f00
,
0x69200006
,
0x00000000
,
0xd82041e4
,
0x17c07c1f
,
0x1990001f
,
0x10006320
,
0x69200006
,
0xbeefbeef
,
0xd8006dc4
,
0x17c07c1f
,
0xd00041e0
,
0x17c07c1f
,
0x1910001f
,
0x10006358
,
0x810b1001
,
0xd8006dc4
,
0x17c07c1f
,
0x1980001f
,
0xdeaddead
,
0x19c0001f
,
0x01411820
,
0xf0000000
};
static
const
struct
pcm_desc
hotplug_pcm
=
{
.
version
=
"pcm_power_down_mt8173_V37"
,
.
base
=
hotplug_binary
,
.
size
=
888
,
.
sess
=
2
,
.
replace
=
0
,
};
static
struct
pwr_ctrl
hotplug_ctrl
=
{
.
wake_src
=
0
,
.
wake_src_md32
=
0
,
.
wfi_op
=
WFI_OP_OR
,
.
mcusys_idle_mask
=
1
,
.
ca7top_idle_mask
=
1
,
.
ca15top_idle_mask
=
1
,
.
disp_req_mask
=
1
,
.
mfg_req_mask
=
1
,
.
md32_req_mask
=
1
,
.
syspwreq_mask
=
1
,
.
pcm_flags
=
0
,
};
static
const
struct
spm_lp_scen
spm_hotplug
=
{
.
pcmdesc
=
&
hotplug_pcm
,
.
pwrctrl
=
&
hotplug_ctrl
,
};
void
spm_go_to_hotplug
(
void
)
{
const
struct
pcm_desc
*
pcmdesc
=
spm_hotplug
.
pcmdesc
;
struct
pwr_ctrl
*
pwrctrl
=
spm_hotplug
.
pwrctrl
;
set_pwrctrl_pcm_flags
(
pwrctrl
,
0
);
spm_reset_and_init_pcm
();
spm_kick_im_to_fetch
(
pcmdesc
);
spm_set_power_control
(
pwrctrl
);
spm_set_wakeup_event
(
pwrctrl
);
spm_kick_pcm_to_run
(
pwrctrl
);
}
void
spm_clear_hotplug
(
void
)
{
/* Inform SPM that CPU wants to program CPU_WAKEUP_EVENT and
* DISABLE_CPU_DROM */
mmio_write_32
(
SPM_PCM_REG_DATA_INI
,
PCM_HANDSHAKE_SEND1
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
PCM_RF_SYNC_R6
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
0
);
/* Wait SPM's response, can't use sleep api */
while
((
mmio_read_32
(
SPM_PCM_FSM_STA
)
&
PCM_END_FSM_STA_MASK
)
!=
PCM_END_FSM_STA_DEF
)
;
/* no hotplug pcm running */
clear_all_ready
();
}
void
spm_hotplug_on
(
unsigned
long
mpidr
)
{
unsigned
long
linear_id
;
linear_id
=
platform_get_core_pos
(
mpidr
);
spm_lock_get
();
if
(
is_hotplug_ready
()
==
0
)
{
spm_mcdi_wakeup_all_cores
();
mmio_clrbits_32
(
SPM_PCM_RESERVE
,
PCM_HOTPLUG_VALID_MASK
);
spm_go_to_hotplug
();
set_hotplug_ready
();
}
/* turn on CPUx */
mmio_clrsetbits_32
(
SPM_PCM_RESERVE
,
PCM_HOTPLUG_VALID_MASK
|
(
1
<<
linear_id
),
1
<<
(
linear_id
+
PCM_HOTPLUG_VALID_SHIFT
));
spm_lock_release
();
}
void
spm_hotplug_off
(
unsigned
long
mpidr
)
{
unsigned
long
linear_id
;
linear_id
=
platform_get_core_pos
(
mpidr
);
spm_lock_get
();
if
(
is_hotplug_ready
()
==
0
)
{
spm_mcdi_wakeup_all_cores
();
mmio_clrbits_32
(
SPM_PCM_RESERVE
,
PCM_HOTPLUG_VALID_MASK
);
spm_go_to_hotplug
();
set_hotplug_ready
();
}
mmio_clrsetbits_32
(
SPM_PCM_RESERVE
,
PCM_HOTPLUG_VALID_MASK
,
(
1
<<
linear_id
)
|
(
1
<<
(
linear_id
+
PCM_HOTPLUG_VALID_SHIFT
)));
spm_lock_release
();
}
plat/mediatek/mt8173/drivers/spm/spm_hotplug.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SPM_HOTPLUG_H__
#define __SPM_HOTPLUG_H__
void
spm_clear_hotplug
(
void
);
void
spm_hotplug_off
(
unsigned
long
mpidr
);
void
spm_hotplug_on
(
unsigned
long
mpidr
);
#endif
/* __SPM_HOTPLUG_H__ */
plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arch.h>
#include <debug.h>
#include <mmio.h>
#include <mt8173_def.h>
#include <platform.h>
#include <platform_def.h>
#include <spm.h>
#include <spm_hotplug.h>
#include <spm_mcdi.h>
/*
* System Power Manager (SPM) is a hardware module, which controls cpu or
* system power for different power scenarios using different firmware.
* This driver controls the cpu power in cpu idle power saving state.
*/
#define WAKE_SRC_FOR_MCDI (WAKE_SRC_SYSPWREQ | WAKE_SRC_CPU_IRQ)
#define PCM_MCDI_HANDSHAKE_SYNC 0xbeefbeef
#define PCM_MCDI_HANDSHAKE_ACK 0xdeaddead
#define PCM_MCDI_UPDATE_INFORM 0xabcdabcd
#define PCM_MCDI_CKECK_DONE 0x12345678
#define PCM_MCDI_ALL_CORE_AWAKE 0x0
#define PCM_MCDI_OFFLOADED 0xaa55aa55
static
const
unsigned
int
mcdi_binary
[]
=
{
0x1212841f
,
0xe2e00036
,
0xe2e0003e
,
0x1380201f
,
0xe2e0003c
,
0xe2a00000
,
0x1b80001f
,
0x20000080
,
0xe2e0007c
,
0x1b80001f
,
0x20000003
,
0xe2e0005c
,
0xe2e0004c
,
0xe2e0004d
,
0xf0000000
,
0x17c07c1f
,
0xe2e0004f
,
0xe2e0006f
,
0xe2e0002f
,
0xe2a00001
,
0x1b80001f
,
0x20000080
,
0xe2e0002e
,
0xe2e0003e
,
0xe2e00032
,
0xf0000000
,
0x17c07c1f
,
0x1212841f
,
0xe2e00026
,
0xe2e0002e
,
0x1380201f
,
0x1a00001f
,
0x100062b4
,
0x1910001f
,
0x100062b4
,
0x81322804
,
0xe2000004
,
0x81202804
,
0xe2000004
,
0x1b80001f
,
0x20000034
,
0x1910001f
,
0x100062b4
,
0x81142804
,
0xd8000524
,
0x17c07c1f
,
0xe2e0000e
,
0xe2e0000c
,
0xe2e0000d
,
0xf0000000
,
0x17c07c1f
,
0xe2e0002d
,
0x1a00001f
,
0x100062b4
,
0x1910001f
,
0x100062b4
,
0xa1002804
,
0xe2000004
,
0xa1122804
,
0xe2000004
,
0x1b80001f
,
0x20000080
,
0x1910001f
,
0x100062b4
,
0x81142804
,
0xd82007c4
,
0x17c07c1f
,
0xe2e0002f
,
0xe2e0002b
,
0xe2e00023
,
0x1380201f
,
0xe2e00022
,
0xf0000000
,
0x17c07c1f
,
0x18c0001f
,
0x10006b6c
,
0x1910001f
,
0x10006b6c
,
0xa1002804
,
0xe0c00004
,
0xf0000000
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x1840001f
,
0x00000001
,
0x11407c1f
,
0xe8208000
,
0x10006b6c
,
0xa0000000
,
0xe8208000
,
0x10006310
,
0x0b160008
,
0x1900001f
,
0x000f7bde
,
0x1a00001f
,
0x10200268
,
0xe2000004
,
0xe8208000
,
0x10006600
,
0x00000000
,
0xc2800940
,
0x1280041f
,
0x1b00001f
,
0x21000001
,
0x1b80001f
,
0xd0010000
,
0xc2800940
,
0x1290841f
,
0x69200006
,
0xbeefbeef
,
0xd8204764
,
0x17c07c1f
,
0xc2800940
,
0x1291041f
,
0x1910001f
,
0x10006358
,
0x810b1001
,
0xd80043e4
,
0x17c07c1f
,
0x1980001f
,
0xdeaddead
,
0x69200006
,
0xabcdabcd
,
0xd82044c4
,
0x17c07c1f
,
0xc2800940
,
0x1291841f
,
0x88900001
,
0x10006814
,
0x1910001f
,
0x10006400
,
0x81271002
,
0x1880001f
,
0x10006600
,
0xe0800004
,
0x1910001f
,
0x10006358
,
0x810b1001
,
0xd8004684
,
0x17c07c1f
,
0x1980001f
,
0x12345678
,
0x60a07c05
,
0x89100002
,
0x10006600
,
0x80801001
,
0xd8007142
,
0x17c07c1f
,
0xc2800940
,
0x1292041f
,
0x1a10001f
,
0x10006720
,
0x82002001
,
0x82201408
,
0xd8204a08
,
0x17c07c1f
,
0x1a40001f
,
0x10006200
,
0x1a80001f
,
0x1000625c
,
0xc2400200
,
0x17c07c1f
,
0xa1400405
,
0xc2800940
,
0x1292841f
,
0x1a10001f
,
0x10006720
,
0x8200a001
,
0x82209408
,
0xd8204be8
,
0x17c07c1f
,
0x1a40001f
,
0x10006218
,
0x1a80001f
,
0x10006264
,
0xc2400200
,
0x17c07c1f
,
0xa1508405
,
0xc2800940
,
0x1293041f
,
0x1a10001f
,
0x10006720
,
0x82012001
,
0x82211408
,
0xd8204dc8
,
0x17c07c1f
,
0x1a40001f
,
0x1000621c
,
0x1a80001f
,
0x1000626c
,
0xc2400200
,
0x17c07c1f
,
0xa1510405
,
0x1a10001f
,
0x10006720
,
0x8201a001
,
0x82219408
,
0xd8204f68
,
0x17c07c1f
,
0x1a40001f
,
0x10006220
,
0x1a80001f
,
0x10006274
,
0xc2400200
,
0x17c07c1f
,
0xa1518405
,
0x1a10001f
,
0x10006720
,
0x82022001
,
0x82221408
,
0xd82050e8
,
0x17c07c1f
,
0x1a40001f
,
0x100062a0
,
0x1280041f
,
0xc2400660
,
0x17c07c1f
,
0xa1520405
,
0x1a10001f
,
0x10006720
,
0x8202a001
,
0x82229408
,
0xd8205268
,
0x17c07c1f
,
0x1a40001f
,
0x100062a4
,
0x1290841f
,
0xc2400660
,
0x17c07c1f
,
0xa1528405
,
0x1a10001f
,
0x10006720
,
0x82032001
,
0x82231408
,
0xd82053e8
,
0x17c07c1f
,
0x1a40001f
,
0x100062a8
,
0x1291041f
,
0xc2400660
,
0x17c07c1f
,
0xa1530405
,
0x1a10001f
,
0x10006720
,
0x8203a001
,
0x82239408
,
0xd8205568
,
0x17c07c1f
,
0x1a40001f
,
0x100062ac
,
0x1291841f
,
0xc2400660
,
0x17c07c1f
,
0xa1538405
,
0x1b80001f
,
0x20000208
,
0xd82070cc
,
0x17c07c1f
,
0x81001401
,
0xd8205964
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x81002001
,
0xb1042081
,
0xb1003081
,
0xb10c3081
,
0xd8205964
,
0x17c07c1f
,
0x1a40001f
,
0x10006200
,
0x1a80001f
,
0x1000625c
,
0xc2400000
,
0x17c07c1f
,
0x89400005
,
0xfffffffe
,
0xe8208000
,
0x10006f00
,
0x00000000
,
0xe8208000
,
0x10006b30
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000001
,
0x81009401
,
0xd8205cc4
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x8100a001
,
0xb104a081
,
0xb1003081
,
0xd8205cc4
,
0x17c07c1f
,
0x1a40001f
,
0x10006218
,
0x1a80001f
,
0x10006264
,
0xc2400000
,
0x17c07c1f
,
0x89400005
,
0xfffffffd
,
0xe8208000
,
0x10006f04
,
0x00000000
,
0xe8208000
,
0x10006b34
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000002
,
0x81011401
,
0xd8206024
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x81012001
,
0xb1052081
,
0xb1003081
,
0xd8206024
,
0x17c07c1f
,
0x1a40001f
,
0x1000621c
,
0x1a80001f
,
0x1000626c
,
0xc2400000
,
0x17c07c1f
,
0x89400005
,
0xfffffffb
,
0xe8208000
,
0x10006f08
,
0x00000000
,
0xe8208000
,
0x10006b38
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000004
,
0x81019401
,
0xd8206384
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x8101a001
,
0xb105a081
,
0xb1003081
,
0xd8206384
,
0x17c07c1f
,
0x1a40001f
,
0x10006220
,
0x1a80001f
,
0x10006274
,
0xc2400000
,
0x17c07c1f
,
0x89400005
,
0xfffffff7
,
0xe8208000
,
0x10006f0c
,
0x00000000
,
0xe8208000
,
0x10006b3c
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000008
,
0x81021401
,
0xd82066c4
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x81022001
,
0xb1062081
,
0xb1003081
,
0xd82066c4
,
0x17c07c1f
,
0x1a40001f
,
0x100062a0
,
0x1280041f
,
0xc2400360
,
0x17c07c1f
,
0x89400005
,
0xffffffef
,
0xe8208000
,
0x10006f10
,
0x00000000
,
0xe8208000
,
0x10006b40
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000010
,
0x81029401
,
0xd8206a04
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x8102a001
,
0xb106a081
,
0xb1003081
,
0xd8206a04
,
0x17c07c1f
,
0x1a40001f
,
0x100062a4
,
0x1290841f
,
0xc2400360
,
0x17c07c1f
,
0x89400005
,
0xffffffdf
,
0xe8208000
,
0x10006f14
,
0x00000000
,
0xe8208000
,
0x10006b44
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000020
,
0x81031401
,
0xd8206d44
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x81032001
,
0xb1072081
,
0xb1003081
,
0xd8206d44
,
0x17c07c1f
,
0x1a40001f
,
0x100062a8
,
0x1291041f
,
0xc2400360
,
0x17c07c1f
,
0x89400005
,
0xffffffbf
,
0xe8208000
,
0x10006f18
,
0x00000000
,
0xe8208000
,
0x10006b48
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000040
,
0x81039401
,
0xd8207084
,
0x17c07c1f
,
0x1a10001f
,
0x10006918
,
0x8103a001
,
0xb107a081
,
0xb1003081
,
0xd8207084
,
0x17c07c1f
,
0x1a40001f
,
0x100062ac
,
0x1291841f
,
0xc2400360
,
0x17c07c1f
,
0x89400005
,
0xffffff7f
,
0xe8208000
,
0x10006f1c
,
0x00000000
,
0xe8208000
,
0x10006b4c
,
0x00000000
,
0xe8208000
,
0x100063e0
,
0x00000080
,
0xc2800940
,
0x1293841f
,
0xd0004260
,
0x17c07c1f
,
0xc2800940
,
0x1294041f
,
0xe8208000
,
0x10006600
,
0x00000000
,
0x1ac0001f
,
0x55aa55aa
,
0x1940001f
,
0xaa55aa55
,
0xc2800940
,
0x1294841f
,
0x1b80001f
,
0x00001000
,
0xf0000000
,
0x17c07c1f
};
static
const
struct
pcm_desc
mcdi_pcm
=
{
.
version
=
"pcm_mcdi_v0.5_20140721_mt8173_v03.04_20150507"
,
.
base
=
mcdi_binary
,
.
size
=
919
,
.
sess
=
2
,
.
replace
=
0
,
};
static
struct
pwr_ctrl
mcdi_ctrl
=
{
.
wake_src
=
WAKE_SRC_FOR_MCDI
,
.
wake_src_md32
=
0
,
.
wfi_op
=
WFI_OP_OR
,
.
mcusys_idle_mask
=
1
,
.
ca7top_idle_mask
=
1
,
.
ca15top_idle_mask
=
1
,
.
disp_req_mask
=
1
,
.
mfg_req_mask
=
1
,
.
md32_req_mask
=
1
,
};
static
const
struct
spm_lp_scen
spm_mcdi
=
{
.
pcmdesc
=
&
mcdi_pcm
,
.
pwrctrl
=
&
mcdi_ctrl
,
};
void
spm_mcdi_cpu_wake_up_event
(
int
wake_up_event
,
int
disable_dormant_power
)
{
if
(((
mmio_read_32
(
SPM_SLEEP_CPU_WAKEUP_EVENT
)
&
0x1
)
==
1
)
&&
((
mmio_read_32
(
SPM_CLK_CON
)
&
CC_DISABLE_DORM_PWR
)
==
0
))
{
/* MCDI is offload? */
INFO
(
"%s: SPM_SLEEP_CPU_WAKEUP_EVENT:%x, SPM_CLK_CON %x"
,
__func__
,
mmio_read_32
(
SPM_SLEEP_CPU_WAKEUP_EVENT
),
mmio_read_32
(
SPM_CLK_CON
));
return
;
}
/* Inform SPM that CPU wants to program CPU_WAKEUP_EVENT and
* DISABLE_CPU_DROM */
mmio_write_32
(
SPM_PCM_REG_DATA_INI
,
PCM_MCDI_HANDSHAKE_SYNC
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
PCM_RF_SYNC_R6
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
0
);
/* Wait SPM's response, can't use sleep api */
while
(
mmio_read_32
(
SPM_PCM_REG6_DATA
)
!=
PCM_MCDI_HANDSHAKE_ACK
)
;
if
(
disable_dormant_power
)
{
mmio_setbits_32
(
SPM_CLK_CON
,
CC_DISABLE_DORM_PWR
);
while
(
mmio_read_32
(
SPM_CLK_CON
)
!=
(
mmio_read_32
(
SPM_CLK_CON
)
|
CC_DISABLE_DORM_PWR
))
;
}
else
{
mmio_clrbits_32
(
SPM_CLK_CON
,
CC_DISABLE_DORM_PWR
);
while
(
mmio_read_32
(
SPM_CLK_CON
)
!=
(
mmio_read_32
(
SPM_CLK_CON
)
&
~
CC_DISABLE_DORM_PWR
))
;
}
mmio_write_32
(
SPM_SLEEP_CPU_WAKEUP_EVENT
,
wake_up_event
);
while
(
mmio_read_32
(
SPM_SLEEP_CPU_WAKEUP_EVENT
)
!=
wake_up_event
)
;
/* Inform SPM to see updated setting */
mmio_write_32
(
SPM_PCM_REG_DATA_INI
,
PCM_MCDI_UPDATE_INFORM
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
PCM_RF_SYNC_R6
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
0
);
while
(
mmio_read_32
(
SPM_PCM_REG6_DATA
)
!=
PCM_MCDI_CKECK_DONE
)
;
/* END OF sequence */
mmio_write_32
(
SPM_PCM_REG_DATA_INI
,
0x0
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
PCM_RF_SYNC_R6
);
mmio_write_32
(
SPM_PCM_PWR_IO_EN
,
0
);
}
void
spm_mcdi_wakeup_all_cores
(
void
)
{
if
(
is_mcdi_ready
()
==
0
)
return
;
spm_mcdi_cpu_wake_up_event
(
1
,
1
);
while
(
mmio_read_32
(
SPM_PCM_REG5_DATA
)
!=
PCM_MCDI_ALL_CORE_AWAKE
)
;
spm_mcdi_cpu_wake_up_event
(
1
,
0
);
while
(
mmio_read_32
(
SPM_PCM_REG5_DATA
)
!=
PCM_MCDI_OFFLOADED
)
;
spm_clean_after_wakeup
();
clear_all_ready
();
}
void
spm_mcdi_wfi_sel_enter
(
unsigned
long
mpidr
)
{
int
core_id_val
=
mpidr
&
MPIDR_CPU_MASK
;
int
cluster_id
=
(
mpidr
&
MPIDR_CLUSTER_MASK
)
>>
MPIDR_AFFINITY_BITS
;
/* SPM WFI Select by core number */
if
(
cluster_id
)
{
switch
(
core_id_val
)
{
case
0
:
mmio_write_32
(
SPM_CA15_CPU0_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA15_WFI0_EN
,
1
);
break
;
case
1
:
mmio_write_32
(
SPM_CA15_CPU1_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA15_WFI1_EN
,
1
);
break
;
case
2
:
mmio_write_32
(
SPM_CA15_CPU2_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA15_WFI2_EN
,
1
);
break
;
case
3
:
mmio_write_32
(
SPM_CA15_CPU3_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA15_WFI3_EN
,
1
);
break
;
default:
break
;
}
}
else
{
switch
(
core_id_val
)
{
case
0
:
mmio_write_32
(
SPM_CA7_CPU0_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA7_WFI0_EN
,
1
);
break
;
case
1
:
mmio_write_32
(
SPM_CA7_CPU1_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA7_WFI1_EN
,
1
);
break
;
case
2
:
mmio_write_32
(
SPM_CA7_CPU2_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA7_WFI2_EN
,
1
);
break
;
case
3
:
mmio_write_32
(
SPM_CA7_CPU3_IRQ_MASK
,
1
);
mmio_write_32
(
SPM_SLEEP_CA7_WFI3_EN
,
1
);
break
;
default:
break
;
}
}
}
void
spm_mcdi_wfi_sel_leave
(
unsigned
long
mpidr
)
{
int
core_id_val
=
mpidr
&
MPIDR_CPU_MASK
;
int
cluster_id
=
(
mpidr
&
MPIDR_CLUSTER_MASK
)
>>
MPIDR_AFFINITY_BITS
;
/* SPM WFI Select by core number */
if
(
cluster_id
)
{
switch
(
core_id_val
)
{
case
0
:
mmio_write_32
(
SPM_SLEEP_CA15_WFI0_EN
,
0
);
mmio_write_32
(
SPM_CA15_CPU0_IRQ_MASK
,
0
);
break
;
case
1
:
mmio_write_32
(
SPM_SLEEP_CA15_WFI1_EN
,
0
);
mmio_write_32
(
SPM_CA15_CPU1_IRQ_MASK
,
0
);
break
;
case
2
:
mmio_write_32
(
SPM_SLEEP_CA15_WFI2_EN
,
0
);
mmio_write_32
(
SPM_CA15_CPU2_IRQ_MASK
,
0
);
break
;
case
3
:
mmio_write_32
(
SPM_SLEEP_CA15_WFI3_EN
,
0
);
mmio_write_32
(
SPM_CA15_CPU3_IRQ_MASK
,
0
);
break
;
default:
break
;
}
}
else
{
switch
(
core_id_val
)
{
case
0
:
mmio_write_32
(
SPM_SLEEP_CA7_WFI0_EN
,
0
);
mmio_write_32
(
SPM_CA7_CPU0_IRQ_MASK
,
0
);
break
;
case
1
:
mmio_write_32
(
SPM_SLEEP_CA7_WFI1_EN
,
0
);
mmio_write_32
(
SPM_CA7_CPU1_IRQ_MASK
,
0
);
break
;
case
2
:
mmio_write_32
(
SPM_SLEEP_CA7_WFI2_EN
,
0
);
mmio_write_32
(
SPM_CA7_CPU2_IRQ_MASK
,
0
);
break
;
case
3
:
mmio_write_32
(
SPM_SLEEP_CA7_WFI3_EN
,
0
);
mmio_write_32
(
SPM_CA7_CPU3_IRQ_MASK
,
0
);
break
;
default:
break
;
}
}
}
void
spm_mcdi_prepare
(
unsigned
long
mpidr
)
{
const
struct
pcm_desc
*
pcmdesc
=
spm_mcdi
.
pcmdesc
;
struct
pwr_ctrl
*
pwrctrl
=
spm_mcdi
.
pwrctrl
;
spm_lock_get
();
if
(
is_mcdi_ready
()
==
0
)
{
if
(
is_hotplug_ready
()
==
1
)
spm_clear_hotplug
();
set_pwrctrl_pcm_flags
(
pwrctrl
,
0
);
spm_reset_and_init_pcm
();
spm_kick_im_to_fetch
(
pcmdesc
);
spm_set_power_control
(
pwrctrl
);
spm_set_wakeup_event
(
pwrctrl
);
spm_kick_pcm_to_run
(
pwrctrl
);
set_mcdi_ready
();
}
spm_mcdi_wfi_sel_enter
(
mpidr
);
spm_lock_release
();
}
void
spm_mcdi_finish
(
unsigned
long
mpidr
)
{
unsigned
long
linear_id
=
platform_get_core_pos
(
mpidr
);
spm_lock_get
();
spm_mcdi_wfi_sel_leave
(
mpidr
);
mmio_write_32
(
SPM_PCM_SW_INT_CLEAR
,
(
0x1
<<
linear_id
));
spm_lock_release
();
}
plat/mediatek/mt8173/drivers/spm/spm_mcdi.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SPM_MCDI_H__
#define __SPM_MCDI_H__
void
spm_mcdi_wakeup_all_cores
(
void
);
void
spm_mcdi_wfi_sel_enter
(
unsigned
long
mpidr
);
void
spm_mcdi_wfi_sel_leave
(
unsigned
long
mpidr
);
void
spm_mcdi_prepare
(
unsigned
long
mpidr
);
void
spm_mcdi_finish
(
unsigned
long
mpidr
);
#endif
/* __SPM_MCDI_H__ */
plat/mediatek/mt8173/drivers/spm/spm_suspend.c
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <bakery_lock.h>
#include <debug.h>
#include <spm.h>
#include <spm_suspend.h>
/*
* System Power Manager (SPM) is a hardware module, which controls cpu or
* system power for different power scenarios using different firmware.
* This driver controls the system power in system suspend flow.
*/
#define WAIT_UART_ACK_TIMES 80
/* 80 * 10us */
#define WAKE_SRC_FOR_SUSPEND \
(WAKE_SRC_KP | WAKE_SRC_EINT | WAKE_SRC_MD32 | \
WAKE_SRC_USB_CD | WAKE_SRC_USB_PDN | WAKE_SRC_THERM | \
WAKE_SRC_SYSPWREQ | WAKE_SRC_SEJ | WAKE_SRC_ALL_MD32)
#define WAKE_SRC_FOR_MD32 0
#define spm_is_wakesrc_invalid(wakesrc) \
(!!((unsigned int)(wakesrc) & 0xc0003803))
const
unsigned
int
spm_flags
=
SPM_DUALVCORE_PDN_DIS
|
SPM_PASR_DIS
|
SPM_DPD_DIS
|
SPM_CPU_DVS_DIS
|
SPM_OPT
|
SPM_INFRA_PDN_DIS
;
enum
wake_reason_t
spm_wake_reason
=
WR_NONE
;
/**********************************************************
* PCM sequence for cpu suspend
**********************************************************/
static
const
unsigned
int
suspend_binary_ca7
[]
=
{
0x81f58407
,
0x81f68407
,
0x803a0400
,
0x803a8400
,
0x1b80001f
,
0x20000000
,
0x80300400
,
0x80318400
,
0x80328400
,
0xa1d28407
,
0x81f20407
,
0x81409801
,
0xd8000245
,
0x17c07c1f
,
0x18c0001f
,
0x10006234
,
0xc0c031a0
,
0x1200041f
,
0x80310400
,
0x1b80001f
,
0x2000000a
,
0xa0110400
,
0x18c0001f
,
0x100062c8
,
0xe0e00010
,
0xe0e00030
,
0xe0e00070
,
0xe0e000f0
,
0x1b80001f
,
0x2000001a
,
0xe0e00ff0
,
0xe8208000
,
0x10006354
,
0xfffe7fff
,
0xe8208000
,
0x10006834
,
0x00000010
,
0x81f00407
,
0xa1dd0407
,
0x81fd0407
,
0xc2803780
,
0x1290041f
,
0x8880000c
,
0x2f7be75f
,
0xd8200642
,
0x17c07c1f
,
0x1b00001f
,
0x7fffe7ff
,
0xd0000680
,
0x17c07c1f
,
0x1b00001f
,
0x7ffff7ff
,
0xf0000000
,
0x17c07c1f
,
0x80880001
,
0xd8000762
,
0x17c07c1f
,
0xd00027a0
,
0x1200041f
,
0xe8208000
,
0x10006834
,
0x00000000
,
0x1b00001f
,
0x3fffe7ff
,
0x1b80001f
,
0x20000004
,
0xd820092c
,
0x17c07c1f
,
0xe8208000
,
0x10006834
,
0x00000010
,
0xd00011a0
,
0x17c07c1f
,
0x18c0001f
,
0x10006608
,
0x1910001f
,
0x10006608
,
0x813b0404
,
0xe0c00004
,
0x1880001f
,
0x10006320
,
0xc0c03680
,
0xe080000f
,
0xd8200b23
,
0x17c07c1f
,
0x1b00001f
,
0x7ffff7ff
,
0xd00011a0
,
0x17c07c1f
,
0xe080001f
,
0xe8208000
,
0x10006354
,
0xffffffff
,
0x18c0001f
,
0x100062c8
,
0xe0e000f0
,
0xe0e00030
,
0xe0e00000
,
0x81409801
,
0xd8000fe5
,
0x17c07c1f
,
0x18c0001f
,
0x10004094
,
0x1910001f
,
0x1020e374
,
0xe0c00004
,
0x18c0001f
,
0x10004098
,
0x1910001f
,
0x1020e378
,
0xe0c00004
,
0x18c0001f
,
0x10011094
,
0x1910001f
,
0x10213374
,
0xe0c00004
,
0x18c0001f
,
0x10011098
,
0x1910001f
,
0x10213378
,
0xe0c00004
,
0x1910001f
,
0x10213378
,
0x18c0001f
,
0x10006234
,
0xc0c03360
,
0x17c07c1f
,
0xc2803780
,
0x1290841f
,
0xa1d20407
,
0x81f28407
,
0xa1d68407
,
0xa0128400
,
0xa0118400
,
0xa0100400
,
0xa01a8400
,
0xa01a0400
,
0x19c0001f
,
0x001c239f
,
0x1b00001f
,
0x3fffefff
,
0xf0000000
,
0x17c07c1f
,
0x808d8001
,
0xd8201422
,
0x17c07c1f
,
0x803d8400
,
0x1b80001f
,
0x2000001a
,
0x80340400
,
0x17c07c1f
,
0x17c07c1f
,
0x80310400
,
0x81fa0407
,
0x81f18407
,
0x81f08407
,
0xa1dc0407
,
0x1b80001f
,
0x200000b6
,
0xd00020e0
,
0x17c07c1f
,
0x1880001f
,
0x20000208
,
0x81411801
,
0xd8001605
,
0x17c07c1f
,
0xe8208000
,
0x1000f600
,
0xd2000000
,
0x1380081f
,
0x18c0001f
,
0x10006240
,
0xe0e00016
,
0xe0e0001e
,
0xe0e0000e
,
0xe0e0000f
,
0x80368400
,
0x1380081f
,
0x80370400
,
0x1380081f
,
0x80360400
,
0x803e0400
,
0x1380081f
,
0x80380400
,
0x803b0400
,
0xa01d8400
,
0x1b80001f
,
0x20000034
,
0x803d8400
,
0x1b80001f
,
0x20000152
,
0x803d0400
,
0x1380081f
,
0x18c0001f
,
0x1000f5c8
,
0x1910001f
,
0x1000f5c8
,
0xa1000404
,
0xe0c00004
,
0x18c0001f
,
0x100125c8
,
0x1910001f
,
0x100125c8
,
0xa1000404
,
0xe0c00004
,
0x1910001f
,
0x100125c8
,
0x80340400
,
0x17c07c1f
,
0x17c07c1f
,
0x80310400
,
0xe8208000
,
0x10000044
,
0x00000100
,
0x1b80001f
,
0x20000068
,
0x1b80001f
,
0x2000000a
,
0x18c0001f
,
0x10006240
,
0xe0e0000d
,
0xd8001e65
,
0x17c07c1f
,
0x18c0001f
,
0x100040f4
,
0x1910001f
,
0x100040f4
,
0xa11c8404
,
0xe0c00004
,
0x1b80001f
,
0x2000000a
,
0x813c8404
,
0xe0c00004
,
0x18c0001f
,
0x100110f4
,
0x1910001f
,
0x100110f4
,
0xa11c8404
,
0xe0c00004
,
0x1b80001f
,
0x2000000a
,
0x813c8404
,
0xe0c00004
,
0x1b80001f
,
0x20000100
,
0x81fa0407
,
0x81f18407
,
0x81f08407
,
0xe8208000
,
0x10006354
,
0xfffe7b47
,
0x18c0001f
,
0x65930003
,
0xc0c03080
,
0x17c07c1f
,
0xa1d80407
,
0xa1dc0407
,
0x18c0001f
,
0x10006608
,
0x1910001f
,
0x10006608
,
0xa11b0404
,
0xe0c00004
,
0xc2803780
,
0x1291041f
,
0x8880000c
,
0x2f7be75f
,
0xd8202222
,
0x17c07c1f
,
0x1b00001f
,
0x3fffe7ff
,
0xd0002260
,
0x17c07c1f
,
0x1b00001f
,
0xbfffe7ff
,
0xf0000000
,
0x17c07c1f
,
0x1890001f
,
0x10006608
,
0x808b0801
,
0xd8202502
,
0x17c07c1f
,
0x1880001f
,
0x10006320
,
0xc0c03400
,
0xe080000f
,
0xd8002663
,
0x17c07c1f
,
0xe080001f
,
0xa1da0407
,
0x81fc0407
,
0xa0110400
,
0xa0140400
,
0xa01d8400
,
0xd0002fc0
,
0x17c07c1f
,
0x1b80001f
,
0x20000fdf
,
0x1890001f
,
0x10006608
,
0x80c98801
,
0x810a8801
,
0x10918c1f
,
0xa0939002
,
0x8080080d
,
0xd82027a2
,
0x12007c1f
,
0x1b00001f
,
0x3fffe7ff
,
0x1b80001f
,
0x20000004
,
0xd800304c
,
0x17c07c1f
,
0x1b00001f
,
0xbfffe7ff
,
0xd0003040
,
0x17c07c1f
,
0x81f80407
,
0x81fc0407
,
0x18c0001f
,
0x65930006
,
0xc0c03080
,
0x17c07c1f
,
0x18c0001f
,
0x65930007
,
0xc0c03080
,
0x17c07c1f
,
0x1880001f
,
0x10006320
,
0xc0c03400
,
0xe080000f
,
0xd8002663
,
0x17c07c1f
,
0xe080001f
,
0x18c0001f
,
0x65930005
,
0xc0c03080
,
0x17c07c1f
,
0xa1da0407
,
0xe8208000
,
0x10000048
,
0x00000100
,
0x1b80001f
,
0x20000068
,
0xa0110400
,
0xa0140400
,
0x18c0001f
,
0x1000f5c8
,
0x1910001f
,
0x1000f5c8
,
0x81200404
,
0xe0c00004
,
0x18c0001f
,
0x100125c8
,
0x1910001f
,
0x100125c8
,
0x81200404
,
0xe0c00004
,
0x1910001f
,
0x100125c8
,
0xa01d0400
,
0xa01b0400
,
0xa0180400
,
0x803d8400
,
0xa01e0400
,
0xa0160400
,
0xa0170400
,
0xa0168400
,
0x1b80001f
,
0x20000104
,
0x81411801
,
0xd8002f85
,
0x17c07c1f
,
0x18c0001f
,
0x10006240
,
0xc0c03360
,
0x17c07c1f
,
0xe8208000
,
0x1000f600
,
0xd2000001
,
0xd8000768
,
0x17c07c1f
,
0xc2803780
,
0x1291841f
,
0x1b00001f
,
0x7ffff7ff
,
0xf0000000
,
0x17c07c1f
,
0x1900001f
,
0x10006830
,
0xe1000003
,
0x18c0001f
,
0x10006834
,
0xe0e00000
,
0xe0e00001
,
0xf0000000
,
0x17c07c1f
,
0xe0f07f16
,
0x1380201f
,
0xe0f07f1e
,
0x1380201f
,
0xe0f07f0e
,
0x1b80001f
,
0x20000104
,
0xe0f07f0c
,
0xe0f07f0d
,
0xe0f07e0d
,
0xe0f07c0d
,
0xe0f0780d
,
0xf0000000
,
0xe0f0700d
,
0xe0f07f0d
,
0xe0f07f0f
,
0xe0f07f1e
,
0xf0000000
,
0xe0f07f12
,
0x11407c1f
,
0x81f08407
,
0x81f18407
,
0x1b80001f
,
0x20000001
,
0xa1d08407
,
0xa1d18407
,
0x1392841f
,
0x812ab401
,
0x80ebb401
,
0xa0c00c04
,
0xd8203603
,
0x17c07c1f
,
0x80c01403
,
0xd8203423
,
0x01400405
,
0x1900001f
,
0x10006814
,
0xf0000000
,
0xe1000003
,
0xa1d00407
,
0x1b80001f
,
0x20000208
,
0x80ea3401
,
0x1a00001f
,
0x10006814
,
0xf0000000
,
0xe2000003
,
0x18c0001f
,
0x10006b6c
,
0x1910001f
,
0x10006b6c
,
0xa1002804
,
0xf0000000
,
0xe0c00004
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x17c07c1f
,
0x1840001f
,
0x00000001
,
0xa1d48407
,
0x1990001f
,
0x10006b08
,
0x1a50001f
,
0x10006610
,
0x8246a401
,
0xe8208000
,
0x10006b6c
,
0x00000000
,
0x1b00001f
,
0x2f7be75f
,
0x81469801
,
0xd8004305
,
0x17c07c1f
,
0x1b80001f
,
0xd00f0000
,
0x8880000c
,
0x2f7be75f
,
0xd8005d62
,
0x17c07c1f
,
0xd0004340
,
0x17c07c1f
,
0x1b80001f
,
0x500f0000
,
0xe8208000
,
0x10006354
,
0xfffe7b47
,
0xc0c06900
,
0x81401801
,
0xd80048a5
,
0x17c07c1f
,
0x81f60407
,
0x18c0001f
,
0x10006200
,
0xc0c05e20
,
0x12807c1f
,
0xe8208000
,
0x1000625c
,
0x00000001
,
0x1b80001f
,
0x20000080
,
0xc0c05e20
,
0x1280041f
,
0x18c0001f
,
0x10006204
,
0xc0c061c0
,
0x1280041f
,
0x18c0001f
,
0x10006208
,
0xc0c05e20
,
0x12807c1f
,
0xe8208000
,
0x10006244
,
0x00000001
,
0x1b80001f
,
0x20000080
,
0xc0c05e20
,
0x1280041f
,
0x18c0001f
,
0x10006290
,
0xc0c05e20
,
0x1280041f
,
0xe8208000
,
0x10006404
,
0x00003101
,
0xc2803780
,
0x1292041f
,
0x81469801
,
0xd8204a05
,
0x17c07c1f
,
0x1b00001f
,
0x2f7be75f
,
0x1b80001f
,
0x30000004
,
0x8880000c
,
0x2f7be75f
,
0xd80057c2
,
0x17c07c1f
,
0xc0c06480
,
0x17c07c1f
,
0x18c0001f
,
0x10006294
,
0xe0f07fff
,
0xe0e00fff
,
0xe0e000ff
,
0x81449801
,
0xd8004c45
,
0x17c07c1f
,
0x1a00001f
,
0x10006604
,
0xe2200003
,
0xc0c06540
,
0x17c07c1f
,
0xe2200005
,
0xc0c06540
,
0x17c07c1f
,
0xa1d38407
,
0xa1d98407
,
0x1800001f
,
0x00000012
,
0x1800001f
,
0x00000e12
,
0x1800001f
,
0x03800e12
,
0x1800001f
,
0x038e0e12
,
0xe8208000
,
0x10006310
,
0x0b1600f8
,
0x1b00001f
,
0xbfffe7ff
,
0x1b80001f
,
0x90100000
,
0x80c00400
,
0xd8204f63
,
0xa1d58407
,
0xa1dd8407
,
0x1b00001f
,
0x3fffefff
,
0xd0004e20
,
0x17c07c1f
,
0x1890001f
,
0x100063e8
,
0x88c0000c
,
0x2f7be75f
,
0xd8005183
,
0x17c07c1f
,
0x80c40001
,
0xd8005103
,
0x17c07c1f
,
0x1b00001f
,
0xbfffe7ff
,
0xd0005140
,
0x17c07c1f
,
0x1b00001f
,
0x7ffff7ff
,
0xd0004e20
,
0x17c07c1f
,
0x80c40001
,
0xd8205283
,
0x17c07c1f
,
0xa1de0407
,
0x1b00001f
,
0x7fffe7ff
,
0xd0004e20
,
0x17c07c1f
,
0x18c0001f
,
0x10006294
,
0xe0e001fe
,
0xe0e003fc
,
0xe0e007f8
,
0xe0e00ff0
,
0x1b80001f
,
0x20000020
,
0xe0f07ff0
,
0xe0f07f00
,
0x81449801
,
0xd8005565
,
0x17c07c1f
,
0x1a00001f
,
0x10006604
,
0xe2200002
,
0xc0c06540
,
0x17c07c1f
,
0xe2200004
,
0xc0c06540
,
0x17c07c1f
,
0x1b80001f
,
0x200016a8
,
0x1800001f
,
0x03800e12
,
0x1b80001f
,
0x20000300
,
0x1800001f
,
0x00000e12
,
0x1b80001f
,
0x20000300
,
0x1800001f
,
0x00000012
,
0x1b80001f
,
0x20000104
,
0x10007c1f
,
0x81f38407
,
0x81f98407
,
0x81f90407
,
0x81f40407
,
0x1b80001f
,
0x200016a8
,
0x81401801
,
0xd8005d65
,
0x17c07c1f
,
0xe8208000
,
0x10006404
,
0x00002101
,
0x18c0001f
,
0x10006290
,
0x1212841f
,
0xc0c05fa0
,
0x12807c1f
,
0xc0c05fa0
,
0x1280041f
,
0x18c0001f
,
0x10006208
,
0x1212841f
,
0xc0c05fa0
,
0x12807c1f
,
0xe8208000
,
0x10006244
,
0x00000000
,
0x1b80001f
,
0x20000080
,
0xc0c05fa0
,
0x1280041f
,
0xe8208000
,
0x10200268
,
0x000ffffe
,
0x18c0001f
,
0x10006204
,
0x1212841f
,
0xc0c06300
,
0x1280041f
,
0x18c0001f
,
0x10006200
,
0x1212841f
,
0xc0c05fa0
,
0x12807c1f
,
0xe8208000
,
0x1000625c
,
0x00000000
,
0x1b80001f
,
0x20000080
,
0xc0c05fa0
,
0x1280041f
,
0x19c0001f
,
0x01411820
,
0x1ac0001f
,
0x55aa55aa
,
0x10007c1f
,
0xf0000000
,
0xd8005eca
,
0x17c07c1f
,
0xe2e0004f
,
0xe2e0006f
,
0xe2e0002f
,
0xd8205f6a
,
0x17c07c1f
,
0xe2e0002e
,
0xe2e0003e
,
0xe2e00032
,
0xf0000000
,
0x17c07c1f
,
0xd800606a
,
0x17c07c1f
,
0xe2e00036
,
0xe2e0003e
,
0x1380201f
,
0xe2e0003c
,
0xd820618a
,
0x17c07c1f
,
0x1380201f
,
0xe2e0007c
,
0x1b80001f
,
0x20000003
,
0xe2e0005c
,
0xe2e0004c
,
0xe2e0004d
,
0xf0000000
,
0x17c07c1f
,
0xd82062c9
,
0x17c07c1f
,
0xe2e0000d
,
0xe2e0000c
,
0xe2e0001c
,
0xe2e0001e
,
0xe2e00016
,
0xe2e00012
,
0xf0000000
,
0x17c07c1f
,
0xd8206449
,
0x17c07c1f
,
0xe2e00016
,
0x1380201f
,
0xe2e0001e
,
0x1380201f
,
0xe2e0001c
,
0x1380201f
,
0xe2e0000c
,
0xe2e0000d
,
0xf0000000
,
0x17c07c1f
,
0xa1d40407
,
0x1391841f
,
0xa1d90407
,
0x1393041f
,
0xf0000000
,
0x17c07c1f
,
0x18d0001f
,
0x10006604
,
0x10cf8c1f
,
0xd8206543
,
0x17c07c1f
,
0xf0000000
,
0x17c07c1f
,
0xe8208000
,
0x11008014
,
0x00000002
,
0xe8208000
,
0x11008020
,
0x00000101
,
0xe8208000
,
0x11008004
,
0x000000d0
,
0x1a00001f
,
0x11008000
,
0xd800680a
,
0xe220005d
,
0xd820682a
,
0xe2200000
,
0xe2200001
,
0xe8208000
,
0x11008024
,
0x00000001
,
0x1b80001f
,
0x20000424
,
0xf0000000
,
0x17c07c1f
,
0xa1d10407
,
0x1b80001f
,
0x20000020
,
0xf0000000
,
0x17c07c1f
};
/*
* PCM binary for suspend scenario
*/
static
const
struct
pcm_desc
suspend_pcm_ca7
=
{
.
version
=
"pcm_suspend_v32.18_20140721_mt8173_v00.03_MD32_EMPTY_CA7"
,
.
base
=
suspend_binary_ca7
,
.
size
=
845
,
.
sess
=
2
,
.
replace
=
0
,
.
vec0
=
EVENT_VEC
(
11
,
1
,
0
,
0
),
.
vec1
=
EVENT_VEC
(
12
,
1
,
0
,
54
),
.
vec2
=
EVENT_VEC
(
30
,
1
,
0
,
143
),
.
vec3
=
EVENT_VEC
(
31
,
1
,
0
,
277
),
};
/*
* SPM settings for suspend scenario
*/
static
struct
pwr_ctrl
spm_ctrl
=
{
.
wake_src
=
WAKE_SRC_FOR_SUSPEND
,
.
wake_src_md32
=
WAKE_SRC_FOR_MD32
,
.
r0_ctrl_en
=
1
,
.
r7_ctrl_en
=
1
,
.
infra_dcm_lock
=
1
,
.
wfi_op
=
WFI_OP_AND
,
.
pcm_apsrc_req
=
0
,
.
ca7top_idle_mask
=
0
,
.
ca15top_idle_mask
=
0
,
.
mcusys_idle_mask
=
0
,
.
disp_req_mask
=
0
,
.
mfg_req_mask
=
0
,
.
md32_req_mask
=
1
,
.
srclkenai_mask
=
1
,
.
ca7_wfi0_en
=
1
,
.
ca7_wfi1_en
=
1
,
.
ca7_wfi2_en
=
1
,
.
ca7_wfi3_en
=
1
,
.
ca15_wfi0_en
=
1
,
.
ca15_wfi1_en
=
1
,
.
ca15_wfi2_en
=
1
,
.
ca15_wfi3_en
=
1
,
};
/*
* go_to_sleep_before_wfi() - trigger SPM to enter suspend scenario
*/
static
void
go_to_sleep_before_wfi
(
const
unsigned
int
spm_flags
)
{
struct
pwr_ctrl
*
pwrctrl
;
pwrctrl
=
&
spm_ctrl
;
set_pwrctrl_pcm_flags
(
pwrctrl
,
spm_flags
);
spm_set_sysclk_settle
();
INFO
(
"sec = %u, wakesrc = 0x%x (%u)(%u)
\n
"
,
pwrctrl
->
timer_val
,
pwrctrl
->
wake_src
,
is_cpu_pdn
(
pwrctrl
->
pcm_flags
),
is_infra_pdn
(
pwrctrl
->
pcm_flags
));
spm_reset_and_init_pcm
();
spm_init_pcm_register
();
spm_set_power_control
(
pwrctrl
);
spm_set_wakeup_event
(
pwrctrl
);
spm_kick_pcm_to_run
(
pwrctrl
);
spm_init_event_vector
(
&
suspend_pcm_ca7
);
spm_kick_im_to_fetch
(
&
suspend_pcm_ca7
);
}
/*
* go_to_sleep_after_wfi() - get wakeup reason after
* leaving suspend scenario and clean up SPM settings
*/
static
enum
wake_reason_t
go_to_sleep_after_wfi
(
void
)
{
struct
wake_status
wakesta
;
static
enum
wake_reason_t
last_wr
=
WR_NONE
;
spm_get_wakeup_status
(
&
wakesta
);
spm_clean_after_wakeup
();
last_wr
=
spm_output_wake_reason
(
&
wakesta
);
return
last_wr
;
}
void
spm_system_suspend
(
void
)
{
spm_lock_get
();
go_to_sleep_before_wfi
(
spm_flags
);
set_suspend_ready
();
spm_lock_release
();
}
void
spm_system_suspend_finish
(
void
)
{
spm_lock_get
();
spm_wake_reason
=
go_to_sleep_after_wfi
();
INFO
(
"spm_wake_reason=%d
\n
"
,
spm_wake_reason
);
clear_all_ready
();
spm_lock_release
();
}
plat/mediatek/mt8173/drivers/spm/spm_suspend.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SPM_SUSPEND_H__
#define __SPM_SUSPEND_H__
/* cpu dormant return code */
#define CPU_DORMANT_RESET 0
#define CPU_DORMANT_ABORT 1
void
spm_system_suspend
(
void
);
void
spm_system_suspend_finish
(
void
);
#endif
/* __SPM_SUSPEND_H__*/
plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arch_helpers.h>
#include <mcucfg.h>
#include <mmio.h>
#include <mt8173_def.h>
#include <mt_cpuxgpt.h>
static
void
write_cpuxgpt
(
unsigned
int
reg_index
,
unsigned
int
value
)
{
mmio_write_32
((
uintptr_t
)
&
mt8173_mcucfg
->
xgpt_idx
,
reg_index
);
mmio_write_32
((
uintptr_t
)
&
mt8173_mcucfg
->
xgpt_ctl
,
value
);
}
static
void
cpuxgpt_set_init_cnt
(
unsigned
int
countH
,
unsigned
int
countL
)
{
write_cpuxgpt
(
INDEX_CNT_H_INIT
,
countH
);
/* update count when countL programmed */
write_cpuxgpt
(
INDEX_CNT_L_INIT
,
countL
);
}
void
generic_timer_backup
(
void
)
{
uint64_t
cval
;
cval
=
read_cntpct_el0
();
cpuxgpt_set_init_cnt
((
uint32_t
)(
cval
>>
32
),
(
uint32_t
)(
cval
&
0xffffffff
));
}
plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __MT_CPUXGPT_H__
#define __MT_CPUXGPT_H__
/* REG */
#define INDEX_CNT_L_INIT 0x008
#define INDEX_CNT_H_INIT 0x00C
void
generic_timer_backup
(
void
);
#endif
/* __MT_CPUXGPT_H__ */
plat/mediatek/mt8173/drivers/uart/8250_console.S
0 → 100644
View file @
aaa0567c
/*
*
Copyright
(
c
)
2015
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
*
*
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
*
list
of
conditions
and
the
following
disclaimer
.
*
*
Redistributions
in
binary
form
must
reproduce
the
above
copyright
notice
,
*
this
list
of
conditions
and
the
following
disclaimer
in
the
documentation
*
and
/
or
other
materials
provided
with
the
distribution
.
*
*
Neither
the
name
of
ARM
nor
the
names
of
its
contributors
may
be
used
*
to
endorse
or
promote
products
derived
from
this
software
without
specific
*
prior
written
permission
.
*
*
THIS
SOFTWARE
IS
PROVIDED
BY
THE
COPYRIGHT
HOLDERS
AND
CONTRIBUTORS
"AS IS"
*
AND
ANY
EXPRESS
OR
IMPLIED
WARRANTIES
,
INCLUDING
,
BUT
NOT
LIMITED
TO
,
THE
*
IMPLIED
WARRANTIES
OF
MERCHANTABILITY
AND
FITNESS
FOR
A
PARTICULAR
PURPOSE
*
ARE
DISCLAIMED
.
IN
NO
EVENT
SHALL
THE
COPYRIGHT
HOLDER
OR
CONTRIBUTORS
BE
*
LIABLE
FOR
ANY
DIRECT
,
INDIRECT
,
INCIDENTAL
,
SPECIAL
,
EXEMPLARY
,
OR
*
CONSEQUENTIAL
DAMAGES
(
INCLUDING
,
BUT
NOT
LIMITED
TO
,
PROCUREMENT
OF
*
SUBSTITUTE
GOODS
OR
SERVICES
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
*
INTERRUPTION
)
HOWEVER
CAUSED
AND
ON
ANY
THEORY
OF
LIABILITY
,
WHETHER
IN
*
CONTRACT
,
STRICT
LIABILITY
,
OR
TORT
(
INCLUDING
NEGLIGENCE
OR
OTHERWISE
)
*
ARISING
IN
ANY
WAY
OUT
OF
THE
USE
OF
THIS
SOFTWARE
,
EVEN
IF
ADVISED
OF
THE
*
POSSIBILITY
OF
SUCH
DAMAGE
.
*/
#include <asm_macros.S>
#include <uart8250.h>
.
globl
console_core_init
.
globl
console_core_putc
.
globl
console_core_getc
/
*
-----------------------------------------------
*
int
console_core_init
(
unsigned
long
base_addr
,
*
unsigned
int
uart_clk
,
unsigned
int
baud_rate
)
*
Function
to
initialize
the
console
without
a
*
C
Runtime
to
print
debug
information
.
This
*
function
will
be
accessed
by
console_init
and
*
crash
reporting
.
*
In
:
x0
-
console
base
address
*
w1
-
Uart
clock
in
Hz
*
w2
-
Baud
rate
*
Out
:
return
1
on
success
else
0
on
error
*
Clobber
list
:
x1
,
x2
,
x3
*
-----------------------------------------------
*/
func
console_core_init
/
*
Check
the
input
base
address
*/
cbz
x0
,
core_init_fail
/
*
Check
baud
rate
and
uart
clock
for
sanity
*/
cbz
w1
,
core_init_fail
cbz
w2
,
core_init_fail
/
*
Disable
interrupt
*/
str
wzr
,
[
x0
,
#
UART_IER
]
/
*
Force
DTR
and
RTS
to
high
*/
mov
w3
,
#(
UART_MCR_DTR
|
UART_MCR_RTS
)
str
w3
,
[
x0
,
#
UART_MCR
]
/
*
Check
high
speed
*/
movz
w3
,
#
:
abs_g1
:
115200
movk
w3
,
#
:
abs_g0_nc
:
115200
cmp
w2
,
w3
b.hi
1
f
/
*
Non
high
speed
*/
lsl
w2
,
w2
,
#
4
mov
w3
,
wzr
b
2
f
/
*
High
speed
*/
1
:
lsl
w2
,
w2
,
#
2
mov
w3
,
#
2
/
*
Set
high
speed
UART
register
*/
2
:
str
w3
,
[
x0
,
#
UART_HIGHSPEED
]
/
*
Calculate
divisor
*/
udiv
w3
,
w1
,
w2
/*
divisor
=
uartclk
/
(
quot
*
baudrate
)
*/
msub
w1
,
w3
,
w2
,
w1
/*
remainder
=
uartclk
%
(
quot
*
baudrate
)
*/
lsr
w2
,
w2
,
#
1
cmp
w1
,
w2
cinc
w3
,
w3
,
hs
/
*
Set
line
configuration
,
access
divisor
latches
*/
mov
w1
,
#(
UART_LCR_DLAB
|
UART_LCR_WLS_8
)
str
w1
,
[
x0
,
#
UART_LCR
]
/
*
Set
the
divisor
*/
and
w1
,
w3
,
#
0xff
str
w1
,
[
x0
,
#
UART_DLL
]
lsr
w1
,
w3
,
#
8
and
w1
,
w1
,
#
0xff
str
w1
,
[
x0
,
#
UART_DLH
]
/
*
Hide
the
divisor
latches
*/
mov
w1
,
#
UART_LCR_WLS_8
str
w1
,
[
x0
,
#
UART_LCR
]
/
*
Enable
FIFOs
,
and
clear
receive
and
transmit
*/
mov
w1
,
#(
UART_FCR_FIFO_EN
| UART_FCR_CLEAR_RCVR |
\
UART_FCR_CLEAR_XMIT
)
str
w1
,
[
x0
,
#
UART_FCR
]
mov
w0
,
#
1
ret
core_init_fail
:
mov
w0
,
wzr
ret
endfunc
console_core_init
/
*
--------------------------------------------------------
*
int
console_core_putc
(
int
c
,
unsigned
long
base_addr
)
*
Function
to
output
a
character
over
the
console
.
It
*
returns
the
character
printed
on
success
or
-
1
on
error
.
*
In
:
w0
-
character
to
be
printed
*
x1
-
console
base
address
*
Out
:
return
-
1
on
error
else
return
character
.
*
Clobber
list
:
x2
*
--------------------------------------------------------
*/
func
console_core_putc
/
*
Check
the
input
parameter
*/
cbz
x1
,
putc_error
/
*
Prepend
'\r'
to
'\n'
*/
cmp
w0
,
#
0xA
b.ne
2
f
/
*
Check
if
the
transmit
FIFO
is
full
*/
1
:
ldr
w2
,
[
x1
,
#
UART_LSR
]
and
w2
,
w2
,
#
UART_LSR_THRE
cbz
w2
,
1
b
mov
w2
,
#
0xD
str
w2
,
[
x1
,
#
UART_THR
]
/
*
Check
if
the
transmit
FIFO
is
full
*/
2
:
ldr
w2
,
[
x1
,
#
UART_LSR
]
and
w2
,
w2
,
#
UART_LSR_THRE
cbz
w2
,
2
b
str
w0
,
[
x1
,
#
UART_THR
]
ret
putc_error
:
mov
w0
,
#-
1
ret
endfunc
console_core_putc
/
*
---------------------------------------------
*
int
console_core_getc
(
unsigned
long
base_addr
)
*
Function
to
get
a
character
from
the
console
.
*
It
returns
the
character
grabbed
on
success
*
or
-
1
on
error
.
*
In
:
x0
-
console
base
address
*
Clobber
list
:
x0
,
x1
*
---------------------------------------------
*/
func
console_core_getc
cbz
x0
,
getc_error
/
*
Check
if
the
receive
FIFO
is
empty
*/
1
:
ldr
w1
,
[
x0
,
#
UART_LSR
]
tbz
w1
,
#
UART_LSR_DR
,
1
b
ldr
w0
,
[
x0
,
#
UART_RBR
]
ret
getc_error
:
mov
w0
,
#-
1
ret
endfunc
console_core_getc
plat/mediatek/mt8173/drivers/uart/uart8250.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __UART8250_H__
#define __UART8250_H__
/* UART register */
#define UART_RBR 0x00
/* Receive buffer register */
#define UART_DLL 0x00
/* Divisor latch lsb */
#define UART_THR 0x00
/* Transmit holding register */
#define UART_DLH 0x04
/* Divisor latch msb */
#define UART_IER 0x04
/* Interrupt enable register */
#define UART_FCR 0x08
/* FIFO control register */
#define UART_LCR 0x0c
/* Line control register */
#define UART_MCR 0x10
/* Modem control register */
#define UART_LSR 0x14
/* Line status register */
#define UART_HIGHSPEED 0x24
/* High speed UART */
/* FCR */
#define UART_FCR_FIFO_EN 0x01
/* enable FIFO */
#define UART_FCR_CLEAR_RCVR 0x02
/* clear the RCVR FIFO */
#define UART_FCR_CLEAR_XMIT 0x04
/* clear the XMIT FIFO */
/* LCR */
#define UART_LCR_WLS_8 0x03
/* 8 bit character length */
#define UART_LCR_DLAB 0x80
/* divisor latch access bit */
/* MCR */
#define UART_MCR_DTR 0x01
#define UART_MCR_RTS 0x02
/* LSR */
#define UART_LSR_DR 0x01
/* Data ready */
#define UART_LSR_THRE 0x20
/* Xmit holding register empty */
#endif
/* __UART8250_H__ */
plat/mediatek/mt8173/include/mcucfg.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __MCUCFG_H__
#define __MCUCFG_H__
#include <mt8173_def.h>
#include <stdint.h>
struct
mt8173_mcucfg_regs
{
uint32_t
mp0_ca7l_cache_config
;
struct
{
uint32_t
mem_delsel0
;
uint32_t
mem_delsel1
;
}
mp0_cpu
[
4
];
uint32_t
mp0_cache_mem_delsel0
;
uint32_t
mp0_cache_mem_delsel1
;
uint32_t
mp0_axi_config
;
uint32_t
mp0_misc_config
[
2
];
struct
{
uint32_t
rv_addr_lw
;
uint32_t
rv_addr_hw
;
}
mp0_rv_addr
[
4
];
uint32_t
mp0_ca7l_cfg_dis
;
uint32_t
mp0_ca7l_clken_ctrl
;
uint32_t
mp0_ca7l_rst_ctrl
;
uint32_t
mp0_ca7l_misc_config
;
uint32_t
mp0_ca7l_dbg_pwr_ctrl
;
uint32_t
mp0_rw_rsvd0
;
uint32_t
mp0_rw_rsvd1
;
uint32_t
mp0_ro_rsvd
;
uint32_t
reserved0_0
[
100
];
uint32_t
mp1_cpucfg
;
uint32_t
mp1_miscdbg
;
uint32_t
reserved0_1
[
13
];
uint32_t
mp1_rst_ctl
;
uint32_t
mp1_clkenm_div
;
uint32_t
reserved0_2
[
7
];
uint32_t
mp1_config_res
;
uint32_t
reserved0_3
[
13
];
struct
{
uint32_t
rv_addr_lw
;
uint32_t
rv_addr_hw
;
}
mp1_rv_addr
[
2
];
uint32_t
reserved0_4
[
84
];
uint32_t
mp0_rst_status
;
/* 0x400 */
uint32_t
mp0_dbg_ctrl
;
uint32_t
mp0_dbg_flag
;
uint32_t
mp0_ca7l_ir_mon
;
struct
{
uint32_t
pc_lw
;
uint32_t
pc_hw
;
uint32_t
fp_arch32
;
uint32_t
sp_arch32
;
uint32_t
fp_arch64_lw
;
uint32_t
fp_arch64_hw
;
uint32_t
sp_arch64_lw
;
uint32_t
sp_arch64_hw
;
}
mp0_dbg_core
[
4
];
uint32_t
dfd_ctrl
;
uint32_t
dfd_cnt_l
;
uint32_t
dfd_cnt_h
;
uint32_t
misccfg_mp0_rw_rsvd
;
uint32_t
misccfg_sec_vio_status0
;
uint32_t
misccfg_sec_vio_status1
;
uint32_t
reserved1
[
22
];
uint32_t
misccfg_rw_rsvd
;
/* 0x500 */
uint32_t
mcusys_dbg_mon_sel_a
;
uint32_t
mcusys_dbg_mon
;
uint32_t
reserved2
[
61
];
uint32_t
mcusys_config_a
;
/* 0x600 */
uint32_t
mcusys_config1_a
;
uint32_t
mcusys_gic_peribase_a
;
uint32_t
reserved3
;
uint32_t
sec_range0_start
;
/* 0x610 */
uint32_t
sec_range0_end
;
uint32_t
sec_range_enable
;
uint32_t
reserved4
;
uint32_t
int_pol_ctl
[
8
];
/* 0x620 */
uint32_t
aclken_div
;
/* 0x640 */
uint32_t
pclken_div
;
uint32_t
l2c_sram_ctrl
;
uint32_t
armpll_jit_ctrl
;
uint32_t
cci_addrmap
;
/* 0x650 */
uint32_t
cci_config
;
uint32_t
cci_periphbase
;
uint32_t
cci_nevntcntovfl
;
uint32_t
cci_clk_ctrl
;
/* 0x660 */
uint32_t
cci_acel_s1_ctrl
;
uint32_t
bus_fabric_dcm_ctrl
;
uint32_t
reserved5
;
uint32_t
xgpt_ctl
;
/* 0x670 */
uint32_t
xgpt_idx
;
uint32_t
ptpod2_ctl0
;
uint32_t
ptpod2_ctl1
;
uint32_t
mcusys_revid
;
uint32_t
mcusys_rw_rsvd0
;
uint32_t
mcusys_rw_rsvd1
;
};
static
struct
mt8173_mcucfg_regs
*
const
mt8173_mcucfg
=
(
void
*
)
MCUCFG_BASE
;
/* cpu boot mode */
enum
{
MP0_CPUCFG_64BIT_SHIFT
=
12
,
MP1_CPUCFG_64BIT_SHIFT
=
28
,
MP0_CPUCFG_64BIT
=
0xf
<<
MP0_CPUCFG_64BIT_SHIFT
,
MP1_CPUCFG_64BIT
=
0xf
<<
MP1_CPUCFG_64BIT_SHIFT
};
/* scu related */
enum
{
MP0_ACINACTM_SHIFT
=
4
,
MP1_ACINACTM_SHIFT
=
0
,
MP0_ACINACTM
=
1
<<
MP0_ACINACTM_SHIFT
,
MP1_ACINACTM
=
1
<<
MP1_ACINACTM_SHIFT
};
enum
{
MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT
=
0
,
MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT
=
4
,
MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT
=
8
,
MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT
=
12
,
MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT
=
16
,
MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK
=
0xf
<<
MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT
,
MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK
=
0xf
<<
MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT
,
MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK
=
0xf
<<
MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT
,
MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK
=
0xf
<<
MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT
,
MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK
=
0xf
<<
MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT
};
enum
{
MP1_AINACTS_SHIFT
=
4
,
MP1_AINACTS
=
1
<<
MP1_AINACTS_SHIFT
};
enum
{
MP1_SW_CG_GEN_SHIFT
=
12
,
MP1_SW_CG_GEN
=
1
<<
MP1_SW_CG_GEN_SHIFT
};
enum
{
MP1_L2RSTDISABLE_SHIFT
=
14
,
MP1_L2RSTDISABLE
=
1
<<
MP1_L2RSTDISABLE_SHIFT
};
#endif
/* __MCUCFG_H__ */
plat/mediatek/mt8173/include/plat_macros.S
0 → 100644
View file @
aaa0567c
/*
*
Copyright
(
c
)
2014
-
2015
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
*
*
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
*
list
of
conditions
and
the
following
disclaimer
.
*
*
Redistributions
in
binary
form
must
reproduce
the
above
copyright
notice
,
*
this
list
of
conditions
and
the
following
disclaimer
in
the
documentation
*
and
/
or
other
materials
provided
with
the
distribution
.
*
*
Neither
the
name
of
ARM
nor
the
names
of
its
contributors
may
be
used
*
to
endorse
or
promote
products
derived
from
this
software
without
specific
*
prior
written
permission
.
*
*
THIS
SOFTWARE
IS
PROVIDED
BY
THE
COPYRIGHT
HOLDERS
AND
CONTRIBUTORS
"AS IS"
*
AND
ANY
EXPRESS
OR
IMPLIED
WARRANTIES
,
INCLUDING
,
BUT
NOT
LIMITED
TO
,
THE
*
IMPLIED
WARRANTIES
OF
MERCHANTABILITY
AND
FITNESS
FOR
A
PARTICULAR
PURPOSE
*
ARE
DISCLAIMED
.
IN
NO
EVENT
SHALL
THE
COPYRIGHT
HOLDER
OR
CONTRIBUTORS
BE
*
LIABLE
FOR
ANY
DIRECT
,
INDIRECT
,
INCIDENTAL
,
SPECIAL
,
EXEMPLARY
,
OR
*
CONSEQUENTIAL
DAMAGES
(
INCLUDING
,
BUT
NOT
LIMITED
TO
,
PROCUREMENT
OF
*
SUBSTITUTE
GOODS
OR
SERVICES
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
*
INTERRUPTION
)
HOWEVER
CAUSED
AND
ON
ANY
THEORY
OF
LIABILITY
,
WHETHER
IN
*
CONTRACT
,
STRICT
LIABILITY
,
OR
TORT
(
INCLUDING
NEGLIGENCE
OR
OTHERWISE
)
*
ARISING
IN
ANY
WAY
OUT
OF
THE
USE
OF
THIS
SOFTWARE
,
EVEN
IF
ADVISED
OF
THE
*
POSSIBILITY
OF
SUCH
DAMAGE
.
*/
#include <cci.h>
#include <gic_v2.h>
#include <mt8173_def.h>
.
section
.
rodata.
gic_reg_name
,
"aS"
gicc_regs
:
.
asciz
"gicc_hppir"
,
"gicc_ahppir"
,
"gicc_ctlr"
,
""
gicd_pend_reg
:
.
asciz
"gicd_ispendr regs (Offsets 0x200 - 0x278)\n"
\
"
Offset
:\
t
\
t
\
tvalue
\
n
"
newline
:
.
asciz
"\n"
spacer
:
.
asciz
":\t\t0x"
/
*
---------------------------------------------
*
The
below
macro
prints
out
relevant
GIC
*
registers
whenever
an
unhandled
exception
is
*
taken
in
BL3
-
1
.
*
Clobbers
:
x0
-
x10
,
x16
,
x17
,
sp
*
---------------------------------------------
*/
.
macro
plat_print_gic_regs
mov_imm
x16
,
BASE_GICD_BASE
mov_imm
x17
,
BASE_GICC_BASE
/
*
Load
the
gicc
reg
list
to
x6
*/
adr
x6
,
gicc_regs
/
*
Load
the
gicc
regs
to
gp
regs
used
by
str_in_crash_buf_print
*/
ldr
w8
,
[
x17
,
#
GICC_HPPIR
]
ldr
w9
,
[
x17
,
#
GICC_AHPPIR
]
ldr
w10
,
[
x17
,
#
GICC_CTLR
]
/
*
Store
to
the
crash
buf
and
print
to
console
*/
bl
str_in_crash_buf_print
/
*
Print
the
GICD_ISPENDR
regs
*/
add
x7
,
x16
,
#
GICD_ISPENDR
adr
x4
,
gicd_pend_reg
bl
asm_print_str
gicd_ispendr_loop
:
sub
x4
,
x7
,
x16
cmp
x4
,
#
0x280
b.eq
exit_print_gic_regs
bl
asm_print_hex
adr
x4
,
spacer
bl
asm_print_str
ldr
x4
,
[
x7
],
#
8
bl
asm_print_hex
adr
x4
,
newline
bl
asm_print_str
b
gicd_ispendr_loop
exit_print_gic_regs
:
.
endm
.
section
.
rodata.
cci_reg_name
,
"aS"
cci_iface_regs
:
.
asciz
"cci_snoop_ctrl_cluster0"
,
"cci_snoop_ctrl_cluster1"
,
""
/
*
------------------------------------------------
*
The
below
macro
prints
out
relevant
interconnect
*
registers
whenever
an
unhandled
exception
is
*
taken
in
BL3
-
1
.
*
Clobbers
:
x0
-
x9
,
sp
*
------------------------------------------------
*/
.
macro
plat_print_interconnect_regs
adr
x6
,
cci_iface_regs
/
*
Store
in
x7
the
base
address
of
the
first
interface
*/
mov_imm
x7
,
(
PLAT_MT_CCI_BASE
+
SLAVE_IFACE_OFFSET
(
\
PLAT_MT_CCI_CLUSTER0_SL_IFACE_IX
))
ldr
w8
,
[
x7
,
#
SNOOP_CTRL_REG
]
/
*
Store
in
x7
the
base
address
of
the
second
interface
*/
mov_imm
x7
,
(
PLAT_MT_CCI_BASE
+
SLAVE_IFACE_OFFSET
(
\
PLAT_MT_CCI_CLUSTER1_SL_IFACE_IX
))
ldr
w9
,
[
x7
,
#
SNOOP_CTRL_REG
]
/
*
Store
to
the
crash
buf
and
print
to
console
*/
bl
str_in_crash_buf_print
.
endm
plat/mediatek/mt8173/include/platform_def.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __PLATFORM_DEF_H__
#define __PLATFORM_DEF_H__
#define DEBUG_XLAT_TABLE 0
/*******************************************************************************
* Platform binary types for linking
******************************************************************************/
#define PLATFORM_LINKER_FORMAT "elf64-littleaarch64"
#define PLATFORM_LINKER_ARCH aarch64
/*******************************************************************************
* Generic platform constants
******************************************************************************/
/* Size of cacheable stacks */
#if DEBUG_XLAT_TABLE
#define PLATFORM_STACK_SIZE 0x800
#elif IMAGE_BL1
#define PLATFORM_STACK_SIZE 0x440
#elif IMAGE_BL2
#define PLATFORM_STACK_SIZE 0x400
#elif IMAGE_BL31
#define PLATFORM_STACK_SIZE 0x800
#elif IMAGE_BL32
#define PLATFORM_STACK_SIZE 0x440
#endif
#define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n"
#define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2
#define PLATFORM_SYSTEM_COUNT 1
#define PLATFORM_CLUSTER_COUNT 2
#define PLATFORM_CLUSTER0_CORE_COUNT 4
#define PLATFORM_CLUSTER1_CORE_COUNT 2
#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \
PLATFORM_CLUSTER0_CORE_COUNT)
#define PLATFORM_MAX_CPUS_PER_CLUSTER 4
#define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \
PLATFORM_CLUSTER_COUNT + \
PLATFORM_CORE_COUNT)
/*******************************************************************************
* Platform memory map related constants
******************************************************************************/
/* TF txet, ro, rw, internal SRAM, Size: release: 80KB, debug: 92KB */
#define TZRAM_BASE (0x100000)
#if DEBUG
#define TZRAM_SIZE (0x20000)
#else
#define TZRAM_SIZE (0x20000)
#endif
/* xlat_table , coherence ram, 64KB */
#define TZRAM2_BASE (TZRAM_BASE + TZRAM_SIZE)
#define TZRAM2_SIZE (0x10000)
/*******************************************************************************
* BL31 specific defines.
******************************************************************************/
/*
* Put BL3-1 at the top of the Trusted SRAM (just below the shared memory, if
* present). BL31_BASE is calculated using the current BL3-1 debug size plus a
* little space for growth.
*/
#define BL31_BASE (TZRAM_BASE + 0x1000)
#define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE)
#define TZRAM2_LIMIT (TZRAM2_BASE + TZRAM2_SIZE)
/*******************************************************************************
* Platform specific page table and MMU setup constants
******************************************************************************/
#define ADDR_SPACE_SIZE (1ull << 32)
#define MAX_XLAT_TABLES 4
#define MAX_MMAP_REGIONS 16
/*******************************************************************************
* Declarations and constants to access the mailboxes safely. Each mailbox is
* aligned on the biggest cache line size in the platform. This is known only
* to the platform as it might have a combination of integrated and external
* caches. Such alignment ensures that two maiboxes do not sit on the same cache
* line at any cache level. They could belong to different cpus/clusters &
* get written while being protected by different locks causing corruption of
* a valid mailbox address.
******************************************************************************/
#define CACHE_WRITEBACK_SHIFT 6
#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
#endif
/* __PLATFORM_DEF_H__ */
plat/mediatek/mt8173/include/power_tracer.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __POWER_TRACER_H__
#define __POWER_TRACER_H__
#define CPU_UP 0
#define CPU_DOWN 1
#define CPU_SUSPEND 2
#define CLUSTER_UP 3
#define CLUSTER_DOWN 4
#define CLUSTER_SUSPEND 5
void
trace_power_flow
(
unsigned
long
mpidr
,
unsigned
char
mode
);
#endif
plat/mediatek/mt8173/include/scu.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SCU_H__
#define __SCU_H__
void
disable_scu
(
unsigned
long
mpidr
);
void
enable_scu
(
unsigned
long
mpidr
);
#endif
plat/mediatek/mt8173/mt8173_def.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __PLAT_DEF_H__
#define __PLAT_DEF_H__
#define MT8173_PRIMARY_CPU 0x0
/* Special value used to verify platform parameters from BL2 to BL3-1 */
#define MT_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL
#define IO_PHYS (0x10000000)
#define INFRACFG_AO_BASE (IO_PHYS + 0x1000)
#define GPIO_BASE (IO_PHYS + 0x5000)
#define SPM_BASE (IO_PHYS + 0x6000)
#define RGU_BASE (IO_PHYS + 0x7000)
#define PMIC_WRAP_BASE (IO_PHYS + 0xD000)
#define MCUCFG_BASE (IO_PHYS + 0x200000)
#define TRNG_base (IO_PHYS + 0x20F000)
#define MT_GIC_BASE (IO_PHYS + 0x220000)
#define PLAT_MT_CCI_BASE (IO_PHYS + 0x390000)
/* Aggregate of all devices in the first GB */
#define MTK_DEV_RNG0_BASE IO_PHYS
#define MTK_DEV_RNG0_SIZE 0x400000
#define MTK_DEV_RNG1_BASE (IO_PHYS + 0x1000000)
#define MTK_DEV_RNG1_SIZE 0x4000000
/*******************************************************************************
* UART related constants
******************************************************************************/
#define MT8173_UART0_BASE (IO_PHYS + 0x01002000)
#define MT8173_UART1_BASE (IO_PHYS + 0x01003000)
#define MT8173_UART2_BASE (IO_PHYS + 0x01004000)
#define MT8173_UART3_BASE (IO_PHYS + 0x01005000)
#define MT8173_BAUDRATE (115200)
#define MT8173_UART_CLOCK (26000000)
/*******************************************************************************
* System counter frequency related constants
******************************************************************************/
#define SYS_COUNTER_FREQ_IN_TICKS 13000000
#define SYS_COUNTER_FREQ_IN_MHZ 13
/*******************************************************************************
* GIC-400 & interrupt handling related constants
******************************************************************************/
/* Base MTK_platform compatible GIC memory map */
#define BASE_GICD_BASE (MT_GIC_BASE + 0x1000)
#define BASE_GICC_BASE (MT_GIC_BASE + 0x2000)
#define BASE_GICR_BASE 0
/* no GICR in GIC-400 */
#define BASE_GICH_BASE (MT_GIC_BASE + 0x4000)
#define BASE_GICV_BASE (MT_GIC_BASE + 0x6000)
#define INT_POL_CTL0 0x10200620
#define GIC_PRIVATE_SIGNALS (32)
/*******************************************************************************
* CCI-400 related constants
******************************************************************************/
#define PLAT_MT_CCI_CLUSTER0_SL_IFACE_IX 4
#define PLAT_MT_CCI_CLUSTER1_SL_IFACE_IX 3
/*******************************************************************************
* WDT related constants
******************************************************************************/
#define MTK_WDT_BASE (RGU_BASE + 0)
#define MTK_WDT_SWRST (MTK_WDT_BASE + 0x0014)
#define MTK_WDT_MODE_DUAL_MODE 0x0040
#define MTK_WDT_MODE_IRQ 0x0008
#define MTK_WDT_MODE_KEY 0x22000000
#define MTK_WDT_MODE_EXTEN 0x0004
#define MTK_WDT_SWRST_KEY 0x1209
/* FIQ platform related define */
#define MT_IRQ_SEC_SGI_0 8
#define MT_IRQ_SEC_SGI_1 9
#define MT_IRQ_SEC_SGI_2 10
#define MT_IRQ_SEC_SGI_3 11
#define MT_IRQ_SEC_SGI_4 12
#define MT_IRQ_SEC_SGI_5 13
#define MT_IRQ_SEC_SGI_6 14
#define MT_IRQ_SEC_SGI_7 15
#endif
/* __PLAT_DEF_H__ */
plat/mediatek/mt8173/plat_delay_timer.c
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arch_helpers.h>
#include <delay_timer.h>
#include <mt8173_def.h>
static
uint32_t
plat_get_timer_value
(
void
)
{
/* Generic delay timer implementation expects the timer to be a down
* counter. We apply bitwise NOT operator to the tick values returned
* by read_cntpct_el0() to simulate the down counter. */
return
(
uint32_t
)(
~
read_cntpct_el0
());
}
static
const
timer_ops_t
plat_timer_ops
=
{
.
get_timer_value
=
plat_get_timer_value
,
.
clk_mult
=
1
,
.
clk_div
=
SYS_COUNTER_FREQ_IN_MHZ
,
};
void
plat_delay_timer_init
(
void
)
{
timer_init
(
&
plat_timer_ops
);
}
plat/mediatek/mt8173/plat_mt_gic.c
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arm_gic.h>
#include <bl_common.h>
#include <mt8173_def.h>
const
unsigned
int
mt_irq_sec_array
[]
=
{
MT_IRQ_SEC_SGI_0
,
MT_IRQ_SEC_SGI_1
,
MT_IRQ_SEC_SGI_2
,
MT_IRQ_SEC_SGI_3
,
MT_IRQ_SEC_SGI_4
,
MT_IRQ_SEC_SGI_5
,
MT_IRQ_SEC_SGI_6
,
MT_IRQ_SEC_SGI_7
};
void
plat_mt_gic_init
(
void
)
{
arm_gic_init
(
BASE_GICC_BASE
,
BASE_GICD_BASE
,
BASE_GICR_BASE
,
mt_irq_sec_array
,
ARRAY_SIZE
(
mt_irq_sec_array
));
}
plat/mediatek/mt8173/plat_pm.c
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arch_helpers.h>
#include <arm_gic.h>
#include <assert.h>
#include <bakery_lock.h>
#include <cci.h>
#include <console.h>
#include <debug.h>
#include <errno.h>
#include <gpio.h>
#include <mcucfg.h>
#include <mmio.h>
#include <mt8173_def.h>
#include <mt_cpuxgpt.h>
/* generic_timer_backup() */
#include <plat_private.h>
#include <power_tracer.h>
#include <psci.h>
#include <rtc.h>
#include <scu.h>
#include <spm_hotplug.h>
#include <spm_mcdi.h>
#include <spm_suspend.h>
struct
core_context
{
unsigned
long
timer_data
[
8
];
unsigned
int
count
;
unsigned
int
rst
;
unsigned
int
abt
;
unsigned
int
brk
;
};
struct
cluster_context
{
struct
core_context
core
[
PLATFORM_MAX_CPUS_PER_CLUSTER
];
};
/*
* Top level structure to hold the complete context of a multi cluster system
*/
struct
system_context
{
struct
cluster_context
cluster
[
PLATFORM_CLUSTER_COUNT
];
};
/*
* Top level structure which encapsulates the context of the entire system
*/
static
struct
system_context
dormant_data
[
1
];
static
inline
struct
cluster_context
*
system_cluster
(
struct
system_context
*
system
,
uint32_t
clusterid
)
{
return
&
system
->
cluster
[
clusterid
];
}
static
inline
struct
core_context
*
cluster_core
(
struct
cluster_context
*
cluster
,
uint32_t
cpuid
)
{
return
&
cluster
->
core
[
cpuid
];
}
static
struct
cluster_context
*
get_cluster_data
(
unsigned
long
mpidr
)
{
uint32_t
clusterid
;
clusterid
=
(
mpidr
&
MPIDR_CLUSTER_MASK
)
>>
MPIDR_AFFINITY_BITS
;
return
system_cluster
(
dormant_data
,
clusterid
);
}
static
struct
core_context
*
get_core_data
(
unsigned
long
mpidr
)
{
struct
cluster_context
*
cluster
;
uint32_t
cpuid
;
cluster
=
get_cluster_data
(
mpidr
);
cpuid
=
mpidr
&
MPIDR_CPU_MASK
;
return
cluster_core
(
cluster
,
cpuid
);
}
static
void
mt_save_generic_timer
(
unsigned
long
*
container
)
{
uint64_t
ctl
;
uint64_t
val
;
__asm__
volatile
(
"mrs %x0, cntkctl_el1
\n\t
"
"mrs %x1, cntp_cval_el0
\n\t
"
"stp %x0, %x1, [%2, #0]"
:
"=&r"
(
ctl
),
"=&r"
(
val
)
:
"r"
(
container
)
:
"memory"
);
__asm__
volatile
(
"mrs %x0, cntp_tval_el0
\n\t
"
"mrs %x1, cntp_ctl_el0
\n\t
"
"stp %x0, %x1, [%2, #16]"
:
"=&r"
(
val
),
"=&r"
(
ctl
)
:
"r"
(
container
)
:
"memory"
);
__asm__
volatile
(
"mrs %x0, cntv_tval_el0
\n\t
"
"mrs %x1, cntv_ctl_el0
\n\t
"
"stp %x0, %x1, [%2, #32]"
:
"=&r"
(
val
),
"=&r"
(
ctl
)
:
"r"
(
container
)
:
"memory"
);
}
static
void
mt_restore_generic_timer
(
unsigned
long
*
container
)
{
uint64_t
ctl
;
uint64_t
val
;
__asm__
volatile
(
"ldp %x0, %x1, [%2, #0]
\n\t
"
"msr cntkctl_el1, %x0
\n\t
"
"msr cntp_cval_el0, %x1"
:
"=&r"
(
ctl
),
"=&r"
(
val
)
:
"r"
(
container
)
:
"memory"
);
__asm__
volatile
(
"ldp %x0, %x1, [%2, #16]
\n\t
"
"msr cntp_tval_el0, %x0
\n\t
"
"msr cntp_ctl_el0, %x1"
:
"=&r"
(
val
),
"=&r"
(
ctl
)
:
"r"
(
container
)
:
"memory"
);
__asm__
volatile
(
"ldp %x0, %x1, [%2, #32]
\n\t
"
"msr cntv_tval_el0, %x0
\n\t
"
"msr cntv_ctl_el0, %x1"
:
"=&r"
(
val
),
"=&r"
(
ctl
)
:
"r"
(
container
)
:
"memory"
);
}
static
inline
uint64_t
read_cntpctl
(
void
)
{
uint64_t
cntpctl
;
__asm__
volatile
(
"mrs %x0, cntp_ctl_el0"
:
"=r"
(
cntpctl
)
:
:
"memory"
);
return
cntpctl
;
}
static
inline
void
write_cntpctl
(
uint64_t
cntpctl
)
{
__asm__
volatile
(
"msr cntp_ctl_el0, %x0"
:
:
"r"
(
cntpctl
));
}
static
void
stop_generic_timer
(
void
)
{
/*
* Disable the timer and mask the irq to prevent
* suprious interrupts on this cpu interface. It
* will bite us when we come back if we don't. It
* will be replayed on the inbound cluster.
*/
uint64_t
cntpctl
=
read_cntpctl
();
write_cntpctl
(
clr_cntp_ctl_enable
(
cntpctl
));
}
static
void
mt_cpu_save
(
unsigned
long
mpidr
)
{
struct
core_context
*
core
;
core
=
get_core_data
(
mpidr
);
mt_save_generic_timer
(
core
->
timer_data
);
/* disable timer irq, and upper layer should enable it again. */
stop_generic_timer
();
}
static
void
mt_cpu_restore
(
unsigned
long
mpidr
)
{
struct
core_context
*
core
;
core
=
get_core_data
(
mpidr
);
mt_restore_generic_timer
(
core
->
timer_data
);
}
static
void
mt_platform_save_context
(
unsigned
long
mpidr
)
{
/* mcusys_save_context: */
mt_cpu_save
(
mpidr
);
}
static
void
mt_platform_restore_context
(
unsigned
long
mpidr
)
{
/* mcusys_restore_context: */
mt_cpu_restore
(
mpidr
);
}
/*******************************************************************************
* Private function which is used to determine if any platform actions
* should be performed for the specified affinity instance given its
* state. Nothing needs to be done if the 'state' is not off or if this is not
* the highest affinity level which will enter the 'state'.
*******************************************************************************/
static
int32_t
plat_do_plat_actions
(
unsigned
int
afflvl
,
unsigned
int
state
)
{
unsigned
int
max_phys_off_afflvl
;
assert
(
afflvl
<=
MPIDR_AFFLVL2
);
if
(
state
!=
PSCI_STATE_OFF
)
return
-
EAGAIN
;
/*
* Find the highest affinity level which will be suspended and postpone
* all the platform specific actions until that level is hit.
*/
max_phys_off_afflvl
=
psci_get_max_phys_off_afflvl
();
assert
(
max_phys_off_afflvl
!=
PSCI_INVALID_DATA
);
if
(
afflvl
!=
max_phys_off_afflvl
)
return
-
EAGAIN
;
return
0
;
}
/*******************************************************************************
* MTK_platform handler called when an affinity instance is about to enter
* standby.
******************************************************************************/
static
void
plat_affinst_standby
(
unsigned
int
power_state
)
{
unsigned
int
target_afflvl
;
/* Sanity check the requested state */
target_afflvl
=
psci_get_pstate_afflvl
(
power_state
);
/*
* It's possible to enter standby only on affinity level 0 i.e. a cpu
* on the MTK_platform. Ignore any other affinity level.
*/
if
(
target_afflvl
==
MPIDR_AFFLVL0
)
{
/*
* Enter standby state. dsb is good practice before using wfi
* to enter low power states.
*/
dsb
();
wfi
();
}
}
/*******************************************************************************
* MTK_platform handler called when an affinity instance is about to be turned
* on. The level and mpidr determine the affinity instance.
******************************************************************************/
static
int
plat_affinst_on
(
unsigned
long
mpidr
,
unsigned
long
sec_entrypoint
,
unsigned
int
afflvl
,
unsigned
int
state
)
{
int
rc
=
PSCI_E_SUCCESS
;
unsigned
long
cpu_id
;
unsigned
long
cluster_id
;
uintptr_t
rv
;
/*
* It's possible to turn on only affinity level 0 i.e. a cpu
* on the MTK_platform. Ignore any other affinity level.
*/
if
(
afflvl
!=
MPIDR_AFFLVL0
)
return
rc
;
cpu_id
=
mpidr
&
MPIDR_CPU_MASK
;
cluster_id
=
mpidr
&
MPIDR_CLUSTER_MASK
;
if
(
cluster_id
)
rv
=
(
uintptr_t
)
&
mt8173_mcucfg
->
mp1_rv_addr
[
cpu_id
].
rv_addr_lw
;
else
rv
=
(
uintptr_t
)
&
mt8173_mcucfg
->
mp0_rv_addr
[
cpu_id
].
rv_addr_lw
;
mmio_write_32
(
rv
,
sec_entrypoint
);
INFO
(
"mt_on[%ld:%ld], entry %x
\n
"
,
cluster_id
,
cpu_id
,
mmio_read_32
(
rv
));
spm_hotplug_on
(
mpidr
);
return
rc
;
}
/*******************************************************************************
* MTK_platform handler called when an affinity instance is about to be turned
* off. The level and mpidr determine the affinity instance. The 'state' arg.
* allows the platform to decide whether the cluster is being turned off and
* take apt actions.
*
* CAUTION: This function is called with coherent stacks so that caches can be
* turned off, flushed and coherency disabled. There is no guarantee that caches
* will remain turned on across calls to this function as each affinity level is
* dealt with. So do not write & read global variables across calls. It will be
* wise to do flush a write to the global to prevent unpredictable results.
******************************************************************************/
static
void
plat_affinst_off
(
unsigned
int
afflvl
,
unsigned
int
state
)
{
unsigned
long
mpidr
=
read_mpidr_el1
();
/* Determine if any platform actions need to be executed. */
if
(
plat_do_plat_actions
(
afflvl
,
state
)
==
-
EAGAIN
)
return
;
/* Prevent interrupts from spuriously waking up this cpu */
arm_gic_cpuif_deactivate
();
spm_hotplug_off
(
mpidr
);
trace_power_flow
(
mpidr
,
CPU_DOWN
);
if
(
afflvl
!=
MPIDR_AFFLVL0
)
{
/* Disable coherency if this cluster is to be turned off */
plat_cci_disable
();
trace_power_flow
(
mpidr
,
CLUSTER_DOWN
);
}
}
/*******************************************************************************
* MTK_platform handler called when an affinity instance is about to be
* suspended. The level and mpidr determine the affinity instance. The 'state'
* arg. allows the platform to decide whether the cluster is being turned off
* and take apt actions.
*
* CAUTION: This function is called with coherent stacks so that caches can be
* turned off, flushed and coherency disabled. There is no guarantee that caches
* will remain turned on across calls to this function as each affinity level is
* dealt with. So do not write & read global variables across calls. It will be
* wise to do flush a write to the global to prevent unpredictable results.
******************************************************************************/
static
void
plat_affinst_suspend
(
unsigned
long
sec_entrypoint
,
unsigned
int
afflvl
,
unsigned
int
state
)
{
unsigned
long
mpidr
=
read_mpidr_el1
();
unsigned
long
cluster_id
;
unsigned
long
cpu_id
;
uintptr_t
rv
;
/* Determine if any platform actions need to be executed. */
if
(
plat_do_plat_actions
(
afflvl
,
state
)
==
-
EAGAIN
)
return
;
cpu_id
=
mpidr
&
MPIDR_CPU_MASK
;
cluster_id
=
mpidr
&
MPIDR_CLUSTER_MASK
;
if
(
cluster_id
)
rv
=
(
uintptr_t
)
&
mt8173_mcucfg
->
mp1_rv_addr
[
cpu_id
].
rv_addr_lw
;
else
rv
=
(
uintptr_t
)
&
mt8173_mcucfg
->
mp0_rv_addr
[
cpu_id
].
rv_addr_lw
;
mmio_write_32
(
rv
,
sec_entrypoint
);
if
(
afflvl
==
MPIDR_AFFLVL0
)
spm_mcdi_prepare
(
mpidr
);
if
(
afflvl
>=
MPIDR_AFFLVL0
)
mt_platform_save_context
(
mpidr
);
/* Perform the common cluster specific operations */
if
(
afflvl
>=
MPIDR_AFFLVL1
)
{
/* Disable coherency if this cluster is to be turned off */
plat_cci_disable
();
disable_scu
(
mpidr
);
trace_power_flow
(
mpidr
,
CLUSTER_SUSPEND
);
}
if
(
afflvl
>=
MPIDR_AFFLVL2
)
{
generic_timer_backup
();
spm_system_suspend
();
/* Prevent interrupts from spuriously waking up this cpu */
arm_gic_cpuif_deactivate
();
}
}
/*******************************************************************************
* MTK_platform handler called when an affinity instance has just been powered
* on after being turned off earlier. The level and mpidr determine the affinity
* instance. The 'state' arg. allows the platform to decide whether the cluster
* was turned off prior to wakeup and do what's necessary to setup it up
* correctly.
******************************************************************************/
static
void
plat_affinst_on_finish
(
unsigned
int
afflvl
,
unsigned
int
state
)
{
unsigned
long
mpidr
=
read_mpidr_el1
();
/* Determine if any platform actions need to be executed. */
if
(
plat_do_plat_actions
(
afflvl
,
state
)
==
-
EAGAIN
)
return
;
/* Perform the common cluster specific operations */
if
(
afflvl
>=
MPIDR_AFFLVL1
)
{
enable_scu
(
mpidr
);
/* Enable coherency if this cluster was off */
plat_cci_enable
();
trace_power_flow
(
mpidr
,
CLUSTER_UP
);
}
/* Enable the gic cpu interface */
arm_gic_cpuif_setup
();
arm_gic_pcpu_distif_setup
();
trace_power_flow
(
mpidr
,
CPU_UP
);
}
/*******************************************************************************
* MTK_platform handler called when an affinity instance has just been powered
* on after having been suspended earlier. The level and mpidr determine the
* affinity instance.
******************************************************************************/
static
void
plat_affinst_suspend_finish
(
unsigned
int
afflvl
,
unsigned
int
state
)
{
unsigned
long
mpidr
=
read_mpidr_el1
();
/* Determine if any platform actions need to be executed. */
if
(
plat_do_plat_actions
(
afflvl
,
state
)
==
-
EAGAIN
)
return
;
if
(
afflvl
>=
MPIDR_AFFLVL2
)
{
/* Enable the gic cpu interface */
arm_gic_setup
();
arm_gic_cpuif_setup
();
spm_system_suspend_finish
();
}
/* Perform the common cluster specific operations */
if
(
afflvl
>=
MPIDR_AFFLVL1
)
{
enable_scu
(
mpidr
);
/* Enable coherency if this cluster was off */
plat_cci_enable
();
trace_power_flow
(
mpidr
,
CLUSTER_UP
);
}
if
(
afflvl
>=
MPIDR_AFFLVL0
)
mt_platform_restore_context
(
mpidr
);
if
(
afflvl
==
MPIDR_AFFLVL0
)
spm_mcdi_finish
(
mpidr
);
arm_gic_pcpu_distif_setup
();
}
static
unsigned
int
plat_get_sys_suspend_power_state
(
void
)
{
/* StateID: 0, StateType: 1(power down), PowerLevel: 2(system) */
return
psci_make_powerstate
(
0
,
1
,
2
);
}
/*******************************************************************************
* MTK handlers to shutdown/reboot the system
******************************************************************************/
static
void
__dead2
plat_system_off
(
void
)
{
INFO
(
"MTK System Off
\n
"
);
gpio_set
(
GPIO120
,
GPIO_OUT_ZERO
);
rtc_bbpu_power_down
();
wfi
();
ERROR
(
"MTK System Off: operation not handled.
\n
"
);
panic
();
}
static
void
__dead2
plat_system_reset
(
void
)
{
/* Write the System Configuration Control Register */
INFO
(
"MTK System Reset
\n
"
);
mmio_clrbits_32
(
MTK_WDT_BASE
,
(
MTK_WDT_MODE_DUAL_MODE
|
MTK_WDT_MODE_IRQ
));
mmio_setbits_32
(
MTK_WDT_BASE
,
(
MTK_WDT_MODE_KEY
|
MTK_WDT_MODE_EXTEN
));
mmio_setbits_32
(
MTK_WDT_SWRST
,
MTK_WDT_SWRST_KEY
);
wfi
();
ERROR
(
"MTK System Reset: operation not handled.
\n
"
);
panic
();
}
/*******************************************************************************
* Export the platform handlers to enable psci to invoke them
******************************************************************************/
static
const
plat_pm_ops_t
plat_plat_pm_ops
=
{
.
affinst_standby
=
plat_affinst_standby
,
.
affinst_on
=
plat_affinst_on
,
.
affinst_off
=
plat_affinst_off
,
.
affinst_suspend
=
plat_affinst_suspend
,
.
affinst_on_finish
=
plat_affinst_on_finish
,
.
affinst_suspend_finish
=
plat_affinst_suspend_finish
,
.
system_off
=
plat_system_off
,
.
system_reset
=
plat_system_reset
,
.
get_sys_suspend_power_state
=
plat_get_sys_suspend_power_state
,
};
/*******************************************************************************
* Export the platform specific power ops & initialize the mtk_platform power
* controller
******************************************************************************/
int
platform_setup_pm
(
const
plat_pm_ops_t
**
plat_ops
)
{
*
plat_ops
=
&
plat_plat_pm_ops
;
return
0
;
}
plat/mediatek/mt8173/plat_private.h
0 → 100644
View file @
aaa0567c
/*
* Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __PLAT_PRIVATE_H__
#define __PLAT_PRIVATE_H__
/*******************************************************************************
* Function and variable prototypes
******************************************************************************/
void
plat_configure_mmu_el3
(
unsigned
long
total_base
,
unsigned
long
total_size
,
unsigned
long
,
unsigned
long
,
unsigned
long
,
unsigned
long
);
void
plat_cci_init
(
void
);
void
plat_cci_enable
(
void
);
void
plat_cci_disable
(
void
);
/* Declarations for plat_mt_gic.c */
void
plat_mt_gic_init
(
void
);
/* Declarations for plat_topology.c */
int
mt_setup_topology
(
void
);
void
plat_delay_timer_init
(
void
);
#endif
/* __PLAT_PRIVATE_H__ */
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment