parent
8d4aebadaf
commit
25b42557da
@ -1,20 +1,21 @@ |
||||
--- a/drivers/Kconfig
|
||||
+++ b/drivers/Kconfig
|
||||
@@ -100,5 +100,7 @@ source "drivers/auxdisplay/Kconfig"
|
||||
@@ -104,6 +104,8 @@ source "drivers/auxdisplay/Kconfig"
|
||||
|
||||
source "drivers/uio/Kconfig"
|
||||
|
||||
+source "drivers/vlynq/Kconfig"
|
||||
+
|
||||
source "drivers/xen/Kconfig"
|
||||
endmenu
|
||||
|
||||
source "drivers/staging/Kconfig"
|
||||
--- a/drivers/Makefile
|
||||
+++ b/drivers/Makefile
|
||||
@@ -96,6 +96,7 @@ obj-$(CONFIG_DCA) += dca/
|
||||
@@ -103,6 +103,7 @@ obj-$(CONFIG_DCA) += dca/
|
||||
obj-$(CONFIG_HID) += hid/
|
||||
obj-$(CONFIG_PPC_PS3) += ps3/
|
||||
obj-$(CONFIG_OF) += of/
|
||||
+obj-$(CONFIG_VLYNQ) += vlynq/
|
||||
obj-$(CONFIG_SSB) += ssb/
|
||||
obj-$(CONFIG_VIRTIO) += virtio/
|
||||
obj-$(CONFIG_REGULATOR) += regulator/
|
||||
obj-$(CONFIG_STAGING) += staging/
|
||||
|
@ -0,0 +1,47 @@ |
||||
--- a/arch/mips/ar7/platform.c
|
||||
+++ b/arch/mips/ar7/platform.c
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <linux/vlynq.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/string.h>
|
||||
+#include <linux/phy.h>
|
||||
+#include <linux/phy_fixed.h>
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/ar7/ar7.h>
|
||||
@@ -205,6 +207,13 @@ static struct physmap_flash_data physmap
|
||||
.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,
|
||||
@@ -506,6 +515,10 @@ static int __init ar7_register_devices(v
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -514,6 +527,10 @@ static int __init ar7_register_devices(v
|
||||
cpmac_low_data.phy_mask = 0xffffffff;
|
||||
}
|
||||
|
||||
+ 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)
|
@ -0,0 +1,90 @@ |
||||
This is a hack to make cpmac work with the external switch on a DG834 v3; it
|
||||
should also work on other similar routers. It has not been tested on hardware
|
||||
with multiple cpmac devices or with no external switch. It may be safer to
|
||||
move external_switch to pdata rather than trying to detect it, and to set
|
||||
phy_mask correctly rather than moving the phy search loop.
|
||||
|
||||
--- a/drivers/net/cpmac.c
|
||||
+++ b/drivers/net/cpmac.c
|
||||
@@ -1096,7 +1096,7 @@ static int external_switch;
|
||||
static int __devinit cpmac_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc, phy_id;
|
||||
- char *mdio_bus_id = "0";
|
||||
+ char mdio_bus_id[BUS_ID_SIZE];
|
||||
struct resource *mem;
|
||||
struct cpmac_priv *priv;
|
||||
struct net_device *dev;
|
||||
@@ -1104,22 +1104,23 @@ static int __devinit cpmac_probe(struct
|
||||
|
||||
pdata = pdev->dev.platform_data;
|
||||
|
||||
- for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
|
||||
- if (!(pdata->phy_mask & (1 << phy_id)))
|
||||
- continue;
|
||||
- if (!cpmac_mii->phy_map[phy_id])
|
||||
- continue;
|
||||
- break;
|
||||
+ if (external_switch || dumb_switch) {
|
||||
+ strncpy(mdio_bus_id, "0", BUS_ID_SIZE); /* fixed phys bus */
|
||||
+ phy_id = pdev->id;
|
||||
+ } else {
|
||||
+ for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
|
||||
+ if (!(pdata->phy_mask & (1 << phy_id)))
|
||||
+ continue;
|
||||
+ if (!cpmac_mii->phy_map[phy_id])
|
||||
+ continue;
|
||||
+ strncpy(mdio_bus_id, cpmac_mii->id, BUS_ID_SIZE);
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (phy_id == PHY_MAX_ADDR) {
|
||||
- if (external_switch || dumb_switch) {
|
||||
- mdio_bus_id = 0; /* fixed phys bus */
|
||||
- phy_id = pdev->id;
|
||||
- } else {
|
||||
- dev_err(&pdev->dev, "no PHY present\n");
|
||||
- return -ENODEV;
|
||||
- }
|
||||
+ dev_err(&pdev->dev, "no PHY present\n");
|
||||
+ return -ENODEV;
|
||||
}
|
||||
|
||||
dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES);
|
||||
@@ -1160,8 +1161,10 @@ static int __devinit cpmac_probe(struct
|
||||
priv->msg_enable = netif_msg_init(debug_level, 0xff);
|
||||
memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
|
||||
|
||||
- priv->phy = phy_connect(dev, dev_name(&cpmac_mii->phy_map[phy_id]->dev),
|
||||
- &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII);
|
||||
+ snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
|
||||
+
|
||||
+ priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
|
||||
+ PHY_INTERFACE_MODE_MII);
|
||||
if (IS_ERR(priv->phy)) {
|
||||
if (netif_msg_drv(priv))
|
||||
printk(KERN_ERR "%s: Could not attach to PHY\n",
|
||||
@@ -1235,11 +1238,11 @@ int __devinit cpmac_init(void)
|
||||
|
||||
cpmac_mii->reset(cpmac_mii);
|
||||
|
||||
- for (i = 0; i < 300000; i++)
|
||||
+ for (i = 0; i < 300; i++)
|
||||
if ((mask = cpmac_read(cpmac_mii->priv, CPMAC_MDIO_ALIVE)))
|
||||
break;
|
||||
else
|
||||
- cpu_relax();
|
||||
+ msleep(10);
|
||||
|
||||
mask &= 0x7fffffff;
|
||||
if (mask & (mask - 1)) {
|
||||
@@ -1248,7 +1251,7 @@ int __devinit cpmac_init(void)
|
||||
}
|
||||
|
||||
cpmac_mii->phy_mask = ~(mask | 0x80000000);
|
||||
- snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "0");
|
||||
+ snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
|
||||
|
||||
res = mdiobus_register(cpmac_mii);
|
||||
if (res)
|
Loading…
Reference in new issue