dt-bindings: net: cpsw: Document cpsw-phy-sel usage but prefer phandle
PATCH 1/2 dt-bindings: net: cpsw: Document cpsw-phy-sel usage but prefer phandle
The current cpsw usage for cpsw-phy-sel is undocumented but is used for all the boards using cpsw. And cpsw-phy-sel is not really a child of the cpsw device, it lives in the system control module instead.
Let's document the existing usage, and improve it a bit where we prefer to use a phandle instead of a child device for it. That way we can properly describe the hardware in dts files for things like genpd.
--- Documentation/devicetree/bindings/net/cpsw.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/cpsw.txt +6 -0
@@ -19,6 +19,10 @@ Required properties: - slaves : Specifies number for slaves - active_slave : Specifies the slave to use for time stamping, ethtool and SIOCGMIIPHY +- cpsw-phy-sel : Specifies the phandle to the CPSW phy mode selection + device. See also cpsw-phy-sel.txt for it's binding. + Note that in legacy cases cpsw-phy-sel may be + a child device instead of a phandle. Optional properties: - ti,hwmods : Must be "cpgmac0"
@@ -75,6 +79,7 @@ Examples: cpts_clock_mult = <0x80000000>; cpts_clock_shift = <29>; syscon = <&cm>; + cpsw-phy-sel = <&phy_sel>; cpsw_emac0: slave@0 { phy_id = <&davinci_mdio>, <0>; phy-mode = "rgmii-txid";
@@ -103,6 +108,7 @@ Examples: cpts_clock_mult = <0x80000000>; cpts_clock_shift = <29>; syscon = <&cm>; + cpsw-phy-sel = <&phy_sel>; cpsw_emac0: slave@0 { phy_id = <&davinci_mdio>, <0>; phy-mode = "rgmii-txid";
Signature · 1 line
2.18.0
PATCH 2/2 net: ethernet: cpsw-phy-sel: prefer phandle for phy sel
The cpsw-phy-sel device is not a child of the cpsw interconnect target module. It lives in the system control module.
Let's fix this issue by trying to use cpsw-phy-sel phandle first if it exists and if not fall back to current usage of trying to find the cpsw-phy-sel child. That way the phy sel driver can be a child of the system control module where it belongs in the device tree.
Without this fix, we cannot have a proper interconnect target module hierarchy in device tree for things like genpd.
Note that deferred probe is mostly not supported by cpsw and this patch does not attempt to fix that. In case deferred probe support is needed, this could be added to cpsw_slave_open() and phy_connect() so they start handling and returning errors.
For documenting it, looks like the cpsw-phy-sel is used for all cpsw device tree nodes. It's missing the related binding documentation, so let's also update the binding documentation accordingly.
--- drivers/net/ethernet/ti/cpsw-phy-sel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/ti/cpsw-phy-sel.c +6 -3
@@ -170,10 +170,13 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)struct device_node *node;struct cpsw_phy_sel_priv *priv; - node =of_get_child_by_name (dev->of_node,"cpsw-phy-sel" ); + node =of_parse_phandle (dev->of_node,"cpsw-phy-sel" ,0 );if (!node) { -dev_err (dev,"Phy mode driver DT not found\n" ); -return ; + node =of_get_child_by_name (dev->of_node,"cpsw-phy-sel" ); +if (!node) { +dev_err (dev,"Phy mode driver DT not found\n" ); +return ; + } } dev =bus_find_device (&platform_bus_type,NULL , node, match);
Signature · 1 line
2.18.0
Re: [PATCH 2/2] net: ethernet: cpsw-phy-sel: prefer phandle for phy sel
From: Tony Lindgren <[email protected]>
Date: Wed, 29 Aug 2018 08:00:24 -0700
Quoted 16 lines
The cpsw-phy-sel device is not a child of the cpsw interconnect target module. It lives in the system control module.
Let's fix this issue by trying to use cpsw-phy-sel phandle first if it exists and if not fall back to current usage of trying to find the cpsw-phy-sel child. That way the phy sel driver can be a child of the system control module where it belongs in the device tree.
Without this fix, we cannot have a proper interconnect target module hierarchy in device tree for things like genpd.
Note that deferred probe is mostly not supported by cpsw and this patch does not attempt to fix that. In case deferred probe support is needed, this could be added to
cpsw_slave_open()andphy_connect()so they start handling and returning errors.
Quoted 5 lines
For documenting it, looks like the cpsw-phy-sel is used for all cpsw device tree nodes. It's missing the related binding documentation, so let's also update the binding documentation accordingly.
Signed-off-by Tony Lindgren <[email protected]>
Applied.
Hi Tony,
Quoted 7 lines · Tony Lindgren
The current cpsw usage for cpsw-phy-sel is undocumented but is used for all the boards using cpsw. And cpsw-phy-sel is not really a child of the cpsw device, it lives in the system control module instead.
Let's document the existing usage, and improve it a bit where we prefer to use a phandle instead of a child device for it. That way we can properly describe the hardware in dts files for things like genpd.
I'm ok with this series, but I really don't like cpsw-phy-sel in general.
It was introduced long time back and now I'm thinking about possibility to replace it with one of current generic interfaces - for example mux-controller.
Each port will control up to 3 muxes (port mode, idmode and rmii_ext_clk) and transform phy-mode => mux states.
What do you think?
Another option is to use phy, but it'd be complicated.
Quoted 44 lines
Cc Andrew Lunn <[email protected]>Cc Grygorii Strashko <[email protected]>Cc Ivan Khoronzhuk <[email protected]>Cc Mark Rutland <[email protected]>Cc Murali Karicheri <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- Documentation/devicetree/bindings/net/cpsw.txt | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/net/cpsw.txt +6
-0@@ -19,6 +19,10 @@ Required properties: - slaves : Specifies number for slaves - active_slave : Specifies the slave to use for time stamping, ethtool and SIOCGMIIPHY +- cpsw-phy-sel : Specifies the phandle to the CPSW phy mode selection + device. See also cpsw-phy-sel.txt for it's binding. + Note that in legacy cases cpsw-phy-sel may be + a child device instead of a phandle. Optional properties: - ti,hwmods : Must be "cpgmac0"@@ -75,6 +79,7 @@ Examples: cpts_clock_mult = <0x80000000>; cpts_clock_shift = <29>; syscon = <&cm>; + cpsw-phy-sel = <&phy_sel>; cpsw_emac0: slave@0 { phy_id = <&davinci_mdio>, <0>; phy-mode = "rgmii-txid";@@ -103,6 +108,7 @@ Examples: cpts_clock_mult = <0x80000000>; cpts_clock_shift = <29>; syscon = <&cm>; + cpsw-phy-sel = <&phy_sel>; cpsw_emac0: slave@0 { phy_id = <&davinci_mdio>, <0>; phy-mode = "rgmii-txid";
Signature · 2 lines
regards, -grygorii
Quoted 7 lines · Grygorii Strashko
Hi Tony,
Quoted 4 lines · Tony Lindgren
The current cpsw usage for cpsw-phy-sel is undocumented but is used for all the boards using cpsw. And cpsw-phy-sel is not really a child of the cpsw device, it lives in the system control module instead.
Quoted 5 lines
Quoted 3 lines
Let's document the existing usage, and improve it a bit where we prefer to use a phandle instead of a child device for it. That way we can properly describe the hardware in dts files for things like genpd.
I'm ok with this series, but I really don't like cpsw-phy-sel in general.
Yeah this binding predates any standards. This series only fixes the nasty issue of cpsw claiming a module as a child that's outside it's IO range.
Quoted 5 lines
It was introduced long time back and now I'm thinking about possibility to replace it with one of current generic interfaces - for example mux-controller.
Each port will control up to 3 muxes (port mode, idmode andrmii_ext_clk) and transform phy-mode => mux states.
What do you think?
Sure a mux-controller here makes sense.
Quoted 1 line
Another option is to use phy, but it'd be complicated.
For the port muxes, how about a phy driver just using a pinctrl driver?
In general, it seems cpsw is just an interconnect instance (L4_FAST) with a control module (CPSW_WR) and a pile of independent other modules. That's described nicely in am437x TRM chapter "2.1.4 L4 Fast Peripheral Memory Map". So from that point of view the binding reg entries right now are all wrong :)
In the long run cpsw should be really treated as an interconnect instance with it's control module providing standard Linux framework services such as clock / regulator / phy / pinctrl / iio whatever for the other modules.
Just my 2c based on looking at the interconnect, I'm not too familiar with cpsw otherwise.
Regards,
Tony
Quoted 5 lines
In the long run cpsw should be really treated as an interconnect instance with it's control module providing standard Linux framework services such as clock / regulator / phy / pinctrl / iio whatever for the other modules.
Some of us have been applying pressure for a new driver. This sounds like another argument for such a re-write.
Andrew
Quoted 31 lines · Tony Lindgren
Quoted 7 lines · Grygorii Strashko
Hi Tony,
Quoted 4 lines · Tony Lindgren
The current cpsw usage for cpsw-phy-sel is undocumented but is used for all the boards using cpsw. And cpsw-phy-sel is not really a child of the cpsw device, it lives in the system control module instead.
Quoted 5 lines
Quoted 3 lines
Let's document the existing usage, and improve it a bit where we prefer to use a phandle instead of a child device for it. That way we can properly describe the hardware in dts files for things like genpd.
I'm ok with this series, but I really don't like cpsw-phy-sel in general.
Yeah this binding predates any standards. This series only fixes the nasty issue of cpsw claiming a module as a child that's outside it's IO range.
Quoted 5 lines
It was introduced long time back and now I'm thinking about possibility to replace it with one of current generic interfaces - for example mux-controller.
Each port will control up to 3 muxes (port mode, idmode andrmii_ext_clk) and transform phy-mode => mux states.
What do you think?Sure a mux-controller here makes sense.
Quoted 1 line
Another option is to use phy, but it'd be complicated.
For the port muxes, how about a phy driver just using a pinctrl driver?
Quoted 6 lines
In general, it seems cpsw is just an interconnect instance (
L4_FAST) with a control module (CPSW_WR) and a pile of independent other modules. That's described nicely in am437x TRM chapter "2.1.4 L4 Fast Peripheral Memory Map". So from that point of view the binding reg entries right now are all wrong :)
TRM not consistent - for am5 it's one MMIO region.
Quoted 9 lines
In the long run cpsw should be really treated as an interconnect instance with it's control module providing standard Linux framework services such as clock / regulator / phy / pinctrl / iio whatever for the other modules.
Just my 2c based on looking at the interconnect, I'm not too familiar with cpsw otherwise.
It's not separate modules. this is composite module which have only one fck/ick and most of blocks can't even function without each other. Above might be the case for Keystone 2, but not omap CPSW.
Keystone 2 - has packet processor, security accelerator, queue manager in addition to its basic switch block.
Signature · 2 lines
regards, -grygorii
Quoted 9 lines · Grygorii Strashko
Quoted 6 lines · Tony Lindgren
In general, it seems cpsw is just an interconnect instance (
L4_FAST) with a control module (CPSW_WR) and a pile of independent other modules. That's described nicely in am437x TRM chapter "2.1.4 L4 Fast Peripheral Memory Map". So from that point of view the binding reg entries right now are all wrong :)TRM not consistent - for am5 it's one MMIO region.
Well that same information is there in 57xx TRM in chapter "Table 26-1454. GMAC_SW Instance Summary". But yeah, all the cpsw internal devices are stuffed into a single interconnect target module.
Quoted 6 lines
Quoted 6 lines
In the long run cpsw should be really treated as an interconnect instance with it's control module providing standard Linux framework services such as clock / regulator / phy / pinctrl / iio whatever for the other modules.
Quoted 8 lines
Quoted 2 lines
Just my 2c based on looking at the interconnect, I'm not too familiar with cpsw otherwise.
It's not separate modules. this is composite module which have only one fck/ick and most of blocks can't even function without each other. Above might be the case for Keystone 2, but not omap CPSW. Keystone 2 - has packet processor, security accelerator, queue manager in addition to its basic switch block.
Yeah there's just one fck/ick as it's all in a single interconnect module. But you might want to look at the CPSW_WR device registers and see what gate clocks and other Linux generic subsystem services CPSW_WR could provide for the other cpsw internal devices. It might just make your life easier maintaining all these variants ;)
Regards,
Tony
From: Tony Lindgren <[email protected]>
Date: Wed, 29 Aug 2018 08:00:23 -0700
Quoted 9 lines
The current cpsw usage for cpsw-phy-sel is undocumented but is used for all the boards using cpsw. And cpsw-phy-sel is not really a child of the cpsw device, it lives in the system control module instead.
Let's document the existing usage, and improve it a bit where we prefer to use a phandle instead of a child device for it. That way we can properly describe the hardware in dts files for things like genpd.
Signed-off-by Tony Lindgren <[email protected]>
Applied.