--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
-@@ -1203,9 +1203,22 @@ void *set_except_vector(int n, void *add
+@@ -1256,9 +1256,22 @@ void *set_except_vector(int n, void *add
exception_handlers[n] = handler;
if (n == 0 && cpu_has_divec) {
}
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
-@@ -167,6 +167,13 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/s
+@@ -174,6 +174,13 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/s
#
#
core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
-@@ -182,8 +182,10 @@ typedef struct { unsigned long pgprot; }
+@@ -185,8 +185,10 @@ typedef struct { unsigned long pgprot; }
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
--- 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/
---- a/drivers/vlynq/vlynq.c 2009-05-31 20:41:57.000000000 +0200
-+++ b/drivers/vlynq/vlynq.c 2009-07-28 21:27:52.000000000 +0200
+--- a/drivers/vlynq/vlynq.c
++++ b/drivers/vlynq/vlynq.c
@@ -14,6 +14,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
#include <linux/delay.h>
#include <linux/io.h>
-@@ -73,15 +75,11 @@
+@@ -73,15 +75,11 @@ struct vlynq_regs {
u32 int_device[8];
};
printk(KERN_DEBUG "VLYNQ local=%p remote=%p\n",
dev->local, dev->remote);
for (i = 0; i < 32; i++) {
-@@ -95,20 +93,23 @@
+@@ -95,20 +93,23 @@ static void vlynq_dump_regs(struct vlynq
static void vlynq_dump_mem(u32 *base, int count)
{
int i;
return 1;
else
cpu_relax();
-@@ -118,17 +119,15 @@
+@@ -118,17 +119,15 @@ int vlynq_linked(struct vlynq_device *de
static void vlynq_reset(struct vlynq_device *dev)
{
/* Give some time for the devices to settle */
msleep(5);
-@@ -142,9 +141,9 @@
+@@ -142,9 +141,9 @@ static void vlynq_irq_unmask(unsigned in
BUG_ON(!dev);
virq = irq - dev->irq_start;
}
static void vlynq_irq_mask(unsigned int irq)
-@@ -155,9 +154,9 @@
+@@ -155,9 +154,9 @@ static void vlynq_irq_mask(unsigned int
BUG_ON(!dev);
virq = irq - dev->irq_start;
}
static int vlynq_irq_type(unsigned int irq, unsigned int flow_type)
-@@ -168,7 +167,7 @@
+@@ -168,7 +167,7 @@ static int vlynq_irq_type(unsigned int i
BUG_ON(!dev);
virq = irq - dev->irq_start;
switch (flow_type & IRQ_TYPE_SENSE_MASK) {
case IRQ_TYPE_EDGE_RISING:
case IRQ_TYPE_EDGE_FALLING:
-@@ -187,28 +186,30 @@
+@@ -187,28 +186,30 @@ static int vlynq_irq_type(unsigned int i
default:
return -EINVAL;
}
}
static irqreturn_t vlynq_irq(int irq, void *dev_id)
-@@ -217,8 +218,8 @@
+@@ -217,8 +218,8 @@ static irqreturn_t vlynq_irq(int irq, vo
u32 status;
int virq = 0;
if (unlikely(!status))
spurious_interrupt();
-@@ -262,28 +263,28 @@
+@@ -262,28 +263,28 @@ static int vlynq_setup_irq(struct vlynq_
if (dev->local_irq == dev->remote_irq) {
printk(KERN_ERR
"%s: local vlynq irq should be different from remote\n",
for (i = dev->irq_start; i <= dev->irq_end; i++) {
virq = i - dev->irq_start;
-@@ -299,12 +300,13 @@
+@@ -299,12 +300,13 @@ static int vlynq_setup_irq(struct vlynq_
set_irq_chip_and_handler(i, &vlynq_irq_chip,
handle_simple_irq);
set_irq_chip_data(i, dev);
return -EAGAIN;
}
-@@ -328,11 +330,11 @@
+@@ -328,11 +330,11 @@ static int vlynq_device_match(struct dev
if (ids->id == vdev->dev_id) {
vdev->divisor = ids->divisor;
vlynq_set_drvdata(vdev, ids);
" for VLYNQ device: %08x\n", ids->id, vdev->dev_id);
ids++;
}
-@@ -346,8 +348,7 @@
+@@ -346,8 +348,7 @@ static int vlynq_device_probe(struct dev
struct vlynq_device_id *id = vlynq_get_drvdata(vdev);
int result = -ENODEV;
result = drv->probe(vdev, id);
if (result)
put_device(dev);
-@@ -357,9 +358,10 @@
+@@ -357,9 +358,10 @@ static int vlynq_device_probe(struct dev
static int vlynq_device_remove(struct device *dev)
{
struct vlynq_driver *drv = to_vlynq_driver(dev->driver);
return 0;
}
-@@ -377,6 +379,14 @@
+@@ -377,6 +379,14 @@ void vlynq_unregister_driver(struct vlyn
}
EXPORT_SYMBOL(vlynq_unregister_driver);
static int __vlynq_try_remote(struct vlynq_device *dev)
{
int i;
-@@ -389,21 +399,21 @@
+@@ -389,21 +399,21 @@ static int __vlynq_try_remote(struct vly
if (!vlynq_linked(dev))
break;
dev->divisor = i;
return 0;
} else {
-@@ -414,26 +424,33 @@
+@@ -414,26 +424,33 @@ static int __vlynq_try_remote(struct vly
return -ENODEV;
}
dev->divisor = i;
return 0;
} else {
-@@ -444,27 +461,33 @@
+@@ -444,27 +461,33 @@ static int __vlynq_try_local(struct vlyn
return -ENODEV;
}
return -ENODEV;
}
-@@ -481,10 +504,10 @@
+@@ -481,10 +504,10 @@ static int __vlynq_enable_device(struct
case vlynq_div_external:
case vlynq_div_auto:
/* When the device is brought from reset it should have clock
VLYNQ_CTRL_CLOCK_INT) {
if (!__vlynq_try_remote(dev) ||
!__vlynq_try_local(dev) ||
-@@ -497,31 +520,43 @@
+@@ -497,31 +520,43 @@ static int __vlynq_enable_device(struct
return 0;
}
break;
return 0;
}
break;
-@@ -568,12 +603,10 @@
+@@ -568,12 +603,10 @@ int vlynq_set_local_mapping(struct vlynq
if (!dev->enabled)
return -ENXIO;
}
return 0;
}
-@@ -587,12 +620,10 @@
+@@ -587,12 +620,10 @@ int vlynq_set_remote_mapping(struct vlyn
if (!dev->enabled)
return -ENXIO;
}
return 0;
}
-@@ -662,8 +693,7 @@
+@@ -662,8 +693,7 @@ static int vlynq_probe(struct platform_d
dev->id = pdev->id;
dev->dev.bus = &vlynq_bus_type;
dev->dev.parent = &pdev->dev;
dev->dev.platform_data = pdev->dev.platform_data;
dev->dev.release = vlynq_device_release;
-@@ -673,9 +703,9 @@
+@@ -673,9 +703,9 @@ static int vlynq_probe(struct platform_d
dev->mem_end = mem_res->end;
len = regs_res->end - regs_res->start;
result = -ENXIO;
goto fail_request;
}
-@@ -683,7 +713,7 @@
+@@ -683,7 +713,7 @@ static int vlynq_probe(struct platform_d
dev->local = ioremap(regs_res->start, len);
if (!dev->local) {
printk(KERN_ERR "%s: Can't remap vlynq registers\n",
result = -ENXIO;
goto fail_remap;
}
-@@ -702,14 +732,14 @@
+@@ -702,14 +732,14 @@ static int vlynq_probe(struct platform_d
platform_set_drvdata(pdev, dev);
printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n",
--- /dev/null
+--- 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)
--- /dev/null
+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)