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

spi: imx: remove ERR009165 workaround on i.mx6ul

ERR009165 fixed on i.mx6ul/6ull/6sll. All other i.mx6/7 and
i.mx8m/8mm still need this errata. Please refer to nxp official
errata document from https://www.nxp.com/ .

For removing workaround on those chips. Add new i.mx6ul type.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>

authored by

Robin Gong and committed by
Shawn Guo
8eb1252b 980f8848

+36 -3
+36 -3
drivers/spi/spi-imx.c
··· 77 77 bool has_slavemode; 78 78 unsigned int fifo_size; 79 79 bool dynamic_burst; 80 + /* 81 + * ERR009165 fixed or not: 82 + * https://www.nxp.com/docs/en/errata/IMX6DQCE.pdf 83 + */ 84 + bool tx_glitch_fixed; 80 85 enum spi_imx_devtype devtype; 81 86 }; 82 87 ··· 596 591 ctrl |= mx51_ecspi_clkdiv(spi_imx, spi_imx->spi_bus_clk, &clk); 597 592 spi_imx->spi_bus_clk = clk; 598 593 599 - /* ERR009165: work in XHC mode as PIO */ 600 - ctrl &= ~MX51_ECSPI_CTRL_SMC; 594 + /* 595 + * ERR009165: work in XHC mode instead of SMC as PIO on the chips 596 + * before i.mx6ul. 597 + */ 598 + if (spi_imx->usedma && spi_imx->devtype_data->tx_glitch_fixed) 599 + ctrl |= MX51_ECSPI_CTRL_SMC; 600 + else 601 + ctrl &= ~MX51_ECSPI_CTRL_SMC; 601 602 602 603 writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); 603 604 ··· 629 618 630 619 static void mx51_setup_wml(struct spi_imx_data *spi_imx) 631 620 { 621 + u32 tx_wml = 0; 622 + 623 + if (spi_imx->devtype_data->tx_glitch_fixed) 624 + tx_wml = spi_imx->wml; 632 625 /* 633 626 * Configure the DMA register: setup the watermark 634 627 * and enable DMA request. 635 628 */ 636 629 writel(MX51_ECSPI_DMA_RX_WML(spi_imx->wml - 1) | 637 - MX51_ECSPI_DMA_TX_WML(0) | 630 + MX51_ECSPI_DMA_TX_WML(tx_wml) | 638 631 MX51_ECSPI_DMA_RXT_WML(spi_imx->wml) | 639 632 MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN | 640 633 MX51_ECSPI_DMA_RXTDEN, spi_imx->base + MX51_ECSPI_DMA); ··· 1029 1014 .devtype = IMX53_ECSPI, 1030 1015 }; 1031 1016 1017 + static struct spi_imx_devtype_data imx6ul_ecspi_devtype_data = { 1018 + .intctrl = mx51_ecspi_intctrl, 1019 + .prepare_message = mx51_ecspi_prepare_message, 1020 + .prepare_transfer = mx51_ecspi_prepare_transfer, 1021 + .trigger = mx51_ecspi_trigger, 1022 + .rx_available = mx51_ecspi_rx_available, 1023 + .reset = mx51_ecspi_reset, 1024 + .setup_wml = mx51_setup_wml, 1025 + .fifo_size = 64, 1026 + .has_dmamode = true, 1027 + .dynamic_burst = true, 1028 + .has_slavemode = true, 1029 + .tx_glitch_fixed = true, 1030 + .disable = mx51_ecspi_disable, 1031 + .devtype = IMX51_ECSPI, 1032 + }; 1033 + 1032 1034 static const struct of_device_id spi_imx_dt_ids[] = { 1033 1035 { .compatible = "fsl,imx1-cspi", .data = &imx1_cspi_devtype_data, }, 1034 1036 { .compatible = "fsl,imx21-cspi", .data = &imx21_cspi_devtype_data, }, ··· 1054 1022 { .compatible = "fsl,imx35-cspi", .data = &imx35_cspi_devtype_data, }, 1055 1023 { .compatible = "fsl,imx51-ecspi", .data = &imx51_ecspi_devtype_data, }, 1056 1024 { .compatible = "fsl,imx53-ecspi", .data = &imx53_ecspi_devtype_data, }, 1025 + { .compatible = "fsl,imx6ul-ecspi", .data = &imx6ul_ecspi_devtype_data, }, 1057 1026 { /* sentinel */ } 1058 1027 }; 1059 1028 MODULE_DEVICE_TABLE(of, spi_imx_dt_ids);