mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* ls1046a: fsl-fman failure
@ 2025-07-15 15:04 Renaud Barbier
  2025-07-15 20:20 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Renaud Barbier @ 2025-07-15 15:04 UTC (permalink / raw)
  To: Barebox List

I have recently moved to barebox v2025.06 and the ethernet driver is failing probing.
In the COMMIT below, dev_get_drvdata is replaced by the following function device_get_match_data:

const void *device_get_match_data(struct device *dev)
  {
~         if (dev->of_id_entry) {
+                pr_err("%s A0 return 0x%p\n", __func__, dev->of_id_entry->data);
                  return dev->of_id_entry->data;
+         }

~         if (dev->id_entry) {
+                pr_err("%s A1 return 0x%p\n", __func__, dev->of_id_entry->data);
                  return (void *)dev->id_entry->driver_data;
+         }

+        pr_err("%s return 0x%p\n", __func__, NULL);
          return NULL;
  }

For my specific device, I get the following debug message:
ERROR: fsl-fman-port 1a8b000.port@8b000.of: probe
ERROR: device_get_match_data A0 return 0x0000000000000000 (here dev->of_id_entry is not NULL  and dev->of_id_entry->data is returned)

and from fsl_fman_port_probe:
ERROR: fsl-fman-port 1a8b000.port@8b000.of: type = 0. This is a valid type: FMAN_PORT_TYPE_RX = 0
ERROR: fsl-fman-port 1a8b000.port@8b000.of:  out 

COMMIT:
index f205de1929..84e7f20330 100644
--- a/drivers/net/fsl-fman.c
+++ b/drivers/net/fsl-fman.c
@@ -1085,15 +1085,14 @@ static int fsl_fman_mdio_probe(struct device *dev)
 static int fsl_fman_port_probe(struct device *dev)
 {
        struct resource *iores;
-       int ret;
        struct fsl_fman_port *port;
        unsigned long type;

        dev_dbg(dev, "probe\n");

-       ret = dev_get_drvdata(dev, (const void **)&type);
         dev_err(dev, "type = %d\n", type); <==== type is 0 or 1 (FMAN_PORT_TYPE_RX  or FMAN_PORT_TYPE_TX )
-       if (ret)
-               return ret;
+       type = (uintptr_t)device_get_match_data(dev);
+       if (!type)  <==== HERE it bails out because type == 0
                 dev_err(dev, "out\n"); **
+               return -ENODEV;

 
 


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

* Re: ls1046a: fsl-fman failure
  2025-07-15 15:04 ls1046a: fsl-fman failure Renaud Barbier
@ 2025-07-15 20:20 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2025-07-15 20:20 UTC (permalink / raw)
  To: Renaud Barbier, Barebox List

Hello Renaud,

Thanks for the report and your investigation and sorry for the breakage.

I just Cc'd you on a suggested fix.

Cheers,
Ahmad

On 15.07.25 17:04, Renaud Barbier wrote:
> I have recently moved to barebox v2025.06 and the ethernet driver is failing probing.
> In the COMMIT below, dev_get_drvdata is replaced by the following function device_get_match_data:
> 
> const void *device_get_match_data(struct device *dev)
>   {
> ~         if (dev->of_id_entry) {
> +                pr_err("%s A0 return 0x%p\n", __func__, dev->of_id_entry->data);
>                   return dev->of_id_entry->data;
> +         }
> 
> ~         if (dev->id_entry) {
> +                pr_err("%s A1 return 0x%p\n", __func__, dev->of_id_entry->data);
>                   return (void *)dev->id_entry->driver_data;
> +         }
> 
> +        pr_err("%s return 0x%p\n", __func__, NULL);
>           return NULL;
>   }
> 
> For my specific device, I get the following debug message:
> ERROR: fsl-fman-port 1a8b000.port@8b000.of: probe
> ERROR: device_get_match_data A0 return 0x0000000000000000 (here dev->of_id_entry is not NULL  and dev->of_id_entry->data is returned)
> 
> and from fsl_fman_port_probe:
> ERROR: fsl-fman-port 1a8b000.port@8b000.of: type = 0. This is a valid type: FMAN_PORT_TYPE_RX = 0
> ERROR: fsl-fman-port 1a8b000.port@8b000.of:  out 
> 
> COMMIT:
> index f205de1929..84e7f20330 100644
> --- a/drivers/net/fsl-fman.c
> +++ b/drivers/net/fsl-fman.c
> @@ -1085,15 +1085,14 @@ static int fsl_fman_mdio_probe(struct device *dev)
>  static int fsl_fman_port_probe(struct device *dev)
>  {
>         struct resource *iores;
> -       int ret;
>         struct fsl_fman_port *port;
>         unsigned long type;
> 
>         dev_dbg(dev, "probe\n");
> 
> -       ret = dev_get_drvdata(dev, (const void **)&type);
>          dev_err(dev, "type = %d\n", type); <==== type is 0 or 1 (FMAN_PORT_TYPE_RX  or FMAN_PORT_TYPE_TX )
> -       if (ret)
> -               return ret;
> +       type = (uintptr_t)device_get_match_data(dev);
> +       if (!type)  <==== HERE it bails out because type == 0
>                  dev_err(dev, "out\n"); **
> +               return -ENODEV;
> 
>  
>  
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2025-07-15 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-15 15:04 ls1046a: fsl-fman failure Renaud Barbier
2025-07-15 20:20 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox