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 diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
17 index 22c79f5..02bd574 100644
18 --- a/arch/mips/ar7/platform.c
19 +++ b/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 @@ -204,6 +206,13 @@ static struct physmap_flash_data physmap_flash_data = {
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 @@ -505,6 +514,10 @@ static int __init ar7_register_devices(void)
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 @@ -513,6 +526,10 @@ static int __init ar7_register_devices(void)
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 diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
66 index ac5a8c4..dbac01d 100644
67 --- a/drivers/net/cpmac.c
68 +++ b/drivers/net/cpmac.c
69 @@ -1034,23 +1034,10 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
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");