2 * Applied Micro X-Gene SoC Ethernet v2 Driver
4 * Copyright (c) 2017, Applied Micro Circuits Corporation
5 * Author(s): Iyappan Subramanian <isubramanian@apm.com>
6 * Keyur Chudgar <kchudgar@apm.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 void xge_wr_csr(struct xge_pdata *pdata, u32 offset, u32 val)
26 void __iomem *addr = pdata->resources.base_addr + offset;
31 u32 xge_rd_csr(struct xge_pdata *pdata, u32 offset)
33 void __iomem *addr = pdata->resources.base_addr + offset;
35 return ioread32(addr);
38 int xge_port_reset(struct net_device *ndev)
40 struct xge_pdata *pdata = netdev_priv(ndev);
42 xge_wr_csr(pdata, ENET_SRST, 0x3);
43 xge_wr_csr(pdata, ENET_SRST, 0x2);
44 xge_wr_csr(pdata, ENET_SRST, 0x0);
46 xge_wr_csr(pdata, ENET_SHIM, DEVM_ARAUX_COH | DEVM_AWAUX_COH);
51 static void xge_traffic_resume(struct net_device *ndev)
53 struct xge_pdata *pdata = netdev_priv(ndev);
55 xge_wr_csr(pdata, CFG_FORCE_LINK_STATUS_EN, 1);
56 xge_wr_csr(pdata, FORCE_LINK_STATUS, 1);
58 xge_wr_csr(pdata, CFG_LINK_AGGR_RESUME, 1);
59 xge_wr_csr(pdata, RX_DV_GATE_REG, 1);
62 int xge_port_init(struct net_device *ndev)
64 struct xge_pdata *pdata = netdev_priv(ndev);
66 pdata->phy_speed = SPEED_1000;
68 xge_traffic_resume(ndev);