From: Paul Walmsley Date: Thu, 21 Jun 2012 02:11:36 +0000 (-0600) Subject: Merge branches 'clock_cleanup_misc_3.6', 'control_clean_dspbridge_writes_cleanup_3... X-Git-Tag: next-20120724~11^2~11^2~1^2^2^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=07b3a13957aa250ff5b5409b8ed756b113544112;p=karo-tx-linux.git Merge branches 'clock_cleanup_misc_3.6', 'control_clean_dspbridge_writes_cleanup_3.6', 'hwmod_soc_conditional_cleanup_3.6', 'mcbsp_clock_aliases_cleanup_3.6' and 'remove_clkdm_requirement_from_hwmod_3.6' into omap_cleanup_a_3.6 Conflicts: arch/arm/mach-omap2/omap_hwmod.c --- 07b3a13957aa250ff5b5409b8ed756b113544112 diff --cc arch/arm/mach-omap2/omap_hwmod.c index bf86f7e8f91f,bf86f7e8f91f,acc616c02e14,bf86f7e8f91f,32a5e08ffb9b..c55df5eed7c8 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@@@@@ -807,10 -807,10 -831,7 -807,10 -807,10 +831,7 @@@@@@ static void _omap4_enable_module(struc */ static int _omap4_wait_target_disable(struct omap_hwmod *oh) { -- -- if (!cpu_is_omap44xx()) -- -- return 0; -- -- ---- if (!oh) ++++ if (!oh || !oh->clkdm) return -EINVAL; if (oh->_int_flags & _HWMOD_NO_MPU_PORT) @@@@@@ -1295,14 -1295,14 -1316,11 -1295,14 -1296,12 +1317,9 @@@@@@ static struct omap_hwmod *_lookup(cons */ static int _init_clkdm(struct omap_hwmod *oh) { -- -- if (cpu_is_omap24xx() || cpu_is_omap34xx()) - if (!oh->clkdm_name) { - pr_warning("omap_hwmod: %s: no clkdm_name\n", oh->name); - return -EINVAL; - } - return 0; - ++++ if (!oh->clkdm_name) + return 0; -- - if (!oh->clkdm_name) { -- - pr_warning("omap_hwmod: %s: no clkdm_name\n", oh->name); -- - return -EINVAL; -- - } -- - oh->clkdm = clkdm_lookup(oh->clkdm_name); if (!oh->clkdm) { pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n", @@@@@@ -1447,16 -1447,16 -1425,9 -1447,16 -1446,20 +1424,9 @@@@@@ static int _assert_hardreset(struct oma if (IS_ERR_VALUE(ret)) return ret; -- - if (cpu_is_omap24xx() || cpu_is_omap34xx()) - if (cpu_is_omap24xx() || cpu_is_omap34xx()) { -- -- return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, -- -- ohri.rst_shift); -- - else if (cpu_is_omap44xx()) -- - return omap4_prminst_assert_hardreset(ohri.rst_shift, -- - oh->clkdm->pwrdm.ptr->prcm_partition, -- - oh->clkdm->pwrdm.ptr->prcm_offs, -- - oh->prcm.omap4.rstctrl_offs); -- - else -- - return -EINVAL; - } else if (cpu_is_omap44xx()) { - if (!oh->clkdm) - return -EINVAL; ++ ++ ret = soc_ops.assert_hardreset(oh, &ohri); ++ + - return omap4_prminst_assert_hardreset(ohri.rst_shift, - oh->clkdm->pwrdm.ptr->prcm_partition, - oh->clkdm->pwrdm.ptr->prcm_offs, - oh->prcm.omap4.rstctrl_offs); - } else { - return -EINVAL; - } ++ ++ return ret; } /** @@@@@@ -1481,22 -1481,22 -1458,7 -1481,22 -1484,26 +1457,7 @@@@@@ static int _deassert_hardreset(struct o if (IS_ERR_VALUE(ret)) return ret; -- -- if (cpu_is_omap24xx() || cpu_is_omap34xx()) { -- -- ret = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs, -- -- ohri.rst_shift, -- -- ohri.st_shift); -- -- } else if (cpu_is_omap44xx()) { -- -- if (ohri.st_shift) -- -- pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", -- -- oh->name, name); - - if (!oh->clkdm) - return -EINVAL; - -- -- ret = omap4_prminst_deassert_hardreset(ohri.rst_shift, -- -- oh->clkdm->pwrdm.ptr->prcm_partition, -- -- oh->clkdm->pwrdm.ptr->prcm_offs, -- -- oh->prcm.omap4.rstctrl_offs); -- -- } else { -- -- return -EINVAL; -- -- } -- -- ++ ++ ret = soc_ops.deassert_hardreset(oh, &ohri); if (ret == -EBUSY) pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name); @@@@@@ -1523,17 -1523,17 -1492,7 -1523,17 -1530,20 +1491,7 @@@@@@ static int _read_hardreset(struct omap_ if (IS_ERR_VALUE(ret)) return ret; -- -- if (cpu_is_omap24xx() || cpu_is_omap34xx()) { -- -- return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, -- -- ohri.st_shift); -- -- } else if (cpu_is_omap44xx()) { - if (!oh->clkdm) - return -EINVAL; - -- -- return omap4_prminst_is_hardreset_asserted(ohri.rst_shift, -- -- oh->clkdm->pwrdm.ptr->prcm_partition, -- -- oh->clkdm->pwrdm.ptr->prcm_offs, -- -- oh->prcm.omap4.rstctrl_offs); -- -- } else { -- -- return -EINVAL; -- -- } ++ ++ return soc_ops.is_hardreset_asserted(oh, &ohri); } /** @@@@@@ -2431,6 -2431,6 -2390,186 -2431,6 -2441,6 +2389,194 @@@@@@ static int __init _alloc_linkspace(stru return 0; } ++ ++/* Static functions intended only for use in soc_ops field function pointers */ ++ ++ ++ ++/** ++ ++ * _omap2_wait_target_ready - wait for a module to leave slave idle ++ ++ * @oh: struct omap_hwmod * ++ ++ * ++ ++ * Wait for a module @oh to leave slave idle. Returns 0 if the module ++ ++ * does not have an IDLEST bit or if the module successfully leaves ++ ++ * slave idle; otherwise, pass along the return value of the ++ ++ * appropriate *_cm*_wait_module_ready() function. ++ ++ */ ++ ++static int _omap2_wait_target_ready(struct omap_hwmod *oh) ++ ++{ ++ ++ if (!oh) ++ ++ return -EINVAL; ++ ++ ++ ++ if (oh->flags & HWMOD_NO_IDLEST) ++ ++ return 0; ++ ++ ++ ++ if (!_find_mpu_rt_port(oh)) ++ ++ return 0; ++ ++ ++ ++ /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ ++ ++ ++ ++ return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs, ++ ++ oh->prcm.omap2.idlest_reg_id, ++ ++ oh->prcm.omap2.idlest_idle_bit); ++ ++} ++ ++ ++ ++/** ++ ++ * _omap4_wait_target_ready - wait for a module to leave slave idle ++ ++ * @oh: struct omap_hwmod * ++ ++ * ++ ++ * Wait for a module @oh to leave slave idle. Returns 0 if the module ++ ++ * does not have an IDLEST bit or if the module successfully leaves ++ ++ * slave idle; otherwise, pass along the return value of the ++ ++ * appropriate *_cm*_wait_module_ready() function. ++ ++ */ ++ ++static int _omap4_wait_target_ready(struct omap_hwmod *oh) ++ ++{ ++ ++ if (!oh || !oh->clkdm) ++ ++ return -EINVAL; ++ ++ ++ ++ if (oh->flags & HWMOD_NO_IDLEST) ++ ++ return 0; ++ ++ ++ ++ if (!_find_mpu_rt_port(oh)) ++ ++ return 0; ++ ++ ++ ++ /* XXX check module SIDLEMODE, hardreset status */ ++ ++ ++ ++ return omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition, ++ ++ oh->clkdm->cm_inst, ++ ++ oh->clkdm->clkdm_offs, ++ ++ oh->prcm.omap4.clkctrl_offs); ++ ++} ++ ++ ++ ++/** ++ ++ * _omap2_assert_hardreset - call OMAP2 PRM hardreset fn with hwmod args ++ ++ * @oh: struct omap_hwmod * to assert hardreset ++ ++ * @ohri: hardreset line data ++ ++ * ++ ++ * Call omap2_prm_assert_hardreset() with parameters extracted from ++ ++ * the hwmod @oh and the hardreset line data @ohri. Only intended for ++ ++ * use as an soc_ops function pointer. Passes along the return value ++ ++ * from omap2_prm_assert_hardreset(). XXX This function is scheduled ++ ++ * for removal when the PRM code is moved into drivers/. ++ ++ */ ++ ++static int _omap2_assert_hardreset(struct omap_hwmod *oh, ++ ++ struct omap_hwmod_rst_info *ohri) ++ ++{ ++ ++ return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, ++ ++ ohri->rst_shift); ++ ++} ++ ++ ++ ++/** ++ ++ * _omap2_deassert_hardreset - call OMAP2 PRM hardreset fn with hwmod args ++ ++ * @oh: struct omap_hwmod * to deassert hardreset ++ ++ * @ohri: hardreset line data ++ ++ * ++ ++ * Call omap2_prm_deassert_hardreset() with parameters extracted from ++ ++ * the hwmod @oh and the hardreset line data @ohri. Only intended for ++ ++ * use as an soc_ops function pointer. Passes along the return value ++ ++ * from omap2_prm_deassert_hardreset(). XXX This function is ++ ++ * scheduled for removal when the PRM code is moved into drivers/. ++ ++ */ ++ ++static int _omap2_deassert_hardreset(struct omap_hwmod *oh, ++ ++ struct omap_hwmod_rst_info *ohri) ++ ++{ ++ ++ return omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs, ++ ++ ohri->rst_shift, ++ ++ ohri->st_shift); ++ ++} ++ ++ ++ ++/** ++ ++ * _omap2_is_hardreset_asserted - call OMAP2 PRM hardreset fn with hwmod args ++ ++ * @oh: struct omap_hwmod * to test hardreset ++ ++ * @ohri: hardreset line data ++ ++ * ++ ++ * Call omap2_prm_is_hardreset_asserted() with parameters extracted ++ ++ * from the hwmod @oh and the hardreset line data @ohri. Only ++ ++ * intended for use as an soc_ops function pointer. Passes along the ++ ++ * return value from omap2_prm_is_hardreset_asserted(). XXX This ++ ++ * function is scheduled for removal when the PRM code is moved into ++ ++ * drivers/. ++ ++ */ ++ ++static int _omap2_is_hardreset_asserted(struct omap_hwmod *oh, ++ ++ struct omap_hwmod_rst_info *ohri) ++ ++{ ++ ++ return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, ++ ++ ohri->st_shift); ++ ++} ++ ++ ++ ++/** ++ ++ * _omap4_assert_hardreset - call OMAP4 PRM hardreset fn with hwmod args ++ ++ * @oh: struct omap_hwmod * to assert hardreset ++ ++ * @ohri: hardreset line data ++ ++ * ++ ++ * Call omap4_prminst_assert_hardreset() with parameters extracted ++ ++ * from the hwmod @oh and the hardreset line data @ohri. Only ++ ++ * intended for use as an soc_ops function pointer. Passes along the ++ ++ * return value from omap4_prminst_assert_hardreset(). XXX This ++ ++ * function is scheduled for removal when the PRM code is moved into ++ ++ * drivers/. ++ ++ */ ++ ++static int _omap4_assert_hardreset(struct omap_hwmod *oh, ++ ++ struct omap_hwmod_rst_info *ohri) - ++ ++{ +++++ if (!oh->clkdm) +++++ return -EINVAL; +++++ ++ ++ return omap4_prminst_assert_hardreset(ohri->rst_shift, ++ ++ oh->clkdm->pwrdm.ptr->prcm_partition, ++ ++ oh->clkdm->pwrdm.ptr->prcm_offs, ++ ++ oh->prcm.omap4.rstctrl_offs); ++ ++} ++ ++ ++ ++/** ++ ++ * _omap4_deassert_hardreset - call OMAP4 PRM hardreset fn with hwmod args ++ ++ * @oh: struct omap_hwmod * to deassert hardreset ++ ++ * @ohri: hardreset line data ++ ++ * ++ ++ * Call omap4_prminst_deassert_hardreset() with parameters extracted ++ ++ * from the hwmod @oh and the hardreset line data @ohri. Only ++ ++ * intended for use as an soc_ops function pointer. Passes along the ++ ++ * return value from omap4_prminst_deassert_hardreset(). XXX This ++ ++ * function is scheduled for removal when the PRM code is moved into ++ ++ * drivers/. ++ ++ */ ++ ++static int _omap4_deassert_hardreset(struct omap_hwmod *oh, ++ ++ struct omap_hwmod_rst_info *ohri) ++ ++{ +++++ if (!oh->clkdm) +++++ return -EINVAL; +++++ ++ ++ if (ohri->st_shift) ++ ++ pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", ++ ++ oh->name, ohri->name); ++ ++ return omap4_prminst_deassert_hardreset(ohri->rst_shift, ++ ++ oh->clkdm->pwrdm.ptr->prcm_partition, ++ ++ oh->clkdm->pwrdm.ptr->prcm_offs, ++ ++ oh->prcm.omap4.rstctrl_offs); ++ ++} ++ ++ ++ ++/** ++ ++ * _omap4_is_hardreset_asserted - call OMAP4 PRM hardreset fn with hwmod args ++ ++ * @oh: struct omap_hwmod * to test hardreset ++ ++ * @ohri: hardreset line data ++ ++ * ++ ++ * Call omap4_prminst_is_hardreset_asserted() with parameters ++ ++ * extracted from the hwmod @oh and the hardreset line data @ohri. ++ ++ * Only intended for use as an soc_ops function pointer. Passes along ++ ++ * the return value from omap4_prminst_is_hardreset_asserted(). XXX ++ ++ * This function is scheduled for removal when the PRM code is moved ++ ++ * into drivers/. ++ ++ */ ++ ++static int _omap4_is_hardreset_asserted(struct omap_hwmod *oh, ++ ++ struct omap_hwmod_rst_info *ohri) ++ ++{ +++++ if (!oh->clkdm) +++++ return -EINVAL; +++++ ++ ++ return omap4_prminst_is_hardreset_asserted(ohri->rst_shift, ++ ++ oh->clkdm->pwrdm.ptr->prcm_partition, ++ ++ oh->clkdm->pwrdm.ptr->prcm_offs, ++ ++ oh->prcm.omap4.rstctrl_offs); ++ ++} ++ ++ /* Public functions */ u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs)