aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorMatteo Croce <rootkit85@yahoo.it>2008-03-05 18:20:44 +0000
committerMatteo Croce <rootkit85@yahoo.it>2008-03-05 18:20:44 +0000
commit9c4f6c192fd84f9f8f0584f4f46e75cdb6528142 (patch)
tree73b6c036d872f50b883cda853c4da892e2e8778c /target
parent321918aa56899cd357d069fd909a806ea768c7c2 (diff)
downloadupstream-9c4f6c192fd84f9f8f0584f4f46e75cdb6528142.tar.gz
upstream-9c4f6c192fd84f9f8f0584f4f46e75cdb6528142.tar.bz2
upstream-9c4f6c192fd84f9f8f0584f4f46e75cdb6528142.zip
fix cpmac in a more elegant way, thanks Anton Vorontsov
SVN-Revision: 10546
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar7/patches-2.6.24/150-cpmac_up_and_running.diff121
1 files changed, 96 insertions, 25 deletions
diff --git a/target/linux/ar7/patches-2.6.24/150-cpmac_up_and_running.diff b/target/linux/ar7/patches-2.6.24/150-cpmac_up_and_running.diff
index 6a0f42d17c..05a578b2f0 100644
--- a/target/linux/ar7/patches-2.6.24/150-cpmac_up_and_running.diff
+++ b/target/linux/ar7/patches-2.6.24/150-cpmac_up_and_running.diff
@@ -1,27 +1,98 @@
---- linux-2.6.24.2/drivers/net/cpmac.c 2008-03-05 13:45:56.000000000 +0100
-+++ linux-2.6.24.2/drivers/net/cpmac.c 2008-03-05 13:46:24.000000000 +0100
-@@ -841,7 +841,8 @@
- int new_state = 0;
+From 0daaa095cefd9d7091a7ccce2ff89f1ff4feae7a Mon Sep 17 00:00:00 2001
+From: Anton Vorontsov <avorontsov@ru.mvista.com>
+Date: Wed, 5 Mar 2008 14:52:26 +0300
+Subject: [PATCH] AR7/cpmac: convert to new fixed phy infrastructure, now for real
+
+This patch converts platform code to register fixed phys early.
+cpmac driver modified to blindly accept fixed phy id (that is equal
+to platform device id).
+
+Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
+---
+ arch/mips/ar7/platform.c | 17 +++++++++++++++++
+ drivers/net/cpmac.c | 19 +++----------------
+ 2 files changed, 20 insertions(+), 16 deletions(-)
+
+diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
+index 22c79f5..02bd574 100644
+--- a/arch/mips/ar7/platform.c
++++ b/arch/mips/ar7/platform.c
+@@ -32,6 +32,8 @@
+ #include <linux/vlynq.h>
+ #include <linux/leds.h>
+ #include <linux/string.h>
++#include <linux/phy.h>
++#include <linux/phy_fixed.h>
- spin_lock(&priv->lock);
-- if (priv->phy->link) {
-+ if (1 /* priv->phy->link */ ) {
-+ netif_carrier_on(dev);
- netif_start_queue(dev);
- if (priv->phy->duplex != priv->oldduplex) {
- new_state = 1;
-@@ -853,11 +854,11 @@
- priv->oldspeed = priv->phy->speed;
- }
+ #include <asm/addrspace.h>
+ #include <asm/ar7/ar7.h>
+@@ -204,6 +206,13 @@ static struct physmap_flash_data physmap_flash_data = {
+ .width = 2,
+ };
+
++/* lets assume this is suitable for both high and low cpmacs links */
++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,
+@@ -505,6 +514,10 @@ 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)
+@@ -513,6 +526,10 @@ static int __init ar7_register_devices(void)
+ cpmac_low_data.phy_mask = 0xffffffff;
+ }
-- if (!priv->oldlink) {
-+ /*if (!priv->oldlink) {
- new_state = 1;
-- priv->oldlink = 1;
-+ priv->oldlink = 1;*/
- netif_schedule(dev);
-- }
-+ /*}*/
- } else if (priv->oldlink) {
- netif_stop_queue(dev);
- new_state = 1;
++ 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)
+diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
+index ac5a8c4..dbac01d 100644
+--- a/drivers/net/cpmac.c
++++ b/drivers/net/cpmac.c
+@@ -1034,23 +1034,10 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
+
+ if (phy_id == PHY_MAX_ADDR) {
+ if (external_switch || dumb_switch) {
+- struct fixed_phy_status status = {};
+-
+- mdio_bus_id = 0;
+-
+- /*
+- * FIXME: this should be in the platform code!
+- * Since there is not platform code at all (that is,
+- * no mainline users of that driver), place it here
+- * for now.
+- */
+- phy_id = 0;
+- status.link = 1;
+- status.duplex = 1;
+- status.speed = 100;
+- fixed_phy_add(PHY_POLL, phy_id, &status);
++ mdio_bus_id = 0; /* fixed phys bus */
++ phy_id = pdev->id;
+ } else {
+- printk(KERN_ERR "cpmac: no PHY present\n");
++ dev_err(&pdev->dev, "no PHY present\n");
+ return -ENODEV;
+ }
+ }
+--
+1.5.2.2
+