From: sashiko-bot@kernel.org
To: "Billy Tsai" <billy_tsai@aspeedtech.com>
Cc: robh@kernel.org, conor+dt@kernel.org, krzk+dt@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v3 3/3] pinctrl: aspeed: Add AST2700 SoC1 support
Date: Fri, 15 May 2026 10:40:04 +0000 [thread overview]
Message-ID: <20260515104004.BA92CC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260515-pinctrl-single-bit-v3-3-e97da4312104@aspeedtech.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Calling `devm_pinctrl_register()` before adding groups and functions breaks device tree pin hogs and exposes an initialization race.
- [High] The SGMII0 pin register offset and shift calculations are corrupted by preceding virtual pins in the enum.
- [High] `ASPEED_G7_SOC1_MUX_FUNC_MASK` is defined as 0x7 instead of 0xF, leaving the highest bit of the 4-bit mux field uncleared.
- [Medium] `aspeed_g7_soc1_pin_config_get()` violates the generic pinconf API by failing to return `-EINVAL` for inactive boolean parameters.
--
commit d166d24632d04188131a95c43f87c2fa9c723d2e
Author: Billy Tsai <billy_tsai@aspeedtech.com>
pinctrl: aspeed: Add AST2700 SoC1 support
This patch implements pin multiplexing and configuration for the AST2700
SoC1 SCU pinctrl block. It describes the packed-field register layout directly
in driver data and accesses the controller registers via regmap.
> diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g7-soc1.c
[ ... ]
> +#define ASPEED_G7_SOC1_MUX_FUNC_MASK 0x7
> +#define ASPEED_G7_SOC1_MUX_BITS_PER_PIN 4
Should this mask be 0xF to cover all 4 bits?
Since ASPEED_G7_SOC1_MUX_BITS_PER_PIN is 4, using 0x7 will only clear the
lower 3 bits when regmap_update_bits() is called. If the bootloader leaves
the 4th bit set, will it remain set and corrupt the pin multiplexing behavior?
[ ... ]
> + AC25,
> + AB25,
> + AC24,
> + PCIERC2_PERST,
> + PORTC_MODE,
> + PORTD_MODE,
> + SGMII0,
> +};
Since SGMII0 is placed after the virtual pins in this enum, its index becomes
219 instead of 216.
When aspeed_g7_soc1_pinmux_field_from_pin() calculates the shift using
(pin % 8) * 4, will this inflated offset skip 3 pin slots (12 bits) and
configure the wrong hardware bits for SGMII0? Would it be safer to move the
virtual pins to the end of the enum?
[ ... ]
> +static int aspeed_g7_soc1_pin_config_get(struct pinctrl_dev *pctldev,
> + unsigned int pin,
> + unsigned long *config)
> +{
[ ... ]
> + val = (val_raw & (field.mask << field.shift)) >> field.shift;
> + if (param == PIN_CONFIG_DRIVE_STRENGTH)
> + val = (val + ASPEED_G7_SOC1_DRV_STRENGTH_HW_BASE) *
> + ASPEED_G7_SOC1_DRV_STRENGTH_STEP_MA;
> + else if (param != PIN_CONFIG_BIAS_DISABLE)
> + val = !val;
> +
> + *config = pinconf_to_config_packed(param, val);
> +
> + return 0;
> +}
Does this unconditionally return 0 (success) even if the queried boolean
parameter is not currently active?
The generic pinconf subsystem expects -EINVAL if a parameter like
PIN_CONFIG_BIAS_PULL_UP or PIN_CONFIG_BIAS_DISABLE is queried but not active
on the pin. Will returning 0 cause tools like debugfs to report mutually
exclusive states as active simultaneously?
[ ... ]
> +static int aspeed_g7_soc1_pinctrl_probe(struct platform_device *pdev)
> +{
[ ... ]
> + pctl->pctl = devm_pinctrl_register(dev, &aspeed_g7_soc1_desc, pctl);
> + if (IS_ERR(pctl->pctl)) {
> + dev_err(dev, "Failed to register pinctrl\n");
> + return PTR_ERR(pctl->pctl);
> + }
> +
> + for (i = 0; i < ARRAY_SIZE(aspeed_g7_soc1_groups); i++) {
> + const struct pingroup *grp = &aspeed_g7_soc1_groups[i];
> +
> + ret = pinctrl_generic_add_group(pctl->pctl, grp->name, (unsigned int *)grp->pins,
> + grp->npins, pctl);
Is it safe to call devm_pinctrl_register() before the groups and functions
are added to the radix trees?
devm_pinctrl_register() immediately exposes the device and parses device tree
pin hogs via pinctrl_enable(). Will any DT hogs defined for this controller
fail to apply because the internal radix trees are still empty?
Should this use devm_pinctrl_register_and_init() instead, followed by an
explicit pinctrl_enable() after populating the groups and functions?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260515-pinctrl-single-bit-v3-0-e97da4312104@aspeedtech.com?part=3
prev parent reply other threads:[~2026-05-15 10:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 9:37 [PATCH v3 0/3] pinctrl: aspeed: Add AST2700 SoC1 support Billy Tsai
2026-05-15 9:37 ` [PATCH v3 1/3] dt-bindings: mfd: aspeed,ast2x00-scu: Support AST2700 SoC1 pinctrl Billy Tsai
2026-05-15 9:37 ` [PATCH v3 2/3] dt-bindings: pinctrl: Add aspeed,ast2700-soc1-pinctrl Billy Tsai
2026-05-15 10:08 ` sashiko-bot
2026-05-15 9:37 ` [PATCH v3 3/3] pinctrl: aspeed: Add AST2700 SoC1 support Billy Tsai
2026-05-15 10:40 ` sashiko-bot [this message]
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=20260515104004.BA92CC2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=billy_tsai@aspeedtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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