Skip to content

Commit ae71a56

Browse files
author
Uwe Kleine-König
committed
ARM: imx: dynamically allocate mxc_w1 devices
Currently there is no platform data used in the driver. In case this changes NULL is passed unused to the soc specific functions. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
1 parent d96801b commit ae71a56

19 files changed

+86
-37
lines changed

arch/arm/mach-imx/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ config MACH_MX27ADS
8888
select IMX_HAVE_PLATFORM_IMX_I2C
8989
select IMX_HAVE_PLATFORM_IMX_UART
9090
select IMX_HAVE_PLATFORM_MXC_NAND
91+
select IMX_HAVE_PLATFORM_MXC_W1
9192
help
9293
Include support for MX27ADS platform. This includes specific
9394
configurations for the board and its peripherals.
@@ -97,6 +98,7 @@ config MACH_PCM038
9798
select IMX_HAVE_PLATFORM_IMX_I2C
9899
select IMX_HAVE_PLATFORM_IMX_UART
99100
select IMX_HAVE_PLATFORM_MXC_NAND
101+
select IMX_HAVE_PLATFORM_MXC_W1
100102
select IMX_HAVE_PLATFORM_SPI_IMX
101103
select MXC_ULPI if USB_ULPI
102104
help
@@ -122,6 +124,7 @@ config MACH_CPUIMX27
122124
select IMX_HAVE_PLATFORM_IMX_I2C
123125
select IMX_HAVE_PLATFORM_IMX_UART
124126
select IMX_HAVE_PLATFORM_MXC_NAND
127+
select IMX_HAVE_PLATFORM_MXC_W1
125128
select MXC_ULPI if USB_ULPI
126129
help
127130
Include support for Eukrea CPUIMX27 platform. This includes
@@ -186,6 +189,7 @@ config MACH_PCA100
186189
select IMX_HAVE_PLATFORM_IMX_SSI
187190
select IMX_HAVE_PLATFORM_IMX_UART
188191
select IMX_HAVE_PLATFORM_MXC_NAND
192+
select IMX_HAVE_PLATFORM_MXC_W1
189193
select IMX_HAVE_PLATFORM_SPI_IMX
190194
select MXC_ULPI if USB_ULPI
191195
help

arch/arm/mach-imx/devices-imx21.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst;
2929
#define imx21_add_mxc_nand(pdata) \
3030
imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
3131

32+
extern const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst;
33+
#define imx21_add_mxc_w1(pdata) \
34+
imx_add_mxc_w1(&imx21_mxc_w1_data)
35+
3236
extern const struct imx_spi_imx_data imx21_cspi_data[] __initconst;
3337
#define imx21_add_cspi(id, pdata) \
3438
imx_add_spi_imx(&imx21_cspi_data[id], pdata)

arch/arm/mach-imx/devices-imx27.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
3535
#define imx27_add_mxc_nand(pdata) \
3636
imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
3737

38+
extern const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst;
39+
#define imx27_add_mxc_w1(pdata) \
40+
imx_add_mxc_w1(&imx27_mxc_w1_data)
41+
3842
extern const struct imx_spi_imx_data imx27_cspi_data[] __initconst;
3943
#define imx27_add_cspi(id, pdata) \
4044
imx_add_spi_imx(&imx27_cspi_data[id], pdata)

arch/arm/mach-imx/devices.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -270,21 +270,6 @@ struct platform_device mxc_wdt = {
270270
.resource = mxc_wdt_resources,
271271
};
272272

273-
static struct resource mxc_w1_master_resources[] = {
274-
{
275-
.start = MX2x_OWIRE_BASE_ADDR,
276-
.end = MX2x_OWIRE_BASE_ADDR + SZ_4K - 1,
277-
.flags = IORESOURCE_MEM,
278-
},
279-
};
280-
281-
struct platform_device mxc_w1_master_device = {
282-
.name = "mxc_w1",
283-
.id = 0,
284-
.num_resources = ARRAY_SIZE(mxc_w1_master_resources),
285-
.resource = mxc_w1_master_resources,
286-
};
287-
288273
/*
289274
* lcdc:
290275
* - i.MX1: the basic controller

arch/arm/mach-imx/devices.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ extern struct platform_device mxc_gpt4;
1414
extern struct platform_device mxc_gpt5;
1515
#endif
1616
extern struct platform_device mxc_wdt;
17-
extern struct platform_device mxc_w1_master_device;
1817
extern struct platform_device mxc_fb_device;
1918
extern struct platform_device mxc_pwm_device;
2019
extern struct platform_device mxc_sdhc_device0;

arch/arm/mach-imx/mach-cpuimx27.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ cpuimx27_nand_board_info __initconst = {
158158
static struct platform_device *platform_devices[] __initdata = {
159159
&eukrea_cpuimx27_nor_mtd_device,
160160
&mxc_wdt,
161-
&mxc_w1_master_device,
162161
};
163162

164163
static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
@@ -262,6 +261,7 @@ static void __init eukrea_cpuimx27_init(void)
262261

263262
imx27_add_fec(NULL);
264263
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
264+
imx27_add_mxc_w1(NULL);
265265

266266
#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
267267
/* SDHC2 can be used for Wifi */

arch/arm/mach-imx/mach-mx27ads.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ static struct imxmmc_platform_data sdhc2_pdata = {
284284

285285
static struct platform_device *platform_devices[] __initdata = {
286286
&mx27ads_nor_mtd_device,
287-
&mxc_w1_master_device,
288287
};
289288

290289
static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -314,6 +313,7 @@ static void __init mx27ads_board_init(void)
314313

315314
imx27_add_fec(NULL);
316315
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
316+
imx27_add_mxc_w1(NULL);
317317
}
318318

319319
static void __init mx27ads_timer_init(void)

arch/arm/mach-imx/mach-pca100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ pca100_nand_board_info __initconst = {
172172
};
173173

174174
static struct platform_device *platform_devices[] __initdata = {
175-
&mxc_w1_master_device,
176175
&mxc_wdt,
177176
};
178177

@@ -434,6 +433,7 @@ static void __init pca100_init(void)
434433

435434
imx27_add_fec(NULL);
436435
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
436+
imx27_add_mxc_w1(NULL);
437437
}
438438

439439
static void __init pca100_timer_init(void)

arch/arm/mach-imx/mach-pcm038.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ pcm038_nand_board_info __initconst = {
172172

173173
static struct platform_device *platform_devices[] __initdata = {
174174
&pcm038_nor_mtd_device,
175-
&mxc_w1_master_device,
176175
&pcm038_sram_mtd_device,
177176
&mxc_wdt,
178177
};
@@ -326,6 +325,7 @@ static void __init pcm038_init(void)
326325

327326
imx27_add_fec(NULL);
328327
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
328+
imx27_add_mxc_w1(NULL);
329329

330330
#ifdef CONFIG_MACH_PCM970_BASEBOARD
331331
pcm970_baseboard_init();

arch/arm/mach-mx3/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ config MACH_PCM037
4141
select IMX_HAVE_PLATFORM_IMX_I2C
4242
select IMX_HAVE_PLATFORM_IMX_UART
4343
select IMX_HAVE_PLATFORM_MXC_NAND
44+
select IMX_HAVE_PLATFORM_MXC_W1
4445
select MXC_ULPI if USB_ULPI
4546
help
4647
Include support for Phytec pcm037 platform. This includes

arch/arm/mach-mx3/devices-imx31.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ extern const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst;
3333
#define imx31_add_mxc_nand(pdata) \
3434
imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
3535

36+
extern const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst;
37+
#define imx31_add_mxc_w1(pdata) \
38+
imx_add_mxc_w1(&imx31_mxc_w1_data)
39+
3640
extern const struct imx_spi_imx_data imx31_cspi_data[] __initconst;
3741
#define imx31_add_cspi(id, pdata) \
3842
imx_add_spi_imx(&imx31_cspi_data[id], pdata)

arch/arm/mach-mx3/devices-imx35.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ extern const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst;
4040
#define imx35_add_mxc_nand(pdata) \
4141
imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
4242

43+
extern const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst;
44+
#define imx35_add_mxc_w1(pdata) \
45+
imx_add_mxc_w1(&imx35_mxc_w1_data)
46+
4347
extern const struct imx_spi_imx_data imx35_cspi_data[] __initconst;
4448
#define imx35_add_cspi(id, pdata) \
4549
imx_add_spi_imx(&imx35_cspi_data[id], pdata)

arch/arm/mach-mx3/devices.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,6 @@ int __init imx3x_register_gpios(void)
5454
return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
5555
}
5656

57-
static struct resource mxc_w1_master_resources[] = {
58-
{
59-
.start = MX3x_OWIRE_BASE_ADDR,
60-
.end = MX3x_OWIRE_BASE_ADDR + SZ_4K - 1,
61-
.flags = IORESOURCE_MEM,
62-
},
63-
};
64-
65-
struct platform_device mxc_w1_master_device = {
66-
.name = "mxc_w1",
67-
.id = 0,
68-
.num_resources = ARRAY_SIZE(mxc_w1_master_resources),
69-
.resource = mxc_w1_master_resources,
70-
};
71-
7257
#ifdef CONFIG_ARCH_MX31
7358
static struct resource mxcsdhc0_resources[] = {
7459
{

arch/arm/mach-mx3/devices.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
extern struct platform_device mxc_w1_master_device;
21
extern struct platform_device mx3_ipu;
32
extern struct platform_device mx3_fb;
43
extern struct platform_device mx3_camera;

arch/arm/mach-mx3/mach-pcm037.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ static void __init mxc_board_init(void)
614614
imx31_add_imx_uart1(&uart_pdata);
615615
imx31_add_imx_uart2(&uart_pdata);
616616

617-
mxc_register_device(&mxc_w1_master_device, NULL);
617+
imx31_add_mxc_w1(NULL);
618618

619619
/* LAN9217 IRQ pin */
620620
ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");

arch/arm/plat-mxc/devices/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ config IMX_HAVE_PLATFORM_IMX_UART
2525
config IMX_HAVE_PLATFORM_MXC_NAND
2626
bool
2727

28+
config IMX_HAVE_PLATFORM_MXC_W1
29+
bool
30+
2831
config IMX_HAVE_PLATFORM_SPI_IMX
2932
bool

arch/arm/plat-mxc/devices/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
77
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
88
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
99
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
10+
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
1011
obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (C) 2010 Pengutronix
3+
* Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under
6+
* the terms of the GNU General Public License version 2 as published by the
7+
* Free Software Foundation.
8+
*/
9+
#include <mach/hardware.h>
10+
#include <mach/devices-common.h>
11+
12+
#define imx_mxc_w1_data_entry_single(soc) \
13+
{ \
14+
.iobase = soc ## _OWIRE_BASE_ADDR, \
15+
}
16+
17+
#ifdef CONFIG_SOC_IMX21
18+
const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst =
19+
imx_mxc_w1_data_entry_single(MX21);
20+
#endif /* ifdef CONFIG_SOC_IMX21 */
21+
22+
#ifdef CONFIG_SOC_IMX27
23+
const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst =
24+
imx_mxc_w1_data_entry_single(MX27);
25+
#endif /* ifdef CONFIG_SOC_IMX27 */
26+
27+
#ifdef CONFIG_ARCH_MX31
28+
const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
29+
imx_mxc_w1_data_entry_single(MX31);
30+
#endif /* ifdef CONFIG_ARCH_MX31 */
31+
32+
#ifdef CONFIG_ARCH_MX35
33+
const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
34+
imx_mxc_w1_data_entry_single(MX35);
35+
#endif /* ifdef CONFIG_ARCH_MX35 */
36+
37+
struct platform_device *__init imx_add_mxc_w1(
38+
const struct imx_mxc_w1_data *data)
39+
{
40+
struct resource res[] = {
41+
{
42+
.start = data->iobase,
43+
.end = data->iobase + SZ_4K - 1,
44+
.flags = IORESOURCE_MEM,
45+
},
46+
};
47+
48+
return imx_add_platform_device("mxc_w1", 0,
49+
res, ARRAY_SIZE(res), NULL, 0);
50+
}

arch/arm/plat-mxc/include/mach/devices-common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ struct platform_device *__init imx_add_mxc_nand(
9999
const struct imx_mxc_nand_data *data,
100100
const struct mxc_nand_platform_data *pdata);
101101

102+
struct imx_mxc_w1_data {
103+
resource_size_t iobase;
104+
};
105+
struct platform_device *__init imx_add_mxc_w1(
106+
const struct imx_mxc_w1_data *data);
107+
102108
#include <mach/spi.h>
103109
struct imx_spi_imx_data {
104110
const char *devid;

0 commit comments

Comments
 (0)