Commit 95c2e689 authored by Diogo Ivo's avatar Diogo Ivo Committed by Paolo Abeni

net: ti: icssg-prueth: Adjust IPG configuration for SR1.0

Correctly adjust the IPG based on the Silicon Revision.

Based on the work of Roger Quadros, Vignesh Raghavendra
and Grygorii Strashko in TI's 5.10 SDK [1].

[1]: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/?h=ti-linux-5.10.yCo-developed-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarDiogo Ivo <diogo.ivo@siemens.com>
Reviewed-by: default avatarRoger Quadros <rogerq@kernel.org>
Reviewed-by: default avatarMD Danish Anwar <danishanwar@ti.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 8623dea2
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
/* IPG is in core_clk cycles */ /* IPG is in core_clk cycles */
#define MII_RT_TX_IPG_100M 0x17 #define MII_RT_TX_IPG_100M 0x17
#define MII_RT_TX_IPG_1G 0xb #define MII_RT_TX_IPG_1G 0xb
#define MII_RT_TX_IPG_100M_SR1 0x166
#define MII_RT_TX_IPG_1G_SR1 0x1a
#define ICSSG_QUEUES_MAX 64 #define ICSSG_QUEUES_MAX 64
#define ICSSG_QUEUE_OFFSET 0xd00 #define ICSSG_QUEUE_OFFSET 0xd00
...@@ -202,23 +204,29 @@ void icssg_config_ipg(struct prueth_emac *emac) ...@@ -202,23 +204,29 @@ void icssg_config_ipg(struct prueth_emac *emac)
{ {
struct prueth *prueth = emac->prueth; struct prueth *prueth = emac->prueth;
int slice = prueth_emac_slice(emac); int slice = prueth_emac_slice(emac);
u32 ipg;
switch (emac->speed) { switch (emac->speed) {
case SPEED_1000: case SPEED_1000:
icssg_mii_update_ipg(prueth->mii_rt, slice, MII_RT_TX_IPG_1G); ipg = emac->is_sr1 ? MII_RT_TX_IPG_1G_SR1 : MII_RT_TX_IPG_1G;
break; break;
case SPEED_100: case SPEED_100:
icssg_mii_update_ipg(prueth->mii_rt, slice, MII_RT_TX_IPG_100M); ipg = emac->is_sr1 ? MII_RT_TX_IPG_100M_SR1 : MII_RT_TX_IPG_100M;
break; break;
case SPEED_10: case SPEED_10:
/* Firmware hardcodes IPG for SR1.0 */
if (emac->is_sr1)
return;
/* IPG for 10M is same as 100M */ /* IPG for 10M is same as 100M */
icssg_mii_update_ipg(prueth->mii_rt, slice, MII_RT_TX_IPG_100M); ipg = MII_RT_TX_IPG_100M;
break; break;
default: default:
/* Other links speeds not supported */ /* Other links speeds not supported */
netdev_err(emac->ndev, "Unsupported link speed\n"); netdev_err(emac->ndev, "Unsupported link speed\n");
return; return;
} }
icssg_mii_update_ipg(prueth->mii_rt, slice, ipg);
} }
static void emac_r30_cmd_init(struct prueth_emac *emac) static void emac_r30_cmd_init(struct prueth_emac *emac)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment