Re: [PATCH v3 05/42] pinctrl: add a Cirrus ep93xx SoC pin controller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH v3 05/42] pinctrl: add a Cirrus ep93xx SoC pin controller
- From: Andy Shevchenko <andy@xxxxxxxxxx>
- Date: Fri, 21 Jul 2023 18:30:18 +0300
- Cc: Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>, Lennert Buytenhek <kernel@xxxxxxxxxxxxxx>, Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Lukasz Majewski <lukma@xxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, Bartosz Golaszewski <brgl@xxxxxxxx>, Rob Herring <robh+dt@xxxxxxxxxx>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@xxxxxxxxxx>, Conor Dooley <conor+dt@xxxxxxxxxx>, Michael Turquette <mturquette@xxxxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Alessandro Zummo <a.zummo@xxxxxxxxxxxx>, Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Wim Van Sebroeck <wim@xxxxxxxxxxxxxxxxxx>, Guenter Roeck <linux@xxxxxxxxxxxx>, Sebastian Reichel <sre@xxxxxxxxxx>, Thierry Reding <thierry.reding@xxxxxxxxx>, Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Vinod Koul <vkoul@xxxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, Vignesh Raghavendra <vigneshr@xxxxxx>, Damien Le Moal <dlemoal@xxxxxxxxxx>, Sergey Shtylyov <s.shtylyov@xxxxxx>, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Olof Johansson <olof@xxxxxxxxx>, soc@xxxxxxxxxx, Liam Girdwood <lgirdwood@xxxxxxxxx>, Jaroslav Kysela <perex@xxxxxxxx>, Takashi Iwai <tiwai@xxxxxxxx>, Michael Peters <mpeters@xxxxxxxxxxxxxx>, Kris Bahnsen <kris@xxxxxxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, linux-clk@xxxxxxxxxxxxxxx, linux-rtc@xxxxxxxxxxxxxxx, linux-watchdog@xxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, linux-pwm@xxxxxxxxxxxxxxx, linux-spi@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, dmaengine@xxxxxxxxxxxxxxx, linux-mtd@xxxxxxxxxxxxxxxxxxx, linux-ide@xxxxxxxxxxxxxxx, linux-input@xxxxxxxxxxxxxxx, alsa-devel@xxxxxxxxxxxxxxxx
- In-reply-to: <20230605-ep93xx-v3-5-3d63a5f1103e@maquefel.me>
- Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
- References: <20230605-ep93xx-v3-0-3d63a5f1103e@maquefel.me> <20230605-ep93xx-v3-5-3d63a5f1103e@maquefel.me>
On Thu, Jul 20, 2023 at 02:29:05PM +0300, Nikita Shubin via B4 Relay wrote:
> From: Nikita Shubin <nikita.shubin@xxxxxxxxxxx>
>
> This adds a pin control (only multiplexing) driver for ep93xx
> SoC so we can fully convert ep93xx to device tree.
>
> This driver is capable of muxing ep9301/ep9302/ep9307/ep9312/ep9315
> variants, this is chosen based on "compatible" in device tree.
...
> +config PINCTRL_EP93XX
> + bool
> + depends on OF && (ARCH_EP93XX || COMPILE_TEST)
The OF seems to be functional dependency and not compile time one.
Thus
depends on (OF && ARCH_EP93XX) || COMPILE_TEST
> + select PINMUX
> + select GENERIC_PINCONF
> + select MFD_SYSCON
...
> +#define EP93XX_SYSCON_DEVCFG_D1ONG BIT(30) /* not used */
> +#define EP93XX_SYSCON_DEVCFG_D0ONG BIT(29) /* not used */
> +#define EP93XX_SYSCON_DEVCFG_IONU2 BIT(28) /* not used */
> +#define EP93XX_SYSCON_DEVCFG_GONK BIT(27) /* done */
> +#define EP93XX_SYSCON_DEVCFG_TONG BIT(26) /* not used */
> +#define EP93XX_SYSCON_DEVCFG_MONG BIT(25) /* not used */
> +#define EP93XX_SYSCON_DEVCFG_A2ONG BIT(22) /* not used */
> +#define EP93XX_SYSCON_DEVCFG_A1ONG BIT(21) /* not used */
> +#define EP93XX_SYSCON_DEVCFG_HONIDE BIT(11) /* done */
> +#define EP93XX_SYSCON_DEVCFG_GONIDE BIT(10) /* done */
> +#define EP93XX_SYSCON_DEVCFG_PONG BIT(9) /* done */
> +#define EP93XX_SYSCON_DEVCFG_EONIDE BIT(8) /* done */
> +#define EP93XX_SYSCON_DEVCFG_I2SONSSP BIT(7) /* done */
> +#define EP93XX_SYSCON_DEVCFG_I2SONAC97 BIT(6) /* done */
> +#define EP93XX_SYSCON_DEVCFG_RASONP3 BIT(4) /* done */
> +#define PADS_MASK (GENMASK(30, 25) | BIT(22) | BIT(21) | GENMASK(11, 6) | BIT(4))
Seems better to spell each bit as by definition given above.
...
> +/* Ordered by bit index */
> +static const char * const ep93xx_padgroups[] = {
> + NULL, NULL, NULL, NULL,
> + "RasOnP3",
> + NULL,
> + "I2SonAC97",
> + "I2SonSSP",
> + "EonIDE",
> + "PonG",
> + "GonIDE",
> + "HonIDE",
> + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> + "A1onG",
> + "A2onG",
> + NULL, NULL,
> + "MonG",
> + "TonG",
> + "GonK",
> + "IonU2",
> + "D0onG",
> + "D1onG",
Instead of tons of NULLs, use
[NN] = "...",
which is much less error prone.
> +};
...
> +/** ep9301, ep9302*/
Is it really kernel doc (besides missing space)?
Please, run
scripts/kernel-doc -v -Wall -none $YOUR_FILE
for each file you contributed in the entire series and fix all warnings.
...
> +static const char *ep93xx_get_group_name(struct pinctrl_dev *pctldev,
> + unsigned int selector)
> +{
> + struct ep93xx_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
> +
> + switch (pmx->model) {
> + case EP93XX_9301_PINCTRL:
> + return ep9301_pin_groups[selector].grp.name;
> + case EP93XX_9307_PINCTRL:
> + return ep9307_pin_groups[selector].grp.name;
> + case EP93XX_9312_PINCTRL:
> + return ep9312_pin_groups[selector].grp.name;
> + }
> + return NULL;
Use default case instead.
> +}
...
> + /* Which bits changed */
> + before &= PADS_MASK;
> + after &= PADS_MASK;
> + expected = before & ~grp->mask;
> + expected |= grp->value;
> + expected &= PADS_MASK;
Instead of above:
expected = (before & ~grp->mask) | grp->value;
> + /* Print changed states */
> + tmp = expected ^ after;
tmp = (expected ^ after) & PADS_MASK;
> + for_each_set_bit(i, &tmp, PADS_MAXBIT) {
> + bool enabled = expected & BIT(i);
> +
> + dev_err(pmx->dev,
> + "pin group %s could not be %s: probably a hardware limitation\n",
> + ep93xx_padgroups[i], str_enabled_disabled(enabled));
Wrong indentation.
> + dev_err(pmx->dev,
> + "DeviceCfg before: %08x, after %08x, expected %08x\n",
> + before, after, expected);
Wrong indentation.
I believe this one can go to debug level.
> + }
...
> + pmx->model = (int)of_device_get_match_data(dev);
(uintptr_t) is more appropriate here.
...
> + pmx->pctl = devm_pinctrl_register(dev, &ep93xx_pmx_desc, pmx);
> + if (IS_ERR(pmx->pctl)) {
> + dev_err(dev, "could not register pinmux driver\n");
> + return PTR_ERR(pmx->pctl);
Why not dev_err_probe() as elsewhere?
> + }
...
> +static int __init ep93xx_pmx_init(void)
> +{
> + return platform_driver_register(&ep93xx_pmx_driver);
> +}
> +arch_initcall(ep93xx_pmx_init);
+ blank line.
Also add everywhere MODULE_DESCRIPTION() as modpost recently started to
complain (probably with `make W=1` which you should execute anyway for
your new code).
> +MODULE_IMPORT_NS(EP93XX_SOC);
--
With Best Regards,
Andy Shevchenko
[Index of Archives]
[Linux Kernel]
[Linux ARM (vger)]
[Linux ARM MSM]
[Linux Omap]
[Linux Arm]
[Linux Tegra]
[Fedora ARM]
[Linux for Samsung SOC]
[eCos]
[Linux Fastboot]
[Gcc Help]
[Git]
[DCCP]
[IETF Announce]
[Security]
[Linux MIPS]
[Yosemite Campsites]
|