Re: [PATCH 1/2] watchdog: i.MX: add soc_reset operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 19, 2017 at 04:03:51PM +0100, Sascha Hauer wrote:
> On i.MX21 watchdog type the reset operation is really different
> from the watchdog enable/set timeout operation, so create an
> extra callback for this instead of folding both things together.
> 
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  drivers/watchdog/imxwd.c | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
> index 03e116ea2..c736fdaa3 100644
> --- a/drivers/watchdog/imxwd.c
> +++ b/drivers/watchdog/imxwd.c
> @@ -26,6 +26,7 @@ struct imx_wd;
>  
>  struct imx_wd_ops {
>  	int (*set_timeout)(struct imx_wd *, int);

With this change the timeout argument could be unsigned int.

> +	void (*soc_reset)(struct imx_wd *);
>  	int (*init)(struct imx_wd *);
>  };
>  
> @@ -76,10 +77,7 @@ static int imx1_watchdog_set_timeout(struct imx_wd *priv, int timeout)
>  		return 0;
>  	}
>  
> -	if (timeout > 0)
> -		val = (timeout * 2 - 1) << 8;
> -	else
> -		val = 0;
> +	val = (timeout * 2 - 1) << 8;
>  
>  	writew(val, priv->base + IMX1_WDOG_WCR);
>  	writew(IMX1_WDOG_WCR_WDE | val, priv->base + IMX1_WDOG_WCR);

Otherwise the timeout < 0 should somehow be handled here.

> @@ -91,6 +89,11 @@ static int imx1_watchdog_set_timeout(struct imx_wd *priv, int timeout)
>  	return 0;
>  }
>  
> +static void imx1_soc_reset(struct imx_wd *priv)
> +{
> +	writew(IMX1_WDOG_WCR_WDE, priv->base + IMX1_WDOG_WCR);
> +}
> +
>  static int imx21_watchdog_set_timeout(struct imx_wd *priv, int timeout)
>  {
>  	u16 val;
> @@ -103,13 +106,9 @@ static int imx21_watchdog_set_timeout(struct imx_wd *priv, int timeout)
>  	if (timeout == 0) /* bit 2 (WDE) cannot be set to 0 again */
>  		return -ENOSYS;
>  
> -	if (timeout > 0)
> -		val = ((timeout * 2 - 1) << 8) | IMX21_WDOG_WCR_SRS |
> -			IMX21_WDOG_WCR_WDA;
> -	else
> -		val = 0;
> +	val = ((timeout * 2 - 1) << 8) | IMX21_WDOG_WCR_SRS |
> +		IMX21_WDOG_WCR_WDA;
Likewise.

	Sam

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux