Message ID | 20090321222901.20493.67103.stgit@localhost.localdomain (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Grant Likely |
Headers | show |
On Sat, Mar 21, 2009 at 04:29:01PM -0600, Grant Likely wrote: > From: Grant Likely <grant.likely@secretlab.ca> > > This patch simplifies the driver by making use of more common code. Did you ever try building it? pasemi_defconfig gives me: drivers/net/pasemi_mac.c: In function 'pasemi_mac_phy_init': drivers/net/pasemi_mac.c:1102: error: implicit declaration of function 'of_phy_connect' drivers/net/pasemi_mac.c:1103: warning: assignment makes pointer from integer without a cast drivers/net/pasemi_mac.c:1114: warning: label 'err' defined but not used drivers/net/pasemi_mac.c:1092: warning: unused variable 'ret' drivers/net/pasemi_mac.c:1091: warning: unused variable 'r' drivers/net/pasemi_mac.c:1090: warning: unused variable 'prop' drivers/net/pasemi_mac.c:1089: warning: unused variable 'ph' make[2]: *** [drivers/net/pasemi_mac.o] Error 1 The changes needed are trivial, include <linux/of_mdio.h> and remove the variables, label and following code. I could send a patch but that's likely more of a hassle than you fixing it up yourself? Otherwise, with the above changes, seems to test out ok on my Electra. When you checkin the changes, feel free to add: Tested-by: Olof Johansson <olof@lixom.net> Acked-by: Olof Johansson <olof@lixom.net> to it. -Olof
On Sun, Mar 22, 2009 at 9:47 AM, Olof Johansson <olof@lixom.net> wrote: > On Sat, Mar 21, 2009 at 04:29:01PM -0600, Grant Likely wrote: >> From: Grant Likely <grant.likely@secretlab.ca> >> >> This patch simplifies the driver by making use of more common code. > > Did you ever try building it? pasemi_defconfig gives me: No. I mentioned it in the series header email, but not in the patch description. My 64bit build environment is broken at the moment so I couldn't build test the pasemi patch. All the others are build tested. I'll have it sorted out before I post v3. > drivers/net/pasemi_mac.c: In function 'pasemi_mac_phy_init': > drivers/net/pasemi_mac.c:1102: error: implicit declaration of function 'of_phy_connect' > drivers/net/pasemi_mac.c:1103: warning: assignment makes pointer from integer without a cast > drivers/net/pasemi_mac.c:1114: warning: label 'err' defined but not used > drivers/net/pasemi_mac.c:1092: warning: unused variable 'ret' > drivers/net/pasemi_mac.c:1091: warning: unused variable 'r' > drivers/net/pasemi_mac.c:1090: warning: unused variable 'prop' > drivers/net/pasemi_mac.c:1089: warning: unused variable 'ph' > make[2]: *** [drivers/net/pasemi_mac.o] Error 1 > > The changes needed are trivial, include <linux/of_mdio.h> and remove the > variables, label and following code. I could send a patch but that's likely > more of a hassle than you fixing it up yourself? Yeah, I'll fix it. Thanks for the testing. > Otherwise, with the above changes, seems to test out ok on my Electra. > When you checkin the changes, feel free to add: Awesome. Thanks for the testing. g.
On Sun, Mar 22, 2009 at 12:36:44PM -0600, Grant Likely wrote: > On Sun, Mar 22, 2009 at 9:47 AM, Olof Johansson <olof@lixom.net> wrote: > > Did you ever try building it? pasemi_defconfig gives me: > > No. I mentioned it in the series header email, but not in the patch > description. My 64bit build environment is broken at the moment so I > couldn't build test the pasemi patch. All the others are build > tested. I'll have it sorted out before I post v3. Ah, my bad. I just glanced it over looking for the git URL. :) > > The changes needed are trivial, include <linux/of_mdio.h> and remove the > > variables, label and following code. I could send a patch but that's likely > > more of a hassle than you fixing it up yourself? > > Yeah, I'll fix it. Thanks for the testing. > > > Otherwise, with the above changes, seems to test out ok on my Electra. > > When you checkin the changes, feel free to add: > > Awesome. Thanks for the testing. NP! Thanks for doing this cleanup! -Olof
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c index 75cc165..26e8f36 100644 --- a/arch/powerpc/platforms/pasemi/gpio_mdio.c +++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c @@ -29,7 +29,7 @@ #include <linux/ioport.h> #include <linux/interrupt.h> #include <linux/phy.h> -#include <linux/platform_device.h> +#include <linux/of_mdio.h> #include <linux/of_platform.h> #define DELAY 1 @@ -39,6 +39,7 @@ static void __iomem *gpio_regs; struct gpio_priv { int mdc_pin; int mdio_pin; + int mdio_irqs[PHY_MAX_ADDR]; }; #define MDC_PIN(bus) (((struct gpio_priv *)bus->priv)->mdc_pin) @@ -244,27 +245,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev, snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", *prop); new_bus->priv = priv; - new_bus->phy_mask = 0; - - new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); - - if (!new_bus->irq) - goto out_free_bus; - - for (i = 0; i < PHY_MAX_ADDR; i++) - new_bus->irq[i] = NO_IRQ; - - for (phy_dn = of_get_next_child(np, NULL); - phy_dn != NULL; - phy_dn = of_get_next_child(np, phy_dn)) { - const unsigned int *ip, *regp; - - ip = of_get_property(phy_dn, "interrupts", NULL); - regp = of_get_property(phy_dn, "reg", NULL); - if (!ip || !regp || *regp >= PHY_MAX_ADDR) - continue; - new_bus->irq[*regp] = irq_create_mapping(NULL, *ip); - } + new_bus->irq = priv->mdio_irqs; prop = of_get_property(np, "mdc-pin", NULL); priv->mdc_pin = *prop; @@ -275,7 +256,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev, new_bus->parent = dev; dev_set_drvdata(dev, new_bus); - err = mdiobus_register(new_bus); + err = of_mdiobus_register(new_bus, np); if (err != 0) { printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n", @@ -286,8 +267,6 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev, return 0; out_free_irq: - kfree(new_bus->irq); -out_free_bus: kfree(new_bus); out_free_priv: kfree(priv); diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index d0349e7..8c92d1f 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c @@ -1086,34 +1086,21 @@ static int pasemi_mac_phy_init(struct net_device *dev) struct pasemi_mac *mac = netdev_priv(dev); struct device_node *dn, *phy_dn; struct phy_device *phydev; - unsigned int phy_id; const phandle *ph; const unsigned int *prop; struct resource r; int ret; dn = pci_device_to_OF_node(mac->pdev); - ph = of_get_property(dn, "phy-handle", NULL); - if (!ph) - return -ENODEV; - phy_dn = of_find_node_by_phandle(*ph); - - prop = of_get_property(phy_dn, "reg", NULL); - ret = of_address_to_resource(phy_dn->parent, 0, &r); - if (ret) - goto err; - - phy_id = *prop; - snprintf(mac->phy_id, sizeof(mac->phy_id), "%x:%02x", - (int)r.start, phy_id); - + phy_dn = of_parse_phandle(dn, "phy-handle", 0); of_node_put(phy_dn); mac->link = 0; mac->speed = 0; mac->duplex = -1; - phydev = phy_connect(dev, mac->phy_id, &pasemi_adjust_link, 0, PHY_INTERFACE_MODE_SGMII); + phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, + PHY_INTERFACE_MODE_SGMII); if (IS_ERR(phydev)) { printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h index 1a115ec..e2f4efa 100644 --- a/drivers/net/pasemi_mac.h +++ b/drivers/net/pasemi_mac.h @@ -100,7 +100,6 @@ struct pasemi_mac { int duplex; unsigned int msg_enable; - char phy_id[BUS_ID_SIZE]; }; /* Software status descriptor (ring_info) */