*/
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)
*/
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",
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;
}
/**
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);
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);
}
/**
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)