Merge branch 'net-dpaa-cleanups-in-preparation-for-phylink-conversion'
Sean Anderson says: ==================== net: dpaa: Cleanups in preparation for phylink conversion This series contains several cleanup patches for dpaa/fman. While they are intended to prepare for a phylink conversion, they stand on their own. This series was originally submitted as part of [1]. [1] https://lore.kernel.org/netdev/20220715215954.1449214-1-sean.anderson@seco.com ==================== Link: https://lore.kernel.org/r/20220818161649.2058728-1-sean.anderson@seco.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
14d25e3f53
22 changed files with 457 additions and 1051 deletions
145
Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml
Normal file
145
Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml
Normal file
|
@ -0,0 +1,145 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/net/fsl,fman-dtsec.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: NXP FMan MAC
|
||||
|
||||
maintainers:
|
||||
- Madalin Bucur <madalin.bucur@nxp.com>
|
||||
|
||||
description: |
|
||||
Each FMan has several MACs, each implementing an Ethernet interface. Earlier
|
||||
versions of FMan used the Datapath Three Speed Ethernet Controller (dTSEC) for
|
||||
10/100/1000 MBit/s speeds, and the 10-Gigabit Ethernet Media Access Controller
|
||||
(10GEC) for 10 Gbit/s speeds. Later versions of FMan use the Multirate
|
||||
Ethernet Media Access Controller (mEMAC) to handle all speeds.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- fsl,fman-dtsec
|
||||
- fsl,fman-xgec
|
||||
- fsl,fman-memac
|
||||
|
||||
cell-index:
|
||||
maximum: 64
|
||||
description: |
|
||||
FManV2:
|
||||
register[bit] MAC cell-index
|
||||
============================================================
|
||||
FM_EPI[16] XGEC 8
|
||||
FM_EPI[16+n] dTSECn n-1
|
||||
FM_NPI[11+n] dTSECn n-1
|
||||
n = 1,..,5
|
||||
|
||||
FManV3:
|
||||
register[bit] MAC cell-index
|
||||
============================================================
|
||||
FM_EPI[16+n] mEMACn n-1
|
||||
FM_EPI[25] mEMAC10 9
|
||||
|
||||
FM_NPI[11+n] mEMACn n-1
|
||||
FM_NPI[10] mEMAC10 9
|
||||
FM_NPI[11] mEMAC9 8
|
||||
n = 1,..8
|
||||
|
||||
FM_EPI and FM_NPI are located in the FMan memory map.
|
||||
|
||||
2. SoC registers:
|
||||
|
||||
- P2041, P3041, P4080 P5020, P5040:
|
||||
register[bit] FMan MAC cell
|
||||
Unit index
|
||||
============================================================
|
||||
DCFG_DEVDISR2[7] 1 XGEC 8
|
||||
DCFG_DEVDISR2[7+n] 1 dTSECn n-1
|
||||
DCFG_DEVDISR2[15] 2 XGEC 8
|
||||
DCFG_DEVDISR2[15+n] 2 dTSECn n-1
|
||||
n = 1,..5
|
||||
|
||||
- T1040, T2080, T4240, B4860:
|
||||
register[bit] FMan MAC cell
|
||||
Unit index
|
||||
============================================================
|
||||
DCFG_CCSR_DEVDISR2[n-1] 1 mEMACn n-1
|
||||
DCFG_CCSR_DEVDISR2[11+n] 2 mEMACn n-1
|
||||
n = 1,..6,9,10
|
||||
|
||||
EVDISR, DCFG_DEVDISR2 and DCFG_CCSR_DEVDISR2 are located in
|
||||
the specific SoC "Device Configuration/Pin Control" Memory
|
||||
Map.
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
fsl,fman-ports:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle-array
|
||||
maxItems: 2
|
||||
description: |
|
||||
An array of two references: the first is the FMan RX port and the second
|
||||
is the TX port used by this MAC.
|
||||
|
||||
ptp-timer:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: A reference to the IEEE1588 timer
|
||||
|
||||
pcsphy-handle:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: A reference to the PCS (typically found on the SerDes)
|
||||
|
||||
tbi-handle:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: A reference to the (TBI-based) PCS
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- cell-index
|
||||
- reg
|
||||
- fsl,fman-ports
|
||||
- ptp-timer
|
||||
|
||||
allOf:
|
||||
- $ref: ethernet-controller.yaml#
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: fsl,fman-dtsec
|
||||
then:
|
||||
required:
|
||||
- tbi-handle
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: fsl,fman-memac
|
||||
then:
|
||||
required:
|
||||
- pcsphy-handle
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
ethernet@e0000 {
|
||||
compatible = "fsl,fman-dtsec";
|
||||
cell-index = <0>;
|
||||
reg = <0xe0000 0x1000>;
|
||||
fsl,fman-ports = <&fman1_rx8 &fman1_tx28>;
|
||||
ptp-timer = <&ptp_timer>;
|
||||
tbi-handle = <&tbi0>;
|
||||
};
|
||||
- |
|
||||
ethernet@e8000 {
|
||||
cell-index = <4>;
|
||||
compatible = "fsl,fman-memac";
|
||||
reg = <0xe8000 0x1000>;
|
||||
fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>;
|
||||
ptp-timer = <&ptp_timer0>;
|
||||
pcsphy-handle = <&pcsphy4>;
|
||||
phy-handle = <&sgmii_phy1>;
|
||||
phy-connection-type = "sgmii";
|
||||
};
|
||||
...
|
|
@ -232,133 +232,7 @@ port@81000 {
|
|||
=============================================================================
|
||||
FMan dTSEC/XGEC/mEMAC Node
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
mEMAC/dTSEC/XGEC are the Ethernet network interfaces
|
||||
|
||||
PROPERTIES
|
||||
|
||||
- compatible
|
||||
Usage: required
|
||||
Value type: <stringlist>
|
||||
Definition: A standard property.
|
||||
Must include one of the following:
|
||||
- "fsl,fman-dtsec" for dTSEC MAC
|
||||
- "fsl,fman-xgec" for XGEC MAC
|
||||
- "fsl,fman-memac" for mEMAC MAC
|
||||
|
||||
- cell-index
|
||||
Usage: required
|
||||
Value type: <u32>
|
||||
Definition: Specifies the MAC id.
|
||||
|
||||
The cell-index value may be used by the FMan or the SoC, to
|
||||
identify the MAC unit in the FMan (or SoC) memory map.
|
||||
In the tables below there's a description of the cell-index
|
||||
use, there are two tables, one describes the use of cell-index
|
||||
by the FMan, the second describes the use by the SoC:
|
||||
|
||||
1. FMan Registers
|
||||
|
||||
FManV2:
|
||||
register[bit] MAC cell-index
|
||||
============================================================
|
||||
FM_EPI[16] XGEC 8
|
||||
FM_EPI[16+n] dTSECn n-1
|
||||
FM_NPI[11+n] dTSECn n-1
|
||||
n = 1,..,5
|
||||
|
||||
FManV3:
|
||||
register[bit] MAC cell-index
|
||||
============================================================
|
||||
FM_EPI[16+n] mEMACn n-1
|
||||
FM_EPI[25] mEMAC10 9
|
||||
|
||||
FM_NPI[11+n] mEMACn n-1
|
||||
FM_NPI[10] mEMAC10 9
|
||||
FM_NPI[11] mEMAC9 8
|
||||
n = 1,..8
|
||||
|
||||
FM_EPI and FM_NPI are located in the FMan memory map.
|
||||
|
||||
2. SoC registers:
|
||||
|
||||
- P2041, P3041, P4080 P5020, P5040:
|
||||
register[bit] FMan MAC cell
|
||||
Unit index
|
||||
============================================================
|
||||
DCFG_DEVDISR2[7] 1 XGEC 8
|
||||
DCFG_DEVDISR2[7+n] 1 dTSECn n-1
|
||||
DCFG_DEVDISR2[15] 2 XGEC 8
|
||||
DCFG_DEVDISR2[15+n] 2 dTSECn n-1
|
||||
n = 1,..5
|
||||
|
||||
- T1040, T2080, T4240, B4860:
|
||||
register[bit] FMan MAC cell
|
||||
Unit index
|
||||
============================================================
|
||||
DCFG_CCSR_DEVDISR2[n-1] 1 mEMACn n-1
|
||||
DCFG_CCSR_DEVDISR2[11+n] 2 mEMACn n-1
|
||||
n = 1,..6,9,10
|
||||
|
||||
EVDISR, DCFG_DEVDISR2 and DCFG_CCSR_DEVDISR2 are located in
|
||||
the specific SoC "Device Configuration/Pin Control" Memory
|
||||
Map.
|
||||
|
||||
- reg
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: A standard property.
|
||||
|
||||
- fsl,fman-ports
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: An array of two phandles - the first references is
|
||||
the FMan RX port and the second is the TX port used by this
|
||||
MAC.
|
||||
|
||||
- ptp-timer
|
||||
Usage required
|
||||
Value type: <phandle>
|
||||
Definition: A phandle for 1EEE1588 timer.
|
||||
|
||||
- pcsphy-handle
|
||||
Usage required for "fsl,fman-memac" MACs
|
||||
Value type: <phandle>
|
||||
Definition: A phandle for pcsphy.
|
||||
|
||||
- tbi-handle
|
||||
Usage required for "fsl,fman-dtsec" MACs
|
||||
Value type: <phandle>
|
||||
Definition: A phandle for tbiphy.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
fman1_tx28: port@a8000 {
|
||||
cell-index = <0x28>;
|
||||
compatible = "fsl,fman-v2-port-tx";
|
||||
reg = <0xa8000 0x1000>;
|
||||
};
|
||||
|
||||
fman1_rx8: port@88000 {
|
||||
cell-index = <0x8>;
|
||||
compatible = "fsl,fman-v2-port-rx";
|
||||
reg = <0x88000 0x1000>;
|
||||
};
|
||||
|
||||
ptp-timer: ptp_timer@fe000 {
|
||||
compatible = "fsl,fman-ptp-timer";
|
||||
reg = <0xfe000 0x1000>;
|
||||
};
|
||||
|
||||
ethernet@e0000 {
|
||||
compatible = "fsl,fman-dtsec";
|
||||
cell-index = <0>;
|
||||
reg = <0xe0000 0x1000>;
|
||||
fsl,fman-ports = <&fman1_rx8 &fman1_tx28>;
|
||||
ptp-timer = <&ptp-timer>;
|
||||
tbi-handle = <&tbi0>;
|
||||
};
|
||||
Refer to Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml
|
||||
|
||||
============================================================================
|
||||
FMan IEEE 1588 Node
|
||||
|
|
|
@ -288,9 +288,11 @@ static int dpaa_stop(struct net_device *net_dev)
|
|||
*/
|
||||
msleep(200);
|
||||
|
||||
err = mac_dev->stop(mac_dev);
|
||||
if (mac_dev->phy_dev)
|
||||
phy_stop(mac_dev->phy_dev);
|
||||
err = mac_dev->disable(mac_dev->fman_mac);
|
||||
if (err < 0)
|
||||
netif_err(priv, ifdown, net_dev, "mac_dev->stop() = %d\n",
|
||||
netif_err(priv, ifdown, net_dev, "mac_dev->disable() = %d\n",
|
||||
err);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
|
||||
|
@ -2942,11 +2944,12 @@ static int dpaa_open(struct net_device *net_dev)
|
|||
goto mac_start_failed;
|
||||
}
|
||||
|
||||
err = priv->mac_dev->start(mac_dev);
|
||||
err = priv->mac_dev->enable(mac_dev->fman_mac);
|
||||
if (err < 0) {
|
||||
netif_err(priv, ifup, net_dev, "mac_dev->start() = %d\n", err);
|
||||
netif_err(priv, ifup, net_dev, "mac_dev->enable() = %d\n", err);
|
||||
goto mac_start_failed;
|
||||
}
|
||||
phy_start(priv->mac_dev->phy_dev);
|
||||
|
||||
netif_tx_start_all_queues(net_dev);
|
||||
|
||||
|
|
|
@ -1,34 +1,7 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2020 NXP
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
|
|
@ -1,34 +1,7 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2020 NXP
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __FM_H
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
@ -860,25 +833,20 @@ int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void graceful_start(struct fman_mac *dtsec, enum comm_mode mode)
|
||||
static void graceful_start(struct fman_mac *dtsec)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
|
||||
if (mode & COMM_MODE_TX)
|
||||
iowrite32be(ioread32be(®s->tctrl) &
|
||||
~TCTRL_GTS, ®s->tctrl);
|
||||
if (mode & COMM_MODE_RX)
|
||||
iowrite32be(ioread32be(®s->rctrl) &
|
||||
~RCTRL_GRS, ®s->rctrl);
|
||||
iowrite32be(ioread32be(®s->tctrl) & ~TCTRL_GTS, ®s->tctrl);
|
||||
iowrite32be(ioread32be(®s->rctrl) & ~RCTRL_GRS, ®s->rctrl);
|
||||
}
|
||||
|
||||
static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode)
|
||||
static void graceful_stop(struct fman_mac *dtsec)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
u32 tmp;
|
||||
|
||||
/* Graceful stop - Assert the graceful Rx stop bit */
|
||||
if (mode & COMM_MODE_RX) {
|
||||
tmp = ioread32be(®s->rctrl) | RCTRL_GRS;
|
||||
iowrite32be(tmp, ®s->rctrl);
|
||||
|
||||
|
@ -889,10 +857,8 @@ static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode)
|
|||
/* Workaround for dTSEC Errata A004839 */
|
||||
usleep_range(10, 50);
|
||||
}
|
||||
}
|
||||
|
||||
/* Graceful stop - Assert the graceful Tx stop bit */
|
||||
if (mode & COMM_MODE_TX) {
|
||||
if (dtsec->fm_rev_info.major == 2) {
|
||||
/* dTSEC Errata A004: Do not use TCTRL[GTS]=1 */
|
||||
pr_debug("GTS not supported due to DTSEC_A004 Errata.\n");
|
||||
|
@ -903,10 +869,9 @@ static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode)
|
|||
/* Workaround for dTSEC Errata A0012, A0014 */
|
||||
usleep_range(10, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode)
|
||||
int dtsec_enable(struct fman_mac *dtsec)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
u32 tmp;
|
||||
|
@ -916,20 +881,16 @@ int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode)
|
|||
|
||||
/* Enable */
|
||||
tmp = ioread32be(®s->maccfg1);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp |= MACCFG1_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp |= MACCFG1_TX_EN;
|
||||
|
||||
tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN;
|
||||
iowrite32be(tmp, ®s->maccfg1);
|
||||
|
||||
/* Graceful start - clear the graceful Rx/Tx stop bit */
|
||||
graceful_start(dtsec, mode);
|
||||
graceful_start(dtsec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode)
|
||||
int dtsec_disable(struct fman_mac *dtsec)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
u32 tmp;
|
||||
|
@ -938,14 +899,10 @@ int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
/* Graceful stop - Assert the graceful Rx/Tx stop bit */
|
||||
graceful_stop(dtsec, mode);
|
||||
graceful_stop(dtsec);
|
||||
|
||||
tmp = ioread32be(®s->maccfg1);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp &= ~MACCFG1_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp &= ~MACCFG1_TX_EN;
|
||||
|
||||
tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN);
|
||||
iowrite32be(tmp, ®s->maccfg1);
|
||||
|
||||
return 0;
|
||||
|
@ -956,18 +913,12 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec,
|
|||
u16 pause_time, u16 __maybe_unused thresh_time)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
enum comm_mode mode = COMM_MODE_NONE;
|
||||
u32 ptv = 0;
|
||||
|
||||
if (!is_init_done(dtsec->dtsec_drv_param))
|
||||
return -EINVAL;
|
||||
|
||||
if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0)
|
||||
mode |= COMM_MODE_RX;
|
||||
if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0)
|
||||
mode |= COMM_MODE_TX;
|
||||
|
||||
graceful_stop(dtsec, mode);
|
||||
graceful_stop(dtsec);
|
||||
|
||||
if (pause_time) {
|
||||
/* FM_BAD_TX_TS_IN_B_2_B_ERRATA_DTSEC_A003 Errata workaround */
|
||||
|
@ -989,7 +940,7 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec,
|
|||
iowrite32be(ioread32be(®s->maccfg1) & ~MACCFG1_TX_FLOW,
|
||||
®s->maccfg1);
|
||||
|
||||
graceful_start(dtsec, mode);
|
||||
graceful_start(dtsec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -997,18 +948,12 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec,
|
|||
int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
enum comm_mode mode = COMM_MODE_NONE;
|
||||
u32 tmp;
|
||||
|
||||
if (!is_init_done(dtsec->dtsec_drv_param))
|
||||
return -EINVAL;
|
||||
|
||||
if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0)
|
||||
mode |= COMM_MODE_RX;
|
||||
if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0)
|
||||
mode |= COMM_MODE_TX;
|
||||
|
||||
graceful_stop(dtsec, mode);
|
||||
graceful_stop(dtsec);
|
||||
|
||||
tmp = ioread32be(®s->maccfg1);
|
||||
if (en)
|
||||
|
@ -1017,25 +962,17 @@ int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en)
|
|||
tmp &= ~MACCFG1_RX_FLOW;
|
||||
iowrite32be(tmp, ®s->maccfg1);
|
||||
|
||||
graceful_start(dtsec, mode);
|
||||
graceful_start(dtsec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
enum comm_mode mode = COMM_MODE_NONE;
|
||||
|
||||
if (!is_init_done(dtsec->dtsec_drv_param))
|
||||
return -EINVAL;
|
||||
|
||||
if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0)
|
||||
mode |= COMM_MODE_RX;
|
||||
if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0)
|
||||
mode |= COMM_MODE_TX;
|
||||
|
||||
graceful_stop(dtsec, mode);
|
||||
graceful_stop(dtsec);
|
||||
|
||||
/* Initialize MAC Station Address registers (1 & 2)
|
||||
* Station address have to be swapped (big endian to little endian
|
||||
|
@ -1043,7 +980,7 @@ int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_add
|
|||
dtsec->addr = ENET_ADDR_TO_UINT64(*enet_addr);
|
||||
set_mac_address(dtsec->regs, (const u8 *)(*enet_addr));
|
||||
|
||||
graceful_start(dtsec, mode);
|
||||
graceful_start(dtsec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1261,18 +1198,12 @@ int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val)
|
|||
int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed)
|
||||
{
|
||||
struct dtsec_regs __iomem *regs = dtsec->regs;
|
||||
enum comm_mode mode = COMM_MODE_NONE;
|
||||
u32 tmp;
|
||||
|
||||
if (!is_init_done(dtsec->dtsec_drv_param))
|
||||
return -EINVAL;
|
||||
|
||||
if ((ioread32be(®s->rctrl) & RCTRL_GRS) == 0)
|
||||
mode |= COMM_MODE_RX;
|
||||
if ((ioread32be(®s->tctrl) & TCTRL_GTS) == 0)
|
||||
mode |= COMM_MODE_TX;
|
||||
|
||||
graceful_stop(dtsec, mode);
|
||||
graceful_stop(dtsec);
|
||||
|
||||
tmp = ioread32be(®s->maccfg2);
|
||||
|
||||
|
@ -1293,7 +1224,7 @@ int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed)
|
|||
tmp &= ~DTSEC_ECNTRL_R100M;
|
||||
iowrite32be(tmp, ®s->ecntrl);
|
||||
|
||||
graceful_start(dtsec, mode);
|
||||
graceful_start(dtsec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#ifndef __DTSEC_H
|
||||
|
@ -43,8 +16,8 @@ int dtsec_adjust_link(struct fman_mac *dtsec,
|
|||
int dtsec_restart_autoneg(struct fman_mac *dtsec);
|
||||
int dtsec_cfg_max_frame_len(struct fman_mac *dtsec, u16 new_val);
|
||||
int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val);
|
||||
int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode);
|
||||
int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode);
|
||||
int dtsec_enable(struct fman_mac *dtsec);
|
||||
int dtsec_disable(struct fman_mac *dtsec);
|
||||
int dtsec_init(struct fman_mac *dtsec);
|
||||
int dtsec_free(struct fman_mac *dtsec);
|
||||
int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en);
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2017 NXP
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of NXP nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NXP BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2017 NXP
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of NXP nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NXP BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __KEYGEN_H
|
||||
|
|
|
@ -75,16 +75,6 @@ typedef u8 enet_addr_t[ETH_ALEN];
|
|||
#define ETH_HASH_ENTRY_OBJ(ptr) \
|
||||
hlist_entry_safe(ptr, struct eth_hash_entry, node)
|
||||
|
||||
/* Enumeration (bit flags) of communication modes (Transmit,
|
||||
* receive or both).
|
||||
*/
|
||||
enum comm_mode {
|
||||
COMM_MODE_NONE = 0, /* No transmit/receive communication */
|
||||
COMM_MODE_RX = 1, /* Only receive communication */
|
||||
COMM_MODE_TX = 2, /* Only transmit communication */
|
||||
COMM_MODE_RX_AND_TX = 3 /* Both transmit and receive communication */
|
||||
};
|
||||
|
||||
/* FM MAC Exceptions */
|
||||
enum fman_mac_exceptions {
|
||||
FM_MAC_EX_10G_MDIO_SCAN_EVENT = 0
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
@ -712,7 +685,7 @@ static bool is_init_done(struct memac_cfg *memac_drv_params)
|
|||
return false;
|
||||
}
|
||||
|
||||
int memac_enable(struct fman_mac *memac, enum comm_mode mode)
|
||||
int memac_enable(struct fman_mac *memac)
|
||||
{
|
||||
struct memac_regs __iomem *regs = memac->regs;
|
||||
u32 tmp;
|
||||
|
@ -721,17 +694,13 @@ int memac_enable(struct fman_mac *memac, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp |= CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp |= CMD_CFG_TX_EN;
|
||||
|
||||
tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN;
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int memac_disable(struct fman_mac *memac, enum comm_mode mode)
|
||||
int memac_disable(struct fman_mac *memac)
|
||||
{
|
||||
struct memac_regs __iomem *regs = memac->regs;
|
||||
u32 tmp;
|
||||
|
@ -740,11 +709,7 @@ int memac_disable(struct fman_mac *memac, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp &= ~CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp &= ~CMD_CFG_TX_EN;
|
||||
|
||||
tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN);
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#ifndef __MEMAC_H
|
||||
|
@ -46,8 +19,8 @@ int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val);
|
|||
int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable);
|
||||
int memac_cfg_fixed_link(struct fman_mac *memac,
|
||||
struct fixed_phy_status *fixed_link);
|
||||
int memac_enable(struct fman_mac *memac, enum comm_mode mode);
|
||||
int memac_disable(struct fman_mac *memac, enum comm_mode mode);
|
||||
int memac_enable(struct fman_mac *memac);
|
||||
int memac_disable(struct fman_mac *memac);
|
||||
int memac_init(struct fman_mac *memac);
|
||||
int memac_free(struct fman_mac *memac);
|
||||
int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en);
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#include "fman_muram.h"
|
||||
|
|
|
@ -1,34 +1,8 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#ifndef __FM_MURAM_EXT
|
||||
#define __FM_MURAM_EXT
|
||||
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __FMAN_PORT_H
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "fman_sp.h"
|
||||
|
|
|
@ -1,32 +1,6 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __FM_SP_H
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
@ -419,7 +392,7 @@ static bool is_init_done(struct tgec_cfg *cfg)
|
|||
return false;
|
||||
}
|
||||
|
||||
int tgec_enable(struct fman_mac *tgec, enum comm_mode mode)
|
||||
int tgec_enable(struct fman_mac *tgec)
|
||||
{
|
||||
struct tgec_regs __iomem *regs = tgec->regs;
|
||||
u32 tmp;
|
||||
|
@ -428,16 +401,13 @@ int tgec_enable(struct fman_mac *tgec, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp |= CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp |= CMD_CFG_TX_EN;
|
||||
tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN;
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tgec_disable(struct fman_mac *tgec, enum comm_mode mode)
|
||||
int tgec_disable(struct fman_mac *tgec)
|
||||
{
|
||||
struct tgec_regs __iomem *regs = tgec->regs;
|
||||
u32 tmp;
|
||||
|
@ -446,10 +416,7 @@ int tgec_disable(struct fman_mac *tgec, enum comm_mode mode)
|
|||
return -EINVAL;
|
||||
|
||||
tmp = ioread32be(®s->command_config);
|
||||
if (mode & COMM_MODE_RX)
|
||||
tmp &= ~CMD_CFG_RX_EN;
|
||||
if (mode & COMM_MODE_TX)
|
||||
tmp &= ~CMD_CFG_TX_EN;
|
||||
tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN);
|
||||
iowrite32be(tmp, ®s->command_config);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008-2015 Freescale Semiconductor Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#ifndef __TGEC_H
|
||||
|
@ -39,8 +12,8 @@ struct fman_mac *tgec_config(struct fman_mac_params *params);
|
|||
int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val);
|
||||
int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *enet_addr);
|
||||
int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val);
|
||||
int tgec_enable(struct fman_mac *tgec, enum comm_mode mode);
|
||||
int tgec_disable(struct fman_mac *tgec, enum comm_mode mode);
|
||||
int tgec_enable(struct fman_mac *tgec);
|
||||
int tgec_disable(struct fman_mac *tgec);
|
||||
int tgec_init(struct fman_mac *tgec);
|
||||
int tgec_free(struct fman_mac *tgec);
|
||||
int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en);
|
||||
|
|
|
@ -1,32 +1,6 @@
|
|||
/* Copyright 2008-2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
@ -54,20 +28,14 @@ MODULE_LICENSE("Dual BSD/GPL");
|
|||
MODULE_DESCRIPTION("FSL FMan MAC API based driver");
|
||||
|
||||
struct mac_priv_s {
|
||||
struct device *dev;
|
||||
void __iomem *vaddr;
|
||||
u8 cell_index;
|
||||
struct fman *fman;
|
||||
struct device_node *internal_phy_node;
|
||||
/* List of multicast addresses */
|
||||
struct list_head mc_addr_list;
|
||||
struct platform_device *eth_dev;
|
||||
struct fixed_phy_status *fixed_link;
|
||||
u16 speed;
|
||||
u16 max_speed;
|
||||
|
||||
int (*enable)(struct fman_mac *mac_dev, enum comm_mode mode);
|
||||
int (*disable)(struct fman_mac *mac_dev, enum comm_mode mode);
|
||||
};
|
||||
|
||||
struct mac_address {
|
||||
|
@ -77,30 +45,26 @@ struct mac_address {
|
|||
|
||||
static void mac_exception(void *handle, enum fman_mac_exceptions ex)
|
||||
{
|
||||
struct mac_device *mac_dev;
|
||||
struct mac_priv_s *priv;
|
||||
|
||||
mac_dev = handle;
|
||||
priv = mac_dev->priv;
|
||||
struct mac_device *mac_dev = handle;
|
||||
|
||||
if (ex == FM_MAC_EX_10G_RX_FIFO_OVFL) {
|
||||
/* don't flag RX FIFO after the first */
|
||||
mac_dev->set_exception(mac_dev->fman_mac,
|
||||
FM_MAC_EX_10G_RX_FIFO_OVFL, false);
|
||||
dev_err(priv->dev, "10G MAC got RX FIFO Error = %x\n", ex);
|
||||
dev_err(mac_dev->dev, "10G MAC got RX FIFO Error = %x\n", ex);
|
||||
}
|
||||
|
||||
dev_dbg(priv->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c",
|
||||
dev_dbg(mac_dev->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c",
|
||||
__func__, ex);
|
||||
}
|
||||
|
||||
static int set_fman_mac_params(struct mac_device *mac_dev,
|
||||
int set_fman_mac_params(struct mac_device *mac_dev,
|
||||
struct fman_mac_params *params)
|
||||
{
|
||||
struct mac_priv_s *priv = mac_dev->priv;
|
||||
|
||||
params->base_addr = (typeof(params->base_addr))
|
||||
devm_ioremap(priv->dev, mac_dev->res->start,
|
||||
devm_ioremap(mac_dev->dev, mac_dev->res->start,
|
||||
resource_size(mac_dev->res));
|
||||
if (!params->base_addr)
|
||||
return -ENOMEM;
|
||||
|
@ -114,183 +78,11 @@ static int set_fman_mac_params(struct mac_device *mac_dev,
|
|||
params->exception_cb = mac_exception;
|
||||
params->event_cb = mac_exception;
|
||||
params->dev_id = mac_dev;
|
||||
params->internal_phy_node = priv->internal_phy_node;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tgec_initialization(struct mac_device *mac_dev)
|
||||
{
|
||||
int err;
|
||||
struct mac_priv_s *priv;
|
||||
struct fman_mac_params params;
|
||||
u32 version;
|
||||
|
||||
priv = mac_dev->priv;
|
||||
|
||||
err = set_fman_mac_params(mac_dev, ¶ms);
|
||||
if (err)
|
||||
goto _return;
|
||||
|
||||
mac_dev->fman_mac = tgec_config(¶ms);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm());
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = tgec_init(mac_dev->fman_mac);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
/* For 10G MAC, disable Tx ECC exception */
|
||||
err = mac_dev->set_exception(mac_dev->fman_mac,
|
||||
FM_MAC_EX_10G_TX_ECC_ER, false);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = tgec_get_version(mac_dev->fman_mac, &version);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
dev_info(priv->dev, "FMan XGEC version: 0x%08x\n", version);
|
||||
|
||||
goto _return;
|
||||
|
||||
_return_fm_mac_free:
|
||||
tgec_free(mac_dev->fman_mac);
|
||||
|
||||
_return:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int dtsec_initialization(struct mac_device *mac_dev)
|
||||
{
|
||||
int err;
|
||||
struct mac_priv_s *priv;
|
||||
struct fman_mac_params params;
|
||||
u32 version;
|
||||
|
||||
priv = mac_dev->priv;
|
||||
|
||||
err = set_fman_mac_params(mac_dev, ¶ms);
|
||||
if (err)
|
||||
goto _return;
|
||||
|
||||
mac_dev->fman_mac = dtsec_config(¶ms);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm());
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = dtsec_init(mac_dev->fman_mac);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
/* For 1G MAC, disable by default the MIB counters overflow interrupt */
|
||||
err = mac_dev->set_exception(mac_dev->fman_mac,
|
||||
FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = dtsec_get_version(mac_dev->fman_mac, &version);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
dev_info(priv->dev, "FMan dTSEC version: 0x%08x\n", version);
|
||||
|
||||
goto _return;
|
||||
|
||||
_return_fm_mac_free:
|
||||
dtsec_free(mac_dev->fman_mac);
|
||||
|
||||
_return:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int memac_initialization(struct mac_device *mac_dev)
|
||||
{
|
||||
int err;
|
||||
struct mac_priv_s *priv;
|
||||
struct fman_mac_params params;
|
||||
|
||||
priv = mac_dev->priv;
|
||||
|
||||
err = set_fman_mac_params(mac_dev, ¶ms);
|
||||
if (err)
|
||||
goto _return;
|
||||
|
||||
if (priv->max_speed == SPEED_10000)
|
||||
params.phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
|
||||
mac_dev->fman_mac = memac_config(¶ms);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm());
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = memac_cfg_reset_on_init(mac_dev->fman_mac, true);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = memac_cfg_fixed_link(mac_dev->fman_mac, priv->fixed_link);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = memac_init(mac_dev->fman_mac);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
dev_info(priv->dev, "FMan MEMAC\n");
|
||||
|
||||
goto _return;
|
||||
|
||||
_return_fm_mac_free:
|
||||
memac_free(mac_dev->fman_mac);
|
||||
|
||||
_return:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int start(struct mac_device *mac_dev)
|
||||
{
|
||||
int err;
|
||||
struct phy_device *phy_dev = mac_dev->phy_dev;
|
||||
struct mac_priv_s *priv = mac_dev->priv;
|
||||
|
||||
err = priv->enable(mac_dev->fman_mac, COMM_MODE_RX_AND_TX);
|
||||
if (!err && phy_dev)
|
||||
phy_start(phy_dev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int stop(struct mac_device *mac_dev)
|
||||
{
|
||||
struct mac_priv_s *priv = mac_dev->priv;
|
||||
|
||||
if (mac_dev->phy_dev)
|
||||
phy_stop(mac_dev->phy_dev);
|
||||
|
||||
return priv->disable(mac_dev->fman_mac, COMM_MODE_RX_AND_TX);
|
||||
}
|
||||
|
||||
static int set_multi(struct net_device *net_dev, struct mac_device *mac_dev)
|
||||
int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev)
|
||||
{
|
||||
struct mac_priv_s *priv;
|
||||
struct mac_address *old_addr, *tmp;
|
||||
|
@ -446,7 +238,7 @@ static void adjust_link_dtsec(struct mac_device *mac_dev)
|
|||
fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
|
||||
err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
|
||||
if (err < 0)
|
||||
dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
|
||||
dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n",
|
||||
err);
|
||||
}
|
||||
|
||||
|
@ -463,33 +255,17 @@ static void adjust_link_memac(struct mac_device *mac_dev)
|
|||
fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
|
||||
err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
|
||||
if (err < 0)
|
||||
dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
|
||||
dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n",
|
||||
err);
|
||||
}
|
||||
|
||||
static void setup_dtsec(struct mac_device *mac_dev)
|
||||
static int tgec_initialization(struct mac_device *mac_dev,
|
||||
struct device_node *mac_node)
|
||||
{
|
||||
mac_dev->init = dtsec_initialization;
|
||||
mac_dev->set_promisc = dtsec_set_promiscuous;
|
||||
mac_dev->change_addr = dtsec_modify_mac_address;
|
||||
mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address;
|
||||
mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address;
|
||||
mac_dev->set_tx_pause = dtsec_set_tx_pause_frames;
|
||||
mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames;
|
||||
mac_dev->set_exception = dtsec_set_exception;
|
||||
mac_dev->set_allmulti = dtsec_set_allmulti;
|
||||
mac_dev->set_tstamp = dtsec_set_tstamp;
|
||||
mac_dev->set_multi = set_multi;
|
||||
mac_dev->start = start;
|
||||
mac_dev->stop = stop;
|
||||
mac_dev->adjust_link = adjust_link_dtsec;
|
||||
mac_dev->priv->enable = dtsec_enable;
|
||||
mac_dev->priv->disable = dtsec_disable;
|
||||
}
|
||||
int err;
|
||||
struct fman_mac_params params;
|
||||
u32 version;
|
||||
|
||||
static void setup_tgec(struct mac_device *mac_dev)
|
||||
{
|
||||
mac_dev->init = tgec_initialization;
|
||||
mac_dev->set_promisc = tgec_set_promiscuous;
|
||||
mac_dev->change_addr = tgec_modify_mac_address;
|
||||
mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address;
|
||||
|
@ -499,17 +275,122 @@ static void setup_tgec(struct mac_device *mac_dev)
|
|||
mac_dev->set_exception = tgec_set_exception;
|
||||
mac_dev->set_allmulti = tgec_set_allmulti;
|
||||
mac_dev->set_tstamp = tgec_set_tstamp;
|
||||
mac_dev->set_multi = set_multi;
|
||||
mac_dev->start = start;
|
||||
mac_dev->stop = stop;
|
||||
mac_dev->set_multi = fman_set_multi;
|
||||
mac_dev->adjust_link = adjust_link_void;
|
||||
mac_dev->priv->enable = tgec_enable;
|
||||
mac_dev->priv->disable = tgec_disable;
|
||||
mac_dev->enable = tgec_enable;
|
||||
mac_dev->disable = tgec_disable;
|
||||
|
||||
err = set_fman_mac_params(mac_dev, ¶ms);
|
||||
if (err)
|
||||
goto _return;
|
||||
|
||||
mac_dev->fman_mac = tgec_config(¶ms);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
err = tgec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm());
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = tgec_init(mac_dev->fman_mac);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
/* For 10G MAC, disable Tx ECC exception */
|
||||
err = mac_dev->set_exception(mac_dev->fman_mac,
|
||||
FM_MAC_EX_10G_TX_ECC_ER, false);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = tgec_get_version(mac_dev->fman_mac, &version);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
dev_info(mac_dev->dev, "FMan XGEC version: 0x%08x\n", version);
|
||||
|
||||
goto _return;
|
||||
|
||||
_return_fm_mac_free:
|
||||
tgec_free(mac_dev->fman_mac);
|
||||
|
||||
_return:
|
||||
return err;
|
||||
}
|
||||
|
||||
static void setup_memac(struct mac_device *mac_dev)
|
||||
static int dtsec_initialization(struct mac_device *mac_dev,
|
||||
struct device_node *mac_node)
|
||||
{
|
||||
mac_dev->init = memac_initialization;
|
||||
int err;
|
||||
struct fman_mac_params params;
|
||||
u32 version;
|
||||
|
||||
mac_dev->set_promisc = dtsec_set_promiscuous;
|
||||
mac_dev->change_addr = dtsec_modify_mac_address;
|
||||
mac_dev->add_hash_mac_addr = dtsec_add_hash_mac_address;
|
||||
mac_dev->remove_hash_mac_addr = dtsec_del_hash_mac_address;
|
||||
mac_dev->set_tx_pause = dtsec_set_tx_pause_frames;
|
||||
mac_dev->set_rx_pause = dtsec_accept_rx_pause_frames;
|
||||
mac_dev->set_exception = dtsec_set_exception;
|
||||
mac_dev->set_allmulti = dtsec_set_allmulti;
|
||||
mac_dev->set_tstamp = dtsec_set_tstamp;
|
||||
mac_dev->set_multi = fman_set_multi;
|
||||
mac_dev->adjust_link = adjust_link_dtsec;
|
||||
mac_dev->enable = dtsec_enable;
|
||||
mac_dev->disable = dtsec_disable;
|
||||
|
||||
err = set_fman_mac_params(mac_dev, ¶ms);
|
||||
if (err)
|
||||
goto _return;
|
||||
params.internal_phy_node = of_parse_phandle(mac_node, "tbi-handle", 0);
|
||||
|
||||
mac_dev->fman_mac = dtsec_config(¶ms);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
err = dtsec_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm());
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = dtsec_cfg_pad_and_crc(mac_dev->fman_mac, true);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = dtsec_init(mac_dev->fman_mac);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
/* For 1G MAC, disable by default the MIB counters overflow interrupt */
|
||||
err = mac_dev->set_exception(mac_dev->fman_mac,
|
||||
FM_MAC_EX_1G_RX_MIB_CNT_OVFL, false);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = dtsec_get_version(mac_dev->fman_mac, &version);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version);
|
||||
|
||||
goto _return;
|
||||
|
||||
_return_fm_mac_free:
|
||||
dtsec_free(mac_dev->fman_mac);
|
||||
|
||||
_return:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int memac_initialization(struct mac_device *mac_dev,
|
||||
struct device_node *mac_node)
|
||||
{
|
||||
int err;
|
||||
struct fman_mac_params params;
|
||||
struct fixed_phy_status *fixed_link;
|
||||
|
||||
mac_dev->set_promisc = memac_set_promiscuous;
|
||||
mac_dev->change_addr = memac_modify_mac_address;
|
||||
mac_dev->add_hash_mac_addr = memac_add_hash_mac_address;
|
||||
|
@ -519,12 +400,81 @@ static void setup_memac(struct mac_device *mac_dev)
|
|||
mac_dev->set_exception = memac_set_exception;
|
||||
mac_dev->set_allmulti = memac_set_allmulti;
|
||||
mac_dev->set_tstamp = memac_set_tstamp;
|
||||
mac_dev->set_multi = set_multi;
|
||||
mac_dev->start = start;
|
||||
mac_dev->stop = stop;
|
||||
mac_dev->set_multi = fman_set_multi;
|
||||
mac_dev->adjust_link = adjust_link_memac;
|
||||
mac_dev->priv->enable = memac_enable;
|
||||
mac_dev->priv->disable = memac_disable;
|
||||
mac_dev->enable = memac_enable;
|
||||
mac_dev->disable = memac_disable;
|
||||
|
||||
err = set_fman_mac_params(mac_dev, ¶ms);
|
||||
if (err)
|
||||
goto _return;
|
||||
params.internal_phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0);
|
||||
|
||||
if (params.max_speed == SPEED_10000)
|
||||
params.phy_if = PHY_INTERFACE_MODE_XGMII;
|
||||
|
||||
mac_dev->fman_mac = memac_config(¶ms);
|
||||
if (!mac_dev->fman_mac) {
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
err = memac_cfg_max_frame_len(mac_dev->fman_mac, fman_get_max_frm());
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
err = memac_cfg_reset_on_init(mac_dev->fman_mac, true);
|
||||
if (err < 0)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
|
||||
struct phy_device *phy;
|
||||
|
||||
err = of_phy_register_fixed_link(mac_node);
|
||||
if (err)
|
||||
goto _return_fm_mac_free;
|
||||
|
||||
fixed_link = kzalloc(sizeof(*fixed_link), GFP_KERNEL);
|
||||
if (!fixed_link) {
|
||||
err = -ENOMEM;
|
||||
goto _return_fm_mac_free;
|
||||
}
|
||||
|
||||
mac_dev->phy_node = of_node_get(mac_node);
|
||||
phy = of_phy_find_device(mac_dev->phy_node);
|
||||
if (!phy) {
|
||||
err = -EINVAL;
|
||||
of_node_put(mac_dev->phy_node);
|
||||
goto _return_fixed_link_free;
|
||||
}
|
||||
|
||||
fixed_link->link = phy->link;
|
||||
fixed_link->speed = phy->speed;
|
||||
fixed_link->duplex = phy->duplex;
|
||||
fixed_link->pause = phy->pause;
|
||||
fixed_link->asym_pause = phy->asym_pause;
|
||||
|
||||
put_device(&phy->mdio.dev);
|
||||
|
||||
err = memac_cfg_fixed_link(mac_dev->fman_mac, fixed_link);
|
||||
if (err < 0)
|
||||
goto _return_fixed_link_free;
|
||||
}
|
||||
|
||||
err = memac_init(mac_dev->fman_mac);
|
||||
if (err < 0)
|
||||
goto _return_fixed_link_free;
|
||||
|
||||
dev_info(mac_dev->dev, "FMan MEMAC\n");
|
||||
|
||||
goto _return;
|
||||
|
||||
_return_fixed_link_free:
|
||||
kfree(fixed_link);
|
||||
_return_fm_mac_free:
|
||||
memac_free(mac_dev->fman_mac);
|
||||
_return:
|
||||
return err;
|
||||
}
|
||||
|
||||
#define DTSEC_SUPPORTED \
|
||||
|
@ -577,7 +527,7 @@ static struct platform_device *dpaa_eth_add_device(int fman_id,
|
|||
goto no_mem;
|
||||
}
|
||||
|
||||
pdev->dev.parent = priv->dev;
|
||||
pdev->dev.parent = mac_dev->dev;
|
||||
|
||||
ret = platform_device_add_data(pdev, &data, sizeof(data));
|
||||
if (ret)
|
||||
|
@ -601,9 +551,9 @@ no_mem:
|
|||
}
|
||||
|
||||
static const struct of_device_id mac_match[] = {
|
||||
{ .compatible = "fsl,fman-dtsec" },
|
||||
{ .compatible = "fsl,fman-xgec" },
|
||||
{ .compatible = "fsl,fman-memac" },
|
||||
{ .compatible = "fsl,fman-dtsec", .data = dtsec_initialization },
|
||||
{ .compatible = "fsl,fman-xgec", .data = tgec_initialization },
|
||||
{ .compatible = "fsl,fman-memac", .data = memac_initialization },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mac_match);
|
||||
|
@ -611,6 +561,7 @@ MODULE_DEVICE_TABLE(of, mac_match);
|
|||
static int mac_probe(struct platform_device *_of_dev)
|
||||
{
|
||||
int err, i, nph;
|
||||
int (*init)(struct mac_device *mac_dev, struct device_node *mac_node);
|
||||
struct device *dev;
|
||||
struct device_node *mac_node, *dev_node;
|
||||
struct mac_device *mac_dev;
|
||||
|
@ -623,6 +574,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
|
||||
dev = &_of_dev->dev;
|
||||
mac_node = dev->of_node;
|
||||
init = of_device_get_match_data(dev);
|
||||
|
||||
mac_dev = devm_kzalloc(dev, sizeof(*mac_dev), GFP_KERNEL);
|
||||
if (!mac_dev) {
|
||||
|
@ -637,24 +589,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
|
||||
/* Save private information */
|
||||
mac_dev->priv = priv;
|
||||
priv->dev = dev;
|
||||
|
||||
if (of_device_is_compatible(mac_node, "fsl,fman-dtsec")) {
|
||||
setup_dtsec(mac_dev);
|
||||
priv->internal_phy_node = of_parse_phandle(mac_node,
|
||||
"tbi-handle", 0);
|
||||
} else if (of_device_is_compatible(mac_node, "fsl,fman-xgec")) {
|
||||
setup_tgec(mac_dev);
|
||||
} else if (of_device_is_compatible(mac_node, "fsl,fman-memac")) {
|
||||
setup_memac(mac_dev);
|
||||
priv->internal_phy_node = of_parse_phandle(mac_node,
|
||||
"pcsphy-handle", 0);
|
||||
} else {
|
||||
dev_err(dev, "MAC node (%pOF) contains unsupported MAC\n",
|
||||
mac_node);
|
||||
err = -EINVAL;
|
||||
goto _return;
|
||||
}
|
||||
mac_dev->dev = dev;
|
||||
|
||||
INIT_LIST_HEAD(&priv->mc_addr_list);
|
||||
|
||||
|
@ -664,7 +599,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
dev_err(dev, "of_get_parent(%pOF) failed\n",
|
||||
mac_node);
|
||||
err = -EINVAL;
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
of_dev = of_find_device_by_node(dev_node);
|
||||
|
@ -698,7 +633,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
if (err < 0) {
|
||||
dev_err(dev, "of_address_to_resource(%pOF) = %d\n",
|
||||
mac_node, err);
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
mac_dev->res = __devm_request_region(dev,
|
||||
|
@ -708,7 +643,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
if (!mac_dev->res) {
|
||||
dev_err(dev, "__devm_request_mem_region(mac) failed\n");
|
||||
err = -EBUSY;
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
priv->vaddr = devm_ioremap(dev, mac_dev->res->start,
|
||||
|
@ -716,12 +651,12 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
if (!priv->vaddr) {
|
||||
dev_err(dev, "devm_ioremap() failed\n");
|
||||
err = -EIO;
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
if (!of_device_is_available(mac_node)) {
|
||||
err = -ENODEV;
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
/* Get the cell-index */
|
||||
|
@ -729,7 +664,7 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
if (err) {
|
||||
dev_err(dev, "failed to read cell-index for %pOF\n", mac_node);
|
||||
err = -EINVAL;
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
priv->cell_index = (u8)val;
|
||||
|
||||
|
@ -744,14 +679,14 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n",
|
||||
mac_node);
|
||||
err = nph;
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
if (nph != ARRAY_SIZE(mac_dev->port)) {
|
||||
dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n",
|
||||
mac_node);
|
||||
err = -EINVAL;
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
|
||||
|
@ -810,42 +745,12 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
|
||||
/* Get the rest of the PHY information */
|
||||
mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
|
||||
if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
|
||||
struct phy_device *phy;
|
||||
|
||||
err = of_phy_register_fixed_link(mac_node);
|
||||
if (err)
|
||||
goto _return_of_get_parent;
|
||||
|
||||
priv->fixed_link = kzalloc(sizeof(*priv->fixed_link),
|
||||
GFP_KERNEL);
|
||||
if (!priv->fixed_link) {
|
||||
err = -ENOMEM;
|
||||
goto _return_of_get_parent;
|
||||
}
|
||||
|
||||
mac_dev->phy_node = of_node_get(mac_node);
|
||||
phy = of_phy_find_device(mac_dev->phy_node);
|
||||
if (!phy) {
|
||||
err = -EINVAL;
|
||||
of_node_put(mac_dev->phy_node);
|
||||
goto _return_of_get_parent;
|
||||
}
|
||||
|
||||
priv->fixed_link->link = phy->link;
|
||||
priv->fixed_link->speed = phy->speed;
|
||||
priv->fixed_link->duplex = phy->duplex;
|
||||
priv->fixed_link->pause = phy->pause;
|
||||
priv->fixed_link->asym_pause = phy->asym_pause;
|
||||
|
||||
put_device(&phy->mdio.dev);
|
||||
}
|
||||
|
||||
err = mac_dev->init(mac_dev);
|
||||
err = init(mac_dev, mac_node);
|
||||
if (err < 0) {
|
||||
dev_err(dev, "mac_dev->init() = %d\n", err);
|
||||
of_node_put(mac_dev->phy_node);
|
||||
goto _return_of_get_parent;
|
||||
goto _return_of_node_put;
|
||||
}
|
||||
|
||||
/* pause frame autonegotiation enabled */
|
||||
|
@ -876,8 +781,6 @@ static int mac_probe(struct platform_device *_of_dev)
|
|||
|
||||
_return_of_node_put:
|
||||
of_node_put(dev_node);
|
||||
_return_of_get_parent:
|
||||
kfree(priv->fixed_link);
|
||||
_return:
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -1,32 +1,6 @@
|
|||
/* Copyright 2008-2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Freescale Semiconductor nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
|
||||
*/
|
||||
|
||||
#ifndef __MAC_H
|
||||
|
@ -45,6 +19,7 @@ struct fman_mac;
|
|||
struct mac_priv_s;
|
||||
|
||||
struct mac_device {
|
||||
struct device *dev;
|
||||
struct resource *res;
|
||||
u8 addr[ETH_ALEN];
|
||||
struct fman_port *port[2];
|
||||
|
@ -61,9 +36,8 @@ struct mac_device {
|
|||
bool promisc;
|
||||
bool allmulti;
|
||||
|
||||
int (*init)(struct mac_device *mac_dev);
|
||||
int (*start)(struct mac_device *mac_dev);
|
||||
int (*stop)(struct mac_device *mac_dev);
|
||||
int (*enable)(struct fman_mac *mac_dev);
|
||||
int (*disable)(struct fman_mac *mac_dev);
|
||||
void (*adjust_link)(struct mac_device *mac_dev);
|
||||
int (*set_promisc)(struct fman_mac *mac_dev, bool enable);
|
||||
int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr);
|
||||
|
@ -97,5 +71,8 @@ int fman_set_mac_active_pause(struct mac_device *mac_dev, bool rx, bool tx);
|
|||
|
||||
void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause,
|
||||
bool *tx_pause);
|
||||
int set_fman_mac_params(struct mac_device *mac_dev,
|
||||
struct fman_mac_params *params);
|
||||
int fman_set_multi(struct net_device *net_dev, struct mac_device *mac_dev);
|
||||
|
||||
#endif /* __MAC_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue