Commit e328b88094b712e4010a805499ceff774e2795b7

Authored by Alexander Shiyan
Committed by Olof Johansson
1 parent a180132f27

ARM: clps711x: Re-add GPIO support

arch_initcall was been removed from GPIO driver, so this patch
re-add support for GPIO into boards as platform_device.
Since some drivers (spi, nand, etc.) is not support deferred probe,
separate machine init calls is used in board code to make proper
loading sequence.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Olof Johansson <olof@lixom.net>

Showing 7 changed files with 78 additions and 8 deletions Side-by-side Diff

arch/arm/mach-clps711x/Makefile
... ... @@ -4,10 +4,7 @@
4 4  
5 5 # Object file lists.
6 6  
7   -obj-y := common.o
8   -obj-m :=
9   -obj-n :=
10   -obj- :=
  7 +obj-y := common.o devices.o
11 8  
12 9 obj-$(CONFIG_ARCH_AUTCPU12) += board-autcpu12.o
13 10 obj-$(CONFIG_ARCH_CDB89712) += board-cdb89712.o
arch/arm/mach-clps711x/board-autcpu12.c
... ... @@ -43,6 +43,7 @@
43 43 #include <mach/autcpu12.h>
44 44  
45 45 #include "common.h"
  46 +#include "devices.h"
46 47  
47 48 #define AUTCPU12_CS8900_BASE (CS2_PHYS_BASE + 0x300)
48 49 #define AUTCPU12_CS8900_IRQ (IRQ_EINT3)
... ... @@ -149,6 +150,7 @@
149 150  
150 151 static void __init autcpu12_init(void)
151 152 {
  153 + clps711x_devices_init();
152 154 platform_device_register_simple("video-clps711x", 0, NULL, 0);
153 155 platform_device_register_simple("cs89x0", 0, autcpu12_cs8900_resource,
154 156 ARRAY_SIZE(autcpu12_cs8900_resource));
arch/arm/mach-clps711x/board-cdb89712.c
... ... @@ -39,6 +39,7 @@
39 39 #include <asm/mach/map.h>
40 40  
41 41 #include "common.h"
  42 +#include "devices.h"
42 43  
43 44 #define CDB89712_CS8900_BASE (CS2_PHYS_BASE + 0x300)
44 45 #define CDB89712_CS8900_IRQ (IRQ_EINT3)
... ... @@ -127,6 +128,7 @@
127 128  
128 129 static void __init cdb89712_init(void)
129 130 {
  131 + clps711x_devices_init();
130 132 platform_device_register(&cdb89712_flash_pdev);
131 133 platform_device_register(&cdb89712_bootrom_pdev);
132 134 platform_device_register(&cdb89712_sram_pdev);
arch/arm/mach-clps711x/board-edb7211.c
... ... @@ -29,6 +29,7 @@
29 29 #include <mach/hardware.h>
30 30  
31 31 #include "common.h"
  32 +#include "devices.h"
32 33  
33 34 #define VIDEORAM_SIZE SZ_128K
34 35  
... ... @@ -151,6 +152,11 @@
151 152  
152 153 static void __init edb7211_init(void)
153 154 {
  155 + clps711x_devices_init();
  156 +}
  157 +
  158 +static void __init edb7211_init_late(void)
  159 +{
154 160 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
155 161  
156 162 platform_device_register(&edb7211_flash_pdev);
... ... @@ -175,6 +181,7 @@
175 181 .init_irq = clps711x_init_irq,
176 182 .init_time = clps711x_timer_init,
177 183 .init_machine = edb7211_init,
  184 + .init_late = edb7211_init_late,
178 185 .handle_irq = clps711x_handle_irq,
179 186 .restart = clps711x_restart,
180 187 MACHINE_END
arch/arm/mach-clps711x/board-p720t.c
... ... @@ -43,6 +43,7 @@
43 43 #include <video/platform_lcd.h>
44 44  
45 45 #include "common.h"
  46 +#include "devices.h"
46 47  
47 48 #define P720T_USERLED CLPS711X_GPIO(3, 0)
48 49 #define P720T_NAND_CLE CLPS711X_GPIO(4, 0)
... ... @@ -199,6 +200,11 @@
199 200  
200 201 static void __init p720t_init(void)
201 202 {
  203 + clps711x_devices_init();
  204 +}
  205 +
  206 +static void __init p720t_init_late(void)
  207 +{
202 208 platform_device_register(&p720t_nand_pdev);
203 209 platform_device_register_data(&platform_bus, "platform-lcd", 0,
204 210 &p720t_lcd_power_pdata,
... ... @@ -207,10 +213,6 @@
207 213 &p720t_lcd_backlight_pdata,
208 214 sizeof(p720t_lcd_backlight_pdata));
209 215 platform_device_register_simple("video-clps711x", 0, NULL, 0);
210   -}
211   -
212   -static void __init p720t_init_late(void)
213   -{
214 216 platform_device_register_data(&platform_bus, "leds-gpio", 0,
215 217 &p720t_gpio_led_pdata,
216 218 sizeof(p720t_gpio_led_pdata));
arch/arm/mach-clps711x/devices.c
  1 +/*
  2 + * CLPS711X common devices definitions
  3 + *
  4 + * Author: Alexander Shiyan <shc_work@mail.ru>, 2013
  5 + *
  6 + * This program is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; either version 2 of the License, or
  9 + * (at your option) any later version.
  10 + */
  11 +
  12 +#include <linux/platform_device.h>
  13 +
  14 +#include <mach/hardware.h>
  15 +
  16 +static const phys_addr_t clps711x_gpios[][2] __initconst = {
  17 + { PADR, PADDR },
  18 + { PBDR, PBDDR },
  19 + { PCDR, PCDDR },
  20 + { PDDR, PDDDR },
  21 + { PEDR, PEDDR },
  22 +};
  23 +
  24 +static void __init clps711x_add_gpio(void)
  25 +{
  26 + unsigned i;
  27 + struct resource gpio_res[2];
  28 +
  29 + memset(gpio_res, 0, sizeof(gpio_res));
  30 +
  31 + gpio_res[0].flags = IORESOURCE_MEM;
  32 + gpio_res[1].flags = IORESOURCE_MEM;
  33 +
  34 + for (i = 0; i < ARRAY_SIZE(clps711x_gpios); i++) {
  35 + gpio_res[0].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][0];
  36 + gpio_res[0].end = gpio_res[0].start;
  37 + gpio_res[1].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][1];
  38 + gpio_res[1].end = gpio_res[1].start;
  39 +
  40 + platform_device_register_simple("clps711x-gpio", i,
  41 + gpio_res, ARRAY_SIZE(gpio_res));
  42 + }
  43 +}
  44 +
  45 +void __init clps711x_devices_init(void)
  46 +{
  47 + clps711x_add_gpio();
  48 +}
arch/arm/mach-clps711x/devices.h
  1 +/*
  2 + * CLPS711X common devices definitions
  3 + *
  4 + * Copyright (C) 2013 Alexander Shiyan <shc_work@mail.ru>
  5 + *
  6 + * This program is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; either version 2 of the License, or
  9 + * (at your option) any later version.
  10 + */
  11 +
  12 +void clps711x_devices_init(void);