public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Jacky Huang <ychuang570808@gmail.com>
Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	lee@kernel.org, mturquette@baylibre.com, sboyd@kernel.org,
	gregkh@linuxfoundation.org, jirislaby@kernel.org,
	tmaimon77@gmail.com, catalin.marinas@arm.com, will@kernel.org,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, arnd@arndb.de, schung@nuvoton.com,
	mjchen@nuvoton.com, Jacky Huang <ychuang3@nuvoton.com>
Subject: Re: [PATCH v8 09/11] reset: Add Nuvoton ma35d1 reset driver support
Date: Wed, 26 Apr 2023 09:39:41 +0200	[thread overview]
Message-ID: <20230426073941.GB4724@pengutronix.de> (raw)
In-Reply-To: <20230425102418.185783-10-ychuang570808@gmail.com>

Hi Jacky,

On Tue, Apr 25, 2023 at 10:24:16AM +0000, Jacky Huang wrote:
> From: Jacky Huang <ychuang3@nuvoton.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@nuvoton.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

  parent reply	other threads:[~2023-04-26  7:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 10:24 [PATCH v8 00/11] Introduce Nuvoton ma35d1 SoC Jacky Huang
2023-04-25 10:24 ` [PATCH v8 01/11] arm64: Kconfig.platforms: Add config for Nuvoton MA35 platform Jacky Huang
2023-04-25 10:24 ` [PATCH v8 02/11] arm64: defconfig: Add support for Nuvoton MA35 family SoCs Jacky Huang
2023-04-25 10:24 ` [PATCH v8 03/11] dt-bindings: clock: nuvoton: add binding for ma35d1 clock controller Jacky Huang
2023-04-25 10:24 ` [PATCH v8 04/11] dt-bindings: reset: nuvoton: Document ma35d1 reset control Jacky Huang
2023-04-25 10:24 ` [PATCH v8 05/11] dt-bindings: arm: Add initial bindings for Nuvoton platform Jacky Huang
2023-04-25 19:02   ` Rob Herring
2023-05-01  9:50   ` Krzysztof Kozlowski
2023-05-02  1:31     ` Jacky Huang
2023-05-02  6:31       ` Krzysztof Kozlowski
2023-05-02  6:40         ` Jacky Huang
2023-05-02  6:46           ` Krzysztof Kozlowski
2023-05-02  6:49             ` Jacky Huang
2023-04-25 10:24 ` [PATCH v8 06/11] dt-bindings: serial: Document ma35d1 uart controller Jacky Huang
2023-04-25 10:24 ` [PATCH v8 07/11] arm64: dts: nuvoton: Add initial ma35d1 device tree Jacky Huang
2023-04-25 10:24 ` [PATCH v8 08/11] clk: nuvoton: Add clock driver for ma35d1 clock controller Jacky Huang
2023-04-25 11:30   ` Ilpo Järvinen
2023-04-26  4:55     ` Jacky Huang
2023-04-25 10:24 ` [PATCH v8 09/11] reset: Add Nuvoton ma35d1 reset driver support Jacky Huang
2023-04-25 10:57   ` Ilpo Järvinen
2023-04-26  0:44     ` Jacky Huang
2023-04-26  7:39   ` Philipp Zabel [this message]
2023-04-25 10:24 ` [PATCH v8 10/11] tty: serial: Add Nuvoton ma35d1 serial " Jacky Huang
2023-04-25 10:38   ` Christophe JAILLET
2023-04-27  7:22     ` Jacky Huang
2023-04-25 14:01   ` kernel test robot
2023-04-25 10:24 ` [PATCH v8 11/11] MAINTAINERS: Add entry for NUVOTON MA35 Jacky Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230426073941.GB4724@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mjchen@nuvoton.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=schung@nuvoton.com \
    --cc=tmaimon77@gmail.com \
    --cc=will@kernel.org \
    --cc=ychuang3@nuvoton.com \
    --cc=ychuang570808@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox