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