~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/fsl/enetc_mdio.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
  2 /* Copyright 2019 NXP */
  3 
  4 #ifndef _FSL_ENETC_MDIO_H_
  5 #define _FSL_ENETC_MDIO_H_
  6 
  7 #include <linux/phy.h>
  8 
  9 /* PCS registers */
 10 #define ENETC_PCS_LINK_TIMER1                   0x12
 11 #define ENETC_PCS_LINK_TIMER1_VAL               0x06a0
 12 #define ENETC_PCS_LINK_TIMER2                   0x13
 13 #define ENETC_PCS_LINK_TIMER2_VAL               0x0003
 14 #define ENETC_PCS_IF_MODE                       0x14
 15 #define ENETC_PCS_IF_MODE_SGMII_EN              BIT(0)
 16 #define ENETC_PCS_IF_MODE_USE_SGMII_AN          BIT(1)
 17 #define ENETC_PCS_IF_MODE_SGMII_SPEED(x)        (((x) << 2) & GENMASK(3, 2))
 18 #define ENETC_PCS_IF_MODE_DUPLEX_HALF           BIT(3)
 19 
 20 /* Not a mistake, the SerDes PLL needs to be set at 3.125 GHz by Reset
 21  * Configuration Word (RCW, outside Linux control) for 2.5G SGMII mode. The PCS
 22  * still thinks it's at gigabit.
 23  */
 24 enum enetc_pcs_speed {
 25         ENETC_PCS_SPEED_10      = 0,
 26         ENETC_PCS_SPEED_100     = 1,
 27         ENETC_PCS_SPEED_1000    = 2,
 28         ENETC_PCS_SPEED_2500    = 2,
 29 };
 30 
 31 struct enetc_hw;
 32 
 33 struct enetc_mdio_priv {
 34         struct enetc_hw *hw;
 35         int mdio_base;
 36 };
 37 
 38 #if IS_REACHABLE(CONFIG_FSL_ENETC_MDIO)
 39 
 40 int enetc_mdio_read_c22(struct mii_bus *bus, int phy_id, int regnum);
 41 int enetc_mdio_write_c22(struct mii_bus *bus, int phy_id, int regnum,
 42                          u16 value);
 43 int enetc_mdio_read_c45(struct mii_bus *bus, int phy_id, int devad, int regnum);
 44 int enetc_mdio_write_c45(struct mii_bus *bus, int phy_id, int devad, int regnum,
 45                          u16 value);
 46 struct enetc_hw *enetc_hw_alloc(struct device *dev, void __iomem *port_regs);
 47 
 48 #else
 49 
 50 static inline int enetc_mdio_read_c22(struct mii_bus *bus, int phy_id,
 51                                       int regnum)
 52 { return -EINVAL; }
 53 static inline int enetc_mdio_write_c22(struct mii_bus *bus, int phy_id,
 54                                        int regnum, u16 value)
 55 { return -EINVAL; }
 56 static inline int enetc_mdio_read_c45(struct mii_bus *bus, int phy_id,
 57                                       int devad, int regnum)
 58 { return -EINVAL; }
 59 static inline int enetc_mdio_write_c45(struct mii_bus *bus, int phy_id,
 60                                        int devad, int regnum, u16 value)
 61 { return -EINVAL; }
 62 static inline struct enetc_hw *enetc_hw_alloc(struct device *dev,
 63                                               void __iomem *port_regs)
 64 { return ERR_PTR(-EINVAL); }
 65 
 66 #endif
 67 
 68 #endif
 69 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php