* [PATCH 0/2] MDIO on GPIO support for the fs_enet driver @ 2008-05-26 9:52 Laurent Pinchart 2008-05-26 9:53 ` [PATCH 1/2] net: OpenFirmware GPIO based MDIO bitbang driver Laurent Pinchart 2008-05-26 9:53 ` [PATCH 2/2] fs_enet: MDIO on GPIO support Laurent Pinchart 0 siblings, 2 replies; 14+ messages in thread From: Laurent Pinchart @ 2008-05-26 9:52 UTC (permalink / raw) To: linuxppc-dev; +Cc: Scott Wood, netdev, jgarzik [-- Attachment #1: Type: text/plain, Size: 400 bytes --] Hi everybody, here is a patch set that adds MDIO on GPIO support. If there are no show stoppers I'd like to see it going into linux-next. [PATCH 1/2] net: OpenFirmware GPIO based MDIO bitbang driver [PATCH 2/2] fs_enet: MDIO on GPIO support -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] net: OpenFirmware GPIO based MDIO bitbang driver 2008-05-26 9:52 [PATCH 0/2] MDIO on GPIO support for the fs_enet driver Laurent Pinchart @ 2008-05-26 9:53 ` Laurent Pinchart 2008-05-31 2:20 ` Jeff Garzik 2008-05-26 9:53 ` [PATCH 2/2] fs_enet: MDIO on GPIO support Laurent Pinchart 1 sibling, 1 reply; 14+ messages in thread From: Laurent Pinchart @ 2008-05-26 9:53 UTC (permalink / raw) To: linuxppc-dev; +Cc: Scott Wood, netdev, jgarzik [-- Attachment #1: Type: text/plain, Size: 7850 bytes --] This patch adds an MDIO bitbang driver that uses the GPIO library and its OF bindings to access the bus I/Os. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> --- Documentation/powerpc/booting-without-of.txt | 21 +++ drivers/net/phy/Kconfig | 6 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-ofgpio.c | 205 ++++++++++++++++++++++++++ 4 files changed, 233 insertions(+), 0 deletions(-) create mode 100644 drivers/net/phy/mdio-ofgpio.c diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index 21a3484..6f8c9d4 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt @@ -58,6 +58,7 @@ Table of Contents o) Xilinx IP cores p) Freescale Synchronous Serial Interface q) USB EHCI controllers + r) MDIO on GPIOs VII - Marvell Discovery mv64[345]6x System Controller chips 1) The /system-controller node @@ -2880,6 +2881,26 @@ platforms are moved over to use the flattened-device-tree model. reg = <0xe8000000 32>; }; + r) MDIO on GPIOs + + Currently defined compatibles: + - virtual,gpio-mdio + + MDC and MDIO lines connected to GPIO controllers are listed in the + gpios property as described in section VIII.1 in the following order: + + MDC, MDIO. + + Example: + + mdio { + compatible = "virtual,mdio-gpio"; + #address-cells = <1>; + #size-cells = <0>; + gpios = <&qe_pio_a 11 + &qe_pio_c 6>; + }; + VII - Marvell Discovery mv64[345]6x System Controller chips =========================================================== diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 6bf9e76..ad7a138 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -83,4 +83,10 @@ config MDIO_BITBANG If in doubt, say N. +config MDIO_OF_GPIO + tristate "Support for GPIO lib-based bitbanged MDIO buses" + depends on MDIO_BITBANG && OF_GPIO + ---help--- + Supports GPIO lib-based MDIO busses. + endif # PHYLIB diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 5997d6e..eee329f 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -15,3 +15,4 @@ obj-$(CONFIG_ICPLUS_PHY) += icplus.o obj-$(CONFIG_REALTEK_PHY) += realtek.o obj-$(CONFIG_FIXED_PHY) += fixed.o obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o +obj-$(CONFIG_MDIO_OF_GPIO) += mdio-ofgpio.o diff --git a/drivers/net/phy/mdio-ofgpio.c b/drivers/net/phy/mdio-ofgpio.c new file mode 100644 index 0000000..7edfc0c --- /dev/null +++ b/drivers/net/phy/mdio-ofgpio.c @@ -0,0 +1,205 @@ +/* + * OpenFirmware GPIO based MDIO bitbang driver. + * + * Copyright (c) 2008 CSE Semaphore Belgium. + * by Laurent Pinchart <laurentp@cse-semaphore.com> + * + * Based on earlier work by + * + * Copyright (c) 2003 Intracom S.A. + * by Pantelis Antoniou <panto@intracom.gr> + * + * 2005 (c) MontaVista Software, Inc. + * Vitaly Bordug <vbordug@ru.mvista.com> + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +#include <linux/module.h> +#include <linux/slab.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/mdio-bitbang.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> + +struct mdio_gpio_info { + struct mdiobb_ctrl ctrl; + int mdc, mdio; +}; + +static void mdio_dir(struct mdiobb_ctrl *ctrl, int dir) +{ + struct mdio_gpio_info *bitbang = + container_of(ctrl, struct mdio_gpio_info, ctrl); + + if (dir) + gpio_direction_output(bitbang->mdio, 1); + else + gpio_direction_input(bitbang->mdio); +} + +static int mdio_read(struct mdiobb_ctrl *ctrl) +{ + struct mdio_gpio_info *bitbang = + container_of(ctrl, struct mdio_gpio_info, ctrl); + + return gpio_get_value(bitbang->mdio); +} + +static void mdio(struct mdiobb_ctrl *ctrl, int what) +{ + struct mdio_gpio_info *bitbang = + container_of(ctrl, struct mdio_gpio_info, ctrl); + + gpio_set_value(bitbang->mdio, what); +} + +static void mdc(struct mdiobb_ctrl *ctrl, int what) +{ + struct mdio_gpio_info *bitbang = + container_of(ctrl, struct mdio_gpio_info, ctrl); + + gpio_set_value(bitbang->mdc, what); +} + +static struct mdiobb_ops mdio_gpio_ops = { + .owner = THIS_MODULE, + .set_mdc = mdc, + .set_mdio_dir = mdio_dir, + .set_mdio_data = mdio, + .get_mdio_data = mdio_read, +}; + +static int __devinit mdio_ofgpio_bitbang_init(struct mii_bus *bus, + struct device_node *np) +{ + struct mdio_gpio_info *bitbang = bus->priv; + + bitbang->mdc = of_get_gpio(np, 0); + bitbang->mdio = of_get_gpio(np, 1); + + if (bitbang->mdc < 0 || bitbang->mdio < 0) + return -ENODEV; + + snprintf(bus->id, MII_BUS_ID_SIZE, "%x", bitbang->mdc); + return 0; +} + +static void __devinit add_phy(struct mii_bus *bus, struct device_node *np) +{ + const u32 *data; + int len, id, irq; + + data = of_get_property(np, "reg", &len); + if (!data || len != 4) + return; + + id = *data; + bus->phy_mask &= ~(1 << id); + + irq = of_irq_to_resource(np, 0, NULL); + if (irq != NO_IRQ) + bus->irq[id] = irq; +} + +static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, + const struct of_device_id *match) +{ + struct device_node *np = NULL; + struct mii_bus *new_bus; + struct mdio_gpio_info *bitbang; + int ret = -ENOMEM; + int i; + + bitbang = kzalloc(sizeof(struct mdio_gpio_info), GFP_KERNEL); + if (!bitbang) + goto out; + + bitbang->ctrl.ops = &mdio_gpio_ops; + + new_bus = alloc_mdio_bitbang(&bitbang->ctrl); + if (!new_bus) + goto out_free_priv; + + new_bus->name = "GPIO Bitbanged MII", + + ret = mdio_ofgpio_bitbang_init(new_bus, ofdev->node); + if (ret) + goto out_free_bus; + + 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] = -1; + + while ((np = of_get_next_child(ofdev->node, np))) + if (!strcmp(np->type, "ethernet-phy")) + add_phy(new_bus, np); + + new_bus->dev = &ofdev->dev; + dev_set_drvdata(&ofdev->dev, new_bus); + + ret = mdiobus_register(new_bus); + if (ret) + goto out_free_irqs; + + return 0; + +out_free_irqs: + dev_set_drvdata(&ofdev->dev, NULL); + kfree(new_bus->irq); +out_free_bus: + kfree(new_bus); +out_free_priv: + free_mdio_bitbang(new_bus); +out: + return ret; +} + +static int mdio_ofgpio_remove(struct of_device *ofdev) +{ + struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); + struct mdio_gpio_info *bitbang = bus->priv; + + mdiobus_unregister(bus); + free_mdio_bitbang(bus); + dev_set_drvdata(&ofdev->dev, NULL); + kfree(bus->irq); + kfree(bitbang); + kfree(bus); + + return 0; +} + +static struct of_device_id mdio_ofgpio_match[] = { + { + .compatible = "virtual,mdio-gpio", + }, + {}, +}; + +static struct of_platform_driver mdio_ofgpio_driver = { + .name = "mdio-gpio", + .match_table = mdio_ofgpio_match, + .probe = mdio_ofgpio_probe, + .remove = mdio_ofgpio_remove, +}; + +static int mdio_ofgpio_init(void) +{ + return of_register_platform_driver(&mdio_ofgpio_driver); +} + +static void mdio_ofgpio_exit(void) +{ + of_unregister_platform_driver(&mdio_ofgpio_driver); +} + +module_init(mdio_ofgpio_init); +module_exit(mdio_ofgpio_exit); -- 1.5.0 -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] net: OpenFirmware GPIO based MDIO bitbang driver 2008-05-26 9:53 ` [PATCH 1/2] net: OpenFirmware GPIO based MDIO bitbang driver Laurent Pinchart @ 2008-05-31 2:20 ` Jeff Garzik 0 siblings, 0 replies; 14+ messages in thread From: Jeff Garzik @ 2008-05-31 2:20 UTC (permalink / raw) To: Laurent Pinchart; +Cc: Scott Wood, linuxppc-dev, netdev Laurent Pinchart wrote: > This patch adds an MDIO bitbang driver that uses the GPIO library and its > OF bindings to access the bus I/Os. > > Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> > --- > Documentation/powerpc/booting-without-of.txt | 21 +++ > drivers/net/phy/Kconfig | 6 + > drivers/net/phy/Makefile | 1 + > drivers/net/phy/mdio-ofgpio.c | 205 ++++++++++++++++++++++++++ > 4 files changed, 233 insertions(+), 0 deletions(-) > create mode 100644 drivers/net/phy/mdio-ofgpio.c applied 1-2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-05-26 9:52 [PATCH 0/2] MDIO on GPIO support for the fs_enet driver Laurent Pinchart 2008-05-26 9:53 ` [PATCH 1/2] net: OpenFirmware GPIO based MDIO bitbang driver Laurent Pinchart @ 2008-05-26 9:53 ` Laurent Pinchart 2008-06-16 8:57 ` Laurent Pinchart 1 sibling, 1 reply; 14+ messages in thread From: Laurent Pinchart @ 2008-05-26 9:53 UTC (permalink / raw) To: linuxppc-dev; +Cc: Scott Wood, netdev, jgarzik [-- Attachment #1: Type: text/plain, Size: 2130 bytes --] Port the fs_enet driver to support the MDIO on GPIO driver for PHY access in addition to the mii-bitbang driver. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> --- drivers/net/fs_enet/fs_enet-main.c | 31 ++++++++++++++++++++----------- 1 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 67b4b07..b0eb1d2 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -43,6 +43,7 @@ #include <asm/uaccess.h> #ifdef CONFIG_PPC_CPM_NEW_BINDING +#include <linux/of_gpio.h> #include <asm/of_platform.h> #endif @@ -1172,8 +1173,7 @@ static int __devinit find_phy(struct device_node *np, struct fs_platform_info *fpi) { struct device_node *phynode, *mdionode; - struct resource res; - int ret = 0, len; + int ret = 0, len, bus_id; const u32 *data; data = of_get_property(np, "fixed-link", NULL); @@ -1190,19 +1190,28 @@ static int __devinit find_phy(struct device_node *np, if (!phynode) return -EINVAL; - mdionode = of_get_parent(phynode); - if (!mdionode) + data = of_get_property(phynode, "reg", &len); + if (!data || len != 4) { + ret = -EINVAL; goto out_put_phy; + } - ret = of_address_to_resource(mdionode, 0, &res); - if (ret) - goto out_put_mdio; + mdionode = of_get_parent(phynode); + if (!mdionode) { + ret = -EINVAL; + goto out_put_phy; + } - data = of_get_property(phynode, "reg", &len); - if (!data || len != 4) - goto out_put_mdio; + bus_id = of_get_gpio(mdionode, 0); + if (bus_id < 0) { + struct resource res; + ret = of_address_to_resource(mdionode, 0, &res); + if (ret) + goto out_put_mdio; + bus_id = res.start; + } - snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); + snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); out_put_mdio: of_node_put(mdionode); -- 1.5.0 -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-05-26 9:53 ` [PATCH 2/2] fs_enet: MDIO on GPIO support Laurent Pinchart @ 2008-06-16 8:57 ` Laurent Pinchart 2008-06-16 16:34 ` Scott Wood 0 siblings, 1 reply; 14+ messages in thread From: Laurent Pinchart @ 2008-06-16 8:57 UTC (permalink / raw) To: linuxppc-dev; +Cc: Scott Wood, netdev, jgarzik, vbordug [-- Attachment #1: Type: text/plain, Size: 2417 bytes --] On Monday 26 May 2008 11:53, Laurent Pinchart wrote: > Port the fs_enet driver to support the MDIO on GPIO driver for PHY access > in addition to the mii-bitbang driver. Now that 1/2 has been applied by Jeff, could this one make it to powerpc-next ? > Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> > --- > drivers/net/fs_enet/fs_enet-main.c | 31 ++++++++++++++++++++----------- > 1 files changed, 20 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c > index 67b4b07..b0eb1d2 100644 > --- a/drivers/net/fs_enet/fs_enet-main.c > +++ b/drivers/net/fs_enet/fs_enet-main.c > @@ -43,6 +43,7 @@ > #include <asm/uaccess.h> > > #ifdef CONFIG_PPC_CPM_NEW_BINDING > +#include <linux/of_gpio.h> > #include <asm/of_platform.h> > #endif > > @@ -1172,8 +1173,7 @@ static int __devinit find_phy(struct device_node *np, > struct fs_platform_info *fpi) > { > struct device_node *phynode, *mdionode; > - struct resource res; > - int ret = 0, len; > + int ret = 0, len, bus_id; > const u32 *data; > > data = of_get_property(np, "fixed-link", NULL); > @@ -1190,19 +1190,28 @@ static int __devinit find_phy(struct device_node *np, > if (!phynode) > return -EINVAL; > > - mdionode = of_get_parent(phynode); > - if (!mdionode) > + data = of_get_property(phynode, "reg", &len); > + if (!data || len != 4) { > + ret = -EINVAL; > goto out_put_phy; > + } > > - ret = of_address_to_resource(mdionode, 0, &res); > - if (ret) > - goto out_put_mdio; > + mdionode = of_get_parent(phynode); > + if (!mdionode) { > + ret = -EINVAL; > + goto out_put_phy; > + } > > - data = of_get_property(phynode, "reg", &len); > - if (!data || len != 4) > - goto out_put_mdio; > + bus_id = of_get_gpio(mdionode, 0); > + if (bus_id < 0) { > + struct resource res; > + ret = of_address_to_resource(mdionode, 0, &res); > + if (ret) > + goto out_put_mdio; > + bus_id = res.start; > + } > > - snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); > + snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); > > out_put_mdio: > of_node_put(mdionode); > -- > 1.5.0 > > -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-06-16 8:57 ` Laurent Pinchart @ 2008-06-16 16:34 ` Scott Wood 2008-06-18 14:48 ` Laurent Pinchart 0 siblings, 1 reply; 14+ messages in thread From: Scott Wood @ 2008-06-16 16:34 UTC (permalink / raw) To: Laurent Pinchart; +Cc: linuxppc-dev, jgarzik, vbordug, netdev On Mon, Jun 16, 2008 at 10:57:02AM +0200, Laurent Pinchart wrote: > On Monday 26 May 2008 11:53, Laurent Pinchart wrote: > > Port the fs_enet driver to support the MDIO on GPIO driver for PHY access > > in addition to the mii-bitbang driver. > > Now that 1/2 has been applied by Jeff, could this one make it to > powerpc-next ? This patch should probably go through Jeff as well... Acked-by: Scott Wood <scottwood@freescale.com> > > - data = of_get_property(phynode, "reg", &len); > > - if (!data || len != 4) > > - goto out_put_mdio; > > + bus_id = of_get_gpio(mdionode, 0); > > + if (bus_id < 0) { > > + struct resource res; > > + ret = of_address_to_resource(mdionode, 0, &res); > > + if (ret) > > + goto out_put_mdio; > > + bus_id = res.start; > > + } > > > > - snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); > > + snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); It'd be nice if this sort of thing could be moved to phylib, so the latter could simply be passed a device node (in addition to current mechanisms for the benefit of unfortunate device-tree-less architectures). -Scott ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-06-16 16:34 ` Scott Wood @ 2008-06-18 14:48 ` Laurent Pinchart 2008-06-18 15:00 ` Jeff Garzik 0 siblings, 1 reply; 14+ messages in thread From: Laurent Pinchart @ 2008-06-18 14:48 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-dev, jgarzik, vbordug, netdev [-- Attachment #1: Type: text/plain, Size: 1665 bytes --] Hi Scott, On Monday 16 June 2008 18:34, Scott Wood wrote: > On Mon, Jun 16, 2008 at 10:57:02AM +0200, Laurent Pinchart wrote: > > On Monday 26 May 2008 11:53, Laurent Pinchart wrote: > > > Port the fs_enet driver to support the MDIO on GPIO driver for PHY > > > access in addition to the mii-bitbang driver. > > > > Now that 1/2 has been applied by Jeff, could this one make it to > > powerpc-next ? > > This patch should probably go through Jeff as well... Jeff, what's your opinion on this ? > Acked-by: Scott Wood <scottwood@freescale.com> > > > > - data = of_get_property(phynode, "reg", &len); > > > - if (!data || len != 4) > > > - goto out_put_mdio; > > > + bus_id = of_get_gpio(mdionode, 0); > > > + if (bus_id < 0) { > > > + struct resource res; > > > + ret = of_address_to_resource(mdionode, 0, &res); > > > + if (ret) > > > + goto out_put_mdio; > > > + bus_id = res.start; > > > + } > > > > > > - snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); > > > + snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); > > It'd be nice if this sort of thing could be moved to phylib, so the latter > could simply be passed a device node (in addition to current mechanisms for > the benefit of unfortunate device-tree-less architectures). Adding a phy_connect_of that would move the above logic to phy_device.c shouldn't be too difficult. Would that be enough ? The mdio bus code would still use the bus id to identify phy devices in mdiobus_register. -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-06-18 14:48 ` Laurent Pinchart @ 2008-06-18 15:00 ` Jeff Garzik 2008-06-18 15:16 ` Laurent Pinchart 0 siblings, 1 reply; 14+ messages in thread From: Jeff Garzik @ 2008-06-18 15:00 UTC (permalink / raw) To: Laurent Pinchart; +Cc: Scott Wood, linuxppc-dev, vbordug, netdev Laurent Pinchart wrote: > Hi Scott, > > On Monday 16 June 2008 18:34, Scott Wood wrote: >> On Mon, Jun 16, 2008 at 10:57:02AM +0200, Laurent Pinchart wrote: >>> On Monday 26 May 2008 11:53, Laurent Pinchart wrote: >>>> Port the fs_enet driver to support the MDIO on GPIO driver for PHY >>>> access in addition to the mii-bitbang driver. >>> Now that 1/2 has been applied by Jeff, could this one make it to >>> powerpc-next ? >> This patch should probably go through Jeff as well... > > Jeff, what's your opinion on this ? > >> Acked-by: Scott Wood <scottwood@freescale.com> >> >>>> - data = of_get_property(phynode, "reg", &len); >>>> - if (!data || len != 4) >>>> - goto out_put_mdio; >>>> + bus_id = of_get_gpio(mdionode, 0); >>>> + if (bus_id < 0) { >>>> + struct resource res; >>>> + ret = of_address_to_resource(mdionode, 0, &res); >>>> + if (ret) >>>> + goto out_put_mdio; >>>> + bus_id = res.start; >>>> + } >>>> >>>> - snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); >>>> + snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); What are the patch dependencies, if any? My general rule is, anytime I see 80%+ of the patch dealing with arch-specific API functions (such as OF resource stuff), I tend to prefer that goes via an arch tree. If it's a networking change, of course I'd prefer it came in my direction. Jeff ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-06-18 15:00 ` Jeff Garzik @ 2008-06-18 15:16 ` Laurent Pinchart 2008-06-26 11:21 ` Laurent Pinchart 0 siblings, 1 reply; 14+ messages in thread From: Laurent Pinchart @ 2008-06-18 15:16 UTC (permalink / raw) To: Jeff Garzik; +Cc: Scott Wood, linuxppc-dev, vbordug, netdev [-- Attachment #1: Type: text/plain, Size: 2390 bytes --] On Wednesday 18 June 2008 17:00, Jeff Garzik wrote: > Laurent Pinchart wrote: > > Hi Scott, > > > > On Monday 16 June 2008 18:34, Scott Wood wrote: > >> On Mon, Jun 16, 2008 at 10:57:02AM +0200, Laurent Pinchart wrote: > >>> On Monday 26 May 2008 11:53, Laurent Pinchart wrote: > >>>> Port the fs_enet driver to support the MDIO on GPIO driver for PHY > >>>> access in addition to the mii-bitbang driver. > >>> Now that 1/2 has been applied by Jeff, could this one make it to > >>> powerpc-next ? > >> This patch should probably go through Jeff as well... > > > > Jeff, what's your opinion on this ? > > > >> Acked-by: Scott Wood <scottwood@freescale.com> > >> > >>>> - data = of_get_property(phynode, "reg", &len); > >>>> - if (!data || len != 4) > >>>> - goto out_put_mdio; > >>>> + bus_id = of_get_gpio(mdionode, 0); > >>>> + if (bus_id < 0) { > >>>> + struct resource res; > >>>> + ret = of_address_to_resource(mdionode, 0, &res); > >>>> + if (ret) > >>>> + goto out_put_mdio; > >>>> + bus_id = res.start; > >>>> + } > >>>> > >>>> - snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); > >>>> + snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); > > What are the patch dependencies, if any? > > My general rule is, anytime I see 80%+ of the patch dealing with > arch-specific API functions (such as OF resource stuff), I tend to > prefer that goes via an arch tree. > > If it's a networking change, of course I'd prefer it came in my direction. The patch modifies the way the Freescale SoC fs_enet driver computes the PHY bus_id field when it connects to a PHY. The 'legacy' binding method was to use the MDIO general purpose I/O register address to identify the mii bus. My first patch (OpenFirmware GPIO based MDIO bitbang driver) introduces a new binding using the GPIO library. With this patch the mii bus is now identified by the GPIO lib I/O resource number if available and falls back to the register address when the device tree uses the legacy binding. There should be no dependencies. When the OF GPIO support is not selected linux/of_gpio.h will define of_get_gpio() as a stub, so the fs_enet driver will fall back to the legacy binding. -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-06-18 15:16 ` Laurent Pinchart @ 2008-06-26 11:21 ` Laurent Pinchart 2008-06-26 13:55 ` Vitaly Bordug 0 siblings, 1 reply; 14+ messages in thread From: Laurent Pinchart @ 2008-06-26 11:21 UTC (permalink / raw) To: linuxppc-dev; +Cc: Scott Wood, netdev, Jeff Garzik, vbordug [-- Attachment #1: Type: text/plain, Size: 2642 bytes --] Jeff, Scott, On Wednesday 18 June 2008 17:16, Laurent Pinchart wrote: > On Wednesday 18 June 2008 17:00, Jeff Garzik wrote: > > Laurent Pinchart wrote: > > > Hi Scott, > > > > > > On Monday 16 June 2008 18:34, Scott Wood wrote: > > >> On Mon, Jun 16, 2008 at 10:57:02AM +0200, Laurent Pinchart wrote: > > >>> On Monday 26 May 2008 11:53, Laurent Pinchart wrote: > > >>>> Port the fs_enet driver to support the MDIO on GPIO driver for PHY > > >>>> access in addition to the mii-bitbang driver. > > >>> Now that 1/2 has been applied by Jeff, could this one make it to > > >>> powerpc-next ? > > >> This patch should probably go through Jeff as well... > > > > > > Jeff, what's your opinion on this ? > > > > > >> Acked-by: Scott Wood <scottwood@freescale.com> > > >> > > >>>> - data = of_get_property(phynode, "reg", &len); > > >>>> - if (!data || len != 4) > > >>>> - goto out_put_mdio; > > >>>> + bus_id = of_get_gpio(mdionode, 0); > > >>>> + if (bus_id < 0) { > > >>>> + struct resource res; > > >>>> + ret = of_address_to_resource(mdionode, 0, &res); > > >>>> + if (ret) > > >>>> + goto out_put_mdio; > > >>>> + bus_id = res.start; > > >>>> + } > > >>>> > > >>>> - snprintf(fpi->bus_id, 16, "%x:%02x", res.start, *data); > > >>>> + snprintf(fpi->bus_id, 16, "%x:%02x", bus_id, *data); > > > > What are the patch dependencies, if any? > > > > My general rule is, anytime I see 80%+ of the patch dealing with > > arch-specific API functions (such as OF resource stuff), I tend to > > prefer that goes via an arch tree. > > > > If it's a networking change, of course I'd prefer it came in my direction. > > The patch modifies the way the Freescale SoC fs_enet driver computes the PHY > bus_id field when it connects to a PHY. > > The 'legacy' binding method was to use the MDIO general purpose I/O register > address to identify the mii bus. My first patch (OpenFirmware GPIO based MDIO > bitbang driver) introduces a new binding using the GPIO library. > > With this patch the mii bus is now identified by the GPIO lib I/O resource > number if available and falls back to the register address when the device > tree uses the legacy binding. > > There should be no dependencies. When the OF GPIO support is not selected > linux/of_gpio.h will define of_get_gpio() as a stub, so the fs_enet driver > will fall back to the legacy binding. Have we reached a consensus on which tree the patch should go to ? -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-06-26 11:21 ` Laurent Pinchart @ 2008-06-26 13:55 ` Vitaly Bordug 2008-07-18 9:26 ` Laurent Pinchart 0 siblings, 1 reply; 14+ messages in thread From: Vitaly Bordug @ 2008-06-26 13:55 UTC (permalink / raw) To: Laurent Pinchart; +Cc: Scott Wood, linuxppc-dev, Jeff Garzik, netdev On Thu, 26 Jun 2008 13:21:23 +0200 Laurent Pinchart <laurentp@cse-semaphore.com> wrote: > > There should be no dependencies. When the OF GPIO support is not selected > > linux/of_gpio.h will define of_get_gpio() as a stub, so the fs_enet driver > > will fall back to the legacy binding. > > Have we reached a consensus on which tree the patch should go to ? I think it should go through powerpc tree, not seeing too much netdev-generic stuff in here. If noone will object, Kumar will pick it up I guess... -- Sincerely, Vitaly ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-06-26 13:55 ` Vitaly Bordug @ 2008-07-18 9:26 ` Laurent Pinchart 2008-07-18 13:40 ` Kumar Gala 0 siblings, 1 reply; 14+ messages in thread From: Laurent Pinchart @ 2008-07-18 9:26 UTC (permalink / raw) To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev, Jeff Garzik, Vitaly Bordug, netdev [-- Attachment #1: Type: text/plain, Size: 823 bytes --] On Thursday 26 June 2008, Vitaly Bordug wrote: > On Thu, 26 Jun 2008 13:21:23 +0200 > Laurent Pinchart <laurentp@cse-semaphore.com> wrote: > > > > There should be no dependencies. When the OF GPIO support is not > > > selected linux/of_gpio.h will define of_get_gpio() as a stub, so the > > > fs_enet driver will fall back to the legacy binding. > > > > Have we reached a consensus on which tree the patch should go to ? > I think it should go through powerpc tree, not seeing too much > netdev-generic stuff in here. If noone will object, Kumar will pick it up I > guess... Kumar, could you pick it up ? I'd like to see this in 2.6.27. Best regards, -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-07-18 9:26 ` Laurent Pinchart @ 2008-07-18 13:40 ` Kumar Gala 2008-07-18 17:10 ` Jeff Garzik 0 siblings, 1 reply; 14+ messages in thread From: Kumar Gala @ 2008-07-18 13:40 UTC (permalink / raw) To: Laurent Pinchart Cc: Scott Wood, linuxppc-dev, Jeff Garzik, Vitaly Bordug, netdev On Jul 18, 2008, at 4:26 AM, Laurent Pinchart wrote: > On Thursday 26 June 2008, Vitaly Bordug wrote: >> On Thu, 26 Jun 2008 13:21:23 +0200 >> Laurent Pinchart <laurentp@cse-semaphore.com> wrote: >> >>>> There should be no dependencies. When the OF GPIO support is not >>>> selected linux/of_gpio.h will define of_get_gpio() as a stub, so >>>> the >>>> fs_enet driver will fall back to the legacy binding. >>> >>> Have we reached a consensus on which tree the patch should go to ? >> I think it should go through powerpc tree, not seeing too much >> netdev-generic stuff in here. If noone will object, Kumar will pick >> it up I >> guess... > > Kumar, could you pick it up ? I'd like to see this in 2.6.27. > > Best regards, Jeff said he applied both to his tree already. - k ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] fs_enet: MDIO on GPIO support 2008-07-18 13:40 ` Kumar Gala @ 2008-07-18 17:10 ` Jeff Garzik 0 siblings, 0 replies; 14+ messages in thread From: Jeff Garzik @ 2008-07-18 17:10 UTC (permalink / raw) To: Kumar Gala; +Cc: linuxppc-dev, netdev, Vitaly Bordug, Scott Wood Kumar Gala wrote: > > On Jul 18, 2008, at 4:26 AM, Laurent Pinchart wrote: > >> On Thursday 26 June 2008, Vitaly Bordug wrote: >>> On Thu, 26 Jun 2008 13:21:23 +0200 >>> Laurent Pinchart <laurentp@cse-semaphore.com> wrote: >>> >>>>> There should be no dependencies. When the OF GPIO support is not >>>>> selected linux/of_gpio.h will define of_get_gpio() as a stub, so the >>>>> fs_enet driver will fall back to the legacy binding. >>>> >>>> Have we reached a consensus on which tree the patch should go to ? >>> I think it should go through powerpc tree, not seeing too much >>> netdev-generic stuff in here. If noone will object, Kumar will pick >>> it up I >>> guess... >> >> Kumar, could you pick it up ? I'd like to see this in 2.6.27. >> >> Best regards, > > Jeff said he applied both to his tree already. Yep, it's already in davem's net-next... Jeff ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-07-18 17:10 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-05-26 9:52 [PATCH 0/2] MDIO on GPIO support for the fs_enet driver Laurent Pinchart 2008-05-26 9:53 ` [PATCH 1/2] net: OpenFirmware GPIO based MDIO bitbang driver Laurent Pinchart 2008-05-31 2:20 ` Jeff Garzik 2008-05-26 9:53 ` [PATCH 2/2] fs_enet: MDIO on GPIO support Laurent Pinchart 2008-06-16 8:57 ` Laurent Pinchart 2008-06-16 16:34 ` Scott Wood 2008-06-18 14:48 ` Laurent Pinchart 2008-06-18 15:00 ` Jeff Garzik 2008-06-18 15:16 ` Laurent Pinchart 2008-06-26 11:21 ` Laurent Pinchart 2008-06-26 13:55 ` Vitaly Bordug 2008-07-18 9:26 ` Laurent Pinchart 2008-07-18 13:40 ` Kumar Gala 2008-07-18 17:10 ` Jeff Garzik
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).