/* * FUNCTION PURPOSE: Power up a module * * DESCRIPTION: Powers up the requested module and the associated power domain * if required. No action is taken it the module is already * powered up. * * Returns 0 on success, -1 if the module can't be powered up, or * if there is a timeout waiting for the transition. */ int psc_enable_module(u32 mod_num) { u32 mdctl; /* Set the bit to apply reset */ mdctl = DEVICE_REG32_R(DEVICE_PSC_BASE + PSC_REG_MDCTL(mod_num)); if ((mdctl & 0x3f) == PSC_REG_VAL_MDSTAT_STATE_ON) return 0; return psc_set_state(mod_num, PSC_REG_VAL_MDCTL_NEXT_ON); }
/* * FUNCTION PURPOSE: Power down a module * * DESCRIPTION: Powers down the requested module. * * Returns 0 on success, -1 on failure or timeout. */ int psc_disable_module(u32 mod_num) { u32 mdctl; /* Set the bit to apply reset */ mdctl = DEVICE_REG32_R(DEVICE_PSC_BASE + PSC_REG_MDCTL(mod_num)); if ((mdctl & 0x3f) == 0) return 0; mdctl = PSC_REG_MDCTL_SET_LRSTZ(mdctl, 0); DEVICE_REG32_W(DEVICE_PSC_BASE + PSC_REG_MDCTL(mod_num), mdctl); return psc_set_state(mod_num, PSC_REG_VAL_MDCTL_NEXT_SWRSTDISABLE); }
/** * psc_disable_module() - Power down a module * @mod_num: LPSC module number * * Return: 0 on success, -1 on failure or timeout. */ int psc_disable_module(u32 mod_num) { u32 mdctl; /* Set the bit to apply reset */ mdctl = __raw_readl(KS2_PSC_BASE + PSC_REG_MDCTL(mod_num)); if ((mdctl & 0x3f) == 0) return 0; mdctl = PSC_REG_MDCTL_SET_LRSTZ(mdctl, 0); __raw_writel(mdctl, KS2_PSC_BASE + PSC_REG_MDCTL(mod_num)); return psc_set_state(mod_num, PSC_REG_VAL_MDCTL_NEXT_SWRSTDISABLE); }