Introduce new APIs to support phylink and phy layers
Subsystems (5)
v2 cover Introduce new APIs to support phylink and phy layers
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()
First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting phy_node from a fwnode.
Changes in v2:
move phy code from base/property.c to net/phy/phy_device.c replace acpi & of code to get phy-handle with fwnode_find_reference replace of_ and acpi_ code with generic fwnode to get phy-handle.
Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introduce phylink_fwnode_phy_connect()
drivers/net/phy/phy_device.c | 83 ++++++++++++++++++++++++++++++------ drivers/net/phy/phylink.c | 68 +++++++++++++++++++++++++++++ include/linux/phy.h | 3 ++ include/linux/phylink.h | 6 +++ 4 files changed, 146 insertions(+), 14 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/3 device property: Introduce phy related fwnode functions
Define fwnode_phy_find_device() to iterate an mdiobus and find the phy device of the provided phy fwnode. Additionally define device_phy_find_device() to find phy device of provided device.
Define fwnode_get_phy_node() to get phy_node using named reference.
---
Changes in v2:
move phy code from base/property.c to net/phy/phy_device.c replace acpi & of code to get phy-handle with fwnode_find_reference
drivers/net/phy/phy_device.c | 55 ++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 3 ++ 2 files changed, 58 insertions(+)
drivers/net/phy/phy_device.c +55 -0
@@ -31,6 +31,7 @@#include <linux/mdio.h> #include <linux/io.h> #include <linux/uaccess.h> +#include <linux/property.h> MODULE_DESCRIPTION ("PHY library" );MODULE_AUTHOR ("Andy Fleming" );
@@ -2436,6 +2437,60 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv)return phydrv->config_intr && phydrv->ack_interrupt; } +/** +* fwnode_phy_find_device - Find phy_device on the mdiobus for the provided +* phy_fwnode. +* @phy_fwnode: Pointer to the phy's fwnode. +* +* If successful, returns a pointer to the phy_device with the embedded +* struct device refcount incremented by one, or NULL on failure. +*/ +struct phy_device *fwnode_phy_find_device (struct fwnode_handle *phy_fwnode) +{ +struct device *d; +struct mdio_device *mdiodev; + +if (!phy_fwnode) +return NULL ; + + d =bus_find_device_by_fwnode (&mdio_bus_type, phy_fwnode); +if (d) { + mdiodev =to_mdio_device (d); +if (mdiodev->flags &MDIO_DEVICE_FLAG_PHY ) +return to_phy_device (d); +put_device (d); + } + +return NULL ; +} +EXPORT_SYMBOL (fwnode_phy_find_device); + +/** +* device_phy_find_device - For the given device, get the phy_device +* @dev: Pointer to the given device +* +* If successful, returns a pointer to the phy_device with the embedded +* struct device refcount incremented by one, or NULL on failure. +*/ +struct phy_device *device_phy_find_device (struct device *dev) +{ +return fwnode_phy_find_device (dev_fwnode (dev)); +} +EXPORT_SYMBOL_GPL (device_phy_find_device); + +/** +* fwnode_get_phy_node - Get the phy_node using the named reference. +* @fwnode: Pointer to fwnode from which phy_node has to be obtained. +* +* Returns pointer to the phy fwnode, or ERR_PTR. Caller is responsible to +* call fwnode_handle_put() on the returned phy fwnode pointer. +*/ +struct fwnode_handle *fwnode_get_phy_node (struct fwnode_handle *fwnode) +{ +return fwnode_find_reference (fwnode,"phy-handle" ,0 ); +} +EXPORT_SYMBOL_GPL (fwnode_get_phy_node); +/** * phy_probe - probe and init a PHY device * @dev: device to probe and init
include/linux/phy.h +3 -0
@@ -1328,6 +1328,9 @@ void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);bool phy_validate_pause (struct phy_device *phydev,struct ethtool_pauseparam *pp);void phy_get_pause (struct phy_device *phydev,bool *tx_pause,bool *rx_pause); +struct phy_device *fwnode_phy_find_device (struct fwnode_handle *phy_fwnode); +struct phy_device *device_phy_find_device (struct device *dev); +struct fwnode_handle *fwnode_get_phy_node (struct fwnode_handle *fwnode);void phy_resolve_pause (unsigned long *local_adv,unsigned long *partner_adv,bool *tx_pause,bool *rx_pause);
Signature · 1 line
2.17.1
Russell King - ARM Linux admin
maintainerRe: [net-next PATCH v2 1/3] device property: Introduce phy related fwnode functions
Quoted 95 lines · Calvin Johnson
Define
fwnode_phy_find_device()to iterate an mdiobus and find the phy device of the provided phy fwnode. Additionally definedevice_phy_find_device()to find phy device of provided device.Define
fwnode_get_phy_node()to getphy_nodeusing named reference.Signed-off-by Calvin Johnson <[email protected]>---
Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencedrivers/net/phy/phy_device.c | 55 ++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 3 ++ 2 files changed, 58 insertions(+)drivers/net/phy/phy_device.c +55
-0@@ -31,6 +31,7 @@#include <linux/mdio.h> #include <linux/io.h> #include <linux/uaccess.h> +#include <linux/property.h> MODULE_DESCRIPTION ("PHY library" );MODULE_AUTHOR ("Andy Fleming" );@@ -2436,6 +2437,60 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv)return phydrv->config_intr && phydrv->ack_interrupt; } +/** +* fwnode_phy_find_device - Find phy_device on the mdiobus for the provided +* phy_fwnode. +* @phy_fwnode: Pointer to the phy's fwnode. +* +* If successful, returns a pointer to the phy_device with the embedded +* struct device refcount incremented by one, or NULL on failure. +*/ +struct phy_device *fwnode_phy_find_device (struct fwnode_handle *phy_fwnode) +{ +struct device *d; +struct mdio_device *mdiodev; + +if (!phy_fwnode) +return NULL ; + + d =bus_find_device_by_fwnode (&mdio_bus_type, phy_fwnode); +if (d) { + mdiodev =to_mdio_device (d); +if (mdiodev->flags &MDIO_DEVICE_FLAG_PHY ) +return to_phy_device (d); +put_device (d); + } + +return NULL ; +} +EXPORT_SYMBOL (fwnode_phy_find_device); + +/** +* device_phy_find_device - For the given device, get the phy_device +* @dev: Pointer to the given device +* +* If successful, returns a pointer to the phy_device with the embedded +* struct device refcount incremented by one, or NULL on failure. +*/ +struct phy_device *device_phy_find_device (struct device *dev) +{ +return fwnode_phy_find_device (dev_fwnode (dev)); +} +EXPORT_SYMBOL_GPL (device_phy_find_device); + +/** +* fwnode_get_phy_node - Get the phy_node using the named reference. +* @fwnode: Pointer to fwnode from which phy_node has to be obtained. +* +* Returns pointer to the phy fwnode, or ERR_PTR. Caller is responsible to +* call fwnode_handle_put() on the returned phy fwnode pointer. +*/ +struct fwnode_handle *fwnode_get_phy_node (struct fwnode_handle *fwnode) +{ +return fwnode_find_reference (fwnode,"phy-handle" ,0 ); +} +EXPORT_SYMBOL_GPL (fwnode_get_phy_node); +/** * phy_probe - probe and init a PHY device * @dev: device to probe and init include/linux/phy.h +0
-0
include/linux/phy.h void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx); · line 1336
Quoted 9 lines
include/linux/phy.h +3
-0@@ -1328,6 +1328,9 @@ void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);bool phy_validate_pause (struct phy_device *phydev,struct ethtool_pauseparam *pp);void phy_get_pause (struct phy_device *phydev,bool *tx_pause,bool *rx_pause); +struct phy_device *fwnode_phy_find_device (struct fwnode_handle *phy_fwnode); +struct phy_device *device_phy_find_device (struct device *dev); +struct fwnode_handle *fwnode_get_phy_node (struct fwnode_handle *fwnode);void phy_resolve_pause (unsigned long *local_adv,unsigned long *partner_adv,bool *tx_pause,bool *rx_pause);
I think you can find a better location in this file to places these function prototypes - putting them in the middle of a set of prototypes for pause-related functions looks like you printed the file out, and played "pin the tail on the donkey" to select somewhere to put them!
I think putting them near the get_phy_device() prototype would be sensible. Also, consider the case where CONFIG_PHYLIB is not set. Do we need stub implementations of these functions to avoid ifdefs in C code?
Thanks.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
Russell King - ARM Linux admin
maintainerRe: [net-next PATCH v2 1/3] device property: Introduce phy related fwnode functions
In reply to Calvin JohnsonQuoted 6 lines · Calvin Johnson
+/**
+ *device_phy_find_device- For the given device, get thephy_device
+ * @dev: Pointer to the given device
+ *
+ * If successful, returns a pointer to thephy_devicewith the embedded
+ * struct device refcount incremented by one, or NULL on failure.
It probably makes sense to refer the reader to the return conditions for fwnode_phy_find_device() so that should fwnode_phy_find_device() be updated, there's no need to modify multiple locations.
drivers/net/phy/phy_device.c static bool phy_drv_supports_irq(struct phy_driver *phydrv) · line 2486
Quoted 13 lines
+ */
drivers/net/phy/phy_device.c +12
-0+struct phy_device *device_phy_find_device (struct device *dev) +{ +return fwnode_phy_find_device (dev_fwnode (dev)); +} +EXPORT_SYMBOL_GPL (device_phy_find_device); + +/** +* fwnode_get_phy_node - Get the phy_node using the named reference. +* @fwnode: Pointer to fwnode from which phy_node has to be obtained. +* +* Returns pointer to the phy fwnode, or ERR_PTR. Caller is responsible to +* call fwnode_handle_put() on the returned phy fwnode pointer.
This one even more so - fwnode_find_reference() is in an entirely separate file, so the comment could well be missed.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
PATCH v2 2/3 net: phy: alphabetically sort header includes
In reply to Calvin JohnsonHeader includes are not sorted. Alphabetically sort them.
---
Changes in v2: None
drivers/net/phy/phy_device.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/net/phy/phy_device.c +15 -15
@@ -9,29 +9,29 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/kernel.h> -#include <linux/string.h> -#include <linux/errno.h> -#include <linux/unistd.h> -#include <linux/slab.h> -#include <linux/interrupt.h> -#include <linux/init.h> +#include <linux/bitmap.h> #include <linux/delay.h> -#include <linux/netdevice.h> +#include <linux/errno.h> #include <linux/etherdevice.h> -#include <linux/skbuff.h> +#include <linux/ethtool.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/mdio.h> +#include <linux/mii.h> #include <linux/mm.h> #include <linux/module.h> -#include <linux/mii.h> -#include <linux/ethtool.h> -#include <linux/bitmap.h> +#include <linux/netdevice.h> #include <linux/phy.h> #include <linux/phy_led_triggers.h> +#include <linux/property.h> #include <linux/sfp.h> -#include <linux/mdio.h> -#include <linux/io.h> +#include <linux/skbuff.h> +#include <linux/slab.h> +#include <linux/string.h> #include <linux/uaccess.h> -#include <linux/property.h> +#include <linux/unistd.h> MODULE_DESCRIPTION ("PHY library" );MODULE_AUTHOR ("Andy Fleming" );
Signature · 1 line
2.17.1
PATCH v2 3/3 phylink: Introduce phylink_fwnode_phy_connect()
In reply to Calvin JohnsonDefine phylink_fwnode_phy_connect() to connect phy specified by a fwnode to a phylink instance. Additionally, phylink_device_phy_connect() is defined to connect phy specified by a device to a phylink instance.
---
Changes in v2:
replace of_ and acpi_ code with generic fwnode to get phy-handle.
drivers/net/phy/phylink.c | 68 +++++++++++++++++++++++++++++++++++++++ include/linux/phylink.h | 6 ++++ 2 files changed, 74 insertions(+)
drivers/net/phy/phylink.c +68 -0
@@ -961,6 +961,74 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) }EXPORT_SYMBOL_GPL (phylink_connect_phy); +/** +* phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode. +* @pl: a pointer to a &struct phylink returned from phylink_create() +* @fwnode: a pointer to a &struct fwnode_handle. +* @flags: PHY-specific flags to communicate to the PHY device driver +* +* Connect the phy specified @fwnode to the phylink instance specified +* by @pl. Actions specified in phylink_connect_phy() will be +* performed. +* +* Returns 0 on success or a negative errno. +*/ +int phylink_fwnode_phy_connect (struct phylink *pl, +struct fwnode_handle *fwnode, +u32 flags) +{ +struct fwnode_handle *phy_fwnode; +struct phy_device *phy_dev; +int ret =0 ; + +/* Fixed links and 802.3z are handled without needing a PHY */ +if (pl->cfg_link_an_mode ==MLO_AN_FIXED || + (pl->cfg_link_an_mode ==MLO_AN_INBAND && +phy_interface_mode_is_8023z (pl->link_interface))) +return 0 ; + + phy_fwnode =fwnode_get_phy_node (fwnode); +if ((IS_ERR_OR_NULL (phy_fwnode)) && (pl->cfg_link_an_mode ==MLO_AN_PHY )) +return -ENODEV ; + + phy_dev =fwnode_phy_find_device (phy_fwnode); +fwnode_handle_put (phy_fwnode); +if (!phy_dev) +return -ENODEV ; + + ret =phy_attach_direct (pl->netdev, phy_dev, flags, + pl->link_interface); +if (ret) +return ret; + + ret =phylink_bringup_phy (pl, phy_dev, pl->link_config.interface); +if (ret) +phy_detach (phy_dev); + +return ret; +} +EXPORT_SYMBOL_GPL (phylink_fwnode_phy_connect); + +/** +* phylink_device_phy_connect() - connect the PHY specified by the device. +* @pl: a pointer to a &struct phylink returned from phylink_create() +* @dev: a pointer to a &struct device. +* @flags: PHY-specific flags to communicate to the PHY device driver +* +* Connect the phy specified by the device to the phylink instance specified +* by @pl. Actions specified in phylink_connect_phy() will be +* performed. +* +* Returns 0 on success or a negative errno. +*/ +int phylink_device_phy_connect (struct phylink *pl, +struct device *dev, +u32 flags) +{ +return phylink_fwnode_phy_connect (pl,dev_fwnode (dev), flags); +} +EXPORT_SYMBOL_GPL (phylink_device_phy_connect); +/** * phylink_of_phy_connect() - connect the PHY specified in the DT mode. * @pl: a pointer to a &struct phylink returned from phylink_create()
include/linux/phylink.h +6 -0
@@ -367,6 +367,12 @@ void phylink_add_pcs(struct phylink *, const struct phylink_pcs_ops *ops);void phylink_destroy (struct phylink *);int phylink_connect_phy (struct phylink *,struct phy_device *); +int phylink_fwnode_phy_connect (struct phylink *pl, +struct fwnode_handle *fwnode, +u32 flags); +int phylink_device_phy_connect (struct phylink *pl, +struct device *dev, +u32 flags);int phylink_of_phy_connect (struct phylink *,struct device_node *,u32 flags);void phylink_disconnect_phy (struct phylink *);
Signature · 1 line
2.17.1
Russell King - ARM Linux admin
maintainerRe: [net-next PATCH v2 3/3] phylink: Introduce phylink_fwnode_phy_connect()
Quoted 41 lines · Calvin Johnson
Define
phylink_fwnode_phy_connect()to connect phy specified by a fwnode to a phylink instance. Additionally,phylink_device_phy_connect()is defined to connect phy specified by a device to a phylink instance.Signed-off-by Calvin Johnson <[email protected]>---
Changes in v2:
replaceof_andacpi_code with generic fwnode to get phy-handle.drivers/net/phy/phylink.c | 68 +++++++++++++++++++++++++++++++++++++++ include/linux/phylink.h | 6 ++++ 2 files changed, 74 insertions(+)drivers/net/phy/phylink.c +18
-0@@ -961,6 +961,74 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) }EXPORT_SYMBOL_GPL (phylink_connect_phy); +/** +* phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode. +* @pl: a pointer to a &struct phylink returned from phylink_create() +* @fwnode: a pointer to a &struct fwnode_handle. +* @flags: PHY-specific flags to communicate to the PHY device driver +* +* Connect the phy specified @fwnode to the phylink instance specified +* by @pl. Actions specified in phylink_connect_phy() will be +* performed. +* +* Returns 0 on success or a negative errno. +*/ +int phylink_fwnode_phy_connect (struct phylink *pl, +struct fwnode_handle *fwnode, +u32 flags) +{ +struct fwnode_handle *phy_fwnode; +struct phy_device *phy_dev;
drivers/net/phy/phylink.c int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) · line 991
Quoted 10 lines
drivers/net/phy/phylink.c +10
-0+int ret =0 ; + +/* Fixed links and 802.3z are handled without needing a PHY */ +if (pl->cfg_link_an_mode ==MLO_AN_FIXED || + (pl->cfg_link_an_mode ==MLO_AN_INBAND && +phy_interface_mode_is_8023z (pl->link_interface))) +return 0 ; + + phy_fwnode =fwnode_get_phy_node (fwnode); +if ((IS_ERR_OR_NULL (phy_fwnode)) && (pl->cfg_link_an_mode ==MLO_AN_PHY ))
According to your documentation for fwnode_get_phy_node(), it can't return NULL. So, use of IS_ERR_OR_NULL() is incorrect here. Please also eliminate the unnecessary parens to match the style in the rest of this file.
drivers/net/phy/phylink.c int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) · line 992
Quoted 1 line
drivers/net/phy/phylink.c +1
-0+return -ENODEV ;
If fwnode_get_phy_node() returns an error pointer, shouldn't you be propagating that error here?
Quoted 28 lines
drivers/net/phy/phylink.c +28
-0+ + phy_dev =fwnode_phy_find_device (phy_fwnode); +fwnode_handle_put (phy_fwnode); +if (!phy_dev) +return -ENODEV ; + + ret =phy_attach_direct (pl->netdev, phy_dev, flags, + pl->link_interface); +if (ret) +return ret; + + ret =phylink_bringup_phy (pl, phy_dev, pl->link_config.interface); +if (ret) +phy_detach (phy_dev); + +return ret; +} +EXPORT_SYMBOL_GPL (phylink_fwnode_phy_connect); + +/** +* phylink_device_phy_connect() - connect the PHY specified by the device. +* @pl: a pointer to a &struct phylink returned from phylink_create() +* @dev: a pointer to a &struct device. +* @flags: PHY-specific flags to communicate to the PHY device driver +* +* Connect the phy specified by the device to the phylink instance specified +* by @pl. Actions specified in phylink_connect_phy() will be +* performed.
drivers/net/phy/phylink.c int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) · line 1030
Quoted 10 lines
drivers/net/phy/phylink.c +10
-0+* +* Returns 0 on success or a negative errno. +*/ +int phylink_device_phy_connect (struct phylink *pl, +struct device *dev, +u32 flags) +{ +return phylink_fwnode_phy_connect (pl,dev_fwnode (dev), flags); +} +EXPORT_SYMBOL_GPL (phylink_device_phy_connect);
If this has any users, I think this should be an inline function in phylink.h - it's just a helper after all. If it doesn't then it should just be dropped.
Thanks.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
Russell King - ARM Linux admin
maintainerQuoted 16 lines · Calvin Johnson
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting
phy_nodefrom a fwnode.Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencereplaceof_andacpi_code with generic fwnode to get phy-handle.
Quoted 4 lines
Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introducephylink_fwnode_phy_connect()
Thanks for this, but there's more work that needs to be done here. I also think that we must have an ack from ACPI people before this can be accepted - you are in effect proposing a new way for representing PHYs in ACPI.
Quoted 11 lines
drivers/net/phy/phy_device.c | 83 ++++++++++++++++++++++++++++++------ drivers/net/phy/phylink.c | 68 +++++++++++++++++++++++++++++ include/linux/phy.h | 3 ++ include/linux/phylink.h | 6 +++ 4 files changed, 146 insertions(+), 14 deletions(-)Signature · 1 line
2.17.1
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
Quoted 22 lines · Russell King - ARM Linux admin
Quoted 16 lines · Calvin Johnson
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting
phy_nodefrom a fwnode.Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencereplaceof_andacpi_code with generic fwnode to get phy-handle.Quoted 4 lines
Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introducephylink_fwnode_phy_connect()
Quoted 4 lines
Thanks for this, but there's more work that needs to be done here. I also think that we must have an ack from ACPI people before this can be accepted - you are in effect proposing a new way for representing PHYs in ACPI.
Thanks for your review.
Agree that we need an ack from ACPI people.
However, I don't think it is a completely new way as similar acpi approach to get phy-handle is already in place.
Please see this:
https://elixir.bootlin.com/linux/v5.7-rc3/source/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c#L832
Please let me know, if you see more work than the ones you pointed out in your review comments on previous patches.
Thanks
Calvin
Quoted 28 lines · Calvin Johnson
Quoted 22 lines · Russell King - ARM Linux admin
Quoted 16 lines · Calvin Johnson
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting
phy_nodefrom a fwnode.Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencereplaceof_andacpi_code with generic fwnode to get phy-handle.Quoted 4 lines
Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introducephylink_fwnode_phy_connect()Quoted 4 lines
Thanks for this, but there's more work that needs to be done here. I also think that we must have an ack from ACPI people before this can be accepted - you are in effect proposing a new way for representing PHYs in ACPI.
Quoted 7 lines
Thanks for your review.
Agree that we need an ack from ACPI people.
However, I don't think it is a completely new way as similar acpi approach to get phy-handle is already in place.
Please see this:
https://elixir.bootlin.com/linux/v5.7-rc3/source/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c#L832
That was added by:
commit 8089a96f601bdfe3e1b41d14bb703aafaf1b8f34
Author: Iyappan Subramanian <[email protected]> Date: Mon Jul 25 17:12:41 2016 -0700
drivers: net: xgene: Add backward compatibility
This patch adds xgene_enet_check_phy_hanlde() function that checks whether MDIO driver is probed successfully and sets pdata->mdio_driver to true. If MDIO driver is not probed, ethernet driver falls back to backward compatibility mode.
Since enum xgene_enet_cmd is used by MDIO driver, removing this from ethernet driver.
The commit message says nothing about adding ACPI stuff, and searching the 'net for the posting of this patch seems to suggest that it wasn't obviously copied to any ACPI people:
https://lists.openwall.net/netdev/2016/07/26/11
Annoyingly, searching for:
"drivers: net: xgene: Add backward compatibility" site:lore.kernel.org
doesn't find it on lore, so can't get the full headers and therefore addresses.
So, yes, there's another driver using it, but the ACPI folk probably never got a look-in on that instance. Even if they had been copied, the patch description is probably sufficiently poor that they wouldn't have read the patch.
I'd say there's questions over whether ACPI people will find this an acceptable approach.
Given that your patch moves this from one driver to a subsystem thing, it needs to be ratified by ACPI people, because it's effectively becoming a standardised way to represent a PHY in ACPI.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
Quoted 76 lines · Russell King - ARM Linux admin
Quoted 28 lines · Calvin Johnson
Quoted 22 lines · Russell King - ARM Linux admin
Quoted 16 lines · Calvin Johnson
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting
phy_nodefrom a fwnode.Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencereplaceof_andacpi_code with generic fwnode to get phy-handle.Quoted 4 lines
Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introducephylink_fwnode_phy_connect()Quoted 4 lines
Thanks for this, but there's more work that needs to be done here. I also think that we must have an ack from ACPI people before this can be accepted - you are in effect proposing a new way for representing PHYs in ACPI.
Quoted 7 lines
Thanks for your review.
Agree that we need an ack from ACPI people.
However, I don't think it is a completely new way as similar acpi approach to get phy-handle is already in place.
Please see this:
https://elixir.bootlin.com/linux/v5.7-rc3/source/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c#L832That was added by:
commit
8089a96f601bdfe3e1b41d14bb703aafaf1b8f34Author: Iyappan Subramanian <[email protected]> Date: Mon Jul 25 17:12:41 2016 -0700drivers: net: xgene: Add backward compatibility
This patch adds
xgene_enet_check_phy_hanlde()function that checks whether MDIO driver is probed successfully and setspdata->mdio_driverto true. If MDIO driver is not probed, ethernet driver falls back to backward compatibility mode.Since enum
xgene_enet_cmdis used by MDIO driver, removing this from ethernet driver.Signed-off-by Iyappan Subramanian <[email protected]>Tested-by Fushen Chen <[email protected]>Tested-by Toan Le <[email protected]>Signed-off-by David S. Miller <[email protected]>The commit message says nothing about adding ACPI stuff, and searching the 'net for the posting of this patch seems to suggest that it wasn't obviously copied to any ACPI people:
https://lists.openwall.net/netdev/2016/07/26/11Annoyingly, searching for:
"drivers: net: xgene: Add backward compatibility" site:lore.kernel.org
doesn't find it on lore, so can't get the full headers and therefore addresses.
So, yes, there's another driver using it, but the ACPI folk probably never got a look-in on that instance. Even if they had been copied, the patch description is probably sufficiently poor that they wouldn't have read the patch.
Quoted 7 lines
I'd say there's questions over whether ACPI people will find this an acceptable approach.
Given that your patch moves this from one driver to a subsystem thing, it needs to be ratified by ACPI people, because it's effectively becoming a standardised way to represent a PHY in ACPI.
Thanks for digging deep. Makes sense to me.
Will wait for ACPI response.
Regards
Calvin
Quoted 76 lines · Russell King - ARM Linux admin
Quoted 28 lines · Calvin Johnson
Quoted 22 lines · Russell King - ARM Linux admin
Quoted 16 lines · Calvin Johnson
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting
phy_nodefrom a fwnode.Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencereplaceof_andacpi_code with generic fwnode to get phy-handle.Quoted 4 lines
Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introducephylink_fwnode_phy_connect()Quoted 4 lines
Thanks for this, but there's more work that needs to be done here. I also think that we must have an ack from ACPI people before this can be accepted - you are in effect proposing a new way for representing PHYs in ACPI.
Quoted 7 lines
Thanks for your review.
Agree that we need an ack from ACPI people.
However, I don't think it is a completely new way as similar acpi approach to get phy-handle is already in place.
Please see this:
https://elixir.bootlin.com/linux/v5.7-rc3/source/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c#L832That was added by:
commit
8089a96f601bdfe3e1b41d14bb703aafaf1b8f34Author: Iyappan Subramanian <[email protected]> Date: Mon Jul 25 17:12:41 2016 -0700drivers: net: xgene: Add backward compatibility
This patch adds
xgene_enet_check_phy_hanlde()function that checks whether MDIO driver is probed successfully and setspdata->mdio_driverto true. If MDIO driver is not probed, ethernet driver falls back to backward compatibility mode.Since enum
xgene_enet_cmdis used by MDIO driver, removing this from ethernet driver.Signed-off-by Iyappan Subramanian <[email protected]>Tested-by Fushen Chen <[email protected]>Tested-by Toan Le <[email protected]>Signed-off-by David S. Miller <[email protected]>The commit message says nothing about adding ACPI stuff, and searching the 'net for the posting of this patch seems to suggest that it wasn't obviously copied to any ACPI people:
https://lists.openwall.net/netdev/2016/07/26/11Annoyingly, searching for:
"drivers: net: xgene: Add backward compatibility" site:lore.kernel.org
doesn't find it on lore, so can't get the full headers and therefore addresses.
So, yes, there's another driver using it, but the ACPI folk probably never got a look-in on that instance. Even if they had been copied, the patch description is probably sufficiently poor that they wouldn't have read the patch.
Quoted 6 lines
I'd say there's questions over whether ACPI people will find this an acceptable approach.
Given that your patch moves this from one driver to a subsystem thing, it needs to be ratified by ACPI people, because it's effectively becoming a standardised way to represent a PHY in ACPI.
How can we get attention/response from ACPI people? I've now added ACPI maintainers in the To list.
Thanks
Calvin
Rafael J. Wysocki
maintainerQuoted 78 lines · Calvin Johnson
Quoted 76 lines · Russell King - ARM Linux admin
Quoted 28 lines · Calvin Johnson
Quoted 22 lines · Russell King - ARM Linux admin
Quoted 16 lines · Calvin Johnson
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting
phy_nodefrom a fwnode.Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencereplaceof_andacpi_code with generic fwnode to get phy-handle.Quoted 4 lines
Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introducephylink_fwnode_phy_connect()Quoted 4 lines
Thanks for this, but there's more work that needs to be done here. I also think that we must have an ack from ACPI people before this can be accepted - you are in effect proposing a new way for representing PHYs in ACPI.
Quoted 7 lines
Thanks for your review.
Agree that we need an ack from ACPI people.
However, I don't think it is a completely new way as similar acpi approach to get phy-handle is already in place.
Please see this:
https://elixir.bootlin.com/linux/v5.7-rc3/source/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c#L832That was added by:
commit
8089a96f601bdfe3e1b41d14bb703aafaf1b8f34Author: Iyappan Subramanian <[email protected]> Date: Mon Jul 25 17:12:41 2016 -0700drivers: net: xgene: Add backward compatibility
This patch adds
xgene_enet_check_phy_hanlde()function that checks whether MDIO driver is probed successfully and setspdata->mdio_driverto true. If MDIO driver is not probed, ethernet driver falls back to backward compatibility mode.Since enum
xgene_enet_cmdis used by MDIO driver, removing this from ethernet driver.Signed-off-by Iyappan Subramanian <[email protected]>Tested-by Fushen Chen <[email protected]>Tested-by Toan Le <[email protected]>Signed-off-by David S. Miller <[email protected]>The commit message says nothing about adding ACPI stuff, and searching the 'net for the posting of this patch seems to suggest that it wasn't obviously copied to any ACPI people:
https://lists.openwall.net/netdev/2016/07/26/11Annoyingly, searching for:
"drivers: net: xgene: Add backward compatibility" site:lore.kernel.org
doesn't find it on lore, so can't get the full headers and therefore addresses.
So, yes, there's another driver using it, but the ACPI folk probably never got a look-in on that instance. Even if they had been copied, the patch description is probably sufficiently poor that they wouldn't have read the patch.
Quoted 8 lines
Quoted 6 lines
I'd say there's questions over whether ACPI people will find this an acceptable approach.
Given that your patch moves this from one driver to a subsystem thing, it needs to be ratified by ACPI people, because it's effectively becoming a standardised way to represent a PHY in ACPI.
How can we get attention/response from ACPI people?
This is in my queue, but the processing of this has been slow for a while, sorry about that.
If you have a new version of the series, please submit it, otherwise ping me in a couple of days if I don't respond to the patches in the meantime.
Thanks!
Hi Rafael,
Quoted 3 lines · Rafael J. Wysocki
Quoted 1 line · Calvin Johnson
<snip>
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
So, yes, there's another driver using it, but the ACPI folk probably never got a look-in on that instance. Even if they had been copied, the patch description is probably sufficiently poor that they wouldn't have read the patch.
I'd say there's questions over whether ACPI people will find this an acceptable approach.
Given that your patch moves this from one driver to a subsystem thing, it needs to be ratified by ACPI people, because it's effectively becoming a standardised way to represent a PHY in ACPI.
Quoted 8 lines
Quoted 1 line
How can we get attention/response from ACPI people?
This is in my queue, but the processing of this has been slow for a while, sorry about that.
If you have a new version of the series, please submit it, otherwise ping me in a couple of days if I don't respond to the patches in the meantime.
I've posted v3 of the patchset. Can you please review?
Thanks
Calvin
On Mon, Apr 27, 2020 at 06:54:06PM +0530, Calvin Johnson wrote:
Hi Russell, others,
Quoted 21 lines
Following functions are defined:
phylink_fwnode_phy_connect()
phylink_device_phy_connect()
fwnode_phy_find_device()
device_phy_find_device()
fwnode_get_phy_node()First two help in connecting phy to phylink instance. Next two help in finding a phy on a mdiobus. Last one helps in getting
phy_nodefrom a fwnode.Changes in v2:
move phy code frombase/property.ctonet/phy/phy_device.creplace acpi & of code to get phy-handle withfwnode_find_referencereplaceof_andacpi_code with generic fwnode to get phy-handle.Calvin Johnson (3):
device property: Introduce phy related fwnode functions
net: phy: alphabetically sort header includes
phylink: Introducephylink_fwnode_phy_connect()
Quoted 5 lines
drivers/net/phy/phy_device.c | 83 ++++++++++++++++++++++++++++++------ drivers/net/phy/phylink.c | 68 +++++++++++++++++++++++++++++ include/linux/phy.h | 3 ++ include/linux/phylink.h | 6 +++ 4 files changed, 146 insertions(+), 14 deletions(-)
I've a new patch introducing fwnode_mdiobus_register_phy and fwnode_get_phy_id. Can I introduce it in v3 of this patchset or do I need to send it separately? Please advice.
Thanks
Calvin