| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /******************************************************************************* |
|---|
| 2 | 3 | This is the driver for the MAC 10/100 on-chip Ethernet controller |
|---|
| 3 | 4 | currently tested on all the ST boards based on STb7109 and stx7200 SoCs. |
|---|
| .. | .. |
|---|
| 9 | 10 | |
|---|
| 10 | 11 | Copyright (C) 2007-2009 STMicroelectronics Ltd |
|---|
| 11 | 12 | |
|---|
| 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". |
|---|
| 23 | 13 | |
|---|
| 24 | 14 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> |
|---|
| 25 | 15 | *******************************************************************************/ |
|---|
| .. | .. |
|---|
| 160 | 150 | return; |
|---|
| 161 | 151 | } |
|---|
| 162 | 152 | |
|---|
| 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 | + |
|---|
| 163 | 165 | const struct stmmac_ops dwmac100_ops = { |
|---|
| 164 | 166 | .core_init = dwmac100_core_init, |
|---|
| 165 | 167 | .set_mac = stmmac_set_mac, |
|---|
| .. | .. |
|---|
| 171 | 173 | .pmt = dwmac100_pmt, |
|---|
| 172 | 174 | .set_umac_addr = dwmac100_set_umac_addr, |
|---|
| 173 | 175 | .get_umac_addr = dwmac100_get_umac_addr, |
|---|
| 176 | + .set_mac_loopback = dwmac100_set_mac_loopback, |
|---|
| 174 | 177 | }; |
|---|
| 175 | 178 | |
|---|
| 176 | 179 | int dwmac100_setup(struct stmmac_priv *priv) |
|---|