Changeset 30945
- Timestamp:
- 2012-03-15T10:25:49+01:00 (6 years ago)
- Location:
- trunk/target/linux/generic/patches-3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/target/linux/generic/patches-3.3/710-phy-add-mdio_register_board_info.patch
r30906 r30945 1 1 --- a/drivers/net/phy/mdio_bus.c 2 2 +++ b/drivers/net/phy/mdio_bus.c 3 @@ -36,6 +36, 44@@3 @@ -36,6 +36,8 @@ 4 4 #include <asm/irq.h> 5 5 #include <asm/uaccess.h> 6 6 7 +struct mdio_board_entry { 8 + struct list_head list; 9 + struct mdio_board_info board_info; 10 +}; 11 + 12 +static LIST_HEAD(mdio_board_list); 13 +static DEFINE_MUTEX(mdio_board_lock); 14 + 15 +/** 16 + * mdio_register_board_info - register PHY devices for a given board 17 + * @info: array of chip descriptors 18 + * @n: how many descriptors are provided 19 + * Context: can sleep 20 + * 21 + * The board info passed can safely be __initdata ... but be careful of 22 + * any embedded pointers (platform_data, etc), they're copied as-is. 23 + */ 24 +int __init 25 +mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) 26 +{ 27 + struct mdio_board_entry *be; 28 + int i; 29 + 30 + be = kzalloc(n * sizeof(*be), GFP_KERNEL); 31 + if (!be) 32 + return -ENOMEM; 33 + 34 + for (i = 0; i < n; i++, be++, info++) { 35 + memcpy(&be->board_info, info, sizeof(*info)); 36 + mutex_lock(&mdio_board_lock); 37 + list_add_tail(&be->list, &mdio_board_list); 38 + mutex_unlock(&mdio_board_lock); 39 + } 40 + 41 + return 0; 42 +} 43 + 7 +#include "mdio-boardinfo.h" 44 8 + 45 9 /** 46 10 * mdiobus_alloc_size - allocate a mii_bus structure 47 11 * @size: extra amount of memory to allocate for private storage. 48 @@ -192,15 + 230,31@@ void mdiobus_free(struct mii_bus *bus)12 @@ -192,15 +194,33 @@ void mdiobus_free(struct mii_bus *bus) 49 13 } 50 14 EXPORT_SYMBOL(mdiobus_free); … … 71 35 return phydev; 72 36 73 + list_for_each_entry(be, &mdio_board_list, list) 37 + mutex_lock(&__mdio_board_lock); 38 + list_for_each_entry(be, &__mdio_board_list, list) 74 39 + mdiobus_setup_phydev_from_boardinfo(bus, phydev, 75 40 + &be->board_info); 41 + mutex_unlock(&__mdio_board_lock); 76 42 + 77 43 err = phy_device_register(phydev); … … 80 46 --- a/include/linux/phy.h 81 47 +++ b/include/linux/phy.h 82 @@ -399,8 +399,8 @@ struct phy_driver {83 /* Determines the negotiated speed and duplex */84 int (*read_status)(struct phy_device *phydev);85 86 - /*87 - * Update the value in phydev->link to reflect the88 + /*89 + * Update the value in phydev->link to reflect the90 * current link value91 */92 int (*update_link)(struct phy_device *phydev);93 48 @@ -543,4 +543,22 @@ int __init mdio_bus_init(void); 94 49 void mdio_bus_exit(void); … … 103 58 +}; 104 59 + 105 +#ifdef CONFIG_ PHYLIB106 +int mdiobus_register_board_info( struct mdio_board_info const*info, unsigned n);60 +#ifdef CONFIG_MDIO_BOARDINFO 61 +int mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n); 107 62 +#else 108 63 +static inline int 109 +mdiobus_register_board_info( struct mdio_board_info const*info, unsigned n)64 +mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n) 110 65 +{ 111 66 + return 0; … … 114 69 + 115 70 #endif /* __PHY_H */ 71 --- a/drivers/net/phy/Kconfig 72 +++ b/drivers/net/phy/Kconfig 73 @@ -13,6 +13,10 @@ menuconfig PHYLIB 74 75 if PHYLIB 76 77 +config MDIO_BOARDINFO 78 + bool 79 + default y 80 + 81 config SWCONFIG 82 tristate "Switch configuration API" 83 ---help--- 84 --- a/drivers/net/phy/Makefile 85 +++ b/drivers/net/phy/Makefile 86 @@ -2,6 +2,8 @@ 87 88 libphy-objs := phy.o phy_device.o mdio_bus.o 89 90 +obj-$(CONFIG_MDIO_BOARDINFO) += mdio-boardinfo.o 91 + 92 obj-$(CONFIG_PHYLIB) += libphy.o 93 obj-$(CONFIG_SWCONFIG) += swconfig.o 94 obj-$(CONFIG_MARVELL_PHY) += marvell.o 95 --- /dev/null 96 +++ b/drivers/net/phy/mdio-boardinfo.c 97 @@ -0,0 +1,58 @@ 98 +/* 99 + * mdio-boardinfo.c - collect pre-declarations of PHY devices 100 + * 101 + * This program is free software; you can redistribute it and/or modify it 102 + * under the terms of the GNU General Public License as published by the 103 + * Free Software Foundation; either version 2 of the License, or (at your 104 + * option) any later version. 105 + * 106 + */ 107 + 108 +#include <linux/kernel.h> 109 +#include <linux/phy.h> 110 +#include <linux/slab.h> 111 +#include <linux/export.h> 112 +#include <linux/mutex.h> 113 +#include <linux/phy.h> 114 + 115 +#include "mdio-boardinfo.h" 116 + 117 +/* 118 + * These symbols are exported ONLY FOR the mdio_bus component. 119 + * No other users will be supported. 120 + */ 121 + 122 +LIST_HEAD(__mdio_board_list); 123 +EXPORT_SYMBOL_GPL(__mdio_board_list); 124 + 125 +DEFINE_MUTEX(__mdio_board_lock); 126 +EXPORT_SYMBOL_GPL(__mdio_board_lock); 127 + 128 +/** 129 + * mdio_register_board_info - register PHY devices for a given board 130 + * @info: array of chip descriptors 131 + * @n: how many descriptors are provided 132 + * Context: can sleep 133 + * 134 + * The board info passed can safely be __initdata ... but be careful of 135 + * any embedded pointers (platform_data, etc), they're copied as-is. 136 + */ 137 +int __init 138 +mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) 139 +{ 140 + struct mdio_board_entry *be; 141 + int i; 142 + 143 + be = kzalloc(n * sizeof(*be), GFP_KERNEL); 144 + if (!be) 145 + return -ENOMEM; 146 + 147 + for (i = 0; i < n; i++, be++, info++) { 148 + memcpy(&be->board_info, info, sizeof(*info)); 149 + mutex_lock(&__mdio_board_lock); 150 + list_add_tail(&be->list, &__mdio_board_list); 151 + mutex_unlock(&__mdio_board_lock); 152 + } 153 + 154 + return 0; 155 +} 156 --- /dev/null 157 +++ b/drivers/net/phy/mdio-boardinfo.h 158 @@ -0,0 +1,22 @@ 159 +/* 160 + * mdio-boardinfo.h - boardinfo interface internal to the mdio_bus component 161 + * 162 + * This program is free software; you can redistribute it and/or modify it 163 + * under the terms of the GNU General Public License as published by the 164 + * Free Software Foundation; either version 2 of the License, or (at your 165 + * option) any later version. 166 + * 167 + */ 168 + 169 +#include <linux/mutex.h> 170 + 171 +struct mdio_board_entry { 172 + struct list_head list; 173 + struct mdio_board_info board_info; 174 +}; 175 + 176 +/* __mdio_board_lock protects __mdio_board_list 177 + * only mdio_bus components are allowed to use these symbols. 178 + */ 179 +extern struct mutex __mdio_board_lock; 180 +extern struct list_head __mdio_board_list; 181 --- a/drivers/net/Makefile 182 +++ b/drivers/net/Makefile 183 @@ -15,7 +15,7 @@ obj-$(CONFIG_MII) += mii.o 184 obj-$(CONFIG_MDIO) += mdio.o 185 obj-$(CONFIG_NET) += Space.o loopback.o 186 obj-$(CONFIG_NETCONSOLE) += netconsole.o 187 -obj-$(CONFIG_PHYLIB) += phy/ 188 +obj-y += phy/ 189 obj-$(CONFIG_RIONET) += rionet.o 190 obj-$(CONFIG_NET_TEAM) += team/ 191 obj-$(CONFIG_TUN) += tun.o -
trunk/target/linux/generic/patches-3.3/720-phy_adm6996.patch
r29986 r30945 1 1 --- a/drivers/net/phy/Kconfig 2 2 +++ b/drivers/net/phy/Kconfig 3 @@ -10 2,6 +102,13 @@ config MICREL_PHY3 @@ -106,6 +106,13 @@ config MICREL_PHY 4 4 ---help--- 5 5 Supports the KSZ9021, VSC8201, KS8001 PHYs. … … 17 17 --- a/drivers/net/phy/Makefile 18 18 +++ b/drivers/net/phy/Makefile 19 @@ -1 4,6 +14,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o19 @@ -16,6 +16,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o 20 20 obj-$(CONFIG_BROADCOM_PHY) += broadcom.o 21 21 obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o -
trunk/target/linux/generic/patches-3.3/722-phy_mvswitch.patch
r29986 r30945 1 1 --- a/drivers/net/phy/Kconfig 2 2 +++ b/drivers/net/phy/Kconfig 3 @@ -1 09,6 +109,9 @@ config ADM6996_PHY3 @@ -113,6 +113,9 @@ config ADM6996_PHY 4 4 Currently supports the ADM6996FC and ADM6996M switches. 5 5 Support for FC is very limited. … … 13 13 --- a/drivers/net/phy/Makefile 14 14 +++ b/drivers/net/phy/Makefile 15 @@ -1 5,6 +15,7 @@ obj-$(CONFIG_BROADCOM_PHY) += broadcom.o15 @@ -17,6 +17,7 @@ obj-$(CONFIG_BROADCOM_PHY) += broadcom.o 16 16 obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o 17 17 obj-$(CONFIG_ICPLUS_PHY) += icplus.o -
trunk/target/linux/generic/patches-3.3/723-phy_ip175c.patch
r29986 r30945 1 1 --- a/drivers/net/phy/Kconfig 2 2 +++ b/drivers/net/phy/Kconfig 3 @@ -11 2,6 +112,10 @@ config ADM6996_PHY3 @@ -116,6 +116,10 @@ config ADM6996_PHY 4 4 config MVSWITCH_PHY 5 5 tristate "Driver for Marvell 88E6060 switches" … … 14 14 --- a/drivers/net/phy/Makefile 15 15 +++ b/drivers/net/phy/Makefile 16 @@ -1 6,6 +16,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o16 @@ -18,6 +18,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o 17 17 obj-$(CONFIG_ICPLUS_PHY) += icplus.o 18 18 obj-$(CONFIG_ADM6996_PHY) += adm6996.o -
trunk/target/linux/generic/patches-3.3/724-phy_ar8216.patch
r29986 r30945 1 1 --- a/drivers/net/phy/Kconfig 2 2 +++ b/drivers/net/phy/Kconfig 3 @@ -1 16,6 +116,10 @@ config IP17XX_PHY3 @@ -120,6 +120,10 @@ config IP17XX_PHY 4 4 tristate "Driver for IC+ IP17xx switches" 5 5 select SWCONFIG … … 14 14 --- a/drivers/net/phy/Makefile 15 15 +++ b/drivers/net/phy/Makefile 16 @@ - 18,6 +18,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o16 @@ -20,6 +20,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o 17 17 obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o 18 18 obj-$(CONFIG_IP17XX_PHY) += ip17xx.o -
trunk/target/linux/generic/patches-3.3/725-phy_rtl8306.patch
r29986 r30945 1 1 --- a/drivers/net/phy/Kconfig 2 2 +++ b/drivers/net/phy/Kconfig 3 @@ -12 0,6 +120,10 @@ config AR8216_PHY3 @@ -124,6 +124,10 @@ config AR8216_PHY 4 4 tristate "Driver for Atheros AR8216 switches" 5 5 select SWCONFIG … … 14 14 --- a/drivers/net/phy/Makefile 15 15 +++ b/drivers/net/phy/Makefile 16 @@ - 19,6 +19,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o16 @@ -21,6 +21,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o 17 17 obj-$(CONFIG_IP17XX_PHY) += ip17xx.o 18 18 obj-$(CONFIG_REALTEK_PHY) += realtek.o -
trunk/target/linux/generic/patches-3.3/726-phy_rtl8366.patch
r29986 r30945 1 1 --- a/drivers/net/phy/Kconfig 2 2 +++ b/drivers/net/phy/Kconfig 3 @@ -16 2,6 +162,31 @@ config MDIO_OCTEON3 @@ -166,6 +166,31 @@ config MDIO_OCTEON 4 4 5 5 If in doubt, say Y. … … 35 35 --- a/drivers/net/phy/Makefile 36 36 +++ b/drivers/net/phy/Makefile 37 @@ -2 0,6 +20,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o37 @@ -22,6 +22,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o 38 38 obj-$(CONFIG_REALTEK_PHY) += realtek.o 39 39 obj-$(CONFIG_AR8216_PHY) += ar8216.o -
trunk/target/linux/generic/patches-3.3/727-phy-rtl8367.patch
r29986 r30945 1 1 --- a/drivers/net/phy/Kconfig 2 2 +++ b/drivers/net/phy/Kconfig 3 @@ -1 79,6 +179,10 @@ config RTL8366RB_PHY3 @@ -183,6 +183,10 @@ config RTL8366RB_PHY 4 4 tristate "Driver for the Realtek RTL8366RB switch" 5 5 select SWCONFIG … … 14 14 --- a/drivers/net/phy/Makefile 15 15 +++ b/drivers/net/phy/Makefile 16 @@ -2 3,6 +23,7 @@ obj-$(CONFIG_RTL8306_PHY) += rtl8306.o16 @@ -25,6 +25,7 @@ obj-$(CONFIG_RTL8306_PHY) += rtl8306.o 17 17 obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o 18 18 obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o
Note: See TracChangeset
for help on using the changeset viewer.