add a ns16550 registration helper and use it
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
ddf349e011
commit
90c35f44f1
|
@ -100,13 +100,6 @@ static struct NS16550_plat quad_uart_serial_plat = {
|
|||
#define QUART_OFFSET 0x1000000
|
||||
#endif
|
||||
|
||||
static struct device_d quad_uart_serial_device = {
|
||||
.id = -1,
|
||||
.name = "serial_ns16550",
|
||||
.map_base = IMX_CS3_BASE + QUART_OFFSET,
|
||||
.size = 0xF,
|
||||
.platform_data = (void *)&quad_uart_serial_plat,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct i2c_board_info i2c_devices[] = {
|
||||
|
@ -295,7 +288,8 @@ static int eukrea_cpuimx27_console_init(void)
|
|||
CS3L = 0x0D1D0D01;
|
||||
CS3A = 0x00D20000;
|
||||
#ifdef CONFIG_DRIVER_SERIAL_NS16550
|
||||
register_device(&quad_uart_serial_device);
|
||||
add_ns16550_device(-1, IMX_CS3_BASE + QUART_OFFSET, 0xf,
|
||||
&quad_uart_serial_plat);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -242,14 +242,6 @@ static struct NS16550_plat serial_plat = {
|
|||
.reg_write = omap_uart_write,
|
||||
};
|
||||
|
||||
static struct device_d beagle_serial_device = {
|
||||
.id = -1,
|
||||
.name = "serial_ns16550",
|
||||
.map_base = OMAP_UART3_BASE,
|
||||
.size = 1024,
|
||||
.platform_data = (void *)&serial_plat,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief UART serial port initialization - remember to enable COM clocks in
|
||||
* arch
|
||||
|
@ -259,7 +251,9 @@ static struct device_d beagle_serial_device = {
|
|||
static int beagle_console_init(void)
|
||||
{
|
||||
/* Register the serial port */
|
||||
return register_device(&beagle_serial_device);
|
||||
add_ns16550_device(-1, OMAP_UART3_BASE, 1024, &serial_plat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
console_initcall(beagle_console_init);
|
||||
#endif /* CONFIG_DRIVER_SERIAL_NS16550 */
|
||||
|
|
|
@ -218,18 +218,6 @@ static struct NS16550_plat serial_plat = {
|
|||
.reg_write = omap_uart_write,
|
||||
};
|
||||
|
||||
static struct device_d omap3evm_serial_device = {
|
||||
.id = -1,
|
||||
.name = "serial_ns16550",
|
||||
#if defined(CONFIG_OMAP3EVM_UART1)
|
||||
.map_base = OMAP_UART1_BASE,
|
||||
#elif defined(CONFIG_OMAP3EVM_UART3)
|
||||
.map_base = OMAP_UART3_BASE,
|
||||
#endif
|
||||
.size = 1024,
|
||||
.platform_data = (void *)&serial_plat,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initialize the serial port to be used as console.
|
||||
*
|
||||
|
@ -237,7 +225,15 @@ static struct device_d omap3evm_serial_device = {
|
|||
*/
|
||||
static int omap3evm_init_console(void)
|
||||
{
|
||||
return register_device(&omap3evm_serial_device);
|
||||
add_ns16550_device(-1,
|
||||
#if defined(CONFIG_OMAP3EVM_UART1)
|
||||
OMAP_UART1_BASE,
|
||||
#elif defined(CONFIG_OMAP3EVM_UART3)
|
||||
OMAP_UART3_BASE,
|
||||
#endif
|
||||
1024, &serial_plat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
console_initcall(omap3evm_init_console);
|
||||
#endif /* CONFIG_DRIVER_SERIAL_NS16550 */
|
||||
|
|
|
@ -610,14 +610,6 @@ static struct NS16550_plat serial_plat = {
|
|||
.reg_write = omap_uart_write,
|
||||
};
|
||||
|
||||
static struct device_d sdp3430_serial_device = {
|
||||
.id = -1,
|
||||
.name = "serial_ns16550",
|
||||
.map_base = OMAP_UART3_BASE,
|
||||
.size = 1024,
|
||||
.platform_data = (void *)&serial_plat,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief UART serial port initialization - remember to enable COM clocks in arch
|
||||
*
|
||||
|
@ -626,7 +618,9 @@ static struct device_d sdp3430_serial_device = {
|
|||
static int sdp3430_console_init(void)
|
||||
{
|
||||
/* Register the serial port */
|
||||
return register_device(&sdp3430_serial_device);
|
||||
add_ns16550_device(-1, OMAP_UART3_BASE, 1024, &serial_plat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
console_initcall(sdp3430_console_init);
|
||||
|
|
|
@ -37,18 +37,12 @@ static struct NS16550_plat serial_plat = {
|
|||
.reg_write = omap_uart_write,
|
||||
};
|
||||
|
||||
static struct device_d panda_serial_device = {
|
||||
.id = -1,
|
||||
.name = "serial_ns16550",
|
||||
.map_base = OMAP44XX_UART3_BASE,
|
||||
.size = 1024,
|
||||
.platform_data = (void *)&serial_plat,
|
||||
};
|
||||
|
||||
static int panda_console_init(void)
|
||||
{
|
||||
/* Register the serial port */
|
||||
return register_device(&panda_serial_device);
|
||||
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, &serial_plat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
console_initcall(panda_console_init);
|
||||
|
||||
|
|
|
@ -48,18 +48,12 @@ static struct NS16550_plat serial_plat = {
|
|||
.reg_write = omap_uart_write,
|
||||
};
|
||||
|
||||
static struct device_d pcm049_serial_device = {
|
||||
.id = -1,
|
||||
.name = "serial_ns16550",
|
||||
.map_base = OMAP44XX_UART3_BASE,
|
||||
.size = 1024,
|
||||
.platform_data = (void *)&serial_plat,
|
||||
};
|
||||
|
||||
static int pcm049_console_init(void)
|
||||
{
|
||||
/* Register the serial port */
|
||||
return register_device(&pcm049_serial_device);
|
||||
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, &serial_plat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
console_initcall(pcm049_console_init);
|
||||
|
||||
|
|
|
@ -83,19 +83,12 @@ static struct NS16550_plat serial_plat = {
|
|||
.reg_write = x86_uart_write,
|
||||
};
|
||||
|
||||
/* we are expecting always one serial interface */
|
||||
static struct device_d generic_pc_serial_device = {
|
||||
.id = -1,
|
||||
.name = "serial_ns16550",
|
||||
.map_base = 0x3f8,
|
||||
.size = 8,
|
||||
.platform_data = (void *)&serial_plat,
|
||||
};
|
||||
|
||||
static int pc_console_init(void)
|
||||
{
|
||||
/* Register the serial port */
|
||||
return register_device(&generic_pc_serial_device);
|
||||
/* Register the serial port */
|
||||
add_ns16550_device(-1, 0x3f8, 8, &serial_plat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
console_initcall(pc_console_init);
|
||||
|
||||
|
|
|
@ -227,6 +227,14 @@ static inline struct device_d *add_cfi_flash_device(int id, resource_size_t star
|
|||
IORESOURCE_MEM | flags, NULL);
|
||||
}
|
||||
|
||||
struct NS16550_plat;
|
||||
static inline struct device_d *add_ns16550_device(int id, resource_size_t start,
|
||||
resource_size_t size, struct NS16550_plat *pdata)
|
||||
{
|
||||
return add_generic_device("serial_ns16550", id, NULL, start, size,
|
||||
IORESOURCE_MEM, pdata);
|
||||
}
|
||||
|
||||
/* linear list over all available devices
|
||||
*/
|
||||
extern struct list_head device_list;
|
||||
|
|
Loading…
Reference in New Issue