linux-mips
[Top] [All Lists]

[PATCH 2/5] ar7: add fixed PHY support for the two on-board cpmac

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 2/5] ar7: add fixed PHY support for the two on-board cpmac
From: Florian Fainelli <florian@openwrt.org>
Date: Tue, 4 Aug 2009 22:52:47 +0200
Cc: linux-mips@linux-mips.org, netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:date:subject :mime-version:x-uid:x-length:to:cc:content-type :content-transfer-encoding:content-disposition:message-id; bh=C0hZ8zo8gjhNmWS9qMO1Y0b7wIZ2hDvJ+HrFtvajZhw=; b=pBvPvexeg/PJVts3CKnBaMY+ucTDYDP4LyZlq53Yirrn06nGCO9rhgEk6UfJOw9sTX YdU+GXIMgKpM+i1OZ9IWD9hgmhOIRiYEY24j/TItp6mkBG236Ekz1BhTwurfkbUB3+X2 DSsXnn17w2iYQj2BsTZaZmY64yYs3c8iZ3riA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:date:subject:mime-version:x-uid:x-length:to:cc :content-type:content-transfer-encoding:content-disposition :message-id; b=PpO2mVHCsqUCvzEFFUb+yyHfOJhYM4CVaY/A5r8PTl42pqAIBV8xC88BGoychYZM3B 6eSlCL7EAL2bB0Hn6/wKSQwpqM/YD5TJqY8u3/H2guY0qa65xdIC+r/HrsEZFCthRDCl EMZgynZXH+rBlzeUvDLyccZXFAYPX3Y857LMk=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
This patch adds fixed PHY support for the two on-chip
cpmac Ethernet adapters.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 5422449..c4737ce 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -33,6 +33,8 @@
 #include <linux/leds.h>
 #include <linux/string.h>
 #include <linux/etherdevice.h>
+#include <linux/phy.h>
+#include <linux/phy_fixed.h>
 
 #include <asm/addrspace.h>
 #include <asm/mach-ar7/ar7.h>
@@ -209,6 +211,12 @@ static struct physmap_flash_data physmap_flash_data = {
        .width = 2,
 };
 
+static struct fixed_phy_status fixed_phy_status __initdata = {
+       .link = 1,
+       .speed = 100,
+       .duplex = 1,
+};
+
 static struct plat_cpmac_data cpmac_low_data = {
        .reset_bit = 17,
        .power_bit = 20,
@@ -530,6 +538,9 @@ static int __init ar7_register_devices(void)
        }
 
        if (ar7_has_high_cpmac()) {
+               res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
+               if (res && res != -ENODEV)
+                       return res;
                cpmac_get_mac(1, cpmac_high_data.dev_addr);
                res = platform_device_register(&cpmac_high);
                if (res)
@@ -538,6 +549,10 @@ static int __init ar7_register_devices(void)
                cpmac_low_data.phy_mask = 0xffffffff;
        }
 
+       res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
+       if (res && res != -ENODEV)
+               return res;
+
        cpmac_get_mac(0, cpmac_low_data.dev_addr);
        res = platform_device_register(&cpmac_low);
        if (res)

<Prev in Thread] Current Thread [Next in Thread>