2023-09-12 13:42:27

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v5 28/31] pinctrl: Add support for the Lantic PEF2256 pinmux

Hi Herve,

thanks for your patch!

On Tue, Sep 12, 2023 at 12:15 PM Herve Codina <[email protected]> wrote:

> The Lantiq PEF2256 is a framer and line interface component designed to
> fulfill all required interfacing between an analog E1/T1/J1 line and the
> digital PCM system highway/H.100 bus.
>
> This kind of component can be found in old telecommunication system.
> It was used to digital transmission of many simultaneous telephone calls
> by time-division multiplexing. Also using HDLC protocol, WAN networks
> can be reached through the framer.
>
> This pinmux support handles the pin muxing part (pins RP(A..D) and pins
> XP(A..D)) of the PEF2256.
>
> Signed-off-by: Herve Codina <[email protected]>
> Reviewed-by: Christophe Leroy <[email protected]>
> Signed-off-by: Christophe Leroy <[email protected]>

Nice to see this as a proper pin control driver!

> drivers/pinctrl/pinctrl-pef2256-regs.h | 65 ++++++
> drivers/pinctrl/pinctrl-pef2256.c | 308 +++++++++++++++++++++++++

Do you really need a separate header just for some registers?
But it's a matter of taste so I'm not gonna complain if you want
it this way.

> +config PINCTRL_PEF2256
> + tristate "Lantiq PEF2256 (FALC56) pin controller driver"
> + depends on OF && FRAMER_PEF2256
> + select PINMUX

select PINCONF

> + select GENERIC_PINCONF

This brings it in implicitly but I prefer that you just select it.

> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*

I think SPDX mandates that you start the tag with C99 comments

// SPDX-License-Identifier: GPL-2.0-only

> + /* We map 1 group <-> 1 pin */

Also known as "the qualcomm trick", but hey: it's fine.

> +static int pef2256_register_pinctrl(struct pef2256_pinctrl *pef2256)
> +{
> + struct pinctrl_dev *pctrl;
> +
> + pef2256->pctrl_desc.name = dev_name(pef2256->dev);
> + pef2256->pctrl_desc.owner = THIS_MODULE;
> + pef2256->pctrl_desc.pctlops = &pef2256_pctlops;
> + pef2256->pctrl_desc.pmxops = &pef2256_pmxops;
> + if (pef2256->version == PEF2256_VERSION_1_2) {
> + pef2256->pctrl_desc.pins = pef2256_v12_pins;
> + pef2256->pctrl_desc.npins = ARRAY_SIZE(pef2256_v12_pins);
> + pef2256->functions = pef2256_v12_functions;
> + pef2256->nfunctions = ARRAY_SIZE(pef2256_v12_functions);
> + } else {
> + pef2256->pctrl_desc.pins = pef2256_v2x_pins;
> + pef2256->pctrl_desc.npins = ARRAY_SIZE(pef2256_v2x_pins);
> + pef2256->functions = pef2256_v2x_functions;
> + pef2256->nfunctions = ARRAY_SIZE(pef2256_v2x_functions);
> + }
> +
> + pctrl = devm_pinctrl_register(pef2256->dev, &pef2256->pctrl_desc, pef2256);
> + if (IS_ERR(pctrl)) {
> + dev_err(pef2256->dev, "pinctrl driver registration failed\n");
> + return PTR_ERR(pctrl);
> + }
> +
> + return 0;

You could use
return dev_err_probe(...);

> + pef2256_reset_pinmux(pef2256_pinctrl);
> + ret = pef2256_register_pinctrl(pef2256_pinctrl);
> + if (ret)
> + return ret;

Or you could use it down here.

With or without these changes (because they are nitpicks)
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij


2023-09-12 15:09:43

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v5 28/31] pinctrl: Add support for the Lantic PEF2256 pinmux

On Tue, Sep 12, 2023 at 01:04:56PM +0200, Linus Walleij wrote:
> On Tue, Sep 12, 2023 at 12:15 PM Herve Codina <[email protected]> wrote:

> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*

> I think SPDX mandates that you start the tag with C99 comments

> // SPDX-License-Identifier: GPL-2.0-only

Not for headers, they should use C style since they might be included in
contexts where C++ isn't supported.


Attachments:
(No filename) (432.00 B)
signature.asc (499.00 B)
Download all attachments

2023-09-13 00:11:34

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v5 28/31] pinctrl: Add support for the Lantic PEF2256 pinmux

On Tue, Sep 12, 2023 at 4:31 PM Mark Brown <[email protected]> wrote:
> On Tue, Sep 12, 2023 at 01:04:56PM +0200, Linus Walleij wrote:
> > On Tue, Sep 12, 2023 at 12:15 PM Herve Codina <[email protected]> wrote:
>
> > > +/* SPDX-License-Identifier: GPL-2.0 */
> > > +/*
>
> > I think SPDX mandates that you start the tag with C99 comments
>
> > // SPDX-License-Identifier: GPL-2.0-only
>
> Not for headers, they should use C style since they might be included in
> contexts where C++ isn't supported.

Oh right. Thanks Mark!

Yours,
Linus Walleij

2023-09-18 19:07:42

by Herve Codina

[permalink] [raw]
Subject: Re: [PATCH v5 28/31] pinctrl: Add support for the Lantic PEF2256 pinmux

On Tue, 12 Sep 2023 13:04:56 +0200
Linus Walleij <[email protected]> wrote:

> Hi Herve,
>
> thanks for your patch!
>
> On Tue, Sep 12, 2023 at 12:15 PM Herve Codina <[email protected]> wrote:
>
> > The Lantiq PEF2256 is a framer and line interface component designed to
> > fulfill all required interfacing between an analog E1/T1/J1 line and the
> > digital PCM system highway/H.100 bus.
> >
> > This kind of component can be found in old telecommunication system.
> > It was used to digital transmission of many simultaneous telephone calls
> > by time-division multiplexing. Also using HDLC protocol, WAN networks
> > can be reached through the framer.
> >
> > This pinmux support handles the pin muxing part (pins RP(A..D) and pins
> > XP(A..D)) of the PEF2256.
> >
> > Signed-off-by: Herve Codina <[email protected]>
> > Reviewed-by: Christophe Leroy <[email protected]>
> > Signed-off-by: Christophe Leroy <[email protected]>
>
> Nice to see this as a proper pin control driver!
>
> > drivers/pinctrl/pinctrl-pef2256-regs.h | 65 ++++++
> > drivers/pinctrl/pinctrl-pef2256.c | 308 +++++++++++++++++++++++++
>
> Do you really need a separate header just for some registers?
> But it's a matter of taste so I'm not gonna complain if you want
> it this way.

Will be move to the .c file in the next iteration.

>
> > +config PINCTRL_PEF2256
> > + tristate "Lantiq PEF2256 (FALC56) pin controller driver"
> > + depends on OF && FRAMER_PEF2256
> > + select PINMUX
>
> select PINCONF

Will be added in the next iteration.

>
> > + select GENERIC_PINCONF
>
> This brings it in implicitly but I prefer that you just select it.
>
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*
>
> I think SPDX mandates that you start the tag with C99 comments

Already replied by Mark, C style comment is correct -> No change.

>
> // SPDX-License-Identifier: GPL-2.0-only
>
> > + /* We map 1 group <-> 1 pin */
>
> Also known as "the qualcomm trick", but hey: it's fine.
>
> > +static int pef2256_register_pinctrl(struct pef2256_pinctrl *pef2256)
> > +{
> > + struct pinctrl_dev *pctrl;
> > +
> > + pef2256->pctrl_desc.name = dev_name(pef2256->dev);
> > + pef2256->pctrl_desc.owner = THIS_MODULE;
> > + pef2256->pctrl_desc.pctlops = &pef2256_pctlops;
> > + pef2256->pctrl_desc.pmxops = &pef2256_pmxops;
> > + if (pef2256->version == PEF2256_VERSION_1_2) {
> > + pef2256->pctrl_desc.pins = pef2256_v12_pins;
> > + pef2256->pctrl_desc.npins = ARRAY_SIZE(pef2256_v12_pins);
> > + pef2256->functions = pef2256_v12_functions;
> > + pef2256->nfunctions = ARRAY_SIZE(pef2256_v12_functions);
> > + } else {
> > + pef2256->pctrl_desc.pins = pef2256_v2x_pins;
> > + pef2256->pctrl_desc.npins = ARRAY_SIZE(pef2256_v2x_pins);
> > + pef2256->functions = pef2256_v2x_functions;
> > + pef2256->nfunctions = ARRAY_SIZE(pef2256_v2x_functions);
> > + }
> > +
> > + pctrl = devm_pinctrl_register(pef2256->dev, &pef2256->pctrl_desc, pef2256);
> > + if (IS_ERR(pctrl)) {
> > + dev_err(pef2256->dev, "pinctrl driver registration failed\n");
> > + return PTR_ERR(pctrl);
> > + }
> > +
> > + return 0;
>
> You could use
> return dev_err_probe(...);

Indeed, I will change.

>
> > + pef2256_reset_pinmux(pef2256_pinctrl);
> > + ret = pef2256_register_pinctrl(pef2256_pinctrl);
> > + if (ret)
> > + return ret;
>
> Or you could use it down here.
>
> With or without these changes (because they are nitpicks)
> Reviewed-by: Linus Walleij <[email protected]>
>
> Yours,
> Linus Walleij

Thanks for your comment.

Best regards,
Hervé