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 --- a/arch/mips/ar7/platform.c
17 +++ b/arch/mips/ar7/platform.c
19 #include <linux/vlynq.h>
20 #include <linux/leds.h>
21 #include <linux/string.h>
22 +#include <linux/phy.h>
23 +#include <linux/phy_fixed.h>
25 #include <asm/addrspace.h>
26 #include <asm/ar7/ar7.h>
31 +/* lets assume this is suitable for both high and low cpmacs links */
32 +static struct fixed_phy_status fixed_phy_status __initdata = {
38 static struct plat_cpmac_data cpmac_low_data = {
44 if (ar7_has_high_cpmac()) {
45 + res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
46 + if (res && res != -ENODEV)
49 cpmac_get_mac(1, cpmac_high_data.dev_addr);
50 res = platform_device_register(&cpmac_high);
53 cpmac_low_data.phy_mask = 0xffffffff;
56 + res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
57 + if (res && res != -ENODEV)
60 cpmac_get_mac(0, cpmac_low_data.dev_addr);
61 res = platform_device_register(&cpmac_low);
63 --- a/drivers/net/cpmac.c
64 +++ b/drivers/net/cpmac.c
65 @@ -1035,23 +1035,10 @@
67 if (phy_id == PHY_MAX_ADDR) {
68 if (external_switch || dumb_switch) {
69 - struct fixed_phy_status status = {};
74 - * FIXME: this should be in the platform code!
75 - * Since there is not platform code at all (that is,
76 - * no mainline users of that driver), place it here
83 - fixed_phy_add(PHY_POLL, phy_id, &status);
84 + mdio_bus_id = 0; /* fixed phys bus */
87 - printk(KERN_ERR "cpmac: no PHY present\n");
88 + dev_err(&pdev->dev, "no PHY present\n");