diff options
author | David Daney <david.daney@cavium.com> | 2012-06-27 03:33:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-28 00:23:24 -0400 |
commit | ac28b9f8cd66d6bc54f8063df59e99abd62173a4 (patch) | |
tree | 9a837eafeead399aebad03fb891654ddeff37513 /include/linux | |
parent | a3caad0a160c03b7238a2518fa89abda78adef1e (diff) |
netdev/phy: Handle IEEE802.3 clause 45 Ethernet PHYs
The IEEE802.3 clause 45 MDIO bus protocol allows for directly
addressing PHY registers using a 21 bit address, and is used by many
10G Ethernet PHYS. Already existing is the ability of MDIO bus
drivers to use clause 45, with the MII_ADDR_C45 flag. Here we add
struct phy_c45_device_ids to hold the device identifier registers
present in clause 45. struct phy_device gets a couple of new fields:
c45_ids to hold the identifiers and is_c45 to signal that it is clause
45.
get_phy_device() gets a new parameter is_c45 to indicate that the PHY
device should use the clause 45 protocol, and its callers are adjusted
to pass false. The follow-on patch to of_mdio.c will pass true where
appropriate.
EXPORT phy_device_create() so that the follow-on patch to of_mdio.c
can use it to create phy devices for PHYs, that have non-standard
device identifier registers, based on the device tree bindings.
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/phy.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index c291cae8ce32..597d05dd0fb4 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -243,6 +243,15 @@ enum phy_state { | |||
243 | PHY_RESUMING | 243 | PHY_RESUMING |
244 | }; | 244 | }; |
245 | 245 | ||
246 | /** | ||
247 | * struct phy_c45_device_ids - 802.3-c45 Device Identifiers | ||
248 | * @devices_in_package: Bit vector of devices present. | ||
249 | * @device_ids: The device identifer for each present device. | ||
250 | */ | ||
251 | struct phy_c45_device_ids { | ||
252 | u32 devices_in_package; | ||
253 | u32 device_ids[8]; | ||
254 | }; | ||
246 | 255 | ||
247 | /* phy_device: An instance of a PHY | 256 | /* phy_device: An instance of a PHY |
248 | * | 257 | * |
@@ -250,6 +259,8 @@ enum phy_state { | |||
250 | * bus: Pointer to the bus this PHY is on | 259 | * bus: Pointer to the bus this PHY is on |
251 | * dev: driver model device structure for this PHY | 260 | * dev: driver model device structure for this PHY |
252 | * phy_id: UID for this device found during discovery | 261 | * phy_id: UID for this device found during discovery |
262 | * c45_ids: 802.3-c45 Device Identifers if is_c45. | ||
263 | * is_c45: Set to true if this phy uses clause 45 addressing. | ||
253 | * state: state of the PHY for management purposes | 264 | * state: state of the PHY for management purposes |
254 | * dev_flags: Device-specific flags used by the PHY driver. | 265 | * dev_flags: Device-specific flags used by the PHY driver. |
255 | * addr: Bus address of PHY | 266 | * addr: Bus address of PHY |
@@ -285,6 +296,9 @@ struct phy_device { | |||
285 | 296 | ||
286 | u32 phy_id; | 297 | u32 phy_id; |
287 | 298 | ||
299 | struct phy_c45_device_ids c45_ids; | ||
300 | bool is_c45; | ||
301 | |||
288 | enum phy_state state; | 302 | enum phy_state state; |
289 | 303 | ||
290 | u32 dev_flags; | 304 | u32 dev_flags; |
@@ -480,7 +494,9 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val) | |||
480 | return mdiobus_write(phydev->bus, phydev->addr, regnum, val); | 494 | return mdiobus_write(phydev->bus, phydev->addr, regnum, val); |
481 | } | 495 | } |
482 | 496 | ||
483 | struct phy_device* get_phy_device(struct mii_bus *bus, int addr); | 497 | struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, |
498 | bool is_c45, struct phy_c45_device_ids *c45_ids); | ||
499 | struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); | ||
484 | int phy_device_register(struct phy_device *phy); | 500 | int phy_device_register(struct phy_device *phy); |
485 | int phy_init_hw(struct phy_device *phydev); | 501 | int phy_init_hw(struct phy_device *phydev); |
486 | struct phy_device * phy_attach(struct net_device *dev, | 502 | struct phy_device * phy_attach(struct net_device *dev, |