Commit b2180a8f authored by Iyappan Subramanian's avatar Iyappan Subramanian Committed by David S. Miller

drivers: net: xgene-v2: Fix port reset

Fixed port reset sequence by adding ECC init.
Signed-off-by: default avatarIyappan Subramanian <isubramanian@apm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 617d795c
...@@ -38,10 +38,24 @@ u32 xge_rd_csr(struct xge_pdata *pdata, u32 offset) ...@@ -38,10 +38,24 @@ u32 xge_rd_csr(struct xge_pdata *pdata, u32 offset)
int xge_port_reset(struct net_device *ndev) int xge_port_reset(struct net_device *ndev)
{ {
struct xge_pdata *pdata = netdev_priv(ndev); struct xge_pdata *pdata = netdev_priv(ndev);
struct device *dev = &pdata->pdev->dev;
u32 data, wait = 10;
xge_wr_csr(pdata, ENET_SRST, 0x3); xge_wr_csr(pdata, ENET_CLKEN, 0x3);
xge_wr_csr(pdata, ENET_SRST, 0x2); xge_wr_csr(pdata, ENET_SRST, 0xf);
xge_wr_csr(pdata, ENET_SRST, 0x0); xge_wr_csr(pdata, ENET_SRST, 0);
xge_wr_csr(pdata, CFG_MEM_RAM_SHUTDOWN, 1);
xge_wr_csr(pdata, CFG_MEM_RAM_SHUTDOWN, 0);
do {
usleep_range(100, 110);
data = xge_rd_csr(pdata, BLOCK_MEM_RDY);
} while (data != MEM_RDY && wait--);
if (data != MEM_RDY) {
dev_err(dev, "ECC init failed: %x\n", data);
return -ETIMEDOUT;
}
xge_wr_csr(pdata, ENET_SHIM, DEVM_ARAUX_COH | DEVM_AWAUX_COH); xge_wr_csr(pdata, ENET_SHIM, DEVM_ARAUX_COH | DEVM_AWAUX_COH);
...@@ -59,13 +73,11 @@ static void xge_traffic_resume(struct net_device *ndev) ...@@ -59,13 +73,11 @@ static void xge_traffic_resume(struct net_device *ndev)
xge_wr_csr(pdata, RX_DV_GATE_REG, 1); xge_wr_csr(pdata, RX_DV_GATE_REG, 1);
} }
int xge_port_init(struct net_device *ndev) void xge_port_init(struct net_device *ndev)
{ {
struct xge_pdata *pdata = netdev_priv(ndev); struct xge_pdata *pdata = netdev_priv(ndev);
pdata->phy_speed = SPEED_1000; pdata->phy_speed = SPEED_1000;
xge_mac_init(pdata); xge_mac_init(pdata);
xge_traffic_resume(ndev); xge_traffic_resume(ndev);
return 0;
} }
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define CFG_MEM_RAM_SHUTDOWN 0xd070 #define CFG_MEM_RAM_SHUTDOWN 0xd070
#define BLOCK_MEM_RDY 0xd074 #define BLOCK_MEM_RDY 0xd074
#define MEM_RDY 0xffffffff
#define DEVM_ARAUX_COH BIT(19) #define DEVM_ARAUX_COH BIT(19)
#define DEVM_AWAUX_COH BIT(3) #define DEVM_AWAUX_COH BIT(3)
...@@ -39,5 +40,6 @@ ...@@ -39,5 +40,6 @@
void xge_wr_csr(struct xge_pdata *pdata, u32 offset, u32 val); void xge_wr_csr(struct xge_pdata *pdata, u32 offset, u32 val);
u32 xge_rd_csr(struct xge_pdata *pdata, u32 offset); u32 xge_rd_csr(struct xge_pdata *pdata, u32 offset);
int xge_port_reset(struct net_device *ndev); int xge_port_reset(struct net_device *ndev);
void xge_port_init(struct net_device *ndev);
#endif /* __XGENE_ENET_V2_ENET__H__ */ #endif /* __XGENE_ENET_V2_ENET__H__ */
...@@ -105,7 +105,6 @@ void xge_mac_set_speed(struct xge_pdata *pdata); ...@@ -105,7 +105,6 @@ void xge_mac_set_speed(struct xge_pdata *pdata);
void xge_mac_enable(struct xge_pdata *pdata); void xge_mac_enable(struct xge_pdata *pdata);
void xge_mac_disable(struct xge_pdata *pdata); void xge_mac_disable(struct xge_pdata *pdata);
void xge_mac_init(struct xge_pdata *pdata); void xge_mac_init(struct xge_pdata *pdata);
int xge_port_init(struct net_device *ndev);
void xge_mac_set_station_addr(struct xge_pdata *pdata); void xge_mac_set_station_addr(struct xge_pdata *pdata);
#endif /* __XGENE_ENET_V2_MAC_H__ */ #endif /* __XGENE_ENET_V2_MAC_H__ */
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