forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*******************************************************************************
23 This is the driver for the MAC 10/100 on-chip Ethernet controller
34 currently tested on all the ST boards based on STb7109 and stx7200 SoCs.
....@@ -9,17 +10,6 @@
910
1011 Copyright (C) 2007-2009 STMicroelectronics Ltd
1112
12
- This program is free software; you can redistribute it and/or modify it
13
- under the terms and conditions of the GNU General Public License,
14
- version 2, as published by the Free Software Foundation.
15
-
16
- This program is distributed in the hope it will be useful, but WITHOUT
17
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19
- more details.
20
-
21
- The full GNU General Public License is included in this distribution in
22
- the file called "COPYING".
2313
2414 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
2515 *******************************************************************************/
....@@ -160,6 +150,18 @@
160150 return;
161151 }
162152
153
+static void dwmac100_set_mac_loopback(void __iomem *ioaddr, bool enable)
154
+{
155
+ u32 value = readl(ioaddr + MAC_CONTROL);
156
+
157
+ if (enable)
158
+ value |= MAC_CONTROL_OM;
159
+ else
160
+ value &= ~MAC_CONTROL_OM;
161
+
162
+ writel(value, ioaddr + MAC_CONTROL);
163
+}
164
+
163165 const struct stmmac_ops dwmac100_ops = {
164166 .core_init = dwmac100_core_init,
165167 .set_mac = stmmac_set_mac,
....@@ -171,6 +173,7 @@
171173 .pmt = dwmac100_pmt,
172174 .set_umac_addr = dwmac100_set_umac_addr,
173175 .get_umac_addr = dwmac100_get_umac_addr,
176
+ .set_mac_loopback = dwmac100_set_mac_loopback,
174177 };
175178
176179 int dwmac100_setup(struct stmmac_priv *priv)