From patchwork Wed Feb 8 00:20:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 140045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 912CAB6EEA for ; Wed, 8 Feb 2012 11:20:15 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9B9628111; Wed, 8 Feb 2012 01:20:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NKhZIKfsZeQm; Wed, 8 Feb 2012 01:20:11 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 53D3F2811E; Wed, 8 Feb 2012 01:20:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7DCD42811E for ; Wed, 8 Feb 2012 01:20:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4s0nH76cje5Q for ; Wed, 8 Feb 2012 01:20:04 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from oproxy8-pub.bluehost.com (oproxy8-pub.bluehost.com [69.89.22.20]) by theia.denx.de (Postfix) with SMTP id 3CCFB28111 for ; Wed, 8 Feb 2012 01:20:02 +0100 (CET) Received: (qmail 28993 invoked by uid 0); 8 Feb 2012 00:20:00 -0000 Received: from unknown (HELO box284.bluehost.com) (69.89.31.84) by oproxy8.bluehost.com with SMTP; 8 Feb 2012 00:20:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=boundarydevices.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=X7eA44XlXTS1FWPl4d2Uf7Mq6DidsLmYlhOlCuESV/8=; b=FDz3TGgCjXcpB2RgvdDU1M/hdxF08y0EmqhGT+eVVkZL6POKxBnYmzwA7fgLmKHxF5BOUs9kJvZrPbl+onxnTQzeKGlo7iPIOZXLLVjzjFKm8TjCvnAWj+jTugy11i9A; Received: from [70.96.116.236] (helo=officeserver-2) by box284.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RuvGQ-0005k5-Pa; Tue, 07 Feb 2012 17:19:59 -0700 Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1RuvGi-0001yO-Or; Tue, 07 Feb 2012 17:20:16 -0700 From: Troy Kisky To: dirk.behme@googlemail.com Date: Tue, 7 Feb 2012 17:20:14 -0700 Message-Id: <1328660414-7551-2-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1328660414-7551-1-git-send-email-troy.kisky@boundarydevices.com> References: <1328660414-7551-1-git-send-email-troy.kisky@boundarydevices.com> X-Identified-User: {1412:box284.bluehost.com:boundar4:boundarydevices.com} {sentby:smtp auth 70.96.116.236 authed with troy.kisky@boundarydevices.com} Cc: u-boot@lists.denx.de, afleming@gmail.com Subject: [U-Boot] [PATCH v2 2/2] RFC: Let linker create phy array X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Troy Kisky --- drivers/net/phy/atheros.c | 9 +-------- drivers/net/phy/broadcom.c | 15 +++------------ drivers/net/phy/davicom.c | 9 +-------- drivers/net/phy/lxt.c | 9 +-------- drivers/net/phy/marvell.c | 24 ++++++------------------ drivers/net/phy/micrel.c | 12 ++---------- drivers/net/phy/natsemi.c | 9 +-------- drivers/net/phy/phy.c | 39 +++++---------------------------------- drivers/net/phy/realtek.c | 9 +-------- drivers/net/phy/smsc.c | 15 +++------------ drivers/net/phy/teranetics.c | 9 +-------- drivers/net/phy/vitesse.c | 30 ++++++++---------------------- include/phy.h | 4 ++++ include/u-boot-common.lds | 7 +++++++ 14 files changed, 44 insertions(+), 156 deletions(-) diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c index 798473d..8e522ca 100644 --- a/drivers/net/phy/atheros.c +++ b/drivers/net/phy/atheros.c @@ -30,7 +30,7 @@ static int ar8021_config(struct phy_device *phydev) return 0; } -struct phy_driver AR8021_driver = { +static struct phy_driver AR8021_driver __phy_entry = { .name = "AR8021", .uid = 0x4dd040, .mask = 0xfffff0, @@ -39,10 +39,3 @@ struct phy_driver AR8021_driver = { .startup = genphy_startup, .shutdown = genphy_shutdown, }; - -int phy_atheros_init(void) -{ - phy_register(&AR8021_driver); - - return 0; -} diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 427ac60..133e907 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -248,7 +248,7 @@ static int bcm5482_startup(struct phy_device *phydev) return 0; } -static struct phy_driver BCM5461S_driver = { +static struct phy_driver BCM5461S_driver __phy_entry = { .name = "Broadcom BCM5461S", .uid = 0x2060c0, .mask = 0xfffff0, @@ -258,7 +258,7 @@ static struct phy_driver BCM5461S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver BCM5464S_driver = { +static struct phy_driver BCM5464S_driver __phy_entry = { .name = "Broadcom BCM5464S", .uid = 0x2060b0, .mask = 0xfffff0, @@ -268,7 +268,7 @@ static struct phy_driver BCM5464S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver BCM5482S_driver = { +static struct phy_driver BCM5482S_driver __phy_entry = { .name = "Broadcom BCM5482S", .uid = 0x143bcb0, .mask = 0xffffff0, @@ -277,12 +277,3 @@ static struct phy_driver BCM5482S_driver = { .startup = &bcm5482_startup, .shutdown = &genphy_shutdown, }; - -int phy_broadcom_init(void) -{ - phy_register(&BCM5482S_driver); - phy_register(&BCM5464S_driver); - phy_register(&BCM5461S_driver); - - return 0; -} diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index e96a4af..4c1e6b8 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c @@ -80,7 +80,7 @@ static int dm9161_startup(struct phy_device *phydev) return 0; } -static struct phy_driver DM9161_driver = { +static struct phy_driver DM9161_driver __phy_entry = { .name = "Davicom DM9161E", .uid = 0x181b880, .mask = 0xffffff0, @@ -89,10 +89,3 @@ static struct phy_driver DM9161_driver = { .startup = &dm9161_startup, .shutdown = &genphy_shutdown, }; - -int phy_davicom_init(void) -{ - phy_register(&DM9161_driver); - - return 0; -} diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index d67bbdd..e43ea93 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c @@ -69,7 +69,7 @@ static int lxt971_startup(struct phy_device *phydev) return 0; } -static struct phy_driver LXT971_driver = { +static struct phy_driver LXT971_driver __phy_entry = { .name = "LXT971", .uid = 0x1378e0, .mask = 0xfffff0, @@ -78,10 +78,3 @@ static struct phy_driver LXT971_driver = { .startup = &lxt971_startup, .shutdown = &genphy_shutdown, }; - -int phy_lxt_init(void) -{ - phy_register(&LXT971_driver); - - return 0; -} diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index e51e799..ebc2ba9 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -395,7 +395,7 @@ static int m88e1149_config(struct phy_device *phydev) } -static struct phy_driver M88E1011S_driver = { +static struct phy_driver M88E1011S_driver __phy_entry = { .name = "Marvell 88E1011S", .uid = 0x1410c60, .mask = 0xffffff0, @@ -405,7 +405,7 @@ static struct phy_driver M88E1011S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1111S_driver = { +static struct phy_driver M88E1111S_driver __phy_entry = { .name = "Marvell 88E1111S", .uid = 0x1410cc0, .mask = 0xffffff0, @@ -415,7 +415,7 @@ static struct phy_driver M88E1111S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1118_driver = { +static struct phy_driver M88E1118_driver __phy_entry = { .name = "Marvell 88E1118", .uid = 0x1410e10, .mask = 0xffffff0, @@ -425,7 +425,7 @@ static struct phy_driver M88E1118_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1121R_driver = { +static struct phy_driver M88E1121R_driver__phy_entry = { .name = "Marvell 88E1121R", .uid = 0x1410cb0, .mask = 0xffffff0, @@ -435,7 +435,7 @@ static struct phy_driver M88E1121R_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1145_driver = { +static struct phy_driver M88E1145_driver __phy_entry = { .name = "Marvell 88E1145", .uid = 0x1410cd0, .mask = 0xffffff0, @@ -445,7 +445,7 @@ static struct phy_driver M88E1145_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1149S_driver = { +static struct phy_driver M88E1149S_driver __phy_entry = { .name = "Marvell 88E1149S", .uid = 0x1410ca0, .mask = 0xffffff0, @@ -454,15 +454,3 @@ static struct phy_driver M88E1149S_driver = { .startup = &m88e1011s_startup, .shutdown = &genphy_shutdown, }; - -int phy_marvell_init(void) -{ - phy_register(&M88E1149S_driver); - phy_register(&M88E1145_driver); - phy_register(&M88E1121R_driver); - phy_register(&M88E1118_driver); - phy_register(&M88E1111S_driver); - phy_register(&M88E1011S_driver); - - return 0; -} diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index d4e64f2..5848f25 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -22,7 +22,7 @@ */ #include -static struct phy_driver KSZ804_driver = { +static struct phy_driver KSZ804_driver __phy_entry = { .name = "Micrel KSZ804", .uid = 0x221510, .mask = 0xfffff0, @@ -32,7 +32,7 @@ static struct phy_driver KSZ804_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver KS8721_driver = { +static struct phy_driver KS8721_driver __phy_entry = { .name = "Micrel KS8721BL", .uid = 0x221610, .mask = 0xfffff0, @@ -41,11 +41,3 @@ static struct phy_driver KS8721_driver = { .startup = &genphy_startup, .shutdown = &genphy_shutdown, }; - -int phy_micrel_init(void) -{ - phy_register(&KSZ804_driver); - phy_register(&KS8721_driver); - - return 0; -} diff --git a/drivers/net/phy/natsemi.c b/drivers/net/phy/natsemi.c index ea60ac1..eedf505 100644 --- a/drivers/net/phy/natsemi.c +++ b/drivers/net/phy/natsemi.c @@ -78,7 +78,7 @@ static int dp83865_startup(struct phy_device *phydev) } -static struct phy_driver DP83865_driver = { +static struct phy_driver DP83865_driver __phy_entry = { .name = "NatSemi DP83865", .uid = 0x20005c70, .mask = 0xfffffff0, @@ -87,10 +87,3 @@ static struct phy_driver DP83865_driver = { .startup = &dp83865_startup, .shutdown = &genphy_shutdown, }; - -int phy_natsemi_init(void) -{ - phy_register(&DP83865_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index eb55180..d3441c1 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -420,40 +420,11 @@ static LIST_HEAD(phy_drivers); int phy_init(void) { -#ifdef CONFIG_PHY_ATHEROS - phy_atheros_init(); -#endif -#ifdef CONFIG_PHY_BROADCOM - phy_broadcom_init(); -#endif -#ifdef CONFIG_PHY_DAVICOM - phy_davicom_init(); -#endif -#ifdef CONFIG_PHY_LXT - phy_lxt_init(); -#endif -#ifdef CONFIG_PHY_MARVELL - phy_marvell_init(); -#endif -#ifdef CONFIG_PHY_MICREL - phy_micrel_init(); -#endif -#ifdef CONFIG_PHY_NATSEMI - phy_natsemi_init(); -#endif -#ifdef CONFIG_PHY_REALTEK - phy_realtek_init(); -#endif -#ifdef CONFIG_PHY_SMSC - phy_smsc_init(); -#endif -#ifdef CONFIG_PHY_TERANETICS - phy_teranetics_init(); -#endif -#ifdef CONFIG_PHY_VITESSE - phy_vitesse_init(); -#endif - + struct phy_driver *entry = &__phy_entry_start; + while (entry < &__phy_entry_end) { + phy_register(entry); + entry++; + } return 0; } diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index b7e2753..ae7e2e2 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -112,7 +112,7 @@ static int rtl8211b_startup(struct phy_device *phydev) return 0; } -static struct phy_driver RTL8211B_driver = { +static struct phy_driver RTL8211B_driver __phy_entry = { .name = "RealTek RTL8211B", .uid = 0x1cc910, .mask = 0xfffff0, @@ -121,10 +121,3 @@ static struct phy_driver RTL8211B_driver = { .startup = &rtl8211b_startup, .shutdown = &genphy_shutdown, }; - -int phy_realtek_init(void) -{ - phy_register(&RTL8211B_driver); - - return 0; -} diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 6dee8eb..aba64bc 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -52,7 +52,7 @@ static int smsc_startup(struct phy_device *phydev) return 0; } -static struct phy_driver lan8700_driver = { +static struct phy_driver lan8700_driver __phy_entry = { .name = "SMSC LAN8700", .uid = 0x0007c0c0, .mask = 0xffff0, @@ -62,7 +62,7 @@ static struct phy_driver lan8700_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver lan911x_driver = { +static struct phy_driver lan911x_driver __phy_entry = { .name = "SMSC LAN911x Internal PHY", .uid = 0x0007c0d0, .mask = 0xffff0, @@ -72,7 +72,7 @@ static struct phy_driver lan911x_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver lan8710_driver = { +static struct phy_driver lan8710_driver __phy_entry = { .name = "SMSC LAN8710/LAN8720", .uid = 0x0007c0f0, .mask = 0xffff0, @@ -81,12 +81,3 @@ static struct phy_driver lan8710_driver = { .startup = &smsc_startup, .shutdown = &genphy_shutdown, }; - -int phy_smsc_init(void) -{ - phy_register(&lan8710_driver); - phy_register(&lan911x_driver); - phy_register(&lan8700_driver); - - return 0; -} diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index 78447b7..544b3fa 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -93,7 +93,7 @@ int tn2020_startup(struct phy_device *phydev) return 0; } -struct phy_driver tn2020_driver = { +static struct phy_driver tn2020_driver __phy_entry = { .name = "Teranetics TN2020", .uid = PHY_UID_TN2020, .mask = 0xfffffff0, @@ -105,10 +105,3 @@ struct phy_driver tn2020_driver = { .startup = &tn2020_startup, .shutdown = &gen10g_shutdown, }; - -int phy_teranetics_init(void) -{ - phy_register(&tn2020_driver); - - return 0; -} diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index d48d4fe..302b599 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c @@ -146,7 +146,7 @@ int vsc8601_config(struct phy_device *phydev) return 0; } -static struct phy_driver VSC8211_driver = { +static struct phy_driver VSC8211_driver __phy_entry = { .name = "Vitesse VSC8211", .uid = 0xfc4b0, .mask = 0xffff0, @@ -156,7 +156,7 @@ static struct phy_driver VSC8211_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8221_driver = { +static struct phy_driver VSC8221_driver __phy_entry = { .name = "Vitesse VSC8221", .uid = 0xfc550, .mask = 0xffff0, @@ -166,7 +166,7 @@ static struct phy_driver VSC8221_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8244_driver = { +static struct phy_driver VSC8244_driver __phy_entry = { .name = "Vitesse VSC8244", .uid = 0xfc6c0, .mask = 0xffff0, @@ -176,7 +176,7 @@ static struct phy_driver VSC8244_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8234_driver = { +static struct phy_driver VSC8234_driver __phy_entry = { .name = "Vitesse VSC8234", .uid = 0xfc620, .mask = 0xffff0, @@ -186,7 +186,7 @@ static struct phy_driver VSC8234_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8601_driver = { +static struct phy_driver VSC8601_driver __phy_entry = { .name = "Vitesse VSC8601", .uid = 0x70420, .mask = 0xffff0, @@ -196,7 +196,7 @@ static struct phy_driver VSC8601_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8641_driver = { +static struct phy_driver VSC8641_driver __phy_entry = { .name = "Vitesse VSC8641", .uid = 0x70430, .mask = 0xffff0, @@ -207,7 +207,7 @@ static struct phy_driver VSC8641_driver = { }; /* Vitesse bought Cicada, so we'll put these here */ -static struct phy_driver cis8201_driver = { +static struct phy_driver cis8201_driver __phy_entry = { .name = "CIS8201", .uid = 0xfc410, .mask = 0xffff0, @@ -217,7 +217,7 @@ static struct phy_driver cis8201_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver cis8204_driver = { +static struct phy_driver cis8204_driver __phy_entry = { .name = "Cicada Cis8204", .uid = 0xfc440, .mask = 0xffff0, @@ -226,17 +226,3 @@ static struct phy_driver cis8204_driver = { .startup = &vitesse_startup, .shutdown = &genphy_shutdown, }; - -int phy_vitesse_init(void) -{ - phy_register(&VSC8641_driver); - phy_register(&VSC8601_driver); - phy_register(&VSC8234_driver); - phy_register(&VSC8244_driver); - phy_register(&VSC8211_driver); - phy_register(&VSC8221_driver); - phy_register(&cis8201_driver); - phy_register(&cis8204_driver); - - return 0; -} diff --git a/include/phy.h b/include/phy.h index bc522d5..f0eb502 100644 --- a/include/phy.h +++ b/include/phy.h @@ -23,6 +23,7 @@ #ifndef _PHY_H #define _PHY_H +#include #include #include #include @@ -231,4 +232,7 @@ int phy_vitesse_init(void); /* PHY UIDs for various PHYs that are referenced in external code */ #define PHY_UID_TN2020 0x00a19410 +#define __phy_entry __attribute__((section(".phy_entry"))) __used __aligned(4) +extern struct phy_driver __phy_entry_start, __phy_entry_end; + #endif diff --git a/include/u-boot-common.lds b/include/u-boot-common.lds index 6d5a4d3..b9e72cf 100644 --- a/include/u-boot-common.lds +++ b/include/u-boot-common.lds @@ -12,6 +12,13 @@ } U_BOOT_LDS_SYMBOL(__u_boot_cmd_end) = .; + . = ALIGN(4); + U_BOOT_LDS_SYMBOL(__phy_entry_start) = .; + .phy_entry : { + KEEP(*(.phy_entry)) + } + U_BOOT_LDS_SYMBOL(__phy_entry_end) = .; + /* powerpc specific, but harmless for others */ . = ALIGN(4); U_BOOT_LDS_SYMBOL(__start___ex_table) = .;