Re: [PATCH 2/6] ARM: ep93xx: enable SPARSE_IRQ

From: Arnd Bergmann
Date: Sat Oct 19 2019 - 16:09:26 EST


On Sat, Oct 19, 2019 at 6:43 PM Alexander Sverdlin
<alexander.sverdlin@xxxxxxxxx> wrote:
> On Fri, 18 Oct 2019 18:29:15 +0200
> Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> > Without CONFIG_SPARSE_IRQ, we rely on mach/irqs.h to define NR_IRQS
> > globally. Do the minimal conversion by setting .nr_irqs in each
> > machine descriptor.
> >
> > Only the vision_ep9307 machine has extra IRQs for GPIOs, so make
> > .nr_irqs the original value there, while using the plain NR_EP93XX_IRQS
> > everywhere else.
>
> This patch causes multiple problems on EDB9302:
>
> 1. WARNINGs during gpiochip registration, for instance:
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at kernel/irq/chip.c:1013 __irq_do_set_handler+0x94/0x188
> CPU: 0 PID: 1 Comm: swapper Tainted: G W 5.4.0-rc3 #1
> Hardware name: Cirrus Logic EDB9302 Evaluation Board
> [<c000e878>] (unwind_backtrace) from [<c000d574>] (show_stack+0x10/0x18)
> [<c000d574>] (show_stack) from [<c0335e28>] (dump_stack+0x18/0x24)
> [<c0335e28>] (dump_stack) from [<c001cf1c>] (__warn+0xa4/0xc8)
> [<c001cf1c>] (__warn) from [<c001cfe8>] (warn_slowpath_fmt+0xa8/0xb8)
> [<c001cfe8>] (warn_slowpath_fmt) from [<c0055668>] (__irq_do_set_handler+0x94/0x188)
> [<c0055668>] (__irq_do_set_handler) from [<c005647c>] (irq_set_chained_handler_and_data+0x48/0x7c)
> [<c005647c>] (irq_set_chained_handler_and_data) from [<c01ab440>] (gpiochip_add_data_with_key+0x6d4/0xabc)
> [<c01ab440>] (gpiochip_add_data_with_key) from [<c01ab868>] (devm_gpiochip_add_data+0x40/0x88)
> [<c01ab868>] (devm_gpiochip_add_data) from [<c01ae554>] (ep93xx_gpio_probe+0x1ac/0x280)
> [<c01ae554>] (ep93xx_gpio_probe) from [<c01e0f34>] (platform_drv_probe+0x28/0x6c)
> [<c01e0f34>] (platform_drv_probe) from [<c01df588>] (really_probe+0x1c8/0x340)
> [<c01df588>] (really_probe) from [<c01ddfe4>] (bus_for_each_drv+0x58/0xc0)
> [<c01ddfe4>] (bus_for_each_drv) from [<c01df904>] (__device_attach+0xb4/0x104)
> [<c01df904>] (__device_attach) from [<c01de1d4>] (bus_probe_device+0x8c/0x94)
> [<c01de1d4>] (bus_probe_device) from [<c01db5e4>] (device_add+0x3d0/0x59c)
> [<c01db5e4>] (device_add) from [<c01e16d8>] (platform_device_add+0x100/0x20c)
> [<c01e16d8>] (platform_device_add) from [<c03f50b0>] (ep93xx_init_devices+0x16c/0x20c)
> [<c03f50b0>] (ep93xx_init_devices) from [<c03f53a0>] (edb93xx_init_machine+0xc/0x84)
> [<c03f53a0>] (edb93xx_init_machine) from [<c03f1984>] (customize_machine+0x20/0x38)
> [<c03f1984>] (customize_machine) from [<c03f0e54>] (do_one_initcall+0x78/0x1a0)
> [<c03f0e54>] (do_one_initcall) from [<c03f1080>] (kernel_init_freeable+0x104/0x1b8)
> [<c03f1080>] (kernel_init_freeable) from [<c034c358>] (kernel_init+0x8/0xf8)
> [<c034c358>] (kernel_init) from [<c00090d0>] (ret_from_fork+0x14/0x24)
> Exception stack(0xc4433fb0 to 0xc4433ff8)
> 3fa0: 00000000 00000000 00000000 00000000
> 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> ---[ end trace 8f9e35e2d6224882 ]---

My first guess would be that this is just the missing irq domain code:

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 38e096e6925f..7c195af6f75d 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -205,6 +205,7 @@ config GPIO_EP93XX
depends on ARCH_EP93XX
select GPIO_GENERIC
select GPIOLIB_IRQCHIP
+ select IRQ_DOMAIN_HIERARCHY

config GPIO_EXAR
tristate "Support for GPIO pins on XR17V352/354/358"

But most likely there are more changes required to the gpio code.

> 2. Broken sound (I2S), this looks like below in the log:
>
> ep93xx-i2s ep93xx-i2s: Missing dma channel for stream: 0
> CS4271: ASoC: pcm constructor failed: -22
> edb93xx-audio edb93xx-audio: ASoC: can't create pcm CS4271 HiFi :-22
>
> And /proc/interrupts has two entries less. Without patch:
>
> # cat /proc/interrupts
> CPU0
> 7: 0 VIC 7 Edge i2s-pcm-out
> 8: 0 VIC 8 Edge i2s-pcm-in
> 39: 2 VIC 7 Edge eth0
> 51: 7532 VIC 19 Edge ep93xx timer
> 52: 144 VIC 20 Edge uart-pl010
> 53: 4 VIC 21 Edge ep93xx-spi
> 60: 0 VIC 28 Edge ep93xx-i2s
> Err: 0
>
> With patch:
>
> # cat /proc/interrupts
> CPU0
> 39: 146 VIC 7 Edge eth0
> 51: 162161 VIC 19 Edge ep93xx timer
> 52: 139 VIC 20 Edge uart-pl010
> 53: 4 VIC 21 Edge ep93xx-spi
> 60: 0 VIC 28 Edge ep93xx-i2s
> Err: 0

I guess that is partial success: some irqs do work ;-)

The two interrupts that did not get registered are for the
dmaengine driver, and that makes sense given the error
message about the DMA not working. No idea how
that would be a result of the irq changes though.

> I will try to look into I2S problem...

Thanks!

Arnd