serial: 8250_uniphier: remove unused code and add auto-flow-control
cover serial: 8250_uniphier: remove unused code and add auto-flow-control
- Remove never-used DT property
- Refactor code
- Add auto-flow-control support
Dai Okamura (1):
serial: 8250_uniphier: add auto-flow-control support
Masahiro Yamada (2):
serial: 8250_uniphier: remove unused "fifo-size" property
serial: 8250_uniphier: flatten probe function
.../devicetree/bindings/serial/uniphier-uart.txt | 3 +- drivers/tty/serial/8250/8250_uniphier.c | 62 ++++++++-------------- 2 files changed, 22 insertions(+), 43 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 serial: 8250_uniphier: remove unused "fifo-size" property
The FIFO size of the UART devices is 64 on almost all UniPhier SoCs with the exception Pro4TV SoC (MN2WS0230), which used 128 FIFO size. However, Pro4TV SoC was never upstreamed, and out of production.
So, this property has never been used in a useful way. Let's remove old unused code.
---
Documentation/devicetree/bindings/serial/uniphier-uart.txt | 4 ---- drivers/tty/serial/8250/8250_uniphier.c | 10 +--------- 2 files changed, 1 insertion(+), 13 deletions(-)
Documentation/devicetree/bindings/serial/uniphier-uart.txt +0 -4
@@ -6,9 +6,6 @@ Required properties: - interrupts: a single interrupt specifier. - clocks: phandle to the input clock. -Optional properties: -- fifo-size: the RX/TX FIFO size. Defaults to 64 if not specified. - Example: aliases { serial0 = &serial0;
@@ -19,5 +16,4 @@ Example: reg = <0x54006800 0x40>; interrupts = <0 33 4>; clocks = <&uart_clk>; - fifo-size = <64>; };
drivers/tty/serial/8250/8250_uniphier.c +1 -9
@@ -12,9 +12,6 @@#include "8250.h" -/* Most (but not all) of UniPhier UART devices have 64-depth FIFO. */ -#define UNIPHIER_UART_DEFAULT_FIFO_SIZE 64 -/* * This hardware is similar to 8250, but its register map is a bit different: * - MMIO32 (regshift = 2)
@@ -185,12 +182,6 @@ static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port, port->uartclk =clk_get_rate (priv->clk); -/* Check for fifo size */ -if (of_property_read_u32 (np,"fifo-size" , &prop) ==0 ) - port->fifosize = prop; -else - port->fifosize =UNIPHIER_UART_DEFAULT_FIFO_SIZE ; -return 0 ; }
@@ -241,6 +232,7 @@ static int uniphier_uart_probe(struct platform_device *pdev) up.port.type =PORT_16550A ; up.port.iotype =UPIO_MEM32 ; + up.port.fifosize =64 ; up.port.regshift =UNIPHIER_UART_REGSHIFT ; up.port.flags =UPF_FIXED_PORT |UPF_FIXED_TYPE ; up.capabilities =UART_CAP_FIFO ;
Signature · 1 line
2.7.4
Rob Herring
maintainerPATCH 1/3 serial: 8250_uniphier: remove unused "fifo-size" property
Quoted 7 lines · Masahiro Yamada
The FIFO size of the UART devices is 64 on almost all UniPhier SoCs with the exception Pro4TV SoC (MN2WS0230), which used 128 FIFO size. However, Pro4TV SoC was never upstreamed, and out of production.
So, this property has never been used in a useful way. Let's remove old unused code.
Quoted 7 lines
Signed-off-by Masahiro Yamada <[email protected]>---
Documentation/devicetree/bindings/serial/uniphier-uart.txt | 4 ---- drivers/tty/serial/8250/8250_uniphier.c | 10 +--------- 2 files changed, 1 insertion(+), 13 deletions(-)
PATCH 2/3 serial: 8250_uniphier: flatten probe function
In reply to Masahiro YamadaCurrently, the DT-related settings are split out to uniphier_of_serial_setup(), but it turned out to be not nice. The next commit will add a DT property, but it will not fit in the helper. Merge the helper into the probe function.
---
drivers/tty/serial/8250/8250_uniphier.c | 49 ++++++++++++--------------------- 1 file changed, 17 insertions(+), 32 deletions(-)
drivers/tty/serial/8250/8250_uniphier.c +17 -32
@@ -155,36 +155,6 @@ static void uniphier_serial_dl_write(struct uart_8250_port *up, int value)writel (value, up->port.membase +UNIPHIER_UART_DLR ); } -static int uniphier_of_serial_setup (struct device *dev,struct uart_port *port, -struct uniphier8250_priv *priv) -{ -int ret; -u32 prop; -struct device_node *np = dev->of_node; - - ret =of_alias_get_id (np,"serial" ); -if (ret <0 ) { -dev_err (dev,"failed to get alias id\n" ); -return ret; - } - port->line = ret; - -/* Get clk rate through clk driver */ - priv->clk =devm_clk_get (dev,NULL ); -if (IS_ERR (priv->clk)) { -dev_err (dev,"failed to get clock\n" ); -return PTR_ERR (priv->clk); - } - - ret =clk_prepare_enable (priv->clk); -if (ret <0 ) -return ret; - - port->uartclk =clk_get_rate (priv->clk); - -return 0 ; -} -static int uniphier_uart_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -217,9 +187,24 @@ static int uniphier_uart_probe(struct platform_device *pdev)memset (&up,0 ,sizeof (up)); - ret =uniphier_of_serial_setup (dev, &up.port, priv); -if (ret <0 ) + ret =of_alias_get_id (dev->of_node,"serial" ); +if (ret <0 ) { +dev_err (dev,"failed to get alias id\n" );return ret; + } + up.port.line = ret; + + priv->clk =devm_clk_get (dev,NULL ); +if (IS_ERR (priv->clk)) { +dev_err (dev,"failed to get clock\n" ); +return PTR_ERR (priv->clk); + } + + ret =clk_prepare_enable (priv->clk); +if (ret) +return ret; + + up.port.uartclk =clk_get_rate (priv->clk);spin_lock_init (&priv->atomic_write_lock);
Signature · 1 line
2.7.4
PATCH 3/3 serial: 8250_uniphier: add auto-flow-control support
In reply to Masahiro YamadaFrom: Dai Okamura <[email protected]>
Add selective auto-flow-control support for UniPhier serial driver.
---
Documentation/devicetree/bindings/serial/uniphier-uart.txt | 3 +++ drivers/tty/serial/8250/8250_uniphier.c | 3 +++ 2 files changed, 6 insertions(+)
Documentation/devicetree/bindings/serial/uniphier-uart.txt +3 -0
@@ -6,6 +6,9 @@ Required properties: - interrupts: a single interrupt specifier. - clocks: phandle to the input clock. +Optional properties: +-auto-flow-control: enable automatic flow control support. + Example: aliases { serial0 = &serial0;
drivers/tty/serial/8250/8250_uniphier.c +3 -0
@@ -222,6 +222,9 @@ static int uniphier_uart_probe(struct platform_device *pdev) up.port.flags =UPF_FIXED_PORT |UPF_FIXED_TYPE ; up.capabilities =UART_CAP_FIFO ; +if (of_property_read_bool (dev->of_node,"auto-flow-control" )) + up.capabilities |=UART_CAP_AFE ; + up.port.serial_in = uniphier_serial_in; up.port.serial_out = uniphier_serial_out; up.dl_read = uniphier_serial_dl_read;
Signature · 1 line
2.7.4
Rob Herring
maintainerPATCH 3/3 serial: 8250_uniphier: add auto-flow-control support
Quoted 4 lines · Masahiro Yamada
From: Dai Okamura <[email protected]>
Add selective auto-flow-control support for UniPhier serial driver.
Quoted 8 lines
Signed-off-by Dai Okamura <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>---
Documentation/devicetree/bindings/serial/uniphier-uart.txt | 3 +++ drivers/tty/serial/8250/8250_uniphier.c | 3 +++ 2 files changed, 6 insertions(+)