Commit 8e53ec53 authored by Jimmy Huang's avatar Jimmy Huang Committed by Yidi Lin
Browse files

mt8173: support big/Little cluster power off for CPU idle(C2 state)



1. add power control for both big and Little cluster in MCDI
2. fix incorrect PCM_HOTPLUG_VALID_MASK in spm_hotplug.c
3. check the power status of cpus in cluster before setting the cputop
   power control

Change-Id: Ifa85306a8bc218098667247904d281494c2f7bfe
Signed-off-by: default avatarWeiyi Lu <weiyi.lu@mediatek.com>
parent 3c454d52
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* This driver controls the cpu power in cpu hotplug flow. * This driver controls the cpu power in cpu hotplug flow.
*/ */
#define PCM_HOTPLUG_VALID_MASK 0x00ff0000 #define PCM_HOTPLUG_VALID_MASK 0x0000ff00
#define PCM_HOTPLUG_VALID_SHIFT 0x8 #define PCM_HOTPLUG_VALID_SHIFT 0x8
/********************************************************** /**********************************************************
......
...@@ -50,68 +50,72 @@ ...@@ -50,68 +50,72 @@
#define PCM_MCDI_CKECK_DONE 0x12345678 #define PCM_MCDI_CKECK_DONE 0x12345678
#define PCM_MCDI_ALL_CORE_AWAKE 0x0 #define PCM_MCDI_ALL_CORE_AWAKE 0x0
#define PCM_MCDI_OFFLOADED 0xaa55aa55 #define PCM_MCDI_OFFLOADED 0xaa55aa55
#define PCM_MCDI_CA72_CPUTOP_PWRCTL (0x1 << 16)
#define PCM_MCDI_CA53_CPUTOP_PWRCTL (0x1 << 17)
#define PCM_MCDI_CA72_PWRSTA_SHIFT 16
#define PCM_MCDI_CA53_PWRSTA_SHIFT 9
static const unsigned int mcdi_binary[] = { static const unsigned int mcdi_binary[] = {
0x1212841f, 0xe2e00036, 0xe2e0003e, 0x1380201f, 0xe2e0003c, 0xe2a00000, 0x1a10001f, 0x10006918, 0x81002001, 0xb100a081, 0xb1012081, 0xb101a081,
0x1b80001f, 0x20000080, 0xe2e0007c, 0x1b80001f, 0x20000003, 0xe2e0005c, 0xb1042081, 0xb104a081, 0xb1052081, 0xb105a081, 0xb1003081, 0xd8200984,
0xe2e0004c, 0xe2e0004d, 0xf0000000, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f, 0x17c07c1f, 0xe2e00036, 0xe2e0003e, 0x1910001f, 0x1000660c, 0x81041001,
0xe2e0002f, 0xe2a00001, 0x1b80001f, 0x20000080, 0xe2e0002e, 0xe2e0003e, 0x1a10001f, 0x10006610, 0x82042001, 0x81002004, 0xd82001e4, 0x17c07c1f,
0xe2e00032, 0xf0000000, 0x17c07c1f, 0x1212841f, 0xe2e00026, 0xe2e0002e, 0xe2e0003c, 0xe8208000, 0x10006244, 0x00000000, 0x1910001f, 0x10006244,
0x1380201f, 0x1a00001f, 0x100062b4, 0x1910001f, 0x100062b4, 0x81322804, 0x81041001, 0xd8000384, 0x17c07c1f, 0x1b80001f, 0x20000030, 0xe2e0007c,
0xe2000004, 0x81202804, 0xe2000004, 0x1b80001f, 0x20000034, 0x1910001f, 0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d, 0x1900001f,
0x100062b4, 0x81142804, 0xd8000524, 0x17c07c1f, 0xe2e0000e, 0xe2e0000c, 0x10001250, 0x1a10001f, 0x10001250, 0x8a000008, 0xfffffffb, 0xe1000008,
0xe2e0000d, 0xf0000000, 0x17c07c1f, 0xe2e0002d, 0x1a00001f, 0x100062b4, 0x1900001f, 0x10001258, 0x1a10001f, 0x10001258, 0x81012001, 0xd8000604,
0x1910001f, 0x100062b4, 0xa1002804, 0xe2000004, 0xa1122804, 0xe2000004, 0x17c07c1f, 0x1900001f, 0x10001220, 0x1a10001f, 0x10001220, 0x8a000008,
0x1b80001f, 0x20000080, 0x1910001f, 0x100062b4, 0x81142804, 0xd82007c4, 0xdfffffff, 0xe1000008, 0x1900001f, 0x10001228, 0x1a10001f, 0x10001228,
0x17c07c1f, 0xe2e0002f, 0xe2e0002b, 0xe2e00023, 0x1380201f, 0xe2e00022, 0x810ea001, 0xd80007c4, 0x17c07c1f, 0x1900001f, 0x1020002c, 0x1a10001f,
0xf0000000, 0x17c07c1f, 0x18c0001f, 0x10006b6c, 0x1910001f, 0x10006b6c, 0x1020002c, 0x8a000008, 0xffffffef, 0xe1000008, 0xf0000000, 0x17c07c1f,
0xa1002804, 0xe0c00004, 0xf0000000, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x1020002c, 0x1a10001f, 0x1020002c, 0xaa000008, 0x00000010,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe1000008, 0x1910001f, 0x10006720, 0x820c1001, 0xd8200aa8, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x10001250, 0x1a10001f, 0x10001250, 0xa2110408, 0xe1000008,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x10001258, 0x1a10001f, 0x10001258, 0x81012001, 0xd8200c04,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x10001220, 0x1a10001f, 0x10001220, 0xa21e8408,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe1000008, 0x1900001f, 0x10001228, 0x1a10001f, 0x10001228, 0x810ea001,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xd8200da4, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xe8208000,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x10006244, 0x00000001, 0x1910001f, 0x10006244, 0x81041001, 0xd8200f44,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2e0002e, 0xe2e0003e, 0xe2e0003a, 0xe2e00032, 0x1910001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1000660c, 0x81041001, 0x1a10001f, 0x10006610, 0x82042001, 0xa1002004,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xd8001064, 0x17c07c1f, 0x1910001f, 0x10006b04, 0x01000404, 0x1a00001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x10006b04, 0xe2000004, 0xf0000000, 0x17c07c1f, 0x1212841f, 0xe2e00036,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2e0003e, 0x1380201f, 0xe2e0003c, 0xe2a00000, 0x1b80001f, 0x20000080,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2e0007c, 0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xf0000000, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xe2a00001,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1b80001f, 0x20000080, 0xe2e0002e, 0xe2e0003e, 0xe2e0003a, 0xe2e00032,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xf0000000, 0x17c07c1f, 0x1212841f, 0xe2e00026, 0xe2e0002e, 0x1380201f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1a00001f, 0x100062b4, 0x1910001f, 0x100062b4, 0x81322804, 0xe2000004,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x81202804, 0xe2000004, 0x1b80001f, 0x20000034, 0x1910001f, 0x100062b4,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x81142804, 0xd80017c4, 0x17c07c1f, 0xe2e0000e, 0xe2e0000c, 0xe2e0000d,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xf0000000, 0x17c07c1f, 0xe2e0002d, 0x1a00001f, 0x100062b4, 0x1910001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x100062b4, 0xa1002804, 0xe2000004, 0xa1122804, 0xe2000004, 0x1b80001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x20000080, 0x1910001f, 0x100062b4, 0x81142804, 0xd8201a64, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2e0002f, 0xe2e0002b, 0xe2e00023, 0x1380201f, 0xe2e00022, 0xf0000000,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x1020020c, 0x1a10001f, 0x1020020c, 0xaa000008,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x00000001, 0xe1000008, 0x1910001f, 0x10006720, 0x820c9001, 0xd8201cc8,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x10001220, 0x1a10001f, 0x10001220, 0xa21f0408,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe1000008, 0x1900001f, 0x10001228, 0x1a10001f, 0x10001228, 0x810f2001,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xd8201e24, 0x17c07c1f, 0xe2e0006d, 0xe2e0002d, 0x1a00001f, 0x100062b8,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1910001f, 0x100062b8, 0xa9000004, 0x00000001, 0xe2000004, 0x1910001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x100062b8, 0x81041001, 0xd8202024, 0x17c07c1f, 0xe2e0002c, 0xe2e0003c,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2e0003e, 0xe2e0003a, 0xe2e00032, 0x1910001f, 0x1000660c, 0x81079001,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1a10001f, 0x10006610, 0x8207a001, 0xa1002004, 0xd8002164, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x10006404, 0x1a10001f, 0x10006404, 0xa2168408, 0xe1000008,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xf0000000, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81022001, 0xb102a081,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xb1062081, 0xb106a081, 0xb1003081, 0xd8202ba4, 0x17c07c1f, 0x1900001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x10006404, 0x1a10001f, 0x10006404, 0x8a000008, 0x0000dfff, 0xe1000008,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2e00036, 0xe2e0003e, 0x1910001f, 0x1000660c, 0x81079001, 0x1a10001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x10006610, 0x8207a001, 0x81002004, 0xd82025c4, 0x17c07c1f, 0xe2e0002e,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1a00001f, 0x100062b8, 0x1910001f, 0x100062b8, 0x89000004, 0x0000fffe,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2000004, 0x1910001f, 0x100062b8, 0x81041001, 0xd80027e4, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe2e0006e, 0xe2e0004e, 0xe2e0004c, 0xe2e0004d, 0x1900001f, 0x10001220,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1a10001f, 0x10001220, 0x8a000008, 0xbfffffff, 0xe1000008, 0x1900001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x10001228, 0x1a10001f, 0x10001228, 0x810f2001, 0xd80029e4, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x1900001f, 0x1020020c, 0x1a10001f, 0x1020020c, 0x8a000008, 0xfffffffe,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0xe1000008, 0xf0000000, 0x17c07c1f, 0x18c0001f, 0x10006b6c, 0x1910001f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 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,
...@@ -140,78 +144,86 @@ static const unsigned int mcdi_binary[] = { ...@@ -140,78 +144,86 @@ static const unsigned int mcdi_binary[] = {
0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0x11407c1f, 0xe8208000, 0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0x11407c1f, 0xe8208000,
0x10006b6c, 0xa0000000, 0xe8208000, 0x10006310, 0x0b160008, 0x1900001f, 0x10006b6c, 0xa0000000, 0xe8208000, 0x10006310, 0x0b160008, 0x1900001f,
0x000f7bde, 0x1a00001f, 0x10200268, 0xe2000004, 0xe8208000, 0x10006600, 0x000f7bde, 0x1a00001f, 0x10200268, 0xe2000004, 0xe8208000, 0x10006600,
0x00000000, 0xc2800940, 0x1280041f, 0x1b00001f, 0x21000001, 0x1b80001f, 0x00000000, 0xc2802be0, 0x1280041f, 0xe8208000, 0x10006b04, 0x00000000,
0xd0010000, 0xc2800940, 0x1290841f, 0x69200006, 0xbeefbeef, 0xd8204764, 0x1b00001f, 0x21000001, 0x1b80001f, 0xd0010000, 0xc2802be0, 0x1290841f,
0x17c07c1f, 0xc2800940, 0x1291041f, 0x1910001f, 0x10006358, 0x810b1001, 0x69200006, 0xbeefbeef, 0xd82047c4, 0x17c07c1f, 0xc2802be0, 0x1291041f,
0xd80043e4, 0x17c07c1f, 0x1980001f, 0xdeaddead, 0x69200006, 0xabcdabcd, 0x1910001f, 0x10006358, 0x810b1001, 0xd8004444, 0x17c07c1f, 0x1980001f,
0xd82044c4, 0x17c07c1f, 0xc2800940, 0x1291841f, 0x88900001, 0x10006814, 0xdeaddead, 0x69200006, 0xabcdabcd, 0xd8204524, 0x17c07c1f, 0xc2802be0,
0x1910001f, 0x10006400, 0x81271002, 0x1880001f, 0x10006600, 0xe0800004, 0x1291841f, 0x88900001, 0x10006814, 0x1910001f, 0x10006400, 0x81271002,
0x1910001f, 0x10006358, 0x810b1001, 0xd8004684, 0x17c07c1f, 0x1980001f, 0x1880001f, 0x10006600, 0xe0800004, 0x1910001f, 0x10006358, 0x810b1001,
0x12345678, 0x60a07c05, 0x89100002, 0x10006600, 0x80801001, 0xd8007142, 0xd80046e4, 0x17c07c1f, 0x1980001f, 0x12345678, 0x60a07c05, 0x89100002,
0x17c07c1f, 0xc2800940, 0x1292041f, 0x1a10001f, 0x10006720, 0x82002001, 0x10006600, 0x80801001, 0xd8007742, 0x17c07c1f, 0xc2802be0, 0x1292041f,
0x82201408, 0xd8204a08, 0x17c07c1f, 0x1a40001f, 0x10006200, 0x1a80001f, 0x1a10001f, 0x10006720, 0x82002001, 0x82201408, 0xd8204a68, 0x17c07c1f,
0x1000625c, 0xc2400200, 0x17c07c1f, 0xa1400405, 0xc2800940, 0x1292841f, 0x1a40001f, 0x10006200, 0x1a80001f, 0x1000625c, 0xc2401480, 0x17c07c1f,
0x1a10001f, 0x10006720, 0x8200a001, 0x82209408, 0xd8204be8, 0x17c07c1f, 0xa1400405, 0xc2802be0, 0x1292841f, 0x1a10001f, 0x10006720, 0x8200a001,
0x1a40001f, 0x10006218, 0x1a80001f, 0x10006264, 0xc2400200, 0x17c07c1f, 0x82209408, 0xd8204c48, 0x17c07c1f, 0x1a40001f, 0x10006218, 0x1a80001f,
0xa1508405, 0xc2800940, 0x1293041f, 0x1a10001f, 0x10006720, 0x82012001, 0x10006264, 0xc2401480, 0x17c07c1f, 0xa1508405, 0xc2802be0, 0x1293041f,
0x82211408, 0xd8204dc8, 0x17c07c1f, 0x1a40001f, 0x1000621c, 0x1a80001f, 0x1a10001f, 0x10006720, 0x82012001, 0x82211408, 0xd8204e28, 0x17c07c1f,
0x1000626c, 0xc2400200, 0x17c07c1f, 0xa1510405, 0x1a10001f, 0x10006720, 0x1a40001f, 0x1000621c, 0x1a80001f, 0x1000626c, 0xc2401480, 0x17c07c1f,
0x8201a001, 0x82219408, 0xd8204f68, 0x17c07c1f, 0x1a40001f, 0x10006220, 0xa1510405, 0x1a10001f, 0x10006720, 0x8201a001, 0x82219408, 0xd8204fc8,
0x1a80001f, 0x10006274, 0xc2400200, 0x17c07c1f, 0xa1518405, 0x1a10001f, 0x17c07c1f, 0x1a40001f, 0x10006220, 0x1a80001f, 0x10006274, 0xc2401480,
0x10006720, 0x82022001, 0x82221408, 0xd82050e8, 0x17c07c1f, 0x1a40001f, 0x17c07c1f, 0xa1518405, 0x1a10001f, 0x10006720, 0x82022001, 0x82221408,
0x100062a0, 0x1280041f, 0xc2400660, 0x17c07c1f, 0xa1520405, 0x1a10001f, 0xd8205148, 0x17c07c1f, 0x1a40001f, 0x100062a0, 0x1280041f, 0xc2401900,
0x10006720, 0x8202a001, 0x82229408, 0xd8205268, 0x17c07c1f, 0x1a40001f, 0x17c07c1f, 0xa1520405, 0x1a10001f, 0x10006720, 0x8202a001, 0x82229408,
0x100062a4, 0x1290841f, 0xc2400660, 0x17c07c1f, 0xa1528405, 0x1a10001f, 0xd82052c8, 0x17c07c1f, 0x1a40001f, 0x100062a4, 0x1290841f, 0xc2401900,
0x10006720, 0x82032001, 0x82231408, 0xd82053e8, 0x17c07c1f, 0x1a40001f, 0x17c07c1f, 0xa1528405, 0x1a10001f, 0x10006720, 0x82032001, 0x82231408,
0x100062a8, 0x1291041f, 0xc2400660, 0x17c07c1f, 0xa1530405, 0x1a10001f, 0xd82053a8, 0x17c07c1f, 0xa1530405, 0x1a10001f, 0x10006720, 0x8203a001,
0x10006720, 0x8203a001, 0x82239408, 0xd8205568, 0x17c07c1f, 0x1a40001f, 0x82239408, 0xd8205488, 0x17c07c1f, 0xa1538405, 0x1a10001f, 0x10006b00,
0x100062ac, 0x1291841f, 0xc2400660, 0x17c07c1f, 0xa1538405, 0x1b80001f, 0x8108a001, 0xd8205864, 0x17c07c1f, 0x1a10001f, 0x10006610, 0x8104a001,
0x20000208, 0xd82070cc, 0x17c07c1f, 0x81001401, 0xd8205964, 0x17c07c1f, 0xb1052081, 0xb105a081, 0xb1062081, 0xd8005744, 0x17c07c1f, 0x1a10001f,
0x1a10001f, 0x10006918, 0x81002001, 0xb1042081, 0xb1003081, 0xb10c3081, 0x10006610, 0x81042001, 0xd8205744, 0x17c07c1f, 0x1a40001f, 0x10006208,
0xd8205964, 0x17c07c1f, 0x1a40001f, 0x10006200, 0x1a80001f, 0x1000625c, 0xc24009c0, 0x17c07c1f, 0x1910001f, 0x10006610, 0x81041001, 0xd8005864,
0xc2400000, 0x17c07c1f, 0x89400005, 0xfffffffe, 0xe8208000, 0x10006f00, 0x17c07c1f, 0x1a40001f, 0x10006208, 0xc2400000, 0x17c07c1f, 0x1a10001f,
0x00000000, 0xe8208000, 0x10006b30, 0x00000000, 0xe8208000, 0x100063e0, 0x10006b00, 0x81082001, 0xd8205ae4, 0x17c07c1f, 0x1a10001f, 0x10006610,
0x00000001, 0x81009401, 0xd8205cc4, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81082001, 0xb108a081, 0xd8005ae4, 0x17c07c1f, 0x1a10001f, 0x10006610,
0x8100a001, 0xb104a081, 0xb1003081, 0xd8205cc4, 0x17c07c1f, 0x1a40001f, 0x8107a001, 0xd8205ae4, 0x17c07c1f, 0x1a40001f, 0x100062b0, 0xc2401be0,
0x10006218, 0x1a80001f, 0x10006264, 0xc2400000, 0x17c07c1f, 0x89400005, 0x17c07c1f, 0x1b80001f, 0x20000208, 0xd82076cc, 0x17c07c1f, 0x1910001f,
0xfffffffd, 0xe8208000, 0x10006f04, 0x00000000, 0xe8208000, 0x10006b34, 0x10006610, 0x81079001, 0xd8005c84, 0x17c07c1f, 0x1a40001f, 0x100062b0,
0x00000000, 0xe8208000, 0x100063e0, 0x00000002, 0x81011401, 0xd8206024, 0xc2402380, 0x17c07c1f, 0x81001401, 0xd8206004, 0x17c07c1f, 0x1a10001f,
0x17c07c1f, 0x1a10001f, 0x10006918, 0x81012001, 0xb1052081, 0xb1003081, 0x10006918, 0x81002001, 0xb1042081, 0xb1003081, 0xb10c3081, 0xd8206004,
0xd8206024, 0x17c07c1f, 0x1a40001f, 0x1000621c, 0x1a80001f, 0x1000626c, 0x17c07c1f, 0x1a40001f, 0x10006200, 0x1a80001f, 0x1000625c, 0xc2401280,
0xc2400000, 0x17c07c1f, 0x89400005, 0xfffffffb, 0xe8208000, 0x10006f08, 0x17c07c1f, 0x89400005, 0xfffffffe, 0xe8208000, 0x10006f00, 0x00000000,
0x00000000, 0xe8208000, 0x10006b38, 0x00000000, 0xe8208000, 0x100063e0, 0xe8208000, 0x10006b30, 0x00000000, 0xe8208000, 0x100063e0, 0x00000001,
0x00000004, 0x81019401, 0xd8206384, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81009401, 0xd8206364, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x8100a001,
0x8101a001, 0xb105a081, 0xb1003081, 0xd8206384, 0x17c07c1f, 0x1a40001f, 0xb104a081, 0xb1003081, 0xd8206364, 0x17c07c1f, 0x1a40001f, 0x10006218,
0x10006220, 0x1a80001f, 0x10006274, 0xc2400000, 0x17c07c1f, 0x89400005, 0x1a80001f, 0x10006264, 0xc2401280, 0x17c07c1f, 0x89400005, 0xfffffffd,
0xfffffff7, 0xe8208000, 0x10006f0c, 0x00000000, 0xe8208000, 0x10006b3c, 0xe8208000, 0x10006f04, 0x00000000, 0xe8208000, 0x10006b34, 0x00000000,
0x00000000, 0xe8208000, 0x100063e0, 0x00000008, 0x81021401, 0xd82066c4, 0xe8208000, 0x100063e0, 0x00000002, 0x81011401, 0xd82066c4, 0x17c07c1f,
0x17c07c1f, 0x1a10001f, 0x10006918, 0x81022001, 0xb1062081, 0xb1003081, 0x1a10001f, 0x10006918, 0x81012001, 0xb1052081, 0xb1003081, 0xd82066c4,
0xd82066c4, 0x17c07c1f, 0x1a40001f, 0x100062a0, 0x1280041f, 0xc2400360, 0x17c07c1f, 0x1a40001f, 0x1000621c, 0x1a80001f, 0x1000626c, 0xc2401280,
0x17c07c1f, 0x89400005, 0xffffffef, 0xe8208000, 0x10006f10, 0x00000000, 0x17c07c1f, 0x89400005, 0xfffffffb, 0xe8208000, 0x10006f08, 0x00000000,
0xe8208000, 0x10006b40, 0x00000000, 0xe8208000, 0x100063e0, 0x00000010, 0xe8208000, 0x10006b38, 0x00000000, 0xe8208000, 0x100063e0, 0x00000004,
0x81029401, 0xd8206a04, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x8102a001, 0x81019401, 0xd8206a24, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x8101a001,
0xb106a081, 0xb1003081, 0xd8206a04, 0x17c07c1f, 0x1a40001f, 0x100062a4, 0xb105a081, 0xb1003081, 0xd8206a24, 0x17c07c1f, 0x1a40001f, 0x10006220,
0x1290841f, 0xc2400360, 0x17c07c1f, 0x89400005, 0xffffffdf, 0xe8208000, 0x1a80001f, 0x10006274, 0xc2401280, 0x17c07c1f, 0x89400005, 0xfffffff7,
0x10006f14, 0x00000000, 0xe8208000, 0x10006b44, 0x00000000, 0xe8208000, 0xe8208000, 0x10006f0c, 0x00000000, 0xe8208000, 0x10006b3c, 0x00000000,
0x100063e0, 0x00000020, 0x81031401, 0xd8206d44, 0x17c07c1f, 0x1a10001f, 0xe8208000, 0x100063e0, 0x00000008, 0x1910001f, 0x10006610, 0x81079001,
0x10006918, 0x81032001, 0xb1072081, 0xb1003081, 0xd8206d44, 0x17c07c1f, 0xd8207144, 0x17c07c1f, 0x81021401, 0xd8206e04, 0x17c07c1f, 0x1a10001f,
0x1a40001f, 0x100062a8, 0x1291041f, 0xc2400360, 0x17c07c1f, 0x89400005, 0x10006918, 0x81022001, 0xb1062081, 0xb1003081, 0xd8206e04, 0x17c07c1f,
0xffffffbf, 0xe8208000, 0x10006f18, 0x00000000, 0xe8208000, 0x10006b48, 0x1a40001f, 0x100062a0, 0x1280041f, 0xc2401600, 0x17c07c1f, 0x89400005,
0x00000000, 0xe8208000, 0x100063e0, 0x00000040, 0x81039401, 0xd8207084, 0xffffffef, 0xe8208000, 0x10006f10, 0x00000000, 0xe8208000, 0x10006b40,
0x17c07c1f, 0x1a10001f, 0x10006918, 0x8103a001, 0xb107a081, 0xb1003081, 0x00000000, 0xe8208000, 0x100063e0, 0x00000010, 0x81029401, 0xd8207144,
0xd8207084, 0x17c07c1f, 0x1a40001f, 0x100062ac, 0x1291841f, 0xc2400360, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x8102a001, 0xb106a081, 0xb1003081,
0xd8207144, 0x17c07c1f, 0x1a40001f, 0x100062a4, 0x1290841f, 0xc2401600,
0x17c07c1f, 0x89400005, 0xffffffdf, 0xe8208000, 0x10006f14, 0x00000000,
0xe8208000, 0x10006b44, 0x00000000, 0xe8208000, 0x100063e0, 0x00000020,
0x81031401, 0xd82073e4, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81032001,
0xb1072081, 0xb1003081, 0xd82073e4, 0x17c07c1f, 0x89400005, 0xffffffbf,
0xe8208000, 0x10006f18, 0x00000000, 0xe8208000, 0x10006b48, 0x00000000,
0xe8208000, 0x100063e0, 0x00000040, 0x81039401, 0xd8207684, 0x17c07c1f,
0x1a10001f, 0x10006918, 0x8103a001, 0xb107a081, 0xb1003081, 0xd8207684,
0x17c07c1f, 0x89400005, 0xffffff7f, 0xe8208000, 0x10006f1c, 0x00000000, 0x17c07c1f, 0x89400005, 0xffffff7f, 0xe8208000, 0x10006f1c, 0x00000000,
0xe8208000, 0x10006b4c, 0x00000000, 0xe8208000, 0x100063e0, 0x00000080, 0xe8208000, 0x10006b4c, 0x00000000, 0xe8208000, 0x100063e0, 0x00000080,
0xc2800940, 0x1293841f, 0xd0004260, 0x17c07c1f, 0xc2800940, 0x1294041f, 0xc2802be0, 0x1293841f, 0xd00042c0, 0x17c07c1f, 0xc2802be0, 0x1294041f,
0xe8208000, 0x10006600, 0x00000000, 0x1ac0001f, 0x55aa55aa, 0x1940001f, 0xe8208000, 0x10006600, 0x00000000, 0x1ac0001f, 0x55aa55aa, 0x1940001f,
0xaa55aa55, 0xc2800940, 0x1294841f, 0x1b80001f, 0x00001000, 0xf0000000, 0xaa55aa55, 0xc2802be0, 0x1294841f, 0x1b80001f, 0x00001000, 0xf0000000,
0x17c07c1f 0x17c07c1f
}; };
static const struct pcm_desc mcdi_pcm = { static const struct pcm_desc mcdi_pcm = {
.version = "pcm_mcdi_v0.5_20140721_mt8173_v03.04_20150507", .version = "pcm_mcdi_mt8173_20150901_v1",
.base = mcdi_binary, .base = mcdi_binary,
.size = 919, .size = 967,
.sess = 2, .sess = 2,
.replace = 0, .replace = 0,
}; };
...@@ -301,7 +313,7 @@ void spm_mcdi_wakeup_all_cores(void) ...@@ -301,7 +313,7 @@ void spm_mcdi_wakeup_all_cores(void)
clear_all_ready(); clear_all_ready();
} }
void spm_mcdi_wfi_sel_enter(unsigned long mpidr) static void spm_mcdi_wfi_sel_enter(unsigned long mpidr)
{ {
int core_id_val = mpidr & MPIDR_CPU_MASK; int core_id_val = mpidr & MPIDR_CPU_MASK;
int cluster_id = (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS; int cluster_id = (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS;
...@@ -352,7 +364,7 @@ void spm_mcdi_wfi_sel_enter(unsigned long mpidr) ...@@ -352,7 +364,7 @@ void spm_mcdi_wfi_sel_enter(unsigned long mpidr)
} }
} }
void spm_mcdi_wfi_sel_leave(unsigned long mpidr) static void spm_mcdi_wfi_sel_leave(unsigned long mpidr)
{ {
int core_id_val = mpidr & MPIDR_CPU_MASK; int core_id_val = mpidr & MPIDR_CPU_MASK;
int cluster_id = (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS; int cluster_id = (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS;
...@@ -403,7 +415,51 @@ void spm_mcdi_wfi_sel_leave(unsigned long mpidr) ...@@ -403,7 +415,51 @@ void spm_mcdi_wfi_sel_leave(unsigned long mpidr)
} }
} }
void spm_mcdi_prepare(unsigned long mpidr) static void spm_mcdi_set_cputop_pwrctrl_for_cluster_off(unsigned long mpidr)
{
unsigned long cluster_id = mpidr & MPIDR_CLUSTER_MASK;
unsigned long cpu_id = mpidr & MPIDR_CPU_MASK;
unsigned int pwr_status, shift, i, flag = 0;
pwr_status = mmio_read_32(SPM_PWR_STATUS) |
mmio_read_32(SPM_PWR_STATUS_2ND);
if (cluster_id) {
for (i = 0; i < PLATFORM_CLUSTER1_CORE_COUNT; i++) {
if (i == cpu_id)
continue;
shift = i + PCM_MCDI_CA72_PWRSTA_SHIFT;
flag |= (pwr_status & (1 << shift)) >> shift;
}
if (!flag)
mmio_setbits_32(SPM_PCM_RESERVE,
PCM_MCDI_CA72_CPUTOP_PWRCTL);
} else {
for (i = 0; i < PLATFORM_CLUSTER0_CORE_COUNT; i++) {
if (i == cpu_id)
continue;
shift = i + PCM_MCDI_CA53_PWRSTA_SHIFT;
flag |= (pwr_status & (1 << shift)) >> shift;
}
if (!flag)
mmio_setbits_32(SPM_PCM_RESERVE,
PCM_MCDI_CA53_CPUTOP_PWRCTL);
}
}
static void spm_mcdi_clear_cputop_pwrctrl_for_cluster_on(unsigned long mpidr)
{
unsigned long cluster_id = mpidr & MPIDR_CLUSTER_MASK;
if (cluster_id)
mmio_clrbits_32(SPM_PCM_RESERVE,
PCM_MCDI_CA72_CPUTOP_PWRCTL);
else
mmio_clrbits_32(SPM_PCM_RESERVE,
PCM_MCDI_CA53_CPUTOP_PWRCTL);
}
void spm_mcdi_prepare_for_off_state(unsigned long mpidr, unsigned int afflvl)
{ {
const struct pcm_desc *pcmdesc = spm_mcdi.pcmdesc; const struct pcm_desc *pcmdesc = spm_mcdi.pcmdesc;
struct pwr_ctrl *pwrctrl = spm_mcdi.pwrctrl; struct pwr_ctrl *pwrctrl = spm_mcdi.pwrctrl;
...@@ -421,14 +477,17 @@ void spm_mcdi_prepare(unsigned long mpidr) ...@@ -421,14 +477,17 @@ void spm_mcdi_prepare(unsigned long mpidr)
set_mcdi_ready(); set_mcdi_ready();
} }
spm_mcdi_wfi_sel_enter(mpidr); spm_mcdi_wfi_sel_enter(mpidr);
if (afflvl == MPIDR_AFFLVL1)
spm_mcdi_set_cputop_pwrctrl_for_cluster_off(mpidr);
spm_lock_release(); spm_lock_release();
} }
void spm_mcdi_finish(unsigned long mpidr) void spm_mcdi_finish_for_on_state(unsigned long mpidr, unsigned int afflvl)
{ {
unsigned long linear_id = platform_get_core_pos(mpidr); unsigned long linear_id = platform_get_core_pos(mpidr);
spm_lock_get(); spm_lock_get();
spm_mcdi_clear_cputop_pwrctrl_for_cluster_on(mpidr);
spm_mcdi_wfi_sel_leave(mpidr); spm_mcdi_wfi_sel_leave(mpidr);
mmio_write_32(SPM_PCM_SW_INT_CLEAR, (0x1 << linear_id)); mmio_write_32(SPM_PCM_SW_INT_CLEAR, (0x1 << linear_id));
spm_lock_release(); spm_lock_release();
......
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
#define __SPM_MCDI_H__ #define __SPM_MCDI_H__
void spm_mcdi_wakeup_all_cores(void); void spm_mcdi_wakeup_all_cores(void);
void spm_mcdi_wfi_sel_enter(unsigned long mpidr); void spm_mcdi_prepare_for_off_state(unsigned long mpidr, unsigned int afflvl);
void spm_mcdi_wfi_sel_leave(unsigned long mpidr); void spm_mcdi_finish_for_on_state(unsigned long mpidr, unsigned int afflvl);
void spm_mcdi_prepare(unsigned long mpidr);
void spm_mcdi_finish(unsigned long mpidr);
#endif /* __SPM_MCDI_H__ */ #endif /* __SPM_MCDI_H__ */
...@@ -380,8 +380,8 @@ static void plat_affinst_suspend(unsigned long sec_entrypoint, ...@@ -380,8 +380,8 @@ static void plat_affinst_suspend(unsigned long sec_entrypoint,
mmio_write_32(rv, sec_entrypoint); mmio_write_32(rv, sec_entrypoint);
if (afflvl == MPIDR_AFFLVL0) if (afflvl < MPIDR_AFFLVL2)
spm_mcdi_prepare(mpidr); spm_mcdi_prepare_for_off_state(mpidr, afflvl);
if (afflvl >= MPIDR_AFFLVL0) if (afflvl >= MPIDR_AFFLVL0)
mt_platform_save_context(mpidr); mt_platform_save_context(mpidr);
...@@ -390,12 +390,10 @@ static void plat_affinst_suspend(unsigned long sec_entrypoint, ...@@ -390,12 +390,10 @@ static void plat_affinst_suspend(unsigned long sec_entrypoint,
if (afflvl >= MPIDR_AFFLVL1) { if (afflvl >= MPIDR_AFFLVL1) {
/* Disable coherency if this cluster is to be turned off */ /* Disable coherency if this cluster is to be turned off */
plat_cci_disable(); plat_cci_disable();
disable_scu(mpidr);
trace_power_flow(mpidr, CLUSTER_SUSPEND);
} }
if (afflvl >= MPIDR_AFFLVL2) { if (afflvl >= MPIDR_AFFLVL2) {
disable_scu(mpidr);
generic_timer_backup(); generic_timer_backup();
spm_system_suspend(); spm_system_suspend();
/* Prevent interrupts from spuriously waking up this cpu */ /* Prevent interrupts from spuriously waking up this cpu */
...@@ -420,8 +418,6 @@ static void plat_affinst_on_finish(unsigned int afflvl, unsigned int state) ...@@ -420,8 +418,6 @@ static void plat_affinst_on_finish(unsigned int afflvl, unsigned int state)
/* Perform the common cluster specific operations */ /* Perform the common cluster specific operations */
if (afflvl >= MPIDR_AFFLVL1) { if (afflvl >= MPIDR_AFFLVL1) {
enable_scu(mpidr);
/* Enable coherency if this cluster was off */ /* Enable coherency if this cluster was off */
plat_cci_enable(); plat_cci_enable();
trace_power_flow(mpidr, CLUSTER_UP); trace_power_flow(mpidr, CLUSTER_UP);
...@@ -451,22 +447,20 @@ static void plat_affinst_suspend_finish(unsigned int afflvl, unsigned int state) ...@@ -451,22 +447,20 @@ static void plat_affinst_suspend_finish(unsigned int afflvl, unsigned int state)
arm_gic_setup(); arm_gic_setup();
arm_gic_cpuif_setup(); arm_gic_cpuif_setup();
spm_system_suspend_finish(); spm_system_suspend_finish();
enable_scu(mpidr);
} }
/* Perform the common cluster specific operations */ /* Perform the common cluster specific operations */
if (afflvl >= MPIDR_AFFLVL1) { if (afflvl >= MPIDR_AFFLVL1) {
enable_scu(mpidr);
/* Enable coherency if this cluster was off */ /* Enable coherency if this cluster was off */
plat_cci_enable(); plat_cci_enable();
trace_power_flow(mpidr, CLUSTER_UP);
} }
if (afflvl >= MPIDR_AFFLVL0) if (afflvl >= MPIDR_AFFLVL0)
mt_platform_restore_context(mpidr); mt_platform_restore_context(mpidr);
if (afflvl == MPIDR_AFFLVL0) if (afflvl < MPIDR_AFFLVL2)
spm_mcdi_finish(mpidr); spm_mcdi_finish_for_on_state(mpidr, afflvl);
arm_gic_pcpu_distif_setup(); arm_gic_pcpu_distif_setup();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment