Skip to contentSkip to conversation

cpmac ethernet fix for linux 2.6.24.2

PATCH New Benoit Istin 1 participant 1 message Mar 20, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpmac ethernet fix for linux 2.6.24.2

Hi,

I tried a recent snapshot of openWrt project and it happened that the ethernet card was not initialised on my DSL624T (AR7 based modem/router).

According to what I could find in the news, there is a conflict during registration of the driver, so I tried to fix it.
And here it comes the patch that allowed me to have my cpmac eth0 up and running.
As I am not an experiment kernel hacker, this may be not the good way to do it, but a least, it look more like what other drivers do :)

Could someone apply this patch to the kernel tree? Best regards
B.I.

drivers/net/cpmac.c +6 -7
diff -pruN linux-2.6.24.2.old/drivers/net/cpmac.c linux-2.6.24.2/drivers/net/cpmac.c
@@ -1112,7 +1112,8 @@ static int external_switch;
 
 static int __devinit cpmac_probe(struct platform_device *pdev)
 {
-	int rc, phy_id, i;
+	int rc, i;
+	int phy_id;
 	int mdio_bus_id = cpmac_mii.id;
 	struct resource *mem;
 	struct cpmac_priv *priv;
@@ -1132,7 +1133,7 @@ static int __devinit cpmac_probe(struct 
 
 	if (phy_id == PHY_MAX_ADDR) {
 		if (external_switch || dumb_switch) {
-			mdio_bus_id = 0; /* fixed phys bus */
+			mdio_bus_id = 0; 
 			phy_id = pdev->id;
 		} else {
 			dev_err(&pdev->dev, "no PHY present\n");
@@ -1178,9 +1179,7 @@ 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));
 
-	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,
+	priv->phy = phy_connect(dev, cpmac_mii.phy_map[phy_id]->dev.bus_id, &cpmac_adjust_link, 0,
 				PHY_INTERFACE_MODE_MII);
 	if (IS_ERR(priv->phy)) {
 		if (netif_msg_drv(priv))
@@ -1222,13 +1221,13 @@ static struct platform_driver cpmac_driv
 	.remove = __devexit_p(cpmac_remove),
 };
 
-int __devinit cpmac_init(void)
+int __devinit cpmac_init(struct platform_device *pldev, long long base)
 {
 	u32 mask;
 	int i, res;
 
+	cpmac_mii.id=pldev->id;
 	cpmac_mii.priv = ioremap(AR7_REGS_MDIO, 256);
-
 	if (!cpmac_mii.priv) {
 		printk(KERN_ERR "Can't ioremap mdio registers\n");
 		return -ENXIO;