Skip to content

Commit 443a236

Browse files
grygoriySdavem330
authored andcommitted
net: ti: icssg-prueth: am65x SR2.0 add 10M full duplex support
For AM65x SR2.0 it's required to enable IEP1 in raw 64bit mode which is used by PRU FW to monitor the link and apply w/a for 10M link issue. Note. No public errata available yet. Without this w/a the PRU FW will stuck if link state changes under TX traffic pressure. Hence, add support for 10M full duplex for AM65x SR2.0: - add new IEP API to enable IEP, but without PTP support - add pdata quirk_10m_link_issue to enable 10M link issue w/a. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 186734c commit 443a236

5 files changed

Lines changed: 62 additions & 2 deletions

File tree

drivers/net/ethernet/ti/icssg/icss_iep.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,32 @@ void icss_iep_put(struct icss_iep *iep)
727727
}
728728
EXPORT_SYMBOL_GPL(icss_iep_put);
729729

730+
void icss_iep_init_fw(struct icss_iep *iep)
731+
{
732+
/* start IEP for FW use in raw 64bit mode, no PTP support */
733+
iep->clk_tick_time = iep->def_inc;
734+
iep->cycle_time_ns = 0;
735+
iep->ops = NULL;
736+
iep->clockops_data = NULL;
737+
icss_iep_set_default_inc(iep, iep->def_inc);
738+
icss_iep_set_compensation_inc(iep, iep->def_inc);
739+
icss_iep_set_compensation_count(iep, 0);
740+
regmap_write(iep->map, ICSS_IEP_SYNC_PWIDTH_REG, iep->refclk_freq / 10); /* 100 ms pulse */
741+
regmap_write(iep->map, ICSS_IEP_SYNC0_PERIOD_REG, 0);
742+
if (iep->plat_data->flags & ICSS_IEP_SLOW_COMPEN_REG_SUPPORT)
743+
icss_iep_set_slow_compensation_count(iep, 0);
744+
745+
icss_iep_enable(iep);
746+
icss_iep_settime(iep, 0);
747+
}
748+
EXPORT_SYMBOL_GPL(icss_iep_init_fw);
749+
750+
void icss_iep_exit_fw(struct icss_iep *iep)
751+
{
752+
icss_iep_disable(iep);
753+
}
754+
EXPORT_SYMBOL_GPL(icss_iep_exit_fw);
755+
730756
int icss_iep_init(struct icss_iep *iep, const struct icss_iep_clockops *clkops,
731757
void *clockops_data, u32 cycle_time_ns)
732758
{

drivers/net/ethernet/ti/icssg/icss_iep.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ int icss_iep_exit(struct icss_iep *iep);
3535
int icss_iep_get_count_low(struct icss_iep *iep);
3636
int icss_iep_get_count_hi(struct icss_iep *iep);
3737
int icss_iep_get_ptp_clock_idx(struct icss_iep *iep);
38+
void icss_iep_init_fw(struct icss_iep *iep);
39+
void icss_iep_exit_fw(struct icss_iep *iep);
3840

3941
#endif /* __NET_TI_ICSS_IEP_H */

drivers/net/ethernet/ti/icssg/icssg_config.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ void icssg_config_ipg(struct prueth_emac *emac)
210210
case SPEED_100:
211211
icssg_mii_update_ipg(prueth->mii_rt, slice, MII_RT_TX_IPG_100M);
212212
break;
213+
case SPEED_10:
214+
/* IPG for 10M is same as 100M */
215+
icssg_mii_update_ipg(prueth->mii_rt, slice, MII_RT_TX_IPG_100M);
216+
break;
213217
default:
214218
/* Other links speeds not supported */
215219
netdev_err(emac->ndev, "Unsupported link speed\n");
@@ -440,6 +444,9 @@ void icssg_config_set_speed(struct prueth_emac *emac)
440444
case SPEED_100:
441445
fw_speed = FW_LINK_SPEED_100M;
442446
break;
447+
case SPEED_10:
448+
fw_speed = FW_LINK_SPEED_10M;
449+
break;
443450
default:
444451
/* Other links speeds not supported */
445452
netdev_err(emac->ndev, "Unsupported link speed\n");

drivers/net/ethernet/ti/icssg/icssg_prueth.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,6 @@ static int emac_phy_connect(struct prueth_emac *emac)
11491149

11501150
/* remove unsupported modes */
11511151
phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
1152-
phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
11531152
phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
11541153
phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
11551154
phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_Pause_BIT);
@@ -2090,13 +2089,29 @@ static int prueth_probe(struct platform_device *pdev)
20902089
goto free_pool;
20912090
}
20922091

2092+
prueth->iep1 = icss_iep_get_idx(np, 1);
2093+
if (IS_ERR(prueth->iep1)) {
2094+
ret = dev_err_probe(dev, PTR_ERR(prueth->iep1), "iep1 get failed\n");
2095+
icss_iep_put(prueth->iep0);
2096+
prueth->iep0 = NULL;
2097+
prueth->iep1 = NULL;
2098+
goto free_pool;
2099+
}
2100+
2101+
if (prueth->pdata.quirk_10m_link_issue) {
2102+
/* Enable IEP1 for FW in 64bit mode as W/A for 10M FD link detect issue under TX
2103+
* traffic.
2104+
*/
2105+
icss_iep_init_fw(prueth->iep1);
2106+
}
2107+
20932108
/* setup netdev interfaces */
20942109
if (eth0_node) {
20952110
ret = prueth_netdev_init(prueth, eth0_node);
20962111
if (ret) {
20972112
dev_err_probe(dev, ret, "netdev init %s failed\n",
20982113
eth0_node->name);
2099-
goto netdev_exit;
2114+
goto exit_iep;
21002115
}
21012116
prueth->emac[PRUETH_MAC0]->iep = prueth->iep0;
21022117
}
@@ -2167,6 +2182,10 @@ static int prueth_probe(struct platform_device *pdev)
21672182
prueth_netdev_exit(prueth, eth_node);
21682183
}
21692184

2185+
exit_iep:
2186+
if (prueth->pdata.quirk_10m_link_issue)
2187+
icss_iep_exit_fw(prueth->iep1);
2188+
21702189
free_pool:
21712190
gen_pool_free(prueth->sram_pool,
21722191
(unsigned long)prueth->msmcram.va, msmc_ram_size);
@@ -2212,6 +2231,10 @@ static void prueth_remove(struct platform_device *pdev)
22122231
prueth_netdev_exit(prueth, eth_node);
22132232
}
22142233

2234+
if (prueth->pdata.quirk_10m_link_issue)
2235+
icss_iep_exit_fw(prueth->iep1);
2236+
2237+
icss_iep_put(prueth->iep1);
22152238
icss_iep_put(prueth->iep0);
22162239

22172240
gen_pool_free(prueth->sram_pool,

drivers/net/ethernet/ti/icssg/icssg_prueth.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ struct prueth_pdata {
208208
* @icssg_hwcmdseq: seq counter or HWQ messages
209209
* @emacs_initialized: num of EMACs/ext ports that are up/running
210210
* @iep0: pointer to IEP0 device
211+
* @iep1: pointer to IEP1 device
211212
*/
212213
struct prueth {
213214
struct device *dev;
@@ -231,6 +232,7 @@ struct prueth {
231232
u8 icssg_hwcmdseq;
232233
int emacs_initialized;
233234
struct icss_iep *iep0;
235+
struct icss_iep *iep1;
234236
};
235237

236238
struct emac_tx_ts_response {

0 commit comments

Comments
 (0)