1. 15 12月, 2012 2 次提交
    • V
      ARM: OMAP2+: Fix sparse warnings in timer.c · bf85f205
      Vaibhav Hiremath 提交于
      Sparse generates the following warnings when compiling mach-omap2/timer.c.
      
        CHECK   arch/arm/mach-omap2/timer.c
        arch/arm/mach-omap2/timer.c:193:13: warning: symbol 'omap_dmtimer_init'
        was not declared. Should it be static?
        arch/arm/mach-omap2/timer.c:213:12: warning: symbol
        'omap_dm_timer_get_errata' was not declared. Should it be static?
      
      Add static to function declaration to fix warnings.
      Signed-off-by: NVaibhav Hiremath <hvaibhav@ti.com>
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      bf85f205
    • J
      ARM: AM335x: Fix warning in timer.c · e0c3e27c
      Jon Hunter 提交于
      When compiling the kernel with configuration options ...
      
       # CONFIG_ARCH_OMAP2 is not set
       # CONFIG_ARCH_OMAP3 is not set
       # CONFIG_ARCH_OMAP4 is not set
       # CONFIG_SOC_OMAP5 is not set
       CONFIG_SOC_AM33XX=y
      
       ... the following build warning is seen.
      
        CC      arch/arm/mach-omap2/timer.o
        arch/arm/mach-omap2/timer.c:395:19: warning: ‘omap2_sync32k_clocksource_init’
        	defined but not used [-Wunused-function]
      
      This issue was introduced by commit 6f80b3bb (ARM: OMAP2+: timer: remove
      CONFIG_OMAP_32K_TIMER) where the omap2_sync32k_clocksource_init() is no
      longer referenced by the timer initialisation function for the AM335x
      device as it has no 32k-sync timer.
      
      Fix this by adding the "__maybe_unused" compiler directive to the
      omap2_sync32k_clocksource_init() function to indicate that this function
      may be used for certain configurations.
      
      Cc: Igor Grinberg <grinberg@compulab.co.il>
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      e0c3e27c
  2. 30 11月, 2012 1 次提交
    • O
      ARM: omap: fix typo on timer cleanup · 73f14f6d
      Olof Johansson 提交于
      Fix 32 vs 32k typo:
      
      arch/arm/mach-omap2/timer.c: In function 'omap4_local_timer_init':
      arch/arm/mach-omap2/timer.c:633:2: error: implicit declaration of function 'omap4_sync32_timer_init' [-Werror=implicit-function-declaration]
      arch/arm/mach-omap2/timer.c: At top level:
      arch/arm/mach-omap2/timer.c:610:2: warning: 'omap4_sync32k_timer_init' defined but not used [-Wunused-function]
      
      Also, mark the omap4_local_timer_init() stub as __init (and take off
      the explicit inline and let the compiler do the work instead).
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Igor Grinberg <grinberg@compulab.co.il>
      73f14f6d
  3. 22 11月, 2012 2 次提交
    • I
      ARM: OMAP3: cm-t3517: use GPTIMER for system clock · 26f01998
      Igor Grinberg 提交于
      cm-t3517 starting from revision 1.2 does not have the 32K oscilator
      wired to the AM3517 SoC.
      Therefore switch to use the GPTIMER for system clock.
      Signed-off-by: NIgor Grinberg <grinberg@compulab.co.il>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      26f01998
    • I
      ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER · 6f80b3bb
      Igor Grinberg 提交于
      CONFIG_OMAP_32K_TIMER is kind of standing on the single zImage way.
      Make OMAP2+ timer code independant from the CONFIG_OMAP_32K_TIMER
      setting.
      To remove the dependancy, several conversions/additions had to be done:
      1) Timer initialization functions are named by the platform
         name and the clock source in use.
         This also makes it possible to define and use the GPTIMER as the
         clock source instead of the 32K timer on platforms that do not have
         the 32K timer ip block or the 32K timer is not wired on the board.
         Currently, the the timer is chosen in the machine_desc structure on
         per board basis. Later, DT should be used to choose the timer.
      2) Settings under the CONFIG_OMAP_32K_TIMER option are used as defaults
         and those under !CONFIG_OMAP_32K_TIMER are removed.
         This removes the CONFIG_OMAP_32K_TIMER on OMAP2+ timer code.
      3) Since we have all the timers defined inside machine_desc structure
         and we no longer need the fallback to gp_timer clock source in case
         32k_timer clock source is unavailable (namely on AM33xx), we no
         longer need the #ifdef around omap2_sync32k_clocksource_init()
         function. Remove the #ifdef CONFIG_OMAP_32K_TIMER around the
         omap2_sync32k_clocksource_init() function.
      Signed-off-by: NIgor Grinberg <grinberg@compulab.co.il>
      Cc: Jon Hunter <jon-hunter@ti.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
      Cc: Vaibhav Hiremath <hvaibhav@ti.com>
      Acked-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      Reviewed-by: NJon Hunter <jon-hunter@ti.com>
      6f80b3bb
  4. 17 11月, 2012 4 次提交
  5. 13 11月, 2012 4 次提交
    • J
      ARM: OMAP: Remove __omap_dm_timer_set_source function · b1538832
      Jon Hunter 提交于
      The __omap_dm_timer_set_source() function is only used by the system timer
      (clock-events and clock-source) code for OMAP2+ devices. Therefore, we can
      remove this code from the dmtimer driver and move it to the system timer
      code for OMAP2+ devices.
      
      The current __omap_dm_timer_set_source() function calls clk_disable() before
      calling clk_set_parent() and clk_enable() afterwards. We can avoid these calls
      to clk_disable/enable by moving the calls to omap_hwmod_setup_one() and
      omap_hwmod_enable() to after the call to clk_set_parent() in
      omap_dm_timer_init_one().
      
      The function omap_hwmod_setup_one() will enable the timers functional clock
      and therefore increment the use-count of the functional clock to 1.
      clk_set_parent() will fail if the use-count is not 0 when called. Hence, if
      omap_hwmod_setup_one() is called before clk_set_parent(), we will need to call
      clk_disable() before calling clk_set_parent() to decrement the use-count.
      Hence, avoid these extra calls to disable and enable the functional clock by
      moving the calls to omap_hwmod_setup_one() and omap_hwmod_enable() to after
      clk_set_parent().
      
      We can also remove the delay from the __omap_dm_timer_set_source() function
      because enabling the clock will now be handled via the HWMOD framework by
      calling omap_hwmod_setup_one(). Therefore, by moving the calls to
      omap_hwmod_setup_one() and omap_hwmod_enable() to after the call to
      clk_set_parent(), we can simply replace __omap_dm_timer_set_source() with
      clk_set_parent().
      
      It should be safe to move these hwmod calls to later in the
      omap_dm_timer_init_one() because other calls to the hwmod layer that occur
      before are just requesting resource information.
      
      Testing includes boot testing on OMAP2420 H4, OMAP3430 SDP and OMAP4430 Blaze
      with the following configurations:
      1. CONFIG_OMAP_32K_TIMER=y
      2. CONFIG_OMAP_32K_TIMER=y and boot parameter "clocksource=gp_timer"
      3. CONFIG_OMAP_32K_TIMER not set
      4. CONFIG_OMAP_32K_TIMER not set and boot parameter "clocksource=gp_timer"
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Acked-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      b1538832
    • J
      ARM: OMAP2+: Don't use __omap_dm_timer_reset() · 10759e82
      Jon Hunter 提交于
      Currently OMAP2+ devices are using the function __omap_dm_timer_reset() to
      configure the clock-activity, idle, wakeup-enable and auto-idle fields in the
      timer OCP_CFG register. The name of the function is mis-leading because this
      function does not actually perform a reset of the timer.
      
      For OMAP2+ devices, HWMOD is responsible for reseting and configuring the
      timer OCP_CFG register. Therefore, do not use __omap_dm_timer_reset() for
      OMAP2+ devices and rely on HWMOD. Furthermore, some timer instances do not
      have the fields clock-activity, wakeup-enable and auto-idle and so this
      function could configure the OCP_CFG register incorrectly.
      
      Currently HWMOD is not configuring the clock-activity field in the OCP_CFG
      register for timers that have this field. Commit 0f0d0807 (ARM: OMAP: DMTimer:
      Use posted mode) configures the clock-activity field to keep the f-clk enabled
      so that the wake-up capability is enabled. Therefore, add the appropriate flags
      to the timer HWMOD structures to configure this field in the same way.
      
      For OMAP2/3 devices all dmtimers have the clock-activity field, where as for
      OMAP4 devices, only dmtimer 1, 2 and 10 have the clock-activity field.
      
      Verified on OMAP2420 H4, OMAP3430 Beagle and OMAP4430 Panda that HWMOD is
      configuring the dmtimer OCP_CFG register as expected for clock-events timer.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Acked-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      10759e82
    • J
      ARM: OMAP3+: Implement timer workaround for errata i103 and i767 · bfd6d021
      Jon Hunter 提交于
      Errata Titles:
      i103: Delay needed to read some GP timer, WD timer and sync timer
            registers after wakeup (OMAP3/4)
      i767: Delay needed to read some GP timer registers after wakeup (OMAP5)
      
      Description (i103/i767):
      If a General Purpose Timer (GPTimer) is in posted mode
      (TSICR [2].POSTED=1), due to internal resynchronizations, values read in
      TCRR, TCAR1 and TCAR2 registers right after the timer interface clock
      (L4) goes from stopped to active may not return the expected values. The
      most common event leading to this situation occurs upon wake up from
      idle.
      
      GPTimer non-posted synchronization mode is not impacted by this
      limitation.
      
      Workarounds:
      1). Disable posted mode
      2). Use static dependency between timer clock domain and MPUSS clock
          domain
      3). Use no-idle mode when the timer is active
      
      Workarounds #2 and #3 are not pratical from a power standpoint and so
      workaround #1 has been implemented. Disabling posted mode adds some CPU
      overhead for configuring and reading the timers as the CPU has to wait
      for accesses to be re-synchronised within the timer. However, disabling
      posted mode guarantees correct operation.
      
      Please note that it is safe to use posted mode for timers if the counter
      (TCRR) and capture (TCARx) registers will never be read. An example of
      this is the clock-event system timer. This is used by the kernel to
      schedule events however, the timers counter is never read and capture
      registers are not used. Given that the kernel configures this timer
      often yet never reads the counter register it is safe to enable posted
      mode in this case. Hence, for the timer used for kernel clock-events,
      posted mode is enabled by overriding the errata for devices that are
      impacted by this defect.
      
      For drivers using the timers that do not read the counter or capture
      registers and wish to use posted mode, can override the errata and
      enable posted mode by making the following function calls.
      
      	__omap_dm_timer_override_errata(timer, OMAP_TIMER_ERRATA_I103_I767);
      	__omap_dm_timer_enable_posted(timer);
      
      Both dmtimers and watchdogs are impacted by this defect this patch only
      implements the workaround for the dmtimer. Currently the watchdog driver
      does not read the counter register and so no workaround is necessary.
      
      Posted mode will be disabled for all OMAP2+ devices (including AM33xx)
      using a GP timer as a clock-source timer to guarantee correct operation.
      This is not necessary for OMAP24xx devices but the default clock-source
      timer for OMAP24xx devices is the 32k-sync timer and not the GP timer
      and so should not have any impact. This should be re-visited for future
      devices if this errata is fixed.
      
      Confirmed with Vaibhav Hiremath that this bug also impacts AM33xx
      devices.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Acked-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      bfd6d021
    • J
      ARM: OMAP: Add DMTIMER definitions for posted mode · 971d0254
      Jon Hunter 提交于
      For OMAP2+ devices, when using DMTIMERs for system timers (clock-events and
      clock-source) the posted mode configuration of the timers is used. To allow
      the compiler to optimise the functions for configuring and reading the system
      timers, the posted flag variable is hard-coded with the value 1. To make it
      clear that posted mode is being used add some definitions so that it is more
      readable.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Acked-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      971d0254
  6. 03 11月, 2012 3 次提交
    • J
      ARM: OMAP2+: Add device-tree support for 32kHz counter · 9883f7c8
      Jon Hunter 提交于
      For OMAP devices, the 32kHz counter is the default clock-source for the kernel.
      However, this is not the only possible clock-source the kernel can use for OMAP
      devices.
      
      When booting with device-tree, if the 32kHz counter is the desired clock-source
      for the kernel, then parse the device-tree blob to ensure that the counter is
      present and if so map memory for the counter using the device-tree of_iomap()
      function so we are no longer reliant on the OMAP HWMOD framework to do this for
      us.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      9883f7c8
    • J
      ARM: OMAP: Add DT support for timer driver · 9725f445
      Jon Hunter 提交于
      In order to add device-tree support to the timer driver the following changes
      were made ...
      
      1. Allocate system timers (used for clock-events and clock-source) based upon
         timer properties rather than using an hard-coded timer instance ID. To allow
         this a new helper function called omap_dmtimer_find_by_property() has been
         added for finding a timer with the particular properties in the device-tree
         blob. Please note that this is an internal helper function for system timers
         only to find a timer in the device-tree blob. This cannot be used by device
         drivers, another API has been added for that (see below). Timers that are
         allocated for system timers are dynamically disabled at boot time by adding
         a status property with the value "disabled" to the timer's device-tree node.
      
         Please note that when allocating system timers we now pass a timer ID and
         timer property. The timer ID is only be used for allocating a timer when
         booting without device-tree. Once device-tree migration is complete, all
         the timer ID references will be removed.
      
      2. System timer resources (memory and interrupts) are directly obtained from
         the device-tree timer node when booting with device-tree, so that system
         timers are no longer reliant upon the OMAP HWMOD framework to provide these
         resources.
      
      3. If DT blob is present, then let device-tree create the timer devices
         dynamically.
      
      4. When device-tree is present the "id" field in the platform_device structure
         (pdev->id) is initialised to -1 and hence cannot be used to identify a timer
         instance. Due to this the following changes were made ...
         a). The API omap_dm_timer_request_specific() is not supported when using
             device-tree, because it uses the device ID to request a specific timer.
             This function will return an error if called when device-tree is present.
             Users of this API should use omap_dm_timer_request_by_cap() instead.
         b). When removing the DMTIMER driver, the timer "id" was used to identify the
             timer instance. The remove function has been modified to use the device
             name instead of the "id".
      
      5. When device-tree is present the platform_data structure will be NULL and so
         check for this.
      
      6. The OMAP timer device tree binding has the following optional parameters ...
         a). ti,timer-alwon  --> Timer is in an always-on power domain
         b). ti,timer-dsp    --> Timer can generate an interrupt to the on-chip DSP
         c). ti,timer-pwm    --> Timer can generate a PWM output
         d). ti,timer-secure --> Timer is reserved on a secure OMAP device
         Search for the above parameters and set the appropriate timer attribute
         flags.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      9725f445
    • J
      ARM: OMAP3: Dynamically disable secure timer nodes for secure devices · ad24bde8
      Jon Hunter 提交于
      OMAP3 devices may or may not have security features enabled. Security enabled
      devices are known as high-secure (HS) and devices without security are known as
      general purpose (GP).
      
      For OMAP3 devices there are 12 general purpose timers available. On secure
      devices the 12th timer is reserved for secure usage and so cannot be used by
      the kernel, where as for a GP device it is available. We can detect the OMAP
      device type, secure or GP, at runtime via an on-chip register. Today, when not
      using DT, we do not register the 12th timer as a linux device if the device is
      secure.
      
      When using device tree, device tree is going to register all the timer devices
      it finds in the device tree blob. To prevent device tree from registering 12th
      timer on a secure OMAP3 device we can add a status property to the timer
      binding with the value "disabled" at boot time. Note that timer 12 on a OMAP3
      device has a property "ti,timer-secure" to indicate that it will not be
      available on a secure device and so for secure OMAP3 devices, we search for
      timers with this property and then disable them. Using the prom_add_property()
      function to dynamically add a property was a recommended approach suggested by
      Rob Herring [1].
      
      I have tested this on an OMAP3 GP device and faking it to pretend to be a
      secure device to ensure that any timers marked with "ti,timer-secure" are not
      registered on boot. I have also made sure that all timers are registered as
      expected on a GP device by default.
      
      [1] http://comments.gmane.org/gmane.linux.ports.arm.omap/79203Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      ad24bde8
  7. 01 11月, 2012 2 次提交
    • T
      ARM: OMAP: Remove plat-omap/common.h · 5c2e8852
      Tony Lindgren 提交于
      Most of the prototypes in plat-omap/common.h are not
      common to omap1 and omap2+, they are local to omap2+
      and should not be in plat-omap/common.h.
      
      The only shared function prototype in this file is
      omap_init_clocksource_32k(), let's put that into
      counter-32k.h.
      
      Note that the new plat/counter-32k.h must not be
      included from drivers, that will break omap2+ build
      for CONFIG_MULTIPLATFORM.
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      5c2e8852
    • T
      ARM: OMAP: Move omap-pm-noop.c local to mach-omap2 · 6e740f9a
      Tony Lindgren 提交于
      This code should be private to mach-omap2.
      
      The only use for it in for omap1 has been in dmtimer.c
      to check for context loss. However, omap1 does not
      lose context during idle, so the code is not needed.
      Further, omap1 timer has OMAP_TIMER_ALWON set, so omap1
      was not hitting omap_pm_get_dev_context_loss_count()
      test.
      
      Cc: Jon Hunter <jon-hunter@ti.com>
      Cc: Kevin Hilman <khilman@deeprootsystems.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      6e740f9a
  8. 19 10月, 2012 2 次提交
  9. 18 10月, 2012 1 次提交
  10. 17 10月, 2012 1 次提交
  11. 09 10月, 2012 1 次提交
  12. 19 9月, 2012 2 次提交
  13. 13 9月, 2012 2 次提交
    • T
      ARM: OMAP: Split plat/hardware.h, use local soc.h for omap2+ · dbc04161
      Tony Lindgren 提交于
      As the plat and mach includes need to disappear for single zImage work,
      we need to remove plat/hardware.h.
      
      Do this by splitting plat/hardware.h into omap1 and omap2+ specific files.
      
      The old plat/hardware.h already has omap1 only defines, so it gets moved
      to mach/hardware.h for omap1. For omap2+, we use the local soc.h
      that for now just includes the related SoC headers to keep this patch more
      readable.
      
      Note that the local soc.h still includes plat/cpu.h that can be dealt
      with in later patches. Let's also include plat/serial.h from common.h for
      all the board-*.c files. This allows making the include files local later
      on without patching these files again.
      
      Note that only minimal changes are done in this patch for the
      drivers/watchdog/omap_wdt.c driver to keep things compiling. Further
      patches are needed to eventually remove cpu_is_omap usage in the drivers.
      
      Also only minimal changes are done to sound/soc/omap/* to remove the
      unneeded includes and to define OMAP44XX_MCPDM_L3_BASE locally so there's
      no need to include omap44xx.h.
      
      While at it, also sort some of the includes in the standard way.
      
      Cc: linux-watchdog@vger.kernel.org
      Cc: alsa-devel@alsa-project.org
      Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
      Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
      Cc: Liam Girdwood <lrg@ti.com>
      Acked-by: NWim Van Sebroeck <wim@iguana.be>
      Acked-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      dbc04161
    • T
      ARM: OMAP2+: Prepare for irqs.h removal · 7d7e1eba
      Tony Lindgren 提交于
      As the interrupts should only be defined in the platform_data, and
      eventually coming from device tree, there's no need to define them
      in header files.
      
      Let's remove the hardcoded references to irqs.h and fix up the includes
      so we don't rely on headers included in irqs.h. Note that we're
      defining OMAP_INTC_START as 0 to the interrupts. This will be needed
      when we enable SPARSE_IRQ. For some drivers we need to add
      #include <plat/cpu.h> for now until these drivers are fixed to
      remove cpu_is_omapxxxx() usage.
      
      While at it, sort som of the includes the standard way, and add
      the trailing commas where they are missing in the related data
      structures.
      
      Note that for drivers/staging/tidspbridge we just define things
      locally.
      
      Cc: Paul Walmsley <paul@pwsan.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      7d7e1eba
  14. 12 9月, 2012 1 次提交
    • P
      ARM: OMAP: clean up some smatch warnings, fix some printk(KERN_ERR ... · a032d33b
      Paul Walmsley 提交于
      Resolve the following warnings from smatch:
      
      arch/arm/mach-omap2/gpmc.c:282 gpmc_cs_set_timings() info: why not propagate 'div' from gpmc_cs_calc_divider() instead of -1?
      arch/arm/mach-omap2/serial.c:328 omap_serial_init_port() error: 'pdev' dereferencing possible ERR_PTR()
      arch/arm/mach-omap2/timer.c:213 omap2_gp_clockevent_init() Error invalid range 4096 to -1
      arch/arm/mach-omap2/gpio.c:63 omap2_gpio_dev_init() warn: possible memory leak of 'pdata'
      arch/arm/mach-omap2/omap_hwmod.c:1478 _assert_hardreset() warn: assigning -22 to unsigned variable 'ret'
      arch/arm/mach-omap2/omap_hwmod.c:1487 _assert_hardreset() warn: 4294963201 is more than 255 (max '(ret)' can be) so this is always the same.
      arch/arm/mach-omap2/omap_hwmod.c:1545 _read_hardreset() warn: assigning -22 to unsigned variable 'ret'
      arch/arm/mach-omap2/omap_hwmod.c:1554 _read_hardreset() warn: 4294963201 is more than 255 (max '(ret)' can be) so this is always the same.
      arch/arm/mach-omap2/dpll3xxx.c:629 omap3_clkoutx2_recalc() error: we previously assumed 'pclk' could be null (see line 627)
      arch/arm/mach-omap2/board-n8x0.c:422 n8x0_mmc_late_init() Error invalid range 14 to 13
      arch/arm/mach-omap1/leds-h2p2-debug.c:71 h2p2_dbg_leds_event() error: potentially derefencing uninitialized 'fpga'.
      arch/arm/plat-omap/mux.c:79 omap_cfg_reg() Error invalid range 4096 to -1
      
      Thanks to Tony Lindgren <tony@atomide.com> for pointing out that BUG()
      can be disabled.  The changes in the first version that removed the
      subsequent return() after BUG() states have been dropped.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: Tony Lindgren <tony@atomide.com>
      a032d33b
  15. 08 9月, 2012 1 次提交
  16. 31 8月, 2012 1 次提交
  17. 26 7月, 2012 1 次提交
  18. 09 7月, 2012 1 次提交
  19. 06 7月, 2012 1 次提交
    • T
      ARM: OMAP2+: dmtimer: cleanup fclk usage · ae6df418
      Tarun Kanti DebBarma 提交于
      With omap_hwmod_get_main_clk() now available, this can be passed to
      clk_get() to extract the fclk and thus avoid construction of fclk name.
      Corrected the timer fck name mis-match between clock44xx_data.c and
      omap_hwmod_44xx_data.c. For other platforms this is already taken care.
      
      Cc: Cousson, Benoit <b-cousson@ti.com>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Kevin Hilman <khilman@ti.com>
      Cc: Rajendra Nayak <rnayak@ti.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
      Signed-off-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      ae6df418
  20. 14 6月, 2012 7 次提交
    • J
      ARM: OMAP2+: Move dmtimer clock set function to dmtimer driver · 2b2d3523
      Jon Hunter 提交于
      OMAP1 uses an architecture specific function for setting the dmtimer clock
      source, where as the OMAP2+ devices use the clock framework. Eventually OMAP1
      device should also use the clock framework and hence we should not any
      architecture specific functions.
      
      For now move the OMAP2+ function for configuring the clock source into the
      dmtimer driver. Therefore, we do no longer need to specify an architecture
      specific function for setting the clock source for OMAP2+ devices. This will
      simplify device tree migration of the dmtimers for OMAP2+ devices.
      
      From now on, only OMAP1 devices should specify an architecture specific
      function for setting the clock source via the platform data set_dmtimer_src()
      function pointer.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      2b2d3523
    • J
      ARM: OMAP: Remove timer function pointer for context loss counter · 0b30ec1c
      Jon Hunter 提交于
      For OMAP2+ devices, a function pointer that returns the number of times a timer
      power domain has lost context is passed to the dmtimer driver. This function
      pointer is only populated for OMAP2+ devices and it is pointing to a platform
      function. Given that this is a platform function, we can simplify the code by
      removing the function pointer and referencing the function directly. We can use
      the OMAP_TIMER_ALWON flag to determine if we need to call this function for
      OMAP1 and OMAP2+ devices.
      
      The benefit of this change is the we can remove the function pointer from the
      platform data and simplifies the dmtimer migration to device-tree.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      0b30ec1c
    • J
      ARM: OMAP: Remove loses_context variable from timer platform data · 1c2d076b
      Jon Hunter 提交于
      The platform data variable loses_context is used to determine if the timer may
      lose its logic state during power transitions and so needs to be restored. This
      information is also provided in the HWMOD device attributes for OMAP2+ devices
      via the OMAP_TIMER_ALWON flag. When this flag is set the timer will not lose
      context. So use the HWMOD device attributes to determine this.
      
      For OMAP1 devices, loses_context is never set and so set the OMAP_TIMER_ALWON
      flag for OMAP1 timers to ensure that code is equivalent.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      1c2d076b
    • J
      ARM: OMAP2+: Fix external clock support for dmtimers · 67d2e760
      Jon Hunter 提交于
      Currently, the dmtimer determines whether an timer can support an external
      clock source (sys_altclk) for driving the timer by the IP version. Only
      OMAP24xx devices can support an external clock source, but the IP version
      between OMAP24xx and OMAP3xxx is common and so this incorrectly indicates
      that OMAP3 devices can use an external clock source.
      
      Rather than use the IP version, just let the clock framework handle this.
      If the "alt_ck" does not exist for a timer then the clock framework will fail
      to find the clock and hence will return an error. By doing this we can eliminate
      the "timer_ip_version" variable passed as part of the platform data and simplify
      the code.
      
      We can also remove the timer IP version from the HWMOD data because the dmtimer
      driver uses the TIDR register to determine the IP version.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      67d2e760
    • J
      ARM: OMAP: Add DMTIMER capability variable to represent timer features · d1c1691b
      Jon Hunter 提交于
      Although the OMAP timers share a common hardware design, there are some
      differences between the timer instances in a given device. For example, a timer
      maybe in a power domain that can be powered-of, so can lose its logic state and
      need restoring where as another may be in power domain that is always be on.
      Another example, is a timer may support different clock sources to drive the
      timer. This information is passed to the dmtimer via the following platform data
      structure.
      
      struct dmtimer_platform_data {
      	int (*set_timer_src)(struct platform_device *pdev, int source);
      	int timer_ip_version;
      	u32 needs_manual_reset:1;
      	bool loses_context;
      	int (*get_context_loss_count)(struct device *dev);
      };
      
      The above structure uses multiple variables to represent the timer features.
      HWMOD also stores the timer capabilities using a bit-mask that represents the
      features supported. By using the same format for representing the timer
      features in the platform data as used by HWMOD, we can ...
      
      1. Use the flags defined in the plat/dmtimer.h to represent the features
         supported.
      2. For devices using HWMOD, we can retrieve the features supported from HWMOD.
      3. Eventually, simplify the platform data structure to be ...
      
      struct dmtimer_platform_data {
      	int (*set_timer_src)(struct platform_device *pdev, int source);
      	u32 timer_capability;
      }
      
      Another benefit from doing this, is that it will simplify the migration of the
      dmtimer driver to device-tree. For example, in the current OMAP2+ timer code the
      "loses_context" variable is configured at runtime by calling an architecture
      specific function. For device tree this creates a problem, because we would need
      to call the architecture specific function from within the dmtimer driver.
      However, such attributes do not need to be queried at runtime and we can look up
      the attributes via HWMOD or device-tree.
      
      This changes a new "capability" variable to the platform data and timer
      structure so we can start removing and simplifying the platform data structure.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      d1c1691b
    • J
      ARM: OMAP2+: Add dmtimer platform function to reserve systimers · b7b4ff76
      Jon Hunter 提交于
      During early boot, one or two dmtimers are reserved by the kernel as system
      timers (for clocksource and clockevents). These timers are marked as reserved
      and the dmtimer driver is notified which timers have been reserved via the
      platform data information.
      
      For OMAP2+ devices the timers reserved may vary depending on device and compile
      flags. Therefore, it is not easy to assume which timers we be reserved for the
      system timers. In order to migrate the dmtimer driver to support device-tree we
      need a way to pass the timers reserved for system timers to the dmtimer driver.
      Using the platform data structure will not work in the same way as it is
      currently used because the platform data structure will be stored statically in
      the dmtimer itself and the platform data will be selected via the device-tree
      match device function (of_match_device).
      
      There are a couple ways to workaround this. One option is to store the system
      timers reserved for the kernel in the device-tree and query them on boot.
      The downside of this approach is that it adds some delay to parse the DT blob
      to search for the system timers. Secondly, for OMAP3 devices we have a
      dependency on compile time flags and the device-tree would not be aware of that
      kernel compile flags and so we would need to address that.
      
      The second option is to add a function to the dmtimer code to reserved the
      system timers during boot and so the dmtimer knows exactly which timers are
      being used for system timers. This also allows us to remove the "reserved"
      member from the timer platform data. This seemed like the simpler approach and
      so was implemented here.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      b7b4ff76
    • J
      ARM: OMAP2+: Remove unused max number of timers definition · 26fe4e45
      Jon Hunter 提交于
      The OMAP2+ timer code has a definition for the maximum number of timers that
      OMAP2+ devices have. This defintion is not used anywhere in the code and
      appears to be left over. Furthermore the definition is not accurate for OMAP4
      devices that only have 11 timers available because the 12th timer is reserved
      as a secure timer and for OMAP3 devices the 12th timer is not available on
      secure devices. Therefore, remove this definition.
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      26fe4e45