1. 27 6月, 2012 1 次提交
    • G
      gpio/omap: fix irq loss while in idle with debounce on · 9e303f22
      Grazvydas Ignotas 提交于
      It seems that currently GPIO module is not working correctly during idle
      when debounce is enabled - the system almost never responds to button
      presses (observed on OMAP3530 ES2.1 and OMAP3630 ES1.2 pandora boards).
      Even though wakeups are probably working, it seems that the GPIO module
      itself is unable to detect input events and generate interrupts.
      OMAP35x TRM also states that:
        "If the debounce clock is inactive, the debounce cell gates all
         input signals and thus cannot be used."
      
      So whenever we are disabling debounce clocks (for PM or other reasons),
      be sure the module's debounce feature is disabled too.
      
      Cc: Kevin Hilman <khilman@ti.com>
      Signed-off-by: NGrazvydas Ignotas <notasas@gmail.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      9e303f22
  2. 18 5月, 2012 2 次提交
    • K
      gpio/omap: (re)fix wakeups on level-triggered GPIOs · b3c64bc3
      Kevin Hilman 提交于
      commit 1b128703 (gpio/omap: fix missing check in *_runtime_suspend())
      broke wakeups on level-triggered GPIOs by adding the enabled
      non-wakeup GPIO check before the workaround that enables wakeups
      on level-triggered IRQs, effectively disabling that workaround.
      
      To fix, move the enabled non-wakeup GPIO check after the
      level-triggered IRQ workaround.
      Reported-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Acked-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      Acked-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Tested-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      b3c64bc3
    • K
      gpio/omap: fix broken context restore for non-OFF mode transitions · 22770de1
      Kevin Hilman 提交于
      The fix in commit 1b128703 (gpio/omap: fix missing check in
      *_runtime_suspend()) exposed another bug in the context restore path.
      
      Currently, the per-bank context restore happens whenever the context
      loss count is different in runtime suspend and runtime resume *and*
      whenever the per-bank contex_loss_count == 0:
      
      	if (context_lost_cnt_after != bank->context_loss_count ||
      					!context_lost_cnt_after) {
      		omap_gpio_restore_context(bank);
      
      Restoring context when the context_lost_cnt_after == 0 is clearly
      wrong, since this will be true until the first off-mode transition
      (which could be never, if off-mode is never enabled.)  This check
      causes the context to be restored on *every* runtime PM transition.
      
      Before commit 1b128703 (gpio/omap: fix missing check in
      *_runtime_suspend()), this code was never executed in non-OFF mode, so
      there were never spurious context restores happening.  After that
      change though, spurious context restores could happen.
      
      To fix, simply remove the !context_lost_cnt_after check. It is not
      needed.
      
      This bug was found when noticing that the smc911x NIC on 3530/Overo
      was not working, and git bisect tracked it down to this patch.  It
      seems that the spurious context restore was causing the smsc911x to
      not be properly probed on this platform.
      Tested-by: NTony Lindgren <tony@atomide.com>
      Acked-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      22770de1
  3. 12 5月, 2012 7 次提交
  4. 10 5月, 2012 1 次提交
    • T
      gpio/omap: fix incorrect initialization of omap_gpio_mod_init · 6edd94db
      Tarun Kanti DebBarma 提交于
      Initialization of irqenable, irqstatus registers is the common
      operation done in this function for all OMAP platforms, viz. OMAP1,
      OMAP2+. The latter _gpio_rmw()'s which supposedly got introduced
      wrongly to take care of OMAP2+ platforms were overwriting initially
      programmed OMAP1 value breaking functionality on OMAP1.
      Somehow incorrect assumption was made that each _gpio_rmw()'s were
      mutually exclusive. On close observation it is found that the first
      _gpio_rmw() which is supposedly done to take care of OMAP1 platform
      is generic enough and takes care of OMAP2+ platform as well.
      Therefore remove the latter _gpio_rmw() to irqenable as they are
      redundant now.
      
      Writing to ctrl and debounce_en registers for OMAP2+ platforms are
      modified to match the original(pre-cleanup) code where the registers
      are initialized with 0. In the cleanup series since we are using
      _gpio_rmw(reg, 0, 1), instead of __raw_writel(), we are just reading
      and writing the same values to ctrl and debounce_en. This is not an
      issue for debounce_en register because it has 0x0 as the default value.
      But in the case of ctrl register the default value is 0x2 (GATINGRATIO
       = 0x1) so that we end up writing 0x2 instead of intended 0 value.
      Therefore changing back to __raw_writel() as this is sufficient for
      this case besides simpler to understand.
      
      Also, change irqstatus initalization logic that avoids comparison
      with bool, besides making it fit in a single line.
      
      Cc: stable@vger.kernel.org
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Kevin Hilman <khilman@ti.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Reported-by: NJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
      Tested-by: NJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
      Signed-off-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      6edd94db
  5. 21 3月, 2012 2 次提交
    • T
      gpio/omap: fix redundant decoding of gpio offset · 7fcca715
      Tarun Kanti DebBarma 提交于
      In gpio_get(), _get_gpio_datain() and _get_gpio_dataout() get rid of
      un-necessary operation to compute gpio mask. The gpio offset passed
      to gpio_get() is sufficient to do that.
      
      Here is Russell's original comment:
      Can someone explain to me this:
      
      static int _get_gpio_datain(struct gpio_bank *bank, int gpio)
      {
             void __iomem *reg = bank->base + bank->regs->datain;
      
             return (__raw_readl(reg) & GPIO_BIT(bank, gpio)) != 0;
      }
      
      static int gpio_get(struct gpio_chip *chip, unsigned offset)
      {
             struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip);
             void __iomem *reg = bank->base;
             int gpio = chip->base + offset;
             u32 mask = GPIO_BIT(bank, gpio);
      
             if (gpio_is_input(bank, mask))
                     return _get_gpio_datain(bank, gpio);
             else
                     return _get_gpio_dataout(bank, gpio);
      }
      
      Given that bank->width on OMAP is either 32 or 16, and GPIO numbers for
      any GPIO chip are always aligned to 32 or 16, why does this code bother
      adding the chips base gpio number and then modulo the width?
      
      Surely this means if - for argument sake - you registered a GPIO chip
      with 8 lines followed by one with 16 lines, GPIO0..7 would be chip 0
      bit 0..7, GPIO8..15 would be chip 1 bit 8..15, GPIO16..23 would be
      chip 1 bit 0..7.
      
      However, if you registered a GPIO chip with 16 lines first, it would
      mean GPIO0..15 would be chip 0 bit 0..15, and GPIO16..31 would be
      chip 1 bit 0..15.
      
      Surely this kind of behaviour is not intended?
      
      Is there a reason why the bitmask can't just be (1 << offset) where
      offset is passed into these functions as GPIO number - chip->base ?
      Reported-by: NRussell King - ARM Linux <linux@arm.linux.org.uk>
      Signed-off-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Reviewed-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      7fcca715
    • T
      gpio/omap: fix incorrect update to context.irqenable1 · 2a900eb7
      Tarun Kanti DebBarma 提交于
      In _enable_gpio_irqbank() when bank->regs->set_irqenable is TRUE,
      gpio_mask can be directly set by writing to set_irqenable register
      without overwriting current value. In order to ensure the same is
      stored in context.irqenable1, we must avoid overwriting it with
      gpio_mask at the end of the function. Instead, update irqenable1
      appropriately by OR'ing with gpio_mask.
      For the case where bank->regs->set_irqenable is FALSE, irqenable1
      can be directly overwritten with 'l' which holds correct computed
      value.
              if (bank->regs->set_irqenable) {
                      reg += bank->regs->set_irqenable;
                      l = gpio_mask;
              } else {
                      reg += bank->regs->irqenable;
                      l = __raw_readl(reg);
                      if (bank->regs->irqenable_inv)
                              l &= ~gpio_mask;
                      else
                              l |= gpio_mask;
              }
      
      Make similar change for _disable_gpio_irqbank().
      Signed-off-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Reviewed-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      2a900eb7
  6. 20 3月, 2012 5 次提交
  7. 13 3月, 2012 2 次提交
    • T
      gpio/omap: Fix section warning for omap_mpuio_alloc_gc() · 8805f410
      Tony Lindgren 提交于
      Make omap_mpuio_alloc_gc() __devinit as omap_gpio_chip_init()
      is __devinit. Otherwise we get:
      
      WARNING: vmlinux.o(.devinit.text+0xa10): Section mismatch in reference
      from the function omap_gpio_chip_init() to the function .init.text:omap_mpuio_alloc_gc()
      The function __devinit omap_gpio_chip_init() references
      a function __init omap_mpuio_alloc_gc().
      If omap_mpuio_alloc_gc is only used by omap_gpio_chip_init then
      annotate omap_mpuio_alloc_gc with a matching annotation.
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Acked-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      8805f410
    • K
      gpio/omap: fix wakeups on level-triggered GPIOs · 68942edb
      Kevin Hilman 提交于
      While both level- and edge-triggered GPIOs are capable of generating
      interrupts, only edge-triggered GPIOs are capable of generating a
      module-level wakeup to the PRCM (c.f. 34xx NDA TRM section 25.5.3.2.)
      
      In order to ensure that devices using level-triggered GPIOs as
      interrupts can also cause wakeups (e.g. from idle), this patch enables
      edge-triggering for wakeup-enabled, level-triggered GPIOs when a GPIO
      bank is runtime-suspended (which also happens during idle.)
      
      This fixes a problem found in GPMC-connected network cards with GPIO
      interrupts (e.g. smsc911x on Zoom3, Overo, ...) where network booting
      with NFSroot was very slow since the GPIO IRQs used by the NIC were
      not generating PRCM wakeups, and thus not waking the system from idle.
      NOTE: until v3.3, this boot-time problem was somewhat masked because
      the UART init prevented WFI during boot until the full serial driver
      was available.  Preventing WFI allowed regular GPIO interrupts to fire
      and this problem was not seen.  After the UART runtime PM cleanups, we
      no longer avoid WFI during boot, so GPIO IRQs that were not causing
      wakeups resulted in very slow IRQ response times.
      
      Tested on platforms using level-triggered GPIOs for network IRQs using
      the SMSC911x NIC: 3530/Overo and 3630/Zoom3.
      Reported-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTarun Kanti DebBarma <tarun.kanti@ti.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      68942edb
  8. 06 3月, 2012 4 次提交
  9. 25 2月, 2012 1 次提交
  10. 06 2月, 2012 15 次提交