* Re: [PATCH v1] usb: phy: generic: migrate to gpio_desc [not found] ` <20141121154358.GF7508@saruman> @ 2014-11-28 10:37 ` Linus Walleij [not found] ` <CACRpkdZtwYb77ytGiadFnZAUOkr8y_HPQoM3vmXBc+N6dszAJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Linus Walleij @ 2014-11-28 10:37 UTC (permalink / raw) To: Felipe Balbi Cc: Robert Jarzmik, linux-usb@vger.kernel.org, Alexandre Courbot, linux-gpio@vger.kernel.org On Fri, Nov 21, 2014 at 4:43 PM, Felipe Balbi <balbi@ti.com> wrote: > On Sun, Nov 09, 2014 at 01:23:07PM +0100, Robert Jarzmik wrote: >> >> Change internal gpio handling from integer gpios into gpio >> descriptors. This change only addresses the internal API and >> device-tree/ACPI, while the legacy platform data remains integer space >> based. >> >> This change is only build compile tested, and very prone to error. I >> leave this comment for now in the commit message so that this patch gets >> some testing as I'm pretty sure it's buggy. >> >> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> > > To my eyes, patch looks fine, but let's get a review from Linus W. > > Linus, can you have a look below ? Is this being used the way you > intended ? BTW, we need support DT and pdata platforms here. This definately make things better so: Acked-by: Linus Walleij <linus.walleij@linaro.org> One comment though: >> if (dev->of_node) { (...) >> + nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios"); >> + err = PTR_ERR(nop->gpiod_reset); >> } else if (pdata) { (...) >> + err = devm_gpio_request_one(dev, pdata->gpio_reset, 0, >> + dev_name(dev)); >> + if (!err) >> + nop->gpiod_reset = gpio_to_desc(pdata->gpio_reset); >> + } This construction implies that if we don't have a DT node, the GPIO is passed as a fixed number in pdata->gpio_reset, but it is actually possible to use descriptors in board files by adding a fixed table. So a next step would be to add support for getting the devm_gpiod_get(dev, "reset-gpios"); outside of the if (dev->of_node) clause, and possibly convert the board files for affected platforms to use descriptors, if they will not be replaced by device tree only. I know this is a major work, so this patch is still a good start! Using descriptors internally is always preferred. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CACRpkdZtwYb77ytGiadFnZAUOkr8y_HPQoM3vmXBc+N6dszAJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v1] usb: phy: generic: migrate to gpio_desc [not found] ` <CACRpkdZtwYb77ytGiadFnZAUOkr8y_HPQoM3vmXBc+N6dszAJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-11-30 20:32 ` Robert Jarzmik 2014-12-01 4:01 ` Alexandre Courbot 0 siblings, 1 reply; 4+ messages in thread From: Robert Jarzmik @ 2014-11-30 20:32 UTC (permalink / raw) To: Linus Walleij Cc: Felipe Balbi, linux-usb@vger.kernel.org, Alexandre Courbot, linux-gpio@vger.kernel.org Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> writes: > This definately make things better so: > Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Thanks. > One comment though: > >>> if (dev->of_node) { > (...) >>> + nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios"); >>> + err = PTR_ERR(nop->gpiod_reset); >>> } else if (pdata) { > (...) >>> + err = devm_gpio_request_one(dev, pdata->gpio_reset, 0, >>> + dev_name(dev)); >>> + if (!err) >>> + nop->gpiod_reset = gpio_to_desc(pdata->gpio_reset); >>> + } > So a next step would be to add support for getting the > devm_gpiod_get(dev, "reset-gpios"); outside of the if (dev->of_node) > clause, and possibly convert the board files for affected > platforms to use descriptors, if they will not be replaced by > device tree only. OK, if we were to do this, is there a way to build a static platform data with a gpio descriptor ? Ie. can I write something like : struct generic_phy_pdata { struct gpio_desc *reset_gpio; }; And in machine code : static struct generic_phy_pdata usb_phy __initdata { .reset_gpio = XXX(19), }; What should "XXX" be like to describe reset_gpio as a ACTIVE_HIGH gpio number 19 ? Cheers. -- Robert -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: phy: generic: migrate to gpio_desc 2014-11-30 20:32 ` Robert Jarzmik @ 2014-12-01 4:01 ` Alexandre Courbot 2014-12-03 22:54 ` Robert Jarzmik 0 siblings, 1 reply; 4+ messages in thread From: Alexandre Courbot @ 2014-12-01 4:01 UTC (permalink / raw) To: Robert Jarzmik Cc: Linus Walleij, Felipe Balbi, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org On Mon, Dec 1, 2014 at 5:32 AM, Robert Jarzmik <robert.jarzmik@free.fr> wrote: > Linus Walleij <linus.walleij@linaro.org> writes: > >> This definately make things better so: >> Acked-by: Linus Walleij <linus.walleij@linaro.org> > Thanks. > >> One comment though: >> >>>> if (dev->of_node) { >> (...) >>>> + nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios"); >>>> + err = PTR_ERR(nop->gpiod_reset); >>>> } else if (pdata) { >> (...) >>>> + err = devm_gpio_request_one(dev, pdata->gpio_reset, 0, >>>> + dev_name(dev)); >>>> + if (!err) >>>> + nop->gpiod_reset = gpio_to_desc(pdata->gpio_reset); >>>> + } > >> So a next step would be to add support for getting the >> devm_gpiod_get(dev, "reset-gpios"); outside of the if (dev->of_node) >> clause, and possibly convert the board files for affected >> platforms to use descriptors, if they will not be replaced by >> device tree only. > > OK, if we were to do this, is there a way to build a static platform data with a > gpio descriptor ? > Ie. can I write something like : > struct generic_phy_pdata { > struct gpio_desc *reset_gpio; > }; > > And in machine code : > static struct generic_phy_pdata usb_phy __initdata { > .reset_gpio = XXX(19), > }; > > What should "XXX" be like to describe reset_gpio as a ACTIVE_HIGH gpio number 19 > ? I think what you want to do is explained in the "Platform Data" section of Documentation/gpio/board.txt ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: phy: generic: migrate to gpio_desc 2014-12-01 4:01 ` Alexandre Courbot @ 2014-12-03 22:54 ` Robert Jarzmik 0 siblings, 0 replies; 4+ messages in thread From: Robert Jarzmik @ 2014-12-03 22:54 UTC (permalink / raw) To: Alexandre Courbot Cc: Linus Walleij, Felipe Balbi, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org Alexandre Courbot <gnurou@gmail.com> writes: > I think what you want to do is explained in the "Platform Data" > section of Documentation/gpio/board.txt Ah yeah, already one year and I never checked again this documemtation. Thanks. -- Robert ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-03 22:54 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1415535787-21868-1-git-send-email-robert.jarzmik@free.fr> [not found] ` <20141121154358.GF7508@saruman> 2014-11-28 10:37 ` [PATCH v1] usb: phy: generic: migrate to gpio_desc Linus Walleij [not found] ` <CACRpkdZtwYb77ytGiadFnZAUOkr8y_HPQoM3vmXBc+N6dszAJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-11-30 20:32 ` Robert Jarzmik 2014-12-01 4:01 ` Alexandre Courbot 2014-12-03 22:54 ` Robert Jarzmik
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).