[PATCH v12 3/6] mfd: khadas-mcu: Add support for VIM4 MCU variant
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Sep 17 01:11:18 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mfd: Incorrect writeable registers in VIM4 regmap config
--
commit fc44329d7ee6d12a0077930b2632df3554d1e38f
Author: Ronald Claveau <linux-kernel-dev at aliel.fr>
mfd: khadas-mcu: Add support for VIM4 MCU variant
This commit adds support for the VIM4 MCU variant by refactoring the
probe function to use per-variant values. It introduces a dedicated
regmap configuration for the VIM4 MCU, with its own volatile and
writeable register checks.
> diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c
> index 0e74efe14f367..4b37e74e2b04a 100644
> --- a/drivers/mfd/khadas-mcu.c
> +++ b/drivers/mfd/khadas-mcu.c
[ ... ]
> +static bool khadas_mcu_vim4_reg_writeable(struct device *dev, unsigned int reg)
> +{
> + switch (reg) {
> + case KHADAS_MCU_VERSION_0_REG:
> + case KHADAS_MCU_VERSION_1_REG:
> + case KHADAS_MCU_SHUTDOWN_NORMAL_STATUS_REG:
> + return false;
> + default:
> + return true;
[Severity: Low]
Does this function omit multiple known read-only registers defined for the MCU,
such as KHADAS_MCU_MAC_0_REG and KHADAS_MCU_USID_0_REG?
Because this switch defaults to true, any unlisted read-only register is
incorrectly marked as writeable. Because the regmap uses REGCACHE_MAPLE,
writing to an omitted read-only register will inappropriately cache the written
value instead of failing, which could poison the cache for subsequent reads.
Even though the khadas-mcu-user-mem cell isn't instantiated for the VIM4 variant
(meaning there is no active code path writing to these registers in normal
production operation), should these known read-only registers be explicitly
handled to prevent future caching issues?
> + }
> +}
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260917-add-mcu-fan-khadas-vim4-v12-0-497cd543a148@aliel.fr?part=3
More information about the linux-amlogic
mailing list