[kernel] refresh 2.6.27 patches
[openwrt.git] / target / linux / ar7 / patches-2.6.24 / 150-cpmac_up_and_running.diff
1 From 0daaa095cefd9d7091a7ccce2ff89f1ff4feae7a Mon Sep 17 00:00:00 2001
2 From: Anton Vorontsov <avorontsov@ru.mvista.com>
3 Date: Wed, 5 Mar 2008 14:52:26 +0300
4 Subject: [PATCH] AR7/cpmac: convert to new fixed phy infrastructure, now for real
5
6 This patch converts platform code to register fixed phys early.
7 cpmac driver modified to blindly accept fixed phy id (that is equal
8 to platform device id).
9
10 Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
11 ---
12 arch/mips/ar7/platform.c | 17 +++++++++++++++++
13 drivers/net/cpmac.c | 19 +++----------------
14 2 files changed, 20 insertions(+), 16 deletions(-)
15
16 Index: linux-2.6.24.7/arch/mips/ar7/platform.c
17 ===================================================================
18 --- linux-2.6.24.7.orig/arch/mips/ar7/platform.c
19 +++ linux-2.6.24.7/arch/mips/ar7/platform.c
20 @@ -33,6 +33,8 @@
21 #include <linux/vlynq.h>
22 #include <linux/leds.h>
23 #include <linux/string.h>
24 +#include <linux/phy.h>
25 +#include <linux/phy_fixed.h>
26
27 #include <asm/addrspace.h>
28 #include <asm/ar7/ar7.h>
29 @@ -205,6 +207,13 @@ static struct physmap_flash_data physmap
30 .width = 2,
31 };
32
33 +/* lets assume this is suitable for both high and low cpmacs links */
34 +static struct fixed_phy_status fixed_phy_status __initdata = {
35 + .link = 1,
36 + .speed = 100,
37 + .duplex = 1,
38 +};
39 +
40 static struct plat_cpmac_data cpmac_low_data = {
41 .reset_bit = 17,
42 .power_bit = 20,
43 @@ -506,6 +515,10 @@ static int __init ar7_register_devices(v
44 }
45
46 if (ar7_has_high_cpmac()) {
47 + res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
48 + if (res && res != -ENODEV)
49 + return res;
50 +
51 cpmac_get_mac(1, cpmac_high_data.dev_addr);
52 res = platform_device_register(&cpmac_high);
53 if (res)
54 @@ -514,6 +527,10 @@ static int __init ar7_register_devices(v
55 cpmac_low_data.phy_mask = 0xffffffff;
56 }
57
58 + res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
59 + if (res && res != -ENODEV)
60 + return res;
61 +
62 cpmac_get_mac(0, cpmac_low_data.dev_addr);
63 res = platform_device_register(&cpmac_low);
64 if (res)
65 Index: linux-2.6.24.7/drivers/net/cpmac.c
66 ===================================================================
67 --- linux-2.6.24.7.orig/drivers/net/cpmac.c
68 +++ linux-2.6.24.7/drivers/net/cpmac.c
69 @@ -1035,23 +1035,10 @@ static int __devinit cpmac_probe(struct
70
71 if (phy_id == PHY_MAX_ADDR) {
72 if (external_switch || dumb_switch) {
73 - struct fixed_phy_status status = {};
74 -
75 - mdio_bus_id = 0;
76 -
77 - /*
78 - * FIXME: this should be in the platform code!
79 - * Since there is not platform code at all (that is,
80 - * no mainline users of that driver), place it here
81 - * for now.
82 - */
83 - phy_id = 0;
84 - status.link = 1;
85 - status.duplex = 1;
86 - status.speed = 100;
87 - fixed_phy_add(PHY_POLL, phy_id, &status);
88 + mdio_bus_id = 0; /* fixed phys bus */
89 + phy_id = pdev->id;
90 } else {
91 - printk(KERN_ERR "cpmac: no PHY present\n");
92 + dev_err(&pdev->dev, "no PHY present\n");
93 return -ENODEV;
94 }
95 }
This page took 0.084144 seconds and 5 git commands to generate.