Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1283868

Re: SoCFPGA ethernet broken

From Andrew Lunn <andrew@lunn.ch>
Newsgroups linux.kernel
Subject Re: SoCFPGA ethernet broken
Date 2015-12-04 15:40 +0100
Message-ID <qBZGG-3Ud-9@gated-at.bofh.it> (permalink)
References (5 earlier) <qBJBU-22d-7@gated-at.bofh.it> <qBNcw-4nR-63@gated-at.bofh.it> <qBNcv-4nR-61@gated-at.bofh.it> <qBNPb-4Dl-3@gated-at.bofh.it> <qBZGG-3Ud-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> > @@ -339,9 +340,19 @@ static int ksz9021_config_init(struct phy_device *phydev)
> >  {
> >  	const struct device *dev = &phydev->dev;
> >  	const struct device_node *of_node = dev->of_node;
> > +	const struct device *dev_walker;
> >  
> > -	if (!of_node && dev->parent->of_node)
> > -		of_node = dev->parent->of_node;
> > +	dev_info(dev, "dev->parent: %s\n", dev_name(dev->parent));
> > +	dev_info(dev, "phydev->attached_dev->dev: %s\n", dev_name(&phydev->attached_dev->dev));
> > +
> > +	dev_walker = &phydev->dev;
> > +	do {
> > +		of_node = dev_walker->of_node;
> > +		dev_info(dev, "walking: %s %p\n",
> > +			 dev_name(dev_walker), of_node);
> > +		dev_walker = dev_walker->parent;
> > +
> > +	} while (!of_node && dev_walker);
> >  
> >  	if (of_node) {
> >  		ksz9021_load_values_from_of(phydev, of_node,
> > 
> 
> Here is the output from the above patch:
> 
> [    1.042049] mmc0: new high speed SDHC card at address aaaa
> [    1.048017] mmcblk0: mmc0:aaaa SU32G 29.7 GiB
> [    1.053506]  mmcblk0: p1 p2 p3 p4
> [    1.057708] dwc2 ffb40000.usb: Configuration mismatch. Forcing host mode
> [    1.064418] dwc2 ffb40000.usb: no platform data or transceiver defined
> [    1.070966] Micrel KSZ9021 Gigabit PHY stmmac-0:04: dev->parent: stmmac-0
> [    1.077746] Micrel KSZ9021 Gigabit PHY stmmac-0:04: phydev->attached_dev->dev: eth0
> [    1.085389] Micrel KSZ9021 Gigabit PHY stmmac-0:04: walking: stmmac-0:04   (null)
> [    1.092841] Micrel KSZ9021 Gigabit PHY stmmac-0:04: walking: stmmac-0   (null)
> [    1.100042] Micrel KSZ9021 Gigabit PHY stmmac-0:04: walking: ff702000.ethernet ef9f3538

Ah! So we have an intermediary device in the
chain. phydev->attached_dev->dev points to this intermediate device,
rather than the platform device, which is why my patch failed.

I don't know the network stack well enough. Is this consider broken?
Is this valid? Is there any generic code which might try looking in
netdev->dev.of_node?  Do other MAC drivers have an intermediate
device?

We could modify the stmac driver so that phydev->attached_dev->dev
does point to the platform device, and then my patch works. But if
there are other MAC drivers which are structured like this, they are
also broken when used with the Micrel PHY. So then walking up the
device tree is a better solution.

Comments from more knowledgeable people requested!

       Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: SoCFPGA ethernet broken Pavel Machek <pavel@denx.de> - 2015-12-03 21:50 +0100
  Re: SoCFPGA ethernet broken David Daney <ddaney@caviumnetworks.com> - 2015-12-03 22:30 +0100
    Re: SoCFPGA ethernet broken Andrew Lunn <andrew@lunn.ch> - 2015-12-04 02:20 +0100
      Re: SoCFPGA ethernet broken Andrew Lunn <andrew@lunn.ch> - 2015-12-04 03:00 +0100
        Re: SoCFPGA ethernet broken Andrew Lunn <andrew@lunn.ch> - 2015-12-04 15:40 +0100
    Re: SoCFPGA ethernet broken Pavel Machek <pavel@denx.de> - 2015-12-04 10:40 +0100

csiph-web