Re: [PATCH] USB: host: ehci: allow tine of highspeed nak-count
On Fri, Nov 16, 2018 at 10:38:18AM -0500, Alan Stern wrote: > On Fri, 16 Nov 2018, Ben Dooks wrote: > > > On 14/11/18 18:47, Alan Stern wrote: > > > On Wed, 14 Nov 2018, Ben Dooks wrote: > > > > > >> From: Ben Dooks > > >> > > >> At least some systems benefit with less scheduling if the NAK count > > >> value is set higher than the default 4. For instance a Tegra3 with > > >> an SMSC9512 showed less interrupt load when this was changed to 14. > > > > > > Interesting. Why do you think this is? In theory, increasing the NAK > > > count RL value should cause a higher memory bus load and perhaps a > > > slight rise in the interrupt load (transfers will complete a little > > > more quickly because the controller tries harder to poll the endpoints > > > and see if they are ready). > > > > I thought the NAK counter was decremented until the transfer is given > > up on. > > That's right. So if the RL value is higher, there will be more polling > attempts in quick succession before the NAK counter drops to 0 and the > controller gives up. More polling attempts in quick succession means > heavier memory bus usage. > > > I'm going to have to go back and get some actual figures from > > a running system as this was originally done over a year ago with the > > SMSC9512 (IIRC) network driver. > > > > >> To allow the changing of this value, add a sysfs node to each of > > >> the controllers to allow run-time changing. > > >> > > >> Signed-off-by: Ben Dooks > > > > > > The patch looks okay to me. > > > > I'll look at getting some tracing from the SMSC driver to see what > > is going on. > > Okay. Should we consider the patch to be held in suspense until then? Yes, I'm not going to have access to any of the test hardware until the end of the week, and will re-verify my initial notes from last year. -- Ben Dooks, b...@fluff.org, http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear.
[PATCH] net: cdc_ncm: use tasklet_init() for tasklet_struct init
The tasklet initialisation would be better done by tasklet_init() instead of assuming all the fields are in an ok state by default. This does not fix any actual know bug. Signed-off-by: Ben Dooks --- drivers/net/usb/cdc_ncm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 0d722b326e1b..863f3548a439 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -784,8 +784,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ hrtimer_init(>tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ctx->tx_timer.function = _ncm_tx_timer_cb; - ctx->bh.data = (unsigned long)dev; - ctx->bh.func = cdc_ncm_txpath_bh; + tasklet_init(>bh, cdc_ncm_txpath_bh, (unsigned long)dev); atomic_set(>stop, 0); spin_lock_init(>mtx); -- 2.19.1
Re: [PATCH 4/7] phy: meson: add USB2 PHY support for Meson8b and GXBB
On 09/09/16 17:14, Martin Blumenstingl wrote: On Fri, Sep 9, 2016 at 5:33 PM, Kevin Hilman <khil...@baylibre.com> wrote: However, the problem with all of the solutions proposed (runtime PM ones included) is that we're forcing a board-specific design issue (2 devices sharing a reset line) into a driver that should not have any board-specific assumptions in it. For example, if this driver is used on another platform where different PHYs have different reset lines, then one of them (the unlucky one who is not probed first) will never get reset. So any form of per-device ref-counting is not a portable solution. maybe we should also consider Ben's solution: he played with the USB PHY on his Meson8b board. His approach was to have only one USB PHY driver instance which exposes two PHYs. The downside of this: the driver would have to know the offset of the PHYs (0x0 for the first PHY, 0x20 for the second), but we could handle the reset using runtime PM without any hacks. I checked the USB PHY reference driver: it seems that there will be a new USB PHY with the GXL/GXM SoCs. So maybe we could live with the assumption that the PHYs are at consecutive addresses. I'm not sure yet how the reset framework is supposed to handle shared reset lines, but that needs some investigation. I quick glance and it seems that reset controllers can have shared lines, so that should be investigated. unfortunately shared resets are not allowed to use reset_control_reset, see [0] [0] http://lxr.free-electrons.com/source/drivers/reset/core.c#L102 If we didn't have the shared reset, we'd have one of node per phy and not have to have two sub-nodes... I don't think any other bits of the PHY framework are shared. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] phy: meson: add USB2 PHY support for Meson8b and GXBB
On 08/09/16 21:42, Kevin Hilman wrote: Ben Dooks <ben.do...@codethink.co.uk> writes: On 08/09/16 20:52, Martin Blumenstingl wrote: On Thu, Sep 8, 2016 at 9:35 PM, Kevin Hilman <khil...@baylibre.com> wrote: + phy = devm_phy_create(>dev, NULL, _meson_usb2_ops); + if (IS_ERR(phy)) { + dev_err(>dev, "failed to create PHY\n"); + return PTR_ERR(phy); + } + + if (usb_reset_refcnt++ == 0) { + ret = device_reset(>dev); + if (ret) { + dev_err(>dev, "Failed to reset USB PHY\n"); + return ret; + } + } The ref count + reset here looks like something that could/should be handled in a runtime PM callback. Unfortunately that doesn't work (as Jerome found out) because both PHYs are sharing the same reset line. So if the second PHY would call device_reset then it would also reset the first PHY! There's a comment above the declaration of usb_reset_refcnt which tries to explain this: "The PHYs are sharing a common reset line -> we are only allowed to reset once for all PHYs." Maybe I should move this comment to the "if (usb_reset_refcnt++ == 0) {" line to make it easier to see? pm-runtime has refcounting in it. When one of the nodes turns on, the pm-runtime will call your driver to say there is a user when this first use turns up. If all the sub-phys turn off and drop their refcount then the driver is called to say there are no more users and you can go to sleep. After a chat w/Martin on IRC, It turns out runtime PM wont help here. The reason is because there are physically two PHY devices[1]. Those 2 devices will be treated independely by runtime PM, and have separate use-counting, which means doing what I proposed would cause a reset to happen when either device was probed. So, I think it's OK as it is. Surely you can do pm_runtime_get/put on the phy's parent platform device and do it that way? -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] phy: meson: add USB2 PHY support for Meson8b and GXBB
On 08/09/16 20:52, Martin Blumenstingl wrote: On Thu, Sep 8, 2016 at 9:35 PM, Kevin Hilman <khil...@baylibre.com> wrote: + phy = devm_phy_create(>dev, NULL, _meson_usb2_ops); + if (IS_ERR(phy)) { + dev_err(>dev, "failed to create PHY\n"); + return PTR_ERR(phy); + } + + if (usb_reset_refcnt++ == 0) { + ret = device_reset(>dev); + if (ret) { + dev_err(>dev, "Failed to reset USB PHY\n"); + return ret; + } + } The ref count + reset here looks like something that could/should be handled in a runtime PM callback. Unfortunately that doesn't work (as Jerome found out) because both PHYs are sharing the same reset line. So if the second PHY would call device_reset then it would also reset the first PHY! There's a comment above the declaration of usb_reset_refcnt which tries to explain this: "The PHYs are sharing a common reset line -> we are only allowed to reset once for all PHYs." Maybe I should move this comment to the "if (usb_reset_refcnt++ == 0) {" line to make it easier to see? pm-runtime has refcounting in it. When one of the nodes turns on, the pm-runtime will call your driver to say there is a user when this first use turns up. If all the sub-phys turn off and drop their refcount then the driver is called to say there are no more users and you can go to sleep. So, in phy_meson_usb2_power_on() you could do: pm_runtime_get_sync(pdev); and in phy_meson_usb2_power_off pm_runtime_put(pdev); https://www.kernel.org/doc/Documentation/power/runtime_pm.txt -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] phy: meson: add USB2 PHY support for Meson8b and GXBB
On 08/09/16 20:35, Kevin Hilman wrote: Martin Blumenstingl <martin.blumensti...@googlemail.com> writes: This is a new driver for the USB PHY found in Meson8b and GXBB SoCs. Signed-off-by: Martin Blumenstingl <martin.blumensti...@googlemail.com> Signed-off-by: Jerome Brunet <jbru...@baylibre.com> I tested this on meson-gxbb-p200 with USB host and a mass storage device. Tested-by: Kevin Hilman <khil...@baylibre.com> A minor question/comment below, for you and for Kishon... [...] +static int phy_meson_usb2_probe(struct platform_device *pdev) +{ + struct phy_meson_usb2_priv *priv; + struct resource *res; + struct phy *phy; + struct phy_provider *phy_provider; + int ret; + + priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + priv->regs = devm_ioremap_resource(>dev, res); + if (IS_ERR(priv->regs)) + return PTR_ERR(priv->regs); + + priv->clk_usb_general = devm_clk_get(>dev, "usb_general"); + if (IS_ERR(priv->clk_usb_general)) + return PTR_ERR(priv->clk_usb_general); + + priv->clk_usb = devm_clk_get(>dev, "usb"); + if (IS_ERR(priv->clk_usb)) + return PTR_ERR(priv->clk_usb); + + priv->dr_mode = of_usb_get_dr_mode_by_phy(pdev->dev.of_node, -1); + if (priv->dr_mode == USB_DR_MODE_UNKNOWN) { + dev_err(>dev, + "missing dual role configuration of the controller\n"); + return -EINVAL; + } + + phy = devm_phy_create(>dev, NULL, _meson_usb2_ops); + if (IS_ERR(phy)) { + dev_err(>dev, "failed to create PHY\n"); + return PTR_ERR(phy); + } + + if (usb_reset_refcnt++ == 0) { + ret = device_reset(>dev); + if (ret) { + dev_err(>dev, "Failed to reset USB PHY\n"); + return ret; + } + } The ref count + reset here looks like something that could/should be handled in a runtime PM callback. IOW, there should be a pm_runtime_get_sync() here, and in the ->runtime_resume() callback, the device_reset() would be called. Runtime PM does the refcounting, and only calls ->runtime_resume() on the 0 -> 1 transition. This isn't a big deal for now, so I'll let Kishon decide, but using runtime PM from the start will help enabling other PM features later. I agree, pm_runtime would probably be the best place to handle >1 device with shared items such as reset. The version I wrote, I simply enabled the clocks and reset the device when probed to work around the shared reset. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: ohci-at91: make at91_dt_syscon_sfr static
On 26/06/16 19:48, Greg Kroah-Hartman wrote: > On Fri, Jun 17, 2016 at 04:11:55PM +0100, Ben Dooks wrote: >> Make at91_dt_syscon_sfr() static as it is not used or declared >> outside the drivers/usb/host/ohci-at91.c file. >> >> drivers/usb/host/ohci-at91.c:144:15: warning: symbol 'at91_dt_syscon_sfr' >> was not declared. Should it be static? >> >> Signed-off-by: Ben Dooks <ben.do...@codethink.co.uk> >> Acked-by: Nicolas Ferre <nicolas.fe...@atmel.com> >> Acked-by: Alexandre Belloni <alexandre.bell...@free-electrons.com> >> --- >> Cc: Alan Stern <st...@rowland.harvard.edu> >> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> >> Cc: linux-usb@vger.kernel.org >> Cc: Alexandre Belloni <alexandre.bell...@free-electrons.com> >> Cc: Jean-Christophe Plagniol-Villard <plagn...@jcrosoft.com> >> --- >> drivers/usb/host/ohci-at91.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > Doesn't apply properly to my tree :( I think the function has now been removed, but I'd need to check. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: renesas_usbhs: make usbhs_write32() static
The usbhs_write32 function is not used outside of the rcar3.c file, so fix the following sparse warning by making it static: drivers/usb/renesas_usbhs/rcar3.c:26:6: warning: symbol 'usbhs_write32' was not declared. Should it be static? Signed-off-by: Ben Dooks <ben.do...@codethink.co.uk> --- Cc: Yoshihiro Shimoda <yoshihiro.shimoda...@renesas.com> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Cc: linux-renesas-...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org --- drivers/usb/renesas_usbhs/rcar3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/rcar3.c b/drivers/usb/renesas_usbhs/rcar3.c index 38b01f2..1d70add 100644 --- a/drivers/usb/renesas_usbhs/rcar3.c +++ b/drivers/usb/renesas_usbhs/rcar3.c @@ -23,7 +23,7 @@ #define UGCTRL2_RESERVED_3 0x0001 /* bit[3:0] should be B'0001 */ #define UGCTRL2_USB0SEL_OTG0x0030 -void usbhs_write32(struct usbhs_priv *priv, u32 reg, u32 data) +static void usbhs_write32(struct usbhs_priv *priv, u32 reg, u32 data) { iowrite32(data, priv->base + reg); } -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: ohci-at91: make at91_dt_syscon_sfr static
Make at91_dt_syscon_sfr() static as it is not used or declared outside the drivers/usb/host/ohci-at91.c file. drivers/usb/host/ohci-at91.c:144:15: warning: symbol 'at91_dt_syscon_sfr' was not declared. Should it be static? Signed-off-by: Ben Dooks <ben.do...@codethink.co.uk> --- Cc: Alan Stern <st...@rowland.harvard.edu> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Cc: Nicolas Ferre <nicolas.fe...@atmel.com> Cc: Alexandre Belloni <alexandre.bell...@free-electrons.com> Cc: Jean-Christophe Plagniol-Villard <plagn...@jcrosoft.com> --- drivers/usb/host/ohci-at91.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 54e8feb..a69b421 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -141,7 +141,7 @@ static void at91_stop_hc(struct platform_device *pdev) /*-*/ -struct regmap *at91_dt_syscon_sfr(void) +static struct regmap *at91_dt_syscon_sfr(void) { struct regmap *regmap; -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: core: fix missing include
On 14/06/16 12:08, Arnd Bergmann wrote: > On Wednesday, June 8, 2016 3:04:27 AM CEST kbuild test robot wrote: >>>> drivers/usb/core/of.c:32:21: error: redefinition of 'usb_of_get_child_node' >> struct device_node *usb_of_get_child_node(struct device_node *parent, >> ^ >>In file included from drivers/usb/core/of.c:21:0: >>include/linux/usb/of.h:36:35: note: previous definition of >> 'usb_of_get_child_node' was here >> static inline struct device_node *usb_of_get_child_node >> ^ >> >> vim +/usb_of_get_child_node +32 drivers/usb/core/of.c >> >> 69bec725 Peter Chen 2016-02-19 26 * @portnum: the port number which >> device is connecting >> 69bec725 Peter Chen 2016-02-19 27 * >> 69bec725 Peter Chen 2016-02-19 28 * Find the node from device tree >> according to its port number. >> 69bec725 Peter Chen 2016-02-19 29 * >> 69bec725 Peter Chen 2016-02-19 30 * Return: On success, a pointer to the >> device node, %NULL on failure. >> 69bec725 Peter Chen 2016-02-19 31 */ >> 69bec725 Peter Chen 2016-02-19 @32 struct device_node >> *usb_of_get_child_node(struct device_node *parent, >> 69bec725 Peter Chen 2016-02-19 33 int >> portnum) >> 69bec725 Peter Chen 2016-02-19 34 { >> 69bec725 Peter Chen 2016-02-19 35 struct device_node *node; >> >> > > I think what we want here is to make the compilation of of.o conditional on > CONFIG_OF, so we get only one of the two definitions. Ah, so make the of.o conditional, and also apply my patch for when it is compiled. Should I submit one for that, or is someone else on the case? -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: core: fix missing include
On 15/06/16 03:43, Peter Chen wrote: > On Tue, Jun 14, 2016 at 01:08:08PM +0200, Arnd Bergmann wrote: >> On Wednesday, June 8, 2016 3:04:27 AM CEST kbuild test robot wrote: >>>>> drivers/usb/core/of.c:32:21: error: redefinition of >>>>> 'usb_of_get_child_node' >>> struct device_node *usb_of_get_child_node(struct device_node *parent, >>> ^ >>>In file included from drivers/usb/core/of.c:21:0: >>>include/linux/usb/of.h:36:35: note: previous definition of >>> 'usb_of_get_child_node' was here >>> static inline struct device_node *usb_of_get_child_node >>> ^ >>> >>> vim +/usb_of_get_child_node +32 drivers/usb/core/of.c >>> >>> 69bec725 Peter Chen 2016-02-19 26 * @portnum: the port number which >>> device is connecting >>> 69bec725 Peter Chen 2016-02-19 27 * >>> 69bec725 Peter Chen 2016-02-19 28 * Find the node from device tree >>> according to its port number. >>> 69bec725 Peter Chen 2016-02-19 29 * >>> 69bec725 Peter Chen 2016-02-19 30 * Return: On success, a pointer to the >>> device node, %NULL on failure. >>> 69bec725 Peter Chen 2016-02-19 31 */ >>> 69bec725 Peter Chen 2016-02-19 @32 struct device_node >>> *usb_of_get_child_node(struct device_node *parent, >>> 69bec725 Peter Chen 2016-02-19 33 int >>> portnum) >>> 69bec725 Peter Chen 2016-02-19 34 { >>> 69bec725 Peter Chen 2016-02-19 35 struct device_node *node; >>> >>> >> >> I think what we want here is to make the compilation of of.o conditional on >> CONFIG_OF, so we get only one of the two definitions. >> >> Arnd > > Thanks, Arnd. It is the correct solution, I will send patch soon. Aha, I didn't think of that. Thanks. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] USB: core: fix missing include
The helper function usb_of_get_child_node() is defined in the header but this was not included. Fix the warning about usb_of_get_child_node() not being declared by adding the right include. Fixes: drivers/usb/core/of.c:31:20: warning: symbol 'usb_of_get_child_node' was not declared. Should it be static? Signed-off-by: Ben Dooks <ben.do...@codethink.co.uk> --- Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> Cc: Arnd Bergmann <a...@arndb.de> Cc: Philipp Zabel <p.za...@pengutronix.de> Cc: Alan Stern <st...@rowland.harvard.edu> Cc: Peter Chen <peter.c...@freescale.com> Cc: linux-usb@vger.kernel.org Cc: linux-ker...@vger.kernel.org --- drivers/usb/core/of.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c index 2289700..3de4f88 100644 --- a/drivers/usb/core/of.c +++ b/drivers/usb/core/of.c @@ -18,6 +18,7 @@ */ #include +#include /** * usb_of_get_child_node - Find the device node match port number -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: AM3517 usb host issue
On 22/05/15 14:50, Felipe Balbi wrote: > Hi, > > On Fri, May 22, 2015 at 11:04:33AM +0300, Ben Dooks wrote: >> I am trying to get the full-speed USB host working on an custom >> AM3517 device with the 3.18.12 kernel. The hardware works (a >> 2.6.37 kernel has been used for testing). >> >> Does anyone have any experience of 3.18 (or similarly recent >> kernel on an AM3517 system) or have any pointers as where to >> start debugging? The ti-linux-3.14.y does not have any patches >> that aren't applied to the usb on 3.18.13. >> >> The cpu port 1 is connected by a TI TUSB1106 usb transceiver >> that is directly connected to a full-speed hub (TI USB2046) hub >> so the OHCI driver is the only one in use. >> >> Note, the ohci-omap3 is loaded as a module as this is how their >> user application expects to be able to shut down usb when it >> does not need it. >> >> The device tree configuration for the usb host: > > and what exactly doesn't work ? That old OHCI driver hasn't been > touched in years, it's no surprise that it stopped working :-( > > Anyway, what exactly doesn't work ? No device enumerates ? Do you > get any IRQs by plugging a new device in ? I just found this in my backlog, and thought I should follow up with the issue. It turns out that even if we're not using the EHCI unit, the 120m functional clock needs to be enabled. This may be down to an internal routing of port signals, or the USB front-end needing it. I've added a local boolean fix to enable the clock, and will post it as soon as we've had a chance to review and document. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] cdc-acm: Add support of ATOL FPrint fiscal printers
On 02/06/15 11:05, Alexey Sokolov wrote: ATOL FPrint fiscal printers require usb_clear_halt to be executed to work properly. Add quirk to fix the issue. Signed-off-by: Alexey Sokolov soko...@7pikes.com --- drivers/usb/class/cdc-acm.c | 9 + drivers/usb/class/cdc-acm.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 5c8f581..9d8a321 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1477,6 +1477,11 @@ skip_countries: goto alloc_fail8; } + if (quirks == CLEAR_HALT_CONDITIONS) { + usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, epread-bEndpointAddress)); + usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, epwrite-bEndpointAddress)); + } + Given quirks looks like a bitfield, it would be better if this is if (quirks CLEAR_HALT_CONDITIONS) { -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: AM3517 usb host issue
On 22/05/15 23:13, Ben Dooks wrote: On 22/05/15 16:50, Felipe Balbi wrote: Hi, On Fri, May 22, 2015 at 11:04:33AM +0300, Ben Dooks wrote: I am trying to get the full-speed USB host working on an custom AM3517 device with the 3.18.12 kernel. The hardware works (a 2.6.37 kernel has been used for testing). Does anyone have any experience of 3.18 (or similarly recent kernel on an AM3517 system) or have any pointers as where to start debugging? The ti-linux-3.14.y does not have any patches that aren't applied to the usb on 3.18.13. The cpu port 1 is connected by a TI TUSB1106 usb transceiver that is directly connected to a full-speed hub (TI USB2046) hub so the OHCI driver is the only one in use. Note, the ohci-omap3 is loaded as a module as this is how their user application expects to be able to shut down usb when it does not need it. The device tree configuration for the usb host: and what exactly doesn't work ? That old OHCI driver hasn't been touched in years, it's no surprise that it stopped working :-( Anyway, what exactly doesn't work ? No device enumerates ? Do you get any IRQs by plugging a new device in ? I will check the interrupts when I get back into the office. There is only one device (the hub) which isn't enumerating and is hard-wired on the board. usbhshost { status = okay; /* just in case it is started disabled */ port1-mode = ohci-phy-6pin-dpdm; }; usbhsohci { status = okay; }; usbhsehci { status = disabled; /* no ehci on board */ }; The usb from the logs is as follows. Some extra debugging has been added to verify the device-tree settings: [0.00] AM3517 ES1.1 (l2cache sgx neon) [0.869706] usbcore: registered new interface driver usbfs [0.874270] usbcore: registered new interface driver hub [0.878592] usbcore: registered new device driver usb [1.223199] usbhs_tll 48062000.usbhstll: starting TI HSUSB TLL Controller [1.273000] usbhs_omap 48064000.usbhshost: ports 0 [1.278291] usbhs_omap 48064000.usbhshost: port 0: ohci-phy-6pin-dpdm [1.284476] usbhs_omap 48064000.usbhshost: port0-mode: ohci-phy-6pin-dpdm -5 [ 1.288689] usbhs_tll 48062000.usbhstll: omap_tll_init() [1.293628] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [1.298434] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [1.302730] usbhs_tll 48062000.usbhstll: omap_tll_enable() [1.307668] usbhs_omap 48064000.usbhshost: usbhs_runtime_suspend [1.310142] stopping usb controller [1.419910] usbhs_tll 48062000.usbhstll: omap_tll_disable() [1.423547] usbhs_omap 48064000.usbhshost: 3 ports [1.429065] usbhs_omap 48064000.usbhshost: starting TI HSUSB Controller [1.433831] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [1.438625] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [1.442921] usbhs_tll 48062000.usbhstll: omap_tll_enable() [1.448548] usbhs_omap 48064000.usbhshost: omap_usbhs_rev1_hostconfig = [1.455034] usbhs_omap 48064000.usbhshost: UHH setup done, uhh_hostconfig=80d [ 1.459918] usbhs_omap 48064000.usbhshost: usbhs_runtime_suspend [1.462337] stopping usb controller [1.569905] usbhs_tll 48062000.usbhstll: omap_tll_disable() [1.575408] usbhs_omap 48064000.usbhshost: populating usb sub nodes [ 77.609168] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [ 77.613927] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [ 77.618374] usbhs_tll 48062000.usbhstll: omap_tll_enable() [ 77.802694] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001 [ 77.816003] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber1 [ 77.827391] usb usb1: Product: OHCI Host Controller [ 77.838674] usb usb1: Manufacturer: Linux 3.18.13-00203-ga3c52be-dirty ohci_d [ 77.849913] usb usb1: SerialNumber: 48064400.ohci OK, so this is roothub, what happens when a device is plugged to the other end ? Is VBUS charged ? We didn't even enumerate TUSB2046, did you look at its datasheet (http://www.ti.com/lit/ds/symlink/tusb2046b.pdf) ? What is the state of RESETn pin ? Perhaps that's tied to a GPIO and the old TI kernel toggles that ? Anything interesting from usbmon ? I've gone through the schematics and verified the hub's reset line is connected where we think it is (will try and check with a 'scope on monday that it is being taken high, the boot-loader starts it low). The root has just the one device connected, and unfortunately the hw designer decided to hard-wire the D+ pull-up to 3.3V instead of the transceiver's pull pin. Not tried usbmon yet. However if the hub is not being detected then probably won't show anything either. I am going to install devmem2 into the root image and use it to poke around and see the state of the system at run time. Thanks for looking in to this. The hub is functioning, 3.3V is up, the ~RESET line is high and the 6MHz crystal is running
AM3517 usb host issue
I am trying to get the full-speed USB host working on an custom AM3517 device with the 3.18.12 kernel. The hardware works (a 2.6.37 kernel has been used for testing). Does anyone have any experience of 3.18 (or similarly recent kernel on an AM3517 system) or have any pointers as where to start debugging? The ti-linux-3.14.y does not have any patches that aren't applied to the usb on 3.18.13. The cpu port 1 is connected by a TI TUSB1106 usb transceiver that is directly connected to a full-speed hub (TI USB2046) hub so the OHCI driver is the only one in use. Note, the ohci-omap3 is loaded as a module as this is how their user application expects to be able to shut down usb when it does not need it. The device tree configuration for the usb host: usbhshost { status = okay;/* just in case it is started disabled */ port1-mode = ohci-phy-6pin-dpdm; }; usbhsohci { status = okay; }; usbhsehci { status = disabled;/* no ehci on board */ }; The usb from the logs is as follows. Some extra debugging has been added to verify the device-tree settings: [0.00] AM3517 ES1.1 (l2cache sgx neon) [0.869706] usbcore: registered new interface driver usbfs [0.874270] usbcore: registered new interface driver hub [0.878592] usbcore: registered new device driver usb [1.223199] usbhs_tll 48062000.usbhstll: starting TI HSUSB TLL Controller [1.273000] usbhs_omap 48064000.usbhshost: ports 0 [1.278291] usbhs_omap 48064000.usbhshost: port 0: ohci-phy-6pin-dpdm [1.284476] usbhs_omap 48064000.usbhshost: port0-mode: ohci-phy-6pin-dpdm -5 [1.288689] usbhs_tll 48062000.usbhstll: omap_tll_init() [1.293628] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [1.298434] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [1.302730] usbhs_tll 48062000.usbhstll: omap_tll_enable() [1.307668] usbhs_omap 48064000.usbhshost: usbhs_runtime_suspend [1.310142] stopping usb controller [1.419910] usbhs_tll 48062000.usbhstll: omap_tll_disable() [1.423547] usbhs_omap 48064000.usbhshost: 3 ports [1.429065] usbhs_omap 48064000.usbhshost: starting TI HSUSB Controller [1.433831] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [1.438625] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [1.442921] usbhs_tll 48062000.usbhstll: omap_tll_enable() [1.448548] usbhs_omap 48064000.usbhshost: omap_usbhs_rev1_hostconfig = [1.455034] usbhs_omap 48064000.usbhshost: UHH setup done, uhh_hostconfig=80d [1.459918] usbhs_omap 48064000.usbhshost: usbhs_runtime_suspend [1.462337] stopping usb controller [1.569905] usbhs_tll 48062000.usbhstll: omap_tll_disable() [1.575408] usbhs_omap 48064000.usbhshost: populating usb sub nodes [ 77.609168] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [ 77.613927] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [ 77.618374] usbhs_tll 48062000.usbhstll: omap_tll_enable() [ 77.802694] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001 [ 77.816003] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber1 [ 77.827391] usb usb1: Product: OHCI Host Controller [ 77.838674] usb usb1: Manufacturer: Linux 3.18.13-00203-ga3c52be-dirty ohci_d [ 77.849913] usb usb1: SerialNumber: 48064400.ohci -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: AM3517 usb host issue
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 22/05/15 16:50, Felipe Balbi wrote: Hi, On Fri, May 22, 2015 at 11:04:33AM +0300, Ben Dooks wrote: I am trying to get the full-speed USB host working on an custom AM3517 device with the 3.18.12 kernel. The hardware works (a 2.6.37 kernel has been used for testing). Does anyone have any experience of 3.18 (or similarly recent kernel on an AM3517 system) or have any pointers as where to start debugging? The ti-linux-3.14.y does not have any patches that aren't applied to the usb on 3.18.13. The cpu port 1 is connected by a TI TUSB1106 usb transceiver that is directly connected to a full-speed hub (TI USB2046) hub so the OHCI driver is the only one in use. Note, the ohci-omap3 is loaded as a module as this is how their user application expects to be able to shut down usb when it does not need it. The device tree configuration for the usb host: and what exactly doesn't work ? That old OHCI driver hasn't been touched in years, it's no surprise that it stopped working :-( Anyway, what exactly doesn't work ? No device enumerates ? Do you get any IRQs by plugging a new device in ? I will check the interrupts when I get back into the office. There is only one device (the hub) which isn't enumerating and is hard-wired on the board. usbhshost { status = okay; /* just in case it is started disabled */ port1-mode = ohci-phy-6pin-dpdm; }; usbhsohci { status = okay; }; usbhsehci { status = disabled; /* no ehci on board */ }; The usb from the logs is as follows. Some extra debugging has been added to verify the device-tree settings: [0.00] AM3517 ES1.1 (l2cache sgx neon) [0.869706] usbcore: registered new interface driver usbfs [0.874270] usbcore: registered new interface driver hub [0.878592] usbcore: registered new device driver usb [1.223199] usbhs_tll 48062000.usbhstll: starting TI HSUSB TLL Controller [1.273000] usbhs_omap 48064000.usbhshost: ports 0 [1.278291] usbhs_omap 48064000.usbhshost: port 0: ohci-phy-6pin-dpdm [1.284476] usbhs_omap 48064000.usbhshost: port0-mode: ohci-phy-6pin-dpdm -5 [ 1.288689] usbhs_tll 48062000.usbhstll: omap_tll_init() [1.293628] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [1.298434] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [1.302730] usbhs_tll 48062000.usbhstll: omap_tll_enable() [1.307668] usbhs_omap 48064000.usbhshost: usbhs_runtime_suspend [1.310142] stopping usb controller [1.419910] usbhs_tll 48062000.usbhstll: omap_tll_disable() [1.423547] usbhs_omap 48064000.usbhshost: 3 ports [1.429065] usbhs_omap 48064000.usbhshost: starting TI HSUSB Controller [1.433831] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [1.438625] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [1.442921] usbhs_tll 48062000.usbhstll: omap_tll_enable() [1.448548] usbhs_omap 48064000.usbhshost: omap_usbhs_rev1_hostconfig = [1.455034] usbhs_omap 48064000.usbhshost: UHH setup done, uhh_hostconfig=80d [ 1.459918] usbhs_omap 48064000.usbhshost: usbhs_runtime_suspend [1.462337] stopping usb controller [1.569905] usbhs_tll 48062000.usbhstll: omap_tll_disable() [1.575408] usbhs_omap 48064000.usbhshost: populating usb sub nodes [ 77.609168] usbhs_omap 48064000.usbhshost: usbhs_runtime_resume [ 77.613927] usbhs_omap 48064000.usbhshost: sysconfig 0x1009 [ 77.618374] usbhs_tll 48062000.usbhstll: omap_tll_enable() [ 77.802694] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001 [ 77.816003] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber1 [ 77.827391] usb usb1: Product: OHCI Host Controller [ 77.838674] usb usb1: Manufacturer: Linux 3.18.13-00203-ga3c52be-dirty ohci_d [ 77.849913] usb usb1: SerialNumber: 48064400.ohci OK, so this is roothub, what happens when a device is plugged to the other end ? Is VBUS charged ? We didn't even enumerate TUSB2046, did you look at its datasheet (http://www.ti.com/lit/ds/symlink/tusb2046b.pdf) ? What is the state of RESETn pin ? Perhaps that's tied to a GPIO and the old TI kernel toggles that ? Anything interesting from usbmon ? I've gone through the schematics and verified the hub's reset line is connected where we think it is (will try and check with a 'scope on monday that it is being taken high, the boot-loader starts it low). The root has just the one device connected, and unfortunately the hw designer decided to hard-wire the D+ pull-up to 3.3V instead of the transceiver's pull pin. Not tried usbmon yet. However if the hub is not being detected then probably won't show anything either. I am going to install devmem2 into the root image and use it to poke around and see the state of the system at run time. Thanks for looking in to this. - -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer
Re: [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 /* Register access macros */ -#ifdef CONFIG_AVR32 -#define usba_io_readl __raw_readl -#define usba_io_writel __raw_writel -#define usba_io_writew __raw_writew -#else -#define usba_io_readl readl_relaxed -#define usba_io_writel writel_relaxed -#define usba_io_writew writew_relaxed -#endif +#define usba_io_readl atmel_oc_readl +#define usba_io_writel atmel_oc_writel +#define usba_io_writew atmel_oc_writew Same comment as earlier patch, it would be nice to remove the define usba_io_{read,write}{l,w} defines in a follow-up patch. I'm fine with this too. Is this targetted at v4.2 ? Yes, although we may move it to the soc specific include directories to avoid adding more to linux/ I will be sorting this out next week. - -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQEcBAEBCAAGBQJVP6neAAoJEMuhVOkVU3uz6tQH/jmZ0MszsoDjiKWdTnG+etoy WUhAEdnmaqPEfJSaBy2OPCcmj9T1O07wg1L/2rHQHBrVuR9bW0gWY/TyJQahnn3A YG81fgfIvOTAwmxIkaF10mG1/haG1LgPQ4P6j7AaKz09Zowath0rsga17AhYuUyh bps4Go7yHF/OpjuwB9VxSttMAbVAIHqXbuc5kufN89JAxDT6x5tV/BrqkqEoHpSV kW7VvGb/V4Aeax1h9klfdUEBlL2czkVuYYtTnicc9lFN3T9+6XJ+SNwKLtSklEr3 SLM78DoIQQoKYWCf8vsg0FR0E9LeR1ytgZXPfOpdAoId+iZt39tBk9bMi/XOiBo= =ceej -END PGP SIGNATURE- -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 28/04/15 17:30, Felipe Balbi wrote: Hi, On Tue, Apr 28, 2015 at 04:40:14PM +0100, Ben Dooks wrote: /* Register access macros */ -#ifdef CONFIG_AVR32 -#define usba_io_readl __raw_readl -#define usba_io_writel __raw_writel -#define usba_io_writew __raw_writew -#else -#define usba_io_readlreadl_relaxed -#define usba_io_writel writel_relaxed -#define usba_io_writew writew_relaxed -#endif +#define usba_io_readl atmel_oc_readl +#define usba_io_writel atmel_oc_writel +#define usba_io_writew atmel_oc_writew Same comment as earlier patch, it would be nice to remove the define usba_io_{read,write}{l,w} defines in a follow-up patch. I'm fine with this too. Is this targetted at v4.2 ? Yes, although we may move it to the soc specific include directories to avoid adding more to linux/ I will be sorting this out next week. I would rather not see drivers including anything from asm or mach-* (unless strictly necessary), otherwise it's a pain to build-test anything Thanks. I think the soc/ include is available for all. I will check this tomorrow. - -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQEcBAEBCAAGBQJVP7aBAAoJEMuhVOkVU3uzId4H/3ZsZ4Vogng63I04OpLtt5Qs VopvttCvaLczye/wOWQKptXJuKIBmrs66BcV4ZsVi1SZjfbju9X1blzc0+6fxU9X xE2rw3kDPZmtKm6v1GCRrE/uzhKeKgAnfp7Yf7pkdn98Lx2D9gy/s7GRN6Bkql28 pz/QIqr/H6Hp2frbubakKx/F7SFV88ZUNZXLkw8+vkn7gKGRX7ODcPFldjbjooIa zyDdrZWiqhTHdWzQ813vNgKJfP1GiYNZuht+EhAh0ngLy0YnqnSXF0eZiOy/uF0Z cCMlXZo1Q/2LkqVKEgywJDxGhCruT3RpPDWLk6eA9trlHF62j3WSn65nDxKtBwA= =cqtq -END PGP SIGNATURE- -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 5/6] usb: gadget: atmel_usba: use atmel_io.h to provide on-chip IO
Use linux/atmel_io.h to provide IO accessors which work on both AVR32 and ARM for on-chip peripherals. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk -- CC: Nicolas Ferre nicolas.fe...@atmel.com CC: Felipe Balbi ba...@ti.com CC: Greg Kroah-Hartman gre...@linuxfoundation.org CC: linux-usb@vger.kernel.org --- drivers/usb/gadget/udc/atmel_usba_udc.c | 1 + drivers/usb/gadget/udc/atmel_usba_udc.h | 12 +++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index be2f503..6735585 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -13,6 +13,7 @@ #include linux/init.h #include linux/interrupt.h #include linux/io.h +#include linux/atmel_io.h #include linux/slab.h #include linux/device.h #include linux/dma-mapping.h diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index 92bd486..3d40aa3 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -191,15 +191,9 @@ | USBA_BF(name, value)) /* Register access macros */ -#ifdef CONFIG_AVR32 -#define usba_io_readl __raw_readl -#define usba_io_writel __raw_writel -#define usba_io_writew __raw_writew -#else -#define usba_io_readl readl_relaxed -#define usba_io_writel writel_relaxed -#define usba_io_writew writew_relaxed -#endif +#define usba_io_readl atmel_oc_readl +#define usba_io_writel atmel_oc_writel +#define usba_io_writew atmel_oc_writew #define usba_readl(udc, reg) \ usba_io_readl((udc)-regs + USBA_##reg) -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
r8a66597-udc: use devm functions
Change r8a66597-udc to use devm functions and cleanup the result. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/8] r8a66597-udc: use devm_kzalloc() to allocate driver state
Update driver to use devm_kzalloc() to make tracking of resources easier. Also remove the exit point via cleanup as there's no cleanup necessary from this point now. As a note, also removes the error print as the allocation calls produce errors if they do not return memory. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- drivers/usb/gadget/r8a66597-udc.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 1721e44..48a9e0b 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1836,7 +1836,6 @@ static int __exit r8a66597_remove(struct platform_device *pdev) clk_put(r8a66597-clk); } - kfree(r8a66597); return 0; } @@ -1892,12 +1891,9 @@ static int __init r8a66597_probe(struct platform_device *pdev) } /* initialize ucd */ - r8a66597 = kzalloc(sizeof(struct r8a66597), GFP_KERNEL); - if (r8a66597 == NULL) { - ret = -ENOMEM; - dev_err(dev, kzalloc error\n); - goto clean_up; - } + r8a66597 = devm_kzalloc(dev, sizeof(struct r8a66597), GFP_KERNEL); + if (r8a66597 == NULL) + return -ENOMEM; spin_lock_init(r8a66597-lock); platform_set_drvdata(pdev, r8a66597); @@ -1996,7 +1992,6 @@ clean_up: if (r8a66597-ep0_req) r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); - kfree(r8a66597); } return ret; -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/8] r8a66597-udc: cleanup error path
With the updates for devm, the cleanup path no longer needs to check for NULL device state, so remove it and return directly if the irq resource missing Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- drivers/usb/gadget/r8a66597-udc.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 2662853..9ebe2c0 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1878,9 +1878,8 @@ static int __init r8a66597_probe(struct platform_device *pdev) irq_trigger = ires-flags IRQF_TRIGGER_MASK; if (irq 0) { - ret = -ENODEV; dev_err(dev, platform_get_irq error.\n); - goto clean_up; + return -ENODEV; } /* initialize ucd */ @@ -1979,11 +1978,8 @@ clean_up2: clk_put(r8a66597-clk); } clean_up: - if (r8a66597) { - if (r8a66597-ep0_req) - r8a66597_free_request(r8a66597-ep[0].ep, - r8a66597-ep0_req); - } + if (r8a66597-ep0_req) + r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); return ret; } -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/8] r8a66597-udc: handle sudmac registers with devm_ioremap_resource()
Change the sudmac register handling in the devm_ioremap_resource to use the devm variant. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- drivers/usb/gadget/r8a66597-udc.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 48a9e0b..2662853 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1826,8 +1826,6 @@ static int __exit r8a66597_remove(struct platform_device *pdev) usb_del_gadget_udc(r8a66597-gadget); del_timer_sync(r8a66597-timer); - if (r8a66597-pdata-sudmac) - iounmap(r8a66597-sudmac_reg); free_irq(platform_get_irq(pdev, 0), r8a66597); r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); @@ -1849,15 +1847,10 @@ static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597, struct resource *res; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, sudmac); - if (!res) { - dev_err(pdev-dev, platform_get_resource error(sudmac).\n); - return -ENODEV; - } - - r8a66597-sudmac_reg = ioremap(res-start, resource_size(res)); - if (r8a66597-sudmac_reg == NULL) { + r8a66597-sudmac_reg = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(r8a66597-sudmac_reg)) { dev_err(pdev-dev, ioremap error(sudmac).\n); - return -ENOMEM; + return PTR_ERR(r8a66597-sudmac_reg); } return 0; @@ -1987,8 +1980,6 @@ clean_up2: } clean_up: if (r8a66597) { - if (r8a66597-sudmac_reg) - iounmap(r8a66597-sudmac_reg); if (r8a66597-ep0_req) r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/8] r8a66597-udc: use devm_request_irq() to get device irq
Use the devm_request_irq() call to get the interrupt for the device and have it automatically free on exit. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- drivers/usb/gadget/r8a66597-udc.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 51eaedd..8414ba5 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1826,7 +1826,6 @@ static int __exit r8a66597_remove(struct platform_device *pdev) usb_del_gadget_udc(r8a66597-gadget); del_timer_sync(r8a66597-timer); - free_irq(platform_get_irq(pdev, 0), r8a66597); r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); if (r8a66597-pdata-on_chip) { @@ -1918,8 +1917,8 @@ static int __init r8a66597_probe(struct platform_device *pdev) disable_controller(r8a66597); /* make sure controller is disabled */ - ret = request_irq(irq, r8a66597_irq, IRQF_SHARED, - udc_name, r8a66597); + ret = devm_request_irq(dev, irq, r8a66597_irq, IRQF_SHARED, + udc_name, r8a66597); if (ret 0) { dev_err(dev, request_irq error (%d)\n, ret); goto clean_up2; @@ -1969,7 +1968,6 @@ static int __init r8a66597_probe(struct platform_device *pdev) err_add_udc: r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); clean_up3: - free_irq(irq, r8a66597); clean_up2: if (r8a66597-pdata-on_chip) clk_disable_unprepare(r8a66597-clk); -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/8] r8a66597-udc: remove now unused clean_up and clean_up3 label.
With the devm additions, the clean_up and clean_up3 are now not needed or used. Change clean_up3 and make everything use clean_up2 and just remove clean_up. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- drivers/usb/gadget/r8a66597-udc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 8414ba5..6ad6028 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1954,7 +1954,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) GFP_KERNEL); if (r8a66597-ep0_req == NULL) { ret = -ENOMEM; - goto clean_up3; + goto clean_up2; } r8a66597-ep0_req-complete = nop_completion; @@ -1967,11 +1967,10 @@ static int __init r8a66597_probe(struct platform_device *pdev) err_add_udc: r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); -clean_up3: clean_up2: if (r8a66597-pdata-on_chip) clk_disable_unprepare(r8a66597-clk); -clean_up: + if (r8a66597-ep0_req) r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/8] r8a66597-udc: use devm_clk_get() to get clock
Change to using the devm_clk_get() to get the clock and have it automatically freed on exit. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- drivers/usb/gadget/r8a66597-udc.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 9ebe2c0..51eaedd 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1831,7 +1831,6 @@ static int __exit r8a66597_remove(struct platform_device *pdev) if (r8a66597-pdata-on_chip) { clk_disable_unprepare(r8a66597-clk); - clk_put(r8a66597-clk); } return 0; @@ -1903,11 +1902,10 @@ static int __init r8a66597_probe(struct platform_device *pdev) if (r8a66597-pdata-on_chip) { snprintf(clk_name, sizeof(clk_name), usb%d, pdev-id); - r8a66597-clk = clk_get(dev, clk_name); + r8a66597-clk = devm_clk_get(dev, clk_name); if (IS_ERR(r8a66597-clk)) { dev_err(dev, cannot get clock \%s\\n, clk_name); - ret = PTR_ERR(r8a66597-clk); - goto clean_up; + return PTR_ERR(r8a66597-clk); } clk_prepare_enable(r8a66597-clk); } @@ -1973,10 +1971,8 @@ err_add_udc: clean_up3: free_irq(irq, r8a66597); clean_up2: - if (r8a66597-pdata-on_chip) { + if (r8a66597-pdata-on_chip) clk_disable_unprepare(r8a66597-clk); - clk_put(r8a66597-clk); - } clean_up: if (r8a66597-ep0_req) r8a66597_free_request(r8a66597-ep[0].ep, r8a66597-ep0_req); -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/8] r8a66597-udc: keep dev as reference to pdev-dev
Remove usages of pdev-dev in the driver probe function with just dev to make the references to it easier to write. Convert all the current users of it to use it. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- drivers/usb/gadget/r8a66597-udc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 7f3af74..1721e44 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1866,6 +1866,7 @@ static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597, static int __init r8a66597_probe(struct platform_device *pdev) { + struct device *dev = pdev-dev; char clk_name[8]; struct resource *res, *ires; int irq; @@ -1886,7 +1887,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) if (irq 0) { ret = -ENODEV; - dev_err(pdev-dev, platform_get_irq error.\n); + dev_err(dev, platform_get_irq error.\n); goto clean_up; } @@ -1894,13 +1895,13 @@ static int __init r8a66597_probe(struct platform_device *pdev) r8a66597 = kzalloc(sizeof(struct r8a66597), GFP_KERNEL); if (r8a66597 == NULL) { ret = -ENOMEM; - dev_err(pdev-dev, kzalloc error\n); + dev_err(dev, kzalloc error\n); goto clean_up; } spin_lock_init(r8a66597-lock); platform_set_drvdata(pdev, r8a66597); - r8a66597-pdata = dev_get_platdata(pdev-dev); + r8a66597-pdata = dev_get_platdata(dev); r8a66597-irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; r8a66597-gadget.ops = r8a66597_gadget_ops; @@ -1914,10 +1915,9 @@ static int __init r8a66597_probe(struct platform_device *pdev) if (r8a66597-pdata-on_chip) { snprintf(clk_name, sizeof(clk_name), usb%d, pdev-id); - r8a66597-clk = clk_get(pdev-dev, clk_name); + r8a66597-clk = clk_get(dev, clk_name); if (IS_ERR(r8a66597-clk)) { - dev_err(pdev-dev, cannot get clock \%s\\n, - clk_name); + dev_err(dev, cannot get clock \%s\\n, clk_name); ret = PTR_ERR(r8a66597-clk); goto clean_up; } @@ -1935,7 +1935,7 @@ static int __init r8a66597_probe(struct platform_device *pdev) ret = request_irq(irq, r8a66597_irq, IRQF_SHARED, udc_name, r8a66597); if (ret 0) { - dev_err(pdev-dev, request_irq error (%d)\n, ret); + dev_err(dev, request_irq error (%d)\n, ret); goto clean_up2; } @@ -1973,11 +1973,11 @@ static int __init r8a66597_probe(struct platform_device *pdev) } r8a66597-ep0_req-complete = nop_completion; - ret = usb_add_gadget_udc(pdev-dev, r8a66597-gadget); + ret = usb_add_gadget_udc(dev, r8a66597-gadget); if (ret) goto err_add_udc; - dev_info(pdev-dev, version %s\n, DRIVER_VERSION); + dev_info(dev, version %s\n, DRIVER_VERSION); return 0; err_add_udc: -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/8] r8a66597-udc: use devm_request_and_ioremap() for registers
--- drivers/usb/gadget/r8a66597-udc.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index aff0a67..7f3af74 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c @@ -1826,7 +1826,6 @@ static int __exit r8a66597_remove(struct platform_device *pdev) usb_del_gadget_udc(r8a66597-gadget); del_timer_sync(r8a66597-timer); - iounmap(r8a66597-reg); if (r8a66597-pdata-sudmac) iounmap(r8a66597-sudmac_reg); free_irq(platform_get_irq(pdev, 0), r8a66597); @@ -1877,11 +1876,9 @@ static int __init r8a66597_probe(struct platform_device *pdev) unsigned long irq_trigger; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - ret = -ENODEV; - dev_err(pdev-dev, platform_get_resource error.\n); - goto clean_up; - } + reg = devm_ioremap_resource(pdev-dev, res); + if (!reg) + return -ENODEV; ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq = ires-start; @@ -1893,13 +1890,6 @@ static int __init r8a66597_probe(struct platform_device *pdev) goto clean_up; } - reg = ioremap(res-start, resource_size(res)); - if (reg == NULL) { - ret = -ENOMEM; - dev_err(pdev-dev, ioremap error.\n); - goto clean_up; - } - /* initialize ucd */ r8a66597 = kzalloc(sizeof(struct r8a66597), GFP_KERNEL); if (r8a66597 == NULL) { @@ -2008,8 +1998,6 @@ clean_up: r8a66597-ep0_req); kfree(r8a66597); } - if (reg) - iounmap(reg); return ret; } -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 1/1] usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers
On 13/06/14 15:25, Felipe Balbi wrote: Hi, + +#define FIRMWARE_NAME r8a779x_usb3_v1.dlmem +MODULE_FIRMWARE(FIRMWARE_NAME); Where can we get this from, it would be nice to test this. +/*** Register Offset ***/ +#define RCAR_USB3_INT_ENA0x224 /* Interrupt Enable */ +#define RCAR_USB3_DL_CTRL 0x250 /* FW Download Control Status */ +#define RCAR_USB3_FW_DATA0 0x258 /* FW Data0 */ + +#define RCAR_USB3_LCLK 0xa44 /* LCLK Select */ +#define RCAR_USB3_CONF10xa48 /* USB3.0 Configuration1 */ +#define RCAR_USB3_CONF2 0xa5c /* USB3.0 Configuration2 */ +#define RCAR_USB3_CONF3 0xaa8 /* USB3.0 Configuration3 */ +#define RCAR_USB3_RX_POL0xab0 /* USB3.0 RX Polarity */ +#define RCAR_USB3_TX_POL0xab8 /* USB3.0 TX Polarity */ + +/*** Register Settings ***/ +/* Interrupt Enable */ +#define RCAR_USB3_INT_XHC_ENA0x0001 +#define RCAR_USB3_INT_PME_ENA 0x0002 +#define RCAR_USB3_INT_HSE_ENA0x0004 +#define RCAR_USB3_INT_ENA_VAL(RCAR_USB3_INT_XHC_ENA | \ + RCAR_USB3_INT_PME_ENA | RCAR_USB3_INT_HSE_ENA) + +/* FW Download Control Status */ +#define RCAR_USB3_DL_CTRL_ENABLE0x0001 +#define RCAR_USB3_DL_CTRL_FW_SUCCESS 0x0010 +#define RCAR_USB3_DL_CTRL_FW_SET_DATA0 0x0100 + +/* LCLK Select */ +#define RCAR_USB3_LCLK_ENA_VAL 0x01030001 + +/* USB3.0 Configuration */ +#define RCAR_USB3_CONF1_VAL0x00030204 +#define RCAR_USB3_CONF2_VAL 0x00030300 +#define RCAR_USB3_CONF3_VAL 0x13802007 + +/* USB3.0 Polarity */ +#define RCAR_USB3_RX_POL_VAL BIT(21) +#define RCAR_USB3_TX_POL_VAL BIT(4) + +void xhci_rcar_start(struct usb_hcd *hcd) +{ +u32 temp; + + if (hcd-regs != NULL) { + /* Interrupt Enable */ + temp = readl(hcd-regs + RCAR_USB3_INT_ENA); + temp |= RCAR_USB3_INT_ENA_VAL; + writel(temp, hcd-regs + RCAR_USB3_INT_ENA); +/* LCLK Select */ + writel(RCAR_USB3_LCLK_ENA_VAL, hcd-regs + RCAR_USB3_LCLK); + /* USB3.0 Configuration */ + writel(RCAR_USB3_CONF1_VAL, hcd-regs + RCAR_USB3_CONF1); + writel(RCAR_USB3_CONF2_VAL, hcd-regs + RCAR_USB3_CONF2); + writel(RCAR_USB3_CONF3_VAL, hcd-regs + RCAR_USB3_CONF3); + /* USB3.0 Polarity */ + writel(RCAR_USB3_RX_POL_VAL, hcd-regs + RCAR_USB3_RX_POL); + writel(RCAR_USB3_TX_POL_VAL, hcd-regs + RCAR_USB3_TX_POL); +} +} + +static int xhci_rcar_download_firmware(struct device *dev, void __iomem *regs) +{ + const struct firmware *fw; +int retval, index, j, time; +int timeout = 1; + u32 data, val, temp; + + /* request R-Car USB3.0 firmware */ + retval = request_firmware(fw, FIRMWARE_NAME, dev); + if (retval) + return retval; + + /* download R-Car USB3.0 firmware */ + temp = readl(regs + RCAR_USB3_DL_CTRL); + temp |= RCAR_USB3_DL_CTRL_ENABLE; + writel(temp, regs + RCAR_USB3_DL_CTRL); + + for (index = 0; index fw-size; index += 4) { +/* to avoid reading beyond the end of the buffer */ + for (data = 0, j = 3; j = 0; j--) { + if ((j + index) fw-size) + data |= fw-data[index + j] (8 * j); + } + writel(data, regs + RCAR_USB3_FW_DATA0); + temp = readl(regs + RCAR_USB3_DL_CTRL); +temp |= RCAR_USB3_DL_CTRL_FW_SET_DATA0; + writel(temp, regs + RCAR_USB3_DL_CTRL); + + for (time = 0; time timeout; time++) { + val = readl(regs + RCAR_USB3_DL_CTRL); + if ((val RCAR_USB3_DL_CTRL_FW_SET_DATA0) == 0) + break; + udelay(1); + } + if (time == timeout) { + retval = -ETIMEDOUT; +break; +} + } + + temp = readl(regs + RCAR_USB3_DL_CTRL); +temp = ~RCAR_USB3_DL_CTRL_ENABLE; + writel(temp, regs + RCAR_USB3_DL_CTRL); + + for (time = 0; time timeout; time++) { + val = readl(regs + RCAR_USB3_DL_CTRL); + if (val RCAR_USB3_DL_CTRL_FW_SUCCESS) { + retval = 0; + break; + } + udelay(1); +} + if (time == timeout) + retval = -ETIMEDOUT; + + release_firmware(fw); + + return retval; +} + +/* This function needs to initialize a phy of usb before */ initializing a PHY looks like something that the PHY layer should do. Why don't you write a PHY driver and teach xhci-core about PHYs ? Then, more people would benefit. The rcar phy code should already do this, so I agree. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http
Re: [PATCH 1/2] usb: rename 'phy' field of 'struct usb_hcd' to 'transceiver'
On 10/04/14 11:49, Sergei Shtylyov wrote: On 10-04-2014 13:20, David Laight wrote: It doesn't do any pin muxing. It switches SoC internal USB signals between USB controllers. The pins remain the same. Doesn't something like that already happen for the companion USB1 controllers for USB2 ports? Did you mean USB 1.1 and USB 2.0 controllers by USB1 and USB2? That also doesn't sound like you are changing the PHY. I am changing one of the PHY registers that controls USB port (Renesas calls it channel) multiplexing. I'd have thought that would happen if you had a single controller that select between multiply PHY. No, it's not the case. There is an interesting case, the USB3 shares a PHY with a SATA and the PCIE and SATA also share a PHY on the R8A7790. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] usb: rename 'phy' field of 'struct usb_hcd' to 'transceiver'
On 10/04/14 12:14, David Laight wrote: From: Ben Dooks On 10/04/14 11:49, Sergei Shtylyov wrote: On 10-04-2014 13:20, David Laight wrote: It doesn't do any pin muxing. It switches SoC internal USB signals between USB controllers. The pins remain the same. Doesn't something like that already happen for the companion USB1 controllers for USB2 ports? Did you mean USB 1.1 and USB 2.0 controllers by USB1 and USB2? Yes. Why do you care which USB controller is driving the pins? That also doesn't sound like you are changing the PHY. I am changing one of the PHY registers that controls USB port (Renesas calls it channel) multiplexing. I'd have thought that would happen if you had a single controller that select between multiply PHY. No, it's not the case. I realised that wasn't what you were doing, but at first it did seem to be what you were doing. There is an interesting case, the USB3 shares a PHY with a SATA and the PCIE and SATA also share a PHY on the R8A7790. Some of those look like pcb design decisions - so there is no dynamic changing, just config time plumbing. OTOH we are carrying PCIe using two SATA cables (the second carries the clock) so I suspect some SoC system pcbs may be able to support SATA or PCIe on the same connector). Yes, which means we will probably want to support the case where the USB3 is routed out of the PCIe lanes. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/9] pci-rcar-gen2: add devicetree support
On 04/04/14 18:09, Bjorn Helgaas wrote: On Thu, Mar 06, 2014 at 06:01:19PM +, Ben Dooks wrote: Add OF match table for pci-rcar-gen2 driver for device tree support. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk I'm not sure what the status of this is. I saw comments about a missing #include, but I didn't see a fixed repost. Ben, could you please repost anything you have outstanding for me? Sergei was going to re-post this series. I can have a look at re-sending this later today if he hasn't already sorted it out. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/9] pci-rcar-gen2: add devicetree support
On 30/03/14 20:10, Sergei Shtylyov wrote: Hello. On 03/06/2014 09:21 PM, Ben Dooks wrote: Add OF match table for pci-rcar-gen2 driver for device tree support. [...] diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index fd3e3ab..1216784 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -16,6 +16,7 @@ #include linux/kernel.h #include linux/module.h #include linux/pci.h +#include linux/of_pci.h #include linux/platform_device.h #include linux/pm_runtime.h #include linux/sizes.h Apologies all, there's a missing include of linux/of.h which should have been added here Have you ever re-posted this patch fixed? If not, it's not going to be merged for 3.15 I guess... I thought I did. I can have a look a reposting it. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/9] pci-rcar-gen2: add devicetree support
On 30/03/14 20:26, Sergei Shtylyov wrote: Hello. On 03/30/2014 11:21 PM, Ben Dooks wrote: Add OF match table for pci-rcar-gen2 driver for device tree support. [...] diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index fd3e3ab..1216784 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -16,6 +16,7 @@ #include linux/kernel.h #include linux/module.h #include linux/pci.h +#include linux/of_pci.h #include linux/platform_device.h #include linux/pm_runtime.h #include linux/sizes.h Apologies all, there's a missing include of linux/of.h which should have been added here Have you ever re-posted this patch fixed? If not, it's not going to be merged for 3.15 I guess... I thought I did. I don't see such repost in 'linux-sh'. I can have a look a reposting it. It doesn't apply to the current renesas.git devel branch. What tree it was against? From my records it was against the -rc3 release of Horms' development tree. I know Simon's tree has been closed for the board bits, but I could re-send the rcar-pci code. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 9/9] ARM: shmobile: lager.dts: link usb-phy to pci nodes
On 30/03/14 20:29, Sergei Shtylyov wrote: Hello. On 03/06/2014 09:01 PM, Ben Dooks wrote: Add the necessary links to add the USB phy nodes to the PCI devices that are behind the bridges specified. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- arch/arm/boot/dts/r8a7790-lager.dts | 37 + 1 file changed, 37 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts index 63d58d6..62f486e 100644 --- a/arch/arm/boot/dts/r8a7790-lager.dts +++ b/arch/arm/boot/dts/r8a7790-lager.dts @@ -233,18 +233,55 @@ pci0 { pinctrl-0 = usb0_pins; pinctrl-names = default; +device_type = pci; + +pci@0,1 { +reg = 0x800 0 0 0 0; +device_type = pci; +usb-phy = usbphy; +}; + +pci@0,2 { +reg = 0x1000 0 0 0 0; +device_type = pci; +usb-phy = usbphy; +}; }; pci1 { status = okay; pinctrl-0 = usb1_pins; pinctrl-names = default; + +pci@0,1 { +reg = 0x800 0 0 0 0; +device_type = pci; +usb-phy = usbphy; +}; + +pci@0,2 { +reg = 0x1000 0 0 0 0; +device_type = pci; +usb-phy = usbphy; +}; }; pci2 { status = okay; pinctrl-0 = usb2_pins; pinctrl-names = default; + +pci@0,1 { +reg = 0x800 0 0 0 0; +device_type = pci; +usb-phy = usbphy; +}; + +pci@0,2 { +reg = 0x1000 0 0 0 0; +device_type = pci; +usb-phy = usbphy; +}; }; I don't see why the internal PCI devices are added to the board file, not the SoC file. Thanks, I think they probably do belong in the .dtsi file. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9] ARM: shmobile: lager.dts: add usbphy reference
On 30/03/14 20:28, Sergei Shtylyov wrote: Hello. On 03/06/2014 09:01 PM, Ben Dooks wrote: Enable the usbphy node so that the phy driver is available. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Cc: linux...@vger.kernel.org Cc: devicet...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au --- arch/arm/boot/dts/r8a7790-lager.dts | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts index fd6851f..63d58d6 100644 --- a/arch/arm/boot/dts/r8a7790-lager.dts +++ b/arch/arm/boot/dts/r8a7790-lager.dts @@ -246,3 +246,7 @@ pinctrl-0 = usb2_pins; pinctrl-names = default; }; + +usbphy { +status = okay; +}; I don't see why we need this patch. Why not make USB PHY always enabled? I have a current setup where we do not want the kernel to try and probe the phy device. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Renesas RCar device-tree USB series
On 07/03/14 05:36, Magnus Damm wrote: Hi Ben, On Fri, Mar 7, 2014 at 3:01 AM, Ben Dooks ben.do...@codethink.co.uk wrote: This is a new series covering enabling the RCar series of SoCs USB with device-tree based booting. It has been tested on the R8A7790 Lager board. Improvements from the previous series include: - mapping usb to the relevant phy by dt - better use of existing pci of functions Note, there is still an issue with the second gigabyte of memory on the Lager, which with current kernels causes the system to abort on startup. This series will only work if the top memory area is disabled. Thanks for these patches. I think they start looking really good. In my mind there are two outstanding issues: 1) Is the USB core code change acceptable or not? The patch [PATCH 4/9] usb: phy: check for of_node when getting phy looks quite fine to me, but I wonder if the USB maintainers will accept it as-is or require some rework. I would say that the rest of this series depends on that USB core change. I'm not sure, but without it we need to hack the PHY driver to turn on the PHY at start time. 2) Per-port USB PHY driver configuration via DT Right now each USB host controller points to the same PHY device. Thanks for working on describing the topology! As you know, the PHY driver itself handles several USB ports, and I'd like to use DT to represent the mapping between which PHY port that maps to what USB Host controller to allow proper run time configuration. Right now in this version of the series there is no such mapping. Of course, that depends on proper USB PHY DT bindings... Hmm, given the shared phy is shared and referenced counted then I don't /think/ there is much more to be done for this. If we add more PHYs then I would assume that each one of them would -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Renesas RCar device-tree USB series
On 07/03/14 17:30, Sergei Shtylyov wrote: Hello. On 03/07/2014 05:30 PM, Ben Dooks wrote: This is a new series covering enabling the RCar series of SoCs USB with device-tree based booting. It has been tested on the R8A7790 Lager board. Improvements from the previous series include: - mapping usb to the relevant phy by dt - better use of existing pci of functions Note, there is still an issue with the second gigabyte of memory on the Lager, which with current kernels causes the system to abort on startup. This series will only work if the top memory area is disabled. Thanks for these patches. I think they start looking really good. In my mind there are two outstanding issues: [...] 2) Per-port USB PHY driver configuration via DT Right now each USB host controller points to the same PHY device. Thanks for working on describing the topology! As you know, the PHY driver itself handles several USB ports, and I'd like to use DT to represent the mapping between which PHY port that maps to what USB Host controller to allow proper run time configuration. Right now in this version of the series there is no such mapping. Of course, that depends on proper USB PHY DT bindings... Hmm, given the shared phy is shared and referenced counted then I don't /think/ there is much more to be done for this. If we add more PHYs then I would assume that each one of them would It seems you didn't finish the sentence... I deleted the last bit by accident. have their own phy driver instance WBR, Sergei -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Renesas RCar device-tree USB series
This is a new series covering enabling the RCar series of SoCs USB with device-tree based booting. It has been tested on the R8A7790 Lager board. Improvements from the previous series include: - mapping usb to the relevant phy by dt - better use of existing pci of functions Note, there is still an issue with the second gigabyte of memory on the Lager, which with current kernels causes the system to abort on startup. This series will only work if the top memory area is disabled. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/9] ARM: shmobile: lager.dts: add pci 0/1/2
Enable pci1 and pci2 nodes for USB controllers attached to the AHBPCI bridge devices. Node pci0 is added for the moment, but not enabled as it could be switched to usb-gadget mode later. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Cc: linux...@vger.kernel.org Cc: devicet...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au --- arch/arm/boot/dts/r8a7790-lager.dts | 32 1 file changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts index 26a9010..fd6851f 100644 --- a/arch/arm/boot/dts/r8a7790-lager.dts +++ b/arch/arm/boot/dts/r8a7790-lager.dts @@ -148,6 +148,21 @@ renesas,groups = qspi_ctrl, qspi_data4; renesas,function = qspi; }; + + usb0_pins: usb0 { + renesas,groups = usb0; + renesas,function = usb0; + }; + + usb1_pins: usb1 { + renesas,groups = usb1; + renesas,function = usb1; + }; + + usb2_pins: usb2 { + renesas,groups = usb2; + renesas,function = usb2; + }; }; mmcif1 { @@ -214,3 +229,20 @@ cd-gpios = gpio3 22 GPIO_ACTIVE_LOW; status = okay; }; + +pci0 { + pinctrl-0 = usb0_pins; + pinctrl-names = default; +}; + +pci1 { + status = okay; + pinctrl-0 = usb1_pins; + pinctrl-names = default; +}; + +pci2 { + status = okay; + pinctrl-0 = usb2_pins; + pinctrl-names = default; +}; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/9] phy-rcar-usb-gen2: add device tree support
Add support for the phy-rcar-gen2-usb driver to be probed from device tree. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Fixes from v2: - fix missed of_match_ptr() - fix names of channel selection booleans - updated and merged documentation for dt entries Fixes from v2: - fix missing of_if patch Fixes from v1: - use of_property_reasd-bool() - remove unused of_id variable Cc: Felipe Balbi ba...@ti.com Cc: linux-usb@vger.kernel.org Cc: linux...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au Cc: devicet...@vger.kernel.org Conflicts: drivers/usb/phy/phy-rcar-gen2-usb.c --- .../bindings/usb/renesas,rcar-gen2-usb-phy.txt | 36 ++ drivers/pci/host/pci-rcar-gen2.c | 1 + drivers/usb/phy/phy-rcar-gen2-usb.c| 34 +--- 3 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt diff --git a/Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt b/Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt new file mode 100644 index 000..5351a30 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt @@ -0,0 +1,36 @@ +Renesas RCar gen2 USB PHY bindings +-- + +Bindings for the USB PHY block used in some Renesas SoCs. + +Required properties: + - compatible: renesas,usb-phy-r8a7790 for the R8A7790 SoC + renesas,usb-phy-r8a7791 for the R8A7791 SoC + - reg : A single region to access device registers + - clocks : The reference to the clock to use for this block + - clock-names : The name for the clock at index 0 (must be usbhs) + +Optional properties: + + - renesas,usb0-device: boolean, if present USB0 is connected to HS device + otherwise the USB0 is connected to OHCI/EHCI host. + - renesas,usb2-xhci: boolean, if present USB2 is connected to XHCI controller + otherwise the USB2 is connected to OHCI/EHCI host. + + +Example device node for SoC dtsi file: + + usbphy: usbphy@e6590100 { + compatible = renesas,usb-phy-r8a7790; + clocks = mstp7_clks R8A7790_CLK_HSUSB; + clock-names = usbhs; + reg = 0x0 0xe6590100 0x0 0x100; + status = disabled; + }; + +Example board file: + +usbphy { + status = okay; +}; + diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index 1216784..2595078 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -15,6 +15,7 @@ #include linux/io.h #include linux/kernel.h #include linux/module.h +#include linux/of.h #include linux/pci.h #include linux/of_pci.h #include linux/platform_device.h diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index 388d89f..8006c3c 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c @@ -15,6 +15,7 @@ #include linux/module.h #include linux/platform_data/usb-rcar-gen2-phy.h #include linux/platform_device.h +#include linux/of_device.h #include linux/spinlock.h #include linux/usb/otg.h @@ -167,6 +168,15 @@ out: spin_unlock_irqrestore(priv-lock, flags); } +#ifdef CONFIG_OF +static struct of_device_id rcar_gen2_usb_phy_ofmatch[] = { + { .compatible = renesas,usb-phy-r8a7790, }, + { .compatible = renesas,usb-phy-r8a7791, }, + { }, +}; +MODULE_DEVICE_TABLE(of, rcar_gen2_usb_phy_ofmatch); +#endif + static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) { struct device *dev = pdev-dev; @@ -178,7 +188,7 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) int retval; pdata = dev_get_platdata(dev); - if (!pdata) { + if (!pdata !dev-of_node) { dev_err(dev, No platform data\n); return -EINVAL; } @@ -203,16 +213,29 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) spin_lock_init(priv-lock); priv-clk = clk; priv-base = base; - priv-ugctrl2 = pdata-chan0_pci ? - USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS; - priv-ugctrl2 |= pdata-chan2_pci ? - USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS; priv-phy.dev = dev; priv-phy.label = dev_name(dev); priv-phy.init = rcar_gen2_usb_phy_init; priv-phy.shutdown = rcar_gen2_usb_phy_shutdown; priv-phy.set_suspend = rcar_gen2_usb_phy_set_suspend; + if (dev-of_node) { + if (of_property_read_bool(dev-of_node, renesas,usb0-device)) + priv-ugctrl2 = USBHS_UGCTRL2_USB0_HS; + else + priv-ugctrl2
[PATCH 7/9] ARM: shmobile: r8a7790.dtsi: add usbphy node
Add node for USB PHY driver to the base R8A7790 device tree include file. It is up to the board file to enable and configure it as necessary. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Cc: devicet...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au Cc: linux...@vger.kernel.org --- arch/arm/boot/dts/r8a7790.dtsi | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index 7325fee..4c03c46 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi @@ -802,4 +802,12 @@ #address-cells = 3; #size-cells = 2; }; + + usbphy: usbphy@e6590100 { + compatible = renesas,usb-phy-r8a7790; + clocks = mstp7_clks R8A7790_CLK_HSUSB; + clock-names = usbhs; + reg = 0x0 0xe6590100 0x0 0x100; + status = disabled; + }; }; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/9] usb: phy: check for of_node when getting phy
If the PHY is specified by usb-phy handle in the device tree, then usb_get_phy_dev() should use the device tree specified PHY. This fixes the issue where device-tree booted Renesas SoCs fail to find the PHY for the USB controllers. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- Cc: linux-usb@vger.kernel.org Cc: Felipe Balbi ba...@ti.com --- drivers/usb/phy/phy.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 8afa813..92b3c09 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -224,6 +224,29 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) struct usb_phy *phy = NULL; unsigned long flags; + if (dev-of_node) { + struct device_node *node; + + node = of_parse_phandle(dev-of_node, usb-phy, index); + if (!node) { + dev_dbg(dev, failed to get %s phandle\n, + dev-of_node-full_name); + return ERR_PTR(-ENODEV); + } + + spin_lock_irqsave(phy_lock, flags); + + phy = __of_usb_find_phy(node); + if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) { + phy = ERR_PTR(-EPROBE_DEFER); + of_node_put(node); + goto err0; + } + + get_device(phy-dev); + goto err0; + } + spin_lock_irqsave(phy_lock, flags); phy = __usb_find_phy_dev(dev, phy_bind_list, index); -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/9] phy-rcar-gen2-usb: always use 'dev' variable in probe() method
From: Sergei Shtylyov sergei.shtyl...@cogentembedded.com The probe() method has the 'dev' local variable declared and used but strangely not in all cases where it should be... Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- Cc: Felipe Balbi ba...@ti.com --- drivers/usb/phy/phy-rcar-gen2-usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index 551e0a6..388d89f 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c @@ -177,15 +177,15 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) struct clk *clk; int retval; - pdata = dev_get_platdata(pdev-dev); + pdata = dev_get_platdata(dev); if (!pdata) { dev_err(dev, No platform data\n); return -EINVAL; } - clk = devm_clk_get(pdev-dev, usbhs); + clk = devm_clk_get(dev, usbhs); if (IS_ERR(clk)) { - dev_err(pdev-dev, Can't get the clock\n); + dev_err(dev, Can't get the clock\n); return PTR_ERR(clk); } -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/9] ARM: shmbobile: r8a7790.dtsi: add pci0/1/2 nodes
Add nodes for USB PCI bridge devices. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Cc: devicet...@vger.kernel.org Cc: linux...@vger.kernel.org Cc: horms+rene...@verge.net.au Conflicts: arch/arm/boot/dts/r8a7790.dtsi --- arch/arm/boot/dts/r8a7790.dtsi | 39 +++ 1 file changed, 39 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index a1e7c39..7325fee 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi @@ -763,4 +763,43 @@ #size-cells = 0; status = disabled; }; + + pci0: pci@ee09 { + compatible = renesas,pci-r8a7790; + clocks = mstp7_clks R8A7790_CLK_EHCI; + reg = 0x0 0xee09 0x0 0xc00, + 0x0 0xee08 0x0 0x1100; + interrupts = 0 108 IRQ_TYPE_LEVEL_HIGH; + status = disabled; + + bus-range = 0 0; + #address-cells = 3; + #size-cells = 2; + }; + + pci1: pci@ee0b { + compatible = renesas,pci-r8a7790; + clocks = mstp7_clks R8A7790_CLK_EHCI; + reg = 0x0 0xee0b 0x0 0xc00, + 0x0 0xee0a 0x0 0x1100; + interrupts = 0 112 IRQ_TYPE_LEVEL_HIGH; + status = disabled; + + bus-range = 1 1; + #address-cells = 3; + #size-cells = 2; + }; + + pci2: pci@ee0d { + compatible = renesas,pci-r8a7790; + clocks = mstp7_clks R8A7790_CLK_EHCI; + reg = 0x0 0xee0d 0x0 0xc00, + 0x0 0xee0c 0x0 0x1100; + interrupts = 0 113 IRQ_TYPE_LEVEL_HIGH; + status = disabled; + + bus-range = 2 2; + #address-cells = 3; + #size-cells = 2; + }; }; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/9] ARM: shmobile: lager.dts: add usbphy reference
Enable the usbphy node so that the phy driver is available. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Cc: linux...@vger.kernel.org Cc: devicet...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au --- arch/arm/boot/dts/r8a7790-lager.dts | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts index fd6851f..63d58d6 100644 --- a/arch/arm/boot/dts/r8a7790-lager.dts +++ b/arch/arm/boot/dts/r8a7790-lager.dts @@ -246,3 +246,7 @@ pinctrl-0 = usb2_pins; pinctrl-names = default; }; + +usbphy { + status = okay; +}; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/9] ARM: shmobile: lager.dts: link usb-phy to pci nodes
Add the necessary links to add the USB phy nodes to the PCI devices that are behind the bridges specified. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- arch/arm/boot/dts/r8a7790-lager.dts | 37 + 1 file changed, 37 insertions(+) diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts index 63d58d6..62f486e 100644 --- a/arch/arm/boot/dts/r8a7790-lager.dts +++ b/arch/arm/boot/dts/r8a7790-lager.dts @@ -233,18 +233,55 @@ pci0 { pinctrl-0 = usb0_pins; pinctrl-names = default; + device_type = pci; + + pci@0,1 { + reg = 0x800 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; + + pci@0,2 { + reg = 0x1000 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; }; pci1 { status = okay; pinctrl-0 = usb1_pins; pinctrl-names = default; + + pci@0,1 { + reg = 0x800 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; + + pci@0,2 { + reg = 0x1000 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; }; pci2 { status = okay; pinctrl-0 = usb2_pins; pinctrl-names = default; + + pci@0,1 { + reg = 0x800 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; + + pci@0,2 { + reg = 0x1000 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; }; usbphy { -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/9] pci-rcar-gen2: add devicetree support
Add OF match table for pci-rcar-gen2 driver for device tree support. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk --- Updates since v1: - moved documentation into patch - moved to using bus-range parsing - ensured usb phy can be linked to usb devices Cc: Bjorn Helgaas bhelg...@google.com Cc: Simon Horman ho...@verge.net.au Cc: linux-...@vger.kernel.org Cc: linux...@vger.kernel.org Cc: devicet...@vger.kernel.org --- .../bindings/pci/renessas,pci-rcar-gen2.txt| 52 ++ drivers/pci/host/pci-rcar-gen2.c | 33 +- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/renessas,pci-rcar-gen2.txt diff --git a/Documentation/devicetree/bindings/pci/renessas,pci-rcar-gen2.txt b/Documentation/devicetree/bindings/pci/renessas,pci-rcar-gen2.txt new file mode 100644 index 000..bd6d291 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/renessas,pci-rcar-gen2.txt @@ -0,0 +1,52 @@ +Renesas AHB to PCI bridge +- + +This is the bridge used internally to connect the USB controllers to the +AHB. There is one bridge instance per USB port consiting of an internal +OHCI and EHCI controller. + +Required properties: + - compatible: renesas,pci-r8a7790 for the R8A7790 SoC + - reg : A list of physical regions to access the device. The first is + the operational registers for the OHCI/EHCI controller and the +second region is for the bridge configuration and control registers. + - interrupts : interrupt for the device + - clocks : The reference to the device clock + - bus-range: The PCI bus number ranges. As this is a single bus, the range + should be specified as the same value twice. + + +Example SoC configuration: + + pci0: pci@ee09 { + compatible = renesas,pci-r8a7790; + clocks = mstp7_clks R8A7790_CLK_EHCI; + reg = 0x0 0xee09 0x0 0xc00, + 0x0 0xee08 0x0 0x1100; + interrupts = 0 108 IRQ_TYPE_LEVEL_HIGH; + status = disabled; + + bus-range = 0 0; + #address-cells = 3; + #size-cells = 2; + }; + +Example board setup: + +pci1 { + status = okay; + pinctrl-0 = usb1_pins; + pinctrl-names = default; + + pci@0,1 { + reg = 0x800 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; + + pci@0,2 { + reg = 0x1000 0 0 0 0; + device_type = pci; + usb-phy = usbphy; + }; +}; diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index fd3e3ab..1216784 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -16,6 +16,7 @@ #include linux/kernel.h #include linux/module.h #include linux/pci.h +#include linux/of_pci.h #include linux/platform_device.h #include linux/pm_runtime.h #include linux/sizes.h @@ -98,6 +99,7 @@ struct rcar_pci_priv { struct resource io_res; struct resource mem_res; struct resource *cfg_res; + unsigned busnr; int irq; unsigned long window_size; }; @@ -312,8 +314,8 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys) pci_add_resource(sys-resources, priv-io_res); pci_add_resource(sys-resources, priv-mem_res); - /* Setup bus number based on platform device id */ - sys-busnr = to_platform_device(priv-dev)-id; + /* Setup bus number based on platform device id / of bus-range */ + sys-busnr = priv-busnr; return 1; } @@ -366,6 +368,23 @@ static int rcar_pci_probe(struct platform_device *pdev) priv-window_size = SZ_1G; + if (pdev-dev.of_node) { + struct resource busnr; + int ret; + + ret = of_pci_parse_bus_range(pdev-dev.of_node, busnr); + if (ret 0) { + dev_err(pdev-dev, failed to parse bus-range\n); + return ret; + } + + priv-busnr = busnr.start; + if (busnr.end != busnr.start) + dev_warn(pdev-dev, only one bus number supported\n); + } else { + priv-busnr = pdev-id; + } + hw_private[0] = priv; memset(hw, 0, sizeof(hw)); hw.nr_controllers = ARRAY_SIZE(hw_private); @@ -377,11 +396,21 @@ static int rcar_pci_probe(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static struct of_device_id rcar_pci_of_match[] = { + { .compatible = renesas,pci-r8a7790, }, + { }, +}; + +MODULE_DEVICE_TABLE(of, rcar_pci_of_match); +#endif + static struct platform_driver rcar_pci_driver = { .driver = { .name = pci-rcar-gen2, .owner = THIS_MODULE, .suppress_bind_attrs = true
Re: [PATCH 3/9] phy-rcar-usb-gen2: add device tree support
On 06/03/14 19:16, Sergei Shtylyov wrote: Hello. On 03/06/2014 09:01 PM, Ben Dooks wrote: Add support for the phy-rcar-gen2-usb driver to be probed from device tree. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Fixes from v2: - fix missed of_match_ptr() - fix names of channel selection booleans - updated and merged documentation for dt entries Fixes from v2: - fix missing of_if patch Fixes from v1: - use of_property_reasd-bool() - remove unused of_id variable Cc: Felipe Balbi ba...@ti.com Cc: linux-usb@vger.kernel.org Cc: linux...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au Cc: devicet...@vger.kernel.org Conflicts: drivers/usb/phy/phy-rcar-gen2-usb.c --- .../bindings/usb/renesas,rcar-gen2-usb-phy.txt | 36 ++ drivers/pci/host/pci-rcar-gen2.c | 1 + Eh? What does this file have to do with USB PHY? Ah, it was a fixup for a missing header that got merged into the wrong file. Will fix that. drivers/usb/phy/phy-rcar-gen2-usb.c| 34 +--- 3 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt diff --git a/Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt b/Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt new file mode 100644 index 000..5351a30 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/renesas,rcar-gen2-usb-phy.txt @@ -0,0 +1,36 @@ +Renesas RCar gen2 USB PHY bindings +-- + +Bindings for the USB PHY block used in some Renesas SoCs. + +Required properties: + - compatible: renesas,usb-phy-r8a7790 for the R8A7790 SoC +renesas,usb-phy-r8a7791 for the R8A7791 SoC + - reg : A single region to access device registers + - clocks : The reference to the clock to use for this block + - clock-names : The name for the clock at index 0 (must be usbhs) + +Optional properties: + + - renesas,usb0-device: boolean, if present USB0 is connected to HS device +otherwise the USB0 is connected to OHCI/EHCI host. IIUC, the testing has shown that USBHS is dual-role controller in that case, i.e. supports both host and device roles (the manual has the host controller details too). Vladimir, is it so? Currently there is no auto-detection for this, so it gets set at start time. + - renesas,usb2-xhci: boolean, if present USB2 is connected to XHCI controller + otherwise the USB2 is connected to OHCI/EHCI host. + + +Example device node for SoC dtsi file: + +usbphy: usbphy@e6590100 { +compatible = renesas,usb-phy-r8a7790; +clocks = mstp7_clks R8A7790_CLK_HSUSB; +clock-names = usbhs; +reg = 0x0 0xe6590100 0x0 0x100; +status = disabled; +}; + +Example board file: + +usbphy { +status = okay; +}; These are usually merged into one node for the example. Much nicer if separate. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/9] pci-rcar-gen2: add devicetree support
On 06/03/14 18:01, Ben Dooks wrote: Add OF match table for pci-rcar-gen2 driver for device tree support. diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index fd3e3ab..1216784 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -16,6 +16,7 @@ #include linux/kernel.h #include linux/module.h #include linux/pci.h +#include linux/of_pci.h #include linux/platform_device.h #include linux/pm_runtime.h #include linux/sizes.h Apologies all, there's a missing include of linux/of.h which should have been added here -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] phy-rcar-gen2-usb: add device tree support
On 06/03/14 19:39, Sergei Shtylyov wrote: Hello. On 03/03/2014 07:44 PM, Felipe Balbi wrote: Add support of the device tree probing for the Renesas R-Car generation 2 SoCs documenting the device tree binding as necessary. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Unless someone on devicetree@vger gives me an ACK pretty soon, I'm afraid this patch will miss v3.15. Mark, you've commented on v1 of the patch, I hope I cleared things up for you in my reply, how about an ACK (or at least new portion of comments)? And whose patches are we going to use? :-p -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] phy-rcar-gen2-usb: add device tree support
On 27/02/14 00:12, Sergei Shtylyov wrote: Add support of the device tree probing for the Renesas R-Car generation 2 SoCs documenting the device tree binding as necessary. So what happened w.r.t to my last set of patches for this? -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] phy-rcar-gen2-usb: add device tree support
On 27/02/14 00:12, Sergei Shtylyov wrote: Add support of the device tree probing for the Renesas R-Car generation 2 SoCs documenting the device tree binding as necessary. You've popped in some fixes for the driver probe in here as well. Could you do the fixes as a patch and send those before the devicetree code is done? + static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) { struct device *dev = pdev-dev; + struct device_node *np = dev-of_node; struct rcar_gen2_phy_platform_data *pdata; struct rcar_gen2_usb_phy_priv *priv; struct resource *res; @@ -177,13 +210,19 @@ static int rcar_gen2_usb_phy_probe(struc struct clk *clk; int retval; - pdata = dev_get_platdata(dev); + if (np) + pdata = rcar_gen2_usb_phy_parse_dt(dev); + else + pdata = dev_get_platdata(dev); if (!pdata) { dev_err(dev, No platform data\n); return -EINVAL; } - clk = devm_clk_get(dev, usbhs); + if (np) + clk = of_clk_get_by_name(np, usbhs); + else + clk = clk_get(dev, usbhs); Can be removed, just add a clock-name of usbhs in the device node. if (IS_ERR(clk)) { dev_err(dev, Can't get the clock\n); return PTR_ERR(clk); @@ -191,13 +230,16 @@ static int rcar_gen2_usb_phy_probe(struc res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, res); - if (IS_ERR(base)) - return PTR_ERR(base); + if (IS_ERR(base)) { + retval = PTR_ERR(base); + goto error; + } priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { dev_err(dev, Memory allocation failed\n); - return -ENOMEM; + retval = -ENOMEM; + goto error; } Probably should be separate patch to fix probe issues. spin_lock_init(priv-lock); @@ -216,12 +258,16 @@ static int rcar_gen2_usb_phy_probe(struc retval = usb_add_phy_dev(priv-phy); if (retval 0) { dev_err(dev, Failed to add USB phy\n); - return retval; + goto error; } platform_set_drvdata(pdev, priv); return retval; + +error: + clk_put(clk); + return retval; } Again, should have been rolled into fix patch. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] phy-rcar-usb-gen2: add device tree support
On 27/01/14 18:23, Sergei Shtylyov wrote: Hello. On 01/26/2014 08:05 PM, Ben Dooks wrote: [snip] +static struct of_device_id rcar_gen2_usb_phy_ofmatch[] = { +{ .compatible = renesas,usb-phy-r8a7790, }, +{ .compatible = renesas,rcar-gen2-usb-phy, }, Frankly speaking, I don't understand the need for the clearly duplicate entries. Thanks, will look into remove it. Anyone else have any comments on this? -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/8] phy-rcar-usb-gen2: add device tree support
Add support for the phy-rcar-gen2-usb driver to be probed from device tree. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Fixes from v1: - use of_property_reasd-bool() - remove unused of_id variable Cc: linux-usb@vger.kernel.org Cc: linux...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au Cc: devicet...@vger.kernel.org --- drivers/usb/phy/phy-rcar-gen2-usb.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index db3ab34..d146388 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c @@ -15,6 +15,7 @@ #include linux/module.h #include linux/platform_data/usb-rcar-gen2-phy.h #include linux/platform_device.h +#include linux/of_device.h #include linux/spinlock.h #include linux/usb/otg.h @@ -167,6 +168,12 @@ out: spin_unlock_irqrestore(priv-lock, flags); } +static struct of_device_id rcar_gen2_usb_phy_ofmatch[] = { + { .compatible = renesas,usb-phy-r8a7790, }, + { .compatible = renesas,rcar-gen2-usb-phy, }, + { }, +}; + static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) { struct device *dev = pdev-dev; @@ -178,7 +185,7 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) int retval; pdata = dev_get_platdata(pdev-dev); - if (!pdata) { + if (!pdata !dev-of_node) { dev_err(dev, No platform data\n); return -EINVAL; } @@ -203,16 +210,29 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) spin_lock_init(priv-lock); priv-clk = clk; priv-base = base; - priv-ugctrl2 = pdata-chan0_pci ? - USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS; - priv-ugctrl2 |= pdata-chan2_pci ? - USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS; priv-phy.dev = dev; priv-phy.label = dev_name(dev); priv-phy.init = rcar_gen2_usb_phy_init; priv-phy.shutdown = rcar_gen2_usb_phy_shutdown; priv-phy.set_suspend = rcar_gen2_usb_phy_set_suspend; + if (of_id) { + if (of_property_read_bool(dev-of_node, renesas,usb0-hs)) + priv-ugctrl2 = USBHS_UGCTRL2_USB0_HS; + else + priv-ugctrl2 = USBHS_UGCTRL2_USB0_PCI; + + if (of_property_read_bool(dev-of_node, renesas,usb2-ss)) + priv-ugctrl2 |= USBHS_UGCTRL2_USB2_SS; + else + priv-ugctrl2 |= USBHS_UGCTRL2_USB2_PCI; + } else { + priv-ugctrl2 = pdata-chan0_pci ? + USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS; + priv-ugctrl2 |= pdata-chan2_pci ? + USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS; + } + retval = usb_add_phy(priv-phy, USB_PHY_TYPE_USB2); if (retval 0) { dev_err(dev, Failed to add USB phy\n); @@ -236,6 +256,7 @@ static int rcar_gen2_usb_phy_remove(struct platform_device *pdev) static struct platform_driver rcar_gen2_usb_phy_driver = { .driver = { .name = usb_phy_rcar_gen2, + .of_match_table = rcar_gen2_usb_phy_ofmatch, }, .probe = rcar_gen2_usb_phy_probe, .remove = rcar_gen2_usb_phy_remove, -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] phy-rcar-usb-gen2: add device tree support
Add support for the phy-rcar-gen2-usb driver to be probed from device tree. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Fixes from v2: - fix missing of_if patch (I clearly should not be let near git-rebase when hungry) Fixes from v1: - use of_property_reasd-bool() - remove unused of_id variable Cc: linux-usb@vger.kernel.org Cc: linux...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au Cc: devicet...@vger.kernel.org --- drivers/usb/phy/phy-rcar-gen2-usb.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index db3ab34..e4665b9 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c @@ -15,6 +15,7 @@ #include linux/module.h #include linux/platform_data/usb-rcar-gen2-phy.h #include linux/platform_device.h +#include linux/of_device.h #include linux/spinlock.h #include linux/usb/otg.h @@ -167,6 +168,12 @@ out: spin_unlock_irqrestore(priv-lock, flags); } +static struct of_device_id rcar_gen2_usb_phy_ofmatch[] = { + { .compatible = renesas,usb-phy-r8a7790, }, + { .compatible = renesas,rcar-gen2-usb-phy, }, + { }, +}; + static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) { struct device *dev = pdev-dev; @@ -178,7 +185,7 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) int retval; pdata = dev_get_platdata(pdev-dev); - if (!pdata) { + if (!pdata !dev-of_node) { dev_err(dev, No platform data\n); return -EINVAL; } @@ -203,16 +210,29 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) spin_lock_init(priv-lock); priv-clk = clk; priv-base = base; - priv-ugctrl2 = pdata-chan0_pci ? - USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS; - priv-ugctrl2 |= pdata-chan2_pci ? - USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS; priv-phy.dev = dev; priv-phy.label = dev_name(dev); priv-phy.init = rcar_gen2_usb_phy_init; priv-phy.shutdown = rcar_gen2_usb_phy_shutdown; priv-phy.set_suspend = rcar_gen2_usb_phy_set_suspend; + if (dev-of_node) { + if (of_property_read_bool(dev-of_node, renesas,usb0-hs)) + priv-ugctrl2 = USBHS_UGCTRL2_USB0_HS; + else + priv-ugctrl2 = USBHS_UGCTRL2_USB0_PCI; + + if (of_property_read_bool(dev-of_node, renesas,usb2-ss)) + priv-ugctrl2 |= USBHS_UGCTRL2_USB2_SS; + else + priv-ugctrl2 |= USBHS_UGCTRL2_USB2_PCI; + } else { + priv-ugctrl2 = pdata-chan0_pci ? + USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS; + priv-ugctrl2 |= pdata-chan2_pci ? + USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS; + } + retval = usb_add_phy(priv-phy, USB_PHY_TYPE_USB2); if (retval 0) { dev_err(dev, Failed to add USB phy\n); @@ -236,6 +256,7 @@ static int rcar_gen2_usb_phy_remove(struct platform_device *pdev) static struct platform_driver rcar_gen2_usb_phy_driver = { .driver = { .name = usb_phy_rcar_gen2, + .of_match_table = rcar_gen2_usb_phy_ofmatch, }, .probe = rcar_gen2_usb_phy_probe, .remove = rcar_gen2_usb_phy_remove, -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/8] phy-rcar-usb-gen2: add device tree support
On 26/01/14 18:03, Sergei Shtylyov wrote: Hello. On 01/26/2014 07:49 PM, Ben Dooks wrote: Add support for the phy-rcar-gen2-usb driver to be probed from device tree. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Fixes from v1: - use of_property_reasd-bool() - remove unused of_id variable Cc: linux-usb@vger.kernel.org Cc: linux...@vger.kernel.org Cc: Magnus Damm magnus.d...@gmail.com Cc: Simon Horman ho...@verge.net.au Cc: devicet...@vger.kernel.org --- drivers/usb/phy/phy-rcar-gen2-usb.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index db3ab34..d146388 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c [...] @@ -203,16 +210,29 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) [...] +if (of_id) { You've removed the variable but not its use. Have you tried to compile this patch? Thanks, already noticed that and produced v3. I should not be let near git-rebase when hungry. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] phy-rcar-usb-gen2: add device tree support
On 20/01/14 12:18, Sergei Shtylyov wrote: Hello. On 18-01-2014 19:03, Ben Dooks wrote: Add support for the phy-rcar-gen2-usb driver to be probed from device tree. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Cc: linux-usb@vger.kernel.org (open list:USB PHY LAYER) Cc: linux...@vger.kernel.org (open list:ARM/SHMOBILE ARM...) Cc: Magnus Damm magnus.d...@gmail.com (supporter:ARM/SHMOBILE ARM...) Cc: Simon Horman ho...@verge.net.au (supporter:ARM/SHMOBILE ARM...) Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND...) --- drivers/usb/phy/phy-rcar-gen2-usb.c | 35 ++- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index db3ab34..906b74b 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c [...] @@ -203,16 +212,31 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) [...] +if (of_id) { +int len = 0; + +if (of_get_property(dev-of_node, renesas,usb0-hs, len)) +priv-ugctrl2 = USBHS_UGCTRL2_USB0_HS; +else +priv-ugctrl2 = USBHS_UGCTRL2_USB0_PCI; + +if (of_get_property(dev-of_node, renesas,usb2-ss, len)) You can use of_property_read_bool() in both cases as both these props are boolean I guess. It's more handy. Thanks, missed that one, will sort that out. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] phy-rcar-usb-gen2: add device tree support
Add support for the phy-rcar-gen2-usb driver to be probed from device tree. Signed-off-by: Ben Dooks ben.do...@codethink.co.uk Reviewed-by: Ian Molton ian.mol...@codethink.co.uk --- Cc: linux-usb@vger.kernel.org (open list:USB PHY LAYER) Cc: linux...@vger.kernel.org (open list:ARM/SHMOBILE ARM...) Cc: Magnus Damm magnus.d...@gmail.com (supporter:ARM/SHMOBILE ARM...) Cc: Simon Horman ho...@verge.net.au (supporter:ARM/SHMOBILE ARM...) Cc: devicet...@vger.kernel.org (open list:OPEN FIRMWARE AND...) --- drivers/usb/phy/phy-rcar-gen2-usb.c | 35 ++- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index db3ab34..906b74b 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c @@ -15,6 +15,7 @@ #include linux/module.h #include linux/platform_data/usb-rcar-gen2-phy.h #include linux/platform_device.h +#include linux/of_device.h #include linux/spinlock.h #include linux/usb/otg.h @@ -167,8 +168,15 @@ out: spin_unlock_irqrestore(priv-lock, flags); } +static struct of_device_id rcar_gen2_usb_phy_ofmatch[] = { + { .compatible = renesas,usb-phy-r8a7790, }, + { .compatible = renesas,rcar-gen2-usb-phy, }, + { }, +}; + static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) { + const struct of_device_id *of_id; struct device *dev = pdev-dev; struct rcar_gen2_phy_platform_data *pdata; struct rcar_gen2_usb_phy_priv *priv; @@ -177,8 +185,9 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) struct clk *clk; int retval; + of_id = of_match_device(rcar_gen2_usb_phy_ofmatch, pdev-dev); pdata = dev_get_platdata(pdev-dev); - if (!pdata) { + if (!pdata !of_id) { dev_err(dev, No platform data\n); return -EINVAL; } @@ -203,16 +212,31 @@ static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) spin_lock_init(priv-lock); priv-clk = clk; priv-base = base; - priv-ugctrl2 = pdata-chan0_pci ? - USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS; - priv-ugctrl2 |= pdata-chan2_pci ? - USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS; priv-phy.dev = dev; priv-phy.label = dev_name(dev); priv-phy.init = rcar_gen2_usb_phy_init; priv-phy.shutdown = rcar_gen2_usb_phy_shutdown; priv-phy.set_suspend = rcar_gen2_usb_phy_set_suspend; + if (of_id) { + int len = 0; + + if (of_get_property(dev-of_node, renesas,usb0-hs, len)) + priv-ugctrl2 = USBHS_UGCTRL2_USB0_HS; + else + priv-ugctrl2 = USBHS_UGCTRL2_USB0_PCI; + + if (of_get_property(dev-of_node, renesas,usb2-ss, len)) + priv-ugctrl2 |= USBHS_UGCTRL2_USB2_SS; + else + priv-ugctrl2 |= USBHS_UGCTRL2_USB2_PCI; + } else { + priv-ugctrl2 = pdata-chan0_pci ? + USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS; + priv-ugctrl2 |= pdata-chan2_pci ? + USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS; + } + retval = usb_add_phy(priv-phy, USB_PHY_TYPE_USB2); if (retval 0) { dev_err(dev, Failed to add USB phy\n); @@ -236,6 +260,7 @@ static int rcar_gen2_usb_phy_remove(struct platform_device *pdev) static struct platform_driver rcar_gen2_usb_phy_driver = { .driver = { .name = usb_phy_rcar_gen2, + .of_match_table = rcar_gen2_usb_phy_ofmatch, }, .probe = rcar_gen2_usb_phy_probe, .remove = rcar_gen2_usb_phy_remove, -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/9] pci: Add R-Car Gen2 internal PCI support
address */ + iowrite32(0x4000 | PCI_BASE_ADDRESS_MEM_PREFETCH, + reg + PCI_BASE_ADDRESS_1); + /* Set AHB-PCI bridge PCI communication area address */ + val = priv-cfg_res-start + RCAR_AHBPCI_PCICOM_OFFSET; + iowrite32(val, reg + PCI_BASE_ADDRESS_0); + + val = ioread32(reg + PCI_COMMAND); + val |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY | + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; + iowrite32(val, reg + PCI_COMMAND); + + /* Enable PCI interrupts */ + iowrite32(RCAR_PCI_INT_A | RCAR_PCI_INT_B | RCAR_PCI_INT_PME, + reg + RCAR_PCI_INT_ENABLE_REG); + + /* Add PCI resources */ + pci_add_resource(sys-resources, priv-io_res); + pci_add_resource(sys-resources, priv-mem_res); + + return 1; +} + +static struct pci_ops rcar_pci_ops = { + .read = rcar_pci_read_config, + .write = rcar_pci_write_config, +}; + +static struct hw_pci rcar_hw_pci __initdata = { + .map_irq= rcar_pci_map_irq, + .ops= rcar_pci_ops, + .setup = rcar_pci_setup, +}; + +static int rcar_pci_count __initdata; + +static int __init rcar_pci_add_controller(struct rcar_pci_priv *priv) +{ + void **private_data; + int count; + + if (rcar_hw_pci.nr_controllers rcar_pci_count) + goto add_priv; + + /* (Re)allocate private data pointer array if needed */ + count = rcar_pci_count + RCAR_PCI_NR_CONTROLLERS; + private_data = kzalloc(count * sizeof(void *), GFP_KERNEL); + if (!private_data) + return -ENOMEM; + + rcar_pci_count = count; + if (rcar_hw_pci.private_data) { + memcpy(private_data, rcar_hw_pci.private_data, + rcar_hw_pci.nr_controllers * sizeof(void *)); + kfree(rcar_hw_pci.private_data); + } + + rcar_hw_pci.private_data = private_data; + +add_priv: + /* Add private data pointer to the array */ + rcar_hw_pci.private_data[rcar_hw_pci.nr_controllers++] = priv; + return 0; +} + +static int __init rcar_pci_probe(struct platform_device *pdev) +{ + struct resource *cfg_res, *mem_res; + struct rcar_pci_priv *priv; + void __iomem *reg; + + cfg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + reg = devm_ioremap_resource(pdev-dev, cfg_res); + if (!reg) + return -ENODEV; + + mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!mem_res || !mem_res-start) + return -ENODEV; + + priv = devm_kzalloc(pdev-dev, + sizeof(struct rcar_pci_priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv-mem_res = *mem_res; + /* +* The controller does not support/use port I/O, +* so setup a dummy port I/O region here. +*/ + priv-io_res.start = priv-mem_res.start; + priv-io_res.end = priv-mem_res.end; + priv-io_res.flags = IORESOURCE_IO; + + priv-cfg_res = cfg_res; + + priv-irq = platform_get_irq(pdev, 0); + priv-reg = reg; + + return rcar_pci_add_controller(priv); +} + +static struct platform_driver rcar_pci_driver = { + .driver = { + .name = pci-rcar-gen2, + }, +}; + +static int __init rcar_pci_init(void) +{ + int retval; + + retval = platform_driver_probe(rcar_pci_driver, rcar_pci_probe); + if (!retval) + pci_common_init(rcar_hw_pci); + + /* Private data pointer array is not needed any more */ + kfree(rcar_hw_pci.private_data); + rcar_hw_pci.private_data = NULL; + + return retval; +} + +subsys_initcall(rcar_pci_init); + +MODULE_LICENSE(GPL v2); +MODULE_DESCRIPTION(Renesas R-Car Gen2 internal PCI); +MODULE_AUTHOR(Valentine Barshak valentine.bars...@cogentembedded.com); -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/8] usb: host: ehci-omap: Remove redundant use of of_match_ptr
On 21/05/13 12:47, Sachin Kamat wrote: 'omap_ehci_dt_ids' is always compiled in. Hence use of of_match_ptr is unnecessary. Thought it was defined as tristate in the Kconfig. config USB_EHCI_HCD_OMAP tristate EHCI support for OMAP3 and later chips depends on ARCH_OMAP this is hardly 'compiled in' here. And even it is 'always compiled in' we could just leave this in in case it is not always compiled in. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dwc3 on omap5432 no SuperSpeed host mode
On 15/05/13 15:30, Felipe Balbi wrote: Hi, On Wed, May 15, 2013 at 03:15:44PM +0100, Ben Dooks wrote: It seems the board is very picky about what it will play host to as neither of the mini-b to A adapters I have work. I am using a mini B to mini B cable to run the card reader. I have still got the disable CMD_RESET patch in. yeah, there are a few issues regarding CMD_RESET bit on the XHCI side with that IP. We're still trying to find a proper workaround. Is replacing the xhci-hcd.c reset command with a call to the dwc3 driver not enough? I will leave this for the moment if it is being worked on. Even if we are just working in gadget mode, having the xhci-hcd driver around causes the system to stop working. yeah, basically CMD_RESET (which is set during XHCI probe) causes some Global and Device Endpoint registers to corrupt. no workaround yet, other than constantly resetting the whole thing when you want to switch roles. What you can do, however, is to choose in Kconfig to have it working as peripheral only, then you're safe. Ok, I was under the impression that it was needed even for host only. We still have not managed to get a stable xhci host mode on the OMAP5432-UEVM board at SuperSpeed. funny, we tested this a few days back. Right now I don't have HW with me (travelling), but Kishon has. Maybe he can help us out ? It would be useful to find out which version of the kernel and u-boot where used. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dwc3 on omap5432 no SuperSpeed host mode
On 08/05/13 17:45, Sebastian Andrzej Siewior wrote: * Ben Dooks | 2013-05-07 22:06:33 [+0200]: We are using an OMAP5432 ES2.0 on an UEVM board and running into issues with the dwc3 usb. Sorry, I can't help at all. I don't have the board and I never had one. I had ES1.0 but I never got dwc3 to work. I have better news, re-based to 3.8.11 and it has now enumerated the USB3 card reader at SuperSpeed. It seems the board is very picky about what it will play host to as neither of the mini-b to A adapters I have work. I am using a mini B to mini B cable to run the card reader. I have still got the disable CMD_RESET patch in. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dwc3 on omap5432 no SuperSpeed host mode
On 08/05/13 18:02, Felipe Balbi wrote: Hi, On Wed, May 08, 2013 at 05:52:50PM +0200, Ben Dooks wrote: On 08/05/13 17:45, Sebastian Andrzej Siewior wrote: * Ben Dooks | 2013-05-07 22:06:33 [+0200]: We are using an OMAP5432 ES2.0 on an UEVM board and running into issues with the dwc3 usb. Sorry, I can't help at all. I don't have the board and I never had one. I had ES1.0 but I never got dwc3 to work. I have better news, re-based to 3.8.11 and it has now enumerated the USB3 card reader at SuperSpeed. It seems the board is very picky about what it will play host to as neither of the mini-b to A adapters I have work. I am using a mini B to mini B cable to run the card reader. I have still got the disable CMD_RESET patch in. yeah, there are a few issues regarding CMD_RESET bit on the XHCI side with that IP. We're still trying to find a proper workaround. Is replacing the xhci-hcd.c reset command with a call to the dwc3 driver not enough? I will leave this for the moment if it is being worked on. Even if we are just working in gadget mode, having the xhci-hcd driver around causes the system to stop working. On your mini-b to A adapters, make sure ID pin is grounded, if it's not then the Vbus regulator won't switch to bypass mode, that's something workable in SW, however, just lack of time to implement. I've forced the palmas-pmic to run Vbus all the time at the moment, as it didn't have any sort of controls for SMSP10 output 1. Thankyou for the response. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
dwc3 on omap5432 no SuperSpeed host mode
We are using an OMAP5432 ES2.0 on an UEVM board and running into issues with the dwc3 usb. The first issue is that the xhci reset code stops the entire core from working after it is executed. We have commented the xhci reset code from issuing the CMD_RESET and this has allowed us to get the XHCI platform driver to work in some capacity (and swap back to gadget mode if needed). Is the xhci_reset issue known? Should I supply a patch to allow the platform code to override the xhci reset with a custom reset hook? The second issue is that once this is working, we have not been able to get the board to function as a SuperSpeed host (it will work as a SuperSpeed gadget to a Linux PC). Any device plugged in (we are testing with a pen-drive, a usb3 network adapter and a usb3 transcend card reader) will either fail to enumerate at-all, or if it does get detected it falls back to high-speed (which does work). I can supply logs if needed. -- Ben Dooks, Senior Engineer http://www.codethink.co.uk/ -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Creating a new xhci-hcd platform device
If the code is small, then I don't see any problem with adding it directly to the xhci-plat.c driver (or in this case you'll probably need an xhci-of binding as well) I was wondering if the marvell system supports a more generic way of attaching devices which have these bus window mappings on them, since there's several others. It may be worth looking into this (at least ask on the arm kernel list). It would probably be best to view the code before making much more in the way of comment. On 22 April 2013 09:18, yehuda yitchak yehud...@gmail.com wrote: Hello everyone I want to ask your advice on the best approach for implementing a new XHCI host controller. I am going to add Linux support for a new XHCI host controller for Marvell SOCs. I looked around the latest XHCI support code in the kernel and found that a platform driver called “xhci-hcd” exists. And there is also one XHCI device (DRD dwc3 used by Samsung and TI) that bounds to this driver. My case is somewhat simpler than the dwc3 since it’s not a Dual Role Device. Basically I need to initialize some SOC level registers and then register an xhci-hcd device. Also I need to implement suspend/resume hooks to save and restore the SOC registers initialized at the probe function. I was thinking to take the following approach: 1. Under drivers/usb/host - Register a new platform driver called “xhci-mv” which will initialize the SOC specific stuff and register an “xhci-hcd” platform device. 2. In the machine code – Register an “xhci-mv” platform device and initialize its resources based on device tree. I appreciate any input or comment Thanks in advance Yehuda Yitschak -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Ben Dooks, http://www.fluff.org/ben/ bjdo...@googlemail.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
DWC3/xHCI host mode ethernet frame corruption on 3.8.5
We are using an OMAP5432 ES2.0 on a uEVM board with the dwc3 OtG block configured for xHCI host mode. When connecting to another board with a similar block running in device mode with g_ether we re seeing corrupted packets. The ARP responses we get have an extra 2 bytes on the header, as shown below and have 4 extra bytes on the end of the packet. 00:35:06.644708 ff:ff:d2:40:90:44 2e:00:ff:ff:ff:ff, ethertype Unknown (0xd3c 0x: 0806 0001 0800 0604 0001 d240 9044 d3c0 ...@.D.. 0x0010: c0a8 0101 c0a8 0103 dead 0x0020: beef .. From what I can see of the xHCI specification, the transfer buffers should support unaligned data. From tracing through xhci_urb_enqueue the buffer being passed is edb07042 (phys adb07042). Unfortunately we do not have enough information about the dwc3 core to work out if there is an problem with unaligned buffers, or if we are missing some configuration of either the host or the otg block to ensure that it properly handles the alignment issues. We are currently assuming that the issue is to do with the xHCI on the DWC3 as the gadget side works with a Intel laptop using a NEC controller to provide a reliable network link between g_ether and laptop's Linux cdc-ethernet. The only other issue we had was the xhci_reset() code causing the whole OtG block to fail, so we have currently remove the issue of the CMD_RESET from the xhci-hcd driver to allow the system to keep going. If this is the issue then we will need to find some other way of resetting the entire block (currently the otg block is initialised by the dwc3 driver before it instantiates a xHCI platform device to handle the host side) -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html