Blame view
include/miiphy.h
5.39 KB
4549e789c SPDX: Convert all... |
1 |
/* SPDX-License-Identifier: GPL-2.0 OR IBM-pibs */ |
46263f2de SPDX-License-Iden... |
2 |
/* |
46263f2de SPDX-License-Iden... |
3 4 |
* Additions (C) Copyright 2009 Industrie Dial Face S.p.A. */ |
214ec6bbd Initial revision |
5 6 |
/*----------------------------------------------------------------------------+ | |
65bd0e284 * Patch by Rune T... |
7 |
| File Name: miiphy.h |
214ec6bbd Initial revision |
8 |
| |
65bd0e284 * Patch by Rune T... |
9 |
| Function: Include file defining PHY registers. |
214ec6bbd Initial revision |
10 |
| |
65bd0e284 * Patch by Rune T... |
11 |
| Author: Mark Wisner |
214ec6bbd Initial revision |
12 |
| |
214ec6bbd Initial revision |
13 14 15 |
+----------------------------------------------------------------------------*/ #ifndef _miiphy_h_ #define _miiphy_h_ |
5f184715e Create PHY Lib fo... |
16 |
#include <common.h> |
8ef583a03 miiphy: convert t... |
17 |
#include <linux/mii.h> |
5f184715e Create PHY Lib fo... |
18 |
#include <linux/list.h> |
63ff004c4 Add support for m... |
19 |
#include <net.h> |
5f184715e Create PHY Lib fo... |
20 |
#include <phy.h> |
f915c9316 Revert "mii: miip... |
21 |
int miiphy_read(const char *devname, unsigned char addr, unsigned char reg, |
298035df4 NET: Cosmetic cha... |
22 |
unsigned short *value); |
f915c9316 Revert "mii: miip... |
23 |
int miiphy_write(const char *devname, unsigned char addr, unsigned char reg, |
298035df4 NET: Cosmetic cha... |
24 |
unsigned short value); |
16a532383 miiphy: Fix some ... |
25 |
int miiphy_info(const char *devname, unsigned char addr, unsigned int *oui, |
298035df4 NET: Cosmetic cha... |
26 |
unsigned char *model, unsigned char *rev); |
16a532383 miiphy: Fix some ... |
27 28 29 30 |
int miiphy_reset(const char *devname, unsigned char addr); int miiphy_speed(const char *devname, unsigned char addr); int miiphy_duplex(const char *devname, unsigned char addr); int miiphy_is_1000base_x(const char *devname, unsigned char addr); |
6d0f6bcf3 rename CFG_ macro... |
31 |
#ifdef CONFIG_SYS_FAULT_ECHO_LINK_DOWN |
16a532383 miiphy: Fix some ... |
32 |
int miiphy_link(const char *devname, unsigned char addr); |
fc3e2165e * Patch by Sangmo... |
33 |
#endif |
214ec6bbd Initial revision |
34 |
|
16a532383 miiphy: Fix some ... |
35 |
void miiphy_init(void); |
d9785c14b Fix miiphy global... |
36 |
|
16a532383 miiphy: Fix some ... |
37 38 |
int miiphy_set_current_dev(const char *devname); const char *miiphy_get_current_dev(void); |
5f184715e Create PHY Lib fo... |
39 |
struct mii_dev *mdio_get_current_dev(void); |
9215bb1f3 miiphy: Add funct... |
40 |
struct list_head *mdio_get_list_head(void); |
5f184715e Create PHY Lib fo... |
41 42 |
struct mii_dev *miiphy_get_dev_by_name(const char *devname); struct phy_device *mdio_phydev_for_ethname(const char *devname); |
63ff004c4 Add support for m... |
43 |
|
16a532383 miiphy: Fix some ... |
44 |
void miiphy_listdev(void); |
63ff004c4 Add support for m... |
45 |
|
5f184715e Create PHY Lib fo... |
46 |
struct mii_dev *mdio_alloc(void); |
cb6baca77 net: mdio: Add md... |
47 |
void mdio_free(struct mii_dev *bus); |
5f184715e Create PHY Lib fo... |
48 |
int mdio_register(struct mii_dev *bus); |
79e2a6a04 common: miiphyuti... |
49 50 51 52 53 54 55 56 57 |
/** * mdio_register_seq - Register mdio bus with sequence number * @bus: mii device structure * @seq: sequence number * * Return: 0 if success, negative value if error */ int mdio_register_seq(struct mii_dev *bus, int seq); |
cb6baca77 net: mdio: Add md... |
58 |
int mdio_unregister(struct mii_dev *bus); |
5f184715e Create PHY Lib fo... |
59 |
void mdio_list_devices(void); |
4ba31ab33 Rewrite the miiph... |
60 61 62 63 64 |
#ifdef CONFIG_BITBANGMII #define BB_MII_DEVNAME "bb_miiphy" struct bb_miiphy_bus { |
f6add132f net/miiphy/serial... |
65 |
char name[16]; |
4ba31ab33 Rewrite the miiph... |
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
int (*init)(struct bb_miiphy_bus *bus); int (*mdio_active)(struct bb_miiphy_bus *bus); int (*mdio_tristate)(struct bb_miiphy_bus *bus); int (*set_mdio)(struct bb_miiphy_bus *bus, int v); int (*get_mdio)(struct bb_miiphy_bus *bus, int *v); int (*set_mdc)(struct bb_miiphy_bus *bus, int v); int (*delay)(struct bb_miiphy_bus *bus); #ifdef CONFIG_BITBANGMII_MULTI void *priv; #endif }; extern struct bb_miiphy_bus bb_miiphy_buses[]; extern int bb_miiphy_buses_num; |
63ff004c4 Add support for m... |
80 |
|
16a532383 miiphy: Fix some ... |
81 |
void bb_miiphy_init(void); |
dfcc496ed net: mii: Changes... |
82 83 84 |
int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg); int bb_miiphy_write(struct mii_dev *miidev, int addr, int devad, int reg, u16 value); |
4ba31ab33 Rewrite the miiph... |
85 |
#endif |
214ec6bbd Initial revision |
86 87 |
/* phy seed setup */ |
65bd0e284 * Patch by Rune T... |
88 |
#define AUTO 99 |
298035df4 NET: Cosmetic cha... |
89 |
#define _1000BASET 1000 |
65bd0e284 * Patch by Rune T... |
90 91 92 93 |
#define _100BASET 100 #define _10BASET 10 #define HALF 22 #define FULL 44 |
214ec6bbd Initial revision |
94 95 |
/* phy register offsets */ |
8ef583a03 miiphy: convert t... |
96 97 98 |
#define MII_MIPSCR 0x11 /* MII_LPA */ |
298035df4 NET: Cosmetic cha... |
99 100 |
#define PHY_ANLPAR_PSB_802_3 0x0001 #define PHY_ANLPAR_PSB_802_9 0x0002 |
8ef583a03 miiphy: convert t... |
101 |
/* MII_CTRL1000 masks */ |
71bc6e647 NET: Add Ethernet... |
102 103 |
#define PHY_1000BTCR_1000FD 0x0200 #define PHY_1000BTCR_1000HD 0x0100 |
8ef583a03 miiphy: convert t... |
104 |
/* MII_STAT1000 masks */ |
298035df4 NET: Cosmetic cha... |
105 106 107 108 109 110 |
#define PHY_1000BTSR_MSCF 0x8000 #define PHY_1000BTSR_MSCR 0x4000 #define PHY_1000BTSR_LRS 0x2000 #define PHY_1000BTSR_RRS 0x1000 #define PHY_1000BTSR_1000FD 0x0800 #define PHY_1000BTSR_1000HD 0x0400 |
855a496fe * Patches by Trav... |
111 |
|
71bc6e647 NET: Add Ethernet... |
112 |
/* phy EXSR */ |
8ef583a03 miiphy: convert t... |
113 114 |
#define ESTATUS_1000XF 0x8000 #define ESTATUS_1000XH 0x4000 |
71bc6e647 NET: Add Ethernet... |
115 |
|
c3452b50c net: introduce MD... |
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
#ifdef CONFIG_DM_MDIO /** * struct mdio_perdev_priv - Per-device class data for MDIO DM * * @mii_bus: Supporting MII legacy bus */ struct mdio_perdev_priv { struct mii_dev *mii_bus; }; /** * struct mdio_ops - MDIO bus operations * * @read: Read from a PHY register * @write: Write to a PHY register * @reset: Reset the MDIO bus, NULL if not supported */ struct mdio_ops { int (*read)(struct udevice *mdio_dev, int addr, int devad, int reg); int (*write)(struct udevice *mdio_dev, int addr, int devad, int reg, u16 val); int (*reset)(struct udevice *mdio_dev); }; #define mdio_get_ops(dev) ((struct mdio_ops *)(dev)->driver->ops) /** * dm_mdio_probe_devices - Call probe on all MII devices, currently used for * MDIO console commands. */ void dm_mdio_probe_devices(void); /** * dm_mdio_phy_connect - Wrapper over phy_connect for DM MDIO * |
a5d32c37d net: mdio-uclass:... |
152 153 |
* @mdiodev: mdio device the PHY is accesible on * @phyaddr: PHY address on MDIO bus |
c3452b50c net: introduce MD... |
154 155 156 157 158 |
* @ethdev: ethernet device to connect to the PHY * @interface: MAC-PHY protocol * * @return pointer to phy_device, or 0 on error */ |
a5d32c37d net: mdio-uclass:... |
159 |
struct phy_device *dm_mdio_phy_connect(struct udevice *mdiodev, int phyaddr, |
c3452b50c net: introduce MD... |
160 161 |
struct udevice *ethdev, phy_interface_t interface); |
2f6245594 net: mdio-uclass:... |
162 163 164 165 166 167 168 169 170 171 172 |
/** * dm_eth_phy_connect - Connect an Eth device to a PHY based on device tree * * Picks up the DT phy-handle and phy-mode from ethernet device node and * connects the ethernet device to the linked PHY. * * @ethdev: ethernet device * * @return pointer to phy_device, or 0 on error */ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev); |
c3452b50c net: introduce MD... |
173 |
#endif |
8880edba0 net: add MDIO_MUX... |
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
#ifdef CONFIG_DM_MDIO_MUX /* indicates none of the child buses is selected */ #define MDIO_MUX_SELECT_NONE -1 /** * struct mdio_mux_ops - MDIO MUX operations * * @select: Selects a child bus * @deselect: Clean up selection. Optional, can be NULL */ struct mdio_mux_ops { int (*select)(struct udevice *mux, int cur, int sel); int (*deselect)(struct udevice *mux, int sel); }; #define mdio_mux_get_ops(dev) ((struct mdio_mux_ops *)(dev)->driver->ops) #endif |
214ec6bbd Initial revision |
193 |
#endif |