]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: imx: dynamically allocate mxc_w1 devices
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 29 Oct 2010 08:56:07 +0000 (10:56 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 17 Nov 2010 07:58:13 +0000 (08:58 +0100)
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>
19 files changed:
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/devices-imx21.h
arch/arm/mach-imx/devices-imx27.h
arch/arm/mach-imx/devices.c
arch/arm/mach-imx/devices.h
arch/arm/mach-imx/mach-cpuimx27.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-imx/mach-pca100.c
arch/arm/mach-imx/mach-pcm038.c
arch/arm/mach-mx3/Kconfig
arch/arm/mach-mx3/devices-imx31.h
arch/arm/mach-mx3/devices-imx35.h
arch/arm/mach-mx3/devices.c
arch/arm/mach-mx3/devices.h
arch/arm/mach-mx3/mach-pcm037.c
arch/arm/plat-mxc/devices/Kconfig
arch/arm/plat-mxc/devices/Makefile
arch/arm/plat-mxc/devices/platform-mxc_w1.c [new file with mode: 0644]
arch/arm/plat-mxc/include/mach/devices-common.h

index 197f9e241cffc36e06543fe1eadc60582955fd1a..edf0182110020a3cef45ffc27c516a7d6ea92115 100644 (file)
@@ -88,6 +88,7 @@ config MACH_MX27ADS
        select IMX_HAVE_PLATFORM_IMX_I2C
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_MXC_NAND
+       select IMX_HAVE_PLATFORM_MXC_W1
        help
          Include support for MX27ADS platform. This includes specific
          configurations for the board and its peripherals.
@@ -97,6 +98,7 @@ config MACH_PCM038
        select IMX_HAVE_PLATFORM_IMX_I2C
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_MXC_NAND
+       select IMX_HAVE_PLATFORM_MXC_W1
        select IMX_HAVE_PLATFORM_SPI_IMX
        select MXC_ULPI if USB_ULPI
        help
@@ -122,6 +124,7 @@ config MACH_CPUIMX27
        select IMX_HAVE_PLATFORM_IMX_I2C
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_MXC_NAND
+       select IMX_HAVE_PLATFORM_MXC_W1
        select MXC_ULPI if USB_ULPI
        help
          Include support for Eukrea CPUIMX27 platform. This includes
@@ -186,6 +189,7 @@ config MACH_PCA100
        select IMX_HAVE_PLATFORM_IMX_SSI
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_MXC_NAND
+       select IMX_HAVE_PLATFORM_MXC_W1
        select IMX_HAVE_PLATFORM_SPI_IMX
        select MXC_ULPI if USB_ULPI
        help
index d189039749b0902a7d081a644b6e8d2e97a82a21..61b0aa7fce986b58fce89b1671654db87b9f3ff5 100644 (file)
@@ -29,6 +29,10 @@ extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst;
 #define imx21_add_mxc_nand(pdata)      \
        imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst;
+#define imx21_add_mxc_w1(pdata)        \
+       imx_add_mxc_w1(&imx21_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx21_cspi_data[] __initconst;
 #define imx21_add_cspi(id, pdata)      \
        imx_add_spi_imx(&imx21_cspi_data[id], pdata)
index 7011690364f270286b8e4bc06d3c58edc868c434..b957e78e052b8ee592f20341ab4b5c1889df356c 100644 (file)
@@ -35,6 +35,10 @@ extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
 #define imx27_add_mxc_nand(pdata)      \
        imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst;
+#define imx27_add_mxc_w1(pdata)        \
+       imx_add_mxc_w1(&imx27_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx27_cspi_data[] __initconst;
 #define imx27_add_cspi(id, pdata)      \
        imx_add_spi_imx(&imx27_cspi_data[id], pdata)
index e69e46eac45ddb6ff1e74d490851631d32c91037..6fbd624fc5305490934fcada7e19b7ac5b1ab26e 100644 (file)
@@ -270,21 +270,6 @@ struct platform_device mxc_wdt = {
        .resource = mxc_wdt_resources,
 };
 
-static struct resource mxc_w1_master_resources[] = {
-       {
-               .start = MX2x_OWIRE_BASE_ADDR,
-               .end = MX2x_OWIRE_BASE_ADDR + SZ_4K - 1,
-               .flags = IORESOURCE_MEM,
-       },
-};
-
-struct platform_device mxc_w1_master_device = {
-       .name = "mxc_w1",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
-       .resource = mxc_w1_master_resources,
-};
-
 /*
  * lcdc:
  * - i.MX1: the basic controller
index 807f02a031c9454ce3534e26f508cd34fdc2b36e..48d2c5b8c164f9c2306cdd75287c6d7fb1af7aff 100644 (file)
@@ -14,7 +14,6 @@ extern struct platform_device mxc_gpt4;
 extern struct platform_device mxc_gpt5;
 #endif
 extern struct platform_device mxc_wdt;
-extern struct platform_device mxc_w1_master_device;
 extern struct platform_device mxc_fb_device;
 extern struct platform_device mxc_pwm_device;
 extern struct platform_device mxc_sdhc_device0;
index 745ee60fb068fee9dca479142b0c283bf14659a6..9baaf3df048e68b5c4e1915bb73454b117b7899f 100644 (file)
@@ -158,7 +158,6 @@ cpuimx27_nand_board_info __initconst = {
 static struct platform_device *platform_devices[] __initdata = {
        &eukrea_cpuimx27_nor_mtd_device,
        &mxc_wdt,
-       &mxc_w1_master_device,
 };
 
 static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
@@ -262,6 +261,7 @@ static void __init eukrea_cpuimx27_init(void)
 
        imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       imx27_add_mxc_w1(NULL);
 
 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
        /* SDHC2 can be used for Wifi */
index a1e4bc573afc20081720fcb21cbd604e14ce5ff0..219899a5c8ab0ed6fc19602e07fa4e6d6b6f2d33 100644 (file)
@@ -284,7 +284,6 @@ static struct imxmmc_platform_data sdhc2_pdata = {
 
 static struct platform_device *platform_devices[] __initdata = {
        &mx27ads_nor_mtd_device,
-       &mxc_w1_master_device,
 };
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -314,6 +313,7 @@ static void __init mx27ads_board_init(void)
 
        imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       imx27_add_mxc_w1(NULL);
 }
 
 static void __init mx27ads_timer_init(void)
index 8c720d44602ab1af61cd18b36316ec44e3613dcc..39c580bc922563a020369bff487c5af053deadcf 100644 (file)
@@ -172,7 +172,6 @@ pca100_nand_board_info __initconst = {
 };
 
 static struct platform_device *platform_devices[] __initdata = {
-       &mxc_w1_master_device,
        &mxc_wdt,
 };
 
@@ -434,6 +433,7 @@ static void __init pca100_init(void)
 
        imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       imx27_add_mxc_w1(NULL);
 }
 
 static void __init pca100_timer_init(void)
index 49a97ce0742665b9e82b5a12224a06b6c80307da..2cfc4b96c5031494e473e625801aae226e260110 100644 (file)
@@ -172,7 +172,6 @@ pcm038_nand_board_info __initconst = {
 
 static struct platform_device *platform_devices[] __initdata = {
        &pcm038_nor_mtd_device,
-       &mxc_w1_master_device,
        &pcm038_sram_mtd_device,
        &mxc_wdt,
 };
@@ -326,6 +325,7 @@ static void __init pcm038_init(void)
 
        imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+       imx27_add_mxc_w1(NULL);
 
 #ifdef CONFIG_MACH_PCM970_BASEBOARD
        pcm970_baseboard_init();
index 5000ac1f93e3d2838cc7e7f915694214292e38dd..3f83fd534073d60cb843f88108bf9c1733710e01 100644 (file)
@@ -41,6 +41,7 @@ config MACH_PCM037
        select IMX_HAVE_PLATFORM_IMX_I2C
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_MXC_NAND
+       select IMX_HAVE_PLATFORM_MXC_W1
        select MXC_ULPI if USB_ULPI
        help
          Include support for Phytec pcm037 platform. This includes
index de9598590eba71e43f83339e5d53a64d1740345c..a88f243ec72f786103cd604879b1bf3456131edd 100644 (file)
@@ -33,6 +33,10 @@ extern const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst;
 #define imx31_add_mxc_nand(pdata)      \
        imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst;
+#define imx31_add_mxc_w1(pdata)        \
+       imx_add_mxc_w1(&imx31_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx31_cspi_data[] __initconst;
 #define imx31_add_cspi(id, pdata)      \
        imx_add_spi_imx(&imx31_cspi_data[id], pdata)
index 5eb917b638d0b40ea14ef260bdc414298cb17db8..7602cb49aab671bb9b6f179dfd374e95297ce177 100644 (file)
@@ -40,6 +40,10 @@ extern const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst;
 #define imx35_add_mxc_nand(pdata)      \
        imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
 
+extern const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst;
+#define imx35_add_mxc_w1(pdata)        \
+       imx_add_mxc_w1(&imx35_mxc_w1_data)
+
 extern const struct imx_spi_imx_data imx35_cspi_data[] __initconst;
 #define imx35_add_cspi(id, pdata)      \
        imx_add_spi_imx(&imx35_cspi_data[id], pdata)
index 74f74f4fcff0a27f2e478a5e67dc1e77c56a0686..5808ce1b157be431de1c003527e4c116c6245082 100644 (file)
@@ -54,21 +54,6 @@ int __init imx3x_register_gpios(void)
        return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
 }
 
-static struct resource mxc_w1_master_resources[] = {
-       {
-               .start = MX3x_OWIRE_BASE_ADDR,
-               .end = MX3x_OWIRE_BASE_ADDR + SZ_4K - 1,
-               .flags = IORESOURCE_MEM,
-       },
-};
-
-struct platform_device mxc_w1_master_device = {
-       .name = "mxc_w1",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
-       .resource = mxc_w1_master_resources,
-};
-
 #ifdef CONFIG_ARCH_MX31
 static struct resource mxcsdhc0_resources[] = {
        {
index 585f814473d5f7b857426b8f549bf1512002e9da..a649772058ef4e0be92257dc03b6ed119c4402e9 100644 (file)
@@ -1,4 +1,3 @@
-extern struct platform_device mxc_w1_master_device;
 extern struct platform_device mx3_ipu;
 extern struct platform_device mx3_fb;
 extern struct platform_device mx3_camera;
index 86e86c1300d5525352ed8d2b3dee50162eef89d9..bc5d3a1aa20628178ef2790c857a809933964cfd 100644 (file)
@@ -614,7 +614,7 @@ static void __init mxc_board_init(void)
        imx31_add_imx_uart1(&uart_pdata);
        imx31_add_imx_uart2(&uart_pdata);
 
-       mxc_register_device(&mxc_w1_master_device, NULL);
+       imx31_add_mxc_w1(NULL);
 
        /* LAN9217 IRQ pin */
        ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
index 9aa6f3ea901253d4a827c39d2d5b752801ab01a9..fb664670c1010e47ee277506b50fca7b290b375e 100644 (file)
@@ -25,5 +25,8 @@ config IMX_HAVE_PLATFORM_IMX_UART
 config IMX_HAVE_PLATFORM_MXC_NAND
        bool
 
+config IMX_HAVE_PLATFORM_MXC_W1
+       bool
+
 config IMX_HAVE_PLATFORM_SPI_IMX
        bool
index 45aefeb283bac440421675ff039b4de427125522..1d7d3920162294e0070e5a00d5e216e72bc5ae70 100644 (file)
@@ -7,4 +7,5 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_w1.c b/arch/arm/plat-mxc/devices/platform-mxc_w1.c
new file mode 100644 (file)
index 0000000..1355237
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Pengutronix
+ * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+#define imx_mxc_w1_data_entry_single(soc)                              \
+       {                                                               \
+               .iobase = soc ## _OWIRE_BASE_ADDR,                      \
+       }
+
+#ifdef CONFIG_SOC_IMX21
+const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst =
+       imx_mxc_w1_data_entry_single(MX21);
+#endif /* ifdef CONFIG_SOC_IMX21 */
+
+#ifdef CONFIG_SOC_IMX27
+const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst =
+       imx_mxc_w1_data_entry_single(MX27);
+#endif /* ifdef CONFIG_SOC_IMX27 */
+
+#ifdef CONFIG_ARCH_MX31
+const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
+       imx_mxc_w1_data_entry_single(MX31);
+#endif /* ifdef CONFIG_ARCH_MX31 */
+
+#ifdef CONFIG_ARCH_MX35
+const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
+       imx_mxc_w1_data_entry_single(MX35);
+#endif /* ifdef CONFIG_ARCH_MX35 */
+
+struct platform_device *__init imx_add_mxc_w1(
+               const struct imx_mxc_w1_data *data)
+{
+       struct resource res[] = {
+               {
+                       .start = data->iobase,
+                       .end = data->iobase + SZ_4K - 1,
+                       .flags = IORESOURCE_MEM,
+               },
+       };
+
+       return imx_add_platform_device("mxc_w1", 0,
+                       res, ARRAY_SIZE(res), NULL, 0);
+}
index 8c6896fd1e5ff8415213f1c656820a08f9aabf9d..431e0ef4a8325b805dba6ea1995894fe60c23148 100644 (file)
@@ -99,6 +99,12 @@ struct platform_device *__init imx_add_mxc_nand(
                const struct imx_mxc_nand_data *data,
                const struct mxc_nand_platform_data *pdata);
 
+struct imx_mxc_w1_data {
+       resource_size_t iobase;
+};
+struct platform_device *__init imx_add_mxc_w1(
+               const struct imx_mxc_w1_data *data);
+
 #include <mach/spi.h>
 struct imx_spi_imx_data {
        const char *devid;