Merge branch 'cleanup-hwmod' into cleanup
authorTony Lindgren <tony@atomide.com>
Thu, 28 Jun 2012 12:47:01 +0000 (05:47 -0700)
committerTony Lindgren <tony@atomide.com>
Thu, 28 Jun 2012 12:47:01 +0000 (05:47 -0700)
Conflicts:
arch/arm/mach-omap2/dsp.c

1  2 
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/clock3xxx_data.c
arch/arm/mach-omap2/dsp.c
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/omap_hwmod_44xx_data.c

index 664224fb7405f6b6f3697f1bebe618c99e6990af,bc7d2393161fa99d6f143ef4fc4bf629d4732906..9ba1c406a4650a9641ddeeb120affa8c8c6f77cf
@@@ -116,7 -116,6 +116,6 @@@ obj-$(CONFIG_ARCH_OMAP4)           += powerdomai
  
  # PRCM clockdomain control
  clockdomain-common                    += clockdomain.o
- clockdomain-common                    += clockdomains_common_data.o
  obj-$(CONFIG_ARCH_OMAP2)              += $(clockdomain-common)
  obj-$(CONFIG_ARCH_OMAP2)              += clockdomain2xxx_3xxx.o
  obj-$(CONFIG_ARCH_OMAP2)              += clockdomains2xxx_3xxx_data.o
@@@ -244,6 -243,9 +243,6 @@@ obj-y                                      += $(omap-flash-y) $(omap-fla
  omap-hsmmc-$(CONFIG_MMC_OMAP_HS)      := hsmmc.o
  obj-y                                 += $(omap-hsmmc-m) $(omap-hsmmc-y)
  
 -
 -usbfs-$(CONFIG_ARCH_OMAP_OTG)         := usb-fs.o
 -obj-y                                 += $(usbfs-m) $(usbfs-y)
  obj-y                                 += usb-musb.o
  obj-y                                 += omap_phy_internal.o
  
index 1efdec236ae89dac6671bbd8f09d7cffb2067deb,d6889b58dd051947d63a0cf6aa4114e06cc8ce5b..ff422bee804a3fe0f0ee4a5ded7e45e210de46e0
@@@ -3236,11 -3236,6 +3236,6 @@@ static struct omap_clk omap3xxx_clks[] 
        CLK(NULL,       "osc_sys_ck",   &osc_sys_ck,    CK_3XXX),
        CLK(NULL,       "sys_ck",       &sys_ck,        CK_3XXX),
        CLK(NULL,       "sys_altclk",   &sys_altclk,    CK_3XXX),
-       CLK("omap-mcbsp.1",     "pad_fck",      &mcbsp_clks,    CK_3XXX),
-       CLK("omap-mcbsp.2",     "pad_fck",      &mcbsp_clks,    CK_3XXX),
-       CLK("omap-mcbsp.3",     "pad_fck",      &mcbsp_clks,    CK_3XXX),
-       CLK("omap-mcbsp.4",     "pad_fck",      &mcbsp_clks,    CK_3XXX),
-       CLK("omap-mcbsp.5",     "pad_fck",      &mcbsp_clks,    CK_3XXX),
        CLK(NULL,       "mcbsp_clks",   &mcbsp_clks,    CK_3XXX),
        CLK(NULL,       "sys_clkout1",  &sys_clkout1,   CK_3XXX),
        CLK(NULL,       "dpll1_ck",     &dpll1_ck,      CK_3XXX),
        CLK(NULL,       "ts_fck",       &ts_fck,        CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK(NULL,       "usbtll_fck",   &usbtll_fck,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK("usbhs_omap",       "usbtll_fck",   &usbtll_fck,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-       CLK("omap-mcbsp.1",     "prcm_fck",     &core_96m_fck,  CK_3XXX),
-       CLK("omap-mcbsp.5",     "prcm_fck",     &core_96m_fck,  CK_3XXX),
        CLK(NULL,       "core_96m_fck", &core_96m_fck,  CK_3XXX),
        CLK(NULL,       "mmchs3_fck",   &mmchs3_fck,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK(NULL,       "mmchs2_fck",   &mmchs2_fck,    CK_3XXX),
        CLK(NULL,       "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
        CLK(NULL,       "gpt12_ick",    &gpt12_ick,     CK_3XXX),
        CLK(NULL,       "gpt1_ick",     &gpt1_ick,      CK_3XXX),
-       CLK("omap-mcbsp.2",     "prcm_fck",     &per_96m_fck,   CK_3XXX),
-       CLK("omap-mcbsp.3",     "prcm_fck",     &per_96m_fck,   CK_3XXX),
-       CLK("omap-mcbsp.4",     "prcm_fck",     &per_96m_fck,   CK_3XXX),
        CLK(NULL,       "per_96m_fck",  &per_96m_fck,   CK_3XXX),
        CLK(NULL,       "per_48m_fck",  &per_48m_fck,   CK_3XXX),
        CLK(NULL,       "uart3_fck",    &uart3_fck,     CK_3XXX),
@@@ -3514,7 -3504,7 +3504,7 @@@ int __init omap3xxx_clk_init(void
        struct omap_clk *c;
        u32 cpu_clkflg = 0;
  
 -      if (cpu_is_omap3517()) {
 +      if (soc_is_am35xx()) {
                cpu_mask = RATE_IN_34XX;
                cpu_clkflg = CK_AM35XX;
        } else if (cpu_is_omap3630()) {
index 88ffa1e645cd948614afe61c17502533c64650a7,8b251a995abfa0ed3f5e2e682b0af81d1a71a3e4..a636ebc16b3975f8ae49cc9c18bd676920baf4df
  
  #include <linux/module.h>
  #include <linux/platform_device.h>
 +
 +#include <asm/memblock.h>
 +
+ #include "control.h"
  #include "cm2xxx_3xxx.h"
  #include "prm2xxx_3xxx.h"
  #ifdef CONFIG_BRIDGE_DVFS
@@@ -46,6 -44,9 +47,9 @@@ static struct omap_dsp_platform_data om
        .dsp_cm_read = omap2_cm_read_mod_reg,
        .dsp_cm_write = omap2_cm_write_mod_reg,
        .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
+       .set_bootaddr = omap_ctrl_write_dsp_boot_addr,
+       .set_bootmode = omap_ctrl_write_dsp_boot_mode,
  };
  
  static phys_addr_t omap_dsp_phys_mempool_base;
index 773193670ea265cefa67f938fa780e938400dbce,c55df5eed7c8fbc9b526ef468be3740ea641322b..f97f0624bca0d8e16367281074c3b90515f16c80
   */
  #define LINKS_PER_OCP_IF              2
  
+ /**
+  * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations
+  * @enable_module: function to enable a module (via MODULEMODE)
+  * @disable_module: function to disable a module (via MODULEMODE)
+  *
+  * XXX Eventually this functionality will be hidden inside the PRM/CM
+  * device drivers.  Until then, this should avoid huge blocks of cpu_is_*()
+  * conditionals in this code.
+  */
+ struct omap_hwmod_soc_ops {
+       void (*enable_module)(struct omap_hwmod *oh);
+       int (*disable_module)(struct omap_hwmod *oh);
+       int (*wait_target_ready)(struct omap_hwmod *oh);
+       int (*assert_hardreset)(struct omap_hwmod *oh,
+                               struct omap_hwmod_rst_info *ohri);
+       int (*deassert_hardreset)(struct omap_hwmod *oh,
+                                 struct omap_hwmod_rst_info *ohri);
+       int (*is_hardreset_asserted)(struct omap_hwmod *oh,
+                                    struct omap_hwmod_rst_info *ohri);
+       int (*init_clkdm)(struct omap_hwmod *oh);
+ };
+ /* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */
+ static struct omap_hwmod_soc_ops soc_ops;
  /* omap_hwmod_list contains all registered struct omap_hwmods */
  static LIST_HEAD(omap_hwmod_list);
  
@@@ -186,6 -211,9 +211,9 @@@ static struct omap_hwmod_link *linkspac
   */
  static unsigned short free_ls, max_ls, ls_supp;
  
+ /* inited: set to true once the hwmod code is initialized */
+ static bool inited;
  /* Private functions */
  
  /**
@@@ -530,7 -558,7 +558,7 @@@ static int _disable_wakeup(struct omap_
        if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP)
                _set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART, v);
        if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP)
 -              _set_master_standbymode(oh, HWMOD_IDLEMODE_SMART_WKUP, v);
 +              _set_master_standbymode(oh, HWMOD_IDLEMODE_SMART, v);
  
        /* XXX test pwrdm_get_wken for this hwmod's subsystem */
  
@@@ -771,23 -799,19 +799,19 @@@ static void _disable_optional_clocks(st
  }
  
  /**
-  * _enable_module - enable CLKCTRL modulemode on OMAP4
+  * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4
   * @oh: struct omap_hwmod *
   *
   * Enables the PRCM module mode related to the hwmod @oh.
   * No return value.
   */
- static void _enable_module(struct omap_hwmod *oh)
+ static void _omap4_enable_module(struct omap_hwmod *oh)
  {
-       /* The module mode does not exist prior OMAP4 */
-       if (cpu_is_omap24xx() || cpu_is_omap34xx())
-               return;
        if (!oh->clkdm || !oh->prcm.omap4.modulemode)
                return;
  
-       pr_debug("omap_hwmod: %s: _enable_module: %d\n",
-                oh->name, oh->prcm.omap4.modulemode);
+       pr_debug("omap_hwmod: %s: %s: %d\n",
+                oh->name, __func__, oh->prcm.omap4.modulemode);
  
        omap4_cminst_module_enable(oh->prcm.omap4.modulemode,
                                   oh->clkdm->prcm_partition,
   */
  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)
@@@ -1285,24 -1306,20 +1306,20 @@@ static struct omap_hwmod *_lookup(cons
  
        return oh;
  }
  /**
   * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod
   * @oh: struct omap_hwmod *
   *
   * Convert a clockdomain name stored in a struct omap_hwmod into a
   * clockdomain pointer, and save it into the struct omap_hwmod.
-  * return -EINVAL if clkdm_name does not exist or if the lookup failed.
+  * Return -EINVAL if the clkdm_name lookup failed.
   */
  static int _init_clkdm(struct omap_hwmod *oh)
  {
-       if (cpu_is_omap24xx() || cpu_is_omap34xx())
+       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",
@@@ -1338,7 -1355,8 +1355,8 @@@ static int _init_clocks(struct omap_hwm
        ret |= _init_main_clk(oh);
        ret |= _init_interface_clks(oh);
        ret |= _init_opt_clks(oh);
-       ret |= _init_clkdm(oh);
+       if (soc_ops.init_clkdm)
+               ret |= soc_ops.init_clkdm(oh);
  
        if (!ret)
                oh->_state = _HWMOD_STATE_CLKS_INITED;
        return ret;
  }
  
- /**
-  * _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 _wait_target_ready(struct omap_hwmod *oh)
- {
-       struct omap_hwmod_ocp_if *os;
-       int ret;
-       if (!oh)
-               return -EINVAL;
-       if (oh->flags & HWMOD_NO_IDLEST)
-               return 0;
-       os = _find_mpu_rt_port(oh);
-       if (!os)
-               return 0;
-       /* XXX check module SIDLEMODE */
-       /* XXX check clock enable states */
-       if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
-               ret = omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs,
-                                                oh->prcm.omap2.idlest_reg_id,
-                                                oh->prcm.omap2.idlest_idle_bit);
-       } else if (cpu_is_omap44xx()) {
-               if (!oh->clkdm)
-                       return -EINVAL;
-               ret = omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition,
-                                                    oh->clkdm->cm_inst,
-                                                    oh->clkdm->clkdm_offs,
-                                                    oh->prcm.omap4.clkctrl_offs);
-       } else {
-               BUG();
-       };
-       return ret;
- }
  /**
   * _lookup_hardreset - fill register bit info for this hwmod/reset line
   * @oh: struct omap_hwmod *
@@@ -1431,32 -1402,31 +1402,31 @@@ static u8 _lookup_hardreset(struct omap
   * @oh: struct omap_hwmod *
   * @name: name of the reset line to lookup and assert
   *
-  * Some IP like dsp, ipu or iva contain processor that require
-  * an HW reset line to be assert / deassert in order to enable fully
-  * the IP.
+  * Some IP like dsp, ipu or iva contain processor that require an HW
+  * reset line to be assert / deassert in order to enable fully the IP.
+  * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
+  * asserting the hardreset line on the currently-booted SoC, or passes
+  * along the return value from _lookup_hardreset() or the SoC's
+  * assert_hardreset code.
   */
  static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
  {
        struct omap_hwmod_rst_info ohri;
-       u8 ret;
+       u8 ret = -EINVAL;
  
        if (!oh)
                return -EINVAL;
  
+       if (!soc_ops.assert_hardreset)
+               return -ENOSYS;
        ret = _lookup_hardreset(oh, name, &ohri);
        if (IS_ERR_VALUE(ret))
                return ret;
  
-       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;
+       ret = soc_ops.assert_hardreset(oh, &ohri);
+       return ret;
  }
  
  /**
   * @oh: struct omap_hwmod *
   * @name: name of the reset line to look up and deassert
   *
-  * Some IP like dsp, ipu or iva contain processor that require
-  * an HW reset line to be assert / deassert in order to enable fully
-  * the IP.
+  * Some IP like dsp, ipu or iva contain processor that require an HW
+  * reset line to be assert / deassert in order to enable fully the IP.
+  * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
+  * deasserting the hardreset line on the currently-booted SoC, or passes
+  * along the return value from _lookup_hardreset() or the SoC's
+  * deassert_hardreset code.
   */
  static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
  {
        struct omap_hwmod_rst_info ohri;
-       int ret;
+       int ret = -EINVAL;
  
        if (!oh)
                return -EINVAL;
  
+       if (!soc_ops.deassert_hardreset)
+               return -ENOSYS;
        ret = _lookup_hardreset(oh, name, &ohri);
        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);
-               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);
  
   * @oh: struct omap_hwmod *
   * @name: name of the reset line to look up and read
   *
-  * Return the state of the reset line.
+  * Return the state of the reset line.  Returns -EINVAL if @oh is
+  * null, -ENOSYS if we have no way of reading the hardreset line
+  * status on the currently-booted SoC, or passes along the return
+  * value from _lookup_hardreset() or the SoC's is_hardreset_asserted
+  * code.
   */
  static int _read_hardreset(struct omap_hwmod *oh, const char *name)
  {
        struct omap_hwmod_rst_info ohri;
-       u8 ret;
+       u8 ret = -EINVAL;
  
        if (!oh)
                return -EINVAL;
  
+       if (!soc_ops.is_hardreset_asserted)
+               return -ENOSYS;
        ret = _lookup_hardreset(oh, name, &ohri);
        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()) {
-               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);
  }
  
  /**
@@@ -1571,10 -1529,6 +1529,6 @@@ static int _omap4_disable_module(struc
  {
        int v;
  
-       /* The module mode does not exist prior OMAP4 */
-       if (!cpu_is_omap44xx())
-               return -EINVAL;
        if (!oh->clkdm || !oh->prcm.omap4.modulemode)
                return -EINVAL;
  
@@@ -1814,9 -1768,11 +1768,11 @@@ static int _enable(struct omap_hwmod *o
        }
  
        _enable_clocks(oh);
-       _enable_module(oh);
+       if (soc_ops.enable_module)
+               soc_ops.enable_module(oh);
  
-       r = _wait_target_ready(oh);
+       r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) :
+               -EINVAL;
        if (!r) {
                /*
                 * Set the clockdomain to HW_AUTO only if the target is ready,
@@@ -1870,7 -1826,8 +1826,8 @@@ static int _idle(struct omap_hwmod *oh
                _idle_sysc(oh);
        _del_initiator_dep(oh, mpu_oh);
  
-       _omap4_disable_module(oh);
+       if (soc_ops.disable_module)
+               soc_ops.disable_module(oh);
  
        /*
         * The module must be in idle mode before disabling any parents
@@@ -1975,7 -1932,8 +1932,8 @@@ static int _shutdown(struct omap_hwmod 
        if (oh->_state == _HWMOD_STATE_ENABLED) {
                _del_initiator_dep(oh, mpu_oh);
                /* XXX what about the other system initiators here? dma, dsp */
-               _omap4_disable_module(oh);
+               if (soc_ops.disable_module)
+                       soc_ops.disable_module(oh);
                _disable_clocks(oh);
                if (oh->clkdm)
                        clkdm_hwmod_disable(oh->clkdm, oh);
@@@ -2431,6 -2389,194 +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)
@@@ -2563,12 -2709,18 +2709,18 @@@ int omap_hwmod_for_each(int (*fn)(struc
   *
   * Intended to be called early in boot before the clock framework is
   * initialized.  If @ois is not null, will register all omap_hwmods
-  * listed in @ois that are valid for this chip.  Returns 0.
+  * listed in @ois that are valid for this chip.  Returns -EINVAL if
+  * omap_hwmod_init() hasn't been called before calling this function,
+  * -ENOMEM if the link memory area can't be allocated, or 0 upon
+  * success.
   */
  int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois)
  {
        int r, i;
  
+       if (!inited)
+               return -EINVAL;
        if (!ois)
                return 0;
  
@@@ -3401,3 -3553,32 +3553,32 @@@ int omap_hwmod_pad_route_irq(struct oma
  
        return 0;
  }
+ /**
+  * omap_hwmod_init - initialize the hwmod code
+  *
+  * Sets up some function pointers needed by the hwmod code to operate on the
+  * currently-booted SoC.  Intended to be called once during kernel init
+  * before any hwmods are registered.  No return value.
+  */
+ void __init omap_hwmod_init(void)
+ {
+       if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
+               soc_ops.wait_target_ready = _omap2_wait_target_ready;
+               soc_ops.assert_hardreset = _omap2_assert_hardreset;
+               soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
+               soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
+       } else if (cpu_is_omap44xx()) {
+               soc_ops.enable_module = _omap4_enable_module;
+               soc_ops.disable_module = _omap4_disable_module;
+               soc_ops.wait_target_ready = _omap4_wait_target_ready;
+               soc_ops.assert_hardreset = _omap4_assert_hardreset;
+               soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
+               soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
+               soc_ops.init_clkdm = _init_clkdm;
+       } else {
+               WARN(1, "omap_hwmod: unknown SoC type\n");
+       }
+       inited = true;
+ }
index f30e861ce6d9cf42c76d90cb78cfcc90cf99f31b,fa2953aff2483791622f32d85214cdcdb79de7f8..d055b4725679dc60a457379f0a532337a1e08782
@@@ -393,7 -393,8 +393,7 @@@ static struct omap_hwmod_class_sysconfi
        .rev_offs       = 0x0000,
        .sysc_offs      = 0x0004,
        .sysc_flags     = SYSC_HAS_SIDLEMODE,
 -      .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
 -                         SIDLE_SMART_WKUP),
 +      .idlemodes      = (SIDLE_FORCE | SIDLE_NO),
        .sysc_fields    = &omap_hwmod_sysc_type1,
  };
  
@@@ -853,11 -854,6 +853,11 @@@ static struct omap_hwmod omap44xx_dss_h
        .name           = "dss_hdmi",
        .class          = &omap44xx_hdmi_hwmod_class,
        .clkdm_name     = "l3_dss_clkdm",
 +      /*
 +       * HDMI audio requires to use no-idle mode. Hence,
 +       * set idle mode by software.
 +       */
 +      .flags          = HWMOD_SWSUP_SIDLE,
        .mpu_irqs       = omap44xx_dss_hdmi_irqs,
        .sdma_reqs      = omap44xx_dss_hdmi_sdma_reqs,
        .main_clk       = "dss_48mhz_clk",
@@@ -2544,14 -2540,12 +2544,12 @@@ static struct omap_hwmod omap44xx_prcm_
  static struct omap_hwmod omap44xx_cm_core_aon_hwmod = {
        .name           = "cm_core_aon",
        .class          = &omap44xx_prcm_hwmod_class,
-       .clkdm_name     = "cm_clkdm",
  };
  
  /* cm_core */
  static struct omap_hwmod omap44xx_cm_core_hwmod = {
        .name           = "cm_core",
        .class          = &omap44xx_prcm_hwmod_class,
-       .clkdm_name     = "cm_clkdm",
  };
  
  /* prm */
@@@ -2568,7 -2562,6 +2566,6 @@@ static struct omap_hwmod_rst_info omap4
  static struct omap_hwmod omap44xx_prm_hwmod = {
        .name           = "prm",
        .class          = &omap44xx_prcm_hwmod_class,
-       .clkdm_name     = "prm_clkdm",
        .mpu_irqs       = omap44xx_prm_irqs,
        .rst_lines      = omap44xx_prm_resets,
        .rst_lines_cnt  = ARRAY_SIZE(omap44xx_prm_resets),
@@@ -6148,6 -6141,7 +6145,7 @@@ static struct omap_hwmod_ocp_if *omap44
  
  int __init omap44xx_hwmod_init(void)
  {
+       omap_hwmod_init();
        return omap_hwmod_register_links(omap44xx_hwmod_ocp_ifs);
  }
  
This page took 0.051381 seconds and 5 git commands to generate.