mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
![Vladimir Oltean](/assets/img/avatar_default.png)
Ping tested: [ 11.808455] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control rx/tx [ 11.816497] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready [root@LS1028ARDB ~] # ethtool -s swp0 advertise 0x4 [ 18.844591] mscc_felix 0000:00:00.5 swp0: Link is Down [ 22.048337] mscc_felix 0000:00:00.5 swp0: Link is Up - 100Mbps/Half - flow control off [root@LS1028ARDB ~] # ip addr add 192.168.1.1/24 dev swp0 [root@LS1028ARDB ~] # ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2): 56 data bytes (...) ^C--- 192.168.1.2 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 0.383/0.611/1.051 ms [root@LS1028ARDB ~] # ethtool -s swp0 advertise 0x10 [ 355.637747] mscc_felix 0000:00:00.5 swp0: Link is Down [ 358.788034] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Half - flow control off [root@LS1028ARDB ~] # ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2): 56 data bytes (...) ^C --- 192.168.1.2 ping statistics --- 16 packets transmitted, 16 packets received, 0% packet loss round-trip min/avg/max = 0.301/0.384/1.138 ms Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
56 lines
1.6 KiB
C
56 lines
1.6 KiB
C
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
|
|
/* Copyright 2019 NXP */
|
|
|
|
#ifndef _FSL_ENETC_MDIO_H_
|
|
#define _FSL_ENETC_MDIO_H_
|
|
|
|
#include <linux/phy.h>
|
|
|
|
/* PCS registers */
|
|
#define ENETC_PCS_LINK_TIMER1 0x12
|
|
#define ENETC_PCS_LINK_TIMER1_VAL 0x06a0
|
|
#define ENETC_PCS_LINK_TIMER2 0x13
|
|
#define ENETC_PCS_LINK_TIMER2_VAL 0x0003
|
|
#define ENETC_PCS_IF_MODE 0x14
|
|
#define ENETC_PCS_IF_MODE_SGMII_EN BIT(0)
|
|
#define ENETC_PCS_IF_MODE_USE_SGMII_AN BIT(1)
|
|
#define ENETC_PCS_IF_MODE_SGMII_SPEED(x) (((x) << 2) & GENMASK(3, 2))
|
|
#define ENETC_PCS_IF_MODE_DUPLEX_HALF BIT(3)
|
|
|
|
/* Not a mistake, the SerDes PLL needs to be set at 3.125 GHz by Reset
|
|
* Configuration Word (RCW, outside Linux control) for 2.5G SGMII mode. The PCS
|
|
* still thinks it's at gigabit.
|
|
*/
|
|
enum enetc_pcs_speed {
|
|
ENETC_PCS_SPEED_10 = 0,
|
|
ENETC_PCS_SPEED_100 = 1,
|
|
ENETC_PCS_SPEED_1000 = 2,
|
|
ENETC_PCS_SPEED_2500 = 2,
|
|
};
|
|
|
|
struct enetc_hw;
|
|
|
|
struct enetc_mdio_priv {
|
|
struct enetc_hw *hw;
|
|
int mdio_base;
|
|
};
|
|
|
|
#if IS_REACHABLE(CONFIG_FSL_ENETC_MDIO)
|
|
|
|
int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum);
|
|
int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value);
|
|
struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs);
|
|
|
|
#else
|
|
|
|
static inline int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
|
|
{ return -EINVAL; }
|
|
static inline int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum,
|
|
u16 value)
|
|
{ return -EINVAL; }
|
|
struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs)
|
|
{ return ERR_PTR(-EINVAL); }
|
|
|
|
#endif
|
|
|
|
#endif
|