Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250: Add new port type for TI DA8xx/66AK2x

This adds a new UART port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx/66AK2x.
These SoCs have standard 8250 registers plus some extra non-standard
registers.

The UART will not function unless the non-standard Power and Emulation
Management Register (PWREMU_MGMT) is configured correctly. This is
currently handled in arch/arm/mach-davinci/serial.c for non-device-tree
boards. Making this part of the UART driver will allow UART to work on
device-tree boards as well and the mach code can eventually be removed.

Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

David Lechner and committed by
Greg Kroah-Hartman
a2d6a987 b2ae93e0

+33 -1
+1
drivers/tty/serial/8250/8250_of.c
··· 332 332 .data = (void *)PORT_ALTR_16550_F128, }, 333 333 { .compatible = "mrvl,mmp-uart", 334 334 .data = (void *)PORT_XSCALE, }, 335 + { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, }, 335 336 { /* end of list */ }, 336 337 }; 337 338 MODULE_DEVICE_TABLE(of, of_platform_serial_table);
+22
drivers/tty/serial/8250/8250_port.c
··· 273 273 .rxtrig_bytes = {1, 4, 8, 14}, 274 274 .flags = UART_CAP_FIFO, 275 275 }, 276 + [PORT_DA830] = { 277 + .name = "TI DA8xx/66AK2x", 278 + .fifo_size = 16, 279 + .tx_loadsz = 16, 280 + .fcr = UART_FCR_DMA_SELECT | UART_FCR_ENABLE_FIFO | 281 + UART_FCR_R_TRIG_10, 282 + .rxtrig_bytes = {1, 4, 8, 14}, 283 + .flags = UART_CAP_FIFO | UART_CAP_AFE, 284 + }, 276 285 }; 277 286 278 287 /* Uart divisor latch read */ ··· 2121 2112 serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B); 2122 2113 serial_port_out(port, UART_EFR, UART_EFR_ECB); 2123 2114 serial_port_out(port, UART_LCR, 0); 2115 + } 2116 + 2117 + if (port->type == PORT_DA830) { 2118 + /* Reset the port */ 2119 + serial_port_out(port, UART_IER, 0); 2120 + serial_port_out(port, UART_DA830_PWREMU_MGMT, 0); 2121 + mdelay(10); 2122 + 2123 + /* Enable Tx, Rx and free run mode */ 2124 + serial_port_out(port, UART_DA830_PWREMU_MGMT, 2125 + UART_DA830_PWREMU_MGMT_UTRST | 2126 + UART_DA830_PWREMU_MGMT_URRST | 2127 + UART_DA830_PWREMU_MGMT_FREE); 2124 2128 } 2125 2129 2126 2130 #ifdef CONFIG_SERIAL_8250_RSA
+2 -1
include/uapi/linux/serial_core.h
··· 56 56 #define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */ 57 57 #define PORT_RT2880 29 /* Ralink RT2880 internal UART */ 58 58 #define PORT_16550A_FSL64 30 /* Freescale 16550 UART with 64 FIFOs */ 59 - #define PORT_MAX_8250 30 /* max port ID */ 59 + #define PORT_DA830 31 /* TI DA8xx/66AK2x */ 60 + #define PORT_MAX_8250 31 /* max port ID */ 60 61 61 62 /* 62 63 * ARM specific type numbers. These are not currently guaranteed
+8
include/uapi/linux/serial_reg.h
··· 327 327 #define SERIAL_RSA_BAUD_BASE (921600) 328 328 #define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8) 329 329 330 + /* Extra registers for TI DA8xx/66AK2x */ 331 + #define UART_DA830_PWREMU_MGMT 12 332 + 333 + /* PWREMU_MGMT register bits */ 334 + #define UART_DA830_PWREMU_MGMT_FREE (1 << 0) /* Free-running mode */ 335 + #define UART_DA830_PWREMU_MGMT_URRST (1 << 13) /* Receiver reset/enable */ 336 + #define UART_DA830_PWREMU_MGMT_UTRST (1 << 14) /* Transmitter reset/enable */ 337 + 330 338 /* 331 339 * Extra serial register definitions for the internal UARTs 332 340 * in TI OMAP processors.