1. 04 Mar, 2008 2 commits
    • David Brownell's avatar
      atmel_tc clocksource/clockevent code · 4d243f92
      David Brownell authored
      Clocksource and clockevent device based on the Atmel TC blocks.
      
      The clockevent device handles both periodic and oneshot modes, so this
      enables NO_HZ and high res timers on some platforms that previously
      couldn't use those mechanisms.
      
      This works on both AVR32 and AT91 chips, given relevant patches for
      tclib support (always) and clockevents (or else this will only look
      like a higher precision clocksource).  It's an updated and modularized
      version of an AT91-only patch that has circulated for some time now.
      
      Changes relative to the original patch:
        * Update to use new tclib API
        * Replace open-coded do-while loop using goto with a real do-while loop
        * Minor irq handler optimization: Load register base address from
          dev_id instead of a global variable.
        * Aggressively turn off clocks when the clockevent isn't being used
        * Include the clockevent code on AT91RM9200 as well. The rating is
          lower than the System Timer, so the clock will usually stay off.
        * Don't assume that the number of clocks is always equal to the
          number of irqs.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarHaavard Skinnemoen <hskinnemoen@atmel.com>
      4d243f92
    • David Brownell's avatar
      atmel_tc library · 2a341f5c
      David Brownell authored
      Create <linux/atmel_tc.h> based on <asm-arm/arch-at91/at91-tc.h> and the
      at91sam9263 and at32ap7000 datasheets.  Most AT91 and AT32 SOCs have one
      or two of these TC blocks, which include three 16-bit timers that can be
      interconnected in various ways.
      
      These TC blocks can be used for external interfacing (such as PWM and
      measurement), or used as somewhat quirky sixteen-bit timers.
      
      Changes relative to the original version:
        * Drop unneeded inclusion of <linux/mutex.h>
        * Support an arbitrary number of TC blocks
        * Return a struct with information about a TC block from
          atmel_tc_alloc() instead of using a combination of return values
          and "out" parameters.
        * ioremap() the I/O registers on allocation
        * Look up clocks and irqs for all channels
        * Add "name" parameter to atmel_tc_alloc() and use this when
          requesting the iomem resource.
        * Check if the platform provided the necessary resources at probe()
          time instead of when the TCB is allocated.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarHaavard Skinnemoen <hskinnemoen@atmel.com>
      2a341f5c
  2. 03 Mar, 2008 38 commits