omap-serial: Allow board files to override serial_in/out
Subsystems (3)
RFC PATCH 2/2 omap-serial: Allow board files to override serial_in/out
This patch adds a way to override the default serial_in and serial_out functions, typically from the board-??? file.
In some cases, mach-omap2/serial.c may already be overriding the default serial_in/out functions. When this happens, old_serial_in/out will be non-null and the board implementation should then call these instead of going ahead and performing direct memory access.
Tested with 8250.c and omap-serial.c on a custom AM3505 system.
Signed-off-by Raphaël Assénat
arch/arm/plat-omap/include/plat/serial.h +10 -0
@@ -105,10 +105,20 @@#ifndef __ASSEMBLER__ +struct uart_port ;struct omap_board_data ; +struct omap_serio_funcs { +unsigned int (*serial_in)(struct uart_port *,int ); +void (*serial_out)(struct uart_port *,int ,int ); + +unsigned int (*old_serial_in)(struct uart_port *,int ); +void (*old_serial_out)(struct uart_port *,int ,int ); +}; +extern void omap_serial_init (void );extern void omap_serial_init_port (struct omap_board_data *bdata); +extern void omap_serial_init_port_serio (struct omap_board_data *bdata,struct omap_serio_funcs *serio_funcs);extern int omap_uart_can_sleep (void );extern void omap_uart_check_wakeup (void );extern void omap_uart_prepare_suspend (void );
arch/arm/mach-omap2/serial.c +20 -1
@@ -696,6 +696,11 @@ static int __init omap_serial_early_init(void) }core_initcall (omap_serial_early_init); +void __init omap_serial_init_port (struct omap_board_data *bdata) +{ +omap_serial_init_port_serio (bdata,NULL ); +} +/** * omap_serial_init_port() - initialize single serial port * @bdata: port specific board data pointer
@@ -707,7 +712,7 @@ core_initcall(omap_serial_early_init);* Don't mix calls to omap_serial_init_port() and omap_serial_init(), * use only one of the two. */ -void __init omap_serial_init_port (struct omap_board_data *bdata) +void __init omap_serial_init_port_serio (struct omap_board_data *bdata,struct omap_serio_funcs *serio_funcs) {struct omap_uart_state *uart;struct omap_hwmod *oh;
@@ -779,6 +784,15 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) p->serial_out = serial_out_override; } +if (serio_funcs) { + serio_funcs->old_serial_in = p->serial_in; + serio_funcs->old_serial_out = p->serial_out; +if (serio_funcs->serial_in) + p->serial_in = serio_funcs->serial_in; +if (serio_funcs->serial_out) + p->serial_out = serio_funcs->serial_out; + } + pdata = &ports[0 ]; pdata_size =2 *sizeof (struct plat_serial8250_port );#else
@@ -792,6 +806,11 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) omap_up.irqflags =IRQF_SHARED ; omap_up.flags =UPF_BOOT_AUTOCONF |UPF_SHARE_IRQ ; +if (serio_funcs) { + omap_up.serial_in = serio_funcs->serial_in; + omap_up.serial_out = serio_funcs->serial_out; + } + pdata = &omap_up; pdata_size =sizeof (struct omap_uart_port_info );#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html