tty: serial: fsl_lpuart: fix DMA operation when using IOMMU
authorMichael Walle <michael@walle.cc>
Fri, 6 Mar 2020 21:44:30 +0000 (22:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Mar 2020 09:02:00 +0000 (10:02 +0100)
commit159381df1442f3c781ae3de05b5c6130fd4ee058
tree50586532d8449f8eff6f2a3aa0d9ef807558f789
parentd3394b3d51828d99d46bf38a1004517c0ff971a8
tty: serial: fsl_lpuart: fix DMA operation when using IOMMU

The DMA channel might not be available at probe time. This is esp. the
case if the DMA controller has an IOMMU mapping.

There is also another caveat. If there is no DMA controller at all,
dma_request_chan() will also return -EPROBE_DEFER. Thus we cannot test
for -EPROBE_DEFER in probe(). Otherwise the lpuart driver will fail to
probe if, for example, the DMA driver is not enabled in the kernel
configuration.

To workaround this, we request the DMA channel in _startup(). Other
serial drivers do it the same way.

Signed-off-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20200306214433.23215-2-michael@walle.cc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c