Commit 2ec459f2 authored by Nicolas Schichan's avatar Nicolas Schichan Committed by Ralf Baechle

MIPS: BCM63xx: Move bcm63xx_gpio_init() to bcm63xx_register_devices().

When called from prom init code, bcm63xx_gpio_init() will fail as it
will call gpiochip_add() which relies on a working kmalloc() to alloc
the gpio_desc array and kmalloc is not useable yet at prom init time.

Move bcm63xx_gpio_init() to bcm63xx_register_devices() (an
arch_initcall) where kmalloc works.

Fixes: 14e85c0e ("gpio: remove gpio_descs global array")
Signed-off-by: default avatarNicolas Schichan <nschichan@freebox.fr>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: Alexandre Courbot <acourbot@nvidia.com>
Patchwork: https://patchwork.linux-mips.org/patch/9530/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent c5b36783
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <bcm63xx_cpu.h> #include <bcm63xx_cpu.h>
#include <bcm63xx_io.h> #include <bcm63xx_io.h>
#include <bcm63xx_regs.h> #include <bcm63xx_regs.h>
#include <bcm63xx_gpio.h>
void __init prom_init(void) void __init prom_init(void)
{ {
...@@ -53,9 +52,6 @@ void __init prom_init(void) ...@@ -53,9 +52,6 @@ void __init prom_init(void)
reg &= ~mask; reg &= ~mask;
bcm_perf_writel(reg, PERF_CKCTL_REG); bcm_perf_writel(reg, PERF_CKCTL_REG);
/* register gpiochip */
bcm63xx_gpio_init();
/* do low level board init */ /* do low level board init */
board_prom_init(); board_prom_init();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <bcm63xx_cpu.h> #include <bcm63xx_cpu.h>
#include <bcm63xx_regs.h> #include <bcm63xx_regs.h>
#include <bcm63xx_io.h> #include <bcm63xx_io.h>
#include <bcm63xx_gpio.h>
void bcm63xx_machine_halt(void) void bcm63xx_machine_halt(void)
{ {
...@@ -160,6 +161,9 @@ void __init plat_mem_setup(void) ...@@ -160,6 +161,9 @@ void __init plat_mem_setup(void)
int __init bcm63xx_register_devices(void) int __init bcm63xx_register_devices(void)
{ {
/* register gpiochip */
bcm63xx_gpio_init();
return board_register_devices(); return board_register_devices();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment