linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] 8250_dw and 8250_dma fixes
@ 2013-01-16 12:08 Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 1/4] serial: 8250_dma: Switch to using tty_port Heikki Krogerus
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Heikki Krogerus @ 2013-01-16 12:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Cox, linux-serial

Hi,

The 8250_dma.c needs to be converted to use tty_port since the tty
buffer functions are now changes. The 8250_dw.c needs to have ifdef
wrapping the ACPI code as there are no stubs for ACPI functions. 

There is also an optimisation for 8250_dw.c and an optimisation for
8250_dma.c in this set.


Heikki Krogerus (4):
  serial: 8250_dma: Switch to using tty_port
  serial: 8250_dma: TX optimisation
  serial: 8250_dw: Use ifdef with ACPI
  serial: 8250_dw: Set maxburst size

 drivers/tty/serial/8250/8250_dma.c |   17 ++++++++++-------
 drivers/tty/serial/8250/8250_dw.c  |   13 +++++++++++--
 2 files changed, 21 insertions(+), 9 deletions(-)

-- 
1.7.10.4


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

* [PATCH 1/4] serial: 8250_dma: Switch to using tty_port
  2013-01-16 12:08 [PATCH 0/4] 8250_dw and 8250_dma fixes Heikki Krogerus
@ 2013-01-16 12:08 ` Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 2/4] serial: 8250_dma: TX optimisation Heikki Krogerus
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2013-01-16 12:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Cox, linux-serial

The tty buffer functions are converted to using tty_port
structure instead of struct tty, so we must do the same.

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

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index 95516a1..02333fc 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -43,8 +43,9 @@ static void __dma_rx_complete(void *param)
 {
 	struct uart_8250_port	*p = param;
 	struct uart_8250_dma	*dma = p->dma;
-	struct tty_struct	*tty = p->port.state->port.tty;
+	struct tty_port		*tty_port = &p->port.state->port;
 	struct dma_tx_state	state;
+	int			count;
 
 	dma_sync_single_for_cpu(dma->rxchan->device->dev, dma->rx_addr,
 				dma->rx_size, DMA_FROM_DEVICE);
@@ -52,10 +53,12 @@ static void __dma_rx_complete(void *param)
 	dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
 	dmaengine_terminate_all(dma->rxchan);
 
-	tty_insert_flip_string(tty, dma->rx_buf, dma->rx_size - state.residue);
-	p->port.icount.rx += dma->rx_size - state.residue;
+	count = dma->rx_size - state.residue;
 
-	tty_flip_buffer_push(tty);
+	tty_insert_flip_string(tty_port, dma->rx_buf, count);
+	p->port.icount.rx += count;
+
+	tty_flip_buffer_push(tty_port);
 }
 
 int serial8250_tx_dma(struct uart_8250_port *p)
-- 
1.7.10.4


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

* [PATCH 2/4] serial: 8250_dma: TX optimisation
  2013-01-16 12:08 [PATCH 0/4] 8250_dw and 8250_dma fixes Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 1/4] serial: 8250_dma: Switch to using tty_port Heikki Krogerus
@ 2013-01-16 12:08 ` Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 3/4] serial: 8250_dw: Use ifdef with ACPI Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 4/4] serial: 8250_dw: Set maxburst size Heikki Krogerus
  3 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2013-01-16 12:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Cox, linux-serial

Remove one useless wakeup, and do not use DMA with zero byte
transfers.

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

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index 02333fc..b9f7fd2 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -67,12 +67,12 @@ int serial8250_tx_dma(struct uart_8250_port *p)
 	struct circ_buf			*xmit = &p->port.state->xmit;
 	struct dma_async_tx_descriptor	*desc;
 
-	if (dma->tx_running) {
-		uart_write_wakeup(&p->port);
+	if (dma->tx_running)
 		return -EBUSY;
-	}
 
 	dma->tx_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
+	if (!dma->tx_size)
+		return -EINVAL;
 
 	desc = dmaengine_prep_slave_single(dma->txchan,
 					   dma->tx_addr + xmit->tail,
-- 
1.7.10.4


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

* [PATCH 3/4] serial: 8250_dw: Use ifdef with ACPI
  2013-01-16 12:08 [PATCH 0/4] 8250_dw and 8250_dma fixes Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 1/4] serial: 8250_dma: Switch to using tty_port Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 2/4] serial: 8250_dma: TX optimisation Heikki Krogerus
@ 2013-01-16 12:08 ` Heikki Krogerus
  2013-01-16 12:08 ` [PATCH 4/4] serial: 8250_dw: Set maxburst size Heikki Krogerus
  3 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2013-01-16 12:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Cox, linux-serial

There are no stubs for ACPI functions so the driver needs to
have this ifdef or it will not compile without ACPI.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index ceacf5e..bfdaf8b 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -145,6 +145,7 @@ static int dw8250_probe_of(struct uart_port *p)
 	return 0;
 }
 
+#ifdef CONFIG_ACPI
 static bool dw8250_acpi_dma_filter(struct dma_chan *chan, void *parm)
 {
 	return chan->chan_id == *(int *)parm;
@@ -231,6 +232,12 @@ static int dw8250_probe_acpi(struct uart_port *p)
 
 	return 0;
 }
+#else
+static inline int dw8250_probe_acpi(struct uart_port *p)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_ACPI */
 
 static void dw8250_setup_port(struct uart_8250_port *up)
 {
-- 
1.7.10.4


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

* [PATCH 4/4] serial: 8250_dw: Set maxburst size
  2013-01-16 12:08 [PATCH 0/4] 8250_dw and 8250_dma fixes Heikki Krogerus
                   ` (2 preceding siblings ...)
  2013-01-16 12:08 ` [PATCH 3/4] serial: 8250_dw: Use ifdef with ACPI Heikki Krogerus
@ 2013-01-16 12:08 ` Heikki Krogerus
  3 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2013-01-16 12:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Cox, linux-serial

The default burst is often 1 byte which is not very optimal.
The ideal burst size when using 16550A type port would be
1/2 of fifosize, but this does not work with all Designware
implementations. Setting it to 1/4 fifosize.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index bfdaf8b..117bb8b 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -178,6 +178,7 @@ dw8250_acpi_walk_resource(struct acpi_resource *res, void *data)
 			slave->direction	= DMA_MEM_TO_DEV;
 			slave->dst_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
 			slave->slave_id		= fixed_dma->request_lines;
+			slave->dst_maxburst	= port->tx_loadsz / 4;
 
 			dma->tx_chan_id		= fixed_dma->channels;
 			dma->tx_param		= &dma->tx_chan_id;
@@ -189,6 +190,7 @@ dw8250_acpi_walk_resource(struct acpi_resource *res, void *data)
 			slave->direction	= DMA_DEV_TO_MEM;
 			slave->src_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
 			slave->slave_id		= fixed_dma->request_lines;
+			slave->src_maxburst	= p->fifosize / 4;
 
 			dma->rx_chan_id		= fixed_dma->channels;
 			dma->rx_param		= &dma->rx_chan_id;
@@ -296,6 +298,8 @@ static int dw8250_probe(struct platform_device *pdev)
 	uart.port.serial_in = dw8250_serial_in;
 	uart.port.serial_out = dw8250_serial_out;
 
+	dw8250_setup_port(&uart);
+
 	if (pdev->dev.of_node) {
 		err = dw8250_probe_of(&uart.port);
 		if (err)
@@ -308,8 +312,6 @@ static int dw8250_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	dw8250_setup_port(&uart);
-
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
-- 
1.7.10.4


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

end of thread, other threads:[~2013-01-16 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 12:08 [PATCH 0/4] 8250_dw and 8250_dma fixes Heikki Krogerus
2013-01-16 12:08 ` [PATCH 1/4] serial: 8250_dma: Switch to using tty_port Heikki Krogerus
2013-01-16 12:08 ` [PATCH 2/4] serial: 8250_dma: TX optimisation Heikki Krogerus
2013-01-16 12:08 ` [PATCH 3/4] serial: 8250_dw: Use ifdef with ACPI Heikki Krogerus
2013-01-16 12:08 ` [PATCH 4/4] serial: 8250_dw: Set maxburst size Heikki Krogerus

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).