1*52e6676eSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
23f0ea764SVaibhav Hiremath /*
33f0ea764SVaibhav Hiremath * AM33XX Power domain data
43f0ea764SVaibhav Hiremath *
583bf6db0SAlexander A. Klimov * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
63f0ea764SVaibhav Hiremath */
73f0ea764SVaibhav Hiremath
83f0ea764SVaibhav Hiremath #include <linux/kernel.h>
93f0ea764SVaibhav Hiremath #include <linux/init.h>
103f0ea764SVaibhav Hiremath
113f0ea764SVaibhav Hiremath #include "powerdomain.h"
123f0ea764SVaibhav Hiremath #include "prcm-common.h"
133f0ea764SVaibhav Hiremath #include "prm-regbits-33xx.h"
143f0ea764SVaibhav Hiremath #include "prm33xx.h"
153f0ea764SVaibhav Hiremath
163f0ea764SVaibhav Hiremath static struct powerdomain gfx_33xx_pwrdm = {
173f0ea764SVaibhav Hiremath .name = "gfx_pwrdm",
183f0ea764SVaibhav Hiremath .voltdm = { .name = "core" },
193f0ea764SVaibhav Hiremath .prcm_offs = AM33XX_PRM_GFX_MOD,
203f0ea764SVaibhav Hiremath .pwrstctrl_offs = AM33XX_PM_GFX_PWRSTCTRL_OFFSET,
213f0ea764SVaibhav Hiremath .pwrstst_offs = AM33XX_PM_GFX_PWRSTST_OFFSET,
223f0ea764SVaibhav Hiremath .pwrsts = PWRSTS_OFF_RET_ON,
233f0ea764SVaibhav Hiremath .pwrsts_logic_ret = PWRSTS_OFF_RET,
243f0ea764SVaibhav Hiremath .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
253f0ea764SVaibhav Hiremath .banks = 1,
263f0ea764SVaibhav Hiremath .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
273f0ea764SVaibhav Hiremath .mem_on_mask = {
283f0ea764SVaibhav Hiremath [0] = AM33XX_GFX_MEM_ONSTATE_MASK, /* gfx_mem */
293f0ea764SVaibhav Hiremath },
303f0ea764SVaibhav Hiremath .mem_ret_mask = {
313f0ea764SVaibhav Hiremath [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */
323f0ea764SVaibhav Hiremath },
333f0ea764SVaibhav Hiremath .mem_pwrst_mask = {
343f0ea764SVaibhav Hiremath [0] = AM33XX_GFX_MEM_STATEST_MASK, /* gfx_mem */
353f0ea764SVaibhav Hiremath },
363f0ea764SVaibhav Hiremath .mem_retst_mask = {
373f0ea764SVaibhav Hiremath [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */
383f0ea764SVaibhav Hiremath },
393f0ea764SVaibhav Hiremath .pwrsts_mem_ret = {
403f0ea764SVaibhav Hiremath [0] = PWRSTS_OFF_RET, /* gfx_mem */
413f0ea764SVaibhav Hiremath },
423f0ea764SVaibhav Hiremath .pwrsts_mem_on = {
433f0ea764SVaibhav Hiremath [0] = PWRSTS_ON, /* gfx_mem */
443f0ea764SVaibhav Hiremath },
453f0ea764SVaibhav Hiremath };
463f0ea764SVaibhav Hiremath
473f0ea764SVaibhav Hiremath static struct powerdomain rtc_33xx_pwrdm = {
483f0ea764SVaibhav Hiremath .name = "rtc_pwrdm",
493f0ea764SVaibhav Hiremath .voltdm = { .name = "rtc" },
503f0ea764SVaibhav Hiremath .prcm_offs = AM33XX_PRM_RTC_MOD,
513f0ea764SVaibhav Hiremath .pwrstctrl_offs = AM33XX_PM_RTC_PWRSTCTRL_OFFSET,
523f0ea764SVaibhav Hiremath .pwrstst_offs = AM33XX_PM_RTC_PWRSTST_OFFSET,
533f0ea764SVaibhav Hiremath .pwrsts = PWRSTS_ON,
543f0ea764SVaibhav Hiremath .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
553f0ea764SVaibhav Hiremath };
563f0ea764SVaibhav Hiremath
573f0ea764SVaibhav Hiremath static struct powerdomain wkup_33xx_pwrdm = {
583f0ea764SVaibhav Hiremath .name = "wkup_pwrdm",
593f0ea764SVaibhav Hiremath .voltdm = { .name = "core" },
603f0ea764SVaibhav Hiremath .prcm_offs = AM33XX_PRM_WKUP_MOD,
613f0ea764SVaibhav Hiremath .pwrstctrl_offs = AM33XX_PM_WKUP_PWRSTCTRL_OFFSET,
623f0ea764SVaibhav Hiremath .pwrstst_offs = AM33XX_PM_WKUP_PWRSTST_OFFSET,
633f0ea764SVaibhav Hiremath .pwrsts = PWRSTS_ON,
643f0ea764SVaibhav Hiremath .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK,
653f0ea764SVaibhav Hiremath };
663f0ea764SVaibhav Hiremath
673f0ea764SVaibhav Hiremath static struct powerdomain per_33xx_pwrdm = {
683f0ea764SVaibhav Hiremath .name = "per_pwrdm",
693f0ea764SVaibhav Hiremath .voltdm = { .name = "core" },
703f0ea764SVaibhav Hiremath .prcm_offs = AM33XX_PRM_PER_MOD,
713f0ea764SVaibhav Hiremath .pwrstctrl_offs = AM33XX_PM_PER_PWRSTCTRL_OFFSET,
723f0ea764SVaibhav Hiremath .pwrstst_offs = AM33XX_PM_PER_PWRSTST_OFFSET,
733f0ea764SVaibhav Hiremath .pwrsts = PWRSTS_OFF_RET_ON,
743f0ea764SVaibhav Hiremath .pwrsts_logic_ret = PWRSTS_OFF_RET,
753f0ea764SVaibhav Hiremath .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
763f0ea764SVaibhav Hiremath .banks = 3,
773f0ea764SVaibhav Hiremath .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK,
783f0ea764SVaibhav Hiremath .mem_on_mask = {
793f0ea764SVaibhav Hiremath [0] = AM33XX_PRUSS_MEM_ONSTATE_MASK, /* pruss_mem */
803f0ea764SVaibhav Hiremath [1] = AM33XX_PER_MEM_ONSTATE_MASK, /* per_mem */
813f0ea764SVaibhav Hiremath [2] = AM33XX_RAM_MEM_ONSTATE_MASK, /* ram_mem */
823f0ea764SVaibhav Hiremath },
833f0ea764SVaibhav Hiremath .mem_ret_mask = {
843f0ea764SVaibhav Hiremath [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */
853f0ea764SVaibhav Hiremath [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */
863f0ea764SVaibhav Hiremath [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */
873f0ea764SVaibhav Hiremath },
883f0ea764SVaibhav Hiremath .mem_pwrst_mask = {
893f0ea764SVaibhav Hiremath [0] = AM33XX_PRUSS_MEM_STATEST_MASK, /* pruss_mem */
903f0ea764SVaibhav Hiremath [1] = AM33XX_PER_MEM_STATEST_MASK, /* per_mem */
913f0ea764SVaibhav Hiremath [2] = AM33XX_RAM_MEM_STATEST_MASK, /* ram_mem */
923f0ea764SVaibhav Hiremath },
933f0ea764SVaibhav Hiremath .mem_retst_mask = {
943f0ea764SVaibhav Hiremath [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */
953f0ea764SVaibhav Hiremath [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */
963f0ea764SVaibhav Hiremath [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */
973f0ea764SVaibhav Hiremath },
983f0ea764SVaibhav Hiremath .pwrsts_mem_ret = {
993f0ea764SVaibhav Hiremath [0] = PWRSTS_OFF_RET, /* pruss_mem */
1003f0ea764SVaibhav Hiremath [1] = PWRSTS_OFF_RET, /* per_mem */
1013f0ea764SVaibhav Hiremath [2] = PWRSTS_OFF_RET, /* ram_mem */
1023f0ea764SVaibhav Hiremath },
1033f0ea764SVaibhav Hiremath .pwrsts_mem_on = {
1043f0ea764SVaibhav Hiremath [0] = PWRSTS_ON, /* pruss_mem */
1053f0ea764SVaibhav Hiremath [1] = PWRSTS_ON, /* per_mem */
1063f0ea764SVaibhav Hiremath [2] = PWRSTS_ON, /* ram_mem */
1073f0ea764SVaibhav Hiremath },
1083f0ea764SVaibhav Hiremath };
1093f0ea764SVaibhav Hiremath
1103f0ea764SVaibhav Hiremath static struct powerdomain mpu_33xx_pwrdm = {
1113f0ea764SVaibhav Hiremath .name = "mpu_pwrdm",
1123f0ea764SVaibhav Hiremath .voltdm = { .name = "mpu" },
1133f0ea764SVaibhav Hiremath .prcm_offs = AM33XX_PRM_MPU_MOD,
1143f0ea764SVaibhav Hiremath .pwrstctrl_offs = AM33XX_PM_MPU_PWRSTCTRL_OFFSET,
1153f0ea764SVaibhav Hiremath .pwrstst_offs = AM33XX_PM_MPU_PWRSTST_OFFSET,
1163f0ea764SVaibhav Hiremath .pwrsts = PWRSTS_OFF_RET_ON,
1173f0ea764SVaibhav Hiremath .pwrsts_logic_ret = PWRSTS_OFF_RET,
1183f0ea764SVaibhav Hiremath .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
1193f0ea764SVaibhav Hiremath .banks = 3,
1203f0ea764SVaibhav Hiremath .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
1213f0ea764SVaibhav Hiremath .mem_on_mask = {
1223f0ea764SVaibhav Hiremath [0] = AM33XX_MPU_L1_ONSTATE_MASK, /* mpu_l1 */
1233f0ea764SVaibhav Hiremath [1] = AM33XX_MPU_L2_ONSTATE_MASK, /* mpu_l2 */
1243f0ea764SVaibhav Hiremath [2] = AM33XX_MPU_RAM_ONSTATE_MASK, /* mpu_ram */
1253f0ea764SVaibhav Hiremath },
1263f0ea764SVaibhav Hiremath .mem_ret_mask = {
1273f0ea764SVaibhav Hiremath [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */
1283f0ea764SVaibhav Hiremath [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */
1293f0ea764SVaibhav Hiremath [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */
1303f0ea764SVaibhav Hiremath },
1313f0ea764SVaibhav Hiremath .mem_pwrst_mask = {
1323f0ea764SVaibhav Hiremath [0] = AM33XX_MPU_L1_STATEST_MASK, /* mpu_l1 */
1333f0ea764SVaibhav Hiremath [1] = AM33XX_MPU_L2_STATEST_MASK, /* mpu_l2 */
1343f0ea764SVaibhav Hiremath [2] = AM33XX_MPU_RAM_STATEST_MASK, /* mpu_ram */
1353f0ea764SVaibhav Hiremath },
1363f0ea764SVaibhav Hiremath .mem_retst_mask = {
1373f0ea764SVaibhav Hiremath [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */
1383f0ea764SVaibhav Hiremath [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */
1393f0ea764SVaibhav Hiremath [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */
1403f0ea764SVaibhav Hiremath },
1413f0ea764SVaibhav Hiremath .pwrsts_mem_ret = {
1423f0ea764SVaibhav Hiremath [0] = PWRSTS_OFF_RET, /* mpu_l1 */
1433f0ea764SVaibhav Hiremath [1] = PWRSTS_OFF_RET, /* mpu_l2 */
1443f0ea764SVaibhav Hiremath [2] = PWRSTS_OFF_RET, /* mpu_ram */
1453f0ea764SVaibhav Hiremath },
1463f0ea764SVaibhav Hiremath .pwrsts_mem_on = {
1473f0ea764SVaibhav Hiremath [0] = PWRSTS_ON, /* mpu_l1 */
1483f0ea764SVaibhav Hiremath [1] = PWRSTS_ON, /* mpu_l2 */
1493f0ea764SVaibhav Hiremath [2] = PWRSTS_ON, /* mpu_ram */
1503f0ea764SVaibhav Hiremath },
1513f0ea764SVaibhav Hiremath };
1523f0ea764SVaibhav Hiremath
1533f0ea764SVaibhav Hiremath static struct powerdomain cefuse_33xx_pwrdm = {
1543f0ea764SVaibhav Hiremath .name = "cefuse_pwrdm",
1553f0ea764SVaibhav Hiremath .voltdm = { .name = "core" },
1563f0ea764SVaibhav Hiremath .prcm_offs = AM33XX_PRM_CEFUSE_MOD,
1573f0ea764SVaibhav Hiremath .pwrstctrl_offs = AM33XX_PM_CEFUSE_PWRSTCTRL_OFFSET,
1583f0ea764SVaibhav Hiremath .pwrstst_offs = AM33XX_PM_CEFUSE_PWRSTST_OFFSET,
1593f0ea764SVaibhav Hiremath .pwrsts = PWRSTS_OFF_ON,
1603f0ea764SVaibhav Hiremath };
1613f0ea764SVaibhav Hiremath
1623f0ea764SVaibhav Hiremath static struct powerdomain *powerdomains_am33xx[] __initdata = {
1633f0ea764SVaibhav Hiremath &gfx_33xx_pwrdm,
1643f0ea764SVaibhav Hiremath &rtc_33xx_pwrdm,
1653f0ea764SVaibhav Hiremath &wkup_33xx_pwrdm,
1663f0ea764SVaibhav Hiremath &per_33xx_pwrdm,
1673f0ea764SVaibhav Hiremath &mpu_33xx_pwrdm,
1683f0ea764SVaibhav Hiremath &cefuse_33xx_pwrdm,
1693f0ea764SVaibhav Hiremath NULL,
1703f0ea764SVaibhav Hiremath };
1713f0ea764SVaibhav Hiremath
am33xx_powerdomains_init(void)1723f0ea764SVaibhav Hiremath void __init am33xx_powerdomains_init(void)
1733f0ea764SVaibhav Hiremath {
1743f0ea764SVaibhav Hiremath pwrdm_register_platform_funcs(&am33xx_pwrdm_operations);
1753f0ea764SVaibhav Hiremath pwrdm_register_pwrdms(powerdomains_am33xx);
1763f0ea764SVaibhav Hiremath pwrdm_complete_init();
1773f0ea764SVaibhav Hiremath }
178