All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] serial: of_serial: new properties
@ 2013-03-25 11:34 Heikki Krogerus
  2013-03-25 11:34 ` [PATCH 1/3] serial: 8250: Allow probe drivers to ignore tx_loadsz Heikki Krogerus
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 11:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Ley Foon Tan, linux-kernel, linux-serial

These add support for  fifo-size and hw-flow-control properties. The
idea is to try to avoid adding new types to 8250.c for UARTs that are
compatible with the standard types but that have different size fifo
or support 16750 compatible auto flow control.


Heikki Krogerus (3):
  serial: 8250: Allow probe drivers to ignore tx_loadsz
  serial: of_serial: Handle fifo-size property
  serial: of_serial: Handle hw-flow-control property

 .../devicetree/bindings/tty/serial/of-serial.txt      |    2 ++
 drivers/tty/serial/8250/8250.c                        |    4 ++++
 drivers/tty/serial/of_serial.c                        |   17 ++++++++++++++---
 3 files changed, 20 insertions(+), 3 deletions(-)

-- 
1.7.10.4


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

* [PATCH 1/3] serial: 8250: Allow probe drivers to ignore tx_loadsz
  2013-03-25 11:34 [PATCH 0/3] serial: of_serial: new properties Heikki Krogerus
@ 2013-03-25 11:34 ` Heikki Krogerus
  2013-03-25 11:34 ` [PATCH 2/3] serial: of_serial: Handle fifo-size property Heikki Krogerus
  2013-03-25 11:34 ` [PATCH 3/3] serial: of_serial: Handle hw-flow-control property Heikki Krogerus
  2 siblings, 0 replies; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 11:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Ley Foon Tan, linux-kernel, linux-serial

In most cases the tx_loadsz is the same as fifosize. This
will store the fifosize in it if it was not separately
delivered from the driver.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/tty/serial/8250/8250.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index cf6a538..19ebbdf 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -3247,6 +3247,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 		uart->tx_loadsz		= up->tx_loadsz;
 		uart->capabilities	= up->capabilities;
 
+		/* Take tx_loadsz from fifosize if it wasn't set separately */
+		if (uart->port.fifosize && !uart->tx_loadsz)
+			uart->tx_loadsz = uart->port.fifosize;
+
 		if (up->port.dev)
 			uart->port.dev = up->port.dev;
 
-- 
1.7.10.4


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

* [PATCH 2/3] serial: of_serial: Handle fifo-size property
  2013-03-25 11:34 [PATCH 0/3] serial: of_serial: new properties Heikki Krogerus
  2013-03-25 11:34 ` [PATCH 1/3] serial: 8250: Allow probe drivers to ignore tx_loadsz Heikki Krogerus
@ 2013-03-25 11:34 ` Heikki Krogerus
  2013-03-25 11:38   ` Arnd Bergmann
  2013-03-25 11:34 ` [PATCH 3/3] serial: of_serial: Handle hw-flow-control property Heikki Krogerus
  2 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 11:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Ley Foon Tan, linux-kernel, linux-serial

This will reduce the need for extra types in 8250.c just
in case the fifo size differs from the standard.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 Documentation/devicetree/bindings/tty/serial/of-serial.txt |    1 +
 drivers/tty/serial/of_serial.c                             |    4 ++++
 2 files changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/tty/serial/of-serial.txt b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
index 8f01cb1..c13f0ce 100644
--- a/Documentation/devicetree/bindings/tty/serial/of-serial.txt
+++ b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
@@ -33,6 +33,7 @@ Optional properties:
   RTAS and should not be registered.
 - no-loopback-test: set to indicate that the port does not implements loopback
   test mode
+- fifo-size: the fifo size of the UART.
 
 Example:
 
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index b025d54..267711b 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -97,6 +97,10 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
 	if (of_property_read_u32(np, "reg-shift", &prop) == 0)
 		port->regshift = prop;
 
+	/* Check for fifo size */
+	if (of_property_read_u32(np, "fifo-size", &prop) == 0)
+		port->fifosize = prop;
+
 	port->irq = irq_of_parse_and_map(np, 0);
 	port->iotype = UPIO_MEM;
 	if (of_property_read_u32(np, "reg-io-width", &prop) == 0) {
-- 
1.7.10.4


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

* [PATCH 3/3] serial: of_serial: Handle hw-flow-control property
  2013-03-25 11:34 [PATCH 0/3] serial: of_serial: new properties Heikki Krogerus
  2013-03-25 11:34 ` [PATCH 1/3] serial: 8250: Allow probe drivers to ignore tx_loadsz Heikki Krogerus
  2013-03-25 11:34 ` [PATCH 2/3] serial: of_serial: Handle fifo-size property Heikki Krogerus
@ 2013-03-25 11:34 ` Heikki Krogerus
  2013-03-25 11:40   ` Arnd Bergmann
  2 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 11:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Ley Foon Tan, linux-kernel, linux-serial

This will add support for hardware flow control. It is
limited to be used only with 8250 driver.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 .../devicetree/bindings/tty/serial/of-serial.txt          |    1 +
 drivers/tty/serial/of_serial.c                            |   13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/tty/serial/of-serial.txt b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
index c13f0ce..e775c93 100644
--- a/Documentation/devicetree/bindings/tty/serial/of-serial.txt
+++ b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
@@ -34,6 +34,7 @@ Optional properties:
 - no-loopback-test: set to indicate that the port does not implements loopback
   test mode
 - fifo-size: the fifo size of the UART.
+- hw-flow-control: support for hardware flow control
 
 Example:
 
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 267711b..2933112 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -14,7 +14,6 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/serial_core.h>
-#include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -22,6 +21,8 @@
 #include <linux/nwpserial.h>
 #include <linux/clk.h>
 
+#include "8250/8250.h"
+
 struct of_serial_info {
 	struct clk *clk;
 	int type;
@@ -171,11 +172,17 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
 #ifdef CONFIG_SERIAL_8250
 	case PORT_8250 ... PORT_MAX_8250:
 	{
-		/* For now the of bindings don't support the extra
-		   8250 specific bits */
 		struct uart_8250_port port8250;
 		memset(&port8250, 0, sizeof(port8250));
 		port8250.port = port;
+
+		if (port.fifosize)
+			port8250.capabilities = UART_CAP_FIFO;
+
+		if (of_property_read_bool(ofdev->dev.of_node,
+					  "hw-flow-control"))
+			port8250.capabilities |= UART_CAP_AFE;
+
 		ret = serial8250_register_8250_port(&port8250);
 		break;
 	}
-- 
1.7.10.4


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

* Re: [PATCH 2/3] serial: of_serial: Handle fifo-size property
  2013-03-25 11:34 ` [PATCH 2/3] serial: of_serial: Handle fifo-size property Heikki Krogerus
@ 2013-03-25 11:38   ` Arnd Bergmann
  0 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2013-03-25 11:38 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Monday 25 March 2013, Heikki Krogerus wrote:
> 
> This will reduce the need for extra types in 8250.c just
> in case the fifo size differs from the standard.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH 3/3] serial: of_serial: Handle hw-flow-control property
  2013-03-25 11:34 ` [PATCH 3/3] serial: of_serial: Handle hw-flow-control property Heikki Krogerus
@ 2013-03-25 11:40   ` Arnd Bergmann
  2013-03-25 12:28     ` Heikki Krogerus
  0 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2013-03-25 11:40 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Monday 25 March 2013, Heikki Krogerus wrote:
> This will add support for hardware flow control. It is
> limited to be used only with 8250 driver.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Does this imply that we can use hardware flow control only when this
flag is set in the device tree? I assumed that working flow control
would be the default. Is it not?

	Arnd

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

* Re: [PATCH 3/3] serial: of_serial: Handle hw-flow-control property
  2013-03-25 11:40   ` Arnd Bergmann
@ 2013-03-25 12:28     ` Heikki Krogerus
  2013-03-25 12:47       ` Arnd Bergmann
  0 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 12:28 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Mon, Mar 25, 2013 at 11:40:31AM +0000, Arnd Bergmann wrote:
> On Monday 25 March 2013, Heikki Krogerus wrote:
> > This will add support for hardware flow control. It is
> > limited to be used only with 8250 driver.
> > 
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> Does this imply that we can use hardware flow control only when this
> flag is set in the device tree? I assumed that working flow control
> would be the default. Is it not?

OK, the commit message is wrong. Is the patch otherwise OK?

-- 
heikki

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

* Re: [PATCH 3/3] serial: of_serial: Handle hw-flow-control property
  2013-03-25 12:28     ` Heikki Krogerus
@ 2013-03-25 12:47       ` Arnd Bergmann
  2013-03-25 12:57         ` Heikki Krogerus
  0 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2013-03-25 12:47 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Monday 25 March 2013, Heikki Krogerus wrote:
> On Mon, Mar 25, 2013 at 11:40:31AM +0000, Arnd Bergmann wrote:
> > On Monday 25 March 2013, Heikki Krogerus wrote:
> > > This will add support for hardware flow control. It is
> > > limited to be used only with 8250 driver.
> > > 
> > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > 
> > Does this imply that we can use hardware flow control only when this
> > flag is set in the device tree? I assumed that working flow control
> > would be the default. Is it not?
> 
> OK, the commit message is wrong. Is the patch otherwise OK?

I still find the text in the binding and the name of the property confusing,
because it seems to imply that you have no hardware flow control without this.
I think what you mean here is really "automatic flow control" rather than
"hardware flow control".

	Arnd

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

* Re: [PATCH 3/3] serial: of_serial: Handle hw-flow-control property
  2013-03-25 12:47       ` Arnd Bergmann
@ 2013-03-25 12:57         ` Heikki Krogerus
  2013-03-25 13:04           ` Arnd Bergmann
  0 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 12:57 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Mon, Mar 25, 2013 at 12:47:58PM +0000, Arnd Bergmann wrote:
> On Monday 25 March 2013, Heikki Krogerus wrote:
> > On Mon, Mar 25, 2013 at 11:40:31AM +0000, Arnd Bergmann wrote:
> > > On Monday 25 March 2013, Heikki Krogerus wrote:
> > > > This will add support for hardware flow control. It is
> > > > limited to be used only with 8250 driver.
> > > > 
> > > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > 
> > > Does this imply that we can use hardware flow control only when this
> > > flag is set in the device tree? I assumed that working flow control
> > > would be the default. Is it not?
> > 
> > OK, the commit message is wrong. Is the patch otherwise OK?
> 
> I still find the text in the binding and the name of the property confusing,
> because it seems to imply that you have no hardware flow control without this.
> I think what you mean here is really "automatic flow control" rather than
> "hardware flow control".

Ah, I understand. I'll change the property name to auto-flow-control.

-- 
heikki

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

* Re: [PATCH 3/3] serial: of_serial: Handle hw-flow-control property
  2013-03-25 12:57         ` Heikki Krogerus
@ 2013-03-25 13:04           ` Arnd Bergmann
  2013-03-25 13:17             ` Heikki Krogerus
  0 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2013-03-25 13:04 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Monday 25 March 2013, Heikki Krogerus wrote:
> On Mon, Mar 25, 2013 at 12:47:58PM +0000, Arnd Bergmann wrote:
> > On Monday 25 March 2013, Heikki Krogerus wrote:
> > > On Mon, Mar 25, 2013 at 11:40:31AM +0000, Arnd Bergmann wrote:
> > > > On Monday 25 March 2013, Heikki Krogerus wrote:
> > > > > This will add support for hardware flow control. It is
> > > > > limited to be used only with 8250 driver.
> > > > > 
> > > > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > > 
> > > > Does this imply that we can use hardware flow control only when this
> > > > flag is set in the device tree? I assumed that working flow control
> > > > would be the default. Is it not?
> > > 
> > > OK, the commit message is wrong. Is the patch otherwise OK?
> > 
> > I still find the text in the binding and the name of the property confusing,
> > because it seems to imply that you have no hardware flow control without this.
> > I think what you mean here is really "automatic flow control" rather than
> > "hardware flow control".
> 
> Ah, I understand. I'll change the property name to auto-flow-control.
> 

Ok, sounds good. I would also suggest rewording the description in the
binding so that the driver is allowed to detect the presence of the automatic
flow control capability even if the property is not set, because that's
what the driver does.

	Arnd

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

* Re: [PATCH 3/3] serial: of_serial: Handle hw-flow-control property
  2013-03-25 13:04           ` Arnd Bergmann
@ 2013-03-25 13:17             ` Heikki Krogerus
  2013-03-25 13:51               ` [PATCHv2 3/3] serial: of_serial: Handle auto-flow-control property Heikki Krogerus
  0 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 13:17 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Mon, Mar 25, 2013 at 01:04:47PM +0000, Arnd Bergmann wrote:
> > > I still find the text in the binding and the name of the property confusing,
> > > because it seems to imply that you have no hardware flow control without this.
> > > I think what you mean here is really "automatic flow control" rather than
> > > "hardware flow control".
> > 
> > Ah, I understand. I'll change the property name to auto-flow-control.
> > 
> 
> Ok, sounds good. I would also suggest rewording the description in the
> binding so that the driver is allowed to detect the presence of the automatic
> flow control capability even if the property is not set, because that's
> what the driver does.

OK, I'll fix the description too.

Thanks,

-- 
heikki

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

* [PATCHv2 3/3] serial: of_serial: Handle auto-flow-control property
  2013-03-25 13:17             ` Heikki Krogerus
@ 2013-03-25 13:51               ` Heikki Krogerus
  2013-03-25 13:53                 ` Arnd Bergmann
  0 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2013-03-25 13:51 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Ley Foon Tan, linux-kernel, linux-serial

Automatic Flow Control capability is not tied to this
property. This is only one way of detecting it. The property
is limited to be used only with 8250 driver.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 .../devicetree/bindings/tty/serial/of-serial.txt          |    3 +++
 drivers/tty/serial/of_serial.c                            |   13 ++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/tty/serial/of-serial.txt b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
index c13f0ce..1928a3e 100644
--- a/Documentation/devicetree/bindings/tty/serial/of-serial.txt
+++ b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
@@ -34,6 +34,9 @@ Optional properties:
 - no-loopback-test: set to indicate that the port does not implements loopback
   test mode
 - fifo-size: the fifo size of the UART.
+- auto-flow-control: one way to enable automatic flow control support. The
+  driver is allowed to detect support for the capability even without this
+  property.
 
 Example:
 
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 267711b..39c7ea4 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -14,7 +14,6 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/serial_core.h>
-#include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -22,6 +21,8 @@
 #include <linux/nwpserial.h>
 #include <linux/clk.h>
 
+#include "8250/8250.h"
+
 struct of_serial_info {
 	struct clk *clk;
 	int type;
@@ -171,11 +172,17 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
 #ifdef CONFIG_SERIAL_8250
 	case PORT_8250 ... PORT_MAX_8250:
 	{
-		/* For now the of bindings don't support the extra
-		   8250 specific bits */
 		struct uart_8250_port port8250;
 		memset(&port8250, 0, sizeof(port8250));
 		port8250.port = port;
+
+		if (port.fifosize)
+			port8250.capabilities = UART_CAP_FIFO;
+
+		if (of_property_read_bool(ofdev->dev.of_node,
+					  "auto-flow-control"))
+			port8250.capabilities |= UART_CAP_AFE;
+
 		ret = serial8250_register_8250_port(&port8250);
 		break;
 	}
-- 
1.7.10.4


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

* Re: [PATCHv2 3/3] serial: of_serial: Handle auto-flow-control property
  2013-03-25 13:51               ` [PATCHv2 3/3] serial: of_serial: Handle auto-flow-control property Heikki Krogerus
@ 2013-03-25 13:53                 ` Arnd Bergmann
  0 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2013-03-25 13:53 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Ley Foon Tan, linux-kernel, linux-serial

On Monday 25 March 2013, Heikki Krogerus wrote:
> 
> Automatic Flow Control capability is not tied to this
> property. This is only one way of detecting it. The property
> is limited to be used only with 8250 driver.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

end of thread, other threads:[~2013-03-25 13:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 11:34 [PATCH 0/3] serial: of_serial: new properties Heikki Krogerus
2013-03-25 11:34 ` [PATCH 1/3] serial: 8250: Allow probe drivers to ignore tx_loadsz Heikki Krogerus
2013-03-25 11:34 ` [PATCH 2/3] serial: of_serial: Handle fifo-size property Heikki Krogerus
2013-03-25 11:38   ` Arnd Bergmann
2013-03-25 11:34 ` [PATCH 3/3] serial: of_serial: Handle hw-flow-control property Heikki Krogerus
2013-03-25 11:40   ` Arnd Bergmann
2013-03-25 12:28     ` Heikki Krogerus
2013-03-25 12:47       ` Arnd Bergmann
2013-03-25 12:57         ` Heikki Krogerus
2013-03-25 13:04           ` Arnd Bergmann
2013-03-25 13:17             ` Heikki Krogerus
2013-03-25 13:51               ` [PATCHv2 3/3] serial: of_serial: Handle auto-flow-control property Heikki Krogerus
2013-03-25 13:53                 ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.