Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 561eca49 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Ralf Baechle
Browse files

MIPS: TXx9: tx39xx: Move GPIO setup from .mem_setup() to .arch_init()



txx9_gpio_init() calls gpiochip_add_data(), which fails with -ENOMEM as
it is called too early in the boot process. This causes all subsequent
GPIO operations to fail silently.

Postpone all GPIO setup to .arch_init() time to fix this.

Suggested-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Cc: linux-mips@linux-mips.org
Cc: linux-gpio@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/13967/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent db19462b
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -92,7 +92,6 @@ void __init tx3927_setup(void)
	/* PIO */
	/* PIO */
	__raw_writel(0, &tx3927_pioptr->maskcpu);
	__raw_writel(0, &tx3927_pioptr->maskcpu);
	__raw_writel(0, &tx3927_pioptr->maskext);
	__raw_writel(0, &tx3927_pioptr->maskext);
	txx9_gpio_init(TX3927_PIO_REG, 0, 16);


	conf = read_c0_conf();
	conf = read_c0_conf();
	if (conf & TX39_CONF_DCE) {
	if (conf & TX39_CONF_DCE) {
+9 −2
Original line number Original line Diff line number Diff line
@@ -142,8 +142,6 @@ static void __init jmr3927_board_init(void)


	/* PIO[15:12] connected to LEDs */
	/* PIO[15:12] connected to LEDs */
	__raw_writel(0x0000f000, &tx3927_pioptr->dir);
	__raw_writel(0x0000f000, &tx3927_pioptr->dir);
	gpio_request(11, "dipsw1");
	gpio_request(10, "dipsw2");


	jmr3927_pci_setup();
	jmr3927_pci_setup();


@@ -204,6 +202,14 @@ static void __init jmr3927_device_init(void)
	txx9_iocled_init(iocled_base, -1, 8, 1, "green", NULL);
	txx9_iocled_init(iocled_base, -1, 8, 1, "green", NULL);
}
}


static void __init jmr3927_arch_init(void)
{
	txx9_gpio_init(TX3927_PIO_REG, 0, 16);

	gpio_request(11, "dipsw1");
	gpio_request(10, "dipsw2");
}

struct txx9_board_vec jmr3927_vec __initdata = {
struct txx9_board_vec jmr3927_vec __initdata = {
	.system = "Toshiba JMR_TX3927",
	.system = "Toshiba JMR_TX3927",
	.prom_init = jmr3927_prom_init,
	.prom_init = jmr3927_prom_init,
@@ -211,6 +217,7 @@ struct txx9_board_vec jmr3927_vec __initdata = {
	.irq_setup = jmr3927_irq_setup,
	.irq_setup = jmr3927_irq_setup,
	.time_init = jmr3927_time_init,
	.time_init = jmr3927_time_init,
	.device_init = jmr3927_device_init,
	.device_init = jmr3927_device_init,
	.arch_init = jmr3927_arch_init,
#ifdef CONFIG_PCI
#ifdef CONFIG_PCI
	.pci_map_irq = jmr3927_pci_map_irq,
	.pci_map_irq = jmr3927_pci_map_irq,
#endif
#endif