[PATCH v4 6/9] power: reset: at91-reset: add at91_reset_data
Sebastian Reichel
sebastian.reichel at collabora.com
Thu Jun 9 13:33:56 PDT 2022
Hi,
On Wed, Jun 08, 2022 at 11:39:39AM +0300, Claudiu Beznea wrote:
> Add struct at91_reset_data to keep per platform related information.
> This is a prerequisite for adding reset_controller_dev support.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea at microchip.com>
> ---
> drivers/power/reset/at91-reset.c | 38 ++++++++++++++++++++++++--------
> 1 file changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
> index e62798750b6b..1b2aca3f490d 100644
> --- a/drivers/power/reset/at91-reset.c
> +++ b/drivers/power/reset/at91-reset.c
> @@ -79,6 +79,16 @@ struct at91_reset {
> u32 ramc_lpr;
> };
>
> +/**
> + * struct at91_reset_data - AT91 reset data
> + * @reset_args: SoC specific system reset arguments
> + * @n_device_reset: number of device resets
> + */
> +struct at91_reset_data {
> + u32 reset_args;
> + u32 n_device_reset;
> +};
> +
> /*
> * unless the SDRAM is cleanly shutdown before we hit the
> * reset register it can be left driving the data bus and
> @@ -173,29 +183,34 @@ static const struct of_device_id at91_ramc_of_match[] = {
> { /* sentinel */ }
> };
>
> +static const struct at91_reset_data sam9260 = {
> + .reset_args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
> +};
> +
> +static const struct at91_reset_data samx7 = {
> + .reset_args = AT91_RSTC_KEY | AT91_RSTC_PROCRST,
> +};
> +
> static const struct of_device_id at91_reset_of_match[] = {
> {
> .compatible = "atmel,at91sam9260-rstc",
> - .data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PERRST |
> - AT91_RSTC_PROCRST),
> + .data = &sam9260,
> },
> {
> .compatible = "atmel,at91sam9g45-rstc",
> - .data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PERRST |
> - AT91_RSTC_PROCRST)
> + .data = &sam9260,
> },
> {
> .compatible = "atmel,sama5d3-rstc",
> - .data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PERRST |
> - AT91_RSTC_PROCRST)
> + .data = &sam9260,
> },
> {
> .compatible = "atmel,samx7-rstc",
> - .data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PROCRST)
> + .data = &samx7,
> },
> {
> .compatible = "microchip,sam9x60-rstc",
> - .data = (void *)(AT91_RSTC_KEY | AT91_RSTC_PROCRST)
> + .data = &samx7,
> },
> { /* sentinel */ }
> };
> @@ -204,6 +219,7 @@ MODULE_DEVICE_TABLE(of, at91_reset_of_match);
> static int __init at91_reset_probe(struct platform_device *pdev)
> {
> const struct of_device_id *match;
> + const struct at91_reset_data *data;
> struct at91_reset *reset;
> struct device_node *np;
> int ret, idx = 0;
> @@ -233,9 +249,13 @@ static int __init at91_reset_probe(struct platform_device *pdev)
> }
>
> match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
> + if (!match || !match->data)
> + return -ENODEV;
> +
> + data = match->data;
data = device_get_match_data(&pdev->dev);
if (!data)
return -ENODEV;
Otherwise LGTM.
-- Sebastian
> reset->nb.notifier_call = at91_reset;
> reset->nb.priority = 192;
> - reset->args = (u32)match->data;
> + reset->args = data->reset_args;
>
> reset->sclk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(reset->sclk))
> --
> 2.33.0
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20220609/2a377844/attachment.sig>
More information about the linux-arm-kernel
mailing list