Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6 -18
+6 -18
drivers/tty/serial/serial-tegra.c
··· 120 120 bool rx_timeout; 121 121 int rx_in_progress; 122 122 int symb_bit; 123 - int dma_req_sel; 124 123 125 124 struct dma_chan *rx_dma_chan; 126 125 struct dma_chan *tx_dma_chan; ··· 909 910 dma_addr_t dma_phys; 910 911 int ret; 911 912 struct dma_slave_config dma_sconfig; 912 - dma_cap_mask_t mask; 913 913 914 - dma_cap_zero(mask); 915 - dma_cap_set(DMA_SLAVE, mask); 916 - dma_chan = dma_request_channel(mask, NULL, NULL); 917 - if (!dma_chan) { 914 + dma_chan = dma_request_slave_channel_reason(tup->uport.dev, 915 + dma_to_memory ? "rx" : "tx"); 916 + if (IS_ERR(dma_chan)) { 917 + ret = PTR_ERR(dma_chan); 918 918 dev_err(tup->uport.dev, 919 - "Dma channel is not available, will try later\n"); 920 - return -EPROBE_DEFER; 919 + "DMA channel alloc failed: %d\n", ret); 920 + return ret; 921 921 } 922 922 923 923 if (dma_to_memory) { ··· 936 938 dma_buf = tup->uport.state->xmit.buf; 937 939 } 938 940 939 - dma_sconfig.slave_id = tup->dma_req_sel; 940 941 if (dma_to_memory) { 941 942 dma_sconfig.src_addr = tup->uport.mapbase; 942 943 dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; ··· 1219 1222 struct tegra_uart_port *tup) 1220 1223 { 1221 1224 struct device_node *np = pdev->dev.of_node; 1222 - u32 of_dma[2]; 1223 1225 int port; 1224 - 1225 - if (of_property_read_u32_array(np, "nvidia,dma-request-selector", 1226 - of_dma, 2) >= 0) { 1227 - tup->dma_req_sel = of_dma[1]; 1228 - } else { 1229 - dev_err(&pdev->dev, "missing dma requestor in device tree\n"); 1230 - return -EINVAL; 1231 - } 1232 1226 1233 1227 port = of_alias_get_id(np, "serial"); 1234 1228 if (port < 0) {