Commit c1a6f123 authored by Vladimir Barinov's avatar Vladimir Barinov Committed by Sascha Hauer

MX27ADS: setup all pins at once in one table

Setup all pins at once in one table
Signed-off-by: default avatarVladimir Barinov <vbarinov@embeddedalley.com>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 3211705f
...@@ -36,148 +36,38 @@ ...@@ -36,148 +36,38 @@
#include "devices.h" #include "devices.h"
/* ADS's NOR flash */ static unsigned int mx27ads_pins[] = {
static struct physmap_flash_data mx27ads_flash_data = { /* UART0 */
.width = 2,
};
static struct resource mx27ads_flash_resource = {
.start = 0xc0000000,
.end = 0xc0000000 + 0x02000000 - 1,
.flags = IORESOURCE_MEM,
};
static struct platform_device mx27ads_nor_mtd_device = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &mx27ads_flash_data,
},
.num_resources = 1,
.resource = &mx27ads_flash_resource,
};
static int mxc_uart0_pins[] = {
PE12_PF_UART1_TXD, PE12_PF_UART1_TXD,
PE13_PF_UART1_RXD, PE13_PF_UART1_RXD,
PE14_PF_UART1_CTS, PE14_PF_UART1_CTS,
PE15_PF_UART1_RTS PE15_PF_UART1_RTS,
}; /* UART1 */
static int uart_mxc_port0_init(struct platform_device *pdev)
{
return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
ARRAY_SIZE(mxc_uart0_pins), "UART0");
}
static void uart_mxc_port0_exit(struct platform_device *pdev)
{
mxc_gpio_release_multiple_pins(mxc_uart0_pins,
ARRAY_SIZE(mxc_uart0_pins));
}
static int mxc_uart1_pins[] = {
PE3_PF_UART2_CTS, PE3_PF_UART2_CTS,
PE4_PF_UART2_RTS, PE4_PF_UART2_RTS,
PE6_PF_UART2_TXD, PE6_PF_UART2_TXD,
PE7_PF_UART2_RXD PE7_PF_UART2_RXD,
}; /* UART2 */
static int uart_mxc_port1_init(struct platform_device *pdev)
{
return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
ARRAY_SIZE(mxc_uart1_pins), "UART1");
}
static void uart_mxc_port1_exit(struct platform_device *pdev)
{
mxc_gpio_release_multiple_pins(mxc_uart1_pins,
ARRAY_SIZE(mxc_uart1_pins));
}
static int mxc_uart2_pins[] = {
PE8_PF_UART3_TXD, PE8_PF_UART3_TXD,
PE9_PF_UART3_RXD, PE9_PF_UART3_RXD,
PE10_PF_UART3_CTS, PE10_PF_UART3_CTS,
PE11_PF_UART3_RTS PE11_PF_UART3_RTS,
}; /* UART3 */
static int uart_mxc_port2_init(struct platform_device *pdev)
{
return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
ARRAY_SIZE(mxc_uart2_pins), "UART2");
}
static void uart_mxc_port2_exit(struct platform_device *pdev)
{
mxc_gpio_release_multiple_pins(mxc_uart2_pins,
ARRAY_SIZE(mxc_uart2_pins));
}
static int mxc_uart3_pins[] = {
PB26_AF_UART4_RTS, PB26_AF_UART4_RTS,
PB28_AF_UART4_TXD, PB28_AF_UART4_TXD,
PB29_AF_UART4_CTS, PB29_AF_UART4_CTS,
PB31_AF_UART4_RXD PB31_AF_UART4_RXD,
}; /* UART4 */
static int uart_mxc_port3_init(struct platform_device *pdev)
{
return mxc_gpio_setup_multiple_pins(mxc_uart3_pins,
ARRAY_SIZE(mxc_uart3_pins), "UART3");
}
static void uart_mxc_port3_exit(struct platform_device *pdev)
{
mxc_gpio_release_multiple_pins(mxc_uart3_pins,
ARRAY_SIZE(mxc_uart3_pins));
}
static int mxc_uart4_pins[] = {
PB18_AF_UART5_TXD, PB18_AF_UART5_TXD,
PB19_AF_UART5_RXD, PB19_AF_UART5_RXD,
PB20_AF_UART5_CTS, PB20_AF_UART5_CTS,
PB21_AF_UART5_RTS PB21_AF_UART5_RTS,
}; /* UART5 */
static int uart_mxc_port4_init(struct platform_device *pdev)
{
return mxc_gpio_setup_multiple_pins(mxc_uart4_pins,
ARRAY_SIZE(mxc_uart4_pins), "UART4");
}
static void uart_mxc_port4_exit(struct platform_device *pdev)
{
mxc_gpio_release_multiple_pins(mxc_uart4_pins,
ARRAY_SIZE(mxc_uart4_pins));
}
static int mxc_uart5_pins[] = {
PB10_AF_UART6_TXD, PB10_AF_UART6_TXD,
PB12_AF_UART6_CTS, PB12_AF_UART6_CTS,
PB11_AF_UART6_RXD, PB11_AF_UART6_RXD,
PB13_AF_UART6_RTS PB13_AF_UART6_RTS,
}; /* FEC */
static int uart_mxc_port5_init(struct platform_device *pdev)
{
return mxc_gpio_setup_multiple_pins(mxc_uart5_pins,
ARRAY_SIZE(mxc_uart5_pins), "UART5");
}
static void uart_mxc_port5_exit(struct platform_device *pdev)
{
mxc_gpio_release_multiple_pins(mxc_uart5_pins,
ARRAY_SIZE(mxc_uart5_pins));
}
static struct platform_device *platform_devices[] __initdata = {
&mx27ads_nor_mtd_device,
&mxc_fec_device,
};
static int mxc_fec_pins[] = {
PD0_AIN_FEC_TXD0, PD0_AIN_FEC_TXD0,
PD1_AIN_FEC_TXD1, PD1_AIN_FEC_TXD1,
PD2_AIN_FEC_TXD2, PD2_AIN_FEC_TXD2,
...@@ -195,46 +85,56 @@ static int mxc_fec_pins[] = { ...@@ -195,46 +85,56 @@ static int mxc_fec_pins[] = {
PD14_AOUT_FEC_RX_CLK, PD14_AOUT_FEC_RX_CLK,
PD15_AOUT_FEC_COL, PD15_AOUT_FEC_COL,
PD16_AIN_FEC_TX_ER, PD16_AIN_FEC_TX_ER,
PF23_AIN_FEC_TX_EN PF23_AIN_FEC_TX_EN,
}; };
static void gpio_fec_active(void) /* ADS's NOR flash */
{ static struct physmap_flash_data mx27ads_flash_data = {
mxc_gpio_setup_multiple_pins(mxc_fec_pins, .width = 2,
ARRAY_SIZE(mxc_fec_pins), "FEC"); };
}
static struct resource mx27ads_flash_resource = {
.start = 0xc0000000,
.end = 0xc0000000 + 0x02000000 - 1,
.flags = IORESOURCE_MEM,
};
static struct platform_device mx27ads_nor_mtd_device = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &mx27ads_flash_data,
},
.num_resources = 1,
.resource = &mx27ads_flash_resource,
};
static struct platform_device *platform_devices[] __initdata = {
&mx27ads_nor_mtd_device,
&mxc_fec_device,
};
static struct imxuart_platform_data uart_pdata[] = { static struct imxuart_platform_data uart_pdata[] = {
{ {
.init = uart_mxc_port0_init,
.exit = uart_mxc_port0_exit,
.flags = IMXUART_HAVE_RTSCTS, .flags = IMXUART_HAVE_RTSCTS,
}, { }, {
.init = uart_mxc_port1_init,
.exit = uart_mxc_port1_exit,
.flags = IMXUART_HAVE_RTSCTS, .flags = IMXUART_HAVE_RTSCTS,
}, { }, {
.init = uart_mxc_port2_init,
.exit = uart_mxc_port2_exit,
.flags = IMXUART_HAVE_RTSCTS, .flags = IMXUART_HAVE_RTSCTS,
}, { }, {
.init = uart_mxc_port3_init,
.exit = uart_mxc_port3_exit,
.flags = IMXUART_HAVE_RTSCTS, .flags = IMXUART_HAVE_RTSCTS,
}, { }, {
.init = uart_mxc_port4_init,
.exit = uart_mxc_port4_exit,
.flags = IMXUART_HAVE_RTSCTS, .flags = IMXUART_HAVE_RTSCTS,
}, { }, {
.init = uart_mxc_port5_init,
.exit = uart_mxc_port5_exit,
.flags = IMXUART_HAVE_RTSCTS, .flags = IMXUART_HAVE_RTSCTS,
}, },
}; };
static void __init mx27ads_board_init(void) static void __init mx27ads_board_init(void)
{ {
gpio_fec_active(); mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins),
"mx27ads");
mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment