[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230426073941.GB4724@pengutronix.de>
Date: Wed, 26 Apr 2023 09:39:41 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Jacky Huang <ychuang570808@...il.com>
Cc: robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
lee@...nel.org, mturquette@...libre.com, sboyd@...nel.org,
gregkh@...uxfoundation.org, jirislaby@...nel.org,
tmaimon77@...il.com, catalin.marinas@....com, will@...nel.org,
devicetree@...r.kernel.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-serial@...r.kernel.org, arnd@...db.de, schung@...oton.com,
mjchen@...oton.com, Jacky Huang <ychuang3@...oton.com>
Subject: Re: [PATCH v8 09/11] reset: Add Nuvoton ma35d1 reset driver support
Hi Jacky,
On Tue, Apr 25, 2023 at 10:24:16AM +0000, Jacky Huang wrote:
> From: Jacky Huang <ychuang3@...oton.com>
>
> This driver supports individual IP reset for ma35d1. The reset
> control registers is a subset of system control registers.
>
> Signed-off-by: Jacky Huang <ychuang3@...oton.com>
> ---
> drivers/reset/Kconfig | 6 +
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-ma35d1.c | 229 +++++++++++++++++++++++++++++++++++
[...]
> diff --git a/drivers/reset/reset-ma35d1.c b/drivers/reset/reset-ma35d1.c
> new file mode 100644
> index 000000000000..648b380becf7
> --- /dev/null
> +++ b/drivers/reset/reset-ma35d1.c
> @@ -0,0 +1,229 @@
[...]
> +static int ma35d1_reset_update(struct reset_controller_dev *rcdev,
> + unsigned long id, bool assert)
> +{
> + u32 reg;
> + struct ma35d1_reset_data *data = container_of(rcdev,
> + struct ma35d1_reset_data,
> + rcdev);
> +
> + reg = readl_relaxed(data->base + ma35d1_reset_map[id].reg_ofs);
> + if (assert)
> + reg |= BIT(ma35d1_reset_map[id].bit);
> + else
> + reg &= ~(BIT(ma35d1_reset_map[id].bit));
> + writel_relaxed(reg, data->base + ma35d1_reset_map[id].reg_ofs);
This is missing a spinlock to protect the read-modify-write cycle from
simultaneous updates.
[...]
> +static int ma35d1_reset_probe(struct platform_device *pdev)
> +{
> + int err;
> + struct device *dev = &pdev->dev;
> + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + struct ma35d1_reset_data *reset_data;
> +
> + if (!pdev->dev.of_node) {
> + dev_err(&pdev->dev, "Device tree node not found\n");
> + return -EINVAL;
> + }
> +
> + reset_data = devm_kzalloc(dev, sizeof(*reset_data), GFP_KERNEL);
> + if (!reset_data)
> + return -ENOMEM;
> +
> + reset_data->base = devm_ioremap_resource(&pdev->dev, res);
You could use devm_platform_ioremap_resource() here.
regards
Philipp
Powered by blists - more mailing lists