From: Yixun Lan <dlan@kernel.org>
To: Eric Chung <eric.chung@riscstar.com>
Cc: u-boot-spacemit@groups.io, u-boot@lists.u-boot-project.org,
Tom Rini <trini@konsulko.com>, Tim Ouyang <tim609@andestech.com>,
Leo Liang <leo.liang@sifive.com>, Peng Fan <peng.fan@nxp.com>,
Huan Zhou <pericycle.cc@gmail.com>,
Raymond Mao <raymond.mao@riscstar.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Bhimeswararao Matsa <bhimeswararao.matsa@gmail.com>,
Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
Kaustabh Chakraborty <kauschluss@disroot.org>,
Han Xu <han.xu@nxp.com>, Yanir Levin <yanir.levin@tandemg.com>,
Christoph Stoidner <c.stoidner@phytec.de>,
Balsundar Ponnusamy <balsundar.ponnusamy@altera.com>,
Daniel Palmer <daniel@thingy.jp>, Anshul Dalal <anshuld@ti.com>,
Bastien Curutchet <bastien.curutchet@bootlin.com>,
Angelo Dureghello <angelo@kernel-space.org>,
Johan Jonker <jbx6244@gmail.com>,
Sam Protsenko <semen.protsenko@linaro.org>,
Guodong Xu <guodong@riscstar.com>, Yao Zi <me@ziyao.cc>,
Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>
Subject: Re: [PATCH v8 02/11] pinctrl: k1: fix drive strength configuration
Date: Mon, 17 Aug 2026 02:12:16 +0000 [thread overview]
Message-ID: <20260817021216-GKB566872@kernel.org> (raw)
In-Reply-To: <20260802-m4-v8-2-e916643205f3@riscstar.com>
On 00:40 Sun 02 Aug , Eric Chung wrote:
> Fix drive strength configuration by:
> - Using FIELD_PREP() to properly set the PAD_DRIVE mask bits
> - Not overriding io_type with IO_TYPE_EXTERNAL for external pins
> - Returning the pin number instead of 0 from pinmux_property_set
> - Removing redundant zero-initialization of the mask variable
>
> Signed-off-by: Eric Chung <eric.chung@riscstar.com>
>
Checked this patch, the logic looks ok to me (only few minor comments),
And you can still add my R-B, thanks
Reviewed-by: Yixun Lan <dlan@kenrel.org>
> ---
> v6:
> - Fix drive strength configuration.
> ---
> drivers/pinctrl/spacemit/pinctrl-k1.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c
> index a6a22eacac7b..6ed511879daf 100644
> --- a/drivers/pinctrl/spacemit/pinctrl-k1.c
> +++ b/drivers/pinctrl/spacemit/pinctrl-k1.c
> @@ -9,6 +9,7 @@
> #include <dm/device_compat.h>
> #include <dm/pinctrl.h>
> #include <dm/read.h>
> +#include <linux/bitfield.h>
> #include <linux/bitops.h>
> #include <linux/errno.h>
> #include <linux/io.h>
> @@ -386,10 +387,12 @@ static int spacemit_pinmux_set(struct udevice *dev, unsigned int pin,
> static int spacemit_pinmux_property_set(struct udevice *dev, u32 pinmux_group)
> {
> u32 pin, mux;
> + int ret;
>
> pin = spacemit_dt_get_pin(pinmux_group);
> mux = spacemit_dt_get_pin_mux(pinmux_group);
> - return spacemit_pinmux_set(dev, pin, mux);
> + ret = spacemit_pinmux_set(dev, pin, mux);
..
> + return ret ? ret : pin;
I'd prefer doing as below, which would more explicitly tell that's an error handler
if (ret < 0)
return ret;
return pin;
> }
>
> static const struct pinconf_param spacemit_pinconf_params[] = {
> @@ -406,7 +409,7 @@ static int spacemit_pinconf_set(struct udevice *dev, unsigned int pin_selector,
> struct spacemit_pinctrl_data *data;
> struct spacemit_pinctrl_priv *priv = dev_get_priv(dev);
> void __iomem *addr;
> - u32 mask = 0;
> + u32 mask;
This isn't a necessary change, which doesn't alter any logic or fix anything,
and more worse, the follow-up patch drop line of this variable
I mean bringing in unrelated change only increase the review burden..
> unsigned int io_type;
> u8 ds;
> bool found;
> @@ -433,7 +436,8 @@ static int spacemit_pinconf_set(struct udevice *dev, unsigned int pin_selector,
> for (i = 0; i < priv->nr_io_pins; i++) {
> if (priv->io_pins[i].pin != pin_selector)
> continue;
> - io_type = priv->io_pins[i].io_type;
> + if (priv->io_pins[i].io_type != IO_TYPE_EXTERNAL)
> + io_type = priv->io_pins[i].io_type;
> break;
> }
> if (io_type != IO_TYPE_3V3 && io_type != IO_TYPE_1V8) {
> @@ -441,7 +445,7 @@ static int spacemit_pinconf_set(struct udevice *dev, unsigned int pin_selector,
> return -EINVAL;
> }
> ds = spacemit_get_drive_strength(io_type, argument);
> - clrsetbits_le32(addr, PAD_DRIVE, ds);
> + clrsetbits_le32(addr, PAD_DRIVE, FIELD_PREP(PAD_DRIVE, ds));
> break;
> case PIN_CONFIG_POWER_SOURCE:
> for (i = 0, found = false; i < priv->nr_io_pins; i++) {
>
> --
> 2.51.0
>
--
Yixun Lan (dlan)
next prev parent reply other threads:[~2026-08-17 4:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 16:40 [PATCH v8 00/11] spacemit mmc driver Eric Chung
2026-08-01 16:40 ` [PATCH v8 01/11] spacemit: k1: select boot device via config registers Eric Chung
2026-08-01 16:40 ` [PATCH v8 02/11] pinctrl: k1: fix drive strength configuration Eric Chung
2026-08-17 2:12 ` Yixun Lan [this message]
2026-08-01 16:40 ` [PATCH v8 03/11] pinctrl: k1: fix pull-up/pull-down configuration Eric Chung
2026-08-17 1:39 ` Yixun Lan
2026-08-01 16:40 ` [PATCH v8 04/11] pinctrl: k1: add IO power domain configuration support Eric Chung
2026-08-17 2:48 ` Yixun Lan
2026-08-01 16:40 ` [PATCH v8 05/11] mmc: k1: add sdhci platform driver Eric Chung
2026-08-01 16:40 ` [PATCH v8 06/11] dts: k1: add SD card support in u-boot overlay Eric Chung
2026-08-16 4:15 ` Yixun Lan
2026-08-01 16:40 ` [PATCH v8 07/11] configs: k1: enable SD and eMMC support Eric Chung
2026-08-01 16:40 ` [PATCH v8 08/11] MAINTAINER: update Spacemit K1 entry Eric Chung
2026-08-01 16:40 ` [PATCH v8 09/11] doc: spacemit: flash on K1 SoC based boards Eric Chung
2026-08-01 16:40 ` [PATCH v8 10/11] config: k1: enable ENV support for eMMC Eric Chung
2026-08-01 16:40 ` [PATCH v8 11/11] spacemit: k1: fix product name detection and DTB matching in SPL Eric Chung
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=20260817021216-GKB566872@kernel.org \
--to=dlan@kernel.org \
--cc=angelo@kernel-space.org \
--cc=anshuld@ti.com \
--cc=balsundar.ponnusamy@altera.com \
--cc=bastien.curutchet@bootlin.com \
--cc=bhimeswararao.matsa@gmail.com \
--cc=c.stoidner@phytec.de \
--cc=daniel@thingy.jp \
--cc=eric.chung@riscstar.com \
--cc=guodong@riscstar.com \
--cc=han.xu@nxp.com \
--cc=jbx6244@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=kauschluss@disroot.org \
--cc=leo.liang@sifive.com \
--cc=me@ziyao.cc \
--cc=peng.fan@nxp.com \
--cc=pericycle.cc@gmail.com \
--cc=raymond.mao@riscstar.com \
--cc=rick@andestech.com \
--cc=semen.protsenko@linaro.org \
--cc=tanmay.kathpalia@altera.com \
--cc=tim609@andestech.com \
--cc=trini@konsulko.com \
--cc=u-boot-spacemit@groups.io \
--cc=u-boot@lists.u-boot-project.org \
--cc=yanir.levin@tandemg.com \
--cc=ycliang@andestech.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