1a5ffef6aSPaul Walmsley /* 2a5ffef6aSPaul Walmsley * OMAP2420 clockdomains 3a5ffef6aSPaul Walmsley * 4a5ffef6aSPaul Walmsley * Copyright (C) 2008-2011 Texas Instruments, Inc. 5a5ffef6aSPaul Walmsley * Copyright (C) 2008-2010 Nokia Corporation 6a5ffef6aSPaul Walmsley * 7a5ffef6aSPaul Walmsley * Paul Walmsley, Jouni Högander 8a5ffef6aSPaul Walmsley * 9a5ffef6aSPaul Walmsley * This file contains clockdomains and clockdomain wakeup dependencies 10a5ffef6aSPaul Walmsley * for OMAP2420 chips. Some notes: 11a5ffef6aSPaul Walmsley * 12a5ffef6aSPaul Walmsley * A useful validation rule for struct clockdomain: Any clockdomain 13a5ffef6aSPaul Walmsley * referenced by a wkdep_srcs must have a dep_bit assigned. So 14a5ffef6aSPaul Walmsley * wkdep_srcs are really just software-controllable dependencies. 15a5ffef6aSPaul Walmsley * Non-software-controllable dependencies do exist, but they are not 16a5ffef6aSPaul Walmsley * encoded below (yet). 17a5ffef6aSPaul Walmsley * 18a5ffef6aSPaul Walmsley * 24xx does not support programmable sleep dependencies (SLEEPDEP) 19a5ffef6aSPaul Walmsley * 20a5ffef6aSPaul Walmsley * The overly-specific dep_bit names are due to a bit name collision 21a5ffef6aSPaul Walmsley * with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift 22a5ffef6aSPaul Walmsley * value are the same for all powerdomains: 2 23a5ffef6aSPaul Walmsley * 24a5ffef6aSPaul Walmsley * XXX should dep_bit be a mask, so we can test to see if it is 0 as a 25a5ffef6aSPaul Walmsley * sanity check? 26a5ffef6aSPaul Walmsley * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE 27a5ffef6aSPaul Walmsley */ 28a5ffef6aSPaul Walmsley 29a5ffef6aSPaul Walmsley /* 30a5ffef6aSPaul Walmsley * To-Do List 31a5ffef6aSPaul Walmsley * -> Port the Sleep/Wakeup dependencies for the domains 32a5ffef6aSPaul Walmsley * from the Power domain framework 33a5ffef6aSPaul Walmsley */ 34a5ffef6aSPaul Walmsley 35a5ffef6aSPaul Walmsley #include <linux/kernel.h> 36a5ffef6aSPaul Walmsley #include <linux/io.h> 37a5ffef6aSPaul Walmsley 38*e4c060dbSTony Lindgren #include "soc.h" 39a5ffef6aSPaul Walmsley #include "clockdomain.h" 40a5ffef6aSPaul Walmsley #include "prm2xxx_3xxx.h" 41a5ffef6aSPaul Walmsley #include "cm2xxx_3xxx.h" 42a5ffef6aSPaul Walmsley #include "cm-regbits-24xx.h" 43a5ffef6aSPaul Walmsley #include "prm-regbits-24xx.h" 44a5ffef6aSPaul Walmsley 45a5ffef6aSPaul Walmsley /* 46a5ffef6aSPaul Walmsley * Clockdomain dependencies for wkdeps 47a5ffef6aSPaul Walmsley * 48a5ffef6aSPaul Walmsley * XXX Hardware dependencies (e.g., dependencies that cannot be 49a5ffef6aSPaul Walmsley * changed in software) are not included here yet, but should be. 50a5ffef6aSPaul Walmsley */ 51a5ffef6aSPaul Walmsley 52a5ffef6aSPaul Walmsley /* Wakeup dependency source arrays */ 53a5ffef6aSPaul Walmsley 54a5ffef6aSPaul Walmsley /* 2420-specific possible wakeup dependencies */ 55a5ffef6aSPaul Walmsley 56a5ffef6aSPaul Walmsley /* 2420 PM_WKDEP_MPU: CORE, DSP, WKUP */ 57a5ffef6aSPaul Walmsley static struct clkdm_dep mpu_2420_wkdeps[] = { 58a5ffef6aSPaul Walmsley { .clkdm_name = "core_l3_clkdm" }, 59a5ffef6aSPaul Walmsley { .clkdm_name = "core_l4_clkdm" }, 60a5ffef6aSPaul Walmsley { .clkdm_name = "dsp_clkdm" }, 61a5ffef6aSPaul Walmsley { .clkdm_name = "wkup_clkdm" }, 62a5ffef6aSPaul Walmsley { NULL }, 63a5ffef6aSPaul Walmsley }; 64a5ffef6aSPaul Walmsley 65a5ffef6aSPaul Walmsley /* 2420 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP */ 66a5ffef6aSPaul Walmsley static struct clkdm_dep core_2420_wkdeps[] = { 67a5ffef6aSPaul Walmsley { .clkdm_name = "dsp_clkdm" }, 68a5ffef6aSPaul Walmsley { .clkdm_name = "gfx_clkdm" }, 69a5ffef6aSPaul Walmsley { .clkdm_name = "mpu_clkdm" }, 70a5ffef6aSPaul Walmsley { .clkdm_name = "wkup_clkdm" }, 71a5ffef6aSPaul Walmsley { NULL }, 72a5ffef6aSPaul Walmsley }; 73a5ffef6aSPaul Walmsley 74a5ffef6aSPaul Walmsley /* 75a5ffef6aSPaul Walmsley * 2420-only clockdomains 76a5ffef6aSPaul Walmsley */ 77a5ffef6aSPaul Walmsley 78a5ffef6aSPaul Walmsley static struct clockdomain mpu_2420_clkdm = { 79a5ffef6aSPaul Walmsley .name = "mpu_clkdm", 80a5ffef6aSPaul Walmsley .pwrdm = { .name = "mpu_pwrdm" }, 81a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP, 82a5ffef6aSPaul Walmsley .wkdep_srcs = mpu_2420_wkdeps, 83a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK, 84a5ffef6aSPaul Walmsley }; 85a5ffef6aSPaul Walmsley 86a5ffef6aSPaul Walmsley static struct clockdomain iva1_2420_clkdm = { 87a5ffef6aSPaul Walmsley .name = "iva1_clkdm", 88a5ffef6aSPaul Walmsley .pwrdm = { .name = "dsp_pwrdm" }, 89a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP, 90a5ffef6aSPaul Walmsley .dep_bit = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT, 91a5ffef6aSPaul Walmsley .wkdep_srcs = dsp_24xx_wkdeps, 92a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP2420_AUTOSTATE_IVA_MASK, 93a5ffef6aSPaul Walmsley }; 94a5ffef6aSPaul Walmsley 95a5ffef6aSPaul Walmsley static struct clockdomain dsp_2420_clkdm = { 96a5ffef6aSPaul Walmsley .name = "dsp_clkdm", 97a5ffef6aSPaul Walmsley .pwrdm = { .name = "dsp_pwrdm" }, 98a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP, 99a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK, 100a5ffef6aSPaul Walmsley }; 101a5ffef6aSPaul Walmsley 102a5ffef6aSPaul Walmsley static struct clockdomain gfx_2420_clkdm = { 103a5ffef6aSPaul Walmsley .name = "gfx_clkdm", 104a5ffef6aSPaul Walmsley .pwrdm = { .name = "gfx_pwrdm" }, 105a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP_SWSUP, 106a5ffef6aSPaul Walmsley .wkdep_srcs = gfx_24xx_wkdeps, 107a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK, 108a5ffef6aSPaul Walmsley }; 109a5ffef6aSPaul Walmsley 110a5ffef6aSPaul Walmsley static struct clockdomain core_l3_2420_clkdm = { 111a5ffef6aSPaul Walmsley .name = "core_l3_clkdm", 112a5ffef6aSPaul Walmsley .pwrdm = { .name = "core_pwrdm" }, 113a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP, 114a5ffef6aSPaul Walmsley .wkdep_srcs = core_2420_wkdeps, 115a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK, 116a5ffef6aSPaul Walmsley }; 117a5ffef6aSPaul Walmsley 118a5ffef6aSPaul Walmsley static struct clockdomain core_l4_2420_clkdm = { 119a5ffef6aSPaul Walmsley .name = "core_l4_clkdm", 120a5ffef6aSPaul Walmsley .pwrdm = { .name = "core_pwrdm" }, 121a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP, 122a5ffef6aSPaul Walmsley .wkdep_srcs = core_2420_wkdeps, 123a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK, 124a5ffef6aSPaul Walmsley }; 125a5ffef6aSPaul Walmsley 126a5ffef6aSPaul Walmsley static struct clockdomain dss_2420_clkdm = { 127a5ffef6aSPaul Walmsley .name = "dss_clkdm", 128a5ffef6aSPaul Walmsley .pwrdm = { .name = "core_pwrdm" }, 129a5ffef6aSPaul Walmsley .flags = CLKDM_CAN_HWSUP, 130a5ffef6aSPaul Walmsley .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK, 131a5ffef6aSPaul Walmsley }; 132a5ffef6aSPaul Walmsley 133a5ffef6aSPaul Walmsley static struct clockdomain *clockdomains_omap242x[] __initdata = { 134a5ffef6aSPaul Walmsley &wkup_common_clkdm, 135a5ffef6aSPaul Walmsley &mpu_2420_clkdm, 136a5ffef6aSPaul Walmsley &iva1_2420_clkdm, 137a5ffef6aSPaul Walmsley &dsp_2420_clkdm, 138a5ffef6aSPaul Walmsley &gfx_2420_clkdm, 139a5ffef6aSPaul Walmsley &core_l3_2420_clkdm, 140a5ffef6aSPaul Walmsley &core_l4_2420_clkdm, 141a5ffef6aSPaul Walmsley &dss_2420_clkdm, 142a5ffef6aSPaul Walmsley NULL, 143a5ffef6aSPaul Walmsley }; 144a5ffef6aSPaul Walmsley 145a5ffef6aSPaul Walmsley void __init omap242x_clockdomains_init(void) 146a5ffef6aSPaul Walmsley { 147a5ffef6aSPaul Walmsley if (!cpu_is_omap242x()) 148a5ffef6aSPaul Walmsley return; 149a5ffef6aSPaul Walmsley 150a5ffef6aSPaul Walmsley clkdm_register_platform_funcs(&omap2_clkdm_operations); 151a5ffef6aSPaul Walmsley clkdm_register_clkdms(clockdomains_omap242x); 152a5ffef6aSPaul Walmsley clkdm_complete_init(); 153a5ffef6aSPaul Walmsley } 154