Description: Moves the serial initialization data from serial.c to board-evm.c file. Signed-off-by: Sudhakar Rajashekhara <[EMAIL PROTECTED]> --- arch/arm/mach-davinci/board-evm.c | 48 ++++++++++++++++++++++++++++- arch/arm/mach-davinci/serial.c | 54 ++------------------------------- include/asm-arm/arch-davinci/common.h | 2 +- 3 files changed, 51 insertions(+), 53 deletions(-)
diff --git a/arch/arm/mach-davinci/board-evm.c b/arch/arm/mach-davinci/board-evm.c index 399bfea..6955208 100644 --- a/arch/arm/mach-davinci/board-evm.c +++ b/arch/arm/mach-davinci/board-evm.c @@ -15,6 +15,7 @@ #include <linux/platform_device.h> #include <linux/i2c.h> #include <linux/gpio.h> +#include <linux/serial_8250.h> #include <linux/i2c/pcf857x.h> #include <linux/leds.h> @@ -36,6 +37,7 @@ #include <asm/arch/common.h> #include <asm/arch/hardware.h> #include <asm/arch/psc.h> +#include <asm/arch/serial.h> /* other misc. init functions */ void __init davinci_psc_init(void); @@ -46,6 +48,49 @@ void __init davinci_init_common_hw(void); /* NOR Flash base address set to CS0 by default */ #define NOR_FLASH_PHYS 0x02000000 +#define DAVINCI_UART_CLK 27000000 + +static struct plat_serial8250_port serial_platform_data[] = { + { + .membase = (char *)IO_ADDRESS(DAVINCI_UART0_BASE), + .mapbase = (unsigned long)DAVINCI_UART0_BASE, + .irq = IRQ_UARTINT0, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 2, + .uartclk = DAVINCI_UART_CLK, + }, + { + .membase = (char *)IO_ADDRESS(DAVINCI_UART1_BASE), + .mapbase = (unsigned long)DAVINCI_UART1_BASE, + .irq = IRQ_UARTINT1, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 2, + .uartclk = DAVINCI_UART_CLK, + }, + { + .membase = (char *)IO_ADDRESS(DAVINCI_UART2_BASE), + .mapbase = (unsigned long)DAVINCI_UART2_BASE, + .irq = IRQ_UARTINT2, + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 2, + .uartclk = DAVINCI_UART_CLK, + }, + { + .flags = 0 + }, +}; + +static struct platform_device serial_device = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev = { + .platform_data = serial_platform_data, + }, +}; + static struct mtd_partition davinci_evm_norflash_partitions[] = { /* bootloader (U-Boot, etc) in first 4 sectors */ { @@ -411,6 +456,7 @@ static struct i2c_board_info __initdata i2c_info[] = { }; static struct platform_device *davinci_evm_devices[] __initdata = { + &serial_device, &davinci_evm_norflash_device, #if defined(CONFIG_MTD_NAND_DAVINCI) || defined(CONFIG_MTD_NAND_DAVINCI_MODULE) &davinci_evm_nandflash_device, @@ -437,6 +483,7 @@ static void __init davinci_evm_map_io(void) { davinci_map_common_io(); + davinci_serial_init(&serial_device); } static __init void davinci_evm_init(void) @@ -454,7 +501,6 @@ static __init void davinci_evm_init(void) i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); davinci_board_config = davinci_evm_config; davinci_board_config_size = ARRAY_SIZE(davinci_evm_config); - davinci_serial_init(); setup_usb(); } diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c index 4ebf63d..8e041d3 100644 --- a/arch/arm/mach-davinci/serial.c +++ b/arch/arm/mach-davinci/serial.c @@ -57,47 +57,6 @@ static inline void davinci_serial_outs(struct plat_serial8250_port *p, __raw_writew(value, p->membase + offset); } -static struct plat_serial8250_port serial_platform_data[] = { - { - .membase = (char *)IO_ADDRESS(DAVINCI_UART0_BASE), - .mapbase = (unsigned long)DAVINCI_UART0_BASE, - .irq = IRQ_UARTINT0, - .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, - .iotype = UPIO_MEM, - .regshift = 2, - .uartclk = 27000000, - }, - { - .membase = (char *)IO_ADDRESS(DAVINCI_UART1_BASE), - .mapbase = (unsigned long)DAVINCI_UART1_BASE, - .irq = IRQ_UARTINT1, - .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, - .iotype = UPIO_MEM, - .regshift = 2, - .uartclk = 27000000, - }, - { - .membase = (char *)IO_ADDRESS(DAVINCI_UART2_BASE), - .mapbase = (unsigned long)DAVINCI_UART2_BASE, - .irq = IRQ_UARTINT2, - .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, - .iotype = UPIO_MEM, - .regshift = 2, - .uartclk = 27000000, - }, - { - .flags = 0 - }, -}; - -static struct platform_device serial_device = { - .name = "serial8250", - .id = PLAT8250_DEV_PLATFORM, - .dev = { - .platform_data = serial_platform_data, - }, -}; - static void __init davinci_serial_reset(struct plat_serial8250_port *p) { /* reset both transmitter and receiver: bits 14,13 = UTRST, URRST */ @@ -113,13 +72,13 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p) davinci_serial_outs(p, UART_DAVINCI_PWREMU, pwremu); } -void __init davinci_serial_init(void) +void __init davinci_serial_init(struct platform_device *pdev) { int i; const struct davinci_uart_config *info; char name[16]; struct clk *uart_clk; - struct device *dev = &serial_device.dev; + struct device *dev = &pdev->dev; /* * Make sure the serial ports are muxed on at this point. @@ -133,7 +92,7 @@ void __init davinci_serial_init(void) return; for (i = 0; i < DAVINCI_MAX_NR_UARTS; i++) { - struct plat_serial8250_port *p = serial_platform_data + i; + struct plat_serial8250_port *p = dev->platform_data + i; if (!(info->enabled_uarts & (1 << i))) { p->membase = 0; @@ -152,10 +111,3 @@ void __init davinci_serial_init(void) } } } - -static int __init davinci_init(void) -{ - return platform_device_register(&serial_device); -} - -arch_initcall(davinci_init); diff --git a/include/asm-arm/arch-davinci/common.h b/include/asm-arm/arch-davinci/common.h index 090013f..70995b5 100644 --- a/include/asm-arm/arch-davinci/common.h +++ b/include/asm-arm/arch-davinci/common.h @@ -15,7 +15,7 @@ struct sys_timer; extern struct sys_timer davinci_timer; -extern void davinci_serial_init(void); +extern void davinci_serial_init(struct platform_device *pdev); extern const u8 *davinci_def_priorities; extern void davinci_irq_init(void); extern void davinci_psc_config(unsigned int domain, unsigned int id, -- 1.5.4.1 _______________________________________________ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source