net/phy: Improvements to Cavium Thunder MDIO code.
Subsystems (5)
cover net/phy: Improvements to Cavium Thunder MDIO code.
From: David Daney <[email protected]>
The firmware on many Cavium Thunder systems configures the MDIO bus hardware to be probed as a PCI device. In order to use the MDIO bus drivers in this configuration, we must add PCI probing to the driver.
There are two parts to this set of three patches:
1) Cleanup the PHY probing code in thunder_bgx.c to handle the case where there is no PHY attached to a port, as well as being more robust in the face of driver loading order by use of -EPROBE_DEFER.
2) Split mdio-octeon.c into two drivers, one with platform probing, and the other with PCI probing. Common code is shared between the two.
Tested on several different Thunder and OCTEON systems, also compile tested on x86_64.
David Daney (3):
net: thunderx: Cleanup PHY probing code.
phy: mdio-octeon: Refactor into two files/modules
phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.
.../devicetree/bindings/net/cavium-mdio.txt | 61 ++++- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 31 +-- drivers/net/phy/Kconfig | 22 +- drivers/net/phy/Makefile | 2 + drivers/net/phy/mdio-cavium.c | 149 +++++++++++ drivers/net/phy/mdio-cavium.h | 119 +++++++++ drivers/net/phy/mdio-octeon.c | 280 ++------------------- drivers/net/phy/mdio-thunder.c | 154 ++++++++++++ 8 files changed, 533 insertions(+), 285 deletions(-) create mode 100644 drivers/net/phy/mdio-cavium.c create mode 100644 drivers/net/phy/mdio-cavium.h create mode 100644 drivers/net/phy/mdio-thunder.c
Signature · 1 line
1.7.11.7
PATCH 1/3 net: thunderx: Cleanup PHY probing code.
From: David Daney <[email protected]>
Remove the call to force the octeon-mdio driver to be loaded. Allow the standard driver loading mechanisms to load the PHY drivers, and use -EPROBE_DEFER to cause the BGX driver to be probed only after the PHY drivers are available.
Reorder the setting of MAC addresses and PHY probing to allow BGX LMACs with no attached PHY to still be assigned a MAC address.
--- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 31 ++++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +16 -15
@@ -978,27 +978,31 @@ static int bgx_init_of_phy(struct bgx *bgx)const char *mac;device_for_each_child_node (&bgx->pdev->dev, fwn) { +struct phy_device *pd;struct device_node *phy_np;struct device_node *node =to_of_node (fwn); -/* If it is not an OF node we cannot handle it yet, so -* exit the loop. -*/ -if (!node) -break ; - - phy_np =of_parse_phandle (node,"phy-handle" ,0 ); -if (!phy_np) -continue ; - - bgx->lmac[lmac].phydev =of_phy_find_device (phy_np); - mac =of_get_mac_address (node);if (mac)ether_addr_copy (bgx->lmac[lmac].mac, mac);SET_NETDEV_DEV (&bgx->lmac[lmac].netdev, &bgx->pdev->dev); bgx->lmac[lmac].lmacid = lmac; + + phy_np =of_parse_phandle (node,"phy-handle" ,0 ); +/* If there is no phy or defective firmware presents +* this cortina phy, for which there is no driver +* support, ignore it. +*/ +if (phy_np && + !of_device_is_compatible (phy_np,"cortina,cs4223-slice" )) { +/* Wait until the phy drivers are available */ + pd =of_phy_find_device (phy_np); +if (!pd) +return -EPROBE_DEFER ; + bgx->lmac[lmac].phydev = pd; + } + lmac++;if (lmac ==MAX_LMAC_PER_BGX ) {of_node_put (node);
@@ -1032,9 +1036,6 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)struct bgx *bgx =NULL ;u8 lmac; -/* Load octeon mdio driver */ -octeon_mdiobus_force_mod_depencency (); - bgx =devm_kzalloc (dev,sizeof (*bgx),GFP_KERNEL );if (!bgx)return -ENOMEM ;
Signature · 1 line
1.7.11.7
PATCH 2/3 phy: mdio-octeon: Refactor into two files/modules
In reply to David DaneyFrom: David Daney <[email protected]>
A follow-on patch uses PCI probing to find the Thunder MDIO hardware. In preparation for this, split out the common code into a new file mdio-cavium.c, which will be used by both the existing OCTEON driver, and the new Thunder PCI based driver.
As part of the refactoring simplify the struct cavium_mdiobus by removing fields that are only ever used in the probe function and can just as well be local variables.
Use readq/writeq in preference to readq_relaxed/writeq_relaxed as the relaxed form was an optimization for an early chip revision, and the MDIO drivers are not performance bottlenecks that need optimization in the first place.
--- drivers/net/phy/Kconfig | 11 +- drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-cavium.c | 149 ++++++++++++++++++++++ drivers/net/phy/mdio-cavium.h | 119 ++++++++++++++++++ drivers/net/phy/mdio-octeon.c | 280 +++--------------------------------------- 5 files changed, 292 insertions(+), 268 deletions(-) create mode 100644 drivers/net/phy/mdio-cavium.c create mode 100644 drivers/net/phy/mdio-cavium.h
drivers/net/phy/Kconfig +7 -4
@@ -183,15 +183,18 @@ config MDIO_GPIO To compile this driver as a module, choose M here: the module will be called mdio-gpio. +config MDIO_CAVIUM + tristate + config MDIO_OCTEON - tristate "Support for MDIO buses on Octeon and ThunderX SOCs" + tristate "Support for MDIO buses on Octeon and some ThunderX SOCs" depends on 64BIT depends on HAS_IOMEM + select MDIO_CAVIUM help - This module provides a driver for the Octeon and ThunderX MDIO - busses. It is required by the Octeon and ThunderX ethernet device - drivers. + buses. It is required by the Octeon and ThunderX ethernet device + drivers on some systems. config MDIO_SUN4I tristate "Allwinner sun4i MDIO interface support"
drivers/net/phy/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_DP83867_PHY) += dp83867.o obj-$(CONFIG_STE10XP) += ste10Xp.o obj-$(CONFIG_MICREL_PHY) += micrel.o obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o +obj-$(CONFIG_MDIO_CAVIUM) += mdio-cavium.o obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o obj-$(CONFIG_AT803X_PHY) += at803x.o obj-$(CONFIG_AMD_PHY) += amd.o
drivers/net/phy/mdio-cavium.c new file +149 -0
149 lines not on this page · raw message
drivers/net/phy/mdio-cavium.h new file +119 -0
119 lines not on this page · raw message
drivers/net/phy/mdio-octeon.c +16 -264
346 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 3/3 phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.
In reply to David DaneyFrom: David Daney <[email protected]>
The Cavium Thunder SoCs have multiple MIDO buses that are part of a single PCI device. To model this in the device tree we call the PCI parent device a "cavium,thunder-8890-mdio-nexus", it has several children, one for each MDIO bus.
The MDIO bus hardware is identical to that found in the OCTEON SoCs, so we use that code for things that are not part of the PCI driver probe/remove
--- .../devicetree/bindings/net/cavium-mdio.txt | 61 +++++++- drivers/net/phy/Kconfig | 11 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-thunder.c | 154 +++++++++++++++++++++ 4 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 drivers/net/phy/mdio-thunder.c
Documentation/devicetree/bindings/net/cavium-mdio.txt +59 -2
@@ -1,9 +1,12 @@ * System Management Interface (SMI) / MDIO Properties: -- compatible: "cavium,octeon-3860-mdio" +- compatible: One of: - Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs. + "cavium,octeon-3860-mdio": Compatibility with all cn3XXX, cn5XXX + and cn6XXX SOCs. + + "cavium,thunder-8890-mdio": Compatibility with all cn8XXX SOCs. - reg: The base address of the MDIO bus controller register bank.
@@ -25,3 +28,57 @@ Example: reg = <0>; }; }; + + +* System Management Interface (SMI) / MDIO Nexus + + Several mdio buses may be gathered as children of a single PCI + device, this PCI device is the nexus of the buses. + +Properties: + +- compatible: "cavium,thunder-8890-mdio-nexus"; + +- reg: The PCI device and function numbers of the nexus device. + +- #address-cells: Must be <2>. + +- #size-cells: Must be <2>. + +- ranges: As needed for mapping of the MDIO bus device registers. + +- assigned-addresses: As needed for mapping of the MDIO bus device registers. + +Example: + + mdio-nexus at 1,3 { + compatible = "cavium,thunder-8890-mdio-nexus"; + #address-cells = <2>; + #size-cells = <2>; + reg = <0x0b00 0 0 0 0>; /* DEVFN = 0x0b (1:3) */ + assigned-addresses = <0x03000000 0x87e0 0x05000000 0x0 0x800000>; + ranges = <0x87e0 0x05000000 0x03000000 0x87e0 0x05000000 0x0 0x800000>; + + mdio0 at 87e0,05003800 { + compatible = "cavium,thunder-8890-mdio"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x87e0 0x05003800 0x0 0x30>; + + ethernet-phy at 0 { + ... + reg = <0>; + }; + }; + mdio0 at 87e0,05003880 { + compatible = "cavium,thunder-8890-mdio"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x87e0 0x05003880 0x0 0x30>; + + ethernet-phy at 0 { + ... + reg = <0>; + }; + }; + };
drivers/net/phy/Kconfig +11 -0
@@ -196,6 +196,17 @@ config MDIO_OCTEON buses. It is required by the Octeon and ThunderX ethernet device drivers on some systems. +config MDIO_THUNDER + tristate "Support for MDIO buses on on ThunderX SOCs" + depends on 64BIT + depends on PCI + select MDIO_CAVIUM + help + This driver supports the MDIO interfaces found on Cavium + ThunderX SoCs when the MDIO bus device appears on as a PCI + device. + + config MDIO_SUN4I tristate "Allwinner sun4i MDIO interface support" depends on ARCH_SUNXI
drivers/net/phy/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_DP83867_PHY) += dp83867.o obj-$(CONFIG_STE10XP) += ste10Xp.o obj-$(CONFIG_MICREL_PHY) += micrel.o obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o +obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o obj-$(CONFIG_MDIO_CAVIUM) += mdio-cavium.o obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o obj-$(CONFIG_AT803X_PHY) += at803x.o
drivers/net/phy/mdio-thunder.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
1.7.11.7
Andrew Lunn
maintainerRe: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
In reply to David Daneydrivers/net/ethernet/cavium/thunder/thunder_bgx.c static int bgx_init_of_phy(struct bgx *bgx) · line 998
Quoted 7 lines
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +7
-0+ phy_np =of_parse_phandle (node,"phy-handle" ,0 ); +/* If there is no phy or defective firmware presents +* this cortina phy, for which there is no driver +* support, ignore it. +*/ +if (phy_np && + !of_device_is_compatible (phy_np,"cortina,cs4223-slice" )) {
Hi David
What is a cortina,cs4223-slice, and why does it need to be handled differently?
Thanks
Andrew
Re: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
Quoted 11 lines · Andrew Lunn
drivers/net/ethernet/cavium/thunder/thunder_bgx.c static int bgx_init_of_phy(struct bgx *bgx) · line 998
Quoted 7 lines
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +7
-0+ phy_np =of_parse_phandle (node,"phy-handle" ,0 ); +/* If there is no phy or defective firmware presents +* this cortina phy, for which there is no driver +* support, ignore it. +*/ +if (phy_np && + !of_device_is_compatible (phy_np,"cortina,cs4223-slice" )) {Hi David
What is a cortina,cs4223-slice,
It is 1/4 of:
https://www.inphi.com/products/cs4223.php
Quoted 2 lines
and why does it need to be handled differently?
$ ls drivers/net/phy/*cortina* ls: cannot access drivers/net/phy/*cortina*: No such file or directory
For this configuration of thunder_bgx.c, the use of a Linux PHY driver is optional.
The firmware should probably not specify a PHY here, but it does so we ignore it so we don't wait around forever for the non-existent driver to bind.
Andrew Lunn
maintainerRe: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
Quoted 23 lines · David Daney
Quoted 11 lines · Andrew Lunn
drivers/net/ethernet/cavium/thunder/thunder_bgx.c static int bgx_init_of_phy(struct bgx *bgx) · line 998
Quoted 7 lines
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +7
-0+ phy_np =of_parse_phandle (node,"phy-handle" ,0 ); +/* If there is no phy or defective firmware presents +* this cortina phy, for which there is no driver +* support, ignore it. +*/ +if (phy_np && + !of_device_is_compatible (phy_np,"cortina,cs4223-slice" )) {Hi David
What is a cortina,cs4223-slice,
It is 1/4 of:
https://www.inphi.com/products/cs4223.php
Quoted 2 lines
and why does it need to be handled differently?
$ ls drivers/net/phy/*cortina* ls: cannot access drivers/net/phy/*cortina*: No such file or directory
Quoted 6 lines
For this configuration of
thunder_bgx.c, the use of a Linux PHY driver is optional.The firmware should probably not specify a PHY here, but it does so we ignore it so we don't wait around forever for the non-existent driver to bind.
Hi David
I don't see why it should wait around forever. I have boards with Marvell PHYs, yet if i don't build the Marvell driver, the Ethernet driver still loads, because the generic PHY driver is used instead. Why does this not work here?
Also, Documentation/devicetree/bindings/net/phy.txt says:
compatible: Compatible list, may contain
"ethernet-phy-ieee802.3-c22" or "ethernet-phy-ieee802.3-c45" for PHYs that implement IEEE802.3 clause 22 or IEEE802.3 clause 45 specifications. If neither of these are specified, the default is to assume clause 22.
If the phy's identifier is known then the list may contain an entry of the form: "ethernet-phy-idAAAA.BBBB" where
AAAA - The value of the 16 bit Phy Identifier 1 register as
4 hex digits. This is the chip vendor OUI bits 3:18
BBBB - The value of the 16 bit Phy Identifier 2 register as
4 hex digits. This is the chip vendor OUI bits 19:24, followed by 10 bits of a vendor specific ID.
The compatible list should not contain other values than those listed here.
So having "cortina,cs4223-slice" in the compatible string goes against the binding. To make this work, you probably need to extend the whitelist_phys list in of_mdio.c.
Andrew
Re: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
Quoted 31 lines · Andrew Lunn
Quoted 23 lines · David Daney
Quoted 11 lines · Andrew Lunn
drivers/net/ethernet/cavium/thunder/thunder_bgx.c static int bgx_init_of_phy(struct bgx *bgx) · line 998
Quoted 7 lines
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +7
-0+ phy_np =of_parse_phandle (node,"phy-handle" ,0 ); +/* If there is no phy or defective firmware presents +* this cortina phy, for which there is no driver +* support, ignore it. +*/ +if (phy_np && + !of_device_is_compatible (phy_np,"cortina,cs4223-slice" )) {Hi David
What is a cortina,cs4223-slice,
It is 1/4 of:
https://www.inphi.com/products/cs4223.php
Quoted 2 lines
and why does it need to be handled differently?
$ ls drivers/net/phy/*cortina* ls: cannot access drivers/net/phy/*cortina*: No such file or directoryQuoted 6 lines
For this configuration of
thunder_bgx.c, the use of a Linux PHY driver is optional.The firmware should probably not specify a PHY here, but it does so we ignore it so we don't wait around forever for the non-existent driver to bind.
Quoted 6 lines
Hi David
I don't see why it should wait around forever. I have boards with Marvell PHYs, yet if i don't build the Marvell driver, the Ethernet driver still loads, because the generic PHY driver is used instead. Why does this not work here?
As I said before, there is no driver for the device, so of_phy_find_device() will always return NULL.
It appears that the architects of the cs4223 were not familiar with the various IEEE specifications for PHYs, so unsurprisingly, the device cannot be handled by any standards compliant generic drivers.
The Marvell PHY architects, on the other hand, seem to have designed their devices with a keen eye for following the standards. So, also unsurprisingly, the Marvell devices work perfectly with the generic drivers.
Quoted 17 lines
Also,
Documentation/devicetree/bindings/net/phy.txtsays:compatible: Compatible list, may contain
"ethernet-phy-ieee802.3-c22" or "ethernet-phy-ieee802.3-c45" for PHYs that implement IEEE802.3 clause 22 or IEEE802.3 clause 45 specifications. If neither of these are specified, the default is to assume clause 22.If the phy's identifier is known then the list may contain an entry of the form: "ethernet-phy-idAAAA.BBBB" where
AAAA - The value of the 16 bit Phy Identifier 1 register as
4 hex digits. This is the chip vendor OUI bits 3:18
BBBB - The value of the 16 bit Phy Identifier 2 register as
4 hex digits. This is the chip vendor OUI bits 19:24, followed by 10 bits of a vendor specific ID.
Quoted 5 lines
The compatible list should not contain other values than those listed here.
So having "cortina,cs4223-slice" in the compatible string goes against the binding.
Yes, you are probably correct. That is why the comment in the patch explains the strategy of ignoring this node that is not complaint with the binding document.
Quoted 2 lines
To make this work, you probably need to extend the
whitelist_physlist inof_mdio.c.
That wouldn't work. There is no driver for the PHY, putting it on a white list doesn't solve the missing driver problem.
Andrew Lunn
maintainerRe: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
Quoted 7 lines
Quoted 4 lines
I don't see why it should wait around forever. I have boards with Marvell PHYs, yet if i don't build the Marvell driver, the Ethernet driver still loads, because the generic PHY driver is used instead. Why does this not work here?
As I said before, there is no driver for the device, so
of_phy_find_device()will always return NULL.
I'm not yet convinced this is true. I really do expect that the generic PHY driver will bind to it. It might then go horribly wrong, because it is not standard compliant, but that is a different issue.
The generic driver should probably have a black list for such devices. This is a PHY issue, not an MDIO issue, and the problem should be solved in the PHY layer, not in one MDIO driver.
We should also consider what happens when somebody actually writes a driver for this PHY. Are you not going to use it?
Before this patchset, you did not special case this compatible string. So at the very least, you need to split this into a separate patch, so the maintainers can ACK/NACK it, independent of the other change it is embedded in.
Andrew
Re: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
Quoted 9 lines · Andrew Lunn
Quoted 7 lines
Quoted 4 lines
I don't see why it should wait around forever. I have boards with Marvell PHYs, yet if i don't build the Marvell driver, the Ethernet driver still loads, because the generic PHY driver is used instead. Why does this not work here?
As I said before, there is no driver for the device, so
of_phy_find_device()will always return NULL.I'm not yet convinced this is true.
Which part don't you believe? Is it:
- there is no driver for the device.
or
- for PHYs with no driver, of_phy_find_device() will return NULL
Quoted 4 lines
I really do expect that the
generic PHY driver will bind to it. It might then go horribly wrong, because it is not standard compliant, but that is a different issue.
At a higher level, the way we handle either of:
- Lack of a driver.
- "Horribly wrong" driver
is the same, we cannot use a PHY driver.
Quoted 3 lines
The generic driver should probably have a black list for such devices. This is a PHY issue, not an MDIO issue, and the problem should be solved in the PHY layer, not in one MDIO driver.
This isn't an MDIO driver patch. This is more about handling a defective device tree in the only driver (a non-MDIO driver) that will ever see such a device tree node.
Quoted 3 lines
We should also consider what happens when somebody actually writes a
driver for this PHY. Are you not going to use it?
Easy to answer: We remove the "&& !of_device_is_compatible(phy_np, "cortina,cs4223-slice")" clause from this driver.
Quoted 6 lines
Before this patchset, you did not special case this compatible string. So at the very least, you need to split this into a separate patch, so the maintainers can ACK/NACK it, independent of the other change it is embedded in.
I can, and will, do that.
Thanks,
David Daney
Re: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
In reply to Andrew LunnQuoted 11 lines · Andrew Lunn
Quoted 7 lines
Quoted 4 lines
I don't see why it should wait around forever. I have boards with Marvell PHYs, yet if i don't build the Marvell driver, the Ethernet driver still loads, because the generic PHY driver is used instead. Why does this not work here?
As I said before, there is no driver for the device, so
of_phy_find_device()will always return NULL.I'm not yet convinced this is true. I really do expect that the generic PHY driver will bind to it. It might then go horribly wrong, because it is not standard compliant, but that is a different issue.
I concur with Andrew here, unless the PHY is guaranteed to return garbage when get_phy_id() is called, there is a good chance that the Generic PHY driver will be bound to this PHY device, or this is not happening for you for some reason?
Quoted 4 lines
The generic driver should probably have a black list for such devices. This is a PHY issue, not an MDIO issue, and the problem should be solved in the PHY layer, not in one MDIO driver.
I considered the possibility once of disabling the generic PHY driver, such that systems where the vendor-specific PHY driver is expected to be used could utilize that. That does not play well with the fixed PHYs using the generic PHY driver though, anyway, I am digressing.
Quoted 11 lines
We should also consider what happens when somebody actually writes a driver for this PHY. Are you not going to use it?
Before this patchset, you did not special case this compatible string. So at the very least, you need to split this into a separate patch, so the maintainers can ACK/NACK it, independent of the other change it is embedded in.
Andrew
Signature · 1 line
Florian
Re: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
Quoted 9 lines · Florian Fainelli
Quoted 8 lines · Andrew Lunn
Quoted 7 lines
Quoted 4 lines
I don't see why it should wait around forever. I have boards with Marvell PHYs, yet if i don't build the Marvell driver, the Ethernet driver still loads, because the generic PHY driver is used instead. Why does this not work here?
As I said before, there is no driver for the device, so
of_phy_find_device()will always return NULL.
Quoted 9 lines
Quoted 3 lines
I'm not yet convinced this is true. I really do expect that the generic PHY driver will bind to it. It might then go horribly wrong, because it is not standard compliant, but that is a different issue.
I concur with Andrew here, unless the PHY is guaranteed to return garbage when
get_phy_id()is called, there is a good chance that the Generic PHY driver will be bound to this PHY device, or this is not happening for you for some reason?
get_phy_id() is working a designed.
For this phy, we have:
compatible = "cortina,cs4223-slice";
Therefore get_phy_id() is being called with a is_c45 value of false.
get_phy_id() is returning a value of 0, which means that it succeeds, but the returned phy_id is 0xffffffff, which causes get_phy_device() to not create a phy_device, and no driver can be bound.
I know you are all skeptical, but I really think the best thing to do is not try to attach a phy driver when this compatible value is encountered.
It is a defective device tree, and I am attempting to handle it in the specific site where it can cause problems.
We are trying to distinguish between these two cases:
- of_phy_find_device() returns NULL because driver is not yet bound
- of_phy_find_device() returns NULL because "cortina,cs4223-slice"
I don't think we need to build some sort of frame work to handle things like this in a general way.
David Daney
Andrew Lunn
maintainerRe: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
Quoted 3 lines
For this phy, we have:
compatible = "cortina,cs4223-slice";
That actually means something else is happening, i think.
of_mdiobus_register() looks at the children, and decides if each child is a phy or an mdio device, by calling of_mdiobus_child_is_phy(). Since this compatible string is not in whitelist_phys[], it will return false. of_mdiobus_register() will then do a of_mdiobus_register_device(). This compatible means it is an MDIO device, not a PHY. So when you later call of_phy_find_device() it is always going to return NULL, because there is no PHY there, only an MDIO device.
How usable is the hardware without a PHY driver? Is a better solution that your write a very minimal PHY driver?
Andrew
Re: [PATCH 1/3] net: thunderx: Cleanup PHY probing code.
On 03/11/2016 01:35 PM, Andrew Lunn wrote:
[...]
Quoted 1 line
How usable is the hardware without a PHY driver?
The hardware has always in the past, still does, and probably always will work fine without a PHY driver. Link up/down are correctly handled.
Quoted 2 lines
Is a better solution
that your write a very minimal PHY driver?
No. Nothing would be gained.
All we are trying to do, is allow for loading of 1G PHY drivers via the -EPROBE_DEFER mechanism while continuing to allow the 10G and 40G ports to function without a PHY driver.
Specifically, we are *not* attempting to solve the problem of re-architecting the kernel phy_device infrastructure so that it would be possible to write a Cortina PHYs driver. Nor are we proposing that a Cortina PHY driver be written that would fit into the current infrastructure.
To this end, I still think the current patch takes the best approach.
Thanks,
David Daney