diff options
author | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-03-15 09:25:49 +0000 |
---|---|---|
committer | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-03-15 09:25:49 +0000 |
commit | d434128dd182fc55828b3a9c54770d6910d19e0c (patch) | |
tree | a16543494137951150b91eab5862f9ac0112d8ce | |
parent | c69dbabba4f8a45bdd20755946323abbaff7db7f (diff) |
linux/3.3: build mdio_register_board_info into the kernel if PHYLIB is selected
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30945 3c298f89-4303-0410-b956-a3cf2f4a3e73
8 files changed, 144 insertions, 68 deletions
diff --git a/target/linux/generic/patches-3.3/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/patches-3.3/710-phy-add-mdio_register_board_info.patch index 77c0a7e3b..f4c00ca7f 100644 --- a/target/linux/generic/patches-3.3/710-phy-add-mdio_register_board_info.patch +++ b/target/linux/generic/patches-3.3/710-phy-add-mdio_register_board_info.patch @@ -1,51 +1,15 @@ --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c -@@ -36,6 +36,44 @@ +@@ -36,6 +36,8 @@ #include <asm/irq.h> #include <asm/uaccess.h> -+struct mdio_board_entry { -+ struct list_head list; -+ struct mdio_board_info board_info; -+}; -+ -+static LIST_HEAD(mdio_board_list); -+static DEFINE_MUTEX(mdio_board_lock); -+ -+/** -+ * mdio_register_board_info - register PHY devices for a given board -+ * @info: array of chip descriptors -+ * @n: how many descriptors are provided -+ * Context: can sleep -+ * -+ * The board info passed can safely be __initdata ... but be careful of -+ * any embedded pointers (platform_data, etc), they're copied as-is. -+ */ -+int __init -+mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) -+{ -+ struct mdio_board_entry *be; -+ int i; -+ -+ be = kzalloc(n * sizeof(*be), GFP_KERNEL); -+ if (!be) -+ return -ENOMEM; -+ -+ for (i = 0; i < n; i++, be++, info++) { -+ memcpy(&be->board_info, info, sizeof(*info)); -+ mutex_lock(&mdio_board_lock); -+ list_add_tail(&be->list, &mdio_board_list); -+ mutex_unlock(&mdio_board_lock); -+ } -+ -+ return 0; -+} -+ ++#include "mdio-boardinfo.h" + /** * mdiobus_alloc_size - allocate a mii_bus structure * @size: extra amount of memory to allocate for private storage. -@@ -192,15 +230,31 @@ void mdiobus_free(struct mii_bus *bus) +@@ -192,15 +194,33 @@ void mdiobus_free(struct mii_bus *bus) } EXPORT_SYMBOL(mdiobus_free); @@ -70,26 +34,17 @@ if (IS_ERR(phydev) || phydev == NULL) return phydev; -+ list_for_each_entry(be, &mdio_board_list, list) ++ mutex_lock(&__mdio_board_lock); ++ list_for_each_entry(be, &__mdio_board_list, list) + mdiobus_setup_phydev_from_boardinfo(bus, phydev, + &be->board_info); ++ mutex_unlock(&__mdio_board_lock); + err = phy_device_register(phydev); if (err) { phy_device_free(phydev); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -399,8 +399,8 @@ struct phy_driver { - /* Determines the negotiated speed and duplex */ - int (*read_status)(struct phy_device *phydev); - -- /* -- * Update the value in phydev->link to reflect the -+ /* -+ * Update the value in phydev->link to reflect the - * current link value - */ - int (*update_link)(struct phy_device *phydev); @@ -543,4 +543,22 @@ int __init mdio_bus_init(void); void mdio_bus_exit(void); @@ -102,14 +57,135 @@ + const void *platform_data; +}; + -+#ifdef CONFIG_PHYLIB -+int mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n); ++#ifdef CONFIG_MDIO_BOARDINFO ++int mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n); +#else +static inline int -+mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) ++mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n) +{ + return 0; +} +#endif + #endif /* __PHY_H */ +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -13,6 +13,10 @@ menuconfig PHYLIB + + if PHYLIB + ++config MDIO_BOARDINFO ++ bool ++ default y ++ + config SWCONFIG + tristate "Switch configuration API" + ---help--- +--- a/drivers/net/phy/Makefile ++++ b/drivers/net/phy/Makefile +@@ -2,6 +2,8 @@ + + libphy-objs := phy.o phy_device.o mdio_bus.o + ++obj-$(CONFIG_MDIO_BOARDINFO) += mdio-boardinfo.o ++ + obj-$(CONFIG_PHYLIB) += libphy.o + obj-$(CONFIG_SWCONFIG) += swconfig.o + obj-$(CONFIG_MARVELL_PHY) += marvell.o +--- /dev/null ++++ b/drivers/net/phy/mdio-boardinfo.c +@@ -0,0 +1,58 @@ ++/* ++ * mdio-boardinfo.c - collect pre-declarations of PHY devices ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/phy.h> ++#include <linux/slab.h> ++#include <linux/export.h> ++#include <linux/mutex.h> ++#include <linux/phy.h> ++ ++#include "mdio-boardinfo.h" ++ ++/* ++ * These symbols are exported ONLY FOR the mdio_bus component. ++ * No other users will be supported. ++ */ ++ ++LIST_HEAD(__mdio_board_list); ++EXPORT_SYMBOL_GPL(__mdio_board_list); ++ ++DEFINE_MUTEX(__mdio_board_lock); ++EXPORT_SYMBOL_GPL(__mdio_board_lock); ++ ++/** ++ * mdio_register_board_info - register PHY devices for a given board ++ * @info: array of chip descriptors ++ * @n: how many descriptors are provided ++ * Context: can sleep ++ * ++ * The board info passed can safely be __initdata ... but be careful of ++ * any embedded pointers (platform_data, etc), they're copied as-is. ++ */ ++int __init ++mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) ++{ ++ struct mdio_board_entry *be; ++ int i; ++ ++ be = kzalloc(n * sizeof(*be), GFP_KERNEL); ++ if (!be) ++ return -ENOMEM; ++ ++ for (i = 0; i < n; i++, be++, info++) { ++ memcpy(&be->board_info, info, sizeof(*info)); ++ mutex_lock(&__mdio_board_lock); ++ list_add_tail(&be->list, &__mdio_board_list); ++ mutex_unlock(&__mdio_board_lock); ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/drivers/net/phy/mdio-boardinfo.h +@@ -0,0 +1,22 @@ ++/* ++ * mdio-boardinfo.h - boardinfo interface internal to the mdio_bus component ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include <linux/mutex.h> ++ ++struct mdio_board_entry { ++ struct list_head list; ++ struct mdio_board_info board_info; ++}; ++ ++/* __mdio_board_lock protects __mdio_board_list ++ * only mdio_bus components are allowed to use these symbols. ++ */ ++extern struct mutex __mdio_board_lock; ++extern struct list_head __mdio_board_list; +--- a/drivers/net/Makefile ++++ b/drivers/net/Makefile +@@ -15,7 +15,7 @@ obj-$(CONFIG_MII) += mii.o + obj-$(CONFIG_MDIO) += mdio.o + obj-$(CONFIG_NET) += Space.o loopback.o + obj-$(CONFIG_NETCONSOLE) += netconsole.o +-obj-$(CONFIG_PHYLIB) += phy/ ++obj-y += phy/ + obj-$(CONFIG_RIONET) += rionet.o + obj-$(CONFIG_NET_TEAM) += team/ + obj-$(CONFIG_TUN) += tun.o diff --git a/target/linux/generic/patches-3.3/720-phy_adm6996.patch b/target/linux/generic/patches-3.3/720-phy_adm6996.patch index d4dbbb5c8..c99824a6b 100644 --- a/target/linux/generic/patches-3.3/720-phy_adm6996.patch +++ b/target/linux/generic/patches-3.3/720-phy_adm6996.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -102,6 +102,13 @@ config MICREL_PHY +@@ -106,6 +106,13 @@ config MICREL_PHY ---help--- Supports the KSZ9021, VSC8201, KS8001 PHYs. @@ -16,7 +16,7 @@ depends on PHYLIB=y --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o +@@ -16,6 +16,7 @@ obj-$(CONFIG_VITESSE_PHY) += vitesse.o obj-$(CONFIG_BROADCOM_PHY) += broadcom.o obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o obj-$(CONFIG_ICPLUS_PHY) += icplus.o diff --git a/target/linux/generic/patches-3.3/722-phy_mvswitch.patch b/target/linux/generic/patches-3.3/722-phy_mvswitch.patch index 925cc4561..8b5bac2b1 100644 --- a/target/linux/generic/patches-3.3/722-phy_mvswitch.patch +++ b/target/linux/generic/patches-3.3/722-phy_mvswitch.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -109,6 +109,9 @@ config ADM6996_PHY +@@ -113,6 +113,9 @@ config ADM6996_PHY Currently supports the ADM6996FC and ADM6996M switches. Support for FC is very limited. @@ -12,7 +12,7 @@ depends on PHYLIB=y --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -15,6 +15,7 @@ obj-$(CONFIG_BROADCOM_PHY) += broadcom.o +@@ -17,6 +17,7 @@ obj-$(CONFIG_BROADCOM_PHY) += broadcom.o obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o obj-$(CONFIG_ICPLUS_PHY) += icplus.o obj-$(CONFIG_ADM6996_PHY) += adm6996.o diff --git a/target/linux/generic/patches-3.3/723-phy_ip175c.patch b/target/linux/generic/patches-3.3/723-phy_ip175c.patch index 0ac339e9a..05b961909 100644 --- a/target/linux/generic/patches-3.3/723-phy_ip175c.patch +++ b/target/linux/generic/patches-3.3/723-phy_ip175c.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -112,6 +112,10 @@ config ADM6996_PHY +@@ -116,6 +116,10 @@ config ADM6996_PHY config MVSWITCH_PHY tristate "Driver for Marvell 88E6060 switches" @@ -13,7 +13,7 @@ depends on PHYLIB=y --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o +@@ -18,6 +18,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o obj-$(CONFIG_ICPLUS_PHY) += icplus.o obj-$(CONFIG_ADM6996_PHY) += adm6996.o obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o diff --git a/target/linux/generic/patches-3.3/724-phy_ar8216.patch b/target/linux/generic/patches-3.3/724-phy_ar8216.patch index 7a51dccee..79169db74 100644 --- a/target/linux/generic/patches-3.3/724-phy_ar8216.patch +++ b/target/linux/generic/patches-3.3/724-phy_ar8216.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -116,6 +116,10 @@ config IP17XX_PHY +@@ -120,6 +120,10 @@ config IP17XX_PHY tristate "Driver for IC+ IP17xx switches" select SWCONFIG @@ -13,7 +13,7 @@ depends on PHYLIB=y --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o +@@ -20,6 +20,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o obj-$(CONFIG_IP17XX_PHY) += ip17xx.o obj-$(CONFIG_REALTEK_PHY) += realtek.o diff --git a/target/linux/generic/patches-3.3/725-phy_rtl8306.patch b/target/linux/generic/patches-3.3/725-phy_rtl8306.patch index 42cd274ca..e243afe10 100644 --- a/target/linux/generic/patches-3.3/725-phy_rtl8306.patch +++ b/target/linux/generic/patches-3.3/725-phy_rtl8306.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -120,6 +120,10 @@ config AR8216_PHY +@@ -124,6 +124,10 @@ config AR8216_PHY tristate "Driver for Atheros AR8216 switches" select SWCONFIG @@ -13,7 +13,7 @@ depends on PHYLIB=y --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -19,6 +19,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o +@@ -21,6 +21,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o obj-$(CONFIG_IP17XX_PHY) += ip17xx.o obj-$(CONFIG_REALTEK_PHY) += realtek.o obj-$(CONFIG_AR8216_PHY) += ar8216.o diff --git a/target/linux/generic/patches-3.3/726-phy_rtl8366.patch b/target/linux/generic/patches-3.3/726-phy_rtl8366.patch index 622a4327c..190b28f45 100644 --- a/target/linux/generic/patches-3.3/726-phy_rtl8366.patch +++ b/target/linux/generic/patches-3.3/726-phy_rtl8366.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -162,6 +162,31 @@ config MDIO_OCTEON +@@ -166,6 +166,31 @@ config MDIO_OCTEON If in doubt, say Y. @@ -34,7 +34,7 @@ config MICREL_KS8995MA --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -20,6 +20,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o +@@ -22,6 +22,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o obj-$(CONFIG_REALTEK_PHY) += realtek.o obj-$(CONFIG_AR8216_PHY) += ar8216.o obj-$(CONFIG_RTL8306_PHY) += rtl8306.o diff --git a/target/linux/generic/patches-3.3/727-phy-rtl8367.patch b/target/linux/generic/patches-3.3/727-phy-rtl8367.patch index 820bda0cd..ca8ccdf61 100644 --- a/target/linux/generic/patches-3.3/727-phy-rtl8367.patch +++ b/target/linux/generic/patches-3.3/727-phy-rtl8367.patch @@ -1,6 +1,6 @@ --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -179,6 +179,10 @@ config RTL8366RB_PHY +@@ -183,6 +183,10 @@ config RTL8366RB_PHY tristate "Driver for the Realtek RTL8366RB switch" select SWCONFIG @@ -13,7 +13,7 @@ depends on RTL8366S_PHY || RTL8366RB_PHY --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -23,6 +23,7 @@ obj-$(CONFIG_RTL8306_PHY) += rtl8306.o +@@ -25,6 +25,7 @@ obj-$(CONFIG_RTL8306_PHY) += rtl8306.o obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o |