This should be replaced with a proper implementation. Signed-off-by: Tero Kristo <t-kristo@xxxxxx> --- arch/arm/mach-omap2/serial.c | 66 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 64 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 067a86b..822c9b8 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -851,17 +851,79 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) * can call this function when they want to have default behaviour * for serial ports (e.g initialize them all as serial ports). */ + +struct serial_mux_conf { + char *name; + int omap3_mux; + int omap4_mux; +}; + +#define OMAP3_SERIAL_MUX_IN_PU (OMAP_PIN_INPUT_PULLUP | \ + OMAP_PIN_OFF_INPUT_PULLDOWN | OMAP_OFFOUT_EN | OMAP_MUX_MODE0) +#define OMAP3_SERIAL_MUX_IN_PD (OMAP_PIN_INPUT_PULLDOWN | \ + OMAP_PIN_OFF_INPUT_PULLDOWN | OMAP_OFFOUT_EN | OMAP_MUX_MODE0) +#define OMAP3_SERIAL_MUX_IN (OMAP_PIN_INPUT | OMAP_PIN_OFF_INPUT_PULLDOWN | \ + OMAP_OFFOUT_EN | OMAP_MUX_MODE0) +#define OMAP3_SERIAL_MUX_OUT (OMAP_PIN_OUTPUT | OMAP_OFF_EN | OMAP_MUX_MODE0) +#define OMAP4_SERIAL_MUX_IN_PU (OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0) +#define OMAP4_SERIAL_MUX_OUT (OMAP_PIN_OUTPUT | OMAP_MUX_MODE0) +#define OMAP4_SERIAL_MUX_IN (OMAP_PIN_INPUT | OMAP_MUX_MODE0) + +#define OMAP_SERIAL_NUM_PADS_PER_PORT 4 + +static const struct serial_mux_conf serial_mux_data[] = { + { "uart1_cts.uart1_cts", OMAP3_SERIAL_MUX_IN, 0, }, + { "uart1_rts.uart1_rts", OMAP3_SERIAL_MUX_OUT, 0, }, + { "uart1_rx.uart1_rx", OMAP3_SERIAL_MUX_IN, 0, }, + { "uart1_tx.uart1_tx", OMAP3_SERIAL_MUX_OUT, 0, }, + { "uart2_cts.uart2_cts", OMAP3_SERIAL_MUX_IN_PU, + OMAP4_SERIAL_MUX_IN_PU, }, + { "uart2_rts.uart2_rts", OMAP3_SERIAL_MUX_OUT, OMAP4_SERIAL_MUX_OUT, }, + { "uart2_rx.uart2_rx", OMAP3_SERIAL_MUX_IN, OMAP4_SERIAL_MUX_IN_PU, }, + { "uart2_tx.uart2_tx", OMAP3_SERIAL_MUX_OUT, OMAP4_SERIAL_MUX_OUT }, + { "uart3_cts_rctx.uart3_cts_rctx", OMAP3_SERIAL_MUX_IN_PD, + OMAP4_SERIAL_MUX_IN_PU, }, + { "uart3_rts_sd.uart3_rts_sd", OMAP3_SERIAL_MUX_OUT, + OMAP4_SERIAL_MUX_OUT, }, + { "uart3_rx_irrx.uart3_rx_irrx", OMAP3_SERIAL_MUX_IN, + OMAP4_SERIAL_MUX_IN, }, + { "uart3_tx_irtx.uart3_tx_irtx", OMAP3_SERIAL_MUX_OUT, + OMAP4_SERIAL_MUX_OUT, }, + { "uart4_rx.uart4_rx", 0, OMAP4_SERIAL_MUX_IN, }, + { "uart4_tx.uart4_tx", 0, OMAP4_SERIAL_MUX_OUT, }, + { NULL, 0, 0, }, + { NULL, 0, 0, }, +}; + void __init omap_serial_init(void) { struct omap_uart_state *uart; struct omap_board_data bdata; + struct omap_device_pad *pads; + int idx; + int i; + pads = kmalloc(sizeof(struct omap_device_pad) * 4, GFP_KERNEL); list_for_each_entry(uart, &uart_list, node) { bdata.id = uart->num; bdata.flags = 0; - bdata.pads = NULL; bdata.pads_cnt = 0; + bdata.pads = pads; + + for (i = 0; i < OMAP_SERIAL_NUM_PADS_PER_PORT; i++) { + idx = bdata.id * OMAP_SERIAL_NUM_PADS_PER_PORT + i; + pads[i].name = serial_mux_data[idx].name; + pads[i].enable = 0; + if (cpu_is_omap34xx()) + pads[i].enable = serial_mux_data[idx].omap3_mux; + if (cpu_is_omap44xx()) + pads[i].enable = serial_mux_data[idx].omap4_mux; + if (pads[i].enable) + bdata.pads_cnt++; + } + if (bdata.pads_cnt == 0) + bdata.pads = NULL; omap_serial_init_port(&bdata); - } + kfree(pads); } -- 1.7.4.1 Texas Instruments Oy, Tekniikantie 12, 02150 Espoo. Y-tunnus: 0115040-6. Kotipaikka: Helsinki -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html