From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 16/40 v2] ARM: mx5: dynamically register imx-i2c devices
Date: Thu, 30 Sep 2010 16:44:53 +0200 [thread overview]
Message-ID: <1285857893-31479-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1285595476-10025-16-git-send-email-u.kleine-koenig@pengutronix.de>
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
Hello,
I just noticed that I missed to adapt board-mx51_babbage in the first
attempt.
I just updated my repository with this new patch.
Best regards
Uwe
arch/arm/mach-mx5/Kconfig | 2 +
arch/arm/mach-mx5/board-cpuimx51.c | 6 ++--
arch/arm/mach-mx5/board-mx51_babbage.c | 7 ++---
arch/arm/mach-mx5/devices-imx51.h | 14 +++++++++
arch/arm/mach-mx5/devices.c | 38 --------------------------
arch/arm/mach-mx5/devices.h | 2 -
arch/arm/plat-mxc/devices/platform-imx-i2c.c | 9 ++++++
7 files changed, 31 insertions(+), 47 deletions(-)
create mode 100644 arch/arm/mach-mx5/devices-imx51.h
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 0848db5..e57caef 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -10,6 +10,7 @@ comment "MX5 platforms:"
config MACH_MX51_BABBAGE
bool "Support MX51 BABBAGE platforms"
+ select IMX_HAVE_PLATFORM_IMX_I2C
help
Include support for MX51 Babbage platform, also known as MX51EVK in
u-boot. This includes specific configurations for the board and its
@@ -24,6 +25,7 @@ config MACH_MX51_3DS
config MACH_EUKREA_CPUIMX51
bool "Support Eukrea CPUIMX51 module"
+ select IMX_HAVE_PLATFORM_IMX_I2C
help
Include support for Eukrea CPUIMX51 platform. This includes
specific configurations for the module and its peripherals.
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 623607a..d52f252 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -30,7 +30,6 @@
#include <mach/hardware.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx51.h>
-#include <mach/i2c.h>
#include <mach/mxc_ehci.h>
#include <asm/irq.h>
@@ -152,7 +151,8 @@ static struct imxuart_platform_data uart_pdata = {
.flags = IMXUART_HAVE_RTSCTS,
};
-static struct imxi2c_platform_data eukrea_cpuimx51_i2c_data = {
+static const
+struct imxi2c_platform_data eukrea_cpuimx51_i2c_data __initconst = {
.bitrate = 100000,
};
@@ -255,7 +255,7 @@ static void __init eukrea_cpuimx51_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices));
- mxc_register_device(&mxc_i2c_device1, &eukrea_cpuimx51_i2c_data);
+ imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index caa8f68..3f3075d 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -23,7 +23,6 @@
#include <mach/hardware.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx51.h>
-#include <mach/i2c.h>
#include <mach/mxc_ehci.h>
#include <asm/irq.h>
@@ -137,7 +136,7 @@ static inline void mxc_init_imx_uart(void)
}
#endif /* SERIAL_IMX */
-static struct imxi2c_platform_data babbage_i2c_data = {
+static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
.bitrate = 100000,
};
@@ -293,8 +292,8 @@ static void __init mxc_board_init(void)
babbage_fec_reset();
platform_add_devices(devices, ARRAY_SIZE(devices));
- mxc_register_device(&mxc_i2c_device0, &babbage_i2c_data);
- mxc_register_device(&mxc_i2c_device1, &babbage_i2c_data);
+ imx51_add_imx_i2c(0, &babbage_i2c_data);
+ imx51_add_imx_i2c(1, &babbage_i2c_data);
mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
if (otg_mode_host)
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
new file mode 100644
index 0000000..a3cc383
--- /dev/null
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -0,0 +1,14 @@
+/*
+ * 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/mx51.h>
+#include <mach/devices-common.h>
+
+extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
+#define imx51_add_imx_i2c(id, pdata) \
+ imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 1920ff4..70b76d1 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -93,44 +93,6 @@ struct platform_device mxc_fec_device = {
.resource = mxc_fec_resources,
};
-static struct resource mxc_i2c0_resources[] = {
- {
- .start = MX51_I2C1_BASE_ADDR,
- .end = MX51_I2C1_BASE_ADDR + SZ_4K - 1,
- .flags = IORESOURCE_MEM,
- }, {
- .start = MX51_MXC_INT_I2C1,
- .end = MX51_MXC_INT_I2C1,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-struct platform_device mxc_i2c_device0 = {
- .name = "imx-i2c",
- .id = 0,
- .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
- .resource = mxc_i2c0_resources,
-};
-
-static struct resource mxc_i2c1_resources[] = {
- {
- .start = MX51_I2C2_BASE_ADDR,
- .end = MX51_I2C2_BASE_ADDR + SZ_4K - 1,
- .flags = IORESOURCE_MEM,
- }, {
- .start = MX51_MXC_INT_I2C2,
- .end = MX51_MXC_INT_I2C2,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-struct platform_device mxc_i2c_device1 = {
- .name = "imx-i2c",
- .id = 1,
- .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
- .resource = mxc_i2c1_resources,
-};
-
static struct resource mxc_hsi2c_resources[] = {
{
.start = MX51_HSI2C_DMA_BASE_ADDR,
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index e509cfa..5c2918f 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -6,7 +6,5 @@ extern struct platform_device mxc_usbdr_host_device;
extern struct platform_device mxc_usbh1_device;
extern struct platform_device mxc_usbdr_udc_device;
extern struct platform_device mxc_wdt;
-extern struct platform_device mxc_i2c_device0;
-extern struct platform_device mxc_i2c_device1;
extern struct platform_device mxc_hsi2c_device;
extern struct platform_device mxc_keypad_device;
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
index ab9670b..ca988d4 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
@@ -68,6 +68,15 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
};
#endif /* ifdef CONFIG_ARCH_MX35 */
+#ifdef CONFIG_ARCH_MX51
+const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
+#define imx51_imx_i2c_data_entry(_id, _hwid) \
+ imx_imx_i2c_data_entry(MX51, _id, _hwid, SZ_4K)
+ imx51_imx_i2c_data_entry(0, 1),
+ imx51_imx_i2c_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_ARCH_MX51 */
+
struct platform_device *__init imx_add_imx_i2c(
const struct imx_imx_i2c_data *data,
const struct imxi2c_platform_data *pdata)
--
1.7.2.3
next prev parent reply other threads:[~2010-09-30 14:44 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-27 13:50 imx patches for 2.6.37 Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 01/40] ARM: imx: remove #ifdefery for unmerged flexcan driver Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 02/40] ARM: imx: ehci: use void __iomem * to hold i/o addresses Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 03/40] ARM: mx5/mx51_babbage: fix compiler warnings Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 04/40] ARM: mx5/mx51_babbage: don't use PHYS_OFFSET Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 05/40] ARM: mx27_defconfig: enable switches used in mx27 code Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 06/40] ARM: mx3_defconfig: add new machine MACH_EUKREA_CPUIMX35 Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 07/40] ARM: remove mx31pdk_defconfig Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 08/40] ARM: mx51_defconfig: add new boards MACH_MX51_3DS and MACH_EUKREA_CPUIMX51 Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 09/40] ARM: mx51: clean up mx51 header Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 10/40] ARM: mx51: fix naming of spi related defines Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 11/40] ARM: mx51: use IMX_IO_ADDRESS to define MX51_IO_ADDRESS Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 12/40] ARM: imx: change the way spi-imx devices are registered Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 13/40] ARM: imx: change the way imx-uarts " Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 14/40] ARM: imx: dynamically allocate imx-ssi devices Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 15/40] ARM: imx: reorganize imx-i2c device registration to use a struct per SoC Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 16/40] ARM: mx5: dynamically register imx-i2c devices Uwe Kleine-König
2010-09-30 14:44 ` Uwe Kleine-König [this message]
2010-09-27 13:50 ` [PATCH 17/40] ARM: imx: fix name of macros to add " Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 18/40] spi/imx: default to m on platforms that have such devices Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 19/40] spi/imx: convert driver to use platform ids Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 20/40] spi/imx: get rid of more ifs depending on the used cpu Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 21/40] spi/imx: save the spi chip select in config struct, not the gpio to use Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 22/40] spi/imx: add support for imx51's eCSPI and CSPI Uwe Kleine-König
2010-09-27 13:50 ` [PATCH 23/40] ARM: imx: use platform ids for spi_imx devices Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 24/40] ARM: mx5: add spi_imx device registration Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 25/40] ARM: mx5/clock-mx51: refactor ccgr callbacks to use common code Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 26/40] ARM: mx5/clock-mx51: new macro that defines a clk with all members Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 27/40] ARM: mx5/clock-mx51: add spi clocks Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 28/40] ARM: mx5/iomux-mx51: add iomux definitions for eCSPI2 on the imx51_3ds board Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 29/40] ARM: mx5/mx51_3ds: add eCSPI2 support " Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 30/40] ARM: mx5/mx51_3ds: add SPI NOR flash in the board init stage Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 31/40] ARM: mx5/iomux-mx51: Add SPI controller pads Uwe Kleine-König
2010-09-27 14:27 ` Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 32/40] ARM: mx5/iomux-mx51: Add aud3 primary function defines Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 33/40] ARM: mx5/iomux-mx51: Fix input path of some pins in gpio mode Uwe Kleine-König
2010-09-27 14:16 ` Lothar Waßmann
2010-09-27 14:31 ` Sascha Hauer
2010-09-27 14:47 ` Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 34/40] ARM: mx5: Add Nand clock support Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 35/40] ARM: mx51: dynamically register imx-uart devices Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 36/40] ARM: mx51: add imx-ssi devices Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 37/40] ARM: mx51: Add audmux support Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 38/40] ARM: imx: reorganize nand registration to use a struct Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 39/40] ARM: mx5: dynamically register mxc-nand device Uwe Kleine-König
2010-09-27 13:51 ` [PATCH 40/40] ARM: mx5: clock-imx51: make *ipg clocks secondary clocks of their corresponding peripheral clocks Uwe Kleine-König
2010-09-27 17:09 ` imx patches for 2.6.37 Philippe Rétornaz
2010-09-27 17:57 ` Uwe Kleine-König
2010-09-29 21:56 ` Dan Williams
2010-09-30 13:58 ` Sascha Hauer
2010-09-28 20:12 ` Uwe Kleine-König
2010-09-28 20:13 ` [PATCH 1/5] ARM: imx/clock-imx27: Pass NULL as function callback, not 0 Uwe Kleine-König
2010-09-28 20:13 ` [PATCH 2/5] ARM: imx/pcm038: make regulator platform data static Uwe Kleine-König
2010-09-28 20:13 ` [PATCH 3/5] ARM: imx: make all pin lists const and signed, move to .init where possible Uwe Kleine-König
2010-09-28 20:13 ` [PATCH 4/5] ARM: imx/pcm970: make platform_data static Uwe Kleine-König
2010-09-28 20:13 ` [PATCH 5/5] ARM: imx/pca100: only specify i2c device type once Uwe Kleine-König
2010-09-28 20:14 ` imx patches for 2.6.37 Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285857893-31479-1-git-send-email-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).