From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] serial: pl011: Add Device Tree support to request DMA channels
Date: Thu, 18 Apr 2013 09:14:16 +0100 [thread overview]
Message-ID: <1366272857-14038-1-git-send-email-lee.jones@linaro.org> (raw)
The new DMA API is operational. It is now possible to request DMA
channels from information passed via Device Tree.
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/tty/serial/amba-pl011.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 3ea5408..1b39f58 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -249,6 +249,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
{
/* DMA is the sole user of the platform data right now */
struct amba_pl011_data *plat = uap->port.dev->platform_data;
+ struct device_node *np = uap->port.dev->of_node;
struct dma_slave_config tx_conf = {
.dst_addr = uap->port.mapbase + UART01x_DR,
.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
@@ -259,9 +260,9 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
struct dma_chan *chan;
dma_cap_mask_t mask;
- /* We need platform data */
- if (!plat || !plat->dma_filter) {
- dev_info(uap->port.dev, "no DMA platform data\n");
+ /* We need platform data or DT */
+ if (!(plat && plat->dma_filter) && !np) {
+ dev_info(uap->port.dev, "no DMA platform data or DT\n");
return;
}
@@ -269,7 +270,10 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
- chan = dma_request_channel(mask, plat->dma_filter, plat->dma_tx_param);
+ chan = dma_request_slave_channel_compat(mask,
+ (plat) ? plat->dma_filter : NULL,
+ (plat) ? plat->dma_tx_param : NULL,
+ uap->port.dev, "tx");
if (!chan) {
dev_err(uap->port.dev, "no TX DMA channel!\n");
return;
@@ -282,7 +286,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
dma_chan_name(uap->dmatx.chan));
/* Optionally make use of an RX channel as well */
- if (plat->dma_rx_param) {
+ if ((plat && plat->dma_rx_param) || np) {
struct dma_slave_config rx_conf = {
.src_addr = uap->port.mapbase + UART01x_DR,
.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
@@ -291,7 +295,10 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap)
.device_fc = false,
};
- chan = dma_request_channel(mask, plat->dma_filter, plat->dma_rx_param);
+ chan = dma_request_slave_channel_compat(mask,
+ (plat) ? plat->dma_filter : NULL,
+ (plat) ? plat->dma_rx_param : NULL,
+ uap->port.dev, "rx");
if (!chan) {
dev_err(uap->port.dev, "no RX DMA channel!\n");
return;
--
1.7.10.4
next reply other threads:[~2013-04-18 8:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-18 8:14 Lee Jones [this message]
2013-04-18 8:18 ` [PATCH v2] serial: pl011: Add Device Tree support to request DMA channels Russell King - ARM Linux
2013-04-18 8:39 ` Lee Jones
2013-04-18 9:00 ` Russell King - ARM Linux
2013-04-20 10:33 ` Arnd Bergmann
2013-04-21 8:53 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366272857-14038-1-git-send-email-lee.jones@linaro.org \
--to=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).