ARM: mx5: dynamically register imx-i2c devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
64de5ec168
commit
44505c0768
|
@ -10,6 +10,7 @@ comment "MX5 platforms:"
|
||||||
|
|
||||||
config MACH_MX51_BABBAGE
|
config MACH_MX51_BABBAGE
|
||||||
bool "Support MX51 BABBAGE platforms"
|
bool "Support MX51 BABBAGE platforms"
|
||||||
|
select IMX_HAVE_PLATFORM_IMX_I2C
|
||||||
help
|
help
|
||||||
Include support for MX51 Babbage platform, also known as MX51EVK in
|
Include support for MX51 Babbage platform, also known as MX51EVK in
|
||||||
u-boot. This includes specific configurations for the board and its
|
u-boot. This includes specific configurations for the board and its
|
||||||
|
@ -24,6 +25,7 @@ config MACH_MX51_3DS
|
||||||
|
|
||||||
config MACH_EUKREA_CPUIMX51
|
config MACH_EUKREA_CPUIMX51
|
||||||
bool "Support Eukrea CPUIMX51 module"
|
bool "Support Eukrea CPUIMX51 module"
|
||||||
|
select IMX_HAVE_PLATFORM_IMX_I2C
|
||||||
help
|
help
|
||||||
Include support for Eukrea CPUIMX51 platform. This includes
|
Include support for Eukrea CPUIMX51 platform. This includes
|
||||||
specific configurations for the module and its peripherals.
|
specific configurations for the module and its peripherals.
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <mach/hardware.h>
|
#include <mach/hardware.h>
|
||||||
#include <mach/imx-uart.h>
|
#include <mach/imx-uart.h>
|
||||||
#include <mach/iomux-mx51.h>
|
#include <mach/iomux-mx51.h>
|
||||||
#include <mach/i2c.h>
|
|
||||||
#include <mach/mxc_ehci.h>
|
#include <mach/mxc_ehci.h>
|
||||||
|
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
|
@ -152,7 +151,8 @@ static struct imxuart_platform_data uart_pdata = {
|
||||||
.flags = IMXUART_HAVE_RTSCTS,
|
.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,
|
.bitrate = 100000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ static void __init eukrea_cpuimx51_init(void)
|
||||||
|
|
||||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
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,
|
i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
|
||||||
ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
|
ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <mach/hardware.h>
|
#include <mach/hardware.h>
|
||||||
#include <mach/imx-uart.h>
|
#include <mach/imx-uart.h>
|
||||||
#include <mach/iomux-mx51.h>
|
#include <mach/iomux-mx51.h>
|
||||||
#include <mach/i2c.h>
|
|
||||||
#include <mach/mxc_ehci.h>
|
#include <mach/mxc_ehci.h>
|
||||||
|
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
|
@ -137,7 +136,7 @@ static inline void mxc_init_imx_uart(void)
|
||||||
}
|
}
|
||||||
#endif /* SERIAL_IMX */
|
#endif /* SERIAL_IMX */
|
||||||
|
|
||||||
static struct imxi2c_platform_data babbage_i2c_data = {
|
static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
|
||||||
.bitrate = 100000,
|
.bitrate = 100000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -293,8 +292,8 @@ static void __init mxc_board_init(void)
|
||||||
babbage_fec_reset();
|
babbage_fec_reset();
|
||||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||||
|
|
||||||
mxc_register_device(&mxc_i2c_device0, &babbage_i2c_data);
|
imx51_add_imx_i2c(0, &babbage_i2c_data);
|
||||||
mxc_register_device(&mxc_i2c_device1, &babbage_i2c_data);
|
imx51_add_imx_i2c(1, &babbage_i2c_data);
|
||||||
mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
|
mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
|
||||||
|
|
||||||
if (otg_mode_host)
|
if (otg_mode_host)
|
||||||
|
|
|
@ -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)
|
|
@ -93,44 +93,6 @@ struct platform_device mxc_fec_device = {
|
||||||
.resource = mxc_fec_resources,
|
.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[] = {
|
static struct resource mxc_hsi2c_resources[] = {
|
||||||
{
|
{
|
||||||
.start = MX51_HSI2C_DMA_BASE_ADDR,
|
.start = MX51_HSI2C_DMA_BASE_ADDR,
|
||||||
|
|
|
@ -6,7 +6,5 @@ extern struct platform_device mxc_usbdr_host_device;
|
||||||
extern struct platform_device mxc_usbh1_device;
|
extern struct platform_device mxc_usbh1_device;
|
||||||
extern struct platform_device mxc_usbdr_udc_device;
|
extern struct platform_device mxc_usbdr_udc_device;
|
||||||
extern struct platform_device mxc_wdt;
|
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_hsi2c_device;
|
||||||
extern struct platform_device mxc_keypad_device;
|
extern struct platform_device mxc_keypad_device;
|
||||||
|
|
|
@ -68,6 +68,15 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
|
||||||
};
|
};
|
||||||
#endif /* ifdef CONFIG_ARCH_MX35 */
|
#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(
|
struct platform_device *__init imx_add_imx_i2c(
|
||||||
const struct imx_imx_i2c_data *data,
|
const struct imx_imx_i2c_data *data,
|
||||||
const struct imxi2c_platform_data *pdata)
|
const struct imxi2c_platform_data *pdata)
|
||||||
|
|
Loading…
Reference in New Issue