Page MenuHomeFreeBSD

Use 'phy-handle' in FDT to find PHY address
ClosedPublic

Authored by aryeeteygerald_rogers.com on Apr 3 2019, 4:07 PM.

Details

Summary

Based on @manu's patch.
Since 'phy_id' is no longer dts as per in r337703, update driver to match device tree.

Test Plan

Tested on a beaglebone black

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

andrew added inline comments.Apr 3 2019, 4:22 PM
sys/arm/ti/cpsw/if_cpsw.c
762 ↗(On Diff #55780)

I don't think this is needed.

sys/arm/ti/cpsw/if_cpsw.c
762 ↗(On Diff #55780)

I don't think this is needed.

Yea, I think fdt_get_phyaddr should already handle it.

779 ↗(On Diff #55780)

I think I should re-add this check in case a slave isn't found somehow ...

  • Remove extra phy-handlei check and add 'no children' check
manu added inline comments.Apr 3 2019, 7:11 PM
sys/arm/ti/cpsw/if_cpsw.c
763 ↗(On Diff #55783)

This would return ENXIO if the first slave node isn't the one used, I don't know if any boards are like that but if they are they worked before and should after.

manu added inline comments.Apr 3 2019, 7:14 PM
sys/arm/ti/cpsw/if_cpsw.c
763 ↗(On Diff #55783)

You might also want to get phy_id if phy-handle don't exists so people with old DTB could still boot.

manu added inline comments.Apr 3 2019, 7:21 PM
sys/arm/ti/cpsw/if_cpsw.c
763 ↗(On Diff #55783)

Mhm no the old code only check the first slave@ node that matches the full node name based on the port and this is still the case.
A correct way would be to rely on the 'slaves' property which contain the number of slaves used and always parse every slave until this number is reached instead of this but that might be out of the scope of this review.
So just add a fallback to read phy_id if phy-handle doesn't exists and we're good to go for this one.

  • Support old DTBs which still use phy_id
manu accepted this revision.Apr 3 2019, 8:31 PM

LGTM.

This revision is now accepted and ready to land.Apr 3 2019, 8:31 PM
This revision was automatically updated to reflect the committed changes.