spi: imx: add function to check for IMX51 family controller
authorAnton Bondarenko <anton.bondarenko.sama@gmail.com>
Sat, 5 Dec 2015 16:57:02 +0000 (17:57 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 7 Dec 2015 19:53:35 +0000 (19:53 +0000)
Similar to other controller type checks add check function for
IMX51. It includes IMX53 and IMX6.

Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-imx.c

index beba40b08ed1a77761ac376386dad3bd42095646..410522fdd4c91e55e902d8add6adaab274e3cdea 100644 (file)
@@ -122,9 +122,14 @@ static inline int is_imx35_cspi(struct spi_imx_data *d)
        return d->devtype_data->devtype == IMX35_CSPI;
 }
 
+static inline int is_imx51_ecspi(struct spi_imx_data *d)
+{
+       return d->devtype_data->devtype == IMX51_ECSPI;
+}
+
 static inline unsigned spi_imx_get_fifosize(struct spi_imx_data *d)
 {
-       return (d->devtype_data->devtype == IMX51_ECSPI) ? 64 : 8;
+       return is_imx51_ecspi(d) ? 64 : 8;
 }
 
 #define MXC_SPI_BUF_RX(type)                                           \
@@ -1210,8 +1215,8 @@ static int spi_imx_probe(struct platform_device *pdev)
         * Only validated on i.mx6 now, can remove the constrain if validated on
         * other chips.
         */
-       if (spi_imx->devtype_data == &imx51_ecspi_devtype_data
-           && spi_imx_sdma_init(&pdev->dev, spi_imx, master, res))
+       if (is_imx51_ecspi(spi_imx) &&
+           spi_imx_sdma_init(&pdev->dev, spi_imx, master, res))
                dev_err(&pdev->dev, "dma setup error,use pio instead\n");
 
        spi_imx->devtype_data->reset(spi_imx);