All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: a37xx: pinctrl: probe after binding
@ 2023-01-17 14:08 Robert Marko
  2023-01-19  7:00 ` Stefan Roese
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Marko @ 2023-01-17 14:08 UTC (permalink / raw)
  To: sr, u-boot, sjg, pali, marex; +Cc: luka.perkov, Robert Marko

Currently, pinctrl drivers are getting probed during post-bind, however
that is being reverted, and on A37XX pinctrl driver is the one that
registers the GPIO driver during the probe.

So, if the pinctrl driver doesn't get probed GPIO-s won't get registered
and thus they cannot be used.

This is a problem on the Methode eDPU as it just uses SB pins as GPIO-s
and without them being registered networking won't work as it only has
one SFP slot and the TX disable GPIO is on the SB controller.

So, lets just add a flag only to A37XX driver to probe after binding
in order for the GPIO driver to always get registered.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
index 25fbe39abd1..1be6252227d 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -745,6 +745,19 @@ static int armada_37xx_pinctrl_probe(struct udevice *dev)
 	return 0;
 }
 
+static int armada_37xx_pinctrl_bind(struct udevice *dev)
+{
+	/*
+	 * Make sure that the pinctrl driver gets probed after binding
+	 * as on A37XX the pinctrl driver is the one that is also
+	 * registering the GPIO one during probe, so if its not probed
+	 * GPIO-s are not registered as well.
+	 */
+	dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
+	return 0;
+}
+
 static const struct udevice_id armada_37xx_pinctrl_of_match[] = {
 	{
 		.compatible = "marvell,armada3710-sb-pinctrl",
@@ -762,6 +775,7 @@ U_BOOT_DRIVER(armada_37xx_pinctrl) = {
 	.id = UCLASS_PINCTRL,
 	.of_match = of_match_ptr(armada_37xx_pinctrl_of_match),
 	.probe = armada_37xx_pinctrl_probe,
+	.bind = armada_37xx_pinctrl_bind,
 	.priv_auto	= sizeof(struct armada_37xx_pinctrl),
 	.ops = &armada_37xx_pinctrl_ops,
 };
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: a37xx: pinctrl: probe after binding
  2023-01-17 14:08 [PATCH] arm64: a37xx: pinctrl: probe after binding Robert Marko
@ 2023-01-19  7:00 ` Stefan Roese
  2023-02-12 23:36   ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Roese @ 2023-01-19  7:00 UTC (permalink / raw)
  To: Robert Marko, u-boot, sjg, pali, marex; +Cc: luka.perkov

On 1/17/23 15:08, Robert Marko wrote:
> Currently, pinctrl drivers are getting probed during post-bind, however
> that is being reverted, and on A37XX pinctrl driver is the one that
> registers the GPIO driver during the probe.
> 
> So, if the pinctrl driver doesn't get probed GPIO-s won't get registered
> and thus they cannot be used.
> 
> This is a problem on the Methode eDPU as it just uses SB pins as GPIO-s
> and without them being registered networking won't work as it only has
> one SFP slot and the TX disable GPIO is on the SB controller.
> 
> So, lets just add a flag only to A37XX driver to probe after binding
> in order for the GPIO driver to always get registered.
> 
> Signed-off-by: Robert Marko <robert.marko@sartura.hr>

Reviewed--by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> index 25fbe39abd1..1be6252227d 100644
> --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> @@ -745,6 +745,19 @@ static int armada_37xx_pinctrl_probe(struct udevice *dev)
>   	return 0;
>   }
>   
> +static int armada_37xx_pinctrl_bind(struct udevice *dev)
> +{
> +	/*
> +	 * Make sure that the pinctrl driver gets probed after binding
> +	 * as on A37XX the pinctrl driver is the one that is also
> +	 * registering the GPIO one during probe, so if its not probed
> +	 * GPIO-s are not registered as well.
> +	 */
> +	dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
> +
> +	return 0;
> +}
> +
>   static const struct udevice_id armada_37xx_pinctrl_of_match[] = {
>   	{
>   		.compatible = "marvell,armada3710-sb-pinctrl",
> @@ -762,6 +775,7 @@ U_BOOT_DRIVER(armada_37xx_pinctrl) = {
>   	.id = UCLASS_PINCTRL,
>   	.of_match = of_match_ptr(armada_37xx_pinctrl_of_match),
>   	.probe = armada_37xx_pinctrl_probe,
> +	.bind = armada_37xx_pinctrl_bind,
>   	.priv_auto	= sizeof(struct armada_37xx_pinctrl),
>   	.ops = &armada_37xx_pinctrl_ops,
>   };

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: a37xx: pinctrl: probe after binding
  2023-01-19  7:00 ` Stefan Roese
@ 2023-02-12 23:36   ` Simon Glass
  2023-02-13 11:59     ` Robert Marko
  2023-03-01 20:14     ` Simon Glass
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Glass @ 2023-02-12 23:36 UTC (permalink / raw)
  To: Stefan Roese; +Cc: Robert Marko, u-boot, pali, marex, luka.perkov

Hi,

On Thu, 19 Jan 2023 at 00:00, Stefan Roese <sr@denx.de> wrote:
>
> On 1/17/23 15:08, Robert Marko wrote:
> > Currently, pinctrl drivers are getting probed during post-bind, however
> > that is being reverted, and on A37XX pinctrl driver is the one that
> > registers the GPIO driver during the probe.
> >
> > So, if the pinctrl driver doesn't get probed GPIO-s won't get registered
> > and thus they cannot be used.
> >
> > This is a problem on the Methode eDPU as it just uses SB pins as GPIO-s
> > and without them being registered networking won't work as it only has
> > one SFP slot and the TX disable GPIO is on the SB controller.
> >
> > So, lets just add a flag only to A37XX driver to probe after binding
> > in order for the GPIO driver to always get registered.
> >
> > Signed-off-by: Robert Marko <robert.marko@sartura.hr>
>
> Reviewed--by: Stefan Roese <sr@denx.de>
>
> Thanks,
> Stefan
>
> > ---
> >   drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 14 ++++++++++++++
> >   1 file changed, 14 insertions(+)
> >
> > diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> > index 25fbe39abd1..1be6252227d 100644
> > --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> > +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> > @@ -745,6 +745,19 @@ static int armada_37xx_pinctrl_probe(struct udevice *dev)
> >       return 0;
> >   }
> >
> > +static int armada_37xx_pinctrl_bind(struct udevice *dev)
> > +{
> > +     /*
> > +      * Make sure that the pinctrl driver gets probed after binding
> > +      * as on A37XX the pinctrl driver is the one that is also
> > +      * registering the GPIO one during probe, so if its not probed
> > +      * GPIO-s are not registered as well.
> > +      */
> > +     dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
> > +
> > +     return 0;
> > +}
> > +
> >   static const struct udevice_id armada_37xx_pinctrl_of_match[] = {
> >       {
> >               .compatible = "marvell,armada3710-sb-pinctrl",
> > @@ -762,6 +775,7 @@ U_BOOT_DRIVER(armada_37xx_pinctrl) = {
> >       .id = UCLASS_PINCTRL,
> >       .of_match = of_match_ptr(armada_37xx_pinctrl_of_match),
> >       .probe = armada_37xx_pinctrl_probe,
> > +     .bind = armada_37xx_pinctrl_bind,
> >       .priv_auto      = sizeof(struct armada_37xx_pinctrl),
> >       .ops = &armada_37xx_pinctrl_ops,
> >   };
>

This is OK if you really want to do this. Is it not possible to do the
bind of the GPIO devices in the pinctrl bind() handler, as is done by
other SoCs? Why do we need to probe the pinctrl driver first?

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: a37xx: pinctrl: probe after binding
  2023-02-12 23:36   ` Simon Glass
@ 2023-02-13 11:59     ` Robert Marko
  2023-03-01 20:14     ` Simon Glass
  1 sibling, 0 replies; 5+ messages in thread
From: Robert Marko @ 2023-02-13 11:59 UTC (permalink / raw)
  To: Simon Glass; +Cc: Stefan Roese, u-boot, pali, marex, luka.perkov

On Mon, Feb 13, 2023 at 12:36 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi,
>
> On Thu, 19 Jan 2023 at 00:00, Stefan Roese <sr@denx.de> wrote:
> >
> > On 1/17/23 15:08, Robert Marko wrote:
> > > Currently, pinctrl drivers are getting probed during post-bind, however
> > > that is being reverted, and on A37XX pinctrl driver is the one that
> > > registers the GPIO driver during the probe.
> > >
> > > So, if the pinctrl driver doesn't get probed GPIO-s won't get registered
> > > and thus they cannot be used.
> > >
> > > This is a problem on the Methode eDPU as it just uses SB pins as GPIO-s
> > > and without them being registered networking won't work as it only has
> > > one SFP slot and the TX disable GPIO is on the SB controller.
> > >
> > > So, lets just add a flag only to A37XX driver to probe after binding
> > > in order for the GPIO driver to always get registered.
> > >
> > > Signed-off-by: Robert Marko <robert.marko@sartura.hr>
> >
> > Reviewed--by: Stefan Roese <sr@denx.de>
> >
> > Thanks,
> > Stefan
> >
> > > ---
> > >   drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 14 ++++++++++++++
> > >   1 file changed, 14 insertions(+)
> > >
> > > diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> > > index 25fbe39abd1..1be6252227d 100644
> > > --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> > > +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> > > @@ -745,6 +745,19 @@ static int armada_37xx_pinctrl_probe(struct udevice *dev)
> > >       return 0;
> > >   }
> > >
> > > +static int armada_37xx_pinctrl_bind(struct udevice *dev)
> > > +{
> > > +     /*
> > > +      * Make sure that the pinctrl driver gets probed after binding
> > > +      * as on A37XX the pinctrl driver is the one that is also
> > > +      * registering the GPIO one during probe, so if its not probed
> > > +      * GPIO-s are not registered as well.
> > > +      */
> > > +     dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
> > > +
> > > +     return 0;
> > > +}
> > > +
> > >   static const struct udevice_id armada_37xx_pinctrl_of_match[] = {
> > >       {
> > >               .compatible = "marvell,armada3710-sb-pinctrl",
> > > @@ -762,6 +775,7 @@ U_BOOT_DRIVER(armada_37xx_pinctrl) = {
> > >       .id = UCLASS_PINCTRL,
> > >       .of_match = of_match_ptr(armada_37xx_pinctrl_of_match),
> > >       .probe = armada_37xx_pinctrl_probe,
> > > +     .bind = armada_37xx_pinctrl_bind,
> > >       .priv_auto      = sizeof(struct armada_37xx_pinctrl),
> > >       .ops = &armada_37xx_pinctrl_ops,
> > >   };
> >
>
> This is OK if you really want to do this. Is it not possible to do the
> bind of the GPIO devices in the pinctrl bind() handler, as is done by
> other SoCs? Why do we need to probe the pinctrl driver first?

Because on A37xx the pinctrl driver needs to be probed before the GPIO
one can be probed as GPIO driver is using internal data that is filled in
by the pinctrl driver.

Regards,
Robert
>
> Reviewed-by: Simon Glass <sjg@chromium.org>



-- 
Robert Marko
Staff Embedded Linux Engineer
Sartura Ltd.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: robert.marko@sartura.hr
Web: www.sartura.hr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: a37xx: pinctrl: probe after binding
  2023-02-12 23:36   ` Simon Glass
  2023-02-13 11:59     ` Robert Marko
@ 2023-03-01 20:14     ` Simon Glass
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2023-03-01 20:14 UTC (permalink / raw)
  To: Robert Marko; +Cc: Stefan Roese, u-boot, pali, marex, luka.perkov, Simon Glass

On Mon, Feb 13, 2023 at 12:36 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi,
>
> On Thu, 19 Jan 2023 at 00:00, Stefan Roese <sr@denx.de> wrote:
> >
> > On 1/17/23 15:08, Robert Marko wrote:
> > > Currently, pinctrl drivers are getting probed during post-bind, however
> > > that is being reverted, and on A37XX pinctrl driver is the one that
> > > registers the GPIO driver during the probe.
> > >
> > > So, if the pinctrl driver doesn't get probed GPIO-s won't get registered
> > > and thus they cannot be used.
> > >
> > > This is a problem on the Methode eDPU as it just uses SB pins as GPIO-s
> > > and without them being registered networking won't work as it only has
> > > one SFP slot and the TX disable GPIO is on the SB controller.
> > >
> > > So, lets just add a flag only to A37XX driver to probe after binding
> > > in order for the GPIO driver to always get registered.
> > >
> > > Signed-off-by: Robert Marko <robert.marko@sartura.hr>
> >
> > Reviewed--by: Stefan Roese <sr@denx.de>
> >
> > Thanks,
> > Stefan
> >
> > > ---
> > >   drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 14 ++++++++++++++
> > >   1 file changed, 14 insertions(+)
> > >
Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-01 20:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 14:08 [PATCH] arm64: a37xx: pinctrl: probe after binding Robert Marko
2023-01-19  7:00 ` Stefan Roese
2023-02-12 23:36   ` Simon Glass
2023-02-13 11:59     ` Robert Marko
2023-03-01 20:14     ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.