[PATCH v4 0/3] usb: ohci-at91: various improvements
Hello, This patch series moves the different driver resources (clks and iomem) retrieval to the device managed versions (devm_ functions). Best Regards, Boris Changes since v3: - replace devm_request_and_ioremap call by devm_ioremap_resource Changes since v2: - split urgent fix and resource retrieval improvements Boris BREZILLON (3): usb: ohci-at91: replace request_mem_region + ioremap by devm_ioremap_resource usb: ohci-at91: use dev variable instead of pdev-dev usb: ohci-at91: use device managed clk retrieval drivers/usb/host/ohci-at91.c | 68 -- 1 file changed, 19 insertions(+), 49 deletions(-) -- 1.7.9.5 -- 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 v4 1/3] usb: ohci-at91: replace request_mem_region + ioremap by devm_ioremap_resource
Replace the request_mem_region + ioremap calls by the devm_ioremap_resource call which does the same things but with device managed resources. Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Signed-off-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 28 +++- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 8c356af..fe2ecc5 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -158,24 +158,18 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd-rsrc_start = res-start; hcd-rsrc_len = resource_size(res); - if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) { - pr_debug(request_mem_region failed\n); - retval = -EBUSY; - goto err1; - } - - hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len); - if (!hcd-regs) { - pr_debug(ioremap failed\n); - retval = -EIO; - goto err2; + hcd-regs = devm_ioremap_resource(dev, res); + if (IS_ERR(hcd-regs)) { + dev_dbg(dev, devm_ioremap_resource failed\n); + retval = PTR_ERR(hcd-regs); + goto err; } iclk = clk_get(pdev-dev, ohci_clk); if (IS_ERR(iclk)) { dev_err(pdev-dev, failed to get ohci_clk\n); retval = PTR_ERR(iclk); - goto err3; + goto err; } fclk = clk_get(pdev-dev, uhpck); if (IS_ERR(fclk)) { @@ -219,13 +213,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, err4: clk_put(iclk); - err3: - iounmap(hcd-regs); - - err2: - release_mem_region(hcd-rsrc_start, hcd-rsrc_len); - - err1: + err: usb_put_hcd(hcd); return retval; } @@ -248,8 +236,6 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd, { usb_remove_hcd(hcd); at91_stop_hc(pdev); - iounmap(hcd-regs); - release_mem_region(hcd-rsrc_start, hcd-rsrc_len); usb_put_hcd(hcd); if (IS_ENABLED(CONFIG_COMMON_CLK)) -- 1.7.9.5 -- 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 v4 2/3] usb: ohci-at91: use dev variable instead of pdev-dev
Make use of the dev variable instead of referencing the dev field of the pdev struct. Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Signed-off-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fe2ecc5..30f1445 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -152,7 +152,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, return irq; } - hcd = usb_create_hcd(driver, pdev-dev, at91); + hcd = usb_create_hcd(driver, dev, at91); if (!hcd) return -ENOMEM; hcd-rsrc_start = res-start; @@ -165,28 +165,28 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, goto err; } - iclk = clk_get(pdev-dev, ohci_clk); + iclk = clk_get(dev, ohci_clk); if (IS_ERR(iclk)) { - dev_err(pdev-dev, failed to get ohci_clk\n); + dev_err(dev, failed to get ohci_clk\n); retval = PTR_ERR(iclk); goto err; } - fclk = clk_get(pdev-dev, uhpck); + fclk = clk_get(dev, uhpck); if (IS_ERR(fclk)) { - dev_err(pdev-dev, failed to get uhpck\n); + dev_err(dev, failed to get uhpck\n); retval = PTR_ERR(fclk); goto err4; } - hclk = clk_get(pdev-dev, hclk); + hclk = clk_get(dev, hclk); if (IS_ERR(hclk)) { - dev_err(pdev-dev, failed to get hclk\n); + dev_err(dev, failed to get hclk\n); retval = PTR_ERR(hclk); goto err5; } if (IS_ENABLED(CONFIG_COMMON_CLK)) { - uclk = clk_get(pdev-dev, usb_clk); + uclk = clk_get(dev, usb_clk); if (IS_ERR(uclk)) { - dev_err(pdev-dev, failed to get uclk\n); + dev_err(dev, failed to get uclk\n); retval = PTR_ERR(uclk); goto err6; } -- 1.7.9.5 -- 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 v4 3/3] usb: ohci-at91: use device managed clk retrieval
Replace clk_get calls by devm_clk_get calls. Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Signed-off-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 30 +++--- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 30f1445..9db3954 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -165,30 +165,30 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, goto err; } - iclk = clk_get(dev, ohci_clk); + iclk = devm_clk_get(dev, ohci_clk); if (IS_ERR(iclk)) { dev_err(dev, failed to get ohci_clk\n); retval = PTR_ERR(iclk); goto err; } - fclk = clk_get(dev, uhpck); + fclk = devm_clk_get(dev, uhpck); if (IS_ERR(fclk)) { dev_err(dev, failed to get uhpck\n); retval = PTR_ERR(fclk); - goto err4; + goto err; } - hclk = clk_get(dev, hclk); + hclk = devm_clk_get(dev, hclk); if (IS_ERR(hclk)) { dev_err(dev, failed to get hclk\n); retval = PTR_ERR(hclk); - goto err5; + goto err; } if (IS_ENABLED(CONFIG_COMMON_CLK)) { - uclk = clk_get(dev, usb_clk); + uclk = devm_clk_get(dev, usb_clk); if (IS_ERR(uclk)) { dev_err(dev, failed to get uclk\n); retval = PTR_ERR(uclk); - goto err6; + goto err; } } @@ -204,15 +204,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, /* Error handling */ at91_stop_hc(pdev); - if (IS_ENABLED(CONFIG_COMMON_CLK)) - clk_put(uclk); - err6: - clk_put(hclk); - err5: - clk_put(fclk); - err4: - clk_put(iclk); - err: usb_put_hcd(hcd); return retval; @@ -237,13 +228,6 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd, usb_remove_hcd(hcd); at91_stop_hc(pdev); usb_put_hcd(hcd); - - if (IS_ENABLED(CONFIG_COMMON_CLK)) - clk_put(uclk); - clk_put(hclk); - clk_put(fclk); - clk_put(iclk); - fclk = iclk = hclk = NULL; } /*-*/ -- 1.7.9.5 -- 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 v4] usb: ohci-at91: fix irq and iomem resource retrieval
When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resources table. Retrieve resources using platform_get_resource and platform_get_irq functions instead of direct resource table entries to avoid resource type mismatch. Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Signed-off-by: Alan Stern st...@rowland.harvard.edu Reviewed-by: Tomasz Figa tomasz.f...@gmail.com --- Changes since v3: - replace platform_get_resource call with IORESOURCE_IRQ argument by platform_get_irq Changes since v2: - split the patch series to isolate the urgent fix provided by this patch Changes since v1: - none drivers/usb/host/ohci-at91.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 418444e..8c356af 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -136,23 +136,27 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, struct ohci_hcd *ohci; int retval; struct usb_hcd *hcd = NULL; - - if (pdev-num_resources != 2) { - pr_debug(hcd probe: invalid num_resources); - return -ENODEV; + struct device *dev = pdev-dev; + struct resource *res; + int irq; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_dbg(dev, hcd probe: missing memory resource\n); + return -ENXIO; } - if ((pdev-resource[0].flags != IORESOURCE_MEM) - || (pdev-resource[1].flags != IORESOURCE_IRQ)) { - pr_debug(hcd probe: invalid resource type\n); - return -ENODEV; + irq = platform_get_irq(pdev, 0); + if (irq 0) { + dev_dbg(dev, hcd probe: missing irq resource\n); + return irq; } hcd = usb_create_hcd(driver, pdev-dev, at91); if (!hcd) return -ENOMEM; - hcd-rsrc_start = pdev-resource[0].start; - hcd-rsrc_len = resource_size(pdev-resource[0]); + hcd-rsrc_start = res-start; + hcd-rsrc_len = resource_size(res); if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) { pr_debug(request_mem_region failed\n); @@ -199,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, ohci-num_ports = board-ports; at91_start_hc(pdev); - retval = usb_add_hcd(hcd, pdev-resource[1].start, IRQF_SHARED); + retval = usb_add_hcd(hcd, irq, IRQF_SHARED); if (retval == 0) return retval; -- 1.7.9.5 -- 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 v4 1/3] usb: ohci-at91: replace request_mem_region + ioremap by devm_ioremap_resource
Hello. On 12/08/2013 06:02 PM, Boris BREZILLON wrote: Replace the request_mem_region + ioremap calls by the devm_ioremap_resource call which does the same things but with device managed resources. Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Signed-off-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 28 +++- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 8c356af..fe2ecc5 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -158,24 +158,18 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd-rsrc_start = res-start; hcd-rsrc_len = resource_size(res); - if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) { - pr_debug(request_mem_region failed\n); - retval = -EBUSY; - goto err1; - } - - hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len); - if (!hcd-regs) { - pr_debug(ioremap failed\n); - retval = -EIO; - goto err2; + hcd-regs = devm_ioremap_resource(dev, res); + if (IS_ERR(hcd-regs)) { + dev_dbg(dev, devm_ioremap_resource failed\n); I've already told you devm_ioremap_resource() prints the detailed error message. No need to duplicate it. + retval = PTR_ERR(hcd-regs); + goto err; } WBR, Sergei -- 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 v4 1/3] usb: ohci-at91: replace request_mem_region + ioremap by devm_ioremap_resource
Hello, Le 08/12/2013 19:31, Sergei Shtylyov a écrit : Hello. On 12/08/2013 06:02 PM, Boris BREZILLON wrote: Replace the request_mem_region + ioremap calls by the devm_ioremap_resource call which does the same things but with device managed resources. Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Signed-off-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/host/ohci-at91.c | 28 +++- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 8c356af..fe2ecc5 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -158,24 +158,18 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd-rsrc_start = res-start; hcd-rsrc_len = resource_size(res); -if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) { -pr_debug(request_mem_region failed\n); -retval = -EBUSY; -goto err1; -} - -hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len); -if (!hcd-regs) { -pr_debug(ioremap failed\n); -retval = -EIO; -goto err2; +hcd-regs = devm_ioremap_resource(dev, res); +if (IS_ERR(hcd-regs)) { +dev_dbg(dev, devm_ioremap_resource failed\n); I've already told you devm_ioremap_resource() prints the detailed error message. No need to duplicate it. Oops, sorry, this is an oversight. I'll send a new version removing this line. Best Regards, Boris +retval = PTR_ERR(hcd-regs); +goto err; } WBR, Sergei -- 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] ARM: fix ohci-pxa27x build error with OF enabled
---8--- $ make CC [M] drivers/usb/host/ohci-pxa27x.o drivers/usb/host/ohci-pxa27x.c: In function ‘ohci_pxa_of_init’: drivers/usb/host/ohci-pxa27x.c:310:2: error: implicit declaration of function ‘dma_coerce_mask_and_coherent’ [-Werror=implicit-function-declaration] drivers/usb/host/ohci-pxa27x.c:310:2: error: implicit declaration of function ‘DMA_BIT_MASK’ [-Werror=implicit-function-declaration] ---8--- Signed-off-by: Sergei Ianovich ynv...@gmail.com CC: Russell King - ARM Linux li...@arm.linux.org.uk # Changes to be committed: --- drivers/usb/host/ohci-pxa27x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e89ac4d..97983fd 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -24,6 +24,7 @@ #include linux/io.h #include linux/kernel.h #include linux/module.h +#include linux/dma-mapping.h #include linux/of_platform.h #include linux/of_gpio.h #include linux/platform_data/usb-ohci-pxa27x.h -- 1.8.4.3 -- 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 5/6] Revert ARM: OMAP2+: Provide alias to USB PHY clock
* Roger Quadros rog...@ti.com [131023 03:14]: On 10/22/2013 06:17 PM, Tony Lindgren wrote: * Roger Quadros rog...@ti.com [131010 02:23]: On 10/09/2013 06:15 PM, Tony Lindgren wrote: * Roger Quadros rog...@ti.com [131009 00:19]: Hi Tony, On 10/08/2013 01:06 PM, Roger Quadros wrote: This reverts commit 741532c4a995be11815cb72d4d7a48f442a22fea. The proper clock reference is provided in device tree so we no longer need this. Could you please Ack this one? I think it is best if it goes through Benoit's tree. I could queue this into my board removal series that will be based on Benoit's branch if that works for you. And this also seems to depend on the omap-for-v3.13/quirk branch that moves all the legacy pdata handling into pdata-quirks.c. OK Tony. Thanks. Actually, can you please update this patch against branch omap-for-v3.13/board-removal-take2 and check the omap5_uevm_legacy_init() part as well? Updated patch is below. Note that this must go in only after Benoit has picked up Tero's clock series and the dts patches in this series. If needed, you can wait and I can send you a reminder when that happens. Thanks. FYI, I'll mark this as read for now, can you please resend one more time when we can apply after Tero's patches. Otherwise I'll probably mess up things and apply this by accident too soon.. Regards, Tony From ab81199d5b9c487c8493e6aa1d8b4bf17c0c5110 Mon Sep 17 00:00:00 2001 From: Roger Quadros rog...@ti.com Date: Wed, 23 Oct 2013 12:58:59 +0300 Subject: [PATCH] ARM: OMAP2+: Get rid of legacy_init_ehci_clk() The proper clock reference is provided in device tree so we no longer need this. Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/mach-omap2/pdata-quirks.c | 25 - 1 file changed, 25 deletions(-) diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 10c7145..22537ed 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -26,20 +26,6 @@ struct pdata_init { void (*fn)(void); }; -/* - * Create alias for USB host PHY clock. - * Remove this when clock phandle can be provided via DT - */ -static void __init __used legacy_init_ehci_clk(char *clkname) -{ - int ret; - - ret = clk_add_alias(main_clk, NULL, clkname, NULL); - if (ret) - pr_err(%s:Failed to add main_clk alias to %s :%d\n, -__func__, clkname, ret); -} - #if IS_ENABLED(CONFIG_WL12XX) static struct wl12xx_platform_data wl12xx __initdata; @@ -105,18 +91,10 @@ static void __init omap4_sdp_legacy_init(void) static void __init omap4_panda_legacy_init(void) { omap4_panda_display_init_of(); - legacy_init_ehci_clk(auxclk3_ck); legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53); } #endif -#ifdef CONFIG_SOC_OMAP5 -static void __init omap5_uevm_legacy_init(void) -{ - legacy_init_ehci_clk(auxclk1_ck); -} -#endif - static struct pcs_pdata pcs_pdata; void omap_pcs_legacy_init(int irq, void (*rearm)(void)) @@ -149,9 +127,6 @@ static struct pdata_init pdata_quirks[] __initdata = { { ti,omap4-sdp, omap4_sdp_legacy_init, }, { ti,omap4-panda, omap4_panda_legacy_init, }, #endif -#ifdef CONFIG_SOC_OMAP5 - { ti,omap5-uevm, omap5_uevm_legacy_init, }, -#endif { /* sentinel */ }, }; -- 1.8.3.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/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module
Hi Benoît, On Tue, 3 Dec 2013, Roger Quadros wrote: Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10. Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation. RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot. Reported-by: Tomi Valkeinen tomi.valkei...@ti.com Signed-off-by: Roger Quadros rog...@ti.com Acked-by: Paul Walmsley p...@pwsan.com Will you pick this up for the -rc series, or do you want me or Tony to? Roger writes that this one's pretty important. - Paul --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++-- arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++-- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 1e5b12c..3318cae9 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = { .sysc_offs = 0x0010, .syss_offs = 0x0014, .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE | -SYSC_HAS_SOFTRESET), +SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS), .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), @@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = { * hence HWMOD_SWSUP_MSTANDBY */ - /* - * During system boot; If the hwmod framework resets the module - * the module will have smart idle settings; which can lead to deadlock - * (above Errata Id:i660); so, dont reset the module during boot; - * Use HWMOD_INIT_NO_RESET. - */ - - .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | - HWMOD_INIT_NO_RESET, + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, }; /* diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index 9e08d69..e297d62 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c @@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = { .rev_offs = 0x, .sysc_offs = 0x0010, .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | -SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), +SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | +SYSC_HAS_RESET_STATUS), .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), @@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = { * hence HWMOD_SWSUP_MSTANDBY */ - /* - * During system boot; If the hwmod framework resets the module - * the module will have smart idle settings; which can lead to deadlock - * (above Errata Id:i660); so, dont reset the module during boot; - * Use HWMOD_INIT_NO_RESET. - */ - - .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | - HWMOD_INIT_NO_RESET, + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, .main_clk = l3init_60m_fclk, .prcm = { .omap4 = { -- 1.8.3.2 - Paul
Re: [PATCH 2/3] ARM: OMAP2+: hwmod: Fix RESET logic
Hi Roger, On Tue, 3 Dec 2013, Roger Quadros wrote: In _ocp_softreset(), after _set_softreset() + write_sysconfig(), the hwmod's sysc_cache will always contain SOFTRESET bit set so all further writes to sysconfig using this cache will initiate a repeated SOFTRESET e.g. enable_sysc(). This is true for OMAP3 like platforms that have RESET_DONE status in the SYSSTATUS register and so the the SOFTRESET bit in SYSCONFIG is not automatically cleared. It is not a problem for OMAP4 like platforms that indicate RESET completion by clearing the SOFTRESET bit in the SYSCONFIG register. This repeated SOFTRESET is undesired and was the root cause of USB host issues on OMAP3 platforms when hwmod was allowed to do the SOFTRESET for the USB Host module. Doh :-( Nice catch. Renamed _clr_softreset() to _clear_softreset() and queued the following for v3.13-rc. - Paul From: Roger Quadros rog...@ti.com ARM: OMAP2+: hwmod: Fix SOFTRESET logic In _ocp_softreset(), after _set_softreset() + write_sysconfig(), the hwmod's sysc_cache will always contain SOFTRESET bit set so all further writes to sysconfig using this cache will initiate a repeated SOFTRESET e.g. enable_sysc(). This is true for OMAP3 like platforms that have RESET_DONE status in the SYSSTATUS register and so the the SOFTRESET bit in SYSCONFIG is not automatically cleared. It is not a problem for OMAP4 like platforms that indicate RESET completion by clearing the SOFTRESET bit in the SYSCONFIG register. This repeated SOFTRESET is undesired and was the root cause of USB host issues on OMAP3 platforms when hwmod was allowed to do the SOFTRESET for the USB Host module. To fix this we clear the SOFTRESET bit and update the sysconfig register + sysc_cache using write_sysconfig(). Signed-off-by: Roger Quadros rog...@ti.com [p...@pwsan.com: renamed _clr_softreset() to _clear_softreset()] Signed-off-by: Paul Walmsley p...@pwsan.com --- arch/arm/mach-omap2/omap_hwmod.c | 43 +++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index e3f0ecaf87dd..cacc0c7e8634 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -399,7 +399,7 @@ static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v) } /** - * _set_softreset: set OCP_SYSCONFIG.CLOCKACTIVITY bits in @v + * _set_softreset: set OCP_SYSCONFIG.SOFTRESET bit in @v * @oh: struct omap_hwmod * * @v: pointer to register contents to modify * @@ -427,6 +427,36 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v) } /** + * _clear_softreset: clear OCP_SYSCONFIG.SOFTRESET bit in @v + * @oh: struct omap_hwmod * + * @v: pointer to register contents to modify + * + * Clear the SOFTRESET bit in @v for hwmod @oh. Returns -EINVAL upon + * error or 0 upon success. + */ +static int _clear_softreset(struct omap_hwmod *oh, u32 *v) +{ + u32 softrst_mask; + + if (!oh-class-sysc || + !(oh-class-sysc-sysc_flags SYSC_HAS_SOFTRESET)) + return -EINVAL; + + if (!oh-class-sysc-sysc_fields) { + WARN(1, +omap_hwmod: %s: sysc_fields absent for sysconfig class\n, +oh-name); + return -EINVAL; + } + + softrst_mask = (0x1 oh-class-sysc-sysc_fields-srst_shift); + + *v = ~softrst_mask; + + return 0; +} + +/** * _wait_softreset_complete - wait for an OCP softreset to complete * @oh: struct omap_hwmod * to wait on * @@ -1911,6 +1941,12 @@ static int _ocp_softreset(struct omap_hwmod *oh) ret = _set_softreset(oh, v); if (ret) goto dis_opt_clks; + + _write_sysconfig(v, oh); + ret = _clear_softreset(oh, v); + if (ret) + goto dis_opt_clks; + _write_sysconfig(v, oh); if (oh-class-sysc-srst_udelay) @@ -3169,6 +3205,11 @@ int omap_hwmod_softreset(struct omap_hwmod *oh) goto error; _write_sysconfig(v, oh); + ret = _clear_softreset(oh, v); + if (ret) + goto error; + _write_sysconfig(v, oh); + error: return ret; } -- 1.8.4.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
Re: [PATCH v2 0/3] ARM: OMAP2+: USB Host bug fixes for 3.13 rc
On Wed, 4 Dec 2013, Tomi Valkeinen wrote: Tested on Panda and Beagle xM. Works fine for me. Thanks, added your Tested-by's to both patches that I've queued. - Paul -- 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/3] usb: phy-generic: Add GPIO based ChipSelect
On Saturday, December 07, 2013 04:24 AM, Felipe Balbi wrote: Hi, On Mon, Dec 02, 2013 at 03:05:17PM +0800, Chris Ruehl wrote: @@ -231,27 +249,40 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) return -ENOMEM; nop-reset_active_low = true;/* default behaviour */ + nop-cs_active_low = true; if (dev-of_node) { struct device_node *node = dev-of_node; enum of_gpio_flags flags; + enum of_gpio_flags csflags; if (of_property_read_u32(node, clock-frequency,clk_rate)) clk_rate = 0; needs_vcc = of_property_read_bool(node, vcc-supply); + nop-gpio_reset = of_get_named_gpio_flags(node, reset-gpios, 0,flags); + two unrelated changes if (nop-gpio_reset == -EPROBE_DEFER) return -EPROBE_DEFER; nop-reset_active_low = flags OF_GPIO_ACTIVE_LOW; + nop-gpio_chipselect = of_get_named_gpio_flags(node, cs-gpios, + 0,csflags); + if (gpio_is_valid(nop-gpio_chipselect)) + nop-cs_active_low = csflags OF_GPIO_ACTIVE_LOW; + } else if (pdata) { type = pdata-type; clk_rate = pdata-clk_rate; needs_vcc = pdata-needs_vcc; nop-gpio_reset = pdata-gpio_reset; + nop-gpio_chipselect = pdata-gpio_chipselect; + } else { + nop-gpio_reset = -1; This line is already going upstream, please remove it, i'll handle the conflict later. Beause the rest of the patch set is not ready to make it in the upstream, I will checkout latest linux-next and send the patch again as a single patch. thanks Chris -- 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/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module
* Paul Walmsley p...@pwsan.com [131208 17:27]: Hi Benoît, On Tue, 3 Dec 2013, Roger Quadros wrote: Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10. Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation. RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot. Reported-by: Tomi Valkeinen tomi.valkei...@ti.com Signed-off-by: Roger Quadros rog...@ti.com Acked-by: Paul Walmsley p...@pwsan.com Will you pick this up for the -rc series, or do you want me or Tony to? Roger writes that this one's pretty important. I suggest that you just queue this with your other fixes so we get things working. Regards, Tony arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++-- arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++-- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 1e5b12c..3318cae9 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = { .sysc_offs = 0x0010, .syss_offs = 0x0014, .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE | - SYSC_HAS_SOFTRESET), + SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS), .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), @@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = { * hence HWMOD_SWSUP_MSTANDBY */ - /* -* During system boot; If the hwmod framework resets the module -* the module will have smart idle settings; which can lead to deadlock -* (above Errata Id:i660); so, dont reset the module during boot; -* Use HWMOD_INIT_NO_RESET. -*/ - - .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | - HWMOD_INIT_NO_RESET, + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, }; /* diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index 9e08d69..e297d62 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c @@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = { .rev_offs = 0x, .sysc_offs = 0x0010, .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | - SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), + SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | + SYSC_HAS_RESET_STATUS), .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), @@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = { * hence HWMOD_SWSUP_MSTANDBY */ - /* -* During system boot; If the hwmod framework resets the module -* the module will have smart idle settings; which can lead to deadlock -* (above Errata Id:i660); so, dont reset the module during boot; -* Use HWMOD_INIT_NO_RESET. -*/ - - .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | - HWMOD_INIT_NO_RESET, + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, .main_clk = l3init_60m_fclk, .prcm = { .omap4 = { -- 1.8.3.2 - Paul -- 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/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module
On Sun, 8 Dec 2013, Tony Lindgren wrote: * Paul Walmsley p...@pwsan.com [131208 17:27]: On Tue, 3 Dec 2013, Roger Quadros wrote: Without this, the USB devices are sometimes not detected on OMAP4 Panda with u-boot v2013.10. Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation. RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot. Reported-by: Tomi Valkeinen tomi.valkei...@ti.com Signed-off-by: Roger Quadros rog...@ti.com Acked-by: Paul Walmsley p...@pwsan.com Will you pick this up for the -rc series, or do you want me or Tony to? Roger writes that this one's pretty important. I suggest that you just queue this with your other fixes so we get things working. I'm going to wait until tomorrow anyway to see if Sathya responds to my other E-mail, so maybe Benoît will let us know by then. - Paul
Re: [PATCH 31/39] USB: remove DEFINE_PCI_DEVICE_TABLE macro
On Tue, Dec 03, 2013 at 08:27:58AM +0900, Jingoo Han wrote: Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro is not preferred. Signed-off-by: Jingoo Han jg1@samsung.com I wonder why I wasn't Cc:ed to this email considering it touches three drivers I care about. Greg, I have the original ones in my tree and I would really like to avoid rebasing my 'next' branch. Do we keep it there or do you want to avoid merging those commits ? Jingoo, please keep maintainers in Cc next time, it's very tough to filter emails you care about otherwise. cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH 1/3] usb: phy-generic: Add GPIO based ChipSelect
Hi, On Mon, Dec 09, 2013 at 09:45:30AM +0800, Chris Ruehl wrote: On Saturday, December 07, 2013 04:24 AM, Felipe Balbi wrote: Hi, On Mon, Dec 02, 2013 at 03:05:17PM +0800, Chris Ruehl wrote: @@ -231,27 +249,40 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) return -ENOMEM; nop-reset_active_low = true; /* default behaviour */ + nop-cs_active_low = true; if (dev-of_node) { struct device_node *node = dev-of_node; enum of_gpio_flags flags; + enum of_gpio_flags csflags; if (of_property_read_u32(node, clock-frequency,clk_rate)) clk_rate = 0; needs_vcc = of_property_read_bool(node, vcc-supply); + nop-gpio_reset = of_get_named_gpio_flags(node, reset-gpios, 0,flags); + two unrelated changes if (nop-gpio_reset == -EPROBE_DEFER) return -EPROBE_DEFER; nop-reset_active_low = flags OF_GPIO_ACTIVE_LOW; + nop-gpio_chipselect = of_get_named_gpio_flags(node, cs-gpios, + 0,csflags); + if (gpio_is_valid(nop-gpio_chipselect)) + nop-cs_active_low = csflags OF_GPIO_ACTIVE_LOW; + } else if (pdata) { type = pdata-type; clk_rate = pdata-clk_rate; needs_vcc = pdata-needs_vcc; nop-gpio_reset = pdata-gpio_reset; + nop-gpio_chipselect = pdata-gpio_chipselect; + } else { + nop-gpio_reset = -1; This line is already going upstream, please remove it, i'll handle the conflict later. Beause the rest of the patch set is not ready to make it in the upstream, I will checkout latest linux-next and send the patch again as a single patch. no, please *never* base any patches off of linux-next. That tree gets recreated every day and can never be considered stable. Aim at using a tag from Linus instead (v3.13-rc3, for example). It's a much better development point than linux-next. In case patch doesn't apply cleanly, different maintainers will have their choice of rebasing it themselves or asking author to rebase on a specific branch. By default, however, use a tag from Linus. cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH 1/3] usb: phy-generic: Add GPIO based ChipSelect
On Monday, December 09, 2013 12:07 PM, Felipe Balbi wrote: Hi, On Mon, Dec 09, 2013 at 09:45:30AM +0800, Chris Ruehl wrote: On Saturday, December 07, 2013 04:24 AM, Felipe Balbi wrote: Hi, On Mon, Dec 02, 2013 at 03:05:17PM +0800, Chris Ruehl wrote: @@ -231,27 +249,40 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) return -ENOMEM; nop-reset_active_low = true;/* default behaviour */ + nop-cs_active_low = true; if (dev-of_node) { struct device_node *node = dev-of_node; enum of_gpio_flags flags; + enum of_gpio_flags csflags; if (of_property_read_u32(node, clock-frequency,clk_rate)) clk_rate = 0; needs_vcc = of_property_read_bool(node, vcc-supply); + nop-gpio_reset = of_get_named_gpio_flags(node, reset-gpios, 0,flags); + two unrelated changes if (nop-gpio_reset == -EPROBE_DEFER) return -EPROBE_DEFER; nop-reset_active_low = flags OF_GPIO_ACTIVE_LOW; + nop-gpio_chipselect = of_get_named_gpio_flags(node, cs-gpios, + 0,csflags); + if (gpio_is_valid(nop-gpio_chipselect)) + nop-cs_active_low = csflags OF_GPIO_ACTIVE_LOW; + } else if (pdata) { type = pdata-type; clk_rate = pdata-clk_rate; needs_vcc = pdata-needs_vcc; nop-gpio_reset = pdata-gpio_reset; + nop-gpio_chipselect = pdata-gpio_chipselect; + } else { + nop-gpio_reset = -1; This line is already going upstream, please remove it, i'll handle the conflict later. Beause the rest of the patch set is not ready to make it in the upstream, I will checkout latest linux-next and send the patch again as a single patch. no, please *never* base any patches off of linux-next. That tree gets recreated every day and can never be considered stable. Aim at using a tag from Linus instead (v3.13-rc3, for example). It's a much better development point than linux-next. In case patch doesn't apply cleanly, different maintainers will have their choice of rebasing it themselves or asking author to rebase on a specific branch. By default, however, use a tag from Linus. cheers Thanks for the advice, I will follow :-) Chris -- 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 0/2] usb: chipidea: streamline regmap handling
On Fri, Dec 06, 2013 at 11:27:31AM +0100, Marc Kleine-Budde wrote: Hello Peter, these patches are for your ci-for-usb-next branch. The repmap handling is streamlined and the kernel shrinks by 706 bytes on i.MX28. Moving the regmap into hw_bank saves on indirection instruction per register access. add/remove: 0/0 grow/shrink: 0/30 up/down: 0/-706 (-706) function old new delta hw_wait_reg 164 160 -4 hw_port_test_get 24 20 -4 hw_ep_flush 132 128 -4 ep_enable392 388 -4 ep_disable 252 248 -4 ci_otg_work 248 244 -4 ci_otg_role 24 20 -4 ci_hdrc_host_init148 144 -4 ci_hdrc_gadget_init 736 732 -4 ci_handle_vbus_change 92 88 -4 isr_setup_status_complete156 148 -8 hw_port_test_set 64 56 -8 host_start 360 352 -8 ci_udc_pullup 84 76 -8 ci_hdrc_remove 100 92 -8 ci_udc_wakeup172 160 -12 udc_id_switch_for_host76 60 -16 udc_id_switch_for_device 80 64 -16 ci_hdrc_otg_destroy 92 76 -16 ci_hdrc_enter_lpm204 188 -16 ci_irq 264 244 -20 hw_device_state 120 96 -24 _ep_queue.isra 10561028 -28 ci_regs_nolpm 76 19 -57 ci_regs_lpm 76 19 -57 hw_device_reset 416 352 -64 ep_set_halt 500 436 -64 hw_alloc_regmap 204 136 -68 ci_hdrc_probe 15121444 -68 udc_irq 32363136-100 regards, Marc Applied this patchset, thanks. -- Best Regards, Peter Chen -- 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 2/4 V2] ARM: mx28: Add USB PHY overcurrent pinmux
On Fri, Dec 06, 2013 at 04:17:33PM +0100, Michael Grzeschik wrote: Hi Peter, On Tue, Nov 26, 2013 at 12:08:03PM +, Peter Chen wrote: The GPIO is working for this pin. But also the DIGCTL register bits helped here. Now the OC event triggers if the pin gets pulled to 3V3. I am currently looking for a good place to enable the DIGCTL bits. I suggest to enable them per default. As we don't have USBMISC registers in MX28, the bits should be toggled in ci_hdrc_imx.c if the of property disable-overcurrent is not found. I will use the syscon interface to reach them with the regmap interface. usbmisc register doesn't stand for the register needs to be in usb controller. Any registers which are related to USB function can be considered as usbmisc registers. You will see FSL-style SoC, the over-current or other related setting are at controller base + 0x800 (0x600), but Sigmatel-style SoC (mx28/mx23), the usb register are not at controller register region. My suggestion is: create usbmisc node for mx28, and put oc setting at there, it can keep ci_hdrc_imx.c clean. Besides, you may need two dts user setting for oc enable and oc polarity. IMHO usbmisc is a driver with memery mapped region. So it would probably make more sense to use syscon for that purpose, as we only need special registers out of the digctl register. Hi Michael, the reason why we have usbmisc is that we want to hide SoC's differentiate at ci_hdrc_imx.c, and call uniform APIs in it. We already have over-current handling at usbmisc for other SoCs, it is better to put all i.mx over-current handlings at the same place. Yes, when we design usbmisc, we just thought it was for usb non-core register and this register region is only for USB, but now, we find it is not correct for i.mx28 whose usb registers are at other regions and shared with others modules. I think usbmisc should handle it, that is some SoCs uses memory mapped region, and others use syscon. It is SoC differentiate, the dts can describe it. Peter What do you think of that code: diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 68f7f5e..ddac5cb 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -19,12 +19,18 @@ #include linux/dma-mapping.h #include linux/usb/chipidea.h #include linux/clk.h +#include linux/regmap.h +#include linux/mfd/syscon.h #include ci.h #include ci_hdrc_imx.h #define CI_HDRC_IMX_IMX28_WRITE_FIX BIT(0) +#define DIGCTL_CTRL_SET 0x4 +#define USB_OTG_OC_ENABLE_BITBIT(23) +#define USB_H1_OC_ENABLE_BIT BIT(24) + struct ci_hdrc_imx_platform_flag { unsigned int flags; }; @@ -105,6 +111,26 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) const struct of_device_id *of_id = of_match_device(ci_hdrc_imx_dt_ids, pdev-dev); const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id-data; + struct device_node *np = pdev-dev.of_node; + struct regmap *digctl; + + /* Some SoCs don't have digctl registers */ + if (of_get_property(np, fsl,digctl, NULL)) { + struct of_phandle_args args; + int enable_bit = USB_OTG_OC_ENABLE_BIT; + ret = of_parse_phandle_with_args(np, fsl,digctl, #index-cells, + 0, args); + digctl = syscon_regmap_lookup_by_phandle + (np, fsl,digctl); + if (IS_ERR(digctl)) { + dev_dbg(pdev-dev, + failed to find regmap for digctl\n); + } else { + if (args.args[0]) + enable_bit = USB_H1_OC_ENABLE_BIT; + regmap_write(digctl, DIGCTL_CTRL_SET, enable_bit); + } + } data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL); if (!data) { diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index 600f7cb..bb61c49 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -668,11 +668,12 @@ }; }; - digctl@8001c000 { - compatible = fsl,imx28-digctl; + digctl: digctl@8001c000 { + #index-cells = 1; + compatible = fsl,imx28-digctl, syscon; reg = 0x8001c000 0x2000; interrupts = 89; - status = disabled; + status = okay; }; etm@80022000 { @@ -976,6 +977,7 @@ interrupts = 93; clocks = clks 60;
Re: [PATCH v2 2/2] arm: omap: remove *.auto* from device names given in usb_bind_phy
Hi, On Saturday 07 December 2013 02:38 AM, Felipe Balbi wrote: Hi, On Fri, Dec 06, 2013 at 01:14:38PM +0100, Javier Martinez Canillas wrote: On Fri, Dec 6, 2013 at 1:06 PM, Kishon Vijay Abraham I kis...@ti.com wrote: Previously MUSB wrapper (OMAP) device used PLATFORM_DEVID_AUTO while creating MUSB core device. So in usb_bind_phy (binds the controller with the PHY), the device name of the controller had *.auto* in it. Since with using PLATFORM_DEVID_AUTO, there is no way to know the exact device name in advance, the data given in usb_bind_phy became obsolete and usb_get_phy was failing. So MUSB wrapper was modified not to use PLATFORM_DEVID_AUTO. Corresponding change is done in board file here. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/mach-omap2/board-2430sdp.c|2 +- arch/arm/mach-omap2/board-3430sdp.c|2 +- arch/arm/mach-omap2/board-cm-t35.c |2 +- arch/arm/mach-omap2/board-devkit8000.c |2 +- arch/arm/mach-omap2/board-ldp.c|2 +- arch/arm/mach-omap2/board-omap3beagle.c|2 +- arch/arm/mach-omap2/board-omap3logic.c |2 +- arch/arm/mach-omap2/board-omap3pandora.c |2 +- arch/arm/mach-omap2/board-omap3stalker.c |2 +- arch/arm/mach-omap2/board-omap3touchbook.c |2 +- arch/arm/mach-omap2/board-overo.c |2 +- arch/arm/mach-omap2/board-rx51.c |2 +- 12 files changed, 12 insertions(+), 12 deletions(-) You can drop this patch since boards files are being removed for v3.14 if we can drop this patch, the whole series is invalid, since we'll be using DT phandles to find PHYs going forward, no ? yeah. But in one of the other threads, Tony seemed ok to take a patch that fixes the same issue in mach-omap2/twl-common.c. So it's better to confirm with Tony. Thanks Kishon -- 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 v5 03/15] usb: phy-mxs: Add auto clock and power setting
With the auto setting, the PHY's clock and power can be recovered correctly from low power mode, it is ganranteed by IC logic. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 20 +--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 6d49040..0c6f3bc 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,11 @@ #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) +#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) +#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) +#define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) +#define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) #define BM_USBPHY_CTRL_ENUTMILEVEL3BIT(15) #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) @@ -96,9 +101,18 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) /* Power up the PHY */ writel(0, base + HW_USBPHY_PWD); - /* enable FS/LS device */ - writel(BM_USBPHY_CTRL_ENUTMILEVEL2 | - BM_USBPHY_CTRL_ENUTMILEVEL3, + /* +* USB PHY Ctrl Setting +* - Auto clock/power on +* - Enable full/low speed support +*/ + writel(BM_USBPHY_CTRL_ENAUTOSET_USBCLKS | + BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE | + BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD | + BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE | + BM_USBPHY_CTRL_ENAUTO_PWRON_PLL | + BM_USBPHY_CTRL_ENUTMILEVEL2 | + BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); return 0; -- 1.7.8 -- 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 v5 07/15] usb: phy: add notify suspend and resume callback
They are used to notify PHY that the controller enters suspend or finishes resume. Signed-off-by: Peter Chen peter.c...@freescale.com --- include/linux/usb/phy.h | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 6c0b1c5..a747960 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -116,6 +116,11 @@ struct usb_phy { enum usb_device_speed speed); int (*notify_disconnect)(struct usb_phy *x, enum usb_device_speed speed); + int (*notify_suspend)(struct usb_phy *x, + enum usb_device_speed speed); + int (*notify_resume)(struct usb_phy *x, + enum usb_device_speed speed); + }; /** @@ -282,6 +287,24 @@ usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed) return 0; } +static inline int usb_phy_notify_suspend + (struct usb_phy *x, enum usb_device_speed speed) +{ + if (x x-notify_suspend) + return x-notify_suspend(x, speed); + else + return 0; +} + +static inline int usb_phy_notify_resume + (struct usb_phy *x, enum usb_device_speed speed) +{ + if (x x-notify_resume) + return x-notify_resume(x, speed); + else + return 0; +} + /* notifiers */ static inline int usb_register_notifier(struct usb_phy *x, struct notifier_block *nb) -- 1.7.8 -- 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 v5 05/15] ARM: dts: imx6: add anatop phandle for usbphy
Add anatop phandle for usbphy Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/boot/dts/imx6qdl.dtsi |2 ++ arch/arm/boot/dts/imx6sl.dtsi |2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index 59154dc..4e74962 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -557,6 +557,7 @@ reg = 0x020c9000 0x1000; interrupts = 0 44 0x04; clocks = clks 182; + fsl,anatop = anatop; }; usbphy2: usbphy@020ca000 { @@ -564,6 +565,7 @@ reg = 0x020ca000 0x1000; interrupts = 0 45 0x04; clocks = clks 183; + fsl,anatop = anatop; }; snvs@020cc000 { diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 28558f1..30322b5 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -489,6 +489,7 @@ reg = 0x020c9000 0x1000; interrupts = 0 44 0x04; clocks = clks IMX6SL_CLK_USBPHY1; + fsl,anatop = anatop; }; usbphy2: usbphy@020ca000 { @@ -496,6 +497,7 @@ reg = 0x020ca000 0x1000; interrupts = 0 45 0x04; clocks = clks IMX6SL_CLK_USBPHY2; + fsl,anatop = anatop; }; snvs@020cc000 { -- 1.7.8 -- 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 v5 06/15] usb: phy-mxs: Add anatop regmap
It is needed by imx6 SoC series, but not for imx23 and imx28. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 23 +-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 0c6f3bc..0ef930a 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -21,6 +21,8 @@ #include linux/err.h #include linux/io.h #include linux/of_device.h +#include linux/regmap.h +#include linux/mfd/syscon.h #define DRIVER_NAME mxs_phy @@ -58,6 +60,9 @@ */ #define MXS_PHY_SENDING_SOF_TOO_FAST BIT(2) +/* The SoCs who have anatop module */ +#define MXS_PHY_HAS_ANATOP BIT(3) + struct mxs_phy_data { unsigned int flags; }; @@ -68,11 +73,13 @@ static const struct mxs_phy_data imx23_phy_data = { static const struct mxs_phy_data imx6q_phy_data = { .flags = MXS_PHY_SENDING_SOF_TOO_FAST | - MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, + MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | + MXS_PHY_HAS_ANATOP, }; static const struct mxs_phy_data imx6sl_phy_data = { - .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, + .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | + MXS_PHY_HAS_ANATOP, }; static const struct of_device_id mxs_phy_dt_ids[] = { @@ -87,6 +94,7 @@ struct mxs_phy { struct usb_phy phy; struct clk *clk; const struct mxs_phy_data *data; + struct regmap *regmap_anatop; }; static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) @@ -190,6 +198,7 @@ static int mxs_phy_probe(struct platform_device *pdev) int ret; const struct of_device_id *of_id = of_match_device(mxs_phy_dt_ids, pdev-dev); + struct device_node *np = pdev-dev.of_node; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(pdev-dev, res); @@ -226,6 +235,16 @@ static int mxs_phy_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mxs_phy); + if (mxs_phy-data-flags MXS_PHY_HAS_ANATOP) { + mxs_phy-regmap_anatop = syscon_regmap_lookup_by_phandle + (np, fsl,anatop); + if (IS_ERR(mxs_phy-regmap_anatop)) { + dev_dbg(pdev-dev, + failed to find regmap for anatop\n); + return PTR_ERR(mxs_phy-regmap_anatop); + } + } + ret = usb_add_phy_dev(mxs_phy-phy); if (ret) return ret; -- 1.7.8 -- 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 v5 04/15] usb: doc: phy-mxs: update binding for adding anatop phandle
Add anatop phandle which is used to access anatop registers to control PHY's power and other USB operations. Signed-off-by: Peter Chen peter.c...@freescale.com --- Documentation/devicetree/bindings/usb/mxs-phy.txt |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index d850e55..059536c 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt @@ -5,10 +5,12 @@ Required properties: for imx6dq and imx6dl, fsl,imx6sl-usbphy for imx6sl - reg: Should contain registers location and length - interrupts: Should contain phy interrupt +- fsl,anatop: phandle for anatop register, it is only for imx6 SoC series Example: usbphy1: usbphy@020c9000 { compatible = fsl,imx6q-usbphy, fsl,imx23-usbphy; reg = 0x020c9000 0x1000; interrupts = 0 44 0x04; + fsl,anatop = anatop; }; -- 1.7.8 -- 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 v5 01/15] usb: doc: phy-mxs: Add more compatible strings
Add fsl,imx6q-usbphy for imx6dq and imx6dl, add fsl,imx6sl-usbphy for imx6sl. Signed-off-by: Peter Chen peter.c...@freescale.com --- Documentation/devicetree/bindings/usb/mxs-phy.txt |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index 5835b27..d850e55 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt @@ -1,7 +1,8 @@ * Freescale MXS USB Phy Device Required properties: -- compatible: Should be fsl,imx23-usbphy +- compatible: fsl,imx23-usbphy for imx23 and imx28, fsl,imx6q-usbphy +for imx6dq and imx6dl, fsl,imx6sl-usbphy for imx6sl - reg: Should contain registers location and length - interrupts: Should contain phy interrupt -- 1.7.8 -- 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 v5 08/15] usb: phy-mxs: Add implementation of nofity_suspend and notify_resume
Implementation of notify_suspend and notify_resume will be different according to mxs_phy_data-flags. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 55 ++--- 1 files changed, 51 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 0ef930a..e3df53f 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -166,8 +166,8 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend) static int mxs_phy_on_connect(struct usb_phy *phy, enum usb_device_speed speed) { - dev_dbg(phy-dev, %s speed device has connected\n, - (speed == USB_SPEED_HIGH) ? high : non-high); + dev_dbg(phy-dev, %s device has connected\n, + (speed == USB_SPEED_HIGH) ? HS : FS/LS); if (speed == USB_SPEED_HIGH) writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, @@ -179,8 +179,8 @@ static int mxs_phy_on_connect(struct usb_phy *phy, static int mxs_phy_on_disconnect(struct usb_phy *phy, enum usb_device_speed speed) { - dev_dbg(phy-dev, %s speed device has disconnected\n, - (speed == USB_SPEED_HIGH) ? high : non-high); + dev_dbg(phy-dev, %s device has disconnected\n, + (speed == USB_SPEED_HIGH) ? HS : FS/LS); if (speed == USB_SPEED_HIGH) writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, @@ -189,6 +189,48 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, return 0; } +static int mxs_phy_on_suspend(struct usb_phy *phy, + enum usb_device_speed speed) +{ + struct mxs_phy *mxs_phy = to_mxs_phy(phy); + + dev_dbg(phy-dev, %s device has suspended\n, + (speed == USB_SPEED_HIGH) ? HS : FS/LS); + + /* delay 4ms to wait bus entering idle */ + usleep_range(4000, 5000); + + if (mxs_phy-data-flags MXS_PHY_ABNORMAL_IN_SUSPEND) { + writel_relaxed(0x, phy-io_priv + HW_USBPHY_PWD); + writel_relaxed(0, phy-io_priv + HW_USBPHY_PWD); + } + + if (speed == USB_SPEED_HIGH) + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, + phy-io_priv + HW_USBPHY_CTRL_CLR); + + return 0; +} + +/* + * The resume signal must be finished here. + */ +static int mxs_phy_on_resume(struct usb_phy *phy, + enum usb_device_speed speed) +{ + dev_dbg(phy-dev, %s device has resumed\n, + (speed == USB_SPEED_HIGH) ? HS : FS/LS); + + if (speed == USB_SPEED_HIGH) { + /* Make sure the device has switched to High-Speed mode */ + udelay(500); + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, + phy-io_priv + HW_USBPHY_CTRL_SET); + } + + return 0; +} + static int mxs_phy_probe(struct platform_device *pdev) { struct resource *res; @@ -235,6 +277,11 @@ static int mxs_phy_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mxs_phy); + if (mxs_phy-data-flags MXS_PHY_SENDING_SOF_TOO_FAST) { + mxs_phy-phy.notify_suspend = mxs_phy_on_suspend; + mxs_phy-phy.notify_resume = mxs_phy_on_resume; + } + if (mxs_phy-data-flags MXS_PHY_HAS_ANATOP) { mxs_phy-regmap_anatop = syscon_regmap_lookup_by_phandle (np, fsl,anatop); -- 1.7.8 -- 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 v5 00/15] Add power management support for mxs phy
Hi Felipe Shawn, The serial adds power management support for MXS PHY, it includes: - Add three common PHY APIs, .set_wakeup, .notify_suspend, notify_resume. - Related above API implementation at mxs phy driver - misc changes and bug fixes for mxs phy to support low power mode and wakeup. It is based on Greg's usb-next, 3.13-rc1. Changes for v5: Add Marc and Michael Grzeschik's commnets - typo error at [2/15] - sqhash patches which introducing mxs_phy_disconnect_line and fixed but at this function. [13/15] - Introducing flag MXS_PHY_NEED_IP_FIX who stands for the SoCs who have IC fixes. [2/15, 8/15] - Delete one patch for low speed connection problem at every rare situations due to the root cause has still not found. Changes for v4: - Using MXS_PHY_HAS_ANATOP to indicate which platform has anatop module - Using mxs_phy_data to instead of mxs_phy_platform_flag - Create is_xxx_phy() MACRO - Add imx6sl support, and pass the test [5/17] - Add one additional binding doc for compatible string [1/17] - Introduce controller id to access un-regulator register region [14/17] [15/17] - Add waiting stable time before phy clock switches to AHB clock (from 32K) [13/17] - Fix one problem that only using the 1st controller register at mxs_phy_disconnect_line [16/17] - Fix one problem for low speed connection at very rare cases [17/17] - Some typos Changes for v3: - Using flag bit to indicate SoC features/bugs, so we can remove platform_device_id. - Remove 3 unnecessary dts/doc patches due to above change - Several comment change Peter Chen (15): usb: doc: phy-mxs: Add more compatible strings usb: phy-mxs: Add platform judgement code usb: phy-mxs: Add auto clock and power setting usb: doc: phy-mxs: update binding for adding anatop phandle ARM: dts: imx6: add anatop phandle for usbphy usb: phy-mxs: Add anatop regmap usb: phy: add notify suspend and resume callback usb: phy-mxs: Add implementation of nofity_suspend and notify_resume usb: phy-mxs: Enable IC fixes for related SoCs ARM: dts: imx: add mxs phy controller id usb: phy-mxs: add controller id usb: phy: Add set_wakeup API usb: phy-mxs: Add implementation of set_wakeup usb: phy-mxs: Add system suspend/resume API usb: phy-mxs: Add sync time after controller clear phcd Documentation/devicetree/bindings/usb/mxs-phy.txt |5 +- arch/arm/boot/dts/imx23.dtsi |1 + arch/arm/boot/dts/imx28.dtsi |2 + arch/arm/boot/dts/imx6qdl.dtsi|4 + arch/arm/boot/dts/imx6sl.dtsi |4 + drivers/usb/phy/phy-mxs-usb.c | 355 - include/linux/usb/phy.h | 39 +++ 7 files changed, 395 insertions(+), 15 deletions(-) -- 1.7.8 -- 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 v5 02/15] usb: phy-mxs: Add platform judgement code
The mxs-phy has several bugs and features at different versions, the driver code can get it through of_device_id.data. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 58 ++-- 1 files changed, 49 insertions(+), 9 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 545844b..6d49040 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012-2013 Freescale Semiconductor, Inc. * Copyright (C) 2012 Marek Vasut ma...@denx.de * on behalf of DENX Software Engineering GmbH * @@ -20,6 +20,7 @@ #include linux/delay.h #include linux/err.h #include linux/io.h +#include linux/of_device.h #define DRIVER_NAME mxs_phy @@ -34,13 +35,55 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) + +/* Do disconnection between PHY and controller without vbus */ +#define MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS BIT(0) + +/* + * The PHY will be in messy if there is a wakeup after putting + * bus to suspend (set portsc.suspendM) but before setting PHY to low + * power mode (set portsc.phcd). + */ +#define MXS_PHY_ABNORMAL_IN_SUSPENDBIT(1) + +/* + * The SOF sends too fast after resuming, it will cause disconnection + * between host and high speed device. + */ +#define MXS_PHY_SENDING_SOF_TOO_FAST BIT(2) + +struct mxs_phy_data { + unsigned int flags; +}; + +static const struct mxs_phy_data imx23_phy_data = { + .flags = MXS_PHY_ABNORMAL_IN_SUSPEND | MXS_PHY_SENDING_SOF_TOO_FAST, +}; + +static const struct mxs_phy_data imx6q_phy_data = { + .flags = MXS_PHY_SENDING_SOF_TOO_FAST | + MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, +}; + +static const struct mxs_phy_data imx6sl_phy_data = { + .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, +}; + +static const struct of_device_id mxs_phy_dt_ids[] = { + { .compatible = fsl,imx6sl-usbphy, .data = imx6sl_phy_data, }, + { .compatible = fsl,imx6q-usbphy, .data = imx6q_phy_data, }, + { .compatible = fsl,imx23-usbphy, .data = imx23_phy_data, }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); + struct mxs_phy { struct usb_phy phy; struct clk *clk; + const struct mxs_phy_data *data; }; -#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) - static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -131,6 +174,8 @@ static int mxs_phy_probe(struct platform_device *pdev) struct clk *clk; struct mxs_phy *mxs_phy; int ret; + const struct of_device_id *of_id = + of_match_device(mxs_phy_dt_ids, pdev-dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(pdev-dev, res); @@ -163,6 +208,7 @@ static int mxs_phy_probe(struct platform_device *pdev) ATOMIC_INIT_NOTIFIER_HEAD(mxs_phy-phy.notifier); mxs_phy-clk = clk; + mxs_phy-data = of_id-data; platform_set_drvdata(pdev, mxs_phy); @@ -182,12 +228,6 @@ static int mxs_phy_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id mxs_phy_dt_ids[] = { - { .compatible = fsl,imx23-usbphy, }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); - static struct platform_driver mxs_phy_driver = { .probe = mxs_phy_probe, .remove = mxs_phy_remove, -- 1.7.8 -- 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 v5 14/15] usb: phy-mxs: Add system suspend/resume API
We need this to keep PHY's power on or off during the system suspend mode. If we need to enable USB wakeup, then we must keep PHY's power being on during the system suspend mode. Otherwise, we need to keep PHY's power being off to save power. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 48 + 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index f2372a8..e18fdf3 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -57,6 +57,10 @@ #define BM_USBPHY_DEBUG_CLKGATEBIT(30) /* Anatop Registers */ +#define ANADIG_ANA_MISC0 0x150 +#define ANADIG_ANA_MISC0_SET 0x154 +#define ANADIG_ANA_MISC0_CLR 0x158 + #define ANADIG_USB1_VBUS_DET_STAT 0x1c0 #define ANADIG_USB2_VBUS_DET_STAT 0x220 @@ -65,6 +69,9 @@ #define ANADIG_USB2_LOOPBACK_SET 0x244 #define ANADIG_USB2_LOOPBACK_CLR 0x248 +#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG BIT(12) +#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL BIT(11) + #define BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALIDBIT(3) #define BM_ANADIG_USB2_VBUS_DET_STAT_VBUS_VALIDBIT(3) @@ -249,6 +256,22 @@ static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) } +static void mxs_phy_enable_ldo_in_suspend(struct mxs_phy *mxs_phy, bool on) +{ + unsigned int reg = on ? ANADIG_ANA_MISC0_SET : ANADIG_ANA_MISC0_CLR; + + /* If the SoCs don't have anatop, quit */ + if (!mxs_phy-regmap_anatop) + return; + + if (is_imx6q_phy(mxs_phy)) + regmap_write(mxs_phy-regmap_anatop, reg, + BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG); + else if (is_imx6sl_phy(mxs_phy)) + regmap_write(mxs_phy-regmap_anatop, + reg, BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL); +} + static int mxs_phy_init(struct usb_phy *phy) { struct mxs_phy *mxs_phy = to_mxs_phy(phy); @@ -440,6 +463,8 @@ static int mxs_phy_probe(struct platform_device *pdev) } } + device_set_wakeup_capable(pdev-dev, true); + ret = usb_add_phy_dev(mxs_phy-phy); if (ret) return ret; @@ -456,6 +481,28 @@ static int mxs_phy_remove(struct platform_device *pdev) return 0; } +static int mxs_phy_system_suspend(struct device *dev) +{ + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + mxs_phy_enable_ldo_in_suspend(mxs_phy, true); + + return 0; +} + +static int mxs_phy_system_resume(struct device *dev) +{ + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + mxs_phy_enable_ldo_in_suspend(mxs_phy, false); + + return 0; +} + +SIMPLE_DEV_PM_OPS(mxs_phy_pm, mxs_phy_system_suspend, mxs_phy_system_resume); + static struct platform_driver mxs_phy_driver = { .probe = mxs_phy_probe, .remove = mxs_phy_remove, @@ -463,6 +510,7 @@ static struct platform_driver mxs_phy_driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, .of_match_table = mxs_phy_dt_ids, + .pm = mxs_phy_pm, }, }; -- 1.7.8 -- 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 v5 15/15] usb: phy-mxs: Add sync time after controller clear phcd
After clear portsc.phcd, PHY needs 200us stable time for switch 32K clock to AHB clock. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index e18fdf3..7ae5225 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy) return mxs_phy-data == imx6sl_phy_data; } +/* + * PHY needs some 32K cycles to switch from 32K clock to + * bus (such as AHB/AXI, etc) clock. + */ +static void mxs_phy_clock_switch(void) +{ + usleep_range(300, 400); +} + static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -276,6 +285,7 @@ static int mxs_phy_init(struct usb_phy *phy) { struct mxs_phy *mxs_phy = to_mxs_phy(phy); + mxs_phy_clock_switch(); clk_prepare_enable(mxs_phy-clk); return mxs_phy_hw_init(mxs_phy); } @@ -300,6 +310,7 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend) x-io_priv + HW_USBPHY_CTRL_SET); clk_disable_unprepare(mxs_phy-clk); } else { + mxs_phy_clock_switch(); clk_prepare_enable(mxs_phy-clk); writel(BM_USBPHY_CTRL_CLKGATE, x-io_priv + HW_USBPHY_CTRL_CLR); -- 1.7.8 -- 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 v5 13/15] usb: phy-mxs: Add implementation of set_wakeup
When we need the PHY can be waken up by external signals, we can call this API. Besides, we call mxs_phy_disconnect_line at this API to close the connection between USB PHY and controller, after that, the line state from controller is SE0. Once the PHY is out of power, without calling mxs_phy_disconnect_line, there are unknown wakeups due to dp/dm floating at device mode. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 116 + 1 files changed, 116 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 527aab0..f2372a8 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,9 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_DEBUG_SET0x54 +#define HW_USBPHY_DEBUG_CLR0x58 + #define HW_USBPHY_IP 0x90 #define HW_USBPHY_IP_SET 0x94 #define HW_USBPHY_IP_CLR 0x98 @@ -39,6 +42,9 @@ #define BM_USBPHY_CTRL_CLKGATE BIT(30) #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) #define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENVBUSCHG_WKUP BIT(23) +#define BM_USBPHY_CTRL_ENIDCHG_WKUPBIT(22) +#define BM_USBPHY_CTRL_ENDPDMCHG_WKUP BIT(21) #define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) #define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) #define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) @@ -48,6 +54,25 @@ #define BM_USBPHY_IP_FIX (BIT(17) | BIT(18)) +#define BM_USBPHY_DEBUG_CLKGATEBIT(30) + +/* Anatop Registers */ +#define ANADIG_USB1_VBUS_DET_STAT 0x1c0 +#define ANADIG_USB2_VBUS_DET_STAT 0x220 + +#define ANADIG_USB1_LOOPBACK_SET 0x1e4 +#define ANADIG_USB1_LOOPBACK_CLR 0x1e8 +#define ANADIG_USB2_LOOPBACK_SET 0x244 +#define ANADIG_USB2_LOOPBACK_CLR 0x248 + +#define BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALIDBIT(3) +#define BM_ANADIG_USB2_VBUS_DET_STAT_VBUS_VALIDBIT(3) + +#define BM_ANADIG_USB1_LOOPBACK_UTMI_DIG_TST1 BIT(2) +#define BM_ANADIG_USB1_LOOPBACK_TSTI_TX_EN BIT(5) +#define BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 BIT(2) +#define BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN BIT(5) + #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) /* Do disconnection between PHY and controller without vbus */ @@ -151,6 +176,79 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) return 0; } +/* Return true if the vbus is there */ +static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy) +{ + unsigned int vbus_value; + + if (mxs_phy-port_id == 0) + regmap_read(mxs_phy-regmap_anatop, + ANADIG_USB1_VBUS_DET_STAT, + vbus_value); + else if (mxs_phy-port_id == 1) + regmap_read(mxs_phy-regmap_anatop, + ANADIG_USB2_VBUS_DET_STAT, + vbus_value); + + if (vbus_value BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALID) + return true; + else + return false; +} + +static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) +{ + void __iomem *base = mxs_phy-phy.io_priv; + u32 reg; + + if (disconnect) + writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, + base + HW_USBPHY_DEBUG_CLR); + + if (mxs_phy-port_id == 0) { + reg = disconnect ? ANADIG_USB1_LOOPBACK_SET + : ANADIG_USB1_LOOPBACK_CLR; + regmap_write(mxs_phy-regmap_anatop, reg, + BM_ANADIG_USB1_LOOPBACK_UTMI_DIG_TST1 | + BM_ANADIG_USB1_LOOPBACK_TSTI_TX_EN); + } else if (mxs_phy-port_id == 1) { + reg = disconnect ? ANADIG_USB2_LOOPBACK_SET + : ANADIG_USB2_LOOPBACK_CLR; + regmap_write(mxs_phy-regmap_anatop, reg, + BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 | + BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN); + } + + if (!disconnect) + writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, + base + HW_USBPHY_DEBUG_SET); + + /* Delay some time, and let Linestate be SE0 for controller */ + if (disconnect) + usleep_range(500, 1000); +} + +static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) +{ + bool vbus_is_on = false; + + /* If the SoCs don't need to disconnect line without vbus, quit */ + if (!(mxs_phy-data-flags MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS)) + return; + + /* If the SoCs don't have anatop, quit */ + if (!mxs_phy-regmap_anatop) +
[PATCH v5 10/15] ARM: dts: imx: add mxs phy controller id
We need to use controller id to access different register regions for mxs phy. Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/boot/dts/imx23.dtsi |1 + arch/arm/boot/dts/imx28.dtsi |2 ++ arch/arm/boot/dts/imx6qdl.dtsi |2 ++ arch/arm/boot/dts/imx6sl.dtsi |2 ++ 4 files changed, 7 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index c96ceae..a231f3d 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi @@ -23,6 +23,7 @@ serial1 = auart1; spi0 = ssp0; spi1 = ssp1; + usbphy0 = usbphy0; }; cpus { diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index cda19c8..671dda0 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -32,6 +32,8 @@ serial4 = auart4; spi0 = ssp1; spi1 = ssp2; + usbphy0 = usbphy0; + usbphy1 = usbphy1; }; cpus { diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index 4e74962..c23803d 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -33,6 +33,8 @@ spi1 = ecspi2; spi2 = ecspi3; spi3 = ecspi4; + usbphy0 = usbphy1; + usbphy1 = usbphy2; }; intc: interrupt-controller@00a01000 { diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 30322b5..a06d939 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -27,6 +27,8 @@ spi1 = ecspi2; spi2 = ecspi3; spi3 = ecspi4; + usbphy0 = usbphy1; + usbphy1 = usbphy2; }; cpus { -- 1.7.8 -- 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 v5 11/15] usb: phy-mxs: add controller id
It is used to access un-regulator registers according to different controllers. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index d1c319b..527aab0 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -106,6 +106,7 @@ struct mxs_phy { struct clk *clk; const struct mxs_phy_data *data; struct regmap *regmap_anatop; + int port_id; }; static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy) @@ -284,6 +285,13 @@ static int mxs_phy_probe(struct platform_device *pdev) return -ENOMEM; } + ret = of_alias_get_id(np, usbphy); + if (ret 0) { + dev_err(pdev-dev, failed to get alias id, errno %d\n, ret); + return ret; + } + mxs_phy-port_id = ret; + mxs_phy-phy.io_priv= base; mxs_phy-phy.dev= pdev-dev; mxs_phy-phy.label = DRIVER_NAME; -- 1.7.8 -- 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 v5 12/15] usb: phy: Add set_wakeup API
This API is used to set wakeup enable at PHY registers, in that case, the PHY can be waken up from suspend due to external events, like vbus change, dp/dm change and id change. Signed-off-by: Peter Chen peter.c...@freescale.com --- include/linux/usb/phy.h | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index a747960..c6ebe1d 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -111,6 +111,13 @@ struct usb_phy { int (*set_suspend)(struct usb_phy *x, int suspend); + /* +* Set wakeup enable for PHY, in that case, the PHY can be +* waken up from suspend status due to external events, +* like vbus change, dp/dm change and id. +*/ + int (*set_wakeup)(struct usb_phy *x, bool enabled); + /* notify phy connect status change */ int (*notify_connect)(struct usb_phy *x, enum usb_device_speed speed); @@ -270,6 +277,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend) } static inline int +usb_phy_set_wakeup(struct usb_phy *x, bool enabled) +{ + if (x x-set_wakeup) + return x-set_wakeup(x, enabled); + else + return 0; +} + +static inline int usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) { if (x x-notify_connect) -- 1.7.8 -- 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 v5 09/15] usb: phy-mxs: Enable IC fixes for related SoCs
Some PHY bugs are fixed by IC logic, but these bits are not enabled by default, so we enable them at driver. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 28 ++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index e3df53f..d1c319b 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,10 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_IP 0x90 +#define HW_USBPHY_IP_SET 0x94 +#define HW_USBPHY_IP_CLR 0x98 + #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) @@ -42,6 +46,8 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define BM_USBPHY_IP_FIX (BIT(17) | BIT(18)) + #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) /* Do disconnection between PHY and controller without vbus */ @@ -63,6 +69,9 @@ /* The SoCs who have anatop module */ #define MXS_PHY_HAS_ANATOP BIT(3) +/* IC has bug fixes logic */ +#define MXS_PHY_NEED_IP_FIXBIT(4) + struct mxs_phy_data { unsigned int flags; }; @@ -74,12 +83,14 @@ static const struct mxs_phy_data imx23_phy_data = { static const struct mxs_phy_data imx6q_phy_data = { .flags = MXS_PHY_SENDING_SOF_TOO_FAST | MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | - MXS_PHY_HAS_ANATOP, + MXS_PHY_HAS_ANATOP | + MXS_PHY_NEED_IP_FIX, }; static const struct mxs_phy_data imx6sl_phy_data = { .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | - MXS_PHY_HAS_ANATOP, + MXS_PHY_HAS_ANATOP | + MXS_PHY_NEED_IP_FIX, }; static const struct of_device_id mxs_phy_dt_ids[] = { @@ -97,6 +108,16 @@ struct mxs_phy { struct regmap *regmap_anatop; }; +static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy) +{ + return mxs_phy-data == imx6q_phy_data; +} + +static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy) +{ + return mxs_phy-data == imx6sl_phy_data; +} + static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -123,6 +144,9 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); + if (mxs_phy-data-flags MXS_PHY_NEED_IP_FIX) + writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET); + return 0; } -- 1.7.8 -- 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 v3 04/10] usb: dwc3: use quirks to know if a particualr platform doesn't have PHY
Hi, On Thursday 05 December 2013 01:28 PM, Heikki Krogerus wrote: Hi, On Thu, Dec 05, 2013 at 12:04:46PM +0530, Kishon Vijay Abraham I wrote: On Wednesday 04 December 2013 08:10 PM, Heikki Krogerus wrote: On Mon, Nov 25, 2013 at 03:31:24PM +0530, Kishon Vijay Abraham I wrote: There can be systems which does not have an external phy, so get phy only if no quirks are added that indicates the PHY is not present. Introduced two quirk flags to indicate the *absence* of usb2 phy and usb3 phy. Also remove checking if return value is -ENXIO since it's now changed to always enable usb_phy layer. Can you guys explain why is something like this needed? Like with clocks and gpios, the device drivers shouldn't need to care any more if the platform has the phys or not. -ENODEV tells you your platform Shouldn't we report if a particular platform needs a PHY and not able to get it. How will a user know if a particular controller is not working because it's not able to get and initialize the PHYs? Don't you think in such cases it's better to fail (and return from probe) because the controller will not work anyway without the PHY? My point is that you do not need to separately tell this to the driver like you do with the quirks (if you did, then you would need to fix your framework and not hack the drivers). Like I said, ENODEV tells you that there is no phy on this platform for you, allowing you to safely continue. If your phy driver is not loaded, the framework already returns EPROBE_DEFER, right. Any other right. but that doesn't consider broken dt data. With quirks we'll able to tell if a controller in a particular platform has PHY or not without depending on the dt data. error when getting the phy you can consider critical. They are the errors telling you that you do need a phy on this platform, but something actually went wrong when getting it. Not on all scenarios though :-s Thanks Kishon -- 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] phy: core: Change the way of_phy_get is called
On Friday 06 December 2013 04:22 PM, Kamil Debski wrote: Hi, From: Kishon Vijay Abraham I [mailto:kis...@ti.com] Sent: Friday, December 06, 2013 6:31 AM Hi, On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote: Previously the of_phy_get function took a struct device * and was declared static. It was impossible to call it from another driver and thus it was impossible to get phy defined It was never intended to be called from other drivers. What's up with the wrapper of of_phy_get, phy_get()/devm_phy_get()? Why isn't that enough? Implementing support for multiple phys in the ehci driver is a bit tricky. Especially when we want to do it right. Please have a look at this part of the dts file: +ehci@1258 { +compatible = samsung,exynos4210-ehci; +reg = 0x1258 0x2; +interrupts = 0 70 0; +clocks = clock 304, clock 305; +clock-names = usbhost, otg; +status = disabled; +#address-cells = 1; +#size-cells = 0; +port@0 { +reg = 0; +phys = usb2phy 1; +phy-names = host; +status = disabled; +}; +port@1 { +reg = 1; +phys = usb2phy 2; +phy-names = hsic0; +status = disabled; +}; +port@2 { +reg = 2; +phys = usb2phy 3; +phy-names = hsic1; +status = disabled; +}; +}; With the above we have a clear specification of ports and their respective phys. But to do this properly the ehci driver has to iterate over port nodes. It is much easier to use devm_of_phy_get by giving the node as its argument. I see. There are a couple of more things we do in the wrapper that gets missed while exporting of_phy_get (get_device and try_module_get). You might want to re-work that one. Thanks Kishon -- 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: xhci_hcd debugging status, please?
On Sun, 2013-12-08 at 12:52 +0100, Udo van den Heuvel wrote: Hello, Can someone please summarise the status of the xhci_hcd debugging I found after booting into 3.12.2? I did not see these messages before and I do not yet understand the added value for a mere user of this exciting xhci technology. Can we please have them go away if really there's noting really wrong? See below for a small part of the stream of stuff that was started. You have XHCI debugging on. This is most likely a side effect of teh switch to dynamic debugging in 3.12. But this should be discussed on linux-usb. HTH Oliver -- 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 v4 3/9] phy: Add new Exynos USB PHY driver
Hi, On Friday 06 December 2013 09:58 PM, Kamil Debski wrote: Hi Kishon, Thank you for the review. From: Kishon Vijay Abraham I [mailto:kis...@ti.com] Sent: Friday, December 06, 2013 11:59 AM Hi, On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote: Add a new driver for the Exynos USB PHY. The new driver uses the generic PHY framework. The driver includes support for the Exynos 4x10 and 4x12 SoC families. Signed-off-by: Kamil Debski k.deb...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com --- snip . . diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index d0caae9..9f4befd 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -7,3 +7,6 @@ obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp- video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_PHY_SAMSUNG_USB2) += phy-samsung-usb2.o +obj-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o +obj-$(CONFIG_PHY_EXYNOS4212_USB2) += phy-exynos4212-usb2.o diff --git a/drivers/phy/phy-exynos4210-usb2.c b/drivers/phy/phy-exynos4210-usb2.c new file mode 100644 index 000..a02e5c2 --- /dev/null +++ b/drivers/phy/phy-exynos4210-usb2.c @@ -0,0 +1,264 @@ +/* + * Samsung SoC USB 1.1/2.0 PHY driver - Exynos 4210 support + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Author: Kamil Debski k.deb...@samsung.com + * + * This program is free software; you can redistribute it and/or +modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/clk.h +#include linux/delay.h +#include linux/io.h +#include linux/kernel.h +#include linux/module.h +#include linux/of.h +#include linux/of_address.h +#include linux/phy/phy.h +#include linux/platform_device.h +#include linux/regmap.h +#include linux/spinlock.h You've included most of the above header files in phy-samsung-usb2.h which you are including below. I agree that includes in phy-samsung-usb2.h could use a cleanup. On the other hand my opinion is that a .c file should include all .h files that are used in this .c file. Relaying on .h file to include another .h doesn't seem good to me. then remove it in .h file. +#include phy-samsung-usb2.h + +/* Exynos USB PHY registers */ + +/* PHY power control */ +#define EXYNOS_4210_UPHYPWR0x0 + +#define EXYNOS_4210_UPHYPWR_PHY0_SUSPEND (1 0) use BIT() here and everywhere below. snip . . +#ifdef CONFIG_PHY_EXYNOS4212_USB2 + { + .compatible = samsung,exynos4212-usb2-phy, + .data = exynos4212_usb2_phy_config, + }, +#endif + { }, +}; I think we've had enough discussion about this approach. Let's get the opinion of others too. Felipe? Greg? Good idea. Summary: We have two drivers PHY_EXYNOS4210_USB2 and PHY_EXYNOS4212_USB2 with almost similar register map [1] and a samsung helper driver for these two drivers. I would not call them separate drivers. It's a single USB 2.0 driver with the option to include support for various SoCs. This patchset adds: Exynos 4210, Exynos 4212, Exynos 5250 and S5PCV210. I know that another person is working on supporting S3C6410. These two PHY drivers populate the function pointers in the helper driver. So any phy_ops will first invoke the helper driver which will then invoke the corresponding phy driver. [1] - http://www.diffchecker.com/7yno1uvk Come on, this diff only includes the registers part of the file. The following functions are also different: - exynos421*_rate_to_clk - exynos421*_isol - exynos421*_phy_pwr - exynos421*_power_on - exynos421*_power_on But most of the differences is because your 4212 has additional features in HSIC and supports more clock rates. It seems that the file is too large for the tool. But still this makes a false impression that only registers are different. Advantages: * (more) clean and readable * helper driver can be used with other PHY drivers which will be added soon Disadvantages: * code duplication I would say that actually in this case less code is duplicated. Having Separate drivers would mean that most of the phy-samsung-usb2.c file has I actually meant a single driver for 4210 and 4212. your current code has separate drivers for different versions of the same IP. If you have a single driver for the different versions, it will lead to a lot less code duplication (hint: I've given the exact 'same' comment at-least twice in this patch). There are quite a few examples in the kernel where the same driver is used for multiple versions of the IP. to be repeated. That is 240 times 4 (and surely more in the future, as this patchset adds support for 4 SoCs). Which is almost 1000 lines more. Maybe having a helper driver makes sense when we have other samsung PHY drivers