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
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).
10 Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
12 arch/mips/ar7/platform.c | 17 +++++++++++++++++
13 drivers/net/cpmac.c | 19 +++----------------
14 2 files changed, 20 insertions(+), 16 deletions(-)
16 Index: linux-2.6.25.4/arch/mips/ar7/platform.c
17 ===================================================================
18 --- linux-2.6.25.4.orig/arch/mips/ar7/platform.c
19 +++ linux-2.6.25.4/arch/mips/ar7/platform.c
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>
27 #include <asm/addrspace.h>
28 #include <asm/ar7/ar7.h>
29 @@ -205,6 +207,13 @@ static struct physmap_flash_data physmap
33 +/* lets assume this is suitable for both high and low cpmacs links */
34 +static struct fixed_phy_status fixed_phy_status __initdata = {
40 static struct plat_cpmac_data cpmac_low_data = {
43 @@ -506,6 +515,10 @@ static int __init ar7_register_devices(v
46 if (ar7_has_high_cpmac()) {
47 + res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
48 + if (res && res != -ENODEV)
51 cpmac_get_mac(1, cpmac_high_data.dev_addr);
52 res = platform_device_register(&cpmac_high);
54 @@ -514,6 +527,10 @@ static int __init ar7_register_devices(v
55 cpmac_low_data.phy_mask = 0xffffffff;
58 + res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
59 + if (res && res != -ENODEV)
62 cpmac_get_mac(0, cpmac_low_data.dev_addr);
63 res = platform_device_register(&cpmac_low);
65 Index: linux-2.6.25.4/drivers/net/cpmac.c
66 ===================================================================
67 --- linux-2.6.25.4.orig/drivers/net/cpmac.c
68 +++ linux-2.6.25.4/drivers/net/cpmac.c
69 @@ -1035,23 +1035,10 @@ static int __devinit cpmac_probe(struct
71 if (phy_id == PHY_MAX_ADDR) {
72 if (external_switch || dumb_switch) {
73 - struct fixed_phy_status status = {};
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
87 - fixed_phy_add(PHY_POLL, phy_id, &status);
88 + mdio_bus_id = 0; /* fixed phys bus */
91 - printk(KERN_ERR "cpmac: no PHY present\n");
92 + dev_err(&pdev->dev, "no PHY present\n");