Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02e57b9d authored by Giuseppe CAVALLARO's avatar Giuseppe CAVALLARO Committed by David S. Miller
Browse files

drivers: net: stmmac: add port selection programming



In case of SGMII more, for example when a MAC2MAC connection
is needed, the port selection bits (inside the MAC configuration
registers) have to be programmed according to the link selected.
So the patch adds a new DT parameter to pass the port selection
and to programmed related PCS and CORE to use it.

Signed-off-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3fe5cadb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -47,6 +47,9 @@ Optional properties:
				supported by this device instance
- snps,perfect-filter-entries:	Number of perfect filter entries supported
				by this device instance
- snps,ps-speed: port selection speed that can be passed to the core when
		 PCS is supported. For example, this is used in case of SGMII
		 and MAC2MAC connection.
- AXI BUS Mode parameters: below the list of all the parameters to program the
			   AXI register inside the DMA module:
	- snps,lpi_en: enable Low Power Interface
+1 −0
Original line number Diff line number Diff line
@@ -531,6 +531,7 @@ struct mac_device_info {
	unsigned int rx_csum;
	unsigned int pcs;
	unsigned int pmt;
	unsigned int ps;
};

struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
+15 −0
Original line number Diff line number Diff line
@@ -46,6 +46,21 @@ static void dwmac1000_core_init(struct mac_device_info *hw, int mtu)
	if (mtu > 2000)
		value |= GMAC_CONTROL_JE;

	if (hw->ps) {
		value |= GMAC_CONTROL_TE;

		if (hw->ps == SPEED_1000) {
			value &= ~GMAC_CONTROL_PS;
		} else {
			value |= GMAC_CONTROL_PS;

			if (hw->ps == SPEED_10)
				value &= ~GMAC_CONTROL_FES;
			else
				value |= GMAC_CONTROL_FES;
		}
	}

	writel(value, ioaddr + GMAC_CONTROL);

	/* Mask GMAC interrupts */
+15 −0
Original line number Diff line number Diff line
@@ -32,6 +32,21 @@ static void dwmac4_core_init(struct mac_device_info *hw, int mtu)
	if (mtu > 2000)
		value |= GMAC_CONFIG_JE;

	if (hw->ps) {
		value |= GMAC_CONFIG_TE;

		if (hw->ps == SPEED_1000) {
			value &= ~GMAC_CONFIG_PS;
		} else {
			value |= GMAC_CONFIG_PS;

			if (hw->ps == SPEED_10)
				value &= ~GMAC_CONFIG_FES;
			else
				value |= GMAC_CONFIG_FES;
		}
	}

	writel(value, ioaddr + GMAC_CONFIG);

	/* Mask GMAC interrupts */
+2 −1
Original line number Diff line number Diff line
@@ -380,7 +380,8 @@ static int stmmac_ethtool_setsettings(struct net_device *dev,
		spin_lock(&priv->lock);

		if (priv->hw->mac->pcs_ctrl_ane)
			priv->hw->mac->pcs_ctrl_ane(priv->ioaddr, 1, 0, 0);
			priv->hw->mac->pcs_ctrl_ane(priv->ioaddr, 1,
						    priv->hw->ps, 0);

		spin_unlock(&priv->lock);

Loading