diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2016-09-11 10:48:33 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-10-04 16:13:57 +0200 |
commit | 5ac676ade1eac27fb311f0f2fb11eeac5089a66c (patch) | |
tree | edf1b400f6ed5fca1af2187dcdd8e69612a6ed8d | |
parent | 561eca4990557b684605090fe6a2f50cecec34e1 (diff) | |
download | op-kernel-dev-5ac676ade1eac27fb311f0f2fb11eeac5089a66c.zip op-kernel-dev-5ac676ade1eac27fb311f0f2fb11eeac5089a66c.tar.gz |
MIPS: TXx9: tx49xx: 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 (before commit 54d77198fdfbc4f0 ("gpio:
bail out silently on NULL descriptors") it printed the error message
"gpiod_direction_output_raw: invalid GPIO" on RBTX49[23]7).
Postpone all GPIO setup to .arch_init() time to fix this.
Suggested-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-mips@linux-mips.org
Cc: linux-gpio@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14237/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/txx9/generic/setup_tx4927.c | 1 | ||||
-rw-r--r-- | arch/mips/txx9/generic/setup_tx4938.c | 1 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4927/setup.c | 32 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4938/setup.c | 1 |
4 files changed, 23 insertions, 12 deletions
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c index a4664cb..8d80115 100644 --- a/arch/mips/txx9/generic/setup_tx4927.c +++ b/arch/mips/txx9/generic/setup_tx4927.c @@ -215,7 +215,6 @@ void __init tx4927_setup(void) txx9_tmr_init(TX4927_TMR_REG(i) & 0xfffffffffULL); /* PIO */ - txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO); __raw_writel(0, &tx4927_pioptr->maskcpu); __raw_writel(0, &tx4927_pioptr->maskext); diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c index 58cdb2a..ba265bf 100644 --- a/arch/mips/txx9/generic/setup_tx4938.c +++ b/arch/mips/txx9/generic/setup_tx4938.c @@ -241,7 +241,6 @@ void __init tx4938_setup(void) txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL); /* PIO */ - txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO); __raw_writel(0, &tx4938_pioptr->maskcpu); __raw_writel(0, &tx4938_pioptr->maskext); diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c index 3c516ef..f5b367e 100644 --- a/arch/mips/txx9/rbtx4927/setup.c +++ b/arch/mips/txx9/rbtx4927/setup.c @@ -52,6 +52,7 @@ #include <linux/leds.h> #include <asm/io.h> #include <asm/reboot.h> +#include <asm/txx9pio.h> #include <asm/txx9/generic.h> #include <asm/txx9/pci.h> #include <asm/txx9/rbtx4927.h> @@ -151,20 +152,37 @@ static void __init tx4937_pci_setup(void) } tx4938_setup_pcierr_irq(); } +#else +static inline void tx4927_pci_setup(void) {} +static inline void tx4937_pci_setup(void) {} +#endif /* CONFIG_PCI */ + +static void __init rbtx4927_gpio_init(void) +{ + /* TX4927-SIO DTR on (PIO[15]) */ + gpio_request(15, "sio-dtr"); + gpio_direction_output(15, 1); + + tx4927_sio_init(0, 0); +} static void __init rbtx4927_arch_init(void) { + txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO); + + rbtx4927_gpio_init(); + tx4927_pci_setup(); } static void __init rbtx4937_arch_init(void) { + txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO); + + rbtx4927_gpio_init(); + tx4937_pci_setup(); } -#else -#define rbtx4927_arch_init NULL -#define rbtx4937_arch_init NULL -#endif /* CONFIG_PCI */ static void toshiba_rbtx4927_restart(char *command) { @@ -205,12 +223,6 @@ static void __init rbtx4927_mem_setup(void) #else set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET); #endif - - /* TX4927-SIO DTR on (PIO[15]) */ - gpio_request(15, "sio-dtr"); - gpio_direction_output(15, 1); - - tx4927_sio_init(0, 0); } static void __init rbtx4927_clock_init(void) diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c index 54de668..07939ed 100644 --- a/arch/mips/txx9/rbtx4938/setup.c +++ b/arch/mips/txx9/rbtx4938/setup.c @@ -336,6 +336,7 @@ static void __init rbtx4938_mtd_init(void) static void __init rbtx4938_arch_init(void) { + txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO); gpiochip_add_data(&rbtx4938_spi_gpio_chip, NULL); rbtx4938_pci_setup(); rbtx4938_spi_init(); |