[PATCH v2 1/2] reset: socfpga: Add reset status callback function

Marek Vasut marex at denx.de
Tue Dec 24 10:40:27 CET 2019


On 12/24/19 9:23 AM, Ley Foon Tan wrote:
> Add .rst_status callback function.
> Read reset status from register, return 0 if deasserted,
> non-zero if asserted
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
> ---
>  drivers/reset/reset-socfpga.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> index 93ec9cfdb6..b77c893b76 100644
> --- a/drivers/reset/reset-socfpga.c
> +++ b/drivers/reset/reset-socfpga.c
> @@ -99,11 +99,23 @@ static int socfpga_reset_free(struct reset_ctl *reset_ctl)
>  	return 0;
>  }
>  
> +static int socfpga_reset_status(struct reset_ctl *reset_ctl)
> +{
> +	struct socfpga_reset_data *data = dev_get_priv(reset_ctl->dev);
> +	int id = reset_ctl->id;
> +	int reg_width = sizeof(u32);
> +	int bank = id / (reg_width * BITS_PER_BYTE);
> +	int offset = id % (reg_width * BITS_PER_BYTE);

You want to flag these int values as const, since that's what they are.
I think some of them are unsigned.

Otherwise looks good, thanks.


More information about the U-Boot mailing list