* [PATCH net-next v2 0/2] Add Half Duplex support for ICSSG Driver @ 2023-09-11 6:01 MD Danish Anwar 2023-09-11 6:01 ` [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support MD Danish Anwar 2023-09-11 6:02 ` [PATCH net-next v2 2/2] net: ti: icssg-prueth: Add support for half duplex operation MD Danish Anwar 0 siblings, 2 replies; 8+ messages in thread From: MD Danish Anwar @ 2023-09-11 6:01 UTC (permalink / raw) To: Andrew Lunn, Roger Quadros, MD Danish Anwar, Conor Dooley, Krzysztof Kozlowski, Rob Herring, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, Simon Horman Cc: linux-kernel, devicetree, netdev, srk, r-gunasekaran This series adds support for half duplex operation for ICSSG driver. In order to support half-duplex operation at 10M and 100M link speeds, the PHY collision detection signal (COL) should be routed to ICSSG GPIO pin (PRGx_PRU0/1_GPI10) so that firmware can detect collision signal and apply the CSMA/CD algorithm applicable for half duplex operation. A DT property, "ti,half-duplex-capable" is introduced for this purpose in the first patch of the series. If board has PHY COL pin conencted to PRGx_PRU1_GPIO10, this DT property can be added to eth node of ICSSG, MII port to support half duplex operation at that port. Second patch of the series configures driver to support half-duplex operation if the DT property "ti,half-duplex-capable" is enabled. This series addresses comments on [v1] (which was posted as RFC). This series is based on the latest net-next/main. This series has no dependency. Changes from v1 to v2: *) Dropped the RFC tag. *) Added RB tags of Andrew and Roger. [1] https://lore.kernel.org/all/20230830113134.1226970-1-danishanwar@ti.com/ Thanks and Regards, Md Danish Anwar MD Danish Anwar (2): dt-bindings: net: Add documentation for Half duplex support. net: ti: icssg-prueth: Add support for half duplex operation .../bindings/net/ti,icssg-prueth.yaml | 7 +++++++ drivers/net/ethernet/ti/icssg/icssg_config.c | 14 ++++++++++++++ drivers/net/ethernet/ti/icssg/icssg_prueth.c | 17 +++++++++++++++-- drivers/net/ethernet/ti/icssg/icssg_prueth.h | 2 ++ 4 files changed, 38 insertions(+), 2 deletions(-) base-commit: 73be7fb14e83d24383f840a22f24d3ed222ca319 -- 2.34.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support. 2023-09-11 6:01 [PATCH net-next v2 0/2] Add Half Duplex support for ICSSG Driver MD Danish Anwar @ 2023-09-11 6:01 ` MD Danish Anwar 2023-09-11 16:46 ` Rob Herring 2023-09-14 10:35 ` Simon Horman 2023-09-11 6:02 ` [PATCH net-next v2 2/2] net: ti: icssg-prueth: Add support for half duplex operation MD Danish Anwar 1 sibling, 2 replies; 8+ messages in thread From: MD Danish Anwar @ 2023-09-11 6:01 UTC (permalink / raw) To: Andrew Lunn, Roger Quadros, MD Danish Anwar, Conor Dooley, Krzysztof Kozlowski, Rob Herring, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, Simon Horman Cc: linux-kernel, devicetree, netdev, srk, r-gunasekaran, Roger Quadros In order to support half-duplex operation at 10M and 100M link speeds, the PHY collision detection signal (COL) should be routed to ICSSG GPIO pin (PRGx_PRU0/1_GPI10) so that firmware can detect collision signal and apply the CSMA/CD algorithm applicable for half duplex operation. A DT property, "ti,half-duplex-capable" is introduced for this purpose. If board has PHY COL pin conencted to PRGx_PRU1_GPIO10, this DT property can be added to eth node of ICSSG, MII port to support half duplex operation at that port. Reviewed-by: Roger Quadros <rogerq@kernel.org> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> --- Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml index 311c570165f9..bba17d4d5874 100644 --- a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml +++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml @@ -106,6 +106,13 @@ properties: phandle to system controller node and register offset to ICSSG control register for RGMII transmit delay + ti,half-duplex-capable: + type: boolean + description: + Enable half duplex operation on ICSSG MII port. This requires + PHY output pin (COL) to be routed to ICSSG GPIO pin + (PRGx_PRU0/1_GPIO10) as input. + required: - reg anyOf: -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support. 2023-09-11 6:01 ` [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support MD Danish Anwar @ 2023-09-11 16:46 ` Rob Herring 2023-09-12 5:55 ` MD Danish Anwar 2023-09-14 10:35 ` Simon Horman 1 sibling, 1 reply; 8+ messages in thread From: Rob Herring @ 2023-09-11 16:46 UTC (permalink / raw) To: MD Danish Anwar Cc: Andrew Lunn, Roger Quadros, Conor Dooley, Krzysztof Kozlowski, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, Simon Horman, linux-kernel, devicetree, netdev, srk, r-gunasekaran, Roger Quadros On Mon, Sep 11, 2023 at 11:31:59AM +0530, MD Danish Anwar wrote: > In order to support half-duplex operation at 10M and 100M link speeds, the > PHY collision detection signal (COL) should be routed to ICSSG > GPIO pin (PRGx_PRU0/1_GPI10) so that firmware can detect collision signal > and apply the CSMA/CD algorithm applicable for half duplex operation. A DT > property, "ti,half-duplex-capable" is introduced for this purpose. If > board has PHY COL pin conencted to PRGx_PRU1_GPIO10, this DT property can > be added to eth node of ICSSG, MII port to support half duplex operation at > that port. > > Reviewed-by: Roger Quadros <rogerq@kernel.org> > Signed-off-by: MD Danish Anwar <danishanwar@ti.com> > --- > Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml > index 311c570165f9..bba17d4d5874 100644 > --- a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml > +++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml > @@ -106,6 +106,13 @@ properties: > phandle to system controller node and register offset > to ICSSG control register for RGMII transmit delay > > + ti,half-duplex-capable: > + type: boolean > + description: > + Enable half duplex operation on ICSSG MII port. This requires Still have capable vs. enable confusion. Please reword the description. > + PHY output pin (COL) to be routed to ICSSG GPIO pin > + (PRGx_PRU0/1_GPIO10) as input. > + > required: > - reg > anyOf: > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support. 2023-09-11 16:46 ` Rob Herring @ 2023-09-12 5:55 ` MD Danish Anwar 2023-09-12 15:16 ` Andrew Lunn 0 siblings, 1 reply; 8+ messages in thread From: MD Danish Anwar @ 2023-09-12 5:55 UTC (permalink / raw) To: Rob Herring Cc: Andrew Lunn, Roger Quadros, Conor Dooley, Krzysztof Kozlowski, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, Simon Horman, linux-kernel, devicetree, netdev, srk, r-gunasekaran, Roger Quadros On 11/09/23 22:16, Rob Herring wrote: > On Mon, Sep 11, 2023 at 11:31:59AM +0530, MD Danish Anwar wrote: >> In order to support half-duplex operation at 10M and 100M link speeds, the >> PHY collision detection signal (COL) should be routed to ICSSG >> GPIO pin (PRGx_PRU0/1_GPI10) so that firmware can detect collision signal >> and apply the CSMA/CD algorithm applicable for half duplex operation. A DT >> property, "ti,half-duplex-capable" is introduced for this purpose. If >> board has PHY COL pin conencted to PRGx_PRU1_GPIO10, this DT property can >> be added to eth node of ICSSG, MII port to support half duplex operation at >> that port. >> >> Reviewed-by: Roger Quadros <rogerq@kernel.org> >> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> >> --- >> Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml >> index 311c570165f9..bba17d4d5874 100644 >> --- a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml >> +++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml >> @@ -106,6 +106,13 @@ properties: >> phandle to system controller node and register offset >> to ICSSG control register for RGMII transmit delay >> >> + ti,half-duplex-capable: >> + type: boolean >> + description: >> + Enable half duplex operation on ICSSG MII port. This requires > > Still have capable vs. enable confusion. Please reword the description. > Sure Rob, I will change the description to below. description: Indicates that the PHY output pin (COL) is routed to ICSSG GPIO pin (PRGx_PRU0/1_GPIO10) as input and ICSSG MII port is capable of half duplex operations. Please let me know if this looks OK or if any other change is required. >> + PHY output pin (COL) to be routed to ICSSG GPIO pin >> + (PRGx_PRU0/1_GPIO10) as input. >> + >> required: >> - reg >> anyOf: >> -- >> 2.34.1 >> -- Thanks and Regards, Danish ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support. 2023-09-12 5:55 ` MD Danish Anwar @ 2023-09-12 15:16 ` Andrew Lunn 2023-09-13 6:17 ` [EXTERNAL] " MD Danish Anwar 0 siblings, 1 reply; 8+ messages in thread From: Andrew Lunn @ 2023-09-12 15:16 UTC (permalink / raw) To: MD Danish Anwar Cc: Rob Herring, Roger Quadros, Conor Dooley, Krzysztof Kozlowski, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, Simon Horman, linux-kernel, devicetree, netdev, srk, r-gunasekaran, Roger Quadros > Sure Rob, I will change the description to below. > > description: > Indicates that the PHY output pin (COL) is routed to ICSSG GPIO The PHY has multiple output pins, so i would not put COL in brackets, but make it explicit which pin you are referring to. > pin (PRGx_PRU0/1_GPIO10) as input and ICSSG MII port is capable > of half duplex operations. "input and so the ICSSG MII port is" Andrew ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [EXTERNAL] Re: [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support. 2023-09-12 15:16 ` Andrew Lunn @ 2023-09-13 6:17 ` MD Danish Anwar 0 siblings, 0 replies; 8+ messages in thread From: MD Danish Anwar @ 2023-09-13 6:17 UTC (permalink / raw) To: Andrew Lunn Cc: Rob Herring, Roger Quadros, Conor Dooley, Krzysztof Kozlowski, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, Simon Horman, linux-kernel, devicetree, netdev, srk, r-gunasekaran, Roger Quadros On 12/09/23 20:46, Andrew Lunn wrote: >> Sure Rob, I will change the description to below. >> >> description: >> Indicates that the PHY output pin (COL) is routed to ICSSG GPIO > > The PHY has multiple output pins, so i would not put COL in brackets, > but make it explicit which pin you are referring to. > Sure, I will remove the brackets and make it explicit. >> pin (PRGx_PRU0/1_GPIO10) as input and ICSSG MII port is capable >> of half duplex operations. > > "input and so the ICSSG MII port is" > I think "input so that the ICSSG MII port is" will be better. The description would look something like below, description: Indicates that the PHY output pin COL is routed to ICSSG GPIO pin (PRGx_PRU0/1_GPIO10) as input so that the ICSSG MII port is capable of half duplex operations. I will post the next version with this change. > Andrew -- Thanks and Regards, Danish ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support. 2023-09-11 6:01 ` [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support MD Danish Anwar 2023-09-11 16:46 ` Rob Herring @ 2023-09-14 10:35 ` Simon Horman 1 sibling, 0 replies; 8+ messages in thread From: Simon Horman @ 2023-09-14 10:35 UTC (permalink / raw) To: MD Danish Anwar Cc: Andrew Lunn, Roger Quadros, Conor Dooley, Krzysztof Kozlowski, Rob Herring, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, linux-kernel, devicetree, netdev, srk, r-gunasekaran, Roger Quadros On Mon, Sep 11, 2023 at 11:31:59AM +0530, MD Danish Anwar wrote: > In order to support half-duplex operation at 10M and 100M link speeds, the > PHY collision detection signal (COL) should be routed to ICSSG > GPIO pin (PRGx_PRU0/1_GPI10) so that firmware can detect collision signal > and apply the CSMA/CD algorithm applicable for half duplex operation. A DT > property, "ti,half-duplex-capable" is introduced for this purpose. If > board has PHY COL pin conencted to PRGx_PRU1_GPIO10, this DT property can nit: connected ... ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v2 2/2] net: ti: icssg-prueth: Add support for half duplex operation 2023-09-11 6:01 [PATCH net-next v2 0/2] Add Half Duplex support for ICSSG Driver MD Danish Anwar 2023-09-11 6:01 ` [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support MD Danish Anwar @ 2023-09-11 6:02 ` MD Danish Anwar 1 sibling, 0 replies; 8+ messages in thread From: MD Danish Anwar @ 2023-09-11 6:02 UTC (permalink / raw) To: Andrew Lunn, Roger Quadros, MD Danish Anwar, Conor Dooley, Krzysztof Kozlowski, Rob Herring, Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller, Vignesh Raghavendra, Simon Horman Cc: linux-kernel, devicetree, netdev, srk, r-gunasekaran, Roger Quadros This patch adds support for half duplex operation at 10M and 100M link speeds for AM654x/AM64x devices. - Driver configures rand_seed, a random number, in DMEM HD_RAND_SEED_OFFSET field, which will be used by firmware for Back off time calculation. - Driver informs FW about half duplex link operation in DMEM PORT_LINK_SPEED_OFFSET field by setting bit 7 for 10/100M HD. Hence, the half duplex operation depends on board design the "ti,half-duplex-capable" property has to be enabled for ICSS-G ports if HW is capable to perform half duplex. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Roger Quadros <rogerq@kernel.org> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> --- drivers/net/ethernet/ti/icssg/icssg_config.c | 14 ++++++++++++++ drivers/net/ethernet/ti/icssg/icssg_prueth.c | 17 +++++++++++++++-- drivers/net/ethernet/ti/icssg/icssg_prueth.h | 2 ++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c index 933b84666574..c1da70f247d4 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_config.c +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c @@ -433,6 +433,17 @@ int emac_set_port_state(struct prueth_emac *emac, return ret; } +void icssg_config_half_duplex(struct prueth_emac *emac) +{ + u32 val; + + if (!emac->half_duplex) + return; + + val = get_random_u32(); + writel(val, emac->dram.va + HD_RAND_SEED_OFFSET); +} + void icssg_config_set_speed(struct prueth_emac *emac) { u8 fw_speed; @@ -453,5 +464,8 @@ void icssg_config_set_speed(struct prueth_emac *emac) return; } + if (emac->duplex == DUPLEX_HALF) + fw_speed |= FW_LINK_SPEED_HD; + writeb(fw_speed, emac->dram.va + PORT_LINK_SPEED_OFFSET); } diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index 410612f43cbd..e736652567cd 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -1029,6 +1029,8 @@ static void emac_adjust_link(struct net_device *ndev) * values */ if (emac->link) { + if (emac->duplex == DUPLEX_HALF) + icssg_config_half_duplex(emac); /* Set the RGMII cfg for gig en and full duplex */ icssg_update_rgmii_cfg(prueth->miig_rt, emac); @@ -1147,9 +1149,13 @@ static int emac_phy_connect(struct prueth_emac *emac) return -ENODEV; } + if (!emac->half_duplex) { + dev_dbg(prueth->dev, "half duplex mode is not supported\n"); + phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT); + phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); + } + /* remove unsupported modes */ - phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT); - phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT); phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_Pause_BIT); phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_Asym_Pause_BIT); @@ -2113,6 +2119,10 @@ static int prueth_probe(struct platform_device *pdev) eth0_node->name); goto exit_iep; } + + if (of_find_property(eth0_node, "ti,half-duplex-capable", NULL)) + prueth->emac[PRUETH_MAC0]->half_duplex = 1; + prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; } @@ -2124,6 +2134,9 @@ static int prueth_probe(struct platform_device *pdev) goto netdev_exit; } + if (of_find_property(eth1_node, "ti,half-duplex-capable", NULL)) + prueth->emac[PRUETH_MAC1]->half_duplex = 1; + prueth->emac[PRUETH_MAC1]->iep = prueth->iep0; } diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h index 3fe80a8758d3..8b6d6b497010 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h @@ -145,6 +145,7 @@ struct prueth_emac { struct icss_iep *iep; unsigned int rx_ts_enabled : 1; unsigned int tx_ts_enabled : 1; + unsigned int half_duplex : 1; /* DMA related */ struct prueth_tx_chn tx_chns[PRUETH_MAX_TX_QUEUES]; @@ -271,6 +272,7 @@ int icssg_config(struct prueth *prueth, struct prueth_emac *emac, int emac_set_port_state(struct prueth_emac *emac, enum icssg_port_state_cmd state); void icssg_config_set_speed(struct prueth_emac *emac); +void icssg_config_half_duplex(struct prueth_emac *emac); /* Buffer queue helpers */ int icssg_queue_pop(struct prueth *prueth, u8 queue); -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-09-14 10:35 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-09-11 6:01 [PATCH net-next v2 0/2] Add Half Duplex support for ICSSG Driver MD Danish Anwar 2023-09-11 6:01 ` [PATCH net-next v2 1/2] dt-bindings: net: Add documentation for Half duplex support MD Danish Anwar 2023-09-11 16:46 ` Rob Herring 2023-09-12 5:55 ` MD Danish Anwar 2023-09-12 15:16 ` Andrew Lunn 2023-09-13 6:17 ` [EXTERNAL] " MD Danish Anwar 2023-09-14 10:35 ` Simon Horman 2023-09-11 6:02 ` [PATCH net-next v2 2/2] net: ti: icssg-prueth: Add support for half duplex operation MD Danish Anwar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).