Commit 14d25e3f authored by Jakub Kicinski's avatar Jakub Kicinski

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.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents bf294c3f c0e36be1
# 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 { ...@@ -232,133 +232,7 @@ port@81000 {
============================================================================= =============================================================================
FMan dTSEC/XGEC/mEMAC Node FMan dTSEC/XGEC/mEMAC Node
DESCRIPTION Refer to Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml
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>;
};
============================================================================ ============================================================================
FMan IEEE 1588 Node FMan IEEE 1588 Node
......
...@@ -288,9 +288,11 @@ static int dpaa_stop(struct net_device *net_dev) ...@@ -288,9 +288,11 @@ static int dpaa_stop(struct net_device *net_dev)
*/ */
msleep(200); 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) 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); err);
for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
...@@ -2942,11 +2944,12 @@ static int dpaa_open(struct net_device *net_dev) ...@@ -2942,11 +2944,12 @@ static int dpaa_open(struct net_device *net_dev)
goto mac_start_failed; goto mac_start_failed;
} }
err = priv->mac_dev->start(mac_dev); err = priv->mac_dev->enable(mac_dev->fman_mac);
if (err < 0) { 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; goto mac_start_failed;
} }
phy_start(priv->mac_dev->phy_dev);
netif_tx_start_all_queues(net_dev); netif_tx_start_all_queues(net_dev);
......
// 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 * 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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
......
/* 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 * 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 #ifndef __FM_H
......
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
...@@ -860,25 +833,20 @@ int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val) ...@@ -860,25 +833,20 @@ int dtsec_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val)
return 0; 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; struct dtsec_regs __iomem *regs = dtsec->regs;
if (mode & COMM_MODE_TX) iowrite32be(ioread32be(&regs->tctrl) & ~TCTRL_GTS, &regs->tctrl);
iowrite32be(ioread32be(&regs->tctrl) & iowrite32be(ioread32be(&regs->rctrl) & ~RCTRL_GRS, &regs->rctrl);
~TCTRL_GTS, &regs->tctrl);
if (mode & COMM_MODE_RX)
iowrite32be(ioread32be(&regs->rctrl) &
~RCTRL_GRS, &regs->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; struct dtsec_regs __iomem *regs = dtsec->regs;
u32 tmp; u32 tmp;
/* Graceful stop - Assert the graceful Rx stop bit */ /* Graceful stop - Assert the graceful Rx stop bit */
if (mode & COMM_MODE_RX) {
tmp = ioread32be(&regs->rctrl) | RCTRL_GRS; tmp = ioread32be(&regs->rctrl) | RCTRL_GRS;
iowrite32be(tmp, &regs->rctrl); iowrite32be(tmp, &regs->rctrl);
...@@ -889,10 +857,8 @@ static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode) ...@@ -889,10 +857,8 @@ static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode)
/* Workaround for dTSEC Errata A004839 */ /* Workaround for dTSEC Errata A004839 */
usleep_range(10, 50); usleep_range(10, 50);
} }
}
/* Graceful stop - Assert the graceful Tx stop bit */ /* Graceful stop - Assert the graceful Tx stop bit */
if (mode & COMM_MODE_TX) {
if (dtsec->fm_rev_info.major == 2) { if (dtsec->fm_rev_info.major == 2) {
/* dTSEC Errata A004: Do not use TCTRL[GTS]=1 */ /* dTSEC Errata A004: Do not use TCTRL[GTS]=1 */
pr_debug("GTS not supported due to DTSEC_A004 Errata.\n"); 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) ...@@ -903,10 +869,9 @@ static void graceful_stop(struct fman_mac *dtsec, enum comm_mode mode)
/* Workaround for dTSEC Errata A0012, A0014 */ /* Workaround for dTSEC Errata A0012, A0014 */
usleep_range(10, 50); 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; struct dtsec_regs __iomem *regs = dtsec->regs;
u32 tmp; u32 tmp;
...@@ -916,20 +881,16 @@ int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode) ...@@ -916,20 +881,16 @@ int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode)
/* Enable */ /* Enable */
tmp = ioread32be(&regs->maccfg1); tmp = ioread32be(&regs->maccfg1);
if (mode & COMM_MODE_RX) tmp |= MACCFG1_RX_EN | MACCFG1_TX_EN;
tmp |= MACCFG1_RX_EN;
if (mode & COMM_MODE_TX)
tmp |= MACCFG1_TX_EN;
iowrite32be(tmp, &regs->maccfg1); iowrite32be(tmp, &regs->maccfg1);
/* Graceful start - clear the graceful Rx/Tx stop bit */ /* Graceful start - clear the graceful Rx/Tx stop bit */
graceful_start(dtsec, mode); graceful_start(dtsec);
return 0; 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; struct dtsec_regs __iomem *regs = dtsec->regs;
u32 tmp; u32 tmp;
...@@ -938,14 +899,10 @@ int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode) ...@@ -938,14 +899,10 @@ int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode)
return -EINVAL; return -EINVAL;
/* Graceful stop - Assert the graceful Rx/Tx stop bit */ /* Graceful stop - Assert the graceful Rx/Tx stop bit */
graceful_stop(dtsec, mode); graceful_stop(dtsec);
tmp = ioread32be(&regs->maccfg1); tmp = ioread32be(&regs->maccfg1);
if (mode & COMM_MODE_RX) tmp &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN);
tmp &= ~MACCFG1_RX_EN;
if (mode & COMM_MODE_TX)
tmp &= ~MACCFG1_TX_EN;
iowrite32be(tmp, &regs->maccfg1); iowrite32be(tmp, &regs->maccfg1);
return 0; return 0;
...@@ -956,18 +913,12 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, ...@@ -956,18 +913,12 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec,
u16 pause_time, u16 __maybe_unused thresh_time) u16 pause_time, u16 __maybe_unused thresh_time)
{ {
struct dtsec_regs __iomem *regs = dtsec->regs; struct dtsec_regs __iomem *regs = dtsec->regs;
enum comm_mode mode = COMM_MODE_NONE;
u32 ptv = 0; u32 ptv = 0;
if (!is_init_done(dtsec->dtsec_drv_param)) if (!is_init_done(dtsec->dtsec_drv_param))
return -EINVAL; return -EINVAL;
if ((ioread32be(&regs->rctrl) & RCTRL_GRS) == 0) graceful_stop(dtsec);
mode |= COMM_MODE_RX;
if ((ioread32be(&regs->tctrl) & TCTRL_GTS) == 0)
mode |= COMM_MODE_TX;
graceful_stop(dtsec, mode);
if (pause_time) { if (pause_time) {
/* FM_BAD_TX_TS_IN_B_2_B_ERRATA_DTSEC_A003 Errata workaround */ /* 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, ...@@ -989,7 +940,7 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec,
iowrite32be(ioread32be(&regs->maccfg1) & ~MACCFG1_TX_FLOW, iowrite32be(ioread32be(&regs->maccfg1) & ~MACCFG1_TX_FLOW,
&regs->maccfg1); &regs->maccfg1);
graceful_start(dtsec, mode); graceful_start(dtsec);
return 0; return 0;
} }
...@@ -997,18 +948,12 @@ int dtsec_set_tx_pause_frames(struct fman_mac *dtsec, ...@@ -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) int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en)
{ {
struct dtsec_regs __iomem *regs = dtsec->regs; struct dtsec_regs __iomem *regs = dtsec->regs;
enum comm_mode mode = COMM_MODE_NONE;
u32 tmp; u32 tmp;
if (!is_init_done(dtsec->dtsec_drv_param)) if (!is_init_done(dtsec->dtsec_drv_param))
return -EINVAL; return -EINVAL;
if ((ioread32be(&regs->rctrl) & RCTRL_GRS) == 0) graceful_stop(dtsec);
mode |= COMM_MODE_RX;
if ((ioread32be(&regs->tctrl) & TCTRL_GTS) == 0)
mode |= COMM_MODE_TX;
graceful_stop(dtsec, mode);
tmp = ioread32be(&regs->maccfg1); tmp = ioread32be(&regs->maccfg1);
if (en) if (en)
...@@ -1017,25 +962,17 @@ int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en) ...@@ -1017,25 +962,17 @@ int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en)
tmp &= ~MACCFG1_RX_FLOW; tmp &= ~MACCFG1_RX_FLOW;
iowrite32be(tmp, &regs->maccfg1); iowrite32be(tmp, &regs->maccfg1);
graceful_start(dtsec, mode); graceful_start(dtsec);
return 0; return 0;
} }
int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr) 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)) if (!is_init_done(dtsec->dtsec_drv_param))
return -EINVAL; return -EINVAL;
if ((ioread32be(&regs->rctrl) & RCTRL_GRS) == 0) graceful_stop(dtsec);
mode |= COMM_MODE_RX;
if ((ioread32be(&regs->tctrl) & TCTRL_GTS) == 0)
mode |= COMM_MODE_TX;
graceful_stop(dtsec, mode);
/* Initialize MAC Station Address registers (1 & 2) /* Initialize MAC Station Address registers (1 & 2)
* Station address have to be swapped (big endian to little endian * 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 ...@@ -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); dtsec->addr = ENET_ADDR_TO_UINT64(*enet_addr);
set_mac_address(dtsec->regs, (const u8 *)(*enet_addr)); set_mac_address(dtsec->regs, (const u8 *)(*enet_addr));
graceful_start(dtsec, mode); graceful_start(dtsec);
return 0; return 0;
} }
...@@ -1261,18 +1198,12 @@ int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val) ...@@ -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) int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed)
{ {
struct dtsec_regs __iomem *regs = dtsec->regs; struct dtsec_regs __iomem *regs = dtsec->regs;
enum comm_mode mode = COMM_MODE_NONE;
u32 tmp; u32 tmp;
if (!is_init_done(dtsec->dtsec_drv_param)) if (!is_init_done(dtsec->dtsec_drv_param))
return -EINVAL; return -EINVAL;
if ((ioread32be(&regs->rctrl) & RCTRL_GRS) == 0) graceful_stop(dtsec);
mode |= COMM_MODE_RX;
if ((ioread32be(&regs->tctrl) & TCTRL_GTS) == 0)
mode |= COMM_MODE_TX;
graceful_stop(dtsec, mode);
tmp = ioread32be(&regs->maccfg2); tmp = ioread32be(&regs->maccfg2);
...@@ -1293,7 +1224,7 @@ int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed) ...@@ -1293,7 +1224,7 @@ int dtsec_adjust_link(struct fman_mac *dtsec, u16 speed)
tmp &= ~DTSEC_ECNTRL_R100M; tmp &= ~DTSEC_ECNTRL_R100M;
iowrite32be(tmp, &regs->ecntrl); iowrite32be(tmp, &regs->ecntrl);
graceful_start(dtsec, mode); graceful_start(dtsec);
return 0; return 0;
} }
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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 __DTSEC_H #ifndef __DTSEC_H
...@@ -43,8 +16,8 @@ int dtsec_adjust_link(struct fman_mac *dtsec, ...@@ -43,8 +16,8 @@ int dtsec_adjust_link(struct fman_mac *dtsec,
int dtsec_restart_autoneg(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_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_cfg_pad_and_crc(struct fman_mac *dtsec, bool new_val);
int dtsec_enable(struct fman_mac *dtsec, enum comm_mode mode); int dtsec_enable(struct fman_mac *dtsec);
int dtsec_disable(struct fman_mac *dtsec, enum comm_mode mode); int dtsec_disable(struct fman_mac *dtsec);
int dtsec_init(struct fman_mac *dtsec); int dtsec_init(struct fman_mac *dtsec);
int dtsec_free(struct fman_mac *dtsec); int dtsec_free(struct fman_mac *dtsec);
int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en); int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en);
......
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/* /*
* Copyright 2017 NXP * 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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/* /*
* Copyright 2017 NXP * 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 #ifndef __KEYGEN_H
......
...@@ -75,16 +75,6 @@ typedef u8 enet_addr_t[ETH_ALEN]; ...@@ -75,16 +75,6 @@ typedef u8 enet_addr_t[ETH_ALEN];
#define ETH_HASH_ENTRY_OBJ(ptr) \ #define ETH_HASH_ENTRY_OBJ(ptr) \
hlist_entry_safe(ptr, struct eth_hash_entry, node) 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 */ /* FM MAC Exceptions */
enum fman_mac_exceptions { enum fman_mac_exceptions {
FM_MAC_EX_10G_MDIO_SCAN_EVENT = 0 FM_MAC_EX_10G_MDIO_SCAN_EVENT = 0
......
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
...@@ -712,7 +685,7 @@ static bool is_init_done(struct memac_cfg *memac_drv_params) ...@@ -712,7 +685,7 @@ static bool is_init_done(struct memac_cfg *memac_drv_params)
return false; 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; struct memac_regs __iomem *regs = memac->regs;
u32 tmp; u32 tmp;
...@@ -721,17 +694,13 @@ int memac_enable(struct fman_mac *memac, enum comm_mode mode) ...@@ -721,17 +694,13 @@ int memac_enable(struct fman_mac *memac, enum comm_mode mode)
return -EINVAL; return -EINVAL;
tmp = ioread32be(&regs->command_config); tmp = ioread32be(&regs->command_config);
if (mode & COMM_MODE_RX) tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN;
tmp |= CMD_CFG_RX_EN;
if (mode & COMM_MODE_TX)
tmp |= CMD_CFG_TX_EN;
iowrite32be(tmp, &regs->command_config); iowrite32be(tmp, &regs->command_config);
return 0; 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; struct memac_regs __iomem *regs = memac->regs;
u32 tmp; u32 tmp;
...@@ -740,11 +709,7 @@ int memac_disable(struct fman_mac *memac, enum comm_mode mode) ...@@ -740,11 +709,7 @@ int memac_disable(struct fman_mac *memac, enum comm_mode mode)
return -EINVAL; return -EINVAL;
tmp = ioread32be(&regs->command_config); tmp = ioread32be(&regs->command_config);
if (mode & COMM_MODE_RX) tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN);
tmp &= ~CMD_CFG_RX_EN;
if (mode & COMM_MODE_TX)
tmp &= ~CMD_CFG_TX_EN;
iowrite32be(tmp, &regs->command_config); iowrite32be(tmp, &regs->command_config);
return 0; return 0;
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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 __MEMAC_H #ifndef __MEMAC_H
...@@ -46,8 +19,8 @@ int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val); ...@@ -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_reset_on_init(struct fman_mac *memac, bool enable);
int memac_cfg_fixed_link(struct fman_mac *memac, int memac_cfg_fixed_link(struct fman_mac *memac,
struct fixed_phy_status *fixed_link); struct fixed_phy_status *fixed_link);
int memac_enable(struct fman_mac *memac, enum comm_mode mode); int memac_enable(struct fman_mac *memac);
int memac_disable(struct fman_mac *memac, enum comm_mode mode); int memac_disable(struct fman_mac *memac);
int memac_init(struct fman_mac *memac); int memac_init(struct fman_mac *memac);
int memac_free(struct fman_mac *memac); int memac_free(struct fman_mac *memac);
int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en); int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en);
......
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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_muram.h" #include "fman_muram.h"
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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_MURAM_EXT #ifndef __FM_MURAM_EXT
#define __FM_MURAM_EXT #define __FM_MURAM_EXT
......
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/* /*
* Copyright 2008 - 2015 Freescale Semiconductor Inc. * 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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/* /*
* Copyright 2008 - 2015 Freescale Semiconductor Inc. * 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 #ifndef __FMAN_PORT_H
......
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/* /*
* Copyright 2008 - 2015 Freescale Semiconductor Inc. * 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" #include "fman_sp.h"
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/* /*
* Copyright 2008 - 2015 Freescale Semiconductor Inc. * 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 #ifndef __FM_SP_H
......
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
...@@ -419,7 +392,7 @@ static bool is_init_done(struct tgec_cfg *cfg) ...@@ -419,7 +392,7 @@ static bool is_init_done(struct tgec_cfg *cfg)
return false; 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; struct tgec_regs __iomem *regs = tgec->regs;
u32 tmp; u32 tmp;
...@@ -428,16 +401,13 @@ int tgec_enable(struct fman_mac *tgec, enum comm_mode mode) ...@@ -428,16 +401,13 @@ int tgec_enable(struct fman_mac *tgec, enum comm_mode mode)
return -EINVAL; return -EINVAL;
tmp = ioread32be(&regs->command_config); tmp = ioread32be(&regs->command_config);
if (mode & COMM_MODE_RX) tmp |= CMD_CFG_RX_EN | CMD_CFG_TX_EN;
tmp |= CMD_CFG_RX_EN;
if (mode & COMM_MODE_TX)
tmp |= CMD_CFG_TX_EN;
iowrite32be(tmp, &regs->command_config); iowrite32be(tmp, &regs->command_config);
return 0; 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; struct tgec_regs __iomem *regs = tgec->regs;
u32 tmp; u32 tmp;
...@@ -446,10 +416,7 @@ int tgec_disable(struct fman_mac *tgec, enum comm_mode mode) ...@@ -446,10 +416,7 @@ int tgec_disable(struct fman_mac *tgec, enum comm_mode mode)
return -EINVAL; return -EINVAL;
tmp = ioread32be(&regs->command_config); tmp = ioread32be(&regs->command_config);
if (mode & COMM_MODE_RX) tmp &= ~(CMD_CFG_RX_EN | CMD_CFG_TX_EN);
tmp &= ~CMD_CFG_RX_EN;
if (mode & COMM_MODE_TX)
tmp &= ~CMD_CFG_TX_EN;
iowrite32be(tmp, &regs->command_config); iowrite32be(tmp, &regs->command_config);
return 0; return 0;
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
/* /*
* Copyright 2008-2015 Freescale Semiconductor Inc. * 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 __TGEC_H #ifndef __TGEC_H
...@@ -39,8 +12,8 @@ struct fman_mac *tgec_config(struct fman_mac_params *params); ...@@ -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_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_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_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val);
int tgec_enable(struct fman_mac *tgec, enum comm_mode mode); int tgec_enable(struct fman_mac *tgec);
int tgec_disable(struct fman_mac *tgec, enum comm_mode mode); int tgec_disable(struct fman_mac *tgec);
int tgec_init(struct fman_mac *tgec); int tgec_init(struct fman_mac *tgec);
int tgec_free(struct fman_mac *tgec); int tgec_free(struct fman_mac *tgec);
int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en); int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en);
......
This diff is collapsed.
/* Copyright 2008-2015 Freescale Semiconductor, Inc. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
* /*
* Redistribution and use in source and binary forms, with or without * Copyright 2008 - 2015 Freescale Semiconductor Inc.
* 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 __MAC_H #ifndef __MAC_H
...@@ -45,6 +19,7 @@ struct fman_mac; ...@@ -45,6 +19,7 @@ struct fman_mac;
struct mac_priv_s; struct mac_priv_s;
struct mac_device { struct mac_device {
struct device *dev;
struct resource *res; struct resource *res;
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
struct fman_port *port[2]; struct fman_port *port[2];
...@@ -61,9 +36,8 @@ struct mac_device { ...@@ -61,9 +36,8 @@ struct mac_device {
bool promisc; bool promisc;
bool allmulti; bool allmulti;
int (*init)(struct mac_device *mac_dev); int (*enable)(struct fman_mac *mac_dev);
int (*start)(struct mac_device *mac_dev); int (*disable)(struct fman_mac *mac_dev);
int (*stop)(struct mac_device *mac_dev);
void (*adjust_link)(struct mac_device *mac_dev); void (*adjust_link)(struct mac_device *mac_dev);
int (*set_promisc)(struct fman_mac *mac_dev, bool enable); int (*set_promisc)(struct fman_mac *mac_dev, bool enable);
int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr); 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); ...@@ -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, void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause,
bool *tx_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 */ #endif /* __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