Skip to contentSkip to conversation

TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x UART

PATCH Superseded David Lechner 3 participants 9 messages Jan 4, 2017 – Jan 5, 2017

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x UART

This series adds a new UART port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x UART. This SoCs have a non-standard register for UART power management that needs special handling in the UART driver.

v2 changes:
* Added references to C66x SoC in various places, which I assume is an OK shorthand for TI Keystone processors.
* New patch for Keystone device tree. This is untested as I don't have any Keystone boards.

David Lechner (4):
doc: DT: Add ti,da830-uart to serial/8250 bindings
serial: 8250: Add new port type for TI

    DA8xx/OMAPL13x/AM17xx/AM18xx/C66x

ARM: da850: Add ti,da830-uart compatible for serial ports
ARM: dts: keystone: Add "ti,da830-uart" compatible string

 Documentation/devicetree/bindings/serial/8250.txt |  1 +
 arch/arm/boot/dts/da850.dtsi                      |  9 ++++++---
 arch/arm/boot/dts/keystone-k2g.dtsi               |  2 +-
 arch/arm/boot/dts/keystone-k2l.dtsi               |  4 ++--
 arch/arm/boot/dts/keystone.dtsi                   |  4 ++--
 drivers/tty/serial/8250/8250_of.c                 |  1 +
 drivers/tty/serial/8250/8250_port.c               | 22 ++++++++++++++++++++++
 include/uapi/linux/serial_core.h                  |  3 ++-
 include/uapi/linux/serial_reg.h                   |  8 ++++++++
 9 files changed, 45 insertions(+), 9 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/4 doc: DT: Add ti,da830-uart to serial/8250 bindings

This adds the ti,da830-uart compatible string to serial 8250 UART bindings.

---

v2 changes:
* picked up Acked-by:

 Documentation/devicetree/bindings/serial/8250.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/8250.txt +1 -0
index f86bb06..10276a4 100644
@@ -19,6 +19,7 @@ Required properties:
 	- "altr,16550-FIFO128"
 	- "fsl,16550-FIFO64"
 	- "fsl,ns16550"
+	- "ti,da830-uart"
 	- "serial" if the port type is unknown.
 - reg : offset and length of the register set for the device.
 - interrupts : should contain uart interrupt.
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/4 serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x

In reply to David Lechner

This adds a new UART port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x. 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.

---

v2 changes:
* Added C66x to list of SoCs

 drivers/tty/serial/8250/8250_of.c   |  1 +
 drivers/tty/serial/8250/8250_port.c | 22 ++++++++++++++++++++++
 include/uapi/linux/serial_core.h    |  3 ++-
 include/uapi/linux/serial_reg.h     |  8 ++++++++
 4 files changed, 33 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_of.c +1 -0
index d25ab1c..5281252 100644
@@ -332,6 +332,7 @@ static const struct of_device_id of_platform_serial_table[] = {
 		.data = (void *)PORT_ALTR_16550_F128, },
 	{ .compatible = "mrvl,mmp-uart",
 		.data = (void *)PORT_XSCALE, },
+	{ .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, },
 	{ /* end of list */ },
 };
 MODULE_DEVICE_TABLE(of, of_platform_serial_table);
drivers/tty/serial/8250/8250_port.c +22 -0
index fe4399b..61dd806 100644
@@ -273,6 +273,15 @@ static const struct serial8250_config uart_config[] = {
 		.rxtrig_bytes	= {1, 4, 8, 14},
 		.flags		= UART_CAP_FIFO,
 	},
+	[PORT_DA830] = {
+		.name		= "TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x",
+		.fifo_size	= 16,
+		.tx_loadsz	= 16,
+		.fcr		= UART_FCR_DMA_SELECT | UART_FCR_ENABLE_FIFO |
+				  UART_FCR_R_TRIG_10,
+		.rxtrig_bytes	= {1, 4, 8, 14},
+		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
+	},
 };
 
 /* Uart divisor latch read */
@@ -2118,6 +2127,19 @@ int serial8250_do_startup(struct uart_port *port)
 		serial_port_out(port, UART_LCR, 0);
 	}
 
+	if (port->type == PORT_DA830) {
+		/* Reset the port */
+		serial_port_out(port, UART_IER, 0);
+		serial_port_out(port, UART_DA830_PWREMU_MGMT, 0);
+		mdelay(10);
+
+		/* Enable Tx, Rx and free run mode */
+		serial_port_out(port, UART_DA830_PWREMU_MGMT,
+				UART_DA830_PWREMU_MGMT_UTRST |
+				UART_DA830_PWREMU_MGMT_URRST |
+				UART_DA830_PWREMU_MGMT_FREE);
+	}
+
 #ifdef CONFIG_SERIAL_8250_RSA
 	/*
 	 * If this is an RSA port, see if we can kick it up to the
include/uapi/linux/serial_core.h +2 -1
index 99dbed8..1265918 100644
@@ -56,7 +56,8 @@
 #define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */
 #define PORT_RT2880	29	/* Ralink RT2880 internal UART */
 #define PORT_16550A_FSL64 30	/* Freescale 16550 UART with 64 FIFOs */
-#define PORT_MAX_8250	30	/* max port ID */
+#define PORT_DA830	31	/* TI DA8xx/OMAP13x/AM17xx/AM18xx/C66x */
+#define PORT_MAX_8250	31	/* max port ID */
 
 /*
  * ARM specific type numbers.  These are not currently guaranteed
include/uapi/linux/serial_reg.h +8 -0
index b4c0484..84606d8 100644
@@ -327,6 +327,14 @@
 #define SERIAL_RSA_BAUD_BASE (921600)
 #define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8)
 
+/* Extra registers for TI DA8xx/OMAP13x/AM17xx/AM18xx/C66x */
+#define UART_DA830_PWREMU_MGMT	12
+
+/* PWREMU_MGMT register bits */
+#define UART_DA830_PWREMU_MGMT_FREE	(1 << 0)  /* Free-running mode */
+#define UART_DA830_PWREMU_MGMT_URRST	(1 << 13) /* Receiver reset/enable */
+#define UART_DA830_PWREMU_MGMT_UTRST	(1 << 14) /* Transmitter reset/enable */
+
 /*
  * Extra serial register definitions for the internal UARTs
  * in TI OMAP processors.
Signature · 1 line
2.7.4
Acked-by on v2 2/4
#3 lore raw

Re: [PATCH v2 2/4] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x

Quoted 1 line · David Lechner

This adds a new UART port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx/C66x.

The Keystone2 processors do include the C66x DSP. But the SoCs being targeted with this patch are the ARM + DSP variants. Using 66AK2x is more appropriate.

http://www.ti.com/lsds/ti/processors/dsp/c6000_dsp-arm/66ak2x/overview.page

Also, DA8xx includes DA830 which is pin-compatible with AM17x. So you can shorten the list of supported processors to DA8xx/66AK2x.

Quoted 10 lines

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.

Looks good to me, apart from the minor change above.

Thanks,
Sekhar

#4 lore raw

PATCH v2 3/4 ARM: da850: Add ti,da830-uart compatible for serial ports

In reply to David Lechner

TI DA8xx/OMAPL13x/AM17xx/AM18xx SoCs have extra UART registers beyond the standard 8250 registers, so we need a new compatible string to indicate this. Also, at least one of these registers uses the full 32 bits, so we need to specify reg-io-width in addition to reg-shift.

"ns16550a" is left in the compatible specification since it does work as long as the bootloader configures the SoC UART power management registers.

---

v2 changes:
* None

 arch/arm/boot/dts/da850.dtsi | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm/boot/dts/da850.dtsi +6 -3
index 104155d..f6cd212 100644
@@ -266,22 +266,25 @@
 			interrupt-names = "edm3_tcerrint";
 		};
 		serial0: serial at 42000 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			reg = <0x42000 0x100>;
+			reg-io-width = <4>;
 			reg-shift = <2>;
 			interrupts = <25>;
 			status = "disabled";
 		};
 		serial1: serial at 10c000 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			reg = <0x10c000 0x100>;
+			reg-io-width = <4>;
 			reg-shift = <2>;
 			interrupts = <53>;
 			status = "disabled";
 		};
 		serial2: serial at 10d000 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			reg = <0x10d000 0x100>;
+			reg-io-width = <4>;
 			reg-shift = <2>;
 			interrupts = <61>;
 			status = "disabled";
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 4/4 ARM: dts: keystone: Add "ti,da830-uart" compatible string

In reply to David Lechner

The TI Keystone SoCs have extra UART registers beyond the standard 8250 registers, so we need a new compatible string to indicate this. Also, at least one of these registers uses the full 32 bits, so we need to specify reg-io-width in addition to reg-shift.

"ns16550a" is left in the compatible specification since it does work as long as the bootloader configures the SoC UART power management registers.

---

v2 changes:
* This is a new patch in v2

 arch/arm/boot/dts/keystone-k2g.dtsi | 2 +-
 arch/arm/boot/dts/keystone-k2l.dtsi | 4 ++--
 arch/arm/boot/dts/keystone.dtsi     | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/keystone-k2g.dtsi +1 -1
index 63c7cf0c..7d7b9a8 100644
@@ -90,7 +90,7 @@
 		};
 
 		uart0: serial at 02530c00 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			current-speed = <115200>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
arch/arm/boot/dts/keystone-k2l.dtsi +2 -2
index 0c5e74e..e91633f 100644
@@ -35,7 +35,7 @@
 		/include/ "keystone-k2l-clocks.dtsi"
 
 		uart2: serial at 02348400 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			current-speed = <115200>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
@@ -45,7 +45,7 @@
 		};
 
 		uart3:	serial at 02348800 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			current-speed = <115200>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
arch/arm/boot/dts/keystone.dtsi +2 -2
index 02708ba..9152610 100644
@@ -98,7 +98,7 @@
 		/include/ "keystone-clocks.dtsi"
 
 		uart0: serial at 02530c00 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			current-speed = <115200>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
@@ -108,7 +108,7 @@
 		};
 
 		uart1:	serial at 02531000 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			current-speed = <115200>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH v2 4/4] ARM: dts: keystone: Add "ti,da830-uart" compatible string

Quoted 8 lines · David Lechner

The TI Keystone SoCs have extra UART registers beyond the standard 8250 registers, so we need a new compatible string to indicate this. Also, at least one of these registers uses the full 32 bits, so we need to specify reg-io-width in addition to reg-shift.

"ns16550a" is left in the compatible specification since it does work as long as the bootloader configures the SoC UART power management registers.

NAK!!
We can't break the booting boards with existing boot loaders. I suggest you to first get the driver updated to take care of the UART PM register and then enable the support for it.

#7 lore raw

Re: [PATCH v2 4/4] ARM: dts: keystone: Add "ti,da830-uart" compatible string

Hi Santosh,

Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · David Lechner

The TI Keystone SoCs have extra UART registers beyond the standard 8250 registers, so we need a new compatible string to indicate this. Also, at least one of these registers uses the full 32 bits, so we need to specify reg-io-width in addition to reg-shift.

Quoted 6 lines
Quoted 4 lines

"ns16550a" is left in the compatible specification since it does work as long as the bootloader configures the SoC UART power management registers.

NAK!!
We can't break the booting boards with existing boot loaders.

Sorry, but it not clear to me how this breaks booting with older bootloaders? If older DTB is ROM'ed, it will continue to work because of match with ns16550a.

I just verified boot on K2E with these patches applied and using 2016.05 based U-Boot from a TI release.

http://pastebin.ubuntu.com/23744719/

Quoted 2 lines

I suggest you to first get the driver updated to take care of the UART PM register and then enable the support for it.

Isn't that what patch 2/4 is doing?

Thanks,
Sekhar

#8 lore raw

Re: [PATCH v2 4/4] ARM: dts: keystone: Add "ti,da830-uart" compatible string

Quoted 16 lines · Sekhar Nori

Hi Santosh,

Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · David Lechner

The TI Keystone SoCs have extra UART registers beyond the standard 8250 registers, so we need a new compatible string to indicate this. Also, at least one of these registers uses the full 32 bits, so we need to specify reg-io-width in addition to reg-shift.

Quoted 6 lines
Quoted 4 lines

"ns16550a" is left in the compatible specification since it does work as long as the bootloader configures the SoC UART power management registers.

NAK!!
We can't break the booting boards with existing boot loaders.

Quoted 9 lines

Sorry, but it not clear to me how this breaks booting with older bootloaders? If older DTB is ROM'ed, it will continue to work because of match with ns16550a.

I just verified boot on K2E with these patches applied and using 2016.05 based U-Boot from a TI release.

http://pastebin.ubuntu.com/23744719/

Thanks for test. As long as it doesn't break the boot, am fine with it.

Quoted 5 lines
Quoted 2 lines

I suggest you to first get the driver updated to take care of the UART PM register and then enable the support for it.

Isn't that what patch 2/4 is doing?

I see that now. Thanks for clarifying.

Serial patch needs to go via Greg's tree. I will pick up the DTS bits.

Regards,
Santosh