linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] TI DA8xx/OMAPL13x/AM17xx/AM18xx UART
@ 2016-12-20 20:23 David Lechner
  2016-12-20 20:23 ` [PATCH 1/3] doc: DT: Add ti,da830-uart to serial/8250 bindings David Lechner
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: David Lechner @ 2016-12-20 20:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: David Lechner, Sekhar Nori, Kevin Hilman, Axel Haslam,
	Alexandre Bailon, Bartosz Golaszewski, Jiri Slaby, linux-serial,
	devicetree, linux-kernel, linux-arm-kernel

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

David Lechner (3):
  doc: DT: Add ti,da830-uart to serial/8250 bindings
  serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx
  ARM: da850: Add ti,da830-uart compatible for serial ports

 Documentation/devicetree/bindings/serial/8250.txt |  1 +
 arch/arm/boot/dts/da850.dtsi                      |  9 ++++++---
 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 ++++++++
 6 files changed, 40 insertions(+), 4 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] doc: DT: Add ti,da830-uart to serial/8250 bindings
  2016-12-20 20:23 [PATCH 0/3] TI DA8xx/OMAPL13x/AM17xx/AM18xx UART David Lechner
@ 2016-12-20 20:23 ` David Lechner
  2016-12-22 21:18   ` Rob Herring
  2016-12-20 20:23 ` [PATCH 2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx David Lechner
  2016-12-20 20:23 ` [PATCH 3/3] ARM: da850: Add ti,da830-uart compatible for serial ports David Lechner
  2 siblings, 1 reply; 10+ messages in thread
From: David Lechner @ 2016-12-20 20:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: David Lechner, Sekhar Nori, Kevin Hilman, Axel Haslam,
	Alexandre Bailon, Bartosz Golaszewski, Jiri Slaby, linux-serial,
	devicetree, linux-kernel, linux-arm-kernel

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

Signed-off-by: David Lechner <david@lechnology.com>
---
 Documentation/devicetree/bindings/serial/8250.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt
index f86bb06..10276a4 100644
--- a/Documentation/devicetree/bindings/serial/8250.txt
+++ b/Documentation/devicetree/bindings/serial/8250.txt
@@ -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.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx
  2016-12-20 20:23 [PATCH 0/3] TI DA8xx/OMAPL13x/AM17xx/AM18xx UART David Lechner
  2016-12-20 20:23 ` [PATCH 1/3] doc: DT: Add ti,da830-uart to serial/8250 bindings David Lechner
@ 2016-12-20 20:23 ` David Lechner
  2016-12-22 15:21   ` [2/3] " Franklin S Cooper Jr
  2016-12-20 20:23 ` [PATCH 3/3] ARM: da850: Add ti,da830-uart compatible for serial ports David Lechner
  2 siblings, 1 reply; 10+ messages in thread
From: David Lechner @ 2016-12-20 20:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: David Lechner, Sekhar Nori, Kevin Hilman, Axel Haslam,
	Alexandre Bailon, Bartosz Golaszewski, Jiri Slaby, linux-serial,
	devicetree, linux-kernel, linux-arm-kernel

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

diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index d25ab1c..5281252 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -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);
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index fe4399b..ea854054 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -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",
+		.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
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 99dbed8..a126d05 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -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 */
+#define PORT_MAX_8250	31	/* max port ID */
 
 /*
  * ARM specific type numbers.  These are not currently guaranteed
diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
index b4c0484..0e72eeb 100644
--- a/include/uapi/linux/serial_reg.h
+++ b/include/uapi/linux/serial_reg.h
@@ -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 */
+#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.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] ARM: da850: Add ti,da830-uart compatible for serial ports
  2016-12-20 20:23 [PATCH 0/3] TI DA8xx/OMAPL13x/AM17xx/AM18xx UART David Lechner
  2016-12-20 20:23 ` [PATCH 1/3] doc: DT: Add ti,da830-uart to serial/8250 bindings David Lechner
  2016-12-20 20:23 ` [PATCH 2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx David Lechner
@ 2016-12-20 20:23 ` David Lechner
  2016-12-22 16:06   ` [3/3] ARM: da850: Add ti, da830-uart " Franklin S Cooper Jr
  2 siblings, 1 reply; 10+ messages in thread
From: David Lechner @ 2016-12-20 20:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: David Lechner, Sekhar Nori, Kevin Hilman, Axel Haslam,
	Alexandre Bailon, Bartosz Golaszewski, Jiri Slaby, linux-serial,
	devicetree, linux-kernel, linux-arm-kernel

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.

Signed-off-by: David Lechner <david@lechnology.com>
---
 arch/arm/boot/dts/da850.dtsi | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 104155d..f6cd212 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -266,22 +266,25 @@
 			interrupt-names = "edm3_tcerrint";
 		};
 		serial0: serial@42000 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			reg = <0x42000 0x100>;
+			reg-io-width = <4>;
 			reg-shift = <2>;
 			interrupts = <25>;
 			status = "disabled";
 		};
 		serial1: serial@10c000 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			reg = <0x10c000 0x100>;
+			reg-io-width = <4>;
 			reg-shift = <2>;
 			interrupts = <53>;
 			status = "disabled";
 		};
 		serial2: serial@10d000 {
-			compatible = "ns16550a";
+			compatible = "ti,da830-uart", "ns16550a";
 			reg = <0x10d000 0x100>;
+			reg-io-width = <4>;
 			reg-shift = <2>;
 			interrupts = <61>;
 			status = "disabled";
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx
  2016-12-20 20:23 ` [PATCH 2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx David Lechner
@ 2016-12-22 15:21   ` Franklin S Cooper Jr
  2016-12-22 16:02     ` Franklin S Cooper Jr
  2016-12-22 18:16     ` David Lechner
  0 siblings, 2 replies; 10+ messages in thread
From: Franklin S Cooper Jr @ 2016-12-22 15:21 UTC (permalink / raw)
  To: David Lechner, Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: devicetree, Axel Haslam, Kevin Hilman, Sekhar Nori, linux-kernel,
	Bartosz Golaszewski, Alexandre Bailon, linux-serial, Jiri Slaby,
	linux-arm-kernel



On 12/20/2016 02:23 PM, David Lechner wrote:
> This adds a new UART port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx. 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>
> ---
>  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(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
> index d25ab1c..5281252 100644
> --- a/drivers/tty/serial/8250/8250_of.c
> +++ b/drivers/tty/serial/8250/8250_of.c
> @@ -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);
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index fe4399b..ea854054 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -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",
> +		.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,
> +	},
>  };


Any reason why the fcr and flags fields are changed when compared
against PORT_16550A?
>  
>  /* 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
> diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
> index 99dbed8..a126d05 100644
> --- a/include/uapi/linux/serial_core.h
> +++ b/include/uapi/linux/serial_core.h
> @@ -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 */
> +#define PORT_MAX_8250	31	/* max port ID */
>  
>  /*
>   * ARM specific type numbers.  These are not currently guaranteed
> diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
> index b4c0484..0e72eeb 100644
> --- a/include/uapi/linux/serial_reg.h
> +++ b/include/uapi/linux/serial_reg.h
> @@ -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 */
> +#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.
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx
  2016-12-22 15:21   ` [2/3] " Franklin S Cooper Jr
@ 2016-12-22 16:02     ` Franklin S Cooper Jr
  2016-12-22 18:16     ` David Lechner
  1 sibling, 0 replies; 10+ messages in thread
From: Franklin S Cooper Jr @ 2016-12-22 16:02 UTC (permalink / raw)
  To: David Lechner, Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: devicetree, Axel Haslam, Kevin Hilman, Sekhar Nori, linux-kernel,
	Bartosz Golaszewski, Alexandre Bailon, linux-serial, Jiri Slaby,
	linux-arm-kernel



On 12/22/2016 09:21 AM, Franklin S Cooper Jr wrote:
> 
> 
> On 12/20/2016 02:23 PM, David Lechner wrote:
>> This adds a new UART port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx. These


Keystone SoCs also require this PWREMU_MGMT register to be configured.
So it would be nice to update this commit message to include Keystone SoCs.

>> 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>
>> ---
>>  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(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
>> index d25ab1c..5281252 100644
>> --- a/drivers/tty/serial/8250/8250_of.c
>> +++ b/drivers/tty/serial/8250/8250_of.c
>> @@ -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);
>> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
>> index fe4399b..ea854054 100644
>> --- a/drivers/tty/serial/8250/8250_port.c
>> +++ b/drivers/tty/serial/8250/8250_port.c
>> @@ -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",
>> +		.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,
>> +	},
>>  };
> 
> 
> Any reason why the fcr and flags fields are changed when compared
> against PORT_16550A?
>>  
>>  /* 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
>> diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
>> index 99dbed8..a126d05 100644
>> --- a/include/uapi/linux/serial_core.h
>> +++ b/include/uapi/linux/serial_core.h
>> @@ -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 */
>> +#define PORT_MAX_8250	31	/* max port ID */
>>  
>>  /*
>>   * ARM specific type numbers.  These are not currently guaranteed
>> diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
>> index b4c0484..0e72eeb 100644
>> --- a/include/uapi/linux/serial_reg.h
>> +++ b/include/uapi/linux/serial_reg.h
>> @@ -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 */
>> +#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.
>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [3/3] ARM: da850: Add ti, da830-uart compatible for serial ports
  2016-12-20 20:23 ` [PATCH 3/3] ARM: da850: Add ti,da830-uart compatible for serial ports David Lechner
@ 2016-12-22 16:06   ` Franklin S Cooper Jr
  2017-01-02  8:06     ` Sekhar Nori
  0 siblings, 1 reply; 10+ messages in thread
From: Franklin S Cooper Jr @ 2016-12-22 16:06 UTC (permalink / raw)
  To: David Lechner, Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: devicetree, Axel Haslam, Kevin Hilman, Sekhar Nori, linux-kernel,
	Bartosz Golaszewski, Alexandre Bailon, linux-serial, Jiri Slaby,
	linux-arm-kernel



On 12/20/2016 02:23 PM, David Lechner wrote:
> TI DA8xx/OMAPL13x/AM17xx/AM18xx SoCs have extra UART registers beyond

Similar comment about adding Keystone SoCs to the list of SoCs.

> 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.
> 
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>  arch/arm/boot/dts/da850.dtsi | 9 ++++++---

Similar changes should be made to the various Keystone dtsi files.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx
  2016-12-22 15:21   ` [2/3] " Franklin S Cooper Jr
  2016-12-22 16:02     ` Franklin S Cooper Jr
@ 2016-12-22 18:16     ` David Lechner
  1 sibling, 0 replies; 10+ messages in thread
From: David Lechner @ 2016-12-22 18:16 UTC (permalink / raw)
  To: Franklin S Cooper Jr, Greg Kroah-Hartman, Rob Herring, Mark Rutland
  Cc: devicetree, Axel Haslam, Kevin Hilman, Sekhar Nori, linux-kernel,
	Bartosz Golaszewski, Alexandre Bailon, linux-serial, Jiri Slaby,
	linux-arm-kernel

On 12/22/2016 09:21 AM, Franklin S Cooper Jr wrote:
>
>
> On 12/20/2016 02:23 PM, David Lechner wrote:
>> This adds a new UART port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx. 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>
>> ---
>>  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(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
>> index d25ab1c..5281252 100644
>> --- a/drivers/tty/serial/8250/8250_of.c
>> +++ b/drivers/tty/serial/8250/8250_of.c
>> @@ -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);
>> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
>> index fe4399b..ea854054 100644
>> --- a/drivers/tty/serial/8250/8250_port.c
>> +++ b/drivers/tty/serial/8250/8250_port.c
>> @@ -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",
>> +		.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,
>> +	},
>>  };
>
>
> Any reason why the fcr and flags fields are changed when compared
> against PORT_16550A?

The AM1808 TRM says to "always enable" the DMA bit. I figured setting it 
now could save someone trouble later if they wanted to add DMA support. 
It does not matter if it is set even if you are not using DMA.

Since we are using the special reset register that resets the state 
machine, setting UART_FCR_CLEAR_RCVR and UART_FCR_CLEAR_XMIT seems 
redundant.

And in my testing with an AM1808, UART_CAP_AFE is not automatically 
detected even though the chip has this capability, so it needs to be 
manually specified.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] doc: DT: Add ti,da830-uart to serial/8250 bindings
  2016-12-20 20:23 ` [PATCH 1/3] doc: DT: Add ti,da830-uart to serial/8250 bindings David Lechner
@ 2016-12-22 21:18   ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2016-12-22 21:18 UTC (permalink / raw)
  To: David Lechner
  Cc: Greg Kroah-Hartman, Mark Rutland, Sekhar Nori, Kevin Hilman,
	Axel Haslam, Alexandre Bailon, Bartosz Golaszewski, Jiri Slaby,
	linux-serial, devicetree, linux-kernel, linux-arm-kernel

On Tue, Dec 20, 2016 at 02:23:02PM -0600, David Lechner wrote:
> This adds the ti,da830-uart compatible string to serial 8250 UART bindings.
> 
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>  Documentation/devicetree/bindings/serial/8250.txt | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [3/3] ARM: da850: Add ti, da830-uart compatible for serial ports
  2016-12-22 16:06   ` [3/3] ARM: da850: Add ti, da830-uart " Franklin S Cooper Jr
@ 2017-01-02  8:06     ` Sekhar Nori
  0 siblings, 0 replies; 10+ messages in thread
From: Sekhar Nori @ 2017-01-02  8:06 UTC (permalink / raw)
  To: Franklin S Cooper Jr, David Lechner, Greg Kroah-Hartman,
	Rob Herring, Mark Rutland
  Cc: devicetree, Axel Haslam, Kevin Hilman, linux-kernel,
	Bartosz Golaszewski, Alexandre Bailon, linux-serial, Jiri Slaby,
	linux-arm-kernel

On Thursday 22 December 2016 09:36 PM, Franklin S Cooper Jr wrote:
> 
> 
> On 12/20/2016 02:23 PM, David Lechner wrote:
>> TI DA8xx/OMAPL13x/AM17xx/AM18xx SoCs have extra UART registers beyond
> 
> Similar comment about adding Keystone SoCs to the list of SoCs.
> 
>> 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.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> ---
>>  arch/arm/boot/dts/da850.dtsi | 9 ++++++---
> 
> Similar changes should be made to the various Keystone dtsi files.

That will be a different patch though since the two changes will go
through different trees. And I strongly suspect David does not have
access to a keystone board. So it will have to be done by someone at TI.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-02  8:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20 20:23 [PATCH 0/3] TI DA8xx/OMAPL13x/AM17xx/AM18xx UART David Lechner
2016-12-20 20:23 ` [PATCH 1/3] doc: DT: Add ti,da830-uart to serial/8250 bindings David Lechner
2016-12-22 21:18   ` Rob Herring
2016-12-20 20:23 ` [PATCH 2/3] serial: 8250: Add new port type for TI DA8xx/OMAPL13x/AM17xx/AM18xx David Lechner
2016-12-22 15:21   ` [2/3] " Franklin S Cooper Jr
2016-12-22 16:02     ` Franklin S Cooper Jr
2016-12-22 18:16     ` David Lechner
2016-12-20 20:23 ` [PATCH 3/3] ARM: da850: Add ti,da830-uart compatible for serial ports David Lechner
2016-12-22 16:06   ` [3/3] ARM: da850: Add ti, da830-uart " Franklin S Cooper Jr
2017-01-02  8:06     ` Sekhar Nori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).