1. 03 10月, 2015 1 次提交
    • G
      gpio: omap: convert to use generic irq handler · 450fa54c
      Grygorii Strashko 提交于
      This patch converts TI OMAP GPIO driver to use generic irq handler
      instead of chained IRQ handler. This way OMAP GPIO driver will be
      compatible with RT kernel where it will be forced thread IRQ handler
      while in non-RT kernel it still will be executed in HW IRQ context.
      As part of this change the IRQ wakeup configuration is applied to
      GPIO Bank IRQ as it now will be under control of IRQ PM Core during
      suspend.
      
      There are also additional benefits:
       - on-RT kernel there will be no complains any more about PM runtime usage
         in atomic context  "BUG: sleeping function called from invalid context";
       - GPIO bank IRQs will appear in /proc/interrupts and its usage statistic
          will be  visible;
       - GPIO bank IRQs could be configured through IRQ proc_fs interface and,
         as result, could be a part of IRQ balancing process if needed;
       - GPIO bank IRQs will be under control of IRQ PM Core during
         suspend to RAM.
      
      Disadvantage:
       - additional runtime overhed as call chain till
         omap_gpio_irq_handler() will be longer now
       - necessity to use wa_lock in omap_gpio_irq_handler() to W/A warning
         in handle_irq_event_percpu()
         WARNING: CPU: 1 PID: 35 at kernel/irq/handle.c:149 handle_irq_event_percpu+0x51c/0x638()
      
      This patch doesn't fully follows recommendations provided by Sebastian
      Andrzej Siewior [1], because It's required to go through and check all
      GPIO IRQ pin states as fast as possible and pass control to handle_level_irq
      or handle_edge_irq. handle_level_irq or handle_edge_irq will perform actions
      specific for IRQ triggering type and wakeup corresponding registered
      threaded IRQ handler (at least it's expected to be threaded).
      IRQs can be lost if handle_nested_irq() will be used, because excecution
      time of some pin specific GPIO IRQ handler can be very significant and
      require accessing ext. devices (I2C).
      
      Idea of such kind reworking was also discussed in [2].
      
      [1] http://www.spinics.net/lists/linux-omap/msg120665.html
      [2] http://www.spinics.net/lists/linux-omap/msg119516.htmlTested-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NAustin Schuh <austin@peloton-tech.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Acked-by: NSantosh Shilimkar <ssantosh@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      450fa54c
  2. 02 10月, 2015 1 次提交
    • G
      gpio: omap: move pm runtime in irq_chip.irq_bus_lock/sync_unlock · aca82d1c
      Grygorii Strashko 提交于
      The PM runtime API can't be used in atomic contex on -RT even if
      it's configured as irqsafe. As result, below error report can
      be seen when PM runtime API called from IRQ chip's callbacks
      irq_startup/irq_shutdown/irq_set_type, because they are
      protected by RAW spinlock:
      
      BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:917
      in_atomic(): 1, irqs_disabled(): 128, pid: 96, name: insmod
      3 locks held by insmod/96:
       #0:  (&dev->mutex){......}, at: [<c04752c8>] __driver_attach+0x54/0xa0
       #1:  (&dev->mutex){......}, at: [<c04752d4>] __driver_attach+0x60/0xa0
       #2:  (class){......}, at: [<c00a408c>] __irq_get_desc_lock+0x60/0xa4
      irq event stamp: 1834
      hardirqs last  enabled at (1833): [<c06ab2a4>] _raw_spin_unlock_irqrestore+0x88/0x90
      hardirqs last disabled at (1834): [<c06ab068>] _raw_spin_lock_irqsave+0x2c/0x64
      softirqs last  enabled at (0): [<c003d220>] copy_process.part.52+0x410/0x19d8
      softirqs last disabled at (0): [<  (null)>]   (null)
      Preemption disabled at:[<  (null)>]   (null)
      
      CPU: 1 PID: 96 Comm: insmod Tainted: G        W  O    4.1.3-rt3-00618-g57e2387-dirty #184
      Hardware name: Generic DRA74X (Flattened Device Tree)
      [<c00190f4>] (unwind_backtrace) from [<c0014734>] (show_stack+0x20/0x24)
      [<c0014734>] (show_stack) from [<c06a62ec>] (dump_stack+0x88/0xdc)
      [<c06a62ec>] (dump_stack) from [<c006ca44>] (___might_sleep+0x198/0x2a8)
      [<c006ca44>] (___might_sleep) from [<c06ab6d4>] (rt_spin_lock+0x30/0x70)
      [<c06ab6d4>] (rt_spin_lock) from [<c04815ac>] (__pm_runtime_resume+0x68/0xa4)
      [<c04815ac>] (__pm_runtime_resume) from [<c04123f4>] (omap_gpio_irq_type+0x188/0x1d8)
      [<c04123f4>] (omap_gpio_irq_type) from [<c00a64e4>] (__irq_set_trigger+0x68/0x130)
      [<c00a64e4>] (__irq_set_trigger) from [<c00a7bc4>] (irq_set_irq_type+0x44/0x6c)
      [<c00a7bc4>] (irq_set_irq_type) from [<c00abbf8>] (irq_create_of_mapping+0x120/0x174)
      [<c00abbf8>] (irq_create_of_mapping) from [<c0577b74>] (of_irq_get+0x48/0x58)
      [<c0577b74>] (of_irq_get) from [<c0540a14>] (i2c_device_probe+0x54/0x15c)
      [<c0540a14>] (i2c_device_probe) from [<c04750dc>] (driver_probe_device+0x184/0x2c8)
      [<c04750dc>] (driver_probe_device) from [<c0475310>] (__driver_attach+0x9c/0xa0)
      [<c0475310>] (__driver_attach) from [<c0473238>] (bus_for_each_dev+0x7c/0xb0)
      [<c0473238>] (bus_for_each_dev) from [<c0474af4>] (driver_attach+0x28/0x30)
      [<c0474af4>] (driver_attach) from [<c0474760>] (bus_add_driver+0x154/0x200)
      [<c0474760>] (bus_add_driver) from [<c0476348>] (driver_register+0x88/0x108)
      [<c0476348>] (driver_register) from [<c0541600>] (i2c_register_driver+0x3c/0x90)
      [<c0541600>] (i2c_register_driver) from [<bf003018>] (pcf857x_init+0x18/0x24 [gpio_pcf857x])
      [<bf003018>] (pcf857x_init [gpio_pcf857x]) from [<c000998c>] (do_one_initcall+0x128/0x1e8)
      [<c000998c>] (do_one_initcall) from [<c06a4220>] (do_init_module+0x6c/0x1bc)
      [<c06a4220>] (do_init_module) from [<c00dd0c8>] (load_module+0x18e8/0x21c4)
      [<c00dd0c8>] (load_module) from [<c00ddaa0>] (SyS_init_module+0xfc/0x158)
      [<c00ddaa0>] (SyS_init_module) from [<c000ff40>] (ret_fast_syscall+0x0/0x54)
      
      The IRQ chip interface defines only two callbacks which are executed in
      non-atomic contex - irq_bus_lock/irq_bus_sync_unlock, so lets move
      PM runtime calls there.
      Tested-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NAustin Schuh <austin@peloton-tech.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Acked-by: NSantosh Shilimkar <ssantosh@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      aca82d1c
  3. 16 9月, 2015 1 次提交
    • T
      genirq: Remove irq argument from irq flow handlers · bd0b9ac4
      Thomas Gleixner 提交于
      Most interrupt flow handlers do not use the irq argument. Those few
      which use it can retrieve the irq number from the irq descriptor.
      
      Remove the argument.
      
      Search and replace was done with coccinelle and some extra helper
      scripts around it. Thanks to Julia for her help!
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Julia Lawall <Julia.Lawall@lip6.fr>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      bd0b9ac4
  4. 14 9月, 2015 2 次提交
  5. 26 8月, 2015 5 次提交
  6. 13 8月, 2015 1 次提交
    • A
      gpio: omap: Fix missing raw locks conversion · 627c89b4
      Axel Lin 提交于
      Fix below build warning:
        CC      drivers/gpio/gpio-omap.o
      drivers/gpio/gpio-omap.c: In function 'omap_gpio_irq_type':
      drivers/gpio/gpio-omap.c:504:3: warning: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [enabled by default]
      include/linux/spinlock.h:360:29: note: expected 'struct spinlock_t *' but argument is of type 'struct raw_spinlock_t *'
      
      Fixes: commit 4dbada2b ("gpio: omap: use raw locks for locking")
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      627c89b4
  7. 27 7月, 2015 1 次提交
    • S
      gpio: omap: use raw locks for locking · 4dbada2b
      Sebastian Andrzej Siewior 提交于
      This patch converts gpio_bank.lock from a spin_lock into a
      raw_spin_lock. The call path is to access this lock is always under a
      raw_spin_lock, for instance
      - __setup_irq() holds &desc->lock with irq off
        + __irq_set_trigger()
         + omap_gpio_irq_type()
      
      - handle_level_irq() (runs with irqs off therefore raw locks)
        + mask_ack_irq()
         + omap_gpio_mask_irq()
      
      This fixes the obvious backtrace on -RT. However the locking vs context
      is not and this is not limited to -RT:
      - omap_gpio_irq_type() is called with IRQ off and has an conditional
        call to pm_runtime_get_sync() which may sleep. Either it may happen or
        it may not happen but pm_runtime_get_sync() should not be called with
        irqs off.
      
      - omap_gpio_debounce() is holding the lock with IRQs off.
        + omap2_set_gpio_debounce()
         + clk_prepare_enable()
          + clk_prepare() this one might sleep.
        The number of users of gpiod_set_debounce() / gpio_set_debounce()
        looks low but still this is not good.
      Acked-by: NJavier Martinez Canillas <javier@dowhile0.org>
      Acked-by: NSantosh Shilimkar <ssantosh@kernel.org>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      4dbada2b
  8. 16 7月, 2015 2 次提交
  9. 14 7月, 2015 2 次提交
  10. 01 6月, 2015 5 次提交
  11. 06 5月, 2015 2 次提交
  12. 27 3月, 2015 8 次提交
  13. 10 3月, 2015 1 次提交
  14. 26 1月, 2015 1 次提交
    • T
      gpio: omap: Fix bad device access with setup_irq() · 3d009c8c
      Tony Lindgren 提交于
      Similar to omap_gpio_irq_type() let's make sure that the GPIO
      is usable as an interrupt if the platform init code did not
      call gpio_request(). Otherwise we can get invalid device access
      after setup_irq():
      
      WARNING: CPU: 0 PID: 1 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x214/0x340()
      44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4CFG (Idle): Data Access in Supervisor mode during Functional access
      ...
      [<c05f21e4>] (__irq_svc) from [<c05f1974>] (_raw_spin_unlock_irqrestore+0x34/0x44)
      [<c05f1974>] (_raw_spin_unlock_irqrestore) from [<c00914a8>] (__setup_irq+0x244/0x530)
      [<c00914a8>] (__setup_irq) from [<c00917d4>] (setup_irq+0x40/0x8c)
      [<c00917d4>] (setup_irq) from [<c0039c8c>] (omap_system_dma_probe+0x1d4/0x2b4)
      [<c0039c8c>] (omap_system_dma_probe) from [<c03b2200>] (platform_drv_probe+0x44/0xa4)
      ...
      
      We can fix this the same way omap_gpio_irq_type() is handling it.
      
      Note that the long term solution is to change the gpio-omap driver
      to handle the banks as separate driver instances. This will allow
      us to rely on just runtime PM for tracking the bank specific state.
      Reported-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Cc: Javier Martinez Canillas <javier@dowhile0.org>
      Cc: Kevin Hilman <khilman@kernel.org>
      Cc: Santosh Shilimkar <ssantosh@kernel.org>
      Tested-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      3d009c8c
  15. 04 12月, 2014 1 次提交
  16. 29 10月, 2014 1 次提交
  17. 23 9月, 2014 2 次提交
  18. 09 7月, 2014 3 次提交