From ccc0a7176f41635aeb961dd1f86fa95c176f4158 Mon Sep 17 00:00:00 2001 From: Alejandro Gonzalez Date: Thu, 27 May 2010 12:40:57 +0200 Subject: ccwmx51: Move SMSC911x to platform specific device file Also, missing I2C selection option to configuration menu. Signed-off-by: Alejandro Gonzalez --- arch/arm/mach-mx5/Kconfig | 25 +++++++++++++ arch/arm/mach-mx5/devices.c | 70 +++--------------------------------- arch/arm/mach-mx5/devices.h | 1 + arch/arm/mach-mx5/devices_ccwmx51.c | 72 +++++++++++++++++++++++++++++++++++++ arch/arm/mach-mx5/devices_ccwmx51.h | 1 + 5 files changed, 103 insertions(+), 66 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index cd6a985af260..5dd3e0fa0b99 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig @@ -149,4 +149,29 @@ config SPI_MXC_SELECT3 Enable the CSPI3 interface endmenu +menu "I2C Interface options" + +config I2C_MXC_SELECT1 + bool "Enable I2C1 module" + default y + depends on I2C_MXC + help + Enable MX51 I2C1 module. + +config I2C_MXC_SELECT2 + bool "Enable I2C2 module" + default n + depends on I2C_MXC + help + Enable MX51 I2C2 module. + +config I2C_MXC_SELECT3 + bool "Enable I2C3 module" + default n + depends on I2C_MXC + help + Enable MX51 I2C3 module. + +endmenu + source "arch/arm/mach-mx5/displays/Kconfig" \ No newline at end of file diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c index 143ba48d2b2c..06f16db88993 100644 --- a/arch/arm/mach-mx5/devices.c +++ b/arch/arm/mach-mx5/devices.c @@ -26,6 +26,8 @@ #include #include #include "crm_regs.h" +#include "mx51_pins.h" +#include "devices.h" /* Flag used to indicate when IRAM has been initialized */ int iram_ready; @@ -617,70 +619,6 @@ struct mxc_gpio_port mxc_gpio_ports[] = { }, }; -#if defined(CONFIG_SMSC9118) || defined(CONFIG_SMSC9118_MODULE) -static struct resource smsc911x_device_resources[] = { - { - .name = "smsc911x-memory", - .start = CS5_BASE_ADDR, - .end = CS5_BASE_ADDR + SZ_4K - 1, - .flags = IORESOURCE_MEM, - }, - { - .start = IOMUX_TO_IRQ(MX51_PIN_GPIO1_9), - .end = IOMUX_TO_IRQ(MX51_PIN_GPIO1_9), - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device smsc911x_device = { - .name = "smsc911x", - .id = -1, - .num_resources = ARRAY_SIZE(smsc911x_device_resources), - .resource = smsc911x_device_resources, -}; - -/* WEIM registers */ -#define CSGCR1 0x00 -#define CSGCR2 0x04 -#define CSRCR1 0x08 -#define CSRCR2 0x0C -#define CSWCR1 0x10 - -static void ccwmx51_init_ext_eth_mac(void) -{ - __iomem u32 *weim_vbaddr; - - weim_vbaddr = ioremap(WEIM_BASE_ADDR, SZ_4K); - if (weim_vbaddr == 0) { - printk(KERN_ERR "Unable to ioremap 0x%08x in %s\n", WEIM_BASE_ADDR, __func__); - return; - } - - /** Configure the CS timming, bus width, etc. - * 16 bit on DATA[31..16], not multiplexed, async - * RWSC=50, RADVA=2, RADVN=6, OEA=0, OEN=0, RCSA=0, RCSN=0, APR=0 - * WAL=0, WBED=1, WWSC=50, WADVA=2, WADVN=6, WEA=0, WEN=0, WCSA=0 - */ - writel(0x00420081, (unsigned int)(weim_vbaddr) + 0x78 + CSGCR1); - writel(0, (unsigned int)(weim_vbaddr) + 0x78 + CSGCR2); - writel(0x32260000, (unsigned int)(weim_vbaddr) + 0x78 + CSRCR1); - writel(0, (unsigned int)(weim_vbaddr) + 0x78 + CSRCR2); - writel(0x72080f00, (unsigned int)(weim_vbaddr) + 0x78 + CSWCR1); - - iounmap(weim_vbaddr); - - /* Configure interrupt line as GPIO input, the iomux should be already setup */ - gpio_request(IOMUX_TO_GPIO(MX51_PIN_GPIO1_9), "LAN2-irq"); - gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_GPIO1_9)); -} -#endif - -#if defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753) || defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753_MODULE) -struct platform_device mxc_wm8753_device = { - .name = "ccwmx51js", -}; -#endif - int __init mxc_register_gpios(void) { if (cpu_is_mx51()) @@ -1417,8 +1355,8 @@ int __init mxc_init_devices(void) mxc_init_scc_iram(); mxc_init_gpu2d(); -#if defined(CONFIG_SMSC9118) || defined(CONFIG_SMSC9118_MODULE) - ccwmx51_init_ext_eth_mac(); +#if defined (CONFIG_MACH_CCWMX51JS) + ccwmx51_init_devices(); #endif return 0; } diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h index e5effff9cedc..13b9c2838fd5 100644 --- a/arch/arm/mach-mx5/devices.h +++ b/arch/arm/mach-mx5/devices.h @@ -61,3 +61,4 @@ extern struct platform_device mxc_usbh1_device; extern struct platform_device mxc_usbh2_device; extern struct platform_device lcd_pdev; extern struct platform_device mxc_wm8753_device; +extern void __init ccwmx51_init_devices ( void ); diff --git a/arch/arm/mach-mx5/devices_ccwmx51.c b/arch/arm/mach-mx5/devices_ccwmx51.c index 539c421d094e..f8bc641320b4 100644 --- a/arch/arm/mach-mx5/devices_ccwmx51.c +++ b/arch/arm/mach-mx5/devices_ccwmx51.c @@ -231,6 +231,71 @@ struct mxc_w1_config mxc_w1_data = { }; #endif +#if defined(CONFIG_SMSC9118) || defined(CONFIG_SMSC9118_MODULE) + +static struct resource smsc911x_device_resources[] = { + { + .name = "smsc911x-memory", + .start = CS5_BASE_ADDR, + .end = CS5_BASE_ADDR + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = IOMUX_TO_IRQ(MX51_PIN_GPIO1_9), + .end = IOMUX_TO_IRQ(MX51_PIN_GPIO1_9), + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device smsc911x_device = { + .name = "smsc911x", + .id = -1, + .num_resources = ARRAY_SIZE(smsc911x_device_resources), + .resource = smsc911x_device_resources, +}; + +/* WEIM registers */ +#define CSGCR1 0x00 +#define CSGCR2 0x04 +#define CSRCR1 0x08 +#define CSRCR2 0x0C +#define CSWCR1 0x10 + +static void __init ccwmx51_init_ext_eth_mac(void) +{ + __iomem u32 *weim_vbaddr; + + weim_vbaddr = ioremap(WEIM_BASE_ADDR, SZ_4K); + if (weim_vbaddr == 0) { + printk(KERN_ERR "Unable to ioremap 0x%08x in %s\n", WEIM_BASE_ADDR, __func__); + return; + } + + /** Configure the CS timming, bus width, etc. + * 16 bit on DATA[31..16], not multiplexed, async + * RWSC=50, RADVA=2, RADVN=6, OEA=0, OEN=0, RCSA=0, RCSN=0, APR=0 + * WAL=0, WBED=1, WWSC=50, WADVA=2, WADVN=6, WEA=0, WEN=0, WCSA=0 + */ + writel(0x00420081, (unsigned int)(weim_vbaddr) + 0x78 + CSGCR1); + writel(0, (unsigned int)(weim_vbaddr) + 0x78 + CSGCR2); + writel(0x32260000, (unsigned int)(weim_vbaddr) + 0x78 + CSRCR1); + writel(0, (unsigned int)(weim_vbaddr) + 0x78 + CSRCR2); + writel(0x72080f00, (unsigned int)(weim_vbaddr) + 0x78 + CSWCR1); + + iounmap(weim_vbaddr); + + /* Configure interrupt line as GPIO input, the iomux should be already setup */ + gpio_request(IOMUX_TO_GPIO(MX51_PIN_GPIO1_9), "LAN2-irq"); + gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_GPIO1_9)); +} +#endif + +#if defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753) || defined(CONFIG_SND_SOC_IMX_CCWMX51_WM8753_MODULE) +struct platform_device mxc_wm8753_device = { + .name = "ccwmx51js", +}; +#endif + struct mxc_spdif_platform_data mxc_spdif_data = { .spdif_tx = 1, .spdif_rx = 0, @@ -381,3 +446,10 @@ int __init ccwmx51_init_fb(void) } device_initcall(ccwmx51_init_fb); #endif + +void __init ccwmx51_init_devices ( void ) +{ +#if defined(CONFIG_SMSC9118) || defined(CONFIG_SMSC9118_MODULE) + ccwmx51_init_ext_eth_mac(); +#endif +} diff --git a/arch/arm/mach-mx5/devices_ccwmx51.h b/arch/arm/mach-mx5/devices_ccwmx51.h index 1a5895a02778..7208099b6e2d 100644 --- a/arch/arm/mach-mx5/devices_ccwmx51.h +++ b/arch/arm/mach-mx5/devices_ccwmx51.h @@ -39,5 +39,6 @@ extern void ccwmx51_init_spidevices(void); extern int __init ccwmx51_init_fb(void); extern void __init ccwmx51_io_init(void); extern int __init ccwmx51_init_mc13892(void); +extern struct platform_device smsc911x_device; #endif /* DEVICES_CCWMX51_H_ */ -- cgit v1.2.3