[U-Boot] [PATCH] spi: designware_spi: Add reset ctrl to driver

Marek Vasut marex at denx.de
Thu Sep 6 10:06:41 UTC 2018


On 09/06/2018 04:22 PM, Ley Foon Tan wrote:
> Add code to reset all reset signals as in SPI DT node. A reset property
> is an optional feature, so only print out a warning and do not fail if a
> reset property is not present.
> 
> If a reset property is discovered, then use it to deassert, thus
> bringing the IP out of reset.
> 
> Release reset when _remove().
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
> ---
>  drivers/spi/designware_spi.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
> index d8b73ea..b73ec38 100644
> --- a/drivers/spi/designware_spi.c
> +++ b/drivers/spi/designware_spi.c
> @@ -17,6 +17,7 @@
>  #include <malloc.h>
>  #include <spi.h>
>  #include <fdtdec.h>
> +#include <reset.h>
>  #include <linux/compat.h>
>  #include <linux/iopoll.h>
>  #include <asm/io.h>
> @@ -111,6 +112,8 @@ struct dw_spi_priv {
>  	void *tx_end;
>  	void *rx;
>  	void *rx_end;
> +
> +	struct reset_ctl_bulk	resets;
>  };
>  
>  static inline u32 dw_read(struct dw_spi_priv *priv, u32 offset)
> @@ -231,6 +234,33 @@ err_rate:
>  	return -EINVAL;
>  }
>  
> +static int dw_spi_reset(struct udevice *bus)
> +{
> +	int ret;
> +	struct dw_spi_priv *priv = dev_get_priv(bus);
> +
> +	ret = reset_get_bulk(bus, &priv->resets);
> +	if (ret) {
> +		/* Return 0 if error due to !CONFIG_DM_RESET and reset
> +		 * DT property is not present.

Multiline comment style.

Otherwise
Acked-by: Marek Vasut <marex at denx.de>

I'll let Jagan pick it for next.

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list