* [PATCH net-next v3 1/2] dt-bindings: net: Add documentation for Half duplex support.
2023-09-13 9:10 [PATCH net-next v3 0/2] Add Half Duplex support for ICSSG Driver MD Danish Anwar
@ 2023-09-13 9:10 ` MD Danish Anwar
2023-09-13 12:21 ` Andrew Lunn
` (2 more replies)
2023-09-13 9:10 ` [PATCH net-next v3 2/2] net: ti: icssg-prueth: Add support for half duplex operation MD Danish Anwar
2023-09-15 13:00 ` [PATCH net-next v3 0/2] Add Half Duplex support for ICSSG Driver patchwork-bot+netdevbpf
2 siblings, 3 replies; 7+ messages in thread
From: MD Danish Anwar @ 2023-09-13 9:10 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 836d2d60e87d..229c8f32019f 100644
--- a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
+++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
@@ -107,6 +107,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:
+ 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.
+
required:
- reg
anyOf:
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH net-next v3 2/2] net: ti: icssg-prueth: Add support for half duplex operation
2023-09-13 9:10 [PATCH net-next v3 0/2] Add Half Duplex support for ICSSG Driver MD Danish Anwar
2023-09-13 9:10 ` [PATCH net-next v3 1/2] dt-bindings: net: Add documentation for Half duplex support MD Danish Anwar
@ 2023-09-13 9:10 ` MD Danish Anwar
2023-09-15 13:00 ` [PATCH net-next v3 0/2] Add Half Duplex support for ICSSG Driver patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: MD Danish Anwar @ 2023-09-13 9:10 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 92b13057d4de..6635b28bc672 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] 7+ messages in thread* Re: [PATCH net-next v3 0/2] Add Half Duplex support for ICSSG Driver
2023-09-13 9:10 [PATCH net-next v3 0/2] Add Half Duplex support for ICSSG Driver MD Danish Anwar
2023-09-13 9:10 ` [PATCH net-next v3 1/2] dt-bindings: net: Add documentation for Half duplex support MD Danish Anwar
2023-09-13 9:10 ` [PATCH net-next v3 2/2] net: ti: icssg-prueth: Add support for half duplex operation MD Danish Anwar
@ 2023-09-15 13:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-15 13:00 UTC (permalink / raw)
To: MD Danish Anwar
Cc: andrew, rogerq, conor+dt, krzysztof.kozlowski+dt, robh+dt, pabeni,
kuba, edumazet, davem, vigneshr, horms, linux-kernel, devicetree,
netdev, srk, r-gunasekaran
Hello:
This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 13 Sep 2023 14:40:09 +0530 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net-next,v3,1/2] dt-bindings: net: Add documentation for Half duplex support.
https://git.kernel.org/netdev/net-next/c/927c568d6212
- [net-next,v3,2/2] net: ti: icssg-prueth: Add support for half duplex operation
https://git.kernel.org/netdev/net-next/c/0a205f0fe8dd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread