]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ARM: imx: dynamically register imx-i2c devices (imx1)
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 16 Jun 2010 13:26:07 +0000 (15:26 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 30 Jun 2010 07:00:37 +0000 (09:00 +0200)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/devices-imx1.h [new file with mode: 0644]
arch/arm/mach-imx/devices.c
arch/arm/mach-imx/devices.h
arch/arm/mach-imx/mach-mx1ads.c
arch/arm/plat-mxc/include/mach/mx1.h

index 5af1c22112a703a4818d1dd30ac289bf9d0cee1f..3f88d4a0b89f8311a709b29f1f4ab843c3e636c9 100644 (file)
@@ -16,6 +16,7 @@ config MACH_MXLADS
 config ARCH_MX1ADS
        bool "MX1ADS platform"
        select MACH_MXLADS
+       select IMX_HAVE_PLATFORM_IMX_I2C
        help
          Say Y here if you are using Motorola MX1ADS/MXLADS boards
 
diff --git a/arch/arm/mach-imx/devices-imx1.h b/arch/arm/mach-imx/devices-imx1.h
new file mode 100644 (file)
index 0000000..a5cfe04
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * 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/mx1.h>
+#include <mach/devices-common.h>
+
+#define imx1_add_i2c_imx(pdata)                \
+       imx_add_imx_i2c(0, MX1_I2C_BASE_ADDR, SZ_4K, MX1_INT_I2C, pdata)
index 3a599e94a65c033f30f511711798a76db5cff43a..a34ad60e8f0a3046f757477174120794cccf834d 100644 (file)
@@ -70,25 +70,6 @@ struct platform_device imx1_camera_device = {
        .num_resources  = ARRAY_SIZE(imx1_camera_resources),
 };
 
-static struct resource imx_i2c_resources[] = {
-       {
-               .start  = 0x00217000,
-               .end    = 0x00217010,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = MX1_I2C_INT,
-               .end    = MX1_I2C_INT,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device imx_i2c_device0 = {
-       .name           = "imx-i2c",
-       .id             = 0,
-       .resource       = imx_i2c_resources,
-       .num_resources  = ARRAY_SIZE(imx_i2c_resources),
-};
-
 #define DEFINE_IMX1_UART_DEVICE(n, baseaddr, irqrx, irqtx, irqrts)     \
        static struct resource imx1_uart_resources ## n[] = {           \
                {                                                       \
index 4ce7eef943f69b8f632d298ea5273ae9a82e1366..b4eb8a0c620796c855179781a082e801646634bf 100644 (file)
@@ -1,6 +1,5 @@
 #ifdef CONFIG_ARCH_MX1
 extern struct platform_device imx1_camera_device;
-extern struct platform_device imx_i2c_device0;
 extern struct platform_device imx1_uart_device0;
 extern struct platform_device imx1_uart_device1;
 extern struct platform_device imx_rtc_device;
index 5d7c85f8aaf563a98cfd42574ff5a2a95e0f3af1..339d41ad19d502a36870d707d30942e3a726150a 100644 (file)
@@ -30,6 +30,7 @@
 #include <mach/iomux-mx1.h>
 #include <mach/irqs.h>
 
+#include "devices-imx1.h"
 #include "devices.h"
 
 static int mx1ads_pins[] = {
@@ -98,7 +99,7 @@ static struct pcf857x_platform_data pcf857x_data[] = {
        }
 };
 
-static struct imxi2c_platform_data mx1ads_i2c_data = {
+static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
        .bitrate = 100000,
 };
 
@@ -131,7 +132,7 @@ static void __init mx1ads_init(void)
        i2c_register_board_info(0, mx1ads_i2c_devices,
                                ARRAY_SIZE(mx1ads_i2c_devices));
 
-       mxc_register_device(&imx_i2c_device0, &mx1ads_i2c_data);
+       imx1_add_i2c_imx(&mx1ads_i2c_data);
 }
 
 static void __init mx1ads_timer_init(void)
index 5eba7e6785dec6ddf643366965c5734bdc1fa89a..e99c0b21e092411550d916356830782b06c5b82c 100644 (file)
 #define MX1_PEN_DATA_INT       33
 #define MX1_PWM_INT            34
 #define MX1_SDHC_INT           35
-#define MX1_I2C_INT            39
+#define MX1_INT_I2C            39
 #define MX1_CSPI_INT           41
 #define MX1_SSI_TX_INT         42
 #define MX1_SSI_TX_ERR_INT     43
 #define PEN_DATA_INT MX1_PEN_DATA_INT
 #define PWM_INT MX1_PWM_INT
 #define SDHC_INT MX1_SDHC_INT
-#define I2C_INT MX1_I2C_INT
+#define I2C_INT MX1_INT_I2C
 #define CSPI_INT MX1_CSPI_INT
 #define SSI_TX_INT MX1_SSI_TX_INT
 #define SSI_TX_ERR_INT MX1_SSI_TX_ERR_INT