Re: [PATCH v2 07/15] spi: imx: remove ERR009165 workaround on i.mx6ul

From: Lucas Stach
Date: Fri Apr 26 2019 - 05:10:09 EST


Am Freitag, den 26.04.2019, 08:05 +0000 schrieb Robin Gong:
> ÂÂÂERR009165 fix on i.mx6ul and next chip, such as i.mx6ull/i.mx8mq/i.mx8mm.
> Remove workaround on those chips. Add new i.mx6ul type for that.
>
> Signed-off-by: Robin Gong <yibin.gong@xxxxxxx>
> ---
> Âdrivers/spi/spi-imx.c | 39 +++++++++++++++++++++++++++++++++++----
> Â1 file changed, 35 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index eb56eac..2e5e978 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -57,6 +57,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, /* ERR009165 fix from i.mx6ul */
> Â};
> Â
> Âstruct spi_imx_data;
> @@ -128,7 +129,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)
> @@ -585,9 +587,16 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
> Â ctrl |= mx51_ecspi_clkdiv(spi_imx, t->speed_hz, &clk);
> Â spi_imx->spi_bus_clk = clk;
> Â
> - /* ERR009165: work in XHC mode as PIO */
> - if (spi_imx->usedma)
> - ctrl &= ~MX51_ECSPI_CTRL_SMC;
> + /*
> + Â* ERR009165: work in XHC mode instead of SMC as PIO on the chips
> + Â* before i.mx6ul.
> + Â*/
> + if (spi_imx->usedma) {
> + if (spi_imx->devtype_data->devtype == IMX6UL_ECSPI)

>=, otherwise the workaround might be applied to later generations of
the core if more are added later.

Regards,
Lucas