From f62220d3a9ccb879c3f90f845ae57b724b7bbb62 Mon Sep 17 00:00:00 2001 From: Andy Fleming Date: Fri, 18 Apr 2008 17:29:54 -0500 Subject: phylib: Add support for board-level PHY fixups Sometimes the specific interaction between the platform and the PHY requires special handling. For instance, to change where the PHY's clock input is, or to add a delay to account for latency issues in the data path. We add a mechanism for registering a callback with the PHY Lib to be called on matching PHYs when they are brought up, or reset. Signed-off-by: Andy Fleming Signed-off-by: Jeff Garzik --- include/linux/phy.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/phy.h b/include/linux/phy.h index 779cbcd65f6..02df20f085f 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -379,6 +379,18 @@ struct phy_driver { }; #define to_phy_driver(d) container_of(d, struct phy_driver, driver) +#define PHY_ANY_ID "MATCH ANY PHY" +#define PHY_ANY_UID 0xffffffff + +/* A Structure for boards to register fixups with the PHY Lib */ +struct phy_fixup { + struct list_head list; + char bus_id[BUS_ID_SIZE]; + u32 phy_uid; + u32 phy_uid_mask; + int (*run)(struct phy_device *phydev); +}; + int phy_read(struct phy_device *phydev, u16 regnum); int phy_write(struct phy_device *phydev, u16 regnum, u16 val); int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); @@ -386,8 +398,8 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr); int phy_clear_interrupt(struct phy_device *phydev); int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); struct phy_device * phy_attach(struct net_device *dev, - const char *phy_id, u32 flags, phy_interface_t interface); -struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, + const char *bus_id, u32 flags, phy_interface_t interface); +struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, void (*handler)(struct net_device *), u32 flags, phy_interface_t interface); void phy_disconnect(struct phy_device *phydev); @@ -427,5 +439,13 @@ void phy_print_status(struct phy_device *phydev); struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); void phy_device_free(struct phy_device *phydev); +int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, + int (*run)(struct phy_device *)); +int phy_register_fixup_for_id(const char *bus_id, + int (*run)(struct phy_device *)); +int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask, + int (*run)(struct phy_device *)); +int phy_scan_fixups(struct phy_device *phydev); + extern struct bus_type mdio_bus_type; #endif /* __PHY_H */ -- cgit v1.2.3 From 461e6c856faf9cdd8862fa4d0785974a64e39dba Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Fri, 25 Apr 2008 00:29:00 -0700 Subject: xfrm: alg_key_len & alg_icv_len should be unsigned In commit ba749ae98d5aa9d2ce9a7facde0deed454f92230 ([XFRM]: alg_key_len should be unsigned to avoid integer divides ) alg_key_len field of struct xfrm_algo was converted to unsigned int to avoid integer divides. Then Herbert in commit 1a6509d991225ad210de54c63314fd9542922095 ([IPSEC]: Add support for combined mode algorithms) added a new structure xfrm_algo_aead, that resurrected a signed int for alg_key_len and re-introduce integer divides. This patch avoids these divides and saves 64 bytes of text on i386. Signed-off-by: Eric Dumazet Acked-by: Herbert Xu Signed-off-by: David S. Miller --- include/linux/xfrm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/linux') diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 0c82c80b277..2ca6bae8872 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h @@ -97,10 +97,10 @@ struct xfrm_algo { }; struct xfrm_algo_aead { - char alg_name[64]; - int alg_key_len; /* in bits */ - int alg_icv_len; /* in bits */ - char alg_key[0]; + char alg_name[64]; + unsigned int alg_key_len; /* in bits */ + unsigned int alg_icv_len; /* in bits */ + char alg_key[0]; }; struct xfrm_stats { -- cgit v1.2.3