MLK-12076-4: spi: spi-imx: add imx6ul device type
Add imx6ul device type in spi driver to enable the ERR008517 workaround or not by dts easily. Signed-off-by: Robin Gong <b38343@freescale.com>pull/10/head
parent
98fad442e1
commit
c633bc8ee9
|
@ -66,6 +66,7 @@ enum spi_imx_devtype {
|
|||
IMX35_CSPI, /* CSPI on all i.mx except above */
|
||||
IMX51_ECSPI, /* ECSPI on i.mx51 */
|
||||
IMX53_ECSPI, /* ECSPI on i.mx53 and later */
|
||||
IMX6UL_ECSPI,
|
||||
};
|
||||
|
||||
struct spi_imx_data;
|
||||
|
@ -129,7 +130,8 @@ static inline int is_imx35_cspi(struct spi_imx_data *d)
|
|||
|
||||
static inline int is_imx51_ecspi(struct spi_imx_data *d)
|
||||
{
|
||||
return d->devtype_data->devtype == IMX51_ECSPI;
|
||||
return d->devtype_data->devtype == IMX51_ECSPI ||
|
||||
d->devtype_data->devtype == IMX6UL_ECSPI;
|
||||
}
|
||||
|
||||
static inline int is_imx53_ecspi(struct spi_imx_data *d)
|
||||
|
@ -434,11 +436,13 @@ static void mx51_ecspi_trigger(struct spi_imx_data *spi_imx)
|
|||
{
|
||||
u32 reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
|
||||
/*
|
||||
* To workaround TKT238285, SDMA script need use XCH instead of SMC
|
||||
* just like PIO mode.
|
||||
* To workaround ERR008517, SDMA script need use XCH instead of SMC
|
||||
* just like PIO mode and it fix on i.mx6ul
|
||||
*/
|
||||
if (!spi_imx->usedma)
|
||||
reg |= MX51_ECSPI_CTRL_XCH;
|
||||
else if (spi_imx->devtype_data->devtype == IMX6UL_ECSPI)
|
||||
reg |= MX51_ECSPI_CTRL_SMC;
|
||||
else
|
||||
reg &= ~MX51_ECSPI_CTRL_SMC;
|
||||
writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
|
||||
|
@ -450,6 +454,7 @@ static int mx51_ecspi_config(struct spi_device *spi)
|
|||
u32 ctrl = MX51_ECSPI_CTRL_ENABLE;
|
||||
u32 clk = spi_imx->speed_hz, delay, reg;
|
||||
u32 cfg = readl(spi_imx->base + MX51_ECSPI_CONFIG);
|
||||
int tx_wml = 0;
|
||||
|
||||
/*
|
||||
* The hardware seems to have a race condition when changing modes. The
|
||||
|
@ -530,8 +535,11 @@ static int mx51_ecspi_config(struct spi_device *spi)
|
|||
* Configure the DMA register: setup the watermark
|
||||
* and enable DMA request.
|
||||
*/
|
||||
if (spi_imx->devtype_data->devtype == IMX6UL_ECSPI)
|
||||
tx_wml = spi_imx->wml / 2;
|
||||
|
||||
writel(MX51_ECSPI_DMA_RX_WML(spi_imx->wml) |
|
||||
MX51_ECSPI_DMA_TX_WML(tx_wml) |
|
||||
MX51_ECSPI_DMA_RXT_WML(spi_imx->wml) |
|
||||
MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN |
|
||||
MX51_ECSPI_DMA_RXTDEN, spi_imx->base + MX51_ECSPI_DMA);
|
||||
|
@ -885,7 +893,19 @@ static struct spi_imx_devtype_data imx53_ecspi_devtype_data = {
|
|||
.devtype = IMX53_ECSPI,
|
||||
};
|
||||
|
||||
static const struct platform_device_id spi_imx_devtype[] = {
|
||||
static struct spi_imx_devtype_data imx6ul_ecspi_devtype_data = {
|
||||
.intctrl = mx51_ecspi_intctrl,
|
||||
.config = mx51_ecspi_config,
|
||||
.trigger = mx51_ecspi_trigger,
|
||||
.rx_available = mx51_ecspi_rx_available,
|
||||
.reset = mx51_ecspi_reset,
|
||||
.fifo_size = 64,
|
||||
.has_dmamode = true,
|
||||
.dynamic_burst = true,
|
||||
.devtype = IMX6UL_ECSPI,
|
||||
};
|
||||
|
||||
static struct platform_device_id spi_imx_devtype[] = {
|
||||
{
|
||||
.name = "imx1-cspi",
|
||||
.driver_data = (kernel_ulong_t) &imx1_cspi_devtype_data,
|
||||
|
@ -907,6 +927,9 @@ static const struct platform_device_id spi_imx_devtype[] = {
|
|||
}, {
|
||||
.name = "imx53-ecspi",
|
||||
.driver_data = (kernel_ulong_t) &imx53_ecspi_devtype_data,
|
||||
}, {
|
||||
.name = "imx6ul-ecspi",
|
||||
.driver_data = (kernel_ulong_t) &imx6ul_ecspi_devtype_data,
|
||||
}, {
|
||||
/* sentinel */
|
||||
}
|
||||
|
@ -920,6 +943,7 @@ static const struct of_device_id spi_imx_dt_ids[] = {
|
|||
{ .compatible = "fsl,imx35-cspi", .data = &imx35_cspi_devtype_data, },
|
||||
{ .compatible = "fsl,imx51-ecspi", .data = &imx51_ecspi_devtype_data, },
|
||||
{ .compatible = "fsl,imx53-ecspi", .data = &imx53_ecspi_devtype_data, },
|
||||
{ .compatible = "fsl,imx6ul-ecspi", .data = &imx6ul_ecspi_devtype_data, },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, spi_imx_dt_ids);
|
||||
|
|
Loading…
Reference in New Issue