• Benjamin Gaignard's avatar
    irqchip/stm32: protect configuration registers with hwspinlock · fb94109b
    Benjamin Gaignard authored
    If a hwspinlock is defined in device tree use it to protect
    configuration registers.
    
    Do not request for hwspinlock during the exti driver init since the
    hwspinlock driver is not probed yet at that stage and the exti driver
    does not support deferred probe.
    Instead of this, postpone the hwspinlock request at the first time the
    hwspinlock is actually needed.
    
    Use the hwspin_trylock_raw() API which is the most appropriated here
    Indeed:
    - hwspin_lock_() calls are under spin_lock protection (chip_data->rlock
      or gc->lock).
    - the _timeout() API relies on jiffies count which won't work if IRQs
      are disabled which is the case here (a large part of the IRQ setup is
      done atomically (see irq/manage.c))
    As a consequence implement the retry/timeout lock from here. And since
    all of this is done atomically, reduce the timeout delay to 1 ms.
    Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@st.com>
    Signed-off-by: default avatarFabien Dessenne <fabien.dessenne@st.com>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    fb94109b
irq-stm32-exti.c 22.1 KB