All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers
@ 2013-04-10 13:58 Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 1/9] serial: 8250_dma: TX cleanup Heikki Krogerus
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

These will update 8250_dma to take advantage of the new dmaengine API helpers
that makes it possible to request channels without the filter parameters. The
helpers also support ACPI on top of DT, so the ACPI specific DMA information
parsing in 8250_dw can also be dropped.

These also include a few minor improvements for both 8250_dma and 8250_dw plus
runtime PM support for 8250_dw.


Heikki Krogerus (9):
  serial: 8250_dma: TX cleanup
  serial: 8250_dma: Fix RX handling
  serial: 8250_dma: Use dmaengine helpers to get the slave channels
  serial: 8250_dma: Provide default slave configuration parameters
  serial: 8250_dw: Enable runtime PM
  serial: 8250_dw: Support clk framework also with ACPI
  serial: 8250_dw: Let ACPI code extract the DMA client info
  serial: 8250_dw: Set port capabilities based on CPR register
  serial: 8250_dw: Use devm_request_and_ioremap()

 drivers/tty/serial/8250/8250_dma.c |   52 ++++++++----
 drivers/tty/serial/8250/8250_dw.c  |  158 ++++++++++++++++--------------------
 2 files changed, 104 insertions(+), 106 deletions(-)

-- 
1.7.10.4


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

* [PATCH 1/9] serial: 8250_dma: TX cleanup
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 2/9] serial: 8250_dma: Fix RX handling Heikki Krogerus
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

Removing one unneeded uart_write_wakeup(). There is no need
to start PIO transfer unless DMA fails, so this also changes
serial8250_tx_dma() to return 0 unless that is the case.

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

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index b9f7fd2..ce2518d 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -33,10 +33,8 @@ static void __dma_tx_complete(void *param)
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
 		uart_write_wakeup(&p->port);
 
-	if (!uart_circ_empty(xmit) && !uart_tx_stopped(&p->port)) {
+	if (!uart_circ_empty(xmit) && !uart_tx_stopped(&p->port))
 		serial8250_tx_dma(p);
-		uart_write_wakeup(&p->port);
-	}
 }
 
 static void __dma_rx_complete(void *param)
@@ -67,12 +65,11 @@ 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)
-		return -EBUSY;
+	if (uart_tx_stopped(&p->port) || dma->tx_running ||
+	    uart_circ_empty(xmit))
+		return 0;
 
 	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] 12+ messages in thread

* [PATCH 2/9] serial: 8250_dma: Fix RX handling
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 1/9] serial: 8250_dma: TX cleanup Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 3/9] serial: 8250_dma: Use dmaengine helpers to get the slave channels Heikki Krogerus
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

Overrun, parity and framing errors should be handled in
8250_core. This also adds check for the dma_status and exits
if the channel is not idle.

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

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index ce2518d..6643061 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -101,20 +101,29 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
 	struct dma_tx_state		state;
 	int				dma_status;
 
-	/*
-	 * If RCVR FIFO trigger level was not reached, complete the transfer and
-	 * let 8250.c copy the remaining data.
-	 */
-	if ((iir & 0x3f) == UART_IIR_RX_TIMEOUT) {
-		dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie,
-						&state);
+	dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
+
+	switch (iir & 0x3f) {
+	case UART_IIR_RLSI:
+		/* 8250_core handles errors and break interrupts */
+		return -EIO;
+	case UART_IIR_RX_TIMEOUT:
+		/*
+		 * If RCVR FIFO trigger level was not reached, complete the
+		 * transfer and let 8250_core copy the remaining data.
+		 */
 		if (dma_status == DMA_IN_PROGRESS) {
 			dmaengine_pause(dma->rxchan);
 			__dma_rx_complete(p);
 		}
 		return -ETIMEDOUT;
+	default:
+		break;
 	}
 
+	if (dma_status)
+		return 0;
+
 	desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr,
 					   dma->rx_size, DMA_DEV_TO_MEM,
 					   DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-- 
1.7.10.4


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

* [PATCH 3/9] serial: 8250_dma: Use dmaengine helpers to get the slave channels
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 1/9] serial: 8250_dma: TX cleanup Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 2/9] serial: 8250_dma: Fix RX handling Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 4/9] serial: 8250_dma: Provide default slave configuration parameters Heikki Krogerus
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

The helper functions in dmaengine API allow the drivers to
request slave channels without the filter parameters. They
will attempt to extract the needed DMA client information
from DT or ACPI, but if such information is not available
the filter parameters can still be used.

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

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index 6643061..fdb6139e 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -156,14 +156,18 @@ int serial8250_request_dma(struct uart_8250_port *p)
 	dma_cap_set(DMA_SLAVE, mask);
 
 	/* Get a channel for RX */
-	dma->rxchan = dma_request_channel(mask, dma->fn, dma->rx_param);
+	dma->rxchan = dma_request_slave_channel_compat(mask,
+						       dma->fn, dma->rx_param,
+						       p->port.dev, "rx");
 	if (!dma->rxchan)
 		return -ENODEV;
 
 	dmaengine_slave_config(dma->rxchan, &dma->rxconf);
 
 	/* Get a channel for TX */
-	dma->txchan = dma_request_channel(mask, dma->fn, dma->tx_param);
+	dma->txchan = dma_request_slave_channel_compat(mask,
+						       dma->fn, dma->tx_param,
+						       p->port.dev, "tx");
 	if (!dma->txchan) {
 		dma_release_channel(dma->rxchan);
 		return -ENODEV;
-- 
1.7.10.4


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

* [PATCH 4/9] serial: 8250_dma: Provide default slave configuration parameters
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
                   ` (2 preceding siblings ...)
  2013-04-10 13:58 ` [PATCH 3/9] serial: 8250_dma: Use dmaengine helpers to get the slave channels Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 5/9] serial: 8250_dw: Enable runtime PM Heikki Krogerus
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

Some slave channel parameters will be always the same. For
example, direction for the Rx channel will always be
DMA_DEV_TO_MEM and DMA_MEM_TO_DEV for Tx channel.

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

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index fdb6139e..7046769 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -149,8 +149,14 @@ int serial8250_request_dma(struct uart_8250_port *p)
 	struct uart_8250_dma	*dma = p->dma;
 	dma_cap_mask_t		mask;
 
-	dma->rxconf.src_addr = p->port.mapbase + UART_RX;
-	dma->txconf.dst_addr = p->port.mapbase + UART_TX;
+	/* Default slave configuration parameters */
+	dma->rxconf.direction		= DMA_DEV_TO_MEM;
+	dma->rxconf.src_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
+	dma->rxconf.src_addr		= p->port.mapbase + UART_RX;
+
+	dma->txconf.direction		= DMA_MEM_TO_DEV;
+	dma->txconf.dst_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
+	dma->txconf.dst_addr		= p->port.mapbase + UART_TX;
 
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
-- 
1.7.10.4


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

* [PATCH 5/9] serial: 8250_dw: Enable runtime PM
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
                   ` (3 preceding siblings ...)
  2013-04-10 13:58 ` [PATCH 4/9] serial: 8250_dma: Provide default slave configuration parameters Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 6/9] serial: 8250_dw: Support clk framework also with ACPI Heikki Krogerus
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

This allows ACPI to put the device to D3 when it's not used.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 3dedd24..d6aea85 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -27,6 +27,7 @@
 #include <linux/slab.h>
 #include <linux/acpi.h>
 #include <linux/clk.h>
+#include <linux/pm_runtime.h>
 
 #include "8250.h"
 
@@ -115,6 +116,18 @@ static int dw8250_handle_irq(struct uart_port *p)
 	return 0;
 }
 
+static void
+dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)
+{
+	if (!state)
+		pm_runtime_get_sync(port->dev);
+
+	serial8250_do_pm(port, state, old);
+
+	if (state)
+		pm_runtime_put_sync_suspend(port->dev);
+}
+
 static int dw8250_probe_of(struct uart_port *p)
 {
 	struct device_node	*np = p->dev->of_node;
@@ -293,6 +306,7 @@ static int dw8250_probe(struct platform_device *pdev)
 	uart.port.mapbase = regs->start;
 	uart.port.irq = irq->start;
 	uart.port.handle_irq = dw8250_handle_irq;
+	uart.port.pm = dw8250_do_pm;
 	uart.port.type = PORT_8250;
 	uart.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT;
 	uart.port.dev = &pdev->dev;
@@ -336,6 +350,9 @@ static int dw8250_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, data);
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	return 0;
 }
 
@@ -343,37 +360,64 @@ static int dw8250_remove(struct platform_device *pdev)
 {
 	struct dw8250_data *data = platform_get_drvdata(pdev);
 
+	pm_runtime_get_sync(&pdev->dev);
+
 	serial8250_unregister_port(data->line);
 
 	if (!IS_ERR(data->clk))
 		clk_disable_unprepare(data->clk);
 
+	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
+
 	return 0;
 }
 
 #ifdef CONFIG_PM
-static int dw8250_suspend(struct platform_device *pdev, pm_message_t state)
+static int dw8250_suspend(struct device *dev)
 {
-	struct dw8250_data *data = platform_get_drvdata(pdev);
+	struct dw8250_data *data = dev_get_drvdata(dev);
 
 	serial8250_suspend_port(data->line);
 
 	return 0;
 }
 
-static int dw8250_resume(struct platform_device *pdev)
+static int dw8250_resume(struct device *dev)
 {
-	struct dw8250_data *data = platform_get_drvdata(pdev);
+	struct dw8250_data *data = dev_get_drvdata(dev);
 
 	serial8250_resume_port(data->line);
 
 	return 0;
 }
-#else
-#define dw8250_suspend NULL
-#define dw8250_resume NULL
 #endif /* CONFIG_PM */
 
+#ifdef CONFIG_PM_RUNTIME
+static int dw8250_runtime_suspend(struct device *dev)
+{
+	struct dw8250_data *data = dev_get_drvdata(dev);
+
+	clk_disable_unprepare(data->clk);
+
+	return 0;
+}
+
+static int dw8250_runtime_resume(struct device *dev)
+{
+	struct dw8250_data *data = dev_get_drvdata(dev);
+
+	clk_prepare_enable(data->clk);
+
+	return 0;
+}
+#endif
+
+static const struct dev_pm_ops dw8250_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume)
+	SET_RUNTIME_PM_OPS(dw8250_runtime_suspend, dw8250_runtime_resume, NULL)
+};
+
 static const struct of_device_id dw8250_of_match[] = {
 	{ .compatible = "snps,dw-apb-uart" },
 	{ /* Sentinel */ }
@@ -391,13 +435,12 @@ static struct platform_driver dw8250_platform_driver = {
 	.driver = {
 		.name		= "dw-apb-uart",
 		.owner		= THIS_MODULE,
+		.pm		= &dw8250_pm_ops,
 		.of_match_table	= dw8250_of_match,
 		.acpi_match_table = ACPI_PTR(dw8250_acpi_match),
 	},
 	.probe			= dw8250_probe,
 	.remove			= dw8250_remove,
-	.suspend		= dw8250_suspend,
-	.resume			= dw8250_resume,
 };
 
 module_platform_driver(dw8250_platform_driver);
-- 
1.7.10.4


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

* [PATCH 6/9] serial: 8250_dw: Support clk framework also with ACPI
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
                   ` (4 preceding siblings ...)
  2013-04-10 13:58 ` [PATCH 5/9] serial: 8250_dw: Enable runtime PM Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 7/9] serial: 8250_dw: Let ACPI code extract the DMA client info Heikki Krogerus
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

The Lynxpoint LPSS peripheral clocks are now handled in clk
framework so the drivers do not need to take care of them
manually. In dw8250_probe_acpi(), the uartclk is now taken
from the driver_data only if it was not already set.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index d6aea85..de7a186 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -36,9 +36,6 @@
 #define DW_UART_CPR	0xf4 /* Component Parameter Register */
 #define DW_UART_UCV	0xf8 /* UART Component Version */
 
-/* Intel Low Power Subsystem specific */
-#define LPSS_PRV_CLOCK_PARAMS 0x800
-
 /* Component Parameter Register bits */
 #define DW_UART_CPR_ABP_DATA_WIDTH	(3 << 0)
 #define DW_UART_CPR_AFCE_MODE		(1 << 4)
@@ -226,7 +223,6 @@ static int dw8250_probe_acpi(struct uart_port *p)
 {
 	const struct acpi_device_id *id;
 	acpi_status status;
-	u32 reg;
 
 	id = acpi_match_device(p->dev->driver->acpi_match_table, p->dev);
 	if (!id)
@@ -236,7 +232,9 @@ static int dw8250_probe_acpi(struct uart_port *p)
 	p->serial_in = dw8250_serial_in32;
 	p->serial_out = dw8250_serial_out32;
 	p->regshift = 2;
-	p->uartclk = (unsigned int)id->driver_data;
+
+	if (!p->uartclk)
+		p->uartclk = (unsigned int)id->driver_data;
 
 	status = acpi_walk_resources(ACPI_HANDLE(p->dev), METHOD_NAME__CRS,
 				     dw8250_acpi_walk_resource, p);
@@ -246,12 +244,6 @@ static int dw8250_probe_acpi(struct uart_port *p)
 		return -ENODEV;
 	}
 
-	/* Fix Haswell issue where the clocks do not get enabled */
-	if (!strcmp(id->id, "INT33C4") || !strcmp(id->id, "INT33C5")) {
-		reg = readl(p->membase + LPSS_PRV_CLOCK_PARAMS);
-		writel(reg | 1, p->membase + LPSS_PRV_CLOCK_PARAMS);
-	}
-
 	return 0;
 }
 #else
@@ -425,8 +417,8 @@ static const struct of_device_id dw8250_of_match[] = {
 MODULE_DEVICE_TABLE(of, dw8250_of_match);
 
 static const struct acpi_device_id dw8250_acpi_match[] = {
-	{ "INT33C4", 100000000 },
-	{ "INT33C5", 100000000 },
+	{ "INT33C4", 0 },
+	{ "INT33C5", 0 },
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
-- 
1.7.10.4


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

* [PATCH 7/9] serial: 8250_dw: Let ACPI code extract the DMA client info
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
                   ` (5 preceding siblings ...)
  2013-04-10 13:58 ` [PATCH 6/9] serial: 8250_dw: Support clk framework also with ACPI Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 8/9] serial: 8250_dw: Set port capabilities based on CPR register Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 9/9] serial: 8250_dw: Use devm_request_and_ioremap() Heikki Krogerus
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

The new ACPI DMA helpers in dmaengine API can take care of
extracting all the necessary information regarding DMA. The
driver does not need to do this separately any more.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index de7a186..09aaea2 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -163,66 +163,10 @@ static int dw8250_probe_of(struct uart_port *p)
 }
 
 #ifdef CONFIG_ACPI
-static bool dw8250_acpi_dma_filter(struct dma_chan *chan, void *parm)
-{
-	return chan->chan_id == *(int *)parm;
-}
-
-static acpi_status
-dw8250_acpi_walk_resource(struct acpi_resource *res, void *data)
-{
-	struct uart_port		*p = data;
-	struct uart_8250_port		*port;
-	struct uart_8250_dma		*dma;
-	struct acpi_resource_fixed_dma	*fixed_dma;
-	struct dma_slave_config		*slave;
-
-	port = container_of(p, struct uart_8250_port, port);
-
-	switch (res->type) {
-	case ACPI_RESOURCE_TYPE_FIXED_DMA:
-		fixed_dma = &res->data.fixed_dma;
-
-		/* TX comes first */
-		if (!port->dma) {
-			dma = devm_kzalloc(p->dev, sizeof(*dma), GFP_KERNEL);
-			if (!dma)
-				return AE_NO_MEMORY;
-
-			port->dma = dma;
-			slave = &dma->txconf;
-
-			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;
-			dma->fn			= dw8250_acpi_dma_filter;
-		} else {
-			dma = port->dma;
-			slave = &dma->rxconf;
-
-			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;
-		}
-
-		break;
-	}
-
-	return AE_OK;
-}
-
-static int dw8250_probe_acpi(struct uart_port *p)
+static int dw8250_probe_acpi(struct uart_8250_port *up)
 {
 	const struct acpi_device_id *id;
-	acpi_status status;
+	struct uart_port *p = &up->port;
 
 	id = acpi_match_device(p->dev->driver->acpi_match_table, p->dev);
 	if (!id)
@@ -236,13 +180,12 @@ static int dw8250_probe_acpi(struct uart_port *p)
 	if (!p->uartclk)
 		p->uartclk = (unsigned int)id->driver_data;
 
-	status = acpi_walk_resources(ACPI_HANDLE(p->dev), METHOD_NAME__CRS,
-				     dw8250_acpi_walk_resource, p);
-	if (ACPI_FAILURE(status)) {
-		dev_err_ratelimited(p->dev, "%s failed \"%s\"\n", __func__,
-				    acpi_format_exception(status));
-		return -ENODEV;
-	}
+	up->dma = devm_kzalloc(p->dev, sizeof(*up->dma), GFP_KERNEL);
+	if (!up->dma)
+		return -ENOMEM;
+
+	up->dma->rxconf.src_maxburst = p->fifosize / 4;
+	up->dma->txconf.dst_maxburst = p->fifosize / 4;
 
 	return 0;
 }
@@ -329,7 +272,7 @@ static int dw8250_probe(struct platform_device *pdev)
 		if (err)
 			return err;
 	} else if (ACPI_HANDLE(&pdev->dev)) {
-		err = dw8250_probe_acpi(&uart.port);
+		err = dw8250_probe_acpi(&uart);
 		if (err)
 			return err;
 	} else {
-- 
1.7.10.4


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

* [PATCH 8/9] serial: 8250_dw: Set port capabilities based on CPR register
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
                   ` (6 preceding siblings ...)
  2013-04-10 13:58 ` [PATCH 7/9] serial: 8250_dw: Let ACPI code extract the DMA client info Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-10 13:58 ` [PATCH 9/9] serial: 8250_dw: Use devm_request_and_ioremap() Heikki Krogerus
  8 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

The Designware UART has an optional support for 16750
compatible Auto Flow Control. This will enable it based on
the AFCE bit in Component Parameter Register.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 09aaea2..b7c7d6a 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -221,7 +221,11 @@ static void dw8250_setup_port(struct uart_8250_port *up)
 		p->flags |= UPF_FIXED_TYPE;
 		p->fifosize = DW_UART_CPR_FIFO_SIZE(reg);
 		up->tx_loadsz = p->fifosize;
+		up->capabilities = UART_CAP_FIFO;
 	}
+
+	if (reg & DW_UART_CPR_AFCE_MODE)
+		up->capabilities |= UART_CAP_AFE;
 }
 
 static int dw8250_probe(struct platform_device *pdev)
-- 
1.7.10.4


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

* [PATCH 9/9] serial: 8250_dw: Use devm_request_and_ioremap()
  2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
                   ` (7 preceding siblings ...)
  2013-04-10 13:58 ` [PATCH 8/9] serial: 8250_dw: Set port capabilities based on CPR register Heikki Krogerus
@ 2013-04-10 13:58 ` Heikki Krogerus
  2013-04-11 12:20   ` Heikki Krogerus
  8 siblings, 1 reply; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-10 13:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

Use resource managed ioremap.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index b7c7d6a..bf2a6e2 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -250,7 +250,7 @@ static int dw8250_probe(struct platform_device *pdev)
 	uart.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT;
 	uart.port.dev = &pdev->dev;
 
-	uart.port.membase = ioremap(regs->start, resource_size(regs));
+	uart.port.membase = devm_request_and_ioremap(&pdev->dev, regs);
 	if (!uart.port.membase)
 		return -ENOMEM;
 
-- 
1.7.10.4


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

* Re: [PATCH 9/9] serial: 8250_dw: Use devm_request_and_ioremap()
  2013-04-10 13:58 ` [PATCH 9/9] serial: 8250_dw: Use devm_request_and_ioremap() Heikki Krogerus
@ 2013-04-11 12:20   ` Heikki Krogerus
  2013-04-11 12:43     ` [PATCH 9/9] serial: 8250_dw: Convert to devm_ioremap() Heikki Krogerus
  0 siblings, 1 reply; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-11 12:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

Hi,

I need to redo this patch.

On Wed, Apr 10, 2013 at 04:58:32PM +0300, Heikki Krogerus wrote:
> Use resource managed ioremap.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
>  drivers/tty/serial/8250/8250_dw.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index b7c7d6a..bf2a6e2 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -250,7 +250,7 @@ static int dw8250_probe(struct platform_device *pdev)
>  	uart.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT;
>  	uart.port.dev = &pdev->dev;
>  
> -	uart.port.membase = ioremap(regs->start, resource_size(regs));
> +	uart.port.membase = devm_request_and_ioremap(&pdev->dev, regs);

There is now function devm_ioremap_resource() that should be preferred
over devm_request_and_ioremap(), but I will change this to use
devm_ioremap(). There is no need to request the mem region here.

-- 
heikki

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

* [PATCH 9/9] serial: 8250_dw: Convert to devm_ioremap()
  2013-04-11 12:20   ` Heikki Krogerus
@ 2013-04-11 12:43     ` Heikki Krogerus
  0 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2013-04-11 12:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-serial

Use resource managed ioremap.

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

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index b7c7d6a..39b7ae4 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -250,7 +250,8 @@ static int dw8250_probe(struct platform_device *pdev)
 	uart.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT;
 	uart.port.dev = &pdev->dev;
 
-	uart.port.membase = ioremap(regs->start, resource_size(regs));
+	uart.port.membase = devm_ioremap(&pdev->dev, regs->start,
+					 resource_size(regs));
 	if (!uart.port.membase)
 		return -ENOMEM;
 
-- 
1.7.10.4


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

end of thread, other threads:[~2013-04-11 12:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 13:58 [PATCH 0/9] serial: 8250_dma to use the new dmaengine helpers Heikki Krogerus
2013-04-10 13:58 ` [PATCH 1/9] serial: 8250_dma: TX cleanup Heikki Krogerus
2013-04-10 13:58 ` [PATCH 2/9] serial: 8250_dma: Fix RX handling Heikki Krogerus
2013-04-10 13:58 ` [PATCH 3/9] serial: 8250_dma: Use dmaengine helpers to get the slave channels Heikki Krogerus
2013-04-10 13:58 ` [PATCH 4/9] serial: 8250_dma: Provide default slave configuration parameters Heikki Krogerus
2013-04-10 13:58 ` [PATCH 5/9] serial: 8250_dw: Enable runtime PM Heikki Krogerus
2013-04-10 13:58 ` [PATCH 6/9] serial: 8250_dw: Support clk framework also with ACPI Heikki Krogerus
2013-04-10 13:58 ` [PATCH 7/9] serial: 8250_dw: Let ACPI code extract the DMA client info Heikki Krogerus
2013-04-10 13:58 ` [PATCH 8/9] serial: 8250_dw: Set port capabilities based on CPR register Heikki Krogerus
2013-04-10 13:58 ` [PATCH 9/9] serial: 8250_dw: Use devm_request_and_ioremap() Heikki Krogerus
2013-04-11 12:20   ` Heikki Krogerus
2013-04-11 12:43     ` [PATCH 9/9] serial: 8250_dw: Convert to devm_ioremap() Heikki Krogerus

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.