Skip to content

ARM: sa1100: Rework IRQ handling

Dmitry Eremin-Solenikov linux-arm-kernel linux-gpio 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 9 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 9 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] ARM: sa1100: Rework IRQ handling
Quoted 11 lines · Linus Walleij
Quoted 5 lines · Dmitry Eremin-Solenikov

This is a considerable rework of my previous attempt to update sa1100 irq handling. IRQ code is updated to support MULTI_IRQ_HANDLER and is mostly prepared to be converted to irqchip driver (if the need arises in future). I have integrated idea of Linus Waleij to use irq domains. GPIO irq handling is split to gpio driver, which also undergo an update/rewrite.

Overall this is looking very nice. However when I apply this on top of (a working and booting) mainline HEAD, I get this:

[skipped]

Quoted 10 lines

This is caused by the patch:
"ARM: sa1100: convert gpio driver to be a proper platform driver"

The reason: UARTs are initialized *very* early and the UART quirk used on the h3600 is using GPIOs through the .set_mctrl hooks back into arch/arm/mach-sa1100/h3xxx.c functions
h3xxx_uart_set_mctrl()
h3xxx_uart_get_mctrl()

And that happens before the GPIO driver gets registered -> crash.

That is not the issue. The real issue is h3xxx using those gpio's without previously calling gpio_request. Unfortunately sa1100 driver doesn't have a good place to request gpios. When faced this problem during locomo refactoring, I ended up with the following piece of code:

========== Cut here ============

static struct gpio collie_uart_gpio[] = {
         { COLLIE_GPIO_CTS, GPIOF_IN, "CTS" },
         { COLLIE_GPIO_RTS, GPIOF_OUT_INIT_LOW, "RTS" },
         { COLLIE_GPIO_DTR, GPIOF_OUT_INIT_LOW, "DTR" },
         { COLLIE_GPIO_DSR, GPIOF_IN, "DSR" },
};

static bool collie_uart_gpio_ok;

static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl)

{
         if (!collie_uart_gpio_ok) {
                 int rc = gpio_request_array(collie_uart_gpio,
                                 ARRAY_SIZE(collie_uart_gpio));
                 if (rc)
                         printk("collie_uart_set_mctrl: gpio request 
%d\n", rc);
                 else
                         collie_uart_gpio_ok = true;
         }

         if (collie_uart_gpio_ok) {
                 gpio_set_value(COLLIE_GPIO_RTS, !(mctrl & TIOCM_RTS));
                 gpio_set_value(COLLIE_GPIO_DTR, !(mctrl & TIOCM_DTR));
         }
}

=========== Cut here ===============

Same goes for get_mctr().

Russell, Linus, what do you think about the previous solution?

Another solution would be to make sa1100 distinguish between console output (where it doesn't have to control rts/dtr) and normal uart work (where 'modem' lines should be used).

I have the feeling that sa11x0-serial driver would need to be somewhat modified at least. I understand the conception behind unified "port_fns", but I think that those should be split to a per-port platform data.

Quoted 6 lines

This is why the device is registered from the machine in the first place I think.

I don't know what the proper solution is, but I think you can keep most of the platform device conversion if you also keep the special initialization call.

That would be possible solution if we can't come up with usefull way to handle h3xxx (and collie) gpios.

Signature · 2 lines
With best wishes
Dmitry