1. 04 12月, 2015 1 次提交
    • T
      ARM: OMAP2+: Change core_initcall levels to postcore_initcall · 8dd5ea72
      Tony Lindgren 提交于
      We want to be able to probe a few selected device drivers before hwmod
      code populates the clocks in omap_hwmod_setup_all(). This allows us to
      convert most of the clock drivers into regular device drivers.
      
      We only need a few minimal clock drivers early for the system timers to
      select between the 32KiHz clock and the high frequency oscillator.
      
      With these changes, initializing the clock drivers can be just done at
      core_initcall time with something like:
      
      np = of_find_node_by_name(NULL, "plls");
      if (np)
      	of_platform_populate(np, NULL, NULL, NULL);
      
      And then these clocks will be available for the interconnect code to use.
      
      Having most of the clock drivers being regular device drivers allows
      us to use the nice things like devm_* functions and dev_err and dev_dbg.
      As an extra bonus, this also allows us to develop the clock drivers for
      new SoCs as loadable modules initially for cases where we can boot up
      the system based on the bootloader configured clocks.
      
      To do this, let's change the core_initcalls to postcore_initcall under
      mach-omap2.
      
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Tero Kristo <t-kristo@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      8dd5ea72
  2. 02 9月, 2015 1 次提交
    • G
      ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init · fe8291e8
      Grygorii Strashko 提交于
      Kernel fails to boot 50% of times (form build to build) with
      RT-patchset applied due to the following race - on late boot
      stages deferred_probe_work_func->omap_hsmmc_probe races with omap_device_late_ini.
      
      The same issue has been reported now on linux-next (4.3) by Keerthy [1]
      
      late_initcall
       - deferred_probe_initcal() tries to re-probe all pending driver's probe.
      
      - later on, some driver is probing in this case It's cpsw.c
        (but could be any other drivers)
        cpsw_init
        - platform_driver_register
          - really_probe
             - driver_bound
               - driver_deferred_probe_trigger
        and boot proceed.
        So, at this moment we have deferred_probe_work_func scheduled.
      
      late_initcall_sync
        - omap_device_late_init
          - omap_device_idle
      
      CPU1					CPU2
        - deferred_probe_work_func
          - really_probe
            - omap_hsmmc_probe
      	- pm_runtime_get_sync
      					late_initcall_sync
      					- omap_device_late_init
      						if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) {
      							if (od->_state == OMAP_DEVICE_STATE_ENABLED) {
      								- omap_device_idle [ops - IP is disabled]
      	- [fail]
      	- pm_runtime_put_sync
                - omap_hsmmc_runtime_suspend [ooops!]
      
      == log ==
       omap_hsmmc 480b4000.mmc: unable to get vmmc regulator -517
       davinci_mdio 48485000.mdio: davinci mdio revision 1.6
       davinci_mdio 48485000.mdio: detected phy mask fffffff3
       libphy: 48485000.mdio: probed
       davinci_mdio 48485000.mdio: phy[2]: device 48485000.mdio:02, driver unknown
       davinci_mdio 48485000.mdio: phy[3]: device 48485000.mdio:03, driver unknown
       omap_hsmmc 480b4000.mmc: unable to get vmmc regulator -517
       cpsw 48484000.ethernet: Detected MACID = b4:99:4c:c7:d2:48
       cpsw 48484000.ethernet: cpsw: Detected MACID = b4:99:4c:c7:d2:49
       hctosys: unable to open rtc device (rtc0)
       omap_hsmmc 480b4000.mmc: omap_device_late_idle: enabled but no driver.  Idling
       ldousb: disabling
       Unhandled fault: imprecise external abort (0x1406) at 0x00000000
       [00000000] *pgd=00000000
       Internal error: : 1406 [#1] PREEMPT SMP ARM
       Modules linked in:
       CPU: 1 PID: 58 Comm: kworker/u4:1 Not tainted 4.1.2-rt1-00467-g6da3c0a-dirty #5
       Hardware name: Generic DRA74X (Flattened Device Tree)
       Workqueue: deferwq deferred_probe_work_func
       task: ee6ddb00 ti: edd3c000 task.ti: edd3c000
       PC is at omap_hsmmc_runtime_suspend+0x1c/0x12c
       LR is at _od_runtime_suspend+0xc/0x24
       pc : [<c0471998>]    lr : [<c0029590>]    psr: a0000013
       sp : edd3dda0  ip : ee6ddb00  fp : c07be540
       r10: 00000000  r9 : c07be540  r8 : 00000008
       r7 : 00000000  r6 : ee646c10  r5 : ee646c10  r4 : edd79380
       r3 : fa0b4100  r2 : 00000000  r1 : 00000000  r0 : ee646c10
       Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
       Control: 10c5387d  Table: 8000406a  DAC: 00000015
       Process kworker/u4:1 (pid: 58, stack limit = 0xedd3c218)
       Stack: (0xedd3dda0 to 0xedd3e000)
       dda0: ee646c70 ee646c10 c0029584 00000000 00000008 c0029590 ee646c70 ee646c10
       ddc0: c0029584 c03adfb8 ee646c10 00000004 0000000c c03adff0 ee646c10 00000004
       dde0: 0000000c c03ae4ec 00000000 edd3c000 ee646c10 00000004 ee646c70 00000004
       de00: fa0b4000 c03aec20 ee6ddb00 ee646c10 00000004 ee646c70 ee646c10 fffffdfb
       de20: edd79380 00000000 fa0b4000 c03aee90 fffffdfb edd79000 ee646c00 c0474290
       de40: 00000000 edda24c0 edd79380 edc81f00 00000000 00000200 00000001 c06dd488
       de60: edda3960 ee646c10 ee646c10 c0824cc4 fffffdfb c0880c94 00000002 edc92600
       de80: c0836378 c03a7f84 ee646c10 c0824cc4 00000000 c0880c80 c0880c94 c03a6568
       dea0: 00000000 ee646c10 c03a66ac ee4f8000 00000000 00000001 edc92600 c03a4b40
       dec0: ee404c94 edc83c4c ee646c10 ee646c10 ee646c44 c03a63c4 ee646c10 ee646c10
       dee0: c0814448 c03a5aa8 ee646c10 c0814220 edd3c000 c03a5ec0 c0814250 ee6be400
       df00: edd3c000 c004e5bc ee6ddb01 00000078 ee6ddb00 ee4f8000 ee6be418 edd3c000
       df20: ee4f8028 00000088 c0836045 ee4f8000 ee6be400 c004e928 ee4f8028 00000000
       df40: c004e8ec 00000000 ee6bf1c0 ee6be400 c004e8ec 00000000 00000000 00000000
       df60: 00000000 c0053450 2e56fa97 00000000 afdffbd7 ee6be400 00000000 00000000
       df80: edd3df80 edd3df80 00000000 00000000 edd3df90 edd3df90 edd3dfac ee6bf1c0
       dfa0: c0053384 00000000 00000000 c000f668 00000000 00000000 00000000 00000000
       dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
       dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 f1fc9d7e febfbdff
       [<c0471998>] (omap_hsmmc_runtime_suspend) from [<c0029590>] (_od_runtime_suspend+0xc/0x24)
       [<c0029590>] (_od_runtime_suspend) from [<c03adfb8>] (__rpm_callback+0x24/0x3c)
       [<c03adfb8>] (__rpm_callback) from [<c03adff0>] (rpm_callback+0x20/0x80)
       [<c03adff0>] (rpm_callback) from [<c03ae4ec>] (rpm_suspend+0xe4/0x618)
       [<c03ae4ec>] (rpm_suspend) from [<c03aee90>] (__pm_runtime_idle+0x60/0x80)
       [<c03aee90>] (__pm_runtime_idle) from [<c0474290>] (omap_hsmmc_probe+0x6bc/0xa7c)
       [<c0474290>] (omap_hsmmc_probe) from [<c03a7f84>] (platform_drv_probe+0x44/0xa4)
       [<c03a7f84>] (platform_drv_probe) from [<c03a6568>] (driver_probe_device+0x170/0x2b4)
       [<c03a6568>] (driver_probe_device) from [<c03a4b40>] (bus_for_each_drv+0x64/0x98)
       [<c03a4b40>] (bus_for_each_drv) from [<c03a63c4>] (device_attach+0x70/0x88)
       [<c03a63c4>] (device_attach) from [<c03a5aa8>] (bus_probe_device+0x84/0xac)
       [<c03a5aa8>] (bus_probe_device) from [<c03a5ec0>] (deferred_probe_work_func+0x58/0x88)
       [<c03a5ec0>] (deferred_probe_work_func) from [<c004e5bc>] (process_one_work+0x134/0x464)
       [<c004e5bc>] (process_one_work) from [<c004e928>] (worker_thread+0x3c/0x4fc)
       [<c004e928>] (worker_thread) from [<c0053450>] (kthread+0xcc/0xe4)
       [<c0053450>] (kthread) from [<c000f668>] (ret_from_fork+0x14/0x2c)
       Code: e594302c e593202c e584205c e594302c (e5932128)
       ---[ end trace 0000000000000002 ]---
      
      The issue happens because omap_device_late_init() do not take into
      account that some drivers are present, but their probes were not
      finished successfully and where deferred instead. This is the valid
      case, and omap_device_late_init() should not idle such devices.
      
      To fix this issue, the value of omap_device->_driver_status field
      should be checked not only for BUS_NOTIFY_BOUND_DRIVER (driver is
      present and has been bound to device successfully), but also checked
      for BUS_NOTIFY_BIND_DRIVER (driver about to be bound) - which means
      driver is present and there was try to bind it to device.
      
      [1] http://www.spinics.net/lists/arm-kernel/msg441880.html
      Cc: Tero Kristo <t-kristo@ti.com>
      Cc: Keerthy <j-keerthy@ti.com>
      Tested-by: NKeerthy <j-keerthy@ti.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      fe8291e8
  3. 02 6月, 2015 1 次提交
  4. 13 5月, 2015 1 次提交
  5. 06 5月, 2015 1 次提交
  6. 17 3月, 2015 1 次提交
  7. 13 12月, 2014 1 次提交
  8. 30 10月, 2014 1 次提交
  9. 26 8月, 2014 1 次提交
    • M
      ARM: OMAP2+: omap_device: remove warning that clk alias already exists · 9a02ae4e
      Markus Pargmann 提交于
      When an alias for a clock already exists the warning is printed. For
      every module with a main_clk defined, a clk alias for fck is added.
      There are some components that have the same main_clk defined, so this
      is a really normal situation.
      
      For example the am33xx edma device has 4 components using the same main
      clock. So there are three warnings in the boot log for this already
      existing clock alias:
      	platform 49000000.edma: alias fck already exists
      	platform 49000000.edma: alias fck already exists
      	platform 49000000.edma: alias fck already exists
      
      As this is only interesting for developers, this patch changes the
      message to a debug message.
      Signed-off-by: NMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      9a02ae4e
  10. 11 12月, 2013 1 次提交
  11. 09 12月, 2013 1 次提交
    • T
      ARM: OMAP2+: Add support for legacy auxdata for twl · dad12d11
      Tony Lindgren 提交于
      As we currently need to support a mix of legacy platform data and
      device tree intialized data, let's make sure things keep working
      for the TWL GPIOs.
      
      Mostly the issue is caused by the fact that DSS does not yet have
      device tree bindings, so we need to rely on the TWL GPIO callback
      for setting up things like LCD backlight for some boards.
      
      As of_platform_populate() for the TWL GPIO is called by twl-core
      after the I2C bus has been initialized, we cannot pass the auxdata
      table from the board init code to twl-core like we used to with
      just legacy platform data.
      
      So let's use the omap_device bus hook to patch in the platform
      data for TWL GPIO until we have sorted out the issues with the
      TWL GPIOs and device tree bindings.
      
      The other option was be to initialize twl core using legacy
      platform data, which seems like a step backwards as we're moving
      to device tree only initialization.  And we really don't want to
      add custom configuration functions to the TWL GPIO driver either
      for this.
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      dad12d11
  12. 15 11月, 2013 1 次提交
    • N
      ARM: OMAP2+: omap_device: maintain sane runtime pm status around suspend/resume · 3522bf7b
      Nishanth Menon 提交于
      OMAP device hooks around suspend|resume_noirq ensures that hwmod
      devices are forced to idle using omap_device_idle/enable as part of
      the last stage of suspend activity.
      
      For a device such as i2c who uses autosuspend, it is possible to enter
      the suspend path with dev->power.runtime_status = RPM_ACTIVE.
      
      As part of the suspend flow, the generic runtime logic would increment
      it's dev->power.disable_depth to 1. This should prevent further
      pm_runtime_get_sync from succeeding once the runtime_status has been
      set to RPM_SUSPENDED.
      
      Now, as part of the suspend_noirq handler in omap_device, we force the
      following: if the device status is !suspended, we force the device
      to idle using omap_device_idle (clocks are cut etc..). This ensures
      that from a hardware perspective, the device is "suspended". However,
      runtime_status is left to be active.
      
      *if* an operation is attempted after this point to
      pm_runtime_get_sync, runtime framework depends on runtime_status to
      indicate accurately the device status, and since it sees it to be
      ACTIVE, it assumes the module is functional and returns a non-error
      value. As a result the user will see pm_runtime_get succeed, however a
      register access will crash due to the lack of clocks.
      
      To prevent this from happening, we should ensure that runtime_status
      exactly indicates the device status. As a result of this change
      any further calls to pm_runtime_get* would return -EACCES (since
      disable_depth is 1). On resume, we restore the clocks and runtime
      status exactly as we suspended with. These operations are not expected
      to fail as we update the states after the core runtime framework has
      suspended itself and restore before the core runtime framework has
      resumed.
      
      Cc: stable@vger.kernel.org # v3.4+
      Reported-by: NJ Keerthy <j-keerthy@ti.com>
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Acked-by: NRajendra Nayak <rnayak@ti.com>
      Acked-by: NKevin Hilman <khilman@linaro.org>
      Reviewed-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      3522bf7b
  13. 19 9月, 2013 1 次提交
  14. 30 7月, 2013 2 次提交
  15. 04 6月, 2013 1 次提交
  16. 16 5月, 2013 1 次提交
  17. 09 5月, 2013 1 次提交
    • K
      ARM: OMAP2+: omap_device: use late_initcall_sync · e7e17c53
      Kevin Hilman 提交于
      If DEBUG_LL and earlyprintk are enabled, and omap-serial.c is compiled
      as a module, the kernel boot hangs early as the clocks for serial port
      are cut while earlyprintk still uses the port.
      
      The problem is a race between the late_initcall for omap_device (which
      idles devices that have no drivers) and the late_initcall in
      kernel/printk.c which turns off the earlyconsole.   Any printks
      that happen between this omap_device late initcall and the earlyconsole
      late initcall will crash when accessing the UART.
      
      The fix is to ensure the omap_device initcall happens after the
      earlyconsole initcall.
      Reported-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      e7e17c53
  18. 03 5月, 2013 2 次提交
    • R
      ARM: OMAP: use consistent error checking · c48cd659
      Russell King 提交于
      Consistently check errors using the usual method used in the kernel
      for much of its history.  For instance:
      
      int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
      {
      	int div;
      	div = gpmc_calc_divider(t->sync_clk);
      	if (div < 0)
      		return div;
      static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
      {
      ...
      	return gpmc_cs_set_timings(cs, t);
      
      .....
      	ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
      	if (IS_ERR_VALUE(ret))
      		return ret;
      
      So, gpmc_cs_set_timings() thinks any negative return value is an error,
      but where we check that in higher levels, only a limited range are
      errors...
      
      There is only _one_ use of IS_ERR_VALUE() in arch/arm which is really
      appropriate, and that is in arch/arm/include/asm/syscall.h:
      
      static inline long syscall_get_error(struct task_struct *task,
      				     struct pt_regs *regs)
      {
      	unsigned long error = regs->ARM_r0;
      	return IS_ERR_VALUE(error) ? error : 0;
      }
      
      because this function really does have to differentiate between error
      return values and addresses which look like negative numbers (eg, from
      mmap()).
      
      So, here's a patch to remove them from OMAP, except for the above.
      Acked-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      c48cd659
    • R
      ARM: cleanup: OMAP hwmod error checking · 857835c6
      Russell King 提交于
      omap_hwmod_lookup() only returns NULL on error, never an error pointer.
      Checking the returned pointer using IS_ERR_OR_NULL() is needless
      overhead.  Use a simple !ptr check instead.
      
      OMAP devices (oh->od) always have a valid platform device attached (see
      omap_device_alloc()) so there's no point validating the platform device
      pointer (we will have already oopsed long before if this is not the
      case here.)
      
      Lastly, oh->od is only ever NULL or a valid omap device pointer - 'oh'
      comes from the statically declared hwmod tables, and the pointer is
      only filled in by omap_device_alloc() at a point where the omap device
      pointer must be valid.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      857835c6
  19. 14 3月, 2013 1 次提交
    • R
      ARM: OMAP: use consistent error checking · 71856843
      Russell King 提交于
      Consistently check errors using the usual method used in the kernel
      for much of its history.  For instance:
      
      int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
      {
      	int div;
      	div = gpmc_calc_divider(t->sync_clk);
      	if (div < 0)
      		return div;
      static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
      {
      ...
      	return gpmc_cs_set_timings(cs, t);
      
      .....
      	ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
      	if (IS_ERR_VALUE(ret))
      		return ret;
      
      So, gpmc_cs_set_timings() thinks any negative return value is an error,
      but where we check that in higher levels, only a limited range are
      errors...
      
      There is only _one_ use of IS_ERR_VALUE() in arch/arm which is really
      appropriate, and that is in arch/arm/include/asm/syscall.h:
      
      static inline long syscall_get_error(struct task_struct *task,
      				     struct pt_regs *regs)
      {
      	unsigned long error = regs->ARM_r0;
      	return IS_ERR_VALUE(error) ? error : 0;
      }
      
      because this function really does have to differentiate between error
      return values and addresses which look like negative numbers (eg, from
      mmap()).
      
      So, here's a patch to remove them from OMAP, except for the above.
      Acked-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      71856843
  20. 24 2月, 2013 1 次提交
    • R
      ARM: cleanup: OMAP hwmod error checking · 4d485661
      Russell King 提交于
      omap_hwmod_lookup() only returns NULL on error, never an error pointer.
      Checking the returned pointer using IS_ERR_OR_NULL() is needless
      overhead.  Use a simple !ptr check instead.
      
      OMAP devices (oh->od) always have a valid platform device attached (see
      omap_device_alloc()) so there's no point validating the platform device
      pointer (we will have already oopsed long before if this is not the
      case here.)
      
      Lastly, oh->od is only ever NULL or a valid omap device pointer - 'oh'
      comes from the statically declared hwmod tables, and the pointer is
      only filled in by omap_device_alloc() at a point where the omap device
      pointer must be valid.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      4d485661
  21. 26 1月, 2013 1 次提交
    • P
      ARM: OMAP2+: omap_device: remove obsolete pm_lats and early_device code · c1d1cd59
      Paul Walmsley 提交于
      Remove now-obsolete code from arch/arm/mach-omap2/omap_device.c.  This
      mostly consists of removing the first attempt at device PM latency
      handling.  This was never really used, has been replaced by the common
      dev_pm_qos code, and needs to go away as part of the DT conversion.
      Also, the early platform_device creation code has been removed, as it
      appears to be unused.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: Kevin Hilman <khilman@deeprootsystems.com>
      c1d1cd59
  22. 12 1月, 2013 1 次提交
    • T
      ARM: OMAP2+: Use omap initcalls · b76c8b19
      Tony Lindgren 提交于
      This way the initcalls don't run on other SoCs on multiplatform
      kernels. Otherwise we'll get something like this when booting
      on vexpress:
      
      omap_hwmod: _ensure_mpu_hwmod_is_setup: MPU initiator hwmod mpu not yet registered
      ...
      WARNING: at arch/arm/mach-omap2/pm.c:82 _init_omap_device+0x74/0x94()
      _init_omap_device: could not find omap_hwmod for mpu
      ...
      omap-dma-engine omap-dma-engine: OMAP DMA engine driver
      ...
      Tested-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      b76c8b19
  23. 22 11月, 2012 2 次提交
  24. 19 10月, 2012 2 次提交
  25. 18 10月, 2012 1 次提交
  26. 03 10月, 2012 1 次提交
  27. 24 9月, 2012 1 次提交
  28. 23 9月, 2012 1 次提交
    • R
      ARM: OMAP2+: hwmod: get rid of all omap_clk_get_by_name usage · 6ea74cb9
      Rajendra Nayak 提交于
      Moving to Common clk framework for OMAP would mean we no longer use
      internal lookup mechanism like omap_clk_get_by_name().
      get rid of all its usage mostly from hwmod and omap_device
      code.
      
      Moving to clk_get() also means the respective platforms
      need the clkdev tables updated with an entry for all clocks
      used by hwmod to have clock name same as the alias.
      
      Based on original changes from Mike Turquette.
      Signed-off-by: NRajendra Nayak <rnayak@ti.com>
      Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
      [paul@pwsan.com: removed IS_ERR_OR_NULL() conversion (rmk comment);
       restricted omap_96m_alwon_fck_3630 to OMAP36xx; added missing AM35xx
       clock aliases for emac_fck, emac_ick, vpfe_ick, vpfe_fck; added
       aliases rng_ick and several emulation clocks]
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      6ea74cb9
  29. 13 9月, 2012 3 次提交
    • K
      ARM: OMAP: omap_device: idle devices with no driver bound · 9634c8dd
      Kevin Hilman 提交于
      Under some circumstances, drivers may leave an omap_device enabled due
      to driver programming errors, or due to a failure in the drivers
      probe method.
      
      Using the recently added omap_device driver_status field, we can
      detect conditions where an omap_device is enabled but has no driver
      bound and then ensure that the device is properly idled until it can
      be probed again.
      
      The goal of this feature is not only to detect and warn on these error
      conditions, but also to ensure that devices are properly put in
      low-power states so they do not prevent SoC-wide low-power states.
      Reviewed-by: NPaul Walmsley <paul@pwsan.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      9634c8dd
    • K
      ARM: OMAP: omap_device: don't attempt late suspend if no driver bound · 72bb6f9b
      Kevin Hilman 提交于
      Currently, the omap_device PM domain layer uses the late suspend and
      early resume callbacks to ensure devices are in their low power
      states.
      
      However, this is attempted even in cases where a driver probe has
      failed.  If a driver's ->probe() method fails, the driver is likely in
      a state where it is not expecting its runtime PM callbacks to be
      called, yet currently the omap_device PM domain code attempts to call
      the drivers callbacks.
      
      To fix, use the omap_device driver_status field to check whether a
      driver is bound to the omap_device before attempting to trigger driver
      callbacks.
      Reviewed-by: NPaul Walmsley <paul@pwsan.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      72bb6f9b
    • K
      ARM: OMAP: omap_device: keep track of driver bound status · e753345b
      Kevin Hilman 提交于
      Use the bus notifier to keep track of driver bound status by adding a
      new internal field to struct omap_device: _driver_status.
      
      This will be useful for follow-up patches which need to know whether
      or not a driver is bound in order to make intelligent omap_device
      enable/idle decisions.
      Reviewed-by: NPaul Walmsley <paul@pwsan.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      e753345b
  30. 12 9月, 2012 1 次提交
    • P
      ARM: OMAP: unwrap strings · 7852ec05
      Paul Walmsley 提交于
      Find and unwrap wrapped strings in the style:
      
      	pr_debug("clockdomain: hardware cannot set/clear wake up of "
      		 "%s when %s wakes up\n", clkdm1->name, clkdm2->name);
      
      Keeping these strings contiguous seems to be the current Linux kernel
      policy.
      
      The offending lines were found with the following command:
      
          pcregrep -rnM '"\s*$\s*"' arch/arm/*omap*
      
      While here, some messages have been clarified, some pr_warning(
      ... calls have been converted to pr_warn( ..., and some printk(KERN_*
      ... have been converted to pr_*.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      7852ec05
  31. 08 9月, 2012 1 次提交
    • V
      ARM: OMAP: omap_device: Do not overwrite resources allocated by OF layer · b82b04e8
      Vaibhav Hiremath 提交于
      With the new devices (like, AM33XX and OMAP5) we now only support
      DT boot mode of operation and now it is the time to start killing
      slowly the dependency on hwmod, so with this patch, we are starting
      with device resources.
      The idea here is implemented considering to both boot modes -
        - DT boot mode
          OF framework will construct the resource structure (currently
          does for MEM & IRQ resource) and we should respect/use these
          resources, killing hwmod dependency.
          If pdev->num_resources > 0, we assume that MEM & IRQ resources
          have been allocated by OF layer already (through DTB).
      
          Once DMA resource is available from OF layer, we should
          kill filling any resources from hwmod.
      
        - Non-DT boot mode
          Here, pdev->num_resources = 0, and we should get all the
          resources from hwmod (following existing steps)
      Signed-off-by: NVaibhav Hiremath <hvaibhav@ti.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Kevin Hilman <khilman@ti.com>
      [b-cousson@ti.com: Fix some checkpatch CHECK issues]
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      b82b04e8
  32. 06 9月, 2012 1 次提交
    • P
      ARM: OMAP: omap_device: Fix up resource names when booted with devicetree · 3956a1a0
      Peter Ujfalusi 提交于
      When booted with some resource will have their name set to NULL. This can
      cause later kernel crash since this is not expected by the platform code.
      
      When we boot without DT the devices are created with platform_device_add()
      which itself fixes up the missing resource names:
      if (r->name == NULL)
      	r->name = dev_name(&pdev->dev);
      
      The of core also fixes up the resource names when taking the information
      from DT data - in __of_address_to_resource():
      r->name = name ? name : dev->full_name;
      
      When we boot OMAP with devicetree: of will create the devices based on the
      DT data so the resource names are guarantied to be not NULL. Since we have
      the 'ti,hwmod' tag, we remove the of created resources from the device and
      re-create them based on hwmod data. If the hwmod data does not specify a
      name for a resource it will be NULL.
      This can cause kernel crash if the driver uses
      platform_get_resource_byname() to get any resource.
      Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com>
      [b-cousson@ti.com: Change omap_hwmod to omap_device in subject]
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      3956a1a0
  33. 18 4月, 2012 1 次提交
    • P
      ARM: OMAP2+: clean up some cppcheck warnings · eeb3711b
      Paul Walmsley 提交于
      Resolve some warnings identified by cppcheck in arch/arm/mach-omap2:
      
          [arch/arm/mach-omap2/usb-tusb6010.c:129]: (style) Checking if unsigned variable 'tmp' is less than zero.
          [arch/arm/mach-omap2/prm_common.c:241]: (error) Possible null pointer dereference: irq_setup - otherwise it is redundant to check if irq_setup is null at line 247
          [arch/arm/mach-omap2/pm34xx.c:790]: (style) Variable 'per_clkdm' is assigned a value that is never used
          [arch/arm/mach-omap2/pm34xx.c:790]: (style) Variable 'core_clkdm' is assigned a value that is never used
          [arch/arm/mach-omap2/pm24xx.c:185]: (style) Variable 'only_idle' is assigned a value that is never used
          [arch/arm/mach-omap2/mux.c:254]: (error) Possible null pointer dereference: mux
          [arch/arm/mach-omap2/mux.c:258]: (error) Possible null pointer dereference: mux
          [arch/arm/mach-omap2/gpmc-onenand.c:178]: (style) Variable 'tick_ns' is assigned a value that is never used
          [arch/arm/mach-omap2/gpio.c:56]: (error) Possible null pointer dereference: pdata - otherwise it is redundant to check if pdata is null at line 57
          [arch/arm/mach-omap2/devices.c:45]: (style) Variable 'l' is assigned a value that is never used
          [arch/arm/mach-omap2/board-omap3evm.c:641] -> [arch/arm/mach-omap2/board-omap3evm.c:639]: (style) Found duplicate branches for if and else.
          [arch/arm/mach-omap2/am35xx-emac.c:95]: (style) Variable 'regval' is assigned a value that is never used
          [arch/arm/mach-omap2/devices.c:74]: (style) Variable 'l' is assigned a value that is never used
          [arch/arm/mach-omap2/pm34xx.c:277]: (style) Variable 'per_prev_state' is assigned a value that is never used
          [arch/arm/plat-omap/dmtimer.c:352]: (error) Possible null pointer dereference: timer - otherwise it is redundant to check if timer is null at line 354
          [arch/arm/plat-omap/omap_device.c:478]: (style) Variable 'c' is assigned a value that is never used
          [arch/arm/plat-omap/usb.c:42]: (style) Variable 'status' is assigned a value that is never used
          [arch/arm/mach-omap1/clock.c:197]: (style) Variable 'dpll1_rate' is assigned a value that is never used
          [arch/arm/mach-omap1/lcd_dma.c:60]: (style) struct or union member 'lcd_dma_info::size' is never used
          [arch/arm/mach-omap1/pm.c:572]: (style) Variable 'entry' is assigned a value that is never used
      
      Some of them are pretty good catches, such as gpio.c:56 and
      usb-tusb6010.c:129.
      
      Thanks to Jarkko Nikula for some comments on the sscanf() warnings.
      It seems that the kernel sscanf() ignores the field width anyway for the
      %d format, so those changes have been dropped from this second version.
      
      Thanks to Daniel Marjamäki <daniel.marjamaki@gmail.com> for pointing
      out that a variable was unnecessarily marked static in the
      board-omap3evm.c change.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Kevin Hilman <khilman@ti.com>
      Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
      Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
      Cc: Charulatha Varadarajan <charu@ti.com>
      Cc: Daniel Marjamäki <daniel.marjamaki@gmail.com>
      Cc: Tarun Kanti DebBarma <tarun.kanti@ti.com>
      Reviewed-by: Charulatha Varadarajan <charu@ti.com> # for gpio.c
      eeb3711b
  34. 06 3月, 2012 1 次提交
    • P
      ARM: OMAP2+: omap_device: call all suspend, resume callbacks when... · b7c39a3f
      Paul Walmsley 提交于
      ARM: OMAP2+: omap_device: call all suspend, resume callbacks when OMAP_DEVICE_NO_IDLE_ON_SUSPEND is set
      
      During system suspend, when OMAP_DEVICE_NO_IDLE_ON_SUSPEND is set on
      an omap_device, call the corresponding driver's ->suspend() and
      ->suspend_noirq() callbacks (if present).  Similarly, during resume,
      the driver's ->resume() and ->resume_noirq() callbacks must both be
      called, if present.  (The previous code only called ->suspend_noirq()
      and ->resume_noirq().)
      
      If all of these callbacks aren't called, some important driver
      suspend/resume code may not get executed.
      
      In current mainline, the bug fixed by this patch is only a problem
      under the following conditions:
      
      - the kernel is running on an OMAP4
      
      - an OMAP UART is used as a console
      
      - the kernel command line parameter 'no_console_suspend' is specified
      
      - and the system enters suspend ("echo mem > /sys/power/state").
      
      Under this combined circumstance, the system cannot be awakened via
      the serial port after commit be4b0281c
      ("tty: serial: OMAP: block idle while the UART is transferring data in
      PIO mode").  This is because the OMAP UART driver's ->suspend()
      callback is never called.  The ->suspend() callback would have called
      uart_suspend_port() which in turn would call enable_irq_wake().  Since
      enable_irq_wake() isn't called for the UART's IRQ, check_wakeup_irqs()
      would mask off the UART IRQ in the GIC.
      
      On v3.3 kernels prior to the above commit, serial resume from suspend
      presumably occurred via the PRCM interrupt.  The UART was in
      smart-idle mode, so it was able to send a PRCM wakeup which in turn
      would be converted into a PRCM interrupt to the GIC, waking up the
      kernel.  But after the above commit, when the system is suspended in
      the middle of a UART transmit, the UART IP block would be in no-idle
      mode.  In no-idle mode, the UART won't generate wakeups to the PRCM
      when incoming characters are received; only GIC interrupts.  But since
      the UART driver's ->suspend() callback is never called,
      uart_suspend_port() and enable_irq_wake() is never called; so the UART
      interrupt is masked by check_wakeup_irqs() and the UART can't wake up
      the MPU.
      
      The remaining mechanism that could have awakened the system would have
      been I/O chain wakeups.  These wouldn't be active because the console
      UART's clocks are never disabled when no_console_suspend is used,
      preventing the full chip from idling.  Also, current mainline doesn't
      yet support full chip idle states for OMAP4, so I/O chain wakeups are
      not enabled.
      
      This patch is the result of a collaboration.  John Stultz
      <johnstul@us.ibm.com> and Andy Green <andy.green@linaro.org> reported
      the serial wakeup problem that led to the discovery of this problem.
      Kevin Hilman <khilman@ti.com> narrowed the problem down to the use of
      no_console_suspend.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      Cc: Andy Green <andy.green@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      b7c39a3f