[ARM] 5374/1: The w90p910 uart0 driver patch
Add W90P910 UART0 support,the W90P910 UART0 is 8250 series. Signed-off-by: Wan ZongShun <mcuos.com@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
committed by
Russell King
parent
b74788d8c1
commit
17198f2d68
@@ -43,6 +43,7 @@ extern void w90p910_init_io(struct map_desc *mach_desc, int size);
|
|||||||
extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no);
|
extern void w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no);
|
||||||
extern void w90p910_init_clocks(int xtal);
|
extern void w90p910_init_clocks(int xtal);
|
||||||
extern void w90p910_map_io(struct map_desc *mach_desc, int size);
|
extern void w90p910_map_io(struct map_desc *mach_desc, int size);
|
||||||
|
extern struct platform_device w90p910_serial_device;
|
||||||
extern struct sys_timer w90x900_timer;
|
extern struct sys_timer w90x900_timer;
|
||||||
|
|
||||||
#define W90X900_RES(name) \
|
#define W90X900_RES(name) \
|
||||||
@@ -67,11 +68,13 @@ struct platform_device w90x900_##devname = { \
|
|||||||
.resource = w90x900_##regname##_resource, \
|
.resource = w90x900_##regname##_resource, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define W90X900_UARTCFG(port, flag, uc, ulc, ufc) \
|
#define W90X900_8250PORT(name) \
|
||||||
{ \
|
{ \
|
||||||
.hwport = port, \
|
.membase = name##_BA, \
|
||||||
.flags = flag, \
|
.mapbase = name##_PA, \
|
||||||
.ucon = uc, \
|
.irq = IRQ_##name, \
|
||||||
.ulcon = ulc, \
|
.uartclk = 11313600, \
|
||||||
.ufcon = ufc, \
|
.regshift = 2, \
|
||||||
|
.iotype = UPIO_MEM, \
|
||||||
|
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
|
||||||
}
|
}
|
||||||
|
@@ -36,24 +36,16 @@
|
|||||||
static struct map_desc w90p910_iodesc[] __initdata = {
|
static struct map_desc w90p910_iodesc[] __initdata = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct w90x900_uartcfg w90p910_uartcfgs[] = {
|
|
||||||
W90X900_UARTCFG(0, 0, 0, 0, 0),
|
|
||||||
W90X900_UARTCFG(1, 0, 0, 0, 0),
|
|
||||||
W90X900_UARTCFG(2, 0, 0, 0, 0),
|
|
||||||
W90X900_UARTCFG(3, 0, 0, 0, 0),
|
|
||||||
W90X900_UARTCFG(4, 0, 0, 0, 0),
|
|
||||||
};
|
|
||||||
|
|
||||||
/*Here should be your evb resourse,such as LCD*/
|
/*Here should be your evb resourse,such as LCD*/
|
||||||
|
|
||||||
static struct platform_device *w90p910evb_dev[] __initdata = {
|
static struct platform_device *w90p910evb_dev[] __initdata = {
|
||||||
|
&w90p910_serial_device,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init w90p910evb_map_io(void)
|
static void __init w90p910evb_map_io(void)
|
||||||
{
|
{
|
||||||
w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
|
w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
|
||||||
w90p910_init_clocks(0);
|
w90p910_init_clocks(0);
|
||||||
w90p910_init_uarts(w90p910_uartcfgs, ARRAY_SIZE(w90p910_uartcfgs));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init w90p910evb_init(void)
|
static void __init w90p910evb_init(void)
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
#include <linux/serial_8250.h>
|
||||||
|
|
||||||
#include <asm/mach/arch.h>
|
#include <asm/mach/arch.h>
|
||||||
#include <asm/mach/map.h>
|
#include <asm/mach/map.h>
|
||||||
@@ -36,12 +37,6 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
/*W90P910 has five uarts*/
|
|
||||||
|
|
||||||
#define MAX_UART_COUNT 5
|
|
||||||
static int uart_count;
|
|
||||||
static struct platform_device *uart_devs[MAX_UART_COUNT-1];
|
|
||||||
|
|
||||||
/* Initial IO mappings */
|
/* Initial IO mappings */
|
||||||
|
|
||||||
static struct map_desc w90p910_iodesc[] __initdata = {
|
static struct map_desc w90p910_iodesc[] __initdata = {
|
||||||
@@ -53,48 +48,19 @@ static struct map_desc w90p910_iodesc[] __initdata = {
|
|||||||
/*IODESC_ENT(LCD),*/
|
/*IODESC_ENT(LCD),*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Init the dev resource*/
|
/* Initial serial platform data */
|
||||||
|
|
||||||
static W90X900_RES(UART0);
|
struct plat_serial8250_port w90p910_uart_data[] = {
|
||||||
static W90X900_RES(UART1);
|
W90X900_8250PORT(UART0),
|
||||||
static W90X900_RES(UART2);
|
|
||||||
static W90X900_RES(UART3);
|
|
||||||
static W90X900_RES(UART4);
|
|
||||||
static W90X900_DEVICE(uart0, UART0, 0, "w90x900-uart");
|
|
||||||
static W90X900_DEVICE(uart1, UART1, 1, "w90x900-uart");
|
|
||||||
static W90X900_DEVICE(uart2, UART2, 2, "w90x900-uart");
|
|
||||||
static W90X900_DEVICE(uart3, UART3, 3, "w90x900-uart");
|
|
||||||
static W90X900_DEVICE(uart4, UART4, 4, "w90x900-uart");
|
|
||||||
|
|
||||||
static struct platform_device *uart_devices[] __initdata = {
|
|
||||||
&w90x900_uart0,
|
|
||||||
&w90x900_uart1,
|
|
||||||
&w90x900_uart2,
|
|
||||||
&w90x900_uart3,
|
|
||||||
&w90x900_uart4
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Init W90P910 uart device*/
|
struct platform_device w90p910_serial_device = {
|
||||||
|
.name = "serial8250",
|
||||||
void __init w90p910_init_uarts(struct w90x900_uartcfg *cfg, int no)
|
.id = PLAT8250_DEV_PLATFORM,
|
||||||
{
|
.dev = {
|
||||||
struct platform_device *platdev;
|
.platform_data = w90p910_uart_data,
|
||||||
int uart, uartdev;
|
},
|
||||||
|
};
|
||||||
/*By min() to judge count of uart be used indeed*/
|
|
||||||
|
|
||||||
uartdev = ARRAY_SIZE(uart_devices);
|
|
||||||
no = min(uartdev, no);
|
|
||||||
|
|
||||||
for (uart = 0; uart < no; uart++, cfg++) {
|
|
||||||
if (cfg->hwport != uart)
|
|
||||||
printk(KERN_ERR "w90x900_uartcfg[%d] error\n", uart);
|
|
||||||
platdev = uart_devices[cfg->hwport];
|
|
||||||
uart_devs[uart] = platdev;
|
|
||||||
platdev->dev.platform_data = cfg;
|
|
||||||
}
|
|
||||||
uart_count = uart;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Init W90P910 evb io*/
|
/*Init W90P910 evb io*/
|
||||||
|
|
||||||
@@ -122,13 +88,6 @@ static int __init w90p910_init_cpu(void)
|
|||||||
|
|
||||||
static int __init w90x900_arch_init(void)
|
static int __init w90x900_arch_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
return w90p910_init_cpu();
|
||||||
|
|
||||||
ret = w90p910_init_cpu();
|
|
||||||
if (ret != 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return platform_add_devices(uart_devs, uart_count);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
arch_initcall(w90x900_arch_init);
|
arch_initcall(w90x900_arch_init);
|
||||||
|
Reference in New Issue
Block a user