aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-nomadik
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-01-05 20:25:20 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-01-28 17:25:37 -0500
commit5f66d482af4e12e2a2d4cda0686820550b80ac8e (patch)
tree470a6f640ebce8a7e59923ba860b2a8549c7170f /arch/arm/mach-nomadik
parent09e02f4d1d3ba6e5ccfada24162817d00e4675bc (diff)
ARM: nomadik: delete old board files
The Device Tree support on Nomadik can do everything the old board files could do, so delete the old board files and make the nomadik select CONFIG_OF. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-nomadik')
-rw-r--r--arch/arm/mach-nomadik/Kconfig10
-rw-r--r--arch/arm/mach-nomadik/Makefile6
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c322
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c112
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.h5
-rw-r--r--arch/arm/mach-nomadik/i2c-8815nhk.c82
6 files changed, 4 insertions, 533 deletions
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 706dc5727bbe..82226a5d60ef 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -4,19 +4,13 @@ menu "Nomadik boards"
4 4
5config MACH_NOMADIK_8815NHK 5config MACH_NOMADIK_8815NHK
6 bool "ST 8815 Nomadik Hardware Kit (evaluation board)" 6 bool "ST 8815 Nomadik Hardware Kit (evaluation board)"
7 select CLKSRC_NOMADIK_MTU
8 select NOMADIK_8815 7 select NOMADIK_8815
8 select I2C
9 select I2C_ALGOBIT
9 10
10endmenu 11endmenu
11 12
12config NOMADIK_8815 13config NOMADIK_8815
13 bool 14 bool
14 15
15config I2C_BITBANG_8815NHK
16 tristate "Driver for bit-bang busses found on the 8815 NHK"
17 depends on I2C && MACH_NOMADIK_8815NHK
18 depends on PINCTRL_NOMADIK
19 default y
20 select I2C_ALGOBIT
21
22endif 16endif
diff --git a/arch/arm/mach-nomadik/Makefile b/arch/arm/mach-nomadik/Makefile
index a42c9a33d3bf..1071c3b04d1a 100644
--- a/arch/arm/mach-nomadik/Makefile
+++ b/arch/arm/mach-nomadik/Makefile
@@ -9,9 +9,3 @@
9 9
10# Cpu revision 10# Cpu revision
11obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o 11obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o
12
13# Specific board support
14obj-$(CONFIG_MACH_NOMADIK_8815NHK) += board-nhk8815.o
15
16# Nomadik extra devices
17obj-$(CONFIG_I2C_BITBANG_8815NHK) += i2c-8815nhk.o
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
deleted file mode 100644
index e7b216cb6802..000000000000
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ /dev/null
@@ -1,322 +0,0 @@
1/*
2 * linux/arch/arm/mach-nomadik/board-8815nhk.c
3 *
4 * Copyright (C) STMicroelectronics
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 version 2, as
8 * published by the Free Software Foundation.
9 *
10 * NHK15 board specifc driver definition
11 */
12#include <linux/types.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/amba/bus.h>
17#include <linux/amba/mmci.h>
18#include <linux/interrupt.h>
19#include <linux/gpio.h>
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/nand.h>
22#include <linux/mtd/fsmc.h>
23#include <linux/mtd/onenand.h>
24#include <linux/mtd/partitions.h>
25#include <linux/i2c.h>
26#include <linux/io.h>
27#include <linux/platform_data/clocksource-nomadik-mtu.h>
28#include <asm/sizes.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/flash.h>
32#include <asm/mach/time.h>
33#include <mach/irqs.h>
34
35#include "cpu-8815.h"
36
37/* Initial value for SRC control register: all timers use MXTAL/8 source */
38#define SRC_CR_INIT_MASK 0x00007fff
39#define SRC_CR_INIT_VAL 0x2aaa8000
40
41#define ALE_OFF 0x1000000
42#define CLE_OFF 0x800000
43
44/* These addresses span 16MB, so use three individual pages */
45static struct resource nhk8815_nand_resources[] = {
46 {
47 .name = "nand_data",
48 .start = 0x40000000,
49 .end = 0x40000000 + SZ_16K - 1,
50 .flags = IORESOURCE_MEM,
51 }, {
52 .name = "nand_addr",
53 .start = 0x40000000 + ALE_OFF,
54 .end = 0x40000000 +ALE_OFF + SZ_16K - 1,
55 .flags = IORESOURCE_MEM,
56 }, {
57 .name = "nand_cmd",
58 .start = 0x40000000 + CLE_OFF,
59 .end = 0x40000000 + CLE_OFF + SZ_16K - 1,
60 .flags = IORESOURCE_MEM,
61 }, {
62 .name = "fsmc_regs",
63 .start = NOMADIK_FSMC_BASE,
64 .end = NOMADIK_FSMC_BASE + SZ_4K - 1,
65 .flags = IORESOURCE_MEM,
66 },
67};
68
69/*
70 * These partitions are the same as those used in the 2.6.20 release
71 * shipped by the vendor; the first two partitions are mandated
72 * by the boot ROM, and the bootloader area is somehow oversized...
73 */
74static struct mtd_partition nhk8815_partitions[] = {
75 {
76 .name = "X-Loader(NAND)",
77 .offset = 0,
78 .size = SZ_256K,
79 }, {
80 .name = "MemInit(NAND)",
81 .offset = MTDPART_OFS_APPEND,
82 .size = SZ_256K,
83 }, {
84 .name = "BootLoader(NAND)",
85 .offset = MTDPART_OFS_APPEND,
86 .size = SZ_2M,
87 }, {
88 .name = "Kernel zImage(NAND)",
89 .offset = MTDPART_OFS_APPEND,
90 .size = 3 * SZ_1M,
91 }, {
92 .name = "Root Filesystem(NAND)",
93 .offset = MTDPART_OFS_APPEND,
94 .size = 22 * SZ_1M,
95 }, {
96 .name = "User Filesystem(NAND)",
97 .offset = MTDPART_OFS_APPEND,
98 .size = MTDPART_SIZ_FULL,
99 }
100};
101
102static struct fsmc_nand_timings nhk8815_nand_timings = {
103 .thiz = 0,
104 .thold = 0x10,
105 .twait = 0x0A,
106 .tset = 0,
107};
108
109static struct fsmc_nand_platform_data nhk8815_nand_platform_data = {
110 .nand_timings = &nhk8815_nand_timings,
111 .partitions = nhk8815_partitions,
112 .nr_partitions = ARRAY_SIZE(nhk8815_partitions),
113 .width = FSMC_NAND_BW8,
114};
115
116static struct platform_device nhk8815_nand_device = {
117 .name = "fsmc-nand",
118 .id = -1,
119 .resource = nhk8815_nand_resources,
120 .num_resources = ARRAY_SIZE(nhk8815_nand_resources),
121 .dev = {
122 .platform_data = &nhk8815_nand_platform_data,
123 },
124};
125
126/* These are the partitions for the OneNand device, different from above */
127static struct mtd_partition nhk8815_onenand_partitions[] = {
128 {
129 .name = "X-Loader(OneNAND)",
130 .offset = 0,
131 .size = SZ_256K,
132 }, {
133 .name = "MemInit(OneNAND)",
134 .offset = MTDPART_OFS_APPEND,
135 .size = SZ_256K,
136 }, {
137 .name = "BootLoader(OneNAND)",
138 .offset = MTDPART_OFS_APPEND,
139 .size = SZ_2M-SZ_256K,
140 }, {
141 .name = "SysImage(OneNAND)",
142 .offset = MTDPART_OFS_APPEND,
143 .size = 4 * SZ_1M,
144 }, {
145 .name = "Root Filesystem(OneNAND)",
146 .offset = MTDPART_OFS_APPEND,
147 .size = 22 * SZ_1M,
148 }, {
149 .name = "User Filesystem(OneNAND)",
150 .offset = MTDPART_OFS_APPEND,
151 .size = MTDPART_SIZ_FULL,
152 }
153};
154
155static struct onenand_platform_data nhk8815_onenand_data = {
156 .parts = nhk8815_onenand_partitions,
157 .nr_parts = ARRAY_SIZE(nhk8815_onenand_partitions),
158};
159
160static struct resource nhk8815_onenand_resource[] = {
161 {
162 .start = 0x30000000,
163 .end = 0x30000000 + SZ_128K - 1,
164 .flags = IORESOURCE_MEM,
165 },
166};
167
168static struct platform_device nhk8815_onenand_device = {
169 .name = "onenand-flash",
170 .id = -1,
171 .dev = {
172 .platform_data = &nhk8815_onenand_data,
173 },
174 .resource = nhk8815_onenand_resource,
175 .num_resources = ARRAY_SIZE(nhk8815_onenand_resource),
176};
177
178/* bus control reg. and bus timing reg. for CS0..CS3 */
179#define FSMC_BCR(x) (NOMADIK_FSMC_VA + (x << 3))
180#define FSMC_BTR(x) (NOMADIK_FSMC_VA + (x << 3) + 0x04)
181
182static void __init nhk8815_onenand_init(void)
183{
184#ifdef CONFIG_MTD_ONENAND
185 /* Set up SMCS0 for OneNand */
186 writel(0x000030db, FSMC_BCR(0));
187 writel(0x02100551, FSMC_BTR(0));
188#endif
189}
190
191static struct mmci_platform_data mmcsd_plat_data = {
192 .ocr_mask = MMC_VDD_29_30,
193 .f_max = 48000000,
194 .gpio_wp = -1,
195 .gpio_cd = 111,
196 .cd_invert = true,
197 .capabilities = MMC_CAP_MMC_HIGHSPEED |
198 MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA,
199};
200
201static int __init nhk8815_mmcsd_init(void)
202{
203 int ret;
204
205 /* For e.g. devicetree boot */
206 if (!machine_is_nomadik())
207 return 0;
208
209 ret = gpio_request(112, "card detect bias");
210 if (ret)
211 return ret;
212 gpio_direction_output(112, 0);
213 amba_apb_device_add(NULL, "mmci", NOMADIK_SDI_BASE, SZ_4K, IRQ_SDMMC, 0, &mmcsd_plat_data, 0x10180180);
214 return 0;
215}
216module_init(nhk8815_mmcsd_init);
217
218static struct resource nhk8815_eth_resources[] = {
219 {
220 .name = "smc91x-regs",
221 .start = 0x34000000 + 0x300,
222 .end = 0x34000000 + SZ_64K - 1,
223 .flags = IORESOURCE_MEM,
224 }, {
225 .start = NOMADIK_GPIO_TO_IRQ(115),
226 .end = NOMADIK_GPIO_TO_IRQ(115),
227 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
228 }
229};
230
231static struct platform_device nhk8815_eth_device = {
232 .name = "smc91x",
233 .resource = nhk8815_eth_resources,
234 .num_resources = ARRAY_SIZE(nhk8815_eth_resources),
235};
236
237static int __init nhk8815_eth_init(void)
238{
239 int gpio_nr = 115; /* hardwired in the board */
240 int err;
241
242 if (!machine_is_nomadik())
243 return 0;
244 err = gpio_request(gpio_nr, "eth_irq");
245 if (!err) err = gpio_direction_input(gpio_nr);
246 if (err)
247 pr_err("Error %i in %s\n", err, __func__);
248 return err;
249}
250device_initcall(nhk8815_eth_init);
251
252static struct platform_device *nhk8815_platform_devices[] __initdata = {
253 &nhk8815_nand_device,
254 &nhk8815_onenand_device,
255 &nhk8815_eth_device,
256 /* will add more devices */
257};
258
259static void __init nomadik_timer_init(void)
260{
261 u32 src_cr;
262
263 /* Configure timer sources in "system reset controller" ctrl reg */
264 src_cr = readl(io_p2v(NOMADIK_SRC_BASE));
265 src_cr &= SRC_CR_INIT_MASK;
266 src_cr |= SRC_CR_INIT_VAL;
267 writel(src_cr, io_p2v(NOMADIK_SRC_BASE));
268
269 nmdk_timer_init(io_p2v(NOMADIK_MTU0_BASE), IRQ_MTU0);
270}
271
272static struct i2c_board_info __initdata nhk8815_i2c0_devices[] = {
273 {
274 I2C_BOARD_INFO("stw4811", 0x2d),
275 },
276};
277
278static struct i2c_board_info __initdata nhk8815_i2c1_devices[] = {
279 {
280 I2C_BOARD_INFO("camera", 0x10),
281 },
282 {
283 I2C_BOARD_INFO("stw5095", 0x1a),
284 },
285 {
286 I2C_BOARD_INFO("lis3lv02dl", 0x1d),
287 },
288};
289
290static struct i2c_board_info __initdata nhk8815_i2c2_devices[] = {
291 {
292 I2C_BOARD_INFO("stw4811-usb", 0x2d),
293 },
294};
295
296static void __init nhk8815_platform_init(void)
297{
298 cpu8815_platform_init();
299 nhk8815_onenand_init();
300 platform_add_devices(nhk8815_platform_devices,
301 ARRAY_SIZE(nhk8815_platform_devices));
302
303 amba_apb_device_add(NULL, "uart0", NOMADIK_UART0_BASE, SZ_4K, IRQ_UART0, 0, NULL, 0);
304 amba_apb_device_add(NULL, "uart1", NOMADIK_UART1_BASE, SZ_4K, IRQ_UART1, 0, NULL, 0);
305
306 i2c_register_board_info(0, nhk8815_i2c0_devices,
307 ARRAY_SIZE(nhk8815_i2c0_devices));
308 i2c_register_board_info(1, nhk8815_i2c1_devices,
309 ARRAY_SIZE(nhk8815_i2c1_devices));
310 i2c_register_board_info(2, nhk8815_i2c2_devices,
311 ARRAY_SIZE(nhk8815_i2c2_devices));
312}
313
314MACHINE_START(NOMADIK, "NHK8815")
315 /* Maintainer: ST MicroElectronics */
316 .atag_offset = 0x100,
317 .map_io = cpu8815_map_io,
318 .init_irq = cpu8815_init_irq,
319 .init_time = nomadik_timer_init,
320 .init_machine = nhk8815_platform_init,
321 .restart = cpu8815_restart,
322MACHINE_END
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 5ad301e4eb2f..60a18e12e6ce 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -48,53 +48,6 @@
48#include <asm/cacheflush.h> 48#include <asm/cacheflush.h>
49#include <asm/hardware/cache-l2x0.h> 49#include <asm/hardware/cache-l2x0.h>
50 50
51#include "cpu-8815.h"
52
53/* The 8815 has 4 GPIO blocks, let's register them immediately */
54static resource_size_t __initdata cpu8815_gpio_base[] = {
55 NOMADIK_GPIO0_BASE,
56 NOMADIK_GPIO1_BASE,
57 NOMADIK_GPIO2_BASE,
58 NOMADIK_GPIO3_BASE,
59};
60
61static struct platform_device *
62cpu8815_add_gpio(int id, resource_size_t addr, int irq,
63 struct nmk_gpio_platform_data *pdata)
64{
65 struct resource resources[] = {
66 {
67 .start = addr,
68 .end = addr + 127,
69 .flags = IORESOURCE_MEM,
70 },
71 {
72 .start = irq,
73 .end = irq,
74 .flags = IORESOURCE_IRQ,
75 }
76 };
77
78 return platform_device_register_resndata(NULL, "gpio", id,
79 resources, ARRAY_SIZE(resources),
80 pdata, sizeof(*pdata));
81}
82
83void cpu8815_add_gpios(resource_size_t *base, int num, int irq,
84 struct nmk_gpio_platform_data *pdata)
85{
86 int first = 0;
87 int i;
88
89 for (i = 0; i < num; i++, first += 32, irq++) {
90 pdata->first_gpio = first;
91 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first);
92 pdata->num_gpio = 32;
93
94 cpu8815_add_gpio(i, base[i], irq, pdata);
95 }
96}
97
98static unsigned long out_low[] = { PIN_OUTPUT_LOW }; 51static unsigned long out_low[] = { PIN_OUTPUT_LOW };
99static unsigned long out_high[] = { PIN_OUTPUT_HIGH }; 52static unsigned long out_high[] = { PIN_OUTPUT_HIGH };
100static unsigned long in_nopull[] = { PIN_INPUT_NOPULL }; 53static unsigned long in_nopull[] = { PIN_INPUT_NOPULL };
@@ -137,38 +90,6 @@ static struct pinctrl_map __initdata nhk8815_pinmap[] = {
137 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO74_C20", in_pullup), 90 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO74_C20", in_pullup),
138}; 91};
139 92
140static inline void
141cpu8815_add_pinctrl(struct device *parent, const char *name)
142{
143 struct platform_device_info pdevinfo = {
144 .parent = parent,
145 .name = name,
146 .id = -1,
147 };
148
149 pinctrl_register_mappings(nhk8815_pinmap, ARRAY_SIZE(nhk8815_pinmap));
150 platform_device_register_full(&pdevinfo);
151}
152
153static int __init cpu8815_init(void)
154{
155 struct nmk_gpio_platform_data pdata = {
156 /* No custom data yet */
157 };
158
159 /* For e.g. device tree boots */
160 if (!machine_is_nomadik())
161 return 0;
162
163 cpu8815_add_gpios(cpu8815_gpio_base, ARRAY_SIZE(cpu8815_gpio_base),
164 IRQ_GPIO0, &pdata);
165 cpu8815_add_pinctrl(NULL, "pinctrl-stn8815");
166 amba_apb_device_add(NULL, "rng", NOMADIK_RNG_BASE, SZ_4K, 0, 0, NULL, 0);
167 amba_apb_device_add(NULL, "rtc-pl031", NOMADIK_RTC_BASE, SZ_4K, IRQ_RTC_RTT, 0, NULL, 0);
168 return 0;
169}
170arch_initcall(cpu8815_init);
171
172/* All SoC devices live in the same area (see hardware.h) */ 93/* All SoC devices live in the same area (see hardware.h) */
173static struct map_desc nomadik_io_desc[] __initdata = { 94static struct map_desc nomadik_io_desc[] __initdata = {
174 { 95 {
@@ -180,37 +101,12 @@ static struct map_desc nomadik_io_desc[] __initdata = {
180 /* static ram and secured ram may be added later */ 101 /* static ram and secured ram may be added later */
181}; 102};
182 103
183void __init cpu8815_map_io(void) 104static void __init cpu8815_map_io(void)
184{ 105{
185 iotable_init(nomadik_io_desc, ARRAY_SIZE(nomadik_io_desc)); 106 iotable_init(nomadik_io_desc, ARRAY_SIZE(nomadik_io_desc));
186} 107}
187 108
188void __init cpu8815_init_irq(void) 109static void cpu8815_restart(char mode, const char *cmd)
189{
190 /* This modified VIC cell has two register blocks, at 0 and 0x20 */
191 vic_init(io_p2v(NOMADIK_IC_BASE + 0x00), IRQ_VIC_START + 0, ~0, 0);
192 vic_init(io_p2v(NOMADIK_IC_BASE + 0x20), IRQ_VIC_START + 32, ~0, 0);
193
194 /*
195 * Init clocks here so that they are available for system timer
196 * initialization.
197 */
198 nomadik_clk_init();
199}
200
201/*
202 * This function is called from the board init ("init_machine").
203 */
204 void __init cpu8815_platform_init(void)
205{
206#ifdef CONFIG_CACHE_L2X0
207 /* At full speed latency must be >=2, so 0x249 in low bits */
208 l2x0_init(io_p2v(NOMADIK_L2CC_BASE), 0x00730249, 0xfe000fff);
209#endif
210 return;
211}
212
213void cpu8815_restart(char mode, const char *cmd)
214{ 110{
215 void __iomem *src_rstsr = io_p2v(NOMADIK_SRC_BASE + 0x18); 111 void __iomem *src_rstsr = io_p2v(NOMADIK_SRC_BASE + 0x18);
216 112
@@ -220,8 +116,6 @@ void cpu8815_restart(char mode, const char *cmd)
220 writel(1, src_rstsr); 116 writel(1, src_rstsr);
221} 117}
222 118
223#ifdef CONFIG_OF
224
225/* Initial value for SRC control register: all timers use MXTAL/8 source */ 119/* Initial value for SRC control register: all timers use MXTAL/8 source */
226#define SRC_CR_INIT_MASK 0x00007fff 120#define SRC_CR_INIT_MASK 0x00007fff
227#define SRC_CR_INIT_VAL 0x2aaa8000 121#define SRC_CR_INIT_VAL 0x2aaa8000
@@ -393,5 +287,3 @@ DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815")
393 .restart = cpu8815_restart, 287 .restart = cpu8815_restart,
394 .dt_compat = cpu8815_board_compat, 288 .dt_compat = cpu8815_board_compat,
395MACHINE_END 289MACHINE_END
396
397#endif
diff --git a/arch/arm/mach-nomadik/cpu-8815.h b/arch/arm/mach-nomadik/cpu-8815.h
deleted file mode 100644
index d6c7830e4799..000000000000
--- a/arch/arm/mach-nomadik/cpu-8815.h
+++ /dev/null
@@ -1,5 +0,0 @@
1extern void cpu8815_map_io(void);
2extern void cpu8815_platform_init(void);
3extern void cpu8815_init_irq(void);
4extern void cpu8815_restart(char, const char *);
5extern struct sys_timer cpu8815_timer;
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c
deleted file mode 100644
index 299ff5a687bc..000000000000
--- a/arch/arm/mach-nomadik/i2c-8815nhk.c
+++ /dev/null
@@ -1,82 +0,0 @@
1#include <linux/module.h>
2#include <linux/init.h>
3#include <linux/i2c.h>
4#include <linux/i2c-algo-bit.h>
5#include <linux/i2c-gpio.h>
6#include <linux/platform_device.h>
7#include <asm/mach-types.h>
8
9/*
10 * There are two busses in the 8815NHK.
11 * They could, in theory, be driven by the hardware component, but we
12 * use bit-bang through GPIO by now, to keep things simple
13 */
14
15/* I2C0 connected to the STw4811 power management chip */
16static struct i2c_gpio_platform_data nhk8815_i2c_data0 = {
17 /* keep defaults for timeouts; pins are push-pull bidirectional */
18 .scl_pin = 62,
19 .sda_pin = 63,
20};
21
22/* I2C1 connected to various sensors */
23static struct i2c_gpio_platform_data nhk8815_i2c_data1 = {
24 /* keep defaults for timeouts; pins are push-pull bidirectional */
25 .scl_pin = 53,
26 .sda_pin = 54,
27};
28
29/* I2C2 connected to the USB portions of the STw4811 only */
30static struct i2c_gpio_platform_data nhk8815_i2c_data2 = {
31 /* keep defaults for timeouts; pins are push-pull bidirectional */
32 .scl_pin = 73,
33 .sda_pin = 74,
34};
35
36static struct platform_device nhk8815_i2c_dev0 = {
37 .name = "i2c-gpio",
38 .id = 0,
39 .dev = {
40 .platform_data = &nhk8815_i2c_data0,
41 },
42};
43
44static struct platform_device nhk8815_i2c_dev1 = {
45 .name = "i2c-gpio",
46 .id = 1,
47 .dev = {
48 .platform_data = &nhk8815_i2c_data1,
49 },
50};
51
52static struct platform_device nhk8815_i2c_dev2 = {
53 .name = "i2c-gpio",
54 .id = 2,
55 .dev = {
56 .platform_data = &nhk8815_i2c_data2,
57 },
58};
59
60static int __init nhk8815_i2c_init(void)
61{
62 /* For e.g. devicetree boot */
63 if (!machine_is_nomadik())
64 return 0;
65
66 platform_device_register(&nhk8815_i2c_dev0);
67 platform_device_register(&nhk8815_i2c_dev1);
68 platform_device_register(&nhk8815_i2c_dev2);
69
70 return 0;
71}
72
73static void __exit nhk8815_i2c_exit(void)
74{
75 platform_device_unregister(&nhk8815_i2c_dev0);
76 platform_device_unregister(&nhk8815_i2c_dev1);
77 platform_device_unregister(&nhk8815_i2c_dev2);
78 return;
79}
80
81module_init(nhk8815_i2c_init);
82module_exit(nhk8815_i2c_exit);