Commit c2b329f5 authored by Stephen Warren's avatar Stephen Warren

serial: tegra: convert to standard DMA DT bindings

By using dma_request_slave_channel_or_err(), the DMA slave ID can be
looked up from standard DT properties, and squirrelled away during
channel allocation. Hence, there's no need to use a custom DT property
to store the slave ID.
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
parent d3d654ef
...@@ -120,7 +120,6 @@ struct tegra_uart_port { ...@@ -120,7 +120,6 @@ struct tegra_uart_port {
bool rx_timeout; bool rx_timeout;
int rx_in_progress; int rx_in_progress;
int symb_bit; int symb_bit;
int dma_req_sel;
struct dma_chan *rx_dma_chan; struct dma_chan *rx_dma_chan;
struct dma_chan *tx_dma_chan; struct dma_chan *tx_dma_chan;
...@@ -910,15 +909,14 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup, ...@@ -910,15 +909,14 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup,
dma_addr_t dma_phys; dma_addr_t dma_phys;
int ret; int ret;
struct dma_slave_config dma_sconfig; struct dma_slave_config dma_sconfig;
dma_cap_mask_t mask;
dma_cap_zero(mask); dma_chan = dma_request_slave_channel_reason(tup->uport.dev,
dma_cap_set(DMA_SLAVE, mask); dma_to_memory ? "rx" : "tx");
dma_chan = dma_request_channel(mask, NULL, NULL); if (IS_ERR(dma_chan)) {
if (!dma_chan) { ret = PTR_ERR(dma_chan);
dev_err(tup->uport.dev, dev_err(tup->uport.dev,
"Dma channel is not available, will try later\n"); "DMA channel alloc failed: %d\n", ret);
return -EPROBE_DEFER; return ret;
} }
if (dma_to_memory) { if (dma_to_memory) {
...@@ -938,7 +936,6 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup, ...@@ -938,7 +936,6 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup,
dma_buf = tup->uport.state->xmit.buf; dma_buf = tup->uport.state->xmit.buf;
} }
dma_sconfig.slave_id = tup->dma_req_sel;
if (dma_to_memory) { if (dma_to_memory) {
dma_sconfig.src_addr = tup->uport.mapbase; dma_sconfig.src_addr = tup->uport.mapbase;
dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
...@@ -1222,17 +1219,8 @@ static int tegra_uart_parse_dt(struct platform_device *pdev, ...@@ -1222,17 +1219,8 @@ static int tegra_uart_parse_dt(struct platform_device *pdev,
struct tegra_uart_port *tup) struct tegra_uart_port *tup)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
u32 of_dma[2];
int port; int port;
if (of_property_read_u32_array(np, "nvidia,dma-request-selector",
of_dma, 2) >= 0) {
tup->dma_req_sel = of_dma[1];
} else {
dev_err(&pdev->dev, "missing dma requestor in device tree\n");
return -EINVAL;
}
port = of_alias_get_id(np, "serial"); port = of_alias_get_id(np, "serial");
if (port < 0) { if (port < 0) {
dev_err(&pdev->dev, "failed to get alias id, errno %d\n", port); dev_err(&pdev->dev, "failed to get alias id, errno %d\n", port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment