18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * AM33XX Power domain data 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/ 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or 78c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License as 88c2ecf20Sopenharmony_ci * published by the Free Software Foundation version 2. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * This program is distributed "as is" WITHOUT ANY WARRANTY of any 118c2ecf20Sopenharmony_ci * kind, whether express or implied; without even the implied warranty 128c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 138c2ecf20Sopenharmony_ci * GNU General Public License for more details. 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/kernel.h> 178c2ecf20Sopenharmony_ci#include <linux/init.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#include "powerdomain.h" 208c2ecf20Sopenharmony_ci#include "prcm-common.h" 218c2ecf20Sopenharmony_ci#include "prm-regbits-33xx.h" 228c2ecf20Sopenharmony_ci#include "prm33xx.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistatic struct powerdomain gfx_33xx_pwrdm = { 258c2ecf20Sopenharmony_ci .name = "gfx_pwrdm", 268c2ecf20Sopenharmony_ci .voltdm = { .name = "core" }, 278c2ecf20Sopenharmony_ci .prcm_offs = AM33XX_PRM_GFX_MOD, 288c2ecf20Sopenharmony_ci .pwrstctrl_offs = AM33XX_PM_GFX_PWRSTCTRL_OFFSET, 298c2ecf20Sopenharmony_ci .pwrstst_offs = AM33XX_PM_GFX_PWRSTST_OFFSET, 308c2ecf20Sopenharmony_ci .pwrsts = PWRSTS_OFF_RET_ON, 318c2ecf20Sopenharmony_ci .pwrsts_logic_ret = PWRSTS_OFF_RET, 328c2ecf20Sopenharmony_ci .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 338c2ecf20Sopenharmony_ci .banks = 1, 348c2ecf20Sopenharmony_ci .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK, 358c2ecf20Sopenharmony_ci .mem_on_mask = { 368c2ecf20Sopenharmony_ci [0] = AM33XX_GFX_MEM_ONSTATE_MASK, /* gfx_mem */ 378c2ecf20Sopenharmony_ci }, 388c2ecf20Sopenharmony_ci .mem_ret_mask = { 398c2ecf20Sopenharmony_ci [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */ 408c2ecf20Sopenharmony_ci }, 418c2ecf20Sopenharmony_ci .mem_pwrst_mask = { 428c2ecf20Sopenharmony_ci [0] = AM33XX_GFX_MEM_STATEST_MASK, /* gfx_mem */ 438c2ecf20Sopenharmony_ci }, 448c2ecf20Sopenharmony_ci .mem_retst_mask = { 458c2ecf20Sopenharmony_ci [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */ 468c2ecf20Sopenharmony_ci }, 478c2ecf20Sopenharmony_ci .pwrsts_mem_ret = { 488c2ecf20Sopenharmony_ci [0] = PWRSTS_OFF_RET, /* gfx_mem */ 498c2ecf20Sopenharmony_ci }, 508c2ecf20Sopenharmony_ci .pwrsts_mem_on = { 518c2ecf20Sopenharmony_ci [0] = PWRSTS_ON, /* gfx_mem */ 528c2ecf20Sopenharmony_ci }, 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic struct powerdomain rtc_33xx_pwrdm = { 568c2ecf20Sopenharmony_ci .name = "rtc_pwrdm", 578c2ecf20Sopenharmony_ci .voltdm = { .name = "rtc" }, 588c2ecf20Sopenharmony_ci .prcm_offs = AM33XX_PRM_RTC_MOD, 598c2ecf20Sopenharmony_ci .pwrstctrl_offs = AM33XX_PM_RTC_PWRSTCTRL_OFFSET, 608c2ecf20Sopenharmony_ci .pwrstst_offs = AM33XX_PM_RTC_PWRSTST_OFFSET, 618c2ecf20Sopenharmony_ci .pwrsts = PWRSTS_ON, 628c2ecf20Sopenharmony_ci .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK, 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistatic struct powerdomain wkup_33xx_pwrdm = { 668c2ecf20Sopenharmony_ci .name = "wkup_pwrdm", 678c2ecf20Sopenharmony_ci .voltdm = { .name = "core" }, 688c2ecf20Sopenharmony_ci .prcm_offs = AM33XX_PRM_WKUP_MOD, 698c2ecf20Sopenharmony_ci .pwrstctrl_offs = AM33XX_PM_WKUP_PWRSTCTRL_OFFSET, 708c2ecf20Sopenharmony_ci .pwrstst_offs = AM33XX_PM_WKUP_PWRSTST_OFFSET, 718c2ecf20Sopenharmony_ci .pwrsts = PWRSTS_ON, 728c2ecf20Sopenharmony_ci .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK, 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistatic struct powerdomain per_33xx_pwrdm = { 768c2ecf20Sopenharmony_ci .name = "per_pwrdm", 778c2ecf20Sopenharmony_ci .voltdm = { .name = "core" }, 788c2ecf20Sopenharmony_ci .prcm_offs = AM33XX_PRM_PER_MOD, 798c2ecf20Sopenharmony_ci .pwrstctrl_offs = AM33XX_PM_PER_PWRSTCTRL_OFFSET, 808c2ecf20Sopenharmony_ci .pwrstst_offs = AM33XX_PM_PER_PWRSTST_OFFSET, 818c2ecf20Sopenharmony_ci .pwrsts = PWRSTS_OFF_RET_ON, 828c2ecf20Sopenharmony_ci .pwrsts_logic_ret = PWRSTS_OFF_RET, 838c2ecf20Sopenharmony_ci .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 848c2ecf20Sopenharmony_ci .banks = 3, 858c2ecf20Sopenharmony_ci .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK, 868c2ecf20Sopenharmony_ci .mem_on_mask = { 878c2ecf20Sopenharmony_ci [0] = AM33XX_PRUSS_MEM_ONSTATE_MASK, /* pruss_mem */ 888c2ecf20Sopenharmony_ci [1] = AM33XX_PER_MEM_ONSTATE_MASK, /* per_mem */ 898c2ecf20Sopenharmony_ci [2] = AM33XX_RAM_MEM_ONSTATE_MASK, /* ram_mem */ 908c2ecf20Sopenharmony_ci }, 918c2ecf20Sopenharmony_ci .mem_ret_mask = { 928c2ecf20Sopenharmony_ci [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */ 938c2ecf20Sopenharmony_ci [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */ 948c2ecf20Sopenharmony_ci [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */ 958c2ecf20Sopenharmony_ci }, 968c2ecf20Sopenharmony_ci .mem_pwrst_mask = { 978c2ecf20Sopenharmony_ci [0] = AM33XX_PRUSS_MEM_STATEST_MASK, /* pruss_mem */ 988c2ecf20Sopenharmony_ci [1] = AM33XX_PER_MEM_STATEST_MASK, /* per_mem */ 998c2ecf20Sopenharmony_ci [2] = AM33XX_RAM_MEM_STATEST_MASK, /* ram_mem */ 1008c2ecf20Sopenharmony_ci }, 1018c2ecf20Sopenharmony_ci .mem_retst_mask = { 1028c2ecf20Sopenharmony_ci [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */ 1038c2ecf20Sopenharmony_ci [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */ 1048c2ecf20Sopenharmony_ci [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */ 1058c2ecf20Sopenharmony_ci }, 1068c2ecf20Sopenharmony_ci .pwrsts_mem_ret = { 1078c2ecf20Sopenharmony_ci [0] = PWRSTS_OFF_RET, /* pruss_mem */ 1088c2ecf20Sopenharmony_ci [1] = PWRSTS_OFF_RET, /* per_mem */ 1098c2ecf20Sopenharmony_ci [2] = PWRSTS_OFF_RET, /* ram_mem */ 1108c2ecf20Sopenharmony_ci }, 1118c2ecf20Sopenharmony_ci .pwrsts_mem_on = { 1128c2ecf20Sopenharmony_ci [0] = PWRSTS_ON, /* pruss_mem */ 1138c2ecf20Sopenharmony_ci [1] = PWRSTS_ON, /* per_mem */ 1148c2ecf20Sopenharmony_ci [2] = PWRSTS_ON, /* ram_mem */ 1158c2ecf20Sopenharmony_ci }, 1168c2ecf20Sopenharmony_ci}; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_cistatic struct powerdomain mpu_33xx_pwrdm = { 1198c2ecf20Sopenharmony_ci .name = "mpu_pwrdm", 1208c2ecf20Sopenharmony_ci .voltdm = { .name = "mpu" }, 1218c2ecf20Sopenharmony_ci .prcm_offs = AM33XX_PRM_MPU_MOD, 1228c2ecf20Sopenharmony_ci .pwrstctrl_offs = AM33XX_PM_MPU_PWRSTCTRL_OFFSET, 1238c2ecf20Sopenharmony_ci .pwrstst_offs = AM33XX_PM_MPU_PWRSTST_OFFSET, 1248c2ecf20Sopenharmony_ci .pwrsts = PWRSTS_OFF_RET_ON, 1258c2ecf20Sopenharmony_ci .pwrsts_logic_ret = PWRSTS_OFF_RET, 1268c2ecf20Sopenharmony_ci .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 1278c2ecf20Sopenharmony_ci .banks = 3, 1288c2ecf20Sopenharmony_ci .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK, 1298c2ecf20Sopenharmony_ci .mem_on_mask = { 1308c2ecf20Sopenharmony_ci [0] = AM33XX_MPU_L1_ONSTATE_MASK, /* mpu_l1 */ 1318c2ecf20Sopenharmony_ci [1] = AM33XX_MPU_L2_ONSTATE_MASK, /* mpu_l2 */ 1328c2ecf20Sopenharmony_ci [2] = AM33XX_MPU_RAM_ONSTATE_MASK, /* mpu_ram */ 1338c2ecf20Sopenharmony_ci }, 1348c2ecf20Sopenharmony_ci .mem_ret_mask = { 1358c2ecf20Sopenharmony_ci [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */ 1368c2ecf20Sopenharmony_ci [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */ 1378c2ecf20Sopenharmony_ci [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */ 1388c2ecf20Sopenharmony_ci }, 1398c2ecf20Sopenharmony_ci .mem_pwrst_mask = { 1408c2ecf20Sopenharmony_ci [0] = AM33XX_MPU_L1_STATEST_MASK, /* mpu_l1 */ 1418c2ecf20Sopenharmony_ci [1] = AM33XX_MPU_L2_STATEST_MASK, /* mpu_l2 */ 1428c2ecf20Sopenharmony_ci [2] = AM33XX_MPU_RAM_STATEST_MASK, /* mpu_ram */ 1438c2ecf20Sopenharmony_ci }, 1448c2ecf20Sopenharmony_ci .mem_retst_mask = { 1458c2ecf20Sopenharmony_ci [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */ 1468c2ecf20Sopenharmony_ci [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */ 1478c2ecf20Sopenharmony_ci [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */ 1488c2ecf20Sopenharmony_ci }, 1498c2ecf20Sopenharmony_ci .pwrsts_mem_ret = { 1508c2ecf20Sopenharmony_ci [0] = PWRSTS_OFF_RET, /* mpu_l1 */ 1518c2ecf20Sopenharmony_ci [1] = PWRSTS_OFF_RET, /* mpu_l2 */ 1528c2ecf20Sopenharmony_ci [2] = PWRSTS_OFF_RET, /* mpu_ram */ 1538c2ecf20Sopenharmony_ci }, 1548c2ecf20Sopenharmony_ci .pwrsts_mem_on = { 1558c2ecf20Sopenharmony_ci [0] = PWRSTS_ON, /* mpu_l1 */ 1568c2ecf20Sopenharmony_ci [1] = PWRSTS_ON, /* mpu_l2 */ 1578c2ecf20Sopenharmony_ci [2] = PWRSTS_ON, /* mpu_ram */ 1588c2ecf20Sopenharmony_ci }, 1598c2ecf20Sopenharmony_ci}; 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_cistatic struct powerdomain cefuse_33xx_pwrdm = { 1628c2ecf20Sopenharmony_ci .name = "cefuse_pwrdm", 1638c2ecf20Sopenharmony_ci .voltdm = { .name = "core" }, 1648c2ecf20Sopenharmony_ci .prcm_offs = AM33XX_PRM_CEFUSE_MOD, 1658c2ecf20Sopenharmony_ci .pwrstctrl_offs = AM33XX_PM_CEFUSE_PWRSTCTRL_OFFSET, 1668c2ecf20Sopenharmony_ci .pwrstst_offs = AM33XX_PM_CEFUSE_PWRSTST_OFFSET, 1678c2ecf20Sopenharmony_ci .pwrsts = PWRSTS_OFF_ON, 1688c2ecf20Sopenharmony_ci}; 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_cistatic struct powerdomain *powerdomains_am33xx[] __initdata = { 1718c2ecf20Sopenharmony_ci &gfx_33xx_pwrdm, 1728c2ecf20Sopenharmony_ci &rtc_33xx_pwrdm, 1738c2ecf20Sopenharmony_ci &wkup_33xx_pwrdm, 1748c2ecf20Sopenharmony_ci &per_33xx_pwrdm, 1758c2ecf20Sopenharmony_ci &mpu_33xx_pwrdm, 1768c2ecf20Sopenharmony_ci &cefuse_33xx_pwrdm, 1778c2ecf20Sopenharmony_ci NULL, 1788c2ecf20Sopenharmony_ci}; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_civoid __init am33xx_powerdomains_init(void) 1818c2ecf20Sopenharmony_ci{ 1828c2ecf20Sopenharmony_ci pwrdm_register_platform_funcs(&am33xx_pwrdm_operations); 1838c2ecf20Sopenharmony_ci pwrdm_register_pwrdms(powerdomains_am33xx); 1848c2ecf20Sopenharmony_ci pwrdm_complete_init(); 1858c2ecf20Sopenharmony_ci} 186