diff options
| author | Stephen Warren <swarren@nvidia.com> | 2013-11-11 16:16:38 -0500 |
|---|---|---|
| committer | Stephen Warren <swarren@nvidia.com> | 2013-12-11 18:44:35 -0500 |
| commit | c2b329f56196cce5ebde42f0b6ffc3c12db4c826 (patch) | |
| tree | 72c0084bdf0dcec605b787dd47606179aa29edb8 | |
| parent | d3d654ef230d8b8370e1b2820589521282c868d8 (diff) | |
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
| -rw-r--r-- | drivers/tty/serial/serial-tegra.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c index 4455481a3517..d5c2a287b7e7 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c | |||
| @@ -120,7 +120,6 @@ struct tegra_uart_port { | |||
| 120 | bool rx_timeout; | 120 | bool rx_timeout; |
| 121 | int rx_in_progress; | 121 | int rx_in_progress; |
| 122 | int symb_bit; | 122 | int symb_bit; |
| 123 | int dma_req_sel; | ||
| 124 | 123 | ||
| 125 | struct dma_chan *rx_dma_chan; | 124 | struct dma_chan *rx_dma_chan; |
| 126 | struct dma_chan *tx_dma_chan; | 125 | struct dma_chan *tx_dma_chan; |
| @@ -910,15 +909,14 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup, | |||
| 910 | dma_addr_t dma_phys; | 909 | dma_addr_t dma_phys; |
| 911 | int ret; | 910 | int ret; |
| 912 | struct dma_slave_config dma_sconfig; | 911 | struct dma_slave_config dma_sconfig; |
| 913 | dma_cap_mask_t mask; | ||
| 914 | 912 | ||
| 915 | dma_cap_zero(mask); | 913 | dma_chan = dma_request_slave_channel_reason(tup->uport.dev, |
| 916 | dma_cap_set(DMA_SLAVE, mask); | 914 | dma_to_memory ? "rx" : "tx"); |
| 917 | dma_chan = dma_request_channel(mask, NULL, NULL); | 915 | if (IS_ERR(dma_chan)) { |
| 918 | if (!dma_chan) { | 916 | ret = PTR_ERR(dma_chan); |
| 919 | dev_err(tup->uport.dev, | 917 | dev_err(tup->uport.dev, |
| 920 | "Dma channel is not available, will try later\n"); | 918 | "DMA channel alloc failed: %d\n", ret); |
| 921 | return -EPROBE_DEFER; | 919 | return ret; |
| 922 | } | 920 | } |
| 923 | 921 | ||
| 924 | if (dma_to_memory) { | 922 | if (dma_to_memory) { |
| @@ -938,7 +936,6 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup, | |||
| 938 | dma_buf = tup->uport.state->xmit.buf; | 936 | dma_buf = tup->uport.state->xmit.buf; |
| 939 | } | 937 | } |
| 940 | 938 | ||
| 941 | dma_sconfig.slave_id = tup->dma_req_sel; | ||
| 942 | if (dma_to_memory) { | 939 | if (dma_to_memory) { |
| 943 | dma_sconfig.src_addr = tup->uport.mapbase; | 940 | dma_sconfig.src_addr = tup->uport.mapbase; |
| 944 | dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; | 941 | 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 | struct tegra_uart_port *tup) | 1219 | struct tegra_uart_port *tup) |
| 1223 | { | 1220 | { |
| 1224 | struct device_node *np = pdev->dev.of_node; | 1221 | struct device_node *np = pdev->dev.of_node; |
| 1225 | u32 of_dma[2]; | ||
| 1226 | int port; | 1222 | int port; |
| 1227 | 1223 | ||
| 1228 | if (of_property_read_u32_array(np, "nvidia,dma-request-selector", | ||
| 1229 | of_dma, 2) >= 0) { | ||
| 1230 | tup->dma_req_sel = of_dma[1]; | ||
| 1231 | } else { | ||
| 1232 | dev_err(&pdev->dev, "missing dma requestor in device tree\n"); | ||
| 1233 | return -EINVAL; | ||
| 1234 | } | ||
| 1235 | |||
| 1236 | port = of_alias_get_id(np, "serial"); | 1224 | port = of_alias_get_id(np, "serial"); |
| 1237 | if (port < 0) { | 1225 | if (port < 0) { |
| 1238 | dev_err(&pdev->dev, "failed to get alias id, errno %d\n", port); | 1226 | dev_err(&pdev->dev, "failed to get alias id, errno %d\n", port); |
