Skip to content

Commit

Permalink
ARM: imx: dynamically register imx-uart devices (imx31)
Browse files Browse the repository at this point in the history
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  • Loading branch information
Uwe Kleine-König committed Jun 30, 2010
1 parent d5dac4a commit 16cf5c4
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 90 deletions.
9 changes: 9 additions & 0 deletions arch/arm/mach-mx3/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ config MACH_MX31ADS
bool "Support MX31ADS platforms"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_I2C
select IMX_HAVE_PLATFORM_IMX_UART
default y
help
Include support for MX31ADS platform. This includes specific
Expand All @@ -36,6 +37,7 @@ config MACH_PCM037
bool "Support Phytec pcm037 (i.MX31) platforms"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_I2C
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_MXC_NAND
select MXC_ULPI if USB_ULPI
help
Expand All @@ -55,6 +57,7 @@ config MACH_MX31LITE
bool "Support MX31 LITEKIT (LogicPD)"
select ARCH_MX31
select MXC_ULPI if USB_ULPI
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_MXC_NAND
select IMX_HAVE_PLATFORM_SPI_IMX
help
Expand All @@ -64,6 +67,7 @@ config MACH_MX31LITE
config MACH_MX31_3DS
bool "Support MX31PDK (3DS)"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_MXC_NAND
select IMX_HAVE_PLATFORM_SPI_IMX
help
Expand All @@ -83,6 +87,7 @@ config MACH_MX31MOBOARD
bool "Support mx31moboard platforms (EPFL Mobots group)"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_I2C
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_SPI_IMX
select MXC_ULPI if USB_ULPI
help
Expand All @@ -92,6 +97,7 @@ config MACH_MX31MOBOARD
config MACH_MX31LILLY
bool "Support MX31 LILLY-1131 platforms (INCO startec)"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_SPI_IMX
select MXC_ULPI if USB_ULPI
help
Expand All @@ -101,6 +107,7 @@ config MACH_MX31LILLY
config MACH_QONG
bool "Support Dave/DENX QongEVB-LITE platform"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_UART
help
Include support for Dave/DENX QongEVB-LITE platform. This includes
specific configurations for the board and its peripherals.
Expand All @@ -119,6 +126,7 @@ config MACH_ARMADILLO5X0
bool "Support Atmark Armadillo-500 Development Base Board"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_I2C
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_MXC_NAND
select MXC_ULPI if USB_ULPI
help
Expand All @@ -136,6 +144,7 @@ config MACH_MX35_3DS
config MACH_KZM_ARM11_01
bool "Support KZM-ARM11-01(Kyoto Microcomputer)"
select ARCH_MX31
select IMX_HAVE_PLATFORM_IMX_UART
help
Include support for KZM-ARM11-01. This includes specific
configurations for the board and its peripherals.
Expand Down
11 changes: 11 additions & 0 deletions arch/arm/mach-mx3/devices-imx31.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
#define imx31_add_imx_i2c2(pdata) \
imx_add_imx_i2c(2, MX31_I2C3_BASE_ADDR, SZ_4K, MX31_INT_I2C3, pdata)

#define imx31_add_imx_uart0(pdata) \
imx_add_imx_uart_1irq(0, MX31_UART1_BASE_ADDR, SZ_16K, MX31_INT_UART1, pdata)
#define imx31_add_imx_uart1(pdata) \
imx_add_imx_uart_1irq(1, MX31_UART2_BASE_ADDR, SZ_16K, MX31_INT_UART2, pdata)
#define imx31_add_imx_uart2(pdata) \
imx_add_imx_uart_1irq(2, MX31_UART3_BASE_ADDR, SZ_16K, MX31_INT_UART3, pdata)
#define imx31_add_imx_uart3(pdata) \
imx_add_imx_uart_1irq(3, MX31_UART4_BASE_ADDR, SZ_16K, MX31_INT_UART4, pdata)
#define imx31_add_imx_uart4(pdata) \
imx_add_imx_uart_1irq(4, MX31_UART5_BASE_ADDR, SZ_16K, MX31_INT_UART5, pdata)

#define imx31_add_mxc_nand(pdata) \
imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata)

Expand Down
43 changes: 2 additions & 41 deletions arch/arm/mach-mx3/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
#include <mach/hardware.h>
#include <mach/irqs.h>
#include <mach/common.h>
#include <mach/imx-uart.h>
#include <mach/mx3_camera.h>

#include "devices.h"

#if defined(CONFIG_ARCH_MX35)
static struct resource uart0[] = {
{
.start = UART1_BASE_ADDR,
Expand Down Expand Up @@ -86,46 +86,7 @@ struct platform_device mxc_uart_device2 = {
.resource = uart2,
.num_resources = ARRAY_SIZE(uart2),
};

#ifdef CONFIG_ARCH_MX31
static struct resource uart3[] = {
{
.start = UART4_BASE_ADDR,
.end = UART4_BASE_ADDR + 0x0B5,
.flags = IORESOURCE_MEM,
}, {
.start = MXC_INT_UART4,
.end = MXC_INT_UART4,
.flags = IORESOURCE_IRQ,
},
};

struct platform_device mxc_uart_device3 = {
.name = "imx-uart",
.id = 3,
.resource = uart3,
.num_resources = ARRAY_SIZE(uart3),
};

static struct resource uart4[] = {
{
.start = UART5_BASE_ADDR,
.end = UART5_BASE_ADDR + 0x0B5,
.flags = IORESOURCE_MEM,
}, {
.start = MXC_INT_UART5,
.end = MXC_INT_UART5,
.flags = IORESOURCE_IRQ,
},
};

struct platform_device mxc_uart_device4 = {
.name = "imx-uart",
.id = 4,
.resource = uart4,
.num_resources = ARRAY_SIZE(uart4),
};
#endif /* CONFIG_ARCH_MX31 */
#endif

/* GPIO port description */
static struct mxc_gpio_port imx_gpio_ports[] = {
Expand Down
5 changes: 2 additions & 3 deletions arch/arm/mach-mx3/devices.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

#if defined(CONFIG_ARCH_MX35)
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;
#endif
extern struct platform_device mxc_w1_master_device;
extern struct platform_device mx3_ipu;
extern struct platform_device mx3_fb;
Expand Down
7 changes: 3 additions & 4 deletions arch/arm/mach-mx3/mach-armadillo5x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include <asm/mach/map.h>

#include <mach/common.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
#include <mach/mmc.h>
#include <mach/ipu.h>
Expand Down Expand Up @@ -493,7 +492,7 @@ static struct platform_device armadillo5x0_smc911x_device = {
};

/* UART device data */
static struct imxuart_platform_data uart_pdata = {
static const struct imxuart_platform_data uart_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};

Expand All @@ -514,8 +513,8 @@ static void __init armadillo5x0_init(void)
imx31_add_imx_i2c1(NULL);

/* Register UART */
mxc_register_device(&mxc_uart_device0, &uart_pdata);
mxc_register_device(&mxc_uart_device1, &uart_pdata);
imx31_add_imx_uart0(&uart_pdata);
imx31_add_imx_uart1(&uart_pdata);

/* SMSC9118 IRQ pin */
gpio_direction_input(MX31_PIN_GPIO1_0);
Expand Down
9 changes: 4 additions & 5 deletions arch/arm/mach-mx3/mach-kzm_arm11_01.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@

#include <mach/clock.h>
#include <mach/common.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
#include <mach/memory.h>

#include "devices-imx31.h"
#include "devices.h"

#define KZM_ARM11_IO_ADDRESS(x) ( \
Expand Down Expand Up @@ -185,15 +185,14 @@ static inline int kzm_init_smsc9118(void)
#endif

#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
static struct imxuart_platform_data uart_pdata = {
static const struct imxuart_platform_data uart_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};

static void __init kzm_init_imx_uart(void)
{
mxc_register_device(&mxc_uart_device0, &uart_pdata);

mxc_register_device(&mxc_uart_device1, &uart_pdata);
imx31_add_imx_uart0(&uart_pdata);
imx31_add_imx_uart1(&uart_pdata);
}
#else
static inline void kzm_init_imx_uart(void)
Expand Down
5 changes: 2 additions & 3 deletions arch/arm/mach-mx3/mach-mx31_3ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <asm/memory.h>
#include <asm/mach/map.h>
#include <mach/common.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>

#include "devices-imx31.h"
Expand Down Expand Up @@ -233,7 +232,7 @@ static struct fsl_usb2_platform_data usbotg_pdata = {
.phy_mode = FSL_USB2_PHY_ULPI,
};

static struct imxuart_platform_data uart_pdata = {
static const struct imxuart_platform_data uart_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};

Expand Down Expand Up @@ -415,7 +414,7 @@ static void __init mxc_board_init(void)
mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins),
"mx31_3ds");

mxc_register_device(&mxc_uart_device0, &uart_pdata);
imx31_add_imx_uart0(&uart_pdata);
imx31_add_mxc_nand(&mx31_3ds_nand_board_info);

imx31_add_spi_imx0(&spi1_pdata);
Expand Down
5 changes: 2 additions & 3 deletions arch/arm/mach-mx3/mach-mx31ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <asm/memory.h>
#include <asm/mach/map.h>
#include <mach/common.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>

#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
Expand Down Expand Up @@ -124,7 +123,7 @@ static inline int mxc_init_extuart(void)
#endif

#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
static struct imxuart_platform_data uart_pdata = {
static const struct imxuart_platform_data uart_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};

Expand All @@ -138,7 +137,7 @@ static unsigned int uart_pins[] = {
static inline void mxc_init_imx_uart(void)
{
mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins), "uart-0");
mxc_register_device(&mxc_uart_device0, &uart_pdata);
imx31_add_imx_uart0(&uart_pdata);
}
#else /* !SERIAL_IMX */
static inline void mxc_init_imx_uart(void)
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-mx3/mach-mx31lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <mach/hardware.h>
#include <mach/common.h>
#include <mach/board-mx31lite.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
#include <mach/irqs.h>
#include <mach/mxc_ehci.h>
Expand Down
10 changes: 4 additions & 6 deletions arch/arm/mach-mx3/mach-mx31moboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <mach/board-mx31moboard.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
#include <mach/ipu.h>
#include <mach/mmc.h>
Expand Down Expand Up @@ -131,11 +130,11 @@ static int moboard_uart0_init(struct platform_device *pdev)
return 0;
}

static struct imxuart_platform_data uart0_pdata = {
static const struct imxuart_platform_data uart0_pdata __initconst = {
.init = moboard_uart0_init,
};

static struct imxuart_platform_data uart4_pdata = {
static const struct imxuart_platform_data uart4_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};

Expand Down Expand Up @@ -495,9 +494,8 @@ static void __init mxc_board_init(void)

platform_add_devices(devices, ARRAY_SIZE(devices));

mxc_register_device(&mxc_uart_device0, &uart0_pdata);

mxc_register_device(&mxc_uart_device4, &uart4_pdata);
imx31_add_imx_uart0(&uart0_pdata);
imx31_add_imx_uart4(&uart4_pdata);

imx31_add_imx_i2c0(&moboard_i2c0_data);
imx31_add_imx_i2c1(&moboard_i2c1_data);
Expand Down
10 changes: 5 additions & 5 deletions arch/arm/mach-mx3/mach-pcm037.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include <asm/mach/map.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
#include <mach/ipu.h>
#include <mach/mmc.h>
Expand Down Expand Up @@ -219,7 +218,7 @@ static struct platform_device pcm037_flash = {
.num_resources = 1,
};

static struct imxuart_platform_data uart_pdata = {
static const struct imxuart_platform_data uart_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};

Expand Down Expand Up @@ -609,9 +608,10 @@ static void __init mxc_board_init(void)

platform_add_devices(devices, ARRAY_SIZE(devices));

mxc_register_device(&mxc_uart_device0, &uart_pdata);
mxc_register_device(&mxc_uart_device1, &uart_pdata);
mxc_register_device(&mxc_uart_device2, &uart_pdata);
imx31_add_imx_uart0(&uart_pdata);
/* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */
imx31_add_imx_uart1(&uart_pdata);
imx31_add_imx_uart2(&uart_pdata);

mxc_register_device(&mxc_w1_master_device, NULL);

Expand Down
9 changes: 5 additions & 4 deletions arch/arm/mach-mx3/mach-qong.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
#include <mach/common.h>
#include <asm/page.h>
#include <asm/setup.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>

#include "devices-imx31.h"
#include "devices.h"

/* FPGA defines */
Expand All @@ -57,7 +58,7 @@
* This file contains the board-specific initialization routines.
*/

static struct imxuart_platform_data uart_pdata = {
static const struct imxuart_platform_data uart_pdata __initconst = {
.flags = IMXUART_HAVE_RTSCTS,
};

Expand All @@ -68,11 +69,11 @@ static int uart_pins[] = {
MX31_PIN_RXD1__RXD1
};

static inline void mxc_init_imx_uart(void)
static inline void __init mxc_init_imx_uart(void)
{
mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins),
"uart-0");
mxc_register_device(&mxc_uart_device0, &uart_pdata);
imx31_add_imx_uart0(&uart_pdata);
}

static struct resource dnet_resources[] = {
Expand Down
Loading

0 comments on commit 16cf5c4

Please sign in to comment.