i.MX2: make SoC devices globally available

Make SoC devices globally available to boards rather than using
a device specific init function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2008-09-09 10:19:41 +02:00
parent 5cf0942123
commit 7e90534a8f
4 changed files with 34 additions and 52 deletions

View file

@ -0,0 +1,15 @@
extern struct platform_device mxc_gpt1;
extern struct platform_device mxc_gpt2;
extern struct platform_device mxc_gpt3;
extern struct platform_device mxc_gpt4;
extern struct platform_device mxc_gpt5;
extern struct platform_device mxc_wdt;
extern struct platform_device mxc_irda_device;
extern struct platform_device mxc_uart_device0;
extern struct platform_device mxc_uart_device1;
extern struct platform_device mxc_uart_device2;
extern struct platform_device mxc_uart_device3;
extern struct platform_device mxc_uart_device4;
extern struct platform_device mxc_uart_device5;

View file

@ -34,6 +34,8 @@
#include <mach/iomux-mx1-mx2.h>
#include <mach/board-mx27ads.h>
#include "devices.h"
/* ADS's NOR flash */
static struct physmap_flash_data mx27ads_flash_data = {
.width = 2,
@ -251,12 +253,14 @@ static struct imxuart_platform_data uart_pdata[] = {
static void __init mx27ads_board_init(void)
{
int i;
gpio_fec_active();
for (i = 0; i < 6; i++)
imx_init_uart(i, &uart_pdata[i]);
mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
mxc_register_device(&mxc_uart_device3, &uart_pdata[3]);
mxc_register_device(&mxc_uart_device4, &uart_pdata[4]);
mxc_register_device(&mxc_uart_device5, &uart_pdata[5]);
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
}

View file

@ -28,6 +28,8 @@
#include <mach/imx-uart.h>
#include <mach/board-pcm038.h>
#include "devices.h"
/*
* Phytec's phyCORE-i.MX27 comes with 32MiB flash,
* 16 bit width
@ -170,11 +172,11 @@ static struct platform_device *platform_devices[] __initdata = {
static void __init pcm038_init(void)
{
int i;
gpio_fec_active();
for (i = 0; i < 3; i++)
imx_init_uart(i, &uart_pdata[i]);
mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));

View file

@ -35,7 +35,7 @@ static struct resource uart0[] = {
},
};
static struct platform_device mxc_uart_device0 = {
struct platform_device mxc_uart_device0 = {
.name = "imx-uart",
.id = 0,
.resource = uart0,
@ -54,7 +54,7 @@ static struct resource uart1[] = {
},
};
static struct platform_device mxc_uart_device1 = {
struct platform_device mxc_uart_device1 = {
.name = "imx-uart",
.id = 1,
.resource = uart1,
@ -73,7 +73,7 @@ static struct resource uart2[] = {
},
};
static struct platform_device mxc_uart_device2 = {
struct platform_device mxc_uart_device2 = {
.name = "imx-uart",
.id = 2,
.resource = uart2,
@ -92,7 +92,7 @@ static struct resource uart3[] = {
},
};
static struct platform_device mxc_uart_device3 = {
struct platform_device mxc_uart_device3 = {
.name = "imx-uart",
.id = 3,
.resource = uart3,
@ -111,7 +111,7 @@ static struct resource uart4[] = {
},
};
static struct platform_device mxc_uart_device4 = {
struct platform_device mxc_uart_device4 = {
.name = "imx-uart",
.id = 4,
.resource = uart4,
@ -130,48 +130,9 @@ static struct resource uart5[] = {
},
};
static struct platform_device mxc_uart_device5 = {
struct platform_device mxc_uart_device5 = {
.name = "imx-uart",
.id = 5,
.resource = uart5,
.num_resources = ARRAY_SIZE(uart5),
};
/*
* Register only those UARTs that physically exists
*/
int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata)
{
switch (uart_no) {
case 0:
mxc_uart_device0.dev.platform_data = pdata;
platform_device_register(&mxc_uart_device0);
break;
case 1:
mxc_uart_device1.dev.platform_data = pdata;
platform_device_register(&mxc_uart_device1);
break;
#ifndef CONFIG_MXC_IRDA
case 2:
mxc_uart_device2.dev.platform_data = pdata;
platform_device_register(&mxc_uart_device2);
break;
#endif
case 3:
mxc_uart_device3.dev.platform_data = pdata;
platform_device_register(&mxc_uart_device3);
break;
case 4:
mxc_uart_device4.dev.platform_data = pdata;
platform_device_register(&mxc_uart_device4);
break;
case 5:
mxc_uart_device5.dev.platform_data = pdata;
platform_device_register(&mxc_uart_device5);
break;
default:
return -ENODEV;
}
return 0;
}