Re: Error in queuecommand_lck: us->srb from usb_stor_control_thread
Kernel did not fail after your patch. It has thrown an error > Device offlined - not ready after error recovery And than device disappeared. Thank you! 2014-11-20 0:25 GMT+03:00 Alan Stern : > On Wed, 19 Nov 2014, Alan Stern wrote: > >> On Wed, 19 Nov 2014, Андрей Аладьев wrote: >> >> > I've tested with 3.18-rc5. It looks the same. >> >> I was able to duplicate the problem in 3.18-rc5. Give me some time to >> investigate it, and I'll get back to you. > > The patch below fixed the problem on my machine. Does it prevent all > those errors on your system? It corrects a bug that was introduced by > commit ac61d1955934. > > Alan Stern > > > > Index: 3.18-rc5/drivers/scsi/scsi_error.c > === > --- 3.18-rc5.orig/drivers/scsi/scsi_error.c > +++ 3.18-rc5/drivers/scsi/scsi_error.c > @@ -1027,7 +1027,7 @@ retry: > } > /* signal not to enter either branch of the if () below */ > timeleft = 0; > - rtn = NEEDS_RETRY; > + rtn = FAILED; > } else { > timeleft = wait_for_completion_timeout(&done, timeout); > rtn = SUCCESS; > @@ -1067,7 +1067,7 @@ retry: > rtn = FAILED; > break; > } > - } else if (!rtn) { > + } else if (rtn != FAILED) { > scsi_abort_eh_cmnd(scmd); > rtn = FAILED; > } > messages.tar.xz Description: application/xz
[GIT PULL] USB-serial fixes for v3.18-rc6
Hi Greg, Here are three bug fixes and some new device ids for 3.18-rc6. All have been in linux-next. Thanks, Johan The following changes since commit 206c5f60a3d902bc4b56dab2de3e88de5eb06108: Linux 3.18-rc4 (2014-11-09 14:55:29 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git tags/usb-serial-3.18-rc6 for you to fetch changes up to 75bcbf29c284dd0154c3e895a0bd1ef0e796160e: USB: ssu100: fix overrun-error reporting (2014-11-19 16:22:22 +0100) USB-serial fixes for v3.18-rc6 Three fixes for bugs related to TTY error reporting, which can to lead to data being dropped by the line discipline. Included is also some new device ids for ftdi_sio and cp210x. Signed-off-by: Johan Hovold Johan Hovold (3): USB: keyspan: fix tty line-status reporting USB: keyspan: fix overrun-error reporting USB: ssu100: fix overrun-error reporting Preston Fick (1): USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick Troy Clark (1): usb: serial: ftdi_sio: add PIDs for Matrix Orbital products drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/ftdi_sio.c | 33 + drivers/usb/serial/ftdi_sio_ids.h | 39 ++-- drivers/usb/serial/keyspan.c | 97 --- drivers/usb/serial/ssu100.c | 11 ++--- 5 files changed, 131 insertions(+), 50 deletions(-) -- 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] uas: Add no-uas quirk for Hitachi usb-3 enclosures 4971:1012
These disks have a broken uas implementation, the tag field of the status iu-s is not set properly, so we need to fall-back to usb-storage for these. Cc: sta...@vger.kernel.org # 3.16 Signed-off-by: Hans de Goede --- drivers/usb/storage/unusual_uas.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 2fefaf9..18a283d 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -103,3 +103,10 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x, 0x, "VL711", USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), + +/* Reported-by: Hans de Goede */ +UNUSUAL_DEV(0x4971, 0x1012, 0x, 0x, + "Hitachi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), -- 2.1.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 00/11] Exynos7: Adding USB 3.0 support
The series has dependency on a) "[PATCH v7 0/7] Enable support for Samsung Exynos7 SoC" http://www.spinics.net/lists/linux-samsung-soc/msg38734.html b) "[GIT PULL] Samsung clock changes for 3.19" - specifically the clock dt bindings header. http://comments.gmane.org/gmane.linux.kernel.samsung-soc/39142 c) "tty: serial: samsung: Clean-up selection of number of available UARTs" http://www.spinics.net/lists/linux-samsung-soc/msg37418.html d) "dts, kbuild: Implement support for dtb vendor subdirs"(merged in linux-next) https://lkml.org/lkml/2014/10/21/654 e) "Samsung pinctrl patches for v3.19" http://www.spinics.net/lists/linux-samsung-soc/msg38744.html Tested on Exynos7-espresso board with 3.18-rc5 and above dependencies. Clubbing the pinctrl, clk, and usb driver changes alongwith the dt changes together in this series only so as to avoid having 'n' number of dependencies. The USB driver patches in this series were part of [1] sent earlier. [1] [PATCH v2 0/4] usb: dwc3/phy-exynos5-usbdrd: Extend support to Exynos7 https://lkml.org/lkml/2014/10/7/191 Vivek Gautam (11): pinctrl: exynos: Add BUS1 pin controller for exynos7 dwc3: exynos: Remove local variable for clock from probe dwc3: exynos: Add provision for suspend clock dwc3: exynos: Add provision for AXI UpScaler clock on exynos7 phy: exynos5-usbdrd: Add pipe-clk, utmi-clk and itp-clk support phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply phy: exynos7-usbdrd: Update dependency for ARCH_EXYNOS clk: exynos7: Add required clock tree for USB arm64: exynos: Add bus1 pinctrl node on exynos7 arm64: dts: Enable USB 3.0 controller on exynos7 arm64: dts: exynos7-espresso: Add regulators for Vbus and Vbus-Boost .../devicetree/bindings/phy/samsung-phy.txt|6 + .../devicetree/bindings/usb/exynos-usb.txt |6 +- arch/arm64/boot/dts/exynos/exynos7-espresso.dts| 43 +++ arch/arm64/boot/dts/exynos/exynos7-pinctrl.dtsi| 26 arch/arm64/boot/dts/exynos/exynos7.dtsi| 42 ++ drivers/clk/samsung/clk-exynos7.c | 64 + drivers/phy/Kconfig|2 +- drivers/phy/phy-exynos5-usbdrd.c | 136 +--- drivers/pinctrl/samsung/pinctrl-exynos.c | 12 ++ drivers/usb/dwc3/dwc3-exynos.c | 39 +- include/dt-bindings/clock/exynos7-clk.h|9 +- 11 files changed, 354 insertions(+), 31 deletions(-) -- 1.7.10.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
[PATCH 01/11] pinctrl: exynos: Add BUS1 pin controller for exynos7
USB and Power regulator on Exynos7 require gpios available in BUS1 pin controller block. So adding the BUS1 pinctrl support. Signed-off-by: Naveen Krishna Ch Signed-off-by: Vivek Gautam Cc: Linus Walleij --- drivers/pinctrl/samsung/pinctrl-exynos.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index d5d4cfc..caca5b5 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -1300,6 +1300,13 @@ static const struct samsung_pin_bank_data exynos7_pin_banks7[] __initconst = { EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpr3", 0x0c), }; +/* pin banks of exynos7 pin-controller - BUS1 */ +static const struct samsung_pin_bank_data exynos7_pin_banks8[] __initconst = { + EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpf0", 0x00), + EXYNOS_PIN_BANK_EINTG(8, 0x0a0, "gpf4", 0x10), + EXYNOS_PIN_BANK_EINTG(6, 0x120, "gph1", 0x20), +}; + const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = { { /* pin-controller instance 0 Alive data */ @@ -1342,5 +1349,10 @@ const struct samsung_pin_ctrl exynos7_pin_ctrl[] __initconst = { .pin_banks = exynos7_pin_banks7, .nr_banks = ARRAY_SIZE(exynos7_pin_banks7), .eint_gpio_init = exynos_eint_gpio_init, + }, { + /* pin-controller instance 8 BUS1 data */ + .pin_banks = exynos7_pin_banks8, + .nr_banks = ARRAY_SIZE(exynos7_pin_banks8), + .eint_gpio_init = exynos_eint_gpio_init, }, }; -- 1.7.10.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
[PATCH 02/11] dwc3: exynos: Remove local variable for clock from probe
There's no need to keep one local variable for clock, and then assign the same to 'clk' member of dwc3_exynos. Just cleaning it up. Signed-off-by: Vivek Gautam --- drivers/usb/dwc3/dwc3-exynos.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 3951a65..7109de7 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -106,7 +106,6 @@ static int dwc3_exynos_remove_child(struct device *dev, void *unused) static int dwc3_exynos_probe(struct platform_device *pdev) { struct dwc3_exynos *exynos; - struct clk *clk; struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; @@ -133,15 +132,13 @@ static int dwc3_exynos_probe(struct platform_device *pdev) return ret; } - clk = devm_clk_get(dev, "usbdrd30"); - if (IS_ERR(clk)) { + exynos->dev = dev; + + exynos->clk = devm_clk_get(dev, "usbdrd30"); + if (IS_ERR(exynos->clk)) { dev_err(dev, "couldn't get clock\n"); return -EINVAL; } - - exynos->dev = dev; - exynos->clk = clk; - clk_prepare_enable(exynos->clk); exynos->vdd33 = devm_regulator_get(dev, "vdd33"); @@ -185,7 +182,7 @@ err4: err3: regulator_disable(exynos->vdd33); err2: - clk_disable_unprepare(clk); + clk_disable_unprepare(exynos->clk); return ret; } -- 1.7.10.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
[PATCH 03/11] dwc3: exynos: Add provision for suspend clock
DWC3 controller on Exynos SoC series have separate control for suspend clock which replaces pipe3_rx_pclk as clock source to a small part of DWC3 core that operates when SS PHY is in its lowest power state (P3) in states SS.disabled and U3. Suggested-by: Anton Tikhomirov Signed-off-by: Vivek Gautam --- drivers/usb/dwc3/dwc3-exynos.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 7109de7..af15ab3 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -35,6 +35,8 @@ struct dwc3_exynos { struct device *dev; struct clk *clk; + struct clk *susp_clk; + struct regulator*vdd33; struct regulator*vdd10; }; @@ -141,6 +143,13 @@ static int dwc3_exynos_probe(struct platform_device *pdev) } clk_prepare_enable(exynos->clk); + exynos->susp_clk = devm_clk_get(dev, "usbdrd30_susp_clk"); + if (IS_ERR(exynos->susp_clk)) { + dev_dbg(dev, "no suspend clk specified\n"); + exynos->susp_clk = NULL; + } + clk_prepare_enable(exynos->susp_clk); + exynos->vdd33 = devm_regulator_get(dev, "vdd33"); if (IS_ERR(exynos->vdd33)) { ret = PTR_ERR(exynos->vdd33); @@ -182,6 +191,7 @@ err4: err3: regulator_disable(exynos->vdd33); err2: + clk_disable_unprepare(exynos->susp_clk); clk_disable_unprepare(exynos->clk); return ret; } @@ -194,6 +204,7 @@ static int dwc3_exynos_remove(struct platform_device *pdev) platform_device_unregister(exynos->usb2_phy); platform_device_unregister(exynos->usb3_phy); + clk_disable_unprepare(exynos->susp_clk); clk_disable_unprepare(exynos->clk); regulator_disable(exynos->vdd33); -- 1.7.10.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
[PATCH 04/11] dwc3: exynos: Add provision for AXI UpScaler clock on exynos7
DWC3 controller on Exynos7 SoC has separate control for AXI UpScaler which connects DWC3 DRD controller to AXI bus. Get the gate clock for the same to control it across power cycles. Suggested-by: Anton Tikhomirov Signed-off-by: Vivek Gautam --- Documentation/devicetree/bindings/usb/exynos-usb.txt |6 -- drivers/usb/dwc3/dwc3-exynos.c | 17 + 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt b/Documentation/devicetree/bindings/usb/exynos-usb.txt index a3b5990..9b4dbe3 100644 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt @@ -82,8 +82,10 @@ Example: DWC3 Required properties: - - compatible: should be "samsung,exynos5250-dwusb3" for USB 3.0 DWC3 - controller. + - compatible: should be one of the following - + "samsung,exynos5250-dwusb3": for USB 3.0 DWC3 controller on + Exynos5250/5420. + "samsung,exynos7-dwusb3": for USB 3.0 DWC3 controller on Exynos7. - #address-cells, #size-cells : should be '1' if the device has sub-nodes with 'reg' property. - ranges: allows valid 1:1 translation between child's address space and diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index af15ab3..6ae8fe5 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -36,6 +36,7 @@ struct dwc3_exynos { struct clk *clk; struct clk *susp_clk; + struct clk *axius_clk; struct regulator*vdd33; struct regulator*vdd10; @@ -150,6 +151,17 @@ static int dwc3_exynos_probe(struct platform_device *pdev) } clk_prepare_enable(exynos->susp_clk); + if (of_device_is_compatible(node, "samsung,exynos7-dwusb3")) { + exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk"); + if (IS_ERR(exynos->axius_clk)) { + dev_err(dev, "no AXI UpScaler clk specified\n"); + return -ENODEV; + } + clk_prepare_enable(exynos->axius_clk); + } else { + exynos->axius_clk = NULL; + } + exynos->vdd33 = devm_regulator_get(dev, "vdd33"); if (IS_ERR(exynos->vdd33)) { ret = PTR_ERR(exynos->vdd33); @@ -191,6 +203,7 @@ err4: err3: regulator_disable(exynos->vdd33); err2: + clk_disable_unprepare(exynos->axius_clk); clk_disable_unprepare(exynos->susp_clk); clk_disable_unprepare(exynos->clk); return ret; @@ -204,6 +217,7 @@ static int dwc3_exynos_remove(struct platform_device *pdev) platform_device_unregister(exynos->usb2_phy); platform_device_unregister(exynos->usb3_phy); + clk_disable_unprepare(exynos->axius_clk); clk_disable_unprepare(exynos->susp_clk); clk_disable_unprepare(exynos->clk); @@ -216,6 +230,7 @@ static int dwc3_exynos_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id exynos_dwc3_match[] = { { .compatible = "samsung,exynos5250-dwusb3" }, + { .compatible = "samsung,exynos7-dwusb3" }, {}, }; MODULE_DEVICE_TABLE(of, exynos_dwc3_match); @@ -226,6 +241,7 @@ static int dwc3_exynos_suspend(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); + clk_disable(exynos->axius_clk); clk_disable(exynos->clk); regulator_disable(exynos->vdd33); @@ -251,6 +267,7 @@ static int dwc3_exynos_resume(struct device *dev) } clk_enable(exynos->clk); + clk_enable(exynos->axius_clk); /* runtime set active to reflect active state. */ pm_runtime_disable(dev); -- 1.7.10.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
[PATCH 05/11] phy: exynos5-usbdrd: Add pipe-clk, utmi-clk and itp-clk support
Exynos7 SoC has now separate gate control for 125MHz pipe3 phy clock, as well as 60MHz utmi phy clock. Additionally, separate gate control is available for the clock used for ITP (Isochronous Transfer Packet) generation. So get the same and control in the phy-exynos5-usbdrd driver. Suggested-by: Anton Tikhomirov Signed-off-by: Vivek Gautam --- .../devicetree/bindings/phy/samsung-phy.txt|6 ++ drivers/phy/phy-exynos5-usbdrd.c | 104 2 files changed, 92 insertions(+), 18 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index 15e0f2c..d5bad92 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -128,6 +128,7 @@ Required properties: - compatible : Should be set to one of the following supported values: - "samsung,exynos5250-usbdrd-phy" - for exynos5250 SoC, - "samsung,exynos5420-usbdrd-phy" - for exynos5420 SoC. + - "samsung,exynos7-usbdrd-phy" - for exynos7 SoC. - reg : Register offset and length of USB DRD PHY register set; - clocks: Clock IDs array as required by the controller - clock-names: names of clocks correseponding to IDs in the clock property; @@ -138,6 +139,11 @@ Required properties: PHY operations, associated by phy name. It is used to determine bit values for clock settings register. For Exynos5420 this is given as 'sclk_usbphy30' in CMU. + - optional clocks: Exynos7 SoC has now following additional + gate clocks available: + - phy_pipe: for PIPE3 phy + - phy_utmi: for UTMI+ phy + - itp: for ITP generation - samsung,pmu-syscon: phandle for PMU system controller interface, used to control pmu registers for power isolation. - #phy-cells : from the generic PHY bindings, must be 1; diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index f756aca..3654712 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c @@ -141,6 +141,7 @@ struct exynos5_usbdrd_phy_drvdata { const struct exynos5_usbdrd_phy_config *phy_cfg; u32 pmu_offset_usbdrd0_phy; u32 pmu_offset_usbdrd1_phy; + bool has_common_clk_gate; }; /** @@ -148,6 +149,9 @@ struct exynos5_usbdrd_phy_drvdata { * @dev: pointer to device instance of this platform device * @reg_phy: usb phy controller register memory base * @clk: phy clock for register access + * @pipeclk: clock for pipe3 phy + * @utmiclk: clock for utmi+ phy + * @itpclk: clock for ITP generation * @drv_data: pointer to SoC level driver data structure * @phys[]: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY * instances each with its 'phy' and 'phy_cfg'. @@ -155,12 +159,14 @@ struct exynos5_usbdrd_phy_drvdata { *reference clocks' for SS and HS operations * @ref_clk: reference clock to PHY block from which PHY's * operational clocks are derived - * @ref_rate: rate of above reference clock */ struct exynos5_usbdrd_phy { struct device *dev; void __iomem *reg_phy; struct clk *clk; + struct clk *pipeclk; + struct clk *utmiclk; + struct clk *itpclk; const struct exynos5_usbdrd_phy_drvdata *drv_data; struct phy_usb_instance { struct phy *phy; @@ -447,6 +453,11 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) dev_dbg(phy_drd->dev, "Request to power_on usbdrd_phy phy\n"); clk_prepare_enable(phy_drd->ref_clk); + if (!phy_drd->drv_data->has_common_clk_gate) { + clk_prepare_enable(phy_drd->pipeclk); + clk_prepare_enable(phy_drd->utmiclk); + clk_prepare_enable(phy_drd->itpclk); + } /* Enable VBUS supply */ if (phy_drd->vbus) { @@ -464,6 +475,11 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) fail_vbus: clk_disable_unprepare(phy_drd->ref_clk); + if (!phy_drd->drv_data->has_common_clk_gate) { + clk_disable_unprepare(phy_drd->itpclk); + clk_disable_unprepare(phy_drd->utmiclk); + clk_disable_unprepare(phy_drd->pipeclk); + } return ret; } @@ -483,6 +499,11 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) regulator_disable(phy_drd->vbus); clk_disable_unprepare(phy_drd->ref_clk); + if (!phy_drd->drv_data->has_common_clk_gate) { + clk_disable_unprepare(phy_drd->itpclk); + clk_disable_unprepare(phy_drd->pipeclk); + clk_disable_unprepare(phy_drd->utmiclk); + } return 0; } @@ -506,6 +527,57 @@ static struct phy_ops exynos5_usbdrd_phy_ops = { .owner = THIS_MODULE, }; +static int exyn
[PATCH 06/11] phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply
Some Exynos boards have a separate regulator controlling a Boost 5V supply which goes as input for VBUS regulator. So adding a control for the same in driver, to enable vbus supply on the port. Signed-off-by: Vivek Gautam --- drivers/phy/phy-exynos5-usbdrd.c | 32 ++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index 3654712..1f54639 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c @@ -159,6 +159,8 @@ struct exynos5_usbdrd_phy_drvdata { *reference clocks' for SS and HS operations * @ref_clk: reference clock to PHY block from which PHY's * operational clocks are derived + * vbus: VBUS regulator for phy + * vbus_boost: Boost regulator for VBUS present on few Exynos boards */ struct exynos5_usbdrd_phy { struct device *dev; @@ -178,6 +180,7 @@ struct exynos5_usbdrd_phy { u32 extrefclk; struct clk *ref_clk; struct regulator *vbus; + struct regulator *vbus_boost; }; static inline @@ -460,11 +463,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) } /* Enable VBUS supply */ + if (phy_drd->vbus_boost) { + ret = regulator_enable(phy_drd->vbus_boost); + if (ret) { + dev_err(phy_drd->dev, + "Failed to enable VBUS boost supply\n"); + goto fail_vbus; + } + } + if (phy_drd->vbus) { ret = regulator_enable(phy_drd->vbus); if (ret) { dev_err(phy_drd->dev, "Failed to enable VBUS supply\n"); - goto fail_vbus; + goto fail_vbus_boost; } } @@ -473,6 +485,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) return 0; +fail_vbus_boost: + if (phy_drd->vbus_boost) + regulator_disable(phy_drd->vbus_boost); + fail_vbus: clk_disable_unprepare(phy_drd->ref_clk); if (!phy_drd->drv_data->has_common_clk_gate) { @@ -497,6 +513,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) /* Disable VBUS supply */ if (phy_drd->vbus) regulator_disable(phy_drd->vbus); + if (phy_drd->vbus_boost) + regulator_disable(phy_drd->vbus_boost); clk_disable_unprepare(phy_drd->ref_clk); if (!phy_drd->drv_data->has_common_clk_gate) { @@ -690,7 +708,7 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) break; } - /* Get Vbus regulator */ + /* Get Vbus regulators */ phy_drd->vbus = devm_regulator_get(dev, "vbus"); if (IS_ERR(phy_drd->vbus)) { ret = PTR_ERR(phy_drd->vbus); @@ -701,6 +719,16 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) phy_drd->vbus = NULL; } + phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost"); + if (IS_ERR(phy_drd->vbus_boost)) { + ret = PTR_ERR(phy_drd->vbus_boost); + if (ret == -EPROBE_DEFER) + return ret; + + dev_warn(dev, "Failed to get VBUS boost supply regulator\n"); + phy_drd->vbus_boost = NULL; + } + dev_vdbg(dev, "Creating usbdrd_phy phy\n"); for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) { -- 1.7.10.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
[PATCH 07/11] phy: exynos7-usbdrd: Update dependency for ARCH_EXYNOS
This PHY controller is also present on Exynos7 platform in arch-exynos family. So PHY_EXYNOS5_USBDRD should now depend on ARCH_EXYNOS. Signed-off-by: Vivek Gautam --- drivers/phy/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2a436e6..1514e40 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -193,7 +193,7 @@ config PHY_EXYNOS5250_USB2 config PHY_EXYNOS5_USBDRD tristate "Exynos5 SoC series USB DRD PHY driver" - depends on ARCH_EXYNOS5 && OF + depends on ARCH_EXYNOS && OF depends on HAS_IOMEM depends on USB_DWC3_EXYNOS select GENERIC_PHY -- 1.7.10.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
[PATCH 08/11] clk: exynos7: Add required clock tree for USB
Adding required gate clocks for USB3.0 DRD controller present on Exynos7. Signed-off-by: Vivek Gautam --- drivers/clk/samsung/clk-exynos7.c | 64 +++ include/dt-bindings/clock/exynos7-clk.h |9 - 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/clk/samsung/clk-exynos7.c b/drivers/clk/samsung/clk-exynos7.c index ea4483b..3128593 100644 --- a/drivers/clk/samsung/clk-exynos7.c +++ b/drivers/clk/samsung/clk-exynos7.c @@ -343,6 +343,8 @@ static struct samsung_mux_clock top1_mux_clks[] __initdata = { MUX(0, "mout_aclk_fsys0_200", mout_top1_group1, MUX_SEL_TOP13, 28, 2), MUX(0, "mout_sclk_mmc2", mout_top1_group1, MUX_SEL_TOP1_FSYS0, 24, 2), + MUX(0, "mout_sclk_usbdrd300", mout_top1_group1, + MUX_SEL_TOP1_FSYS0, 28, 2), MUX(0, "mout_sclk_mmc1", mout_top1_group1, MUX_SEL_TOP1_FSYS1, 24, 2), MUX(0, "mout_sclk_mmc0", mout_top1_group1, MUX_SEL_TOP1_FSYS1, 28, 2), @@ -356,6 +358,8 @@ static struct samsung_div_clock top1_div_clks[] __initdata = { DIV(DOUT_SCLK_MMC2, "dout_sclk_mmc2", "mout_sclk_mmc2", DIV_TOP1_FSYS0, 24, 4), + DIV(0, "dout_sclk_usbdrd300", "mout_sclk_usbdrd300", + DIV_TOP1_FSYS0, 28, 4), DIV(DOUT_SCLK_MMC1, "dout_sclk_mmc1", "mout_sclk_mmc1", DIV_TOP1_FSYS1, 24, 4), @@ -366,6 +370,8 @@ static struct samsung_div_clock top1_div_clks[] __initdata = { static struct samsung_gate_clock top1_gate_clks[] __initdata = { GATE(CLK_SCLK_MMC2, "sclk_mmc2", "dout_sclk_mmc2", ENABLE_SCLK_TOP1_FSYS0, 24, CLK_SET_RATE_PARENT, 0), + GATE(0, "sclk_usbdrd300", "dout_sclk_usbdrd300", + ENABLE_SCLK_TOP1_FSYS0, 28, 0, 0), GATE(CLK_SCLK_MMC1, "sclk_mmc1", "dout_sclk_mmc1", ENABLE_SCLK_TOP1_FSYS1, 24, CLK_SET_RATE_PARENT, 0), @@ -647,7 +653,12 @@ CLK_OF_DECLARE(exynos7_clk_peris, "samsung,exynos7-clock-peris", /* Register Offset definitions for CMU_FSYS0 (0x10E9) */ #define MUX_SEL_FSYS00 0x0200 #define MUX_SEL_FSYS01 0x0204 +#define MUX_SEL_FSYS02 0x0208 +#define ENABLE_ACLK_FSYS00 0x0800 #define ENABLE_ACLK_FSYS01 0x0804 +#define ENABLE_SCLK_FSYS01 0x0A04 +#define ENABLE_SCLK_FSYS02 0x0A08 +#define ENABLE_SCLK_FSYS04 0x0A10 /* * List of parent clocks for Muxes in CMU_FSYS0 @@ -655,10 +666,29 @@ CLK_OF_DECLARE(exynos7_clk_peris, "samsung,exynos7-clock-peris", PNAME(mout_aclk_fsys0_200_p) = { "fin_pll", "dout_aclk_fsys0_200" }; PNAME(mout_sclk_mmc2_p)= { "fin_pll", "sclk_mmc2" }; +PNAME(mout_sclk_usbdrd300_p) = { "fin_pll", "sclk_usbdrd300" }; +PNAME(mout_phyclk_usbdrd300_udrd30_phyclk_p) = { "fin_pll", + "phyclk_usbdrd300_udrd30_phyclock" }; +PNAME(mout_phyclk_usbdrd300_udrd30_pipe_pclk_p)= { "fin_pll", + "phyclk_usbdrd300_udrd30_pipe_pclk" }; + +/* fixed rate clocks used in the FSYS0 block */ +struct samsung_fixed_rate_clock fixed_rate_clks_fsys0[] __initdata = { + FRATE(0, "phyclk_usbdrd300_udrd30_phyclock", NULL, + CLK_IS_ROOT, 6000), + FRATE(0, "phyclk_usbdrd300_udrd30_pipe_pclk", NULL, + CLK_IS_ROOT, 12500), +}; + static unsigned long fsys0_clk_regs[] __initdata = { MUX_SEL_FSYS00, MUX_SEL_FSYS01, + MUX_SEL_FSYS02, + ENABLE_ACLK_FSYS00, ENABLE_ACLK_FSYS01, + ENABLE_SCLK_FSYS01, + ENABLE_SCLK_FSYS02, + ENABLE_SCLK_FSYS04, }; static struct samsung_mux_clock fsys0_mux_clks[] __initdata = { @@ -666,11 +696,45 @@ static struct samsung_mux_clock fsys0_mux_clks[] __initdata = { MUX_SEL_FSYS00, 24, 1), MUX(0, "mout_sclk_mmc2_user", mout_sclk_mmc2_p, MUX_SEL_FSYS01, 24, 1), + MUX(0, "mout_sclk_usbdrd300_user", mout_sclk_usbdrd300_p, + MUX_SEL_FSYS01, 28, 1), + + MUX(0, "mout_phyclk_usbdrd300_udrd30_pipe_pclk_user", + mout_phyclk_usbdrd300_udrd30_pipe_pclk_p, + MUX_SEL_FSYS02, 24, 1), + MUX(0, "mout_phyclk_usbdrd300_udrd30_phyclk_user", + mout_phyclk_usbdrd300_udrd30_phyclk_p, + MUX_SEL_FSYS02, 28, 1), }; static struct samsung_gate_clock fsys0_gate_clks[] __initdata = { + GATE(ACLK_AXIUS_USBDRD30X_FSYS0X, "aclk_axius_usbdrd30x_fsys0x", + "mout_aclk_fsys0_200_user", + ENABLE_ACLK_FSYS00, 19, 0, 0), + + GATE(ACLK_USBDRD300, "aclk_usbdrd300", "mout_aclk_fsys0_200_user", + ENABLE_ACLK_FSYS01, 29, 0, 0), GATE(ACLK_MMC2, "aclk_mmc2", "mout_aclk_fsys0_200_user", ENABLE_ACLK_FSYS01, 31, 0, 0), + + GATE(SCLK_USBDRD300_SUSPENDCLK, "sclk_usbdrd300_suspendclk", + "mout_sclk_usbdrd300_user", + ENABLE_SCLK_FSYS01, 4, 0, 0), + GA
[PATCH 09/11] arm64: exynos: Add bus1 pinctrl node on exynos7
BUS1 pinctrl provides gpios for usb and power regulator available on exynos7-espresso board. So add relevant device node for pinctrl-bus1. Signed-off-by: Naveen Krishna Ch Signed-off-by: Vivek Gautam --- arch/arm64/boot/dts/exynos/exynos7-pinctrl.dtsi | 26 +++ arch/arm64/boot/dts/exynos/exynos7.dtsi |7 ++ 2 files changed, 33 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos7-pinctrl.dtsi b/arch/arm64/boot/dts/exynos/exynos7-pinctrl.dtsi index 2eef4a2..9648e03 100644 --- a/arch/arm64/boot/dts/exynos/exynos7-pinctrl.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7-pinctrl.dtsi @@ -335,6 +335,32 @@ }; }; +&pinctrl_bus1 { + gpf0: gpf0 { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpf4: gpf4 { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gph1: gph1 { + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; +}; + &pinctrl_nfc { gpj0: gpj0 { gpio-controller; diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi index d7a37c3..90048b2 100644 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi @@ -26,6 +26,7 @@ pinctrl5 = &pinctrl_ese; pinctrl6 = &pinctrl_fsys0; pinctrl7 = &pinctrl_fsys1; + pinctrl8 = &pinctrl_bus1; }; cpus { @@ -242,6 +243,12 @@ interrupts = <0 383 0>; }; + pinctrl_bus1: pinctrl@1487 { + compatible = "samsung,exynos7-pinctrl"; + reg = <0x1487 0x1000>; + interrupts = <0 384 0>; + }; + pinctrl_nfc: pinctrl@14cd { compatible = "samsung,exynos7-pinctrl"; reg = <0x14cd 0x1000>; -- 1.7.10.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
[PATCH 10/11] arm64: dts: Enable USB 3.0 controller on exynos7
Adding USB 3.0 DRD controller device node, with its clock and phy information to enable using the same on Exynos7. Signed-off-by: Vivek Gautam --- arch/arm64/boot/dts/exynos/exynos7.dtsi | 35 +++ 1 file changed, 35 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi index 90048b2..e633b02 100644 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi @@ -531,6 +531,41 @@ clocks = <&clock_peric0 PCLK_PWM>; clock-names = "timers"; }; + + usbdrd3: usb@1540 { + compatible = "samsung,exynos7-dwusb3"; + clocks = <&clock_fsys0 ACLK_USBDRD300>, +<&clock_fsys0 SCLK_USBDRD300_SUSPENDCLK>, +<&clock_fsys0 ACLK_AXIUS_USBDRD30X_FSYS0X>; + clock-names = "usbdrd30", "usbdrd30_susp_clk", + "usbdrd30_axius_clk"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + dwc3 { + compatible = "snps,dwc3"; + reg = <0x1540 0x1>; + interrupts = <0 223 0>; + phys = <&usbdrd_phy 0>, <&usbdrd_phy 1>; + phy-names = "usb2-phy", "usb3-phy"; + }; + }; + + usbdrd_phy: phy@1550 { + compatible = "samsung,exynos7-usbdrd-phy"; + reg = <0x1550 0x100>; + clocks = + <&clock_fsys0 ACLK_USBDRD300>, + <&clock_fsys0 OSCCLK_PHY_CLKOUT_USB30_PHY>, + <&clock_fsys0 PHYCLK_USBDRD300_UDRD30_PIPE_PCLK_USER>, + <&clock_fsys0 PHYCLK_USBDRD300_UDRD30_PHYCLK_USER>, + <&clock_fsys0 SCLK_USBDRD300_REFCLK>; + clock-names = "phy", "ref", "phy_pipe", "phy_utmi", + "itp"; + samsung,pmu-syscon = <&pmu_system_controller>; + #phy-cells = <1>; + }; }; }; -- 1.7.10.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
[PATCH 11/11] arm64: dts: exynos7-espresso: Add regulators for Vbus and Vbus-Boost
Adding fixed voltage regulators for Vbus and Vbus-boost required by USB 3.0 DRD controller on Exynos7-espresso board. Signed-off-by: Vivek Gautam --- arch/arm64/boot/dts/exynos/exynos7-espresso.dts | 43 +++ 1 file changed, 43 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts index 5424cc4..2dedd5e 100644 --- a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts +++ b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts @@ -30,6 +30,28 @@ device_type = "memory"; reg = <0x0 0x4000 0x0 0xC000>; }; + + usb30_vbus_reg: regulator-usb30 { + compatible = "regulator-fixed"; + regulator-name = "VBUS_5V"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + gpio = <&gph1 1 0>; + pinctrl-names = "default"; + pinctrl-0 = <&usb30_vbus_en>; + enable-active-high; + }; + + usb3drd_vboost_5v: regulator-usb3drd-vboost { + compatible = "regulator-fixed"; + regulator-name = "VUSB_VBUS_5V"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + gpio = <&gpf4 1 0>; + pinctrl-names = "default"; + pinctrl-0 = <&usb3drd_vboost_en>; + enable-active-high; + }; }; &fin_pll { @@ -40,6 +62,22 @@ status = "okay"; }; +&pinctrl_bus1 { + usb30_vbus_en: usb30-vbus-en { + samsung,pins = "gph1-1"; + samsung,pin-function = <1>; + samsung,pin-pud = <0>; + samsung,pin-drv = <0>; + }; + + usb3drd_vboost_en: usb3drd-vboost-en { + samsung,pins = "gpf4-1"; + samsung,pin-function = <1>; + samsung,pin-pud = <0>; + samsung,pin-drv = <0>; + }; +}; + &rtc { status = "okay"; }; @@ -82,3 +120,8 @@ bus-width = <4>; disable-wp; }; + +&usbdrd_phy { + vbus-supply = <&usb30_vbus_reg>; + vbus-boost-supply = <&usb3drd_vboost_5v>; +}; -- 1.7.10.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
[PATCH 1/1] USB: gadget: function: Deletion of an unnecessary check before the function call "rndis_add_hdr"
From: Markus Elfring Date: Fri, 21 Nov 2014 14:51:43 +0100 The rndis_add_hdr() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/usb/gadget/function/f_rndis.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index ddb09dc..da56a5f 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -375,8 +375,7 @@ static struct sk_buff *rndis_add_header(struct gether *port, struct sk_buff *skb2; skb2 = skb_realloc_headroom(skb, sizeof(struct rndis_packet_msg_type)); - if (skb2) - rndis_add_hdr(skb2); + rndis_add_hdr(skb2); dev_kfree_skb(skb); return skb2; -- 2.1.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
[PATCH v6 1/3] usb: dwc2/gadget: rework disconnect event handling
This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. DISCONNINT interrupt cannot be used for this purpose, because it is asserted only in host mode. To avoid reporting disconnect event more than once, a disconnect call has been moved from USB_REQ_SET_ADDRESS handling function to SESSREQINT interrupt. This way driver ensures that disconnect event is reported either when usb cable is unplugged or every time the host starts a new session. To handle devices which has been synthesized without SRP support, connected state is set in ENUMDONE interrupt. Signed-off-by: Marek Szyprowski Acked-by: Paul Zimmerman --- drivers/usb/dwc2/core.h | 3 +++ drivers/usb/dwc2/core_intr.c | 9 + drivers/usb/dwc2/gadget.c| 10 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 4710935fbad3..2cb0ac31ae86 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -687,6 +687,7 @@ struct dwc2_hsotg { u8 ctrl_buff[8]; struct usb_gadget gadget; + unsigned int connected:1; unsigned int setup; unsigned long last_rst; struct s3c_hsotg_ep *eps; @@ -968,6 +969,7 @@ extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2); extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq); extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2); extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg); +extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2); #else static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) { return 0; } @@ -979,6 +981,7 @@ static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) { return 0; } static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2) {} static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {} +static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {} #endif #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index b176c2fc34e5..ad43c5bc1ef1 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -128,6 +128,9 @@ static void dwc2_handle_otg_intr(struct dwc2_hsotg *hsotg) dwc2_op_state_str(hsotg)); gotgctl = readl(hsotg->regs + GOTGCTL); + if (dwc2_is_device_mode(hsotg)) + s3c_hsotg_disconnect(hsotg); + if (hsotg->op_state == OTG_STATE_B_HOST) { hsotg->op_state = OTG_STATE_B_PERIPHERAL; } else { @@ -314,6 +317,12 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) /* Clear interrupt */ writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS); + + /* +* Report disconnect if there is any previous session established +*/ + if (dwc2_is_device_mode(hsotg)) + s3c_hsotg_disconnect(hsotg); } /* diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 685527b58bde..c0673ad4c4ad 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1030,7 +1030,6 @@ static int s3c_hsotg_process_req_feature(struct dwc2_hsotg *hsotg, } static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg *hsotg); -static void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg); /** * s3c_hsotg_stall_ep0 - stall ep0 @@ -1108,7 +1107,6 @@ static void s3c_hsotg_process_control(struct dwc2_hsotg *hsotg, if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { switch (ctrl->bRequest) { case USB_REQ_SET_ADDRESS: - s3c_hsotg_disconnect(hsotg); dcfg = readl(hsotg->regs + DCFG); dcfg &= ~DCFG_DEVADDR_MASK; dcfg |= (le16_to_cpu(ctrl->wValue) << @@ -2028,15 +2026,20 @@ static void kill_all_requests(struct dwc2_hsotg *hsotg, * transactions and signal the gadget driver that this * has happened. */ -static void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg) +void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg) { unsigned ep; + if (!hsotg->connected) + return; + + hsotg->connected = 0; for (ep = 0; ep < hsotg->num_of_eps; ep++) kill_all_requests(hsotg, &hsotg->eps[ep], -ESHUTDOWN, true); call_gadget(hsotg, disconnect); } +EXPORT_SYMBOL_GPL(s3c_hsotg_disconnect); /** * s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler @@ -2289,6 +2292,7 @@ irq_retry: writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS); s3c_hsotg_irq_enumdone(hsotg); + hsotg->connected = 1; } if (gintsts & (GINTSTS_OEPINT | GINTSTS_IEPINT)) { -- 1.9.2 -- To unsubscribe from this
[PATCH v6 2/3] usb: dwc2/gadget: add mutex to serialize init/deinit calls
This patch adds mutex, which protects initialization and deinitialization procedures against suspend/resume methods. This mutex will be needed by the updated suspend/resume calls, which tracks gadget state. Signed-off-by: Marek Szyprowski Acked-by: Paul Zimmerman --- drivers/usb/dwc2/core.h | 1 + drivers/usb/dwc2/gadget.c | 19 +++ drivers/usb/dwc2/platform.c | 2 ++ 3 files changed, 22 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 2cb0ac31ae86..6b197550c133 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -576,6 +576,7 @@ struct dwc2_hsotg { struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; spinlock_t lock; + struct mutex init_mutex; void *priv; int irq; struct clk *clk; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index c0673ad4c4ad..baba8a862826 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -2866,6 +2867,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, return -EINVAL; } + mutex_lock(&hsotg->init_mutex); WARN_ON(hsotg->driver); driver->driver.bus = NULL; @@ -2891,9 +2893,12 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name); + mutex_unlock(&hsotg->init_mutex); + return 0; err: + mutex_unlock(&hsotg->init_mutex); hsotg->driver = NULL; return ret; } @@ -2914,6 +2919,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) if (!hsotg) return -ENODEV; + mutex_lock(&hsotg->init_mutex); + /* all endpoints should be shutdown */ for (ep = 1; ep < hsotg->num_of_eps; ep++) s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); @@ -2931,6 +2938,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) clk_disable(hsotg->clk); + mutex_unlock(&hsotg->init_mutex); + return 0; } @@ -2959,6 +2968,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on); + mutex_lock(&hsotg->init_mutex); spin_lock_irqsave(&hsotg->lock, flags); if (is_on) { clk_enable(hsotg->clk); @@ -2970,6 +2980,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) hsotg->gadget.speed = USB_SPEED_UNKNOWN; spin_unlock_irqrestore(&hsotg->lock, flags); + mutex_unlock(&hsotg->init_mutex); return 0; } @@ -3572,6 +3583,8 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) unsigned long flags; int ret = 0; + mutex_lock(&hsotg->init_mutex); + if (hsotg->driver) dev_info(hsotg->dev, "suspending usb gadget %s\n", hsotg->driver->driver.name); @@ -3594,6 +3607,8 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) clk_disable(hsotg->clk); } + mutex_unlock(&hsotg->init_mutex); + return ret; } EXPORT_SYMBOL_GPL(s3c_hsotg_suspend); @@ -3603,6 +3618,8 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) unsigned long flags; int ret = 0; + mutex_lock(&hsotg->init_mutex); + if (hsotg->driver) { dev_info(hsotg->dev, "resuming usb gadget %s\n", hsotg->driver->driver.name); @@ -3619,6 +3636,8 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) s3c_hsotg_core_connect(hsotg); spin_unlock_irqrestore(&hsotg->lock, flags); + mutex_unlock(&hsotg->init_mutex); + return ret; } EXPORT_SYMBOL_GPL(s3c_hsotg_resume); diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 57eb8a3e022b..ec5658ac52ba 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -212,6 +213,7 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node); spin_lock_init(&hsotg->lock); + mutex_init(&hsotg->init_mutex); retval = dwc2_gadget_init(hsotg, irq); if (retval) return retval; -- 1.9.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 v6 3/3] usb: dwc2/gadget: rework suspend/resume code to correctly restore gadget state
Suspend/resume code assumed that the gadget was always started and enabled to connect to usb bus. This means that the actual state of the gadget (started/stopped or connected/disconnected) was not correctly preserved on suspend/resume cycle. This patch fixes this issue. Signed-off-by: Marek Szyprowski --- Since hsotg->driver is always set in udc_start and cleared in udc_stop, it has been also used to track if gadget has been start (in previous version a 'enabled' bool entry was used for this purpose). Because 'connected' bool entry has been used to track usb cable connection state, to aboid confusion, I reused 'enable' bool entry to track soft-disconnect mode. --- drivers/usb/dwc2/core.h | 3 ++- drivers/usb/dwc2/gadget.c | 39 ++- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 6b197550c133..7a70a1349334 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -688,8 +688,9 @@ struct dwc2_hsotg { u8 ctrl_buff[8]; struct usb_gadget gadget; + unsigned int enabled:1; unsigned int connected:1; - unsigned int setup; + unsigned int setup:1; unsigned long last_rst; struct s3c_hsotg_ep *eps; #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index baba8a862826..1ecc5ac16244 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2889,6 +2889,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, spin_lock_irqsave(&hsotg->lock, flags); s3c_hsotg_init(hsotg); s3c_hsotg_core_init_disconnected(hsotg); + hsotg->enabled = 0; spin_unlock_irqrestore(&hsotg->lock, flags); dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name); @@ -2929,6 +2930,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) hsotg->driver = NULL; hsotg->gadget.speed = USB_SPEED_UNKNOWN; + hsotg->enabled = 0; spin_unlock_irqrestore(&hsotg->lock, flags); @@ -2972,9 +2974,11 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) spin_lock_irqsave(&hsotg->lock, flags); if (is_on) { clk_enable(hsotg->clk); + hsotg->enabled = 1; s3c_hsotg_core_connect(hsotg); } else { s3c_hsotg_core_disconnect(hsotg); + hsotg->enabled = 0; clk_disable(hsotg->clk); } @@ -3585,20 +3589,21 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) mutex_lock(&hsotg->init_mutex); - if (hsotg->driver) + if (hsotg->driver) { + int ep; + dev_info(hsotg->dev, "suspending usb gadget %s\n", hsotg->driver->driver.name); - spin_lock_irqsave(&hsotg->lock, flags); - s3c_hsotg_core_disconnect(hsotg); - s3c_hsotg_disconnect(hsotg); - hsotg->gadget.speed = USB_SPEED_UNKNOWN; - spin_unlock_irqrestore(&hsotg->lock, flags); + spin_lock_irqsave(&hsotg->lock, flags); + if (hsotg->enabled) + s3c_hsotg_core_disconnect(hsotg); + s3c_hsotg_disconnect(hsotg); + hsotg->gadget.speed = USB_SPEED_UNKNOWN; + spin_unlock_irqrestore(&hsotg->lock, flags); - s3c_hsotg_phy_disable(hsotg); + s3c_hsotg_phy_disable(hsotg); - if (hsotg->driver) { - int ep; for (ep = 0; ep < hsotg->num_of_eps; ep++) s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); @@ -3626,16 +3631,16 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) clk_enable(hsotg->clk); ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies), - hsotg->supplies); - } - - s3c_hsotg_phy_enable(hsotg); + hsotg->supplies); - spin_lock_irqsave(&hsotg->lock, flags); - s3c_hsotg_core_init_disconnected(hsotg); - s3c_hsotg_core_connect(hsotg); - spin_unlock_irqrestore(&hsotg->lock, flags); + s3c_hsotg_phy_enable(hsotg); + spin_lock_irqsave(&hsotg->lock, flags); + s3c_hsotg_core_init_disconnected(hsotg); + if (hsotg->enabled) + s3c_hsotg_core_connect(hsotg); + spin_unlock_irqrestore(&hsotg->lock, flags); + } mutex_unlock(&hsotg->init_mutex); return ret; -- 1.9.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 1/1] USB: PCI-quirks: Deletion of unnecessary checks before the function call "pci_dev_put"
From: Markus Elfring Date: Fri, 21 Nov 2014 15:20:12 +0100 The pci_dev_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/usb/host/pci-quirks.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 2f3aceb..dd483c1 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -233,10 +233,8 @@ commit: spin_unlock_irqrestore(&amd_lock, flags); - if (info.nb_dev) - pci_dev_put(info.nb_dev); - if (info.smbus_dev) - pci_dev_put(info.smbus_dev); + pci_dev_put(info.nb_dev); + pci_dev_put(info.smbus_dev); } else { /* no race - commit the result */ @@ -447,10 +445,8 @@ void usb_amd_dev_put(void) spin_unlock_irqrestore(&amd_lock, flags); - if (nb) - pci_dev_put(nb); - if (smbus) - pci_dev_put(smbus); + pci_dev_put(nb); + pci_dev_put(smbus); } EXPORT_SYMBOL_GPL(usb_amd_dev_put); -- 2.1.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
[PATCH 1/1] USB-SIS: Deletion of an unnecessary check before the function call "usb_put_dev"
From: Markus Elfring Date: Fri, 21 Nov 2014 15:50:44 +0100 The usb_put_dev() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/usb/misc/sisusbvga/sisusb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 633caf6..022dc00 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c @@ -2472,8 +2472,7 @@ sisusb_delete(struct kref *kref) if (!sisusb) return; - if (sisusb->sisusb_dev) - usb_put_dev(sisusb->sisusb_dev); + usb_put_dev(sisusb->sisusb_dev); sisusb->sisusb_dev = NULL; sisusb_free_buffers(sisusb); -- 2.1.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] usb: gagdet: f_midi: fix parameter assignment
On Fri, Nov 21, 2014 at 01:00:30AM +0100, Daniel Mack wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 11/20/2014 08:49 PM, Felipe Balbi wrote: > > On Tue, Nov 18, 2014 at 11:21:17PM +0100, Daniel Mack wrote: > >> f_midi_register_card() uses midi->id and midi->index, so they > >> need to be assigned before the function is called from > >> f_midi_bind_config(). Move the assigment of midi->buflen and > >> midi->qlen as well so they are all grouped. > >> > >> Compile tested only. > >> > >> Signed-off-by: Daniel Mack > > > > doesn't apply: > > > > checking file drivers/usb/gadget/function/f_midi.c Hunk #1 FAILED > > at 954. Hunk #2 FAILED at 965. 2 out of 2 hunks FAILED > > > > can you rebase on my testing/next ? > > Ah, I thought for a fix like this, your 'fixes' branch is enough. > > In your testing/next, the code looks quite different, and if I read > that correctly, the bug is already fixed there. Guess you can just > drop the patch then :) very well, then :-) cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb:phy: propagate __of_usb_find_phy()'s error on failure
On Fri, Nov 21, 2014 at 12:19:42PM +0530, Arjun Sreedharan wrote: > On 21 November 2014 01:09, Felipe Balbi wrote: > > > On Thu, Nov 20, 2014 at 09:23:36PM +0530, Arjun Sreedharan wrote: > > > When __of_usb_find_phy() fails, it returns -ENODEV - its > > > error code has to be returned by devm_usb_get_phy_by_phandle(). > > > Only when the former function succeeds and try_module_get() > > > fails should -EPROBE_DEFER be returned. > > > > > > Signed-off-by: Arjun Sreedharan > > > --- > > > drivers/usb/phy/phy.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c > > > index 045cd30..0310112 100644 > > > --- a/drivers/usb/phy/phy.c > > > +++ b/drivers/usb/phy/phy.c > > > @@ -191,7 +191,9 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct > > device *dev, > > > > > > phy = __of_usb_find_phy(node); > > > if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { > > > - phy = ERR_PTR(-EPROBE_DEFER); > > > + if (!IS_ERR(phy)) > > > + phy = ERR_PTR(-EPROBE_DEFER); > > > + > > > > trailing whitespace here. I'll fix it myself this time, but next time be > > more careful. > > > > sorry about that. my bloody vi. thanks add these to your .vimrc :-) " Highlight redundant whitespaces highlight RedundantWhitespace ctermbg=red guibg=red match RedundantWhitespace /\s\+$\| \+\ze\t/ -- balbi signature.asc Description: Digital signature
Re: [PATCH 00/11] Exynos7: Adding USB 3.0 support
On Fri, Nov 21, 2014 at 07:05:43PM +0530, Vivek Gautam wrote: > The series has dependency on > a) "[PATCH v7 0/7] Enable support for Samsung Exynos7 SoC" >http://www.spinics.net/lists/linux-samsung-soc/msg38734.html > b) "[GIT PULL] Samsung clock changes for 3.19" - specifically the clock dt >bindings header. >http://comments.gmane.org/gmane.linux.kernel.samsung-soc/39142 > c) "tty: serial: samsung: Clean-up selection of number of available UARTs" >http://www.spinics.net/lists/linux-samsung-soc/msg37418.html > d) "dts, kbuild: Implement support for dtb vendor subdirs"(merged in > linux-next) >https://lkml.org/lkml/2014/10/21/654 > e) "Samsung pinctrl patches for v3.19" >http://www.spinics.net/lists/linux-samsung-soc/msg38744.html > > Tested on Exynos7-espresso board with 3.18-rc5 and above dependencies. > > Clubbing the pinctrl, clk, and usb driver changes alongwith the dt changes > together in this series only so as to avoid having 'n' number of dependencies. > > The USB driver patches in this series were part of [1] sent earlier. > [1] [PATCH v2 0/4] usb: dwc3/phy-exynos5-usbdrd: Extend support to Exynos7 > https://lkml.org/lkml/2014/10/7/191 I took dwc3 driver patches. -- balbi signature.asc Description: Digital signature
Re: [PATCH v1 2/3] usb: phy: Handle per-PHY event for connect and disconnect events
On Fri, Nov 21, 2014 at 11:31:21AM +0530, Kiran Raparthy wrote: > usb: phy: Handle per-PHY event for connnect and disconnect events > > When usb is connected and enumerated in device mode or when usb is > disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event. > > Cc: Felipe Balbi > Cc: Greg Kroah-Hartman > Cc: linux-ker...@vger.kernel.org > Cc: linux-usb@vger.kernel.org > Cc: Android Kernel Team > Cc: John Stultz > Cc: Sumit Semwal > Cc: Arve Hj�nnev�g > Cc: Benoit Goby > [Original patch in Android from Todd] > Cc: Todd Poynor > Signed-off-by: Kiran Raparthy this patch doesn't apply, please rebase entire series on my testing/next. -- balbi signature.asc Description: Digital signature
[PATCH 1/1] USB: serial: Deletion of an unnecessary check before the function call "release_firmware"
From: Markus Elfring Date: Fri, 21 Nov 2014 16:15:34 +0100 The release_firmware() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/usb/serial/mxuport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c index ab1d690..3653ec1 100644 --- a/drivers/usb/serial/mxuport.c +++ b/drivers/usb/serial/mxuport.c @@ -1101,8 +1101,7 @@ static int mxuport_probe(struct usb_serial *serial, */ usb_set_serial_data(serial, (void *)id->driver_info); out: - if (fw_p) - release_firmware(fw_p); + release_firmware(fw_p); return err; } -- 2.1.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 1/1] USB: serial: Deletion of an unnecessary check before the function call "release_firmware"
On Fri, 21 Nov 2014, SF Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 21 Nov 2014 16:15:34 +0100 > > The release_firmware() function tests whether its argument is NULL > and then returns immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/usb/serial/mxuport.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c > index ab1d690..3653ec1 100644 > --- a/drivers/usb/serial/mxuport.c > +++ b/drivers/usb/serial/mxuport.c > @@ -1101,8 +1101,7 @@ static int mxuport_probe(struct usb_serial *serial, >*/ > usb_set_serial_data(serial, (void *)id->driver_info); > out: > - if (fw_p) > - release_firmware(fw_p); > + release_firmware(fw_p); I think that the if should stay. There were two cases on the allocation, so there should be two cases on the release. julia > return err; > } > > -- > 2.1.3 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- 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/1] USB-IP: Deletion of unnecessary checks before the function call "usb_put_dev"
From: Markus Elfring Date: Fri, 21 Nov 2014 16:33:18 +0100 The usb_put_dev() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/usb/usbip/vhci_hcd.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index c02374b..cc1b03e 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -518,8 +518,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, dev_info(dev, "SetAddress Request (%d) to port %d\n", ctrlreq->wValue, vdev->rhport); - if (vdev->udev) - usb_put_dev(vdev->udev); + usb_put_dev(vdev->udev); vdev->udev = usb_get_dev(urb->dev); spin_lock(&vdev->ud.lock); @@ -539,8 +538,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, usbip_dbg_vhci_hc( "Not yet?:Get_Descriptor to device 0 (get max pipe size)\n"); - if (vdev->udev) - usb_put_dev(vdev->udev); + usb_put_dev(vdev->udev); vdev->udev = usb_get_dev(urb->dev); goto out; @@ -831,8 +829,7 @@ static void vhci_device_reset(struct usbip_device *ud) vdev->speed = 0; vdev->devid = 0; - if (vdev->udev) - usb_put_dev(vdev->udev); + usb_put_dev(vdev->udev); vdev->udev = NULL; if (ud->tcp_socket) { -- 2.1.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] drivers/usb/musb/Kconfig: Use menu instead of choice for Platform Glue Layer
On Wed, Nov 05, 2014 at 10:57:46PM -0600, Felipe Balbi wrote: > On Thu, Nov 06, 2014 at 03:13:57AM +, Ben Hutchings wrote: > > On Wed, 2014-11-05 at 20:56 -0600, Felipe Balbi wrote: > > > On Thu, Nov 06, 2014 at 01:25:39AM +, Ben Hutchings wrote: > > > > A Kconfig choice only allows one 'y' selection or multiple 'm' > > > > selections, but it is valid to have any combination of 'y' and 'm' > > > > selections here (dependent on USB_MUSB_HDRC). Use a menu instead. > > > > > > > > Reported-by: Arnaud Patard > > > > Signed-off-by: Ben Hutchings > > > > > > not yet. A kernel with TUSB6010=y and any other glue layer =y won't > > > work, IIRC it won't even build. How have you tested this patch ? > > > > Arnaud had a configuration for Debian where this was needed, and his > > patch removed the choice and endchoice. We didn't run into that > > incomapatibility. However, we don't currently use a mixture of 'y' and > > 'm', so I have to confess I haven't tested it. > > I'll run a few build tests here with this patch and see what comes out > of it. sorry for the delay, have been pretty busy with some other stuff. But as I suspected: drivers/usb/musb/tusb6010.o: In function `musb_read_fifo': drivers/usb/musb/tusb6010.c:227: multiple definition of `musb_read_fifo' drivers/usb/musb/am35x.o:drivers/usb/musb/am35x.c:412: first defined here make[3]: *** [drivers/usb/musb/built-in.o] Error 1 make[2]: *** [drivers/usb/musb] Error 2 make[1]: *** [drivers/usb] Error 2 make: *** [drivers] Error 2 -- balbi signature.asc Description: Digital signature
Re: [PATCH v1 2/3] usb: phy: Handle per-PHY event for connect and disconnect events
On 21 November 2014 20:41, Felipe Balbi wrote: > On Fri, Nov 21, 2014 at 11:31:21AM +0530, Kiran Raparthy wrote: >> usb: phy: Handle per-PHY event for connnect and disconnect events >> >> When usb is connected and enumerated in device mode or when usb is >> disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event. >> >> Cc: Felipe Balbi >> Cc: Greg Kroah-Hartman >> Cc: linux-ker...@vger.kernel.org >> Cc: linux-usb@vger.kernel.org >> Cc: Android Kernel Team >> Cc: John Stultz >> Cc: Sumit Semwal >> Cc: Arve Hj�nnev�g >> Cc: Benoit Goby >> [Original patch in Android from Todd] >> Cc: Todd Poynor >> Signed-off-by: Kiran Raparthy > > this patch doesn't apply, please rebase entire series on my testing/next. Sure, Regards, Kiran > > -- > balbi -- 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 v1] usb: phy: generic: migrate to gpio_desc
Hi, On Sun, Nov 09, 2014 at 01:23:07PM +0100, Robert Jarzmik wrote: > Change internal gpio handling from integer gpios into gpio > descriptors. This change only addresses the internal API and > device-tree/ACPI, while the legacy platform data remains integer space > based. > > This change is only build compile tested, and very prone to error. I > leave this comment for now in the commit message so that this patch gets > some testing as I'm pretty sure it's buggy. > > Signed-off-by: Robert Jarzmik To my eyes, patch looks fine, but let's get a review from Linus W. Linus, can you have a look below ? Is this being used the way you intended ? BTW, we need support DT and pdata platforms here. > --- > drivers/usb/phy/phy-generic.c | 58 > --- > drivers/usb/phy/phy-generic.h | 4 +-- > 2 files changed, 18 insertions(+), 44 deletions(-) > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > index 7594e50..eba097a 100644 > --- a/drivers/usb/phy/phy-generic.c > +++ b/drivers/usb/phy/phy-generic.c > @@ -61,16 +61,8 @@ static int nop_set_suspend(struct usb_phy *x, int suspend) > > static void nop_reset_set(struct usb_phy_generic *nop, int asserted) > { > - int value; > - > - if (!gpio_is_valid(nop->gpio_reset)) > - return; > - > - value = asserted; > - if (nop->reset_active_low) > - value = !value; > - > - gpio_set_value_cansleep(nop->gpio_reset, value); > + if (nop->gpiod_reset) > + gpiod_set_value(nop->gpiod_reset, asserted); > > if (!asserted) > usleep_range(1, 2); > @@ -145,35 +137,35 @@ int usb_phy_gen_create_phy(struct device *dev, struct > usb_phy_generic *nop, > struct usb_phy_generic_platform_data *pdata) > { > enum usb_phy_type type = USB_PHY_TYPE_USB2; > - int err; > + int err = 0; > > u32 clk_rate = 0; > bool needs_vcc = false; > > - nop->reset_active_low = true; /* default behaviour */ > - > if (dev->of_node) { > struct device_node *node = dev->of_node; > - enum of_gpio_flags flags = 0; > > 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); > - if (nop->gpio_reset == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - > - nop->reset_active_low = flags & OF_GPIO_ACTIVE_LOW; > - > + nop->gpiod_reset = devm_gpiod_get(dev, "reset-gpios"); > + err = PTR_ERR(nop->gpiod_reset); > } else if (pdata) { > type = pdata->type; > clk_rate = pdata->clk_rate; > needs_vcc = pdata->needs_vcc; > - nop->gpio_reset = pdata->gpio_reset; > - } else { > - nop->gpio_reset = -1; > + err = devm_gpio_request_one(dev, pdata->gpio_reset, 0, > + dev_name(dev)); > + if (!err) > + nop->gpiod_reset = gpio_to_desc(pdata->gpio_reset); > + } > + > + if (err == -EPROBE_DEFER) > + return -EPROBE_DEFER; > + if (err) { > + dev_err(dev, "Error requesting RESET GPIO\n"); > + return err; > } > > nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg), > @@ -203,24 +195,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct > usb_phy_generic *nop, > return -EPROBE_DEFER; > } > > - if (gpio_is_valid(nop->gpio_reset)) { > - unsigned long gpio_flags; > - > - /* Assert RESET */ > - if (nop->reset_active_low) > - gpio_flags = GPIOF_OUT_INIT_LOW; > - else > - gpio_flags = GPIOF_OUT_INIT_HIGH; > - > - err = devm_gpio_request_one(dev, nop->gpio_reset, > - gpio_flags, dev_name(dev)); > - if (err) { > - dev_err(dev, "Error requesting RESET GPIO %d\n", > - nop->gpio_reset); > - return err; > - } > - } > - > nop->dev= dev; > nop->phy.dev= nop->dev; > nop->phy.label = "nop-xceiv"; > diff --git a/drivers/usb/phy/phy-generic.h b/drivers/usb/phy/phy-generic.h > index d8feacc..09924fd 100644 > --- a/drivers/usb/phy/phy-generic.h > +++ b/drivers/usb/phy/phy-generic.h > @@ -2,14 +2,14 @@ > #define _PHY_GENERIC_H_ > > #include > +#include > > struct usb_phy_generic { > struct usb_phy phy; > struct device *dev; > struct clk *clk; > struct regulator *vcc; > - int gpio_reset; > - b
[PATCH] SCSI: fix regression in scsi_send_eh_cmnd()
Commit ac61d1955934 (scsi: set correct completion code in scsi_send_eh_cmnd()) introduced a bug. It changed the stored return value from a queuecommand call, but it didn't take into account that the return value was used again later on. This patch fixes the bug by changing the later usage. There is a big comment in the middle of scsi_send_eh_cmnd() which does a good job of explaining how the routine works. But it mentions a "rtn = FAILURE" value that doesn't exist in the code. This patch adjusts the code to match the comment (I assume the comment is right and the code is wrong). This fixes Bugzilla #88341. Signed-off-by: Alan Stern Reported-by: Андрей Аладьев Tested-by: Андрей Аладьев Fixes: ac61d19559349e205dad7b5122b281419aa74a82 CC: Hannes Reinecke CC: --- [as1768] drivers/scsi/scsi_error.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: 3.18-rc5/drivers/scsi/scsi_error.c === --- 3.18-rc5.orig/drivers/scsi/scsi_error.c +++ 3.18-rc5/drivers/scsi/scsi_error.c @@ -1027,7 +1027,7 @@ retry: } /* signal not to enter either branch of the if () below */ timeleft = 0; - rtn = NEEDS_RETRY; + rtn = FAILED; } else { timeleft = wait_for_completion_timeout(&done, timeout); rtn = SUCCESS; @@ -1067,7 +1067,7 @@ retry: rtn = FAILED; break; } - } else if (!rtn) { + } else if (rtn != FAILED) { scsi_abort_eh_cmnd(scmd); rtn = FAILED; } -- 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 v1] usb: phy: nop: device tree documentation for vbus
On Sun, Nov 09, 2014 at 02:02:18PM +0100, Robert Jarzmik wrote: > Enhance the phy documentation by adding 2 new optional bindings : > - the vbus gpio, which detects usb insertion > - the vbus regulator, which provides current drawn from the usb cable > > Signed-off-by: Robert Jarzmik > --- > Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt | 8 > 1 file changed, 8 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt > b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt > index 1bd37fa..65dfe4b 100644 > --- a/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt > +++ b/Documentation/devicetree/bindings/usb/usb-nop-xceiv.txt > @@ -17,6 +17,11 @@ Optional properties: > > - reset-gpios: Should specify the GPIO for reset. > > +- vbus-gpios: should specify the GPIO detecting a VBus insertion > + (see Documentation/devicetree/bindings/gpio/gpio.txt) > +- vbus-regulator : should specifiy the regulator supplying current drawn from > + the VBus line (see > Documentation/devicetree/bindings/regulator/regulator.txt). > + > Example: > > hsusb1_phy { > @@ -26,8 +31,11 @@ Example: > clock-names = "main_clk"; > vcc-supply = <&hsusb1_vcc_regulator>; > reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; > + vbus-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>; > + vbus-regulator = <&vbus_regulator>; not sure why you need vbus-gpios here. You can pass the gpio to the regulator as enable-gpio, right ? -- balbi signature.asc Description: Digital signature
Re: [PATCH v1] usb: phy: generic: add vbus support
On Sun, Nov 09, 2014 at 03:58:14PM +0100, Robert Jarzmik wrote: > Add support for vbus detection and power supply. This code is more or > less stolen from phy-gpio-vbus-usb.c, and aims at providing a detection > mechanism for VBus (ie. usb cable plug) based on a GPIO line, and a > power supply activation which draws current from the VBus. > > Signed-off-by: Robert Jarzmik > --- > drivers/usb/phy/phy-generic.c | 90 > - > drivers/usb/phy/phy-generic.h | 6 +++ > include/linux/usb/usb_phy_generic.h | 2 + > 3 files changed, 97 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > index 71e061d..2f383a1 100644 > --- a/drivers/usb/phy/phy-generic.c > +++ b/drivers/usb/phy/phy-generic.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -41,6 +42,9 @@ > > #include "phy-generic.h" > > +#define VBUS_IRQ_FLAGS \ > + (IRQF_SHARED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING) > + > struct platform_device *usb_phy_generic_register(void) > { > return platform_device_register_simple("usb_phy_generic", > @@ -68,6 +72,73 @@ static void nop_reset_set(struct usb_phy_generic *nop, int > asserted) > usleep_range(1, 2); > } > > +/* interface to regulator framework */ > +static void nop_set_vbus_draw(struct usb_phy_generic *nop, unsigned mA) > +{ > + struct regulator *vbus_draw = nop->vbus_draw; > + int enabled; > + int ret; > + > + if (!vbus_draw) > + return; > + > + enabled = nop->vbus_draw_enabled; > + if (mA) { > + regulator_set_current_limit(vbus_draw, 0, 1000 * mA); > + if (!enabled) { > + ret = regulator_enable(vbus_draw); > + if (ret < 0) > + return; > + nop->vbus_draw_enabled = 1; do you really need this flag here ? How about: if (regulator_is_enabled(vbus_draw)) foo(); > + } > + } else { > + if (enabled) { > + ret = regulator_disable(vbus_draw); > + if (ret < 0) > + return; > + nop->vbus_draw_enabled = 0; > + } > + } > + nop->mA = mA; > +} > + > + > +static irqreturn_t nop_gpio_vbus_thread(int irq, void *data) > +{ > + struct usb_phy_generic *nop = data; > + struct usb_otg *otg = nop->phy.otg; > + int vbus, status; > + > + vbus = gpiod_get_value(nop->gpiod_vbus); > + if ((vbus ^ nop->vbus) == 0) > + return IRQ_HANDLED; > + nop->vbus = vbus; > + > + if (vbus) { > + status = USB_EVENT_VBUS; > + nop->phy.state = OTG_STATE_B_PERIPHERAL; > + nop->phy.last_event = status; > + usb_gadget_vbus_connect(otg->gadget); > + > + /* drawing a "unit load" is *always* OK, except for OTG */ > + nop_set_vbus_draw(nop, 100); right, we need to take into considering the Battery Charging specification here, though. We might need to setup a timer for the amount of time we can draw 100mA before device enumerates. If the times expires we're only allowed to draw 8mA or 2mA, or something like that. The time gets cancelled as soon as we get enumerated. Another possibility would be to move this policy into userland, then kernel only provides the interfaces. -- balbi signature.asc Description: Digital signature
Re: USB: serial: Deletion of an unnecessary check before the function call "release_firmware"
>> diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c >> index ab1d690..3653ec1 100644 >> --- a/drivers/usb/serial/mxuport.c >> +++ b/drivers/usb/serial/mxuport.c >> @@ -1101,8 +1101,7 @@ static int mxuport_probe(struct usb_serial *serial, >> */ >> usb_set_serial_data(serial, (void *)id->driver_info); >> out: >> -if (fw_p) >> -release_firmware(fw_p); >> +release_firmware(fw_p); > > I think that the if should stay. I have got an other opinion. > There were two cases on the allocation, so there should be two cases > on the release. I find that this implementation detail does not really matter for the necessity of a null pointer check directly before such a function call. Regards, Markus -- 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 v1] usb: phy: generic: add vbus support
Hi Robert, On Sat, Nov 15, 2014 at 12:01:00PM +0100, Robert Jarzmik wrote: > Robert Jarzmik writes: > > > Add support for vbus detection and power supply. This code is more or > > less stolen from phy-gpio-vbus-usb.c, and aims at providing a detection > > mechanism for VBus (ie. usb cable plug) based on a GPIO line, and a > > power supply activation which draws current from the VBus. > > Hi Felipe, > > Am I still on time for the next merge window ? sorry, but I got caught up with other tasks (internal and public) and ended up not having a lot of time to review your patches. I just reviewed them, though. -rc6 still wasn't tagged, from what I can see, so we might still have a couple days. Let's hope Linus W gives us a review for the gpio_desc conversion quickly :-p cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH v4] usb: gadget: f_fs: add "no_disconnect" mode
On Thu, Nov 13, 2014 at 05:28:22PM +0100, Krzysztof Opasiak wrote: > Hello, > > > -Original Message- > > From: Felipe Balbi [mailto:ba...@ti.com] > > Sent: Thursday, November 13, 2014 3:44 AM > > To: Felipe Balbi > > Cc: Robert Baldyga; David Cohen; gre...@linuxfoundation.org; linux- > > u...@vger.kernel.org; linux-ker...@vger.kernel.org; > > min...@mina86.com; andrze...@samsung.com; m.szyprow...@samsung.com; > > k.opas...@samsung.com > > Subject: Re: [PATCH v4] usb: gadget: f_fs: add "no_disconnect" mode > > (...) > > > > > David, you have been messing with ffs lately, can I get a > > Tested-by > > > > from you on this patch ? > > > > > > ping. David ? Any chance you can test this one out ? > > > > a reminder on this request, it's getting close to tree lockdown > > (probably another 2 to 3 weeks). > > I have tested this patch today but I'm afraid that I can't give > tested-by tag: > > When I kill the daemon and then reconnect my device I get on my host: > > [776092.877175] usb 1-1.1: can't set config #1, error -32 > > While on device there is only: > > [ 2147.035340] configfs-gadget gadget: high-speed config #1: The only > one > > Moreover, I'm not very enthusiastic about the convention in which we > allow > to reconnect the device without any changes. > > In my opinion when daemon has been killed we should allow user to finish > communication with other functions and then simply unbind our gadget. > This should happen not only on reconnection but also when host is trying > to enable configuration which contains this function "zombie". > This function is not fully operational so it is very good idea to > allow user to finish his job with other functions but when he reconnects > the > device we should unbind gadget to notify userspace that something is > wrong. > The same when we switch configuration. > > What do you think about this Michal and Felipe? let's wait another merge window to discuss this one better. If it's causing confusion/regressions, we better delay it. -- balbi signature.asc Description: Digital signature
Re: [PATCH] SCSI: fix regression in scsi_send_eh_cmnd()
On 11/21/2014 04:44 PM, Alan Stern wrote: > Commit ac61d1955934 (scsi: set correct completion code in > scsi_send_eh_cmnd()) introduced a bug. It changed the stored return > value from a queuecommand call, but it didn't take into account that > the return value was used again later on. This patch fixes the bug by > changing the later usage. > > There is a big comment in the middle of scsi_send_eh_cmnd() which > does a good job of explaining how the routine works. But it mentions > a "rtn = FAILURE" value that doesn't exist in the code. This patch > adjusts the code to match the comment (I assume the comment is right > and the code is wrong). > > This fixes Bugzilla #88341. > > Signed-off-by: Alan Stern > Reported-by: Андрей Аладьев > Tested-by: Андрей Аладьев > Fixes: ac61d19559349e205dad7b5122b281419aa74a82 > CC: Hannes Reinecke > CC: > That is correct. Acked-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg) -- 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: Fixed a few typos in comments
Fixed typos in comments of 2 drivers/usb/chipidea files Signed-off-by: Mickael Maison --- drivers/usb/chipidea/core.c| 2 +- drivers/usb/chipidea/otg_fsm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 9bdc6bd..9401323 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -472,7 +472,7 @@ static int ci_get_platdata(struct device *dev, if (PTR_ERR(platdata->reg_vbus) == -EPROBE_DEFER) { return -EPROBE_DEFER; } else if (PTR_ERR(platdata->reg_vbus) == -ENODEV) { - /* no vbus regualator is needed */ + /* no vbus regulator is needed */ platdata->reg_vbus = NULL; } else if (IS_ERR(platdata->reg_vbus)) { dev_err(dev, "Getting regulator error: %ld\n", diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index caaabc5..a8e0064 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -303,7 +303,7 @@ static void a_wait_vfall_tmout_func(void *ptr, unsigned long indicator) set_tmout(ci, indicator); /* Disable port power */ hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_PP, 0); - /* Clear exsiting DP irq */ + /* Clear existing DP irq */ hw_write_otgsc(ci, OTGSC_DPIS, OTGSC_DPIS); /* Enable data pulse irq */ hw_write_otgsc(ci, OTGSC_DPIE, OTGSC_DPIE); @@ -663,7 +663,7 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci) fsm->b_bus_suspend = 1; /* * Init a timer to know how long this suspend -* will contine, if time out, indicates B no longer +* will continue, if time out, indicates B no longer * wants to be host role */ ci_otg_add_timer(ci, A_BIDL_ADIS); -- 1.9.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 v1] usb: phy: nop: device tree documentation for vbus
Felipe Balbi writes: > On Sun, Nov 09, 2014 at 02:02:18PM +0100, Robert Jarzmik wrote: >> hsusb1_phy { >> @@ -26,8 +31,11 @@ Example: >> clock-names = "main_clk"; >> vcc-supply = <&hsusb1_vcc_regulator>; >> reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; >> +vbus-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>; >> +vbus-regulator = <&vbus_regulator>; > > not sure why you need vbus-gpios here. You can pass the gpio to the > regulator as enable-gpio, right ? Euh no. From my understanding a regulator enable-gpio is an _output_ gpio enabling the regulator. This vbus-gpio is an _input_ gpio detecting the vbus assertion. Maybe a name like "vbus-detect-gpio" would be more accurante ? Cheers. -- Robert -- 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 v1] usb: phy: nop: device tree documentation for vbus
On Fri, Nov 21, 2014 at 06:17:58PM +0100, Robert Jarzmik wrote: > Felipe Balbi writes: > > > On Sun, Nov 09, 2014 at 02:02:18PM +0100, Robert Jarzmik wrote: > >>hsusb1_phy { > >> @@ -26,8 +31,11 @@ Example: > >>clock-names = "main_clk"; > >>vcc-supply = <&hsusb1_vcc_regulator>; > >>reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; > >> + vbus-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>; > >> + vbus-regulator = <&vbus_regulator>; > > > > not sure why you need vbus-gpios here. You can pass the gpio to the > > regulator as enable-gpio, right ? > > Euh no. From my understanding a regulator enable-gpio is an _output_ gpio > enabling the regulator. This vbus-gpio is an _input_ gpio detecting the vbus > assertion. Maybe a name like "vbus-detect-gpio" would be more accurante ? aha, that clears it up, yeah. So the GPIO is detecting if we have VBUS from the host side while the regulator supplies VBUS ? -- balbi signature.asc Description: Digital signature
Re: [PATCH v1] usb: phy: generic: add vbus support
Felipe Balbi writes: > On Sun, Nov 09, 2014 at 03:58:14PM +0100, Robert Jarzmik wrote: >> +if (!enabled) { >> +ret = regulator_enable(vbus_draw); >> +if (ret < 0) >> +return; >> +nop->vbus_draw_enabled = 1; > > do you really need this flag here ? How about: > > if (regulator_is_enabled(vbus_draw)) > foo(); Good question, I copy-pasted that code from gpio-vbus... Philipp, do you have an insight here ? >> +if (vbus) { >> +status = USB_EVENT_VBUS; >> +nop->phy.state = OTG_STATE_B_PERIPHERAL; >> +nop->phy.last_event = status; >> +usb_gadget_vbus_connect(otg->gadget); >> + >> +/* drawing a "unit load" is *always* OK, except for OTG */ >> +nop_set_vbus_draw(nop, 100); > > right, we need to take into considering the Battery Charging > specification here, though. We might need to setup a timer for the > amount of time we can draw 100mA before device enumerates. If the times > expires we're only allowed to draw 8mA or 2mA, or something like that. > > The time gets cancelled as soon as we get enumerated. > > Another possibility would be to move this policy into userland, then > kernel only provides the interfaces. Ah ok. Do you know exactly what the spec is telling in here ? Is it something such as : - upon vbus insertion, a UDC can draw 100mA during ??? ms - if during ??? ms, the device is enumerated, it can continue drawing 100mA - if not, it should not draw more than 8mA after ??? ms Is this right ? I can add a timer I think, if the spec if that simple. Now if there are a lot of special cases then maybe it could be dropped to userland. Cheers. -- Robert -- 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 v1] usb: phy: generic: add vbus support
Hi, On Fri, Nov 21, 2014 at 06:24:44PM +0100, Robert Jarzmik wrote: > Felipe Balbi writes: > > > On Sun, Nov 09, 2014 at 03:58:14PM +0100, Robert Jarzmik wrote: > >> + if (!enabled) { > >> + ret = regulator_enable(vbus_draw); > >> + if (ret < 0) > >> + return; > >> + nop->vbus_draw_enabled = 1; > > > > do you really need this flag here ? How about: > > > > if (regulator_is_enabled(vbus_draw)) > > foo(); > Good question, I copy-pasted that code from gpio-vbus... > Philipp, do you have an insight here ? > > >> + if (vbus) { > >> + status = USB_EVENT_VBUS; > >> + nop->phy.state = OTG_STATE_B_PERIPHERAL; > >> + nop->phy.last_event = status; > >> + usb_gadget_vbus_connect(otg->gadget); > >> + > >> + /* drawing a "unit load" is *always* OK, except for OTG */ > >> + nop_set_vbus_draw(nop, 100); > > > > right, we need to take into considering the Battery Charging > > specification here, though. We might need to setup a timer for the > > amount of time we can draw 100mA before device enumerates. If the times > > expires we're only allowed to draw 8mA or 2mA, or something like that. > > > > The time gets cancelled as soon as we get enumerated. > > > > Another possibility would be to move this policy into userland, then > > kernel only provides the interfaces. > Ah ok. > Do you know exactly what the spec is telling in here ? I would have to go read the spec again to remember, but... > Is it something such as : > - upon vbus insertion, a UDC can draw 100mA during ??? ms this is, IIRC, a rather long time. Something like 10 minutes or maybe more. It falls into the dead battery provision. >- if during ??? ms, the device is enumerated, it can continue drawing 100mA either 100mA or bMaxPower from chosen configuration. >- if not, it should not draw more than 8mA after ??? ms yeah, something like that. > Is this right ? I can add a timer I think, if the spec if that simple. Now if > there are a lot of special cases then maybe it could be dropped to userland. yeah, there quite a few special cases :-) -- balbi signature.asc Description: Digital signature
Re: [PATCH 1/1] USB-IP: Deletion of unnecessary checks before the function call "usb_put_dev"
On Fri, Nov 21, 2014 at 5:36 PM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 21 Nov 2014 16:33:18 +0100 > > The usb_put_dev() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/usb/usbip/vhci_hcd.c | 9 +++-- > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c > index c02374b..cc1b03e 100644 > --- a/drivers/usb/usbip/vhci_hcd.c > +++ b/drivers/usb/usbip/vhci_hcd.c > @@ -518,8 +518,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct > urb *urb, > dev_info(dev, "SetAddress Request (%d) to port %d\n", > ctrlreq->wValue, vdev->rhport); > > - if (vdev->udev) > - usb_put_dev(vdev->udev); > + usb_put_dev(vdev->udev); > vdev->udev = usb_get_dev(urb->dev); > > spin_lock(&vdev->ud.lock); > @@ -539,8 +538,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct > urb *urb, > usbip_dbg_vhci_hc( > "Not yet?:Get_Descriptor to device 0 > (get max pipe size)\n"); > > - if (vdev->udev) > - usb_put_dev(vdev->udev); > + usb_put_dev(vdev->udev); > vdev->udev = usb_get_dev(urb->dev); > goto out; > > @@ -831,8 +829,7 @@ static void vhci_device_reset(struct usbip_device *ud) > vdev->speed = 0; > vdev->devid = 0; > > - if (vdev->udev) > - usb_put_dev(vdev->udev); > + usb_put_dev(vdev->udev); > vdev->udev = NULL; > > if (ud->tcp_socket) { > -- > 2.1.3 > Acked-by: Valentina Manea -- 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 v2 3/3] usb: phy: hold wakeupsource when USB is enumerated in peripheral mode
usb: phy: hold wakeupsource when USB is enumerated in peripheral mode Some systems require a mechanism to prevent system to enter into suspend state when USB is connected and enumerated in peripheral mode. This patch provides an interface to hold a wakeupsource to prevent suspend. PHY drivers can use this interface when USB is connected and enumerated in peripheral mode. A timed wakeupsource is temporarily held on USB disconnect events, to allow the rest of the system to react to the USB disconnection (dropping host sessions, updating charger status, etc.) prior to re-allowing suspend. Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-ker...@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team Cc: John Stultz Cc: Sumit Semwal Cc: Arve Hjønnevåg Cc: Benoit Goby [Original patch in Android from Todd] Cc: Todd Poynor Signed-off-by: Kiran Raparthy --- drivers/usb/phy/phy.c | 29 +++-- include/linux/usb/phy.h | 5 + 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index b4066a0..8c87bc3 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -331,6 +331,7 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type) int ret = 0; unsigned long flags; struct usb_phy *phy; + char wsource_name[40]; if (x->type != USB_PHY_TYPE_UNDEFINED) { dev_err(x->dev, "not accepting initialized PHY %s\n", x->label); @@ -353,6 +354,10 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type) x->type = type; list_add_tail(&x->head, &phy_list); + snprintf(wsource_name, sizeof(wsource_name), "vbus-%s", + dev_name(x->dev)); + wakeup_source_init(&x->wsource, wsource_name); + out: spin_unlock_irqrestore(&phy_lock, flags); return ret; @@ -404,6 +409,7 @@ void usb_remove_phy(struct usb_phy *x) spin_lock_irqsave(&phy_lock, flags); if (x) { + wakeup_source_trash(&x->wsource); list_for_each_entry(phy_bind, &phy_bind_list, list) if (phy_bind->phy == x) phy_bind->phy = NULL; @@ -448,13 +454,32 @@ int usb_bind_phy(const char *dev_name, u8 index, EXPORT_SYMBOL_GPL(usb_bind_phy); /** - * usb_phy_set_event - set event to phy event + * usb_phy_set_event - set event to phy event and + * hold/temporarily hold wakeupsource * @x: the phy returned by usb_get_phy(); * - * This sets event to phy event + * This holds per-PHY wakeupsource/timed wakeupsource */ void usb_phy_set_event(struct usb_phy *x, unsigned long event) { + x->last_event = event; + + switch (event) { + case USB_EVENT_ENUMERATED: + __pm_stay_awake(&x->wsource); + break; + + case USB_EVENT_NONE: + case USB_EVENT_ID: + case USB_EVENT_VBUS: + case USB_EVENT_CHARGER: + __pm_wakeup_event(&x->wsource, + USB_PHY_DEFAULT_WAKEUP_SRC_TIMEOUT); + break; + + default: + break; + } } EXPORT_SYMBOL_GPL(usb_phy_set_event); diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index f499c23..63a56bf 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -12,6 +12,8 @@ #include #include +#define USB_PHY_DEFAULT_WAKEUP_SRC_TIMEOUT msecs_to_jiffies(2000) + enum usb_phy_interface { USBPHY_INTERFACE_MODE_UNKNOWN, USBPHY_INTERFACE_MODE_UTMI, @@ -88,6 +90,9 @@ struct usb_phy { /* for notification of usb_phy_events */ struct atomic_notifier_head notifier; + /* wakeup source */ + struct wakeup_sourcewsource; + /* to pass extra port status to the root hub */ u16 port_status; u16 port_change; -- 1.9.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 v2 2/3] usb: phy: Handle per-PHY event for connect and disconnect events
usb: phy: Handle per-PHY event for connnect and disconnect events When usb is connected and enumerated in device mode or when usb is disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event. Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-ker...@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team Cc: John Stultz Cc: Sumit Semwal Cc: Arve Hjønnevåg Cc: Benoit Goby [Original patch in Android from Todd] Cc: Todd Poynor Signed-off-by: Kiran Raparthy --- drivers/usb/phy/phy-ab8500-usb.c| 15 +++ drivers/usb/phy/phy-gpio-vbus-usb.c | 2 ++ drivers/usb/phy/phy-mv-usb.c| 2 ++ drivers/usb/phy/phy-tahvo.c | 2 ++ 4 files changed, 21 insertions(+) diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 30c96f0..8cd7d19 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -445,6 +445,7 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, event = UX500_MUSB_NONE; /* Fallback to default B_IDLE as nothing is connected. */ ab->phy.otg->state = OTG_STATE_B_IDLE; + usb_phy_set_event(&ab->phy, USB_EVENT_NONE); break; case USB_LINK_ACA_RID_C_NM_9540: @@ -459,12 +460,14 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, ab8500_usb_peri_phy_en(ab); atomic_notifier_call_chain(&ab->phy.notifier, UX500_MUSB_PREPARE, &ab->vbus_draw); + usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); } if (ab->mode == USB_IDLE) { ab->mode = USB_PERIPHERAL; ab8500_usb_peri_phy_en(ab); atomic_notifier_call_chain(&ab->phy.notifier, UX500_MUSB_PREPARE, &ab->vbus_draw); + usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); } if (event != UX500_MUSB_RIDC) event = UX500_MUSB_VBUS; @@ -500,6 +503,7 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, event = UX500_MUSB_CHARGER; atomic_notifier_call_chain(&ab->phy.notifier, event, &ab->vbus_draw); + usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER); break; case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_9540: @@ -524,6 +528,7 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, ab->mode = USB_IDLE; ab->phy.otg->default_a = false; ab->vbus_draw = 0; + usb_phy_set_event(&ab->phy, USB_EVENT_NONE); } } break; @@ -583,6 +588,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, * is connected */ ab->phy.otg->state = OTG_STATE_B_IDLE; + usb_phy_set_event(&ab->phy, USB_EVENT_NONE); break; case USB_LINK_ACA_RID_C_NM_8540: @@ -596,6 +602,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, ab8500_usb_peri_phy_en(ab); atomic_notifier_call_chain(&ab->phy.notifier, UX500_MUSB_PREPARE, &ab->vbus_draw); + usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED); } if (event != UX500_MUSB_RIDC) event = UX500_MUSB_VBUS; @@ -624,6 +631,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, event = UX500_MUSB_CHARGER; atomic_notifier_call_chain(&ab->phy.notifier, event, &ab->vbus_draw); + usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER); break; case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_8540: @@ -646,6 +654,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, ab->mode = USB_IDLE; ab->phy.otg->default_a = false; ab->vbus_draw = 0; + usb_phy_set_event(&ab->phy, USB_EVENT_NONE); } break; @@ -692,6 +701,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, * is connected */ ab->phy.otg->state = OTG_STATE_B_IDLE; + usb_phy_set_event(&ab->phy, USB_EVENT_NONE); break; case USB_LINK_ACA_RID_C_NM_8505: @@ -705,6 +715,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, ab8500_usb_peri_phy_en(ab); atomic_notifier_call_chain(&ab->phy.notifier,
[PATCH v2 1/3] usb: phy: introduce usb_phy_set_event interface
PHY drivers require a generic interface to handle per-PHY events. usb_phy_set_event interface sets event to phy event. PHY drivers call this interface for each phy event. Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-ker...@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team Cc: John Stultz Cc: Sumit Semwal Cc: Arve Hjønnevåg Cc: Benoit Goby [Original patch in Android from Todd] Cc: Todd Poynor Signed-off-by: Kiran Raparthy Signed-off-by: Felipe Balbi --- drivers/usb/phy/phy.c | 12 include/linux/usb/phy.h | 5 + 2 files changed, 17 insertions(+) diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index e6bf801..b4066a0 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -446,3 +446,15 @@ int usb_bind_phy(const char *dev_name, u8 index, return 0; } EXPORT_SYMBOL_GPL(usb_bind_phy); + +/** + * usb_phy_set_event - set event to phy event + * @x: the phy returned by usb_get_phy(); + * + * This sets event to phy event + */ +void usb_phy_set_event(struct usb_phy *x, unsigned long event) +{ + x->last_event = event; +} +EXPORT_SYMBOL_GPL(usb_phy_set_event); diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index ac7d791..f499c23 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -209,6 +209,7 @@ extern void usb_put_phy(struct usb_phy *); extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x); extern int usb_bind_phy(const char *dev_name, u8 index, const char *phy_dev_name); +extern void usb_phy_set_event(struct usb_phy *x, unsigned long event); #else static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) { @@ -250,6 +251,10 @@ static inline int usb_bind_phy(const char *dev_name, u8 index, { return -EOPNOTSUPP; } + +static inline void usb_phy_set_event(struct usb_phy *x, unsigned long event) +{ +} #endif static inline int -- 1.9.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 v1] usb: phy: nop: device tree documentation for vbus
Felipe Balbi writes: > On Fri, Nov 21, 2014 at 06:17:58PM +0100, Robert Jarzmik wrote: >> Felipe Balbi writes: >> >> > On Sun, Nov 09, 2014 at 02:02:18PM +0100, Robert Jarzmik wrote: >> >> hsusb1_phy { >> >> @@ -26,8 +31,11 @@ Example: >> >> clock-names = "main_clk"; >> >> vcc-supply = <&hsusb1_vcc_regulator>; >> >> reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; >> >> + vbus-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>; >> >> + vbus-regulator = <&vbus_regulator>; >> > >> > not sure why you need vbus-gpios here. You can pass the gpio to the >> > regulator as enable-gpio, right ? >> >> Euh no. From my understanding a regulator enable-gpio is an _output_ gpio >> enabling the regulator. This vbus-gpio is an _input_ gpio detecting the vbus >> assertion. Maybe a name like "vbus-detect-gpio" would be more accurante ? > > aha, that clears it up, yeah. So the GPIO is detecting if we have VBUS > from the host side while the regulator supplies VBUS ? Yup, exactly. I'll amend the name for v2. Cheers. -- Robert -- 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: USB: serial: Deletion of an unnecessary check before the function call "release_firmware"
On Fri, 21 Nov 2014, SF Markus Elfring wrote: > >> diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c > >> index ab1d690..3653ec1 100644 > >> --- a/drivers/usb/serial/mxuport.c > >> +++ b/drivers/usb/serial/mxuport.c > >> @@ -1101,8 +1101,7 @@ static int mxuport_probe(struct usb_serial *serial, > >> */ > >>usb_set_serial_data(serial, (void *)id->driver_info); > >> out: > >> - if (fw_p) > >> - release_firmware(fw_p); > >> + release_firmware(fw_p); > > > > I think that the if should stay. > > I have got an other opinion. > > > > There were two cases on the allocation, so there should be two cases > > on the release. > > I find that this implementation detail does not really matter for the > necessity of a null pointer check directly before such a function call. Conceptually, if it is clear 10 lines above that nothing was allocated, and there is a fallback to existing data (according to the comment above) it is strange to be releasing something. julia -- 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 v1] usb: phy: nop: device tree documentation for vbus
On Fri, Nov 21, 2014 at 06:49:47PM +0100, Robert Jarzmik wrote: > Felipe Balbi writes: > > > On Fri, Nov 21, 2014 at 06:17:58PM +0100, Robert Jarzmik wrote: > >> Felipe Balbi writes: > >> > >> > On Sun, Nov 09, 2014 at 02:02:18PM +0100, Robert Jarzmik wrote: > >> >> hsusb1_phy { > >> >> @@ -26,8 +31,11 @@ Example: > >> >> clock-names = "main_clk"; > >> >> vcc-supply = <&hsusb1_vcc_regulator>; > >> >> reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; > >> >> + vbus-gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>; > >> >> + vbus-regulator = <&vbus_regulator>; > >> > > >> > not sure why you need vbus-gpios here. You can pass the gpio to the > >> > regulator as enable-gpio, right ? > >> > >> Euh no. From my understanding a regulator enable-gpio is an _output_ gpio > >> enabling the regulator. This vbus-gpio is an _input_ gpio detecting the > >> vbus > >> assertion. Maybe a name like "vbus-detect-gpio" would be more accurante ? > > > > aha, that clears it up, yeah. So the GPIO is detecting if we have VBUS > > from the host side while the regulator supplies VBUS ? > Yup, exactly. I'll amend the name for v2. Thank you -- balbi signature.asc Description: Digital signature
Re: [PATCH v1] usb: phy: generic: add vbus support
On Fri, Nov 21, 2014 at 6:24 PM, Robert Jarzmik wrote: > Felipe Balbi writes: > >> On Sun, Nov 09, 2014 at 03:58:14PM +0100, Robert Jarzmik wrote: >>> +if (!enabled) { >>> +ret = regulator_enable(vbus_draw); >>> +if (ret < 0) >>> +return; >>> +nop->vbus_draw_enabled = 1; >> >> do you really need this flag here ? How about: >> >> if (regulator_is_enabled(vbus_draw)) >> foo(); > Good question, I copy-pasted that code from gpio-vbus... > Philipp, do you have an insight here ? Regulator refcounting is per regulator_dev, not per struct regulator, so for multiple consumer scenarios it is necessary to either balance enable/disable calls, or, if that can't be guaranteed, the consumer has to keep its own enable flag. The latter is the case for the vbus_draw callback. Also regulator_is_enabled does not just return (refcount > 0), but might try to read the actual regulator hardware state (and fail), depending on the regulator driver. While I can't see a reason to ever share the vbus_draw regulator with another consumer, and for gpio regulators regulator_is_enabled never fails, so for the current users relying on regulator_is_enabled should work here, I think keeping the flag is the safe thing to do. regards Philipp -- 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 net-next v3 0/2] r8152: adjust rx functions
From: Hayes Wang Date: Thu, 20 Nov 2014 10:29:04 +0800 > v3: > For patch #1, remove unnecessary initialization for ret and > unnecessary blank line in r8152_submit_rx(). > > v2: > For patch #1, set actual_length to 0 before adding the rx to the > list, when a error occurs. > > For patch #2, change the flow. Stop submitting the rx if a error > occurs, and add the remaining rx to the list for submitting later. > > v1: > Adjust some flows and codes which are relative to r8152_submit_rx() > and rtl_start_rx(). Series applied, thanks. -- 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] net: USB: Deletion of unnecessary checks before the function call "kfree"
From: SF Markus Elfring Date: Thu, 20 Nov 2014 16:16:16 +0100 > From: Markus Elfring > Date: Thu, 20 Nov 2014 16:11:56 +0100 > > The kfree() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring Applied. -- 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] HID: usbhid: get/put around clearing needs_remote_wakeup
Hi Alan, On Fri, Nov 14, 2014 at 7:17 AM, Alan Stern wrote: > > The reason for the get/put is to force a call to autosuspend_check(). > But in this case, if killing the interrupt URB causes > autosuspend_check() to run then the get/put isn't needed. > > On the other hand, I don't see why killing the interrupt URB would > cause autosuspend_check() to run. Can you explain that? Sorry for the delay in my response. I did some more checking of my particular failure, and my commit message is incorrect. The usb_kill_urb is actually not the cause of this problem. It does not result in autosuspend_check() itself, and is only serving to add some delay. hidraw_release() in hidraw.c calls drop_ref(), which calls the following in sequence upon clearing the last reader : /* close device for last reader */ hid_hw_power(hidraw->hid, PM_HINT_NORMAL); hid_hw_close(hidraw->hid); hid_hw_power results in a usb_autopm_put_interface. In this case, the reference count is decremented to 0, and a delayed autosuspend request is attempted. hid_hw_close leads to usbhid_close, which clears needs_remote_wakeup. However, there's no guarantee that the clear of needs_remote_wakeup will occur before the delayed work ( runtime_idle() -> autosuspend_check() ) runs. Moving usbhid->intf->needs_remote_wakeup = 0 to before the usb_kill_urb(usbhid->urbin) only serves to reduce the amount of time between these events and makes this particular failure less likely. The correct solution is to put get/put around each change of needs_remote_wakeup, as that will correctly trigger another delayed autosuspend_check(), whose result is affected by the state of needs_remote_wakeup. Since autosuspend_check() occurs as delayed work, I think it is appropriate to add get/put around the clear in usbhid_stop as well. -- Benson Leung Software Engineer, Chrom* OS ble...@chromium.org On Fri, Nov 14, 2014 at 7:17 AM, Alan Stern wrote: > On Thu, 13 Nov 2014, Benson Leung wrote: > >> Hi Alan, >> >> On Thu, Nov 13, 2014 at 2:11 PM, Alan Stern >> wrote: >> > Wait a minute -- in your previous email you said this approach didn't >> > work. So does it work or doesn't it? >> >> Sorry for the confusion. The approach *does* work. >> >> That was actually my original idea to fix the problem, but I saw other >> places in the kernel where it was done with a get/put. > > The reason for the get/put is to force a call to autosuspend_check(). > But in this case, if killing the interrupt URB causes > autosuspend_check() to run then the get/put isn't needed. > > On the other hand, I don't see why killing the interrupt URB would > cause autosuspend_check() to run. Can you explain that? > > Alan Stern > > > -- Benson Leung Software Engineer, Chrom* OS ble...@chromium.org -- 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] HID: usbhid: get/put around clearing needs_remote_wakeup
On Fri, Nov 14, 2014 at 1:08 AM, Oliver Neukum wrote: > On Thu, 2014-11-13 at 12:16 -0800, Benson Leung wrote: > >> In usbhid_open, usb_autopm_get_interface is called >> before setting the needs_remote_wakeup flag, and >> usb_autopm_put_interface is called after hid_start_in. >> >> However, when the device is closed in usbhid_close, the same >> protection isn't there when clearing needs_remote_wakeup. This will >> add that to usbhid_close as well as usbhid_stop. > > Interesting, but this has the side effect of waking devices > that are asleep just to remove the flag. > > Regards If devices are already asleep with this flag enabled, that means that they are presently configured for remote wake. Waking the device in the case of a close() is appropriate because it also has the effect of re-suspending the device with the capability disabled, as it is no longer necessary. -- Benson Leung Software Engineer, Chrom* OS ble...@chromium.org -- 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: dwc2: Fix build warning when CONFIG_PM_SLEEP=n
On 11/19/2014 4:01 PM, Felipe Balbi wrote: HI, On Wed, Nov 19, 2014 at 12:37:53PM -0200, Fabio Estevam wrote: Building with bcm2835_defconfig, which has CONFIG_PM_SLEEP=n causes the following build warning: drivers/usb/dwc2/platform.c:227:12: warning: 'dwc2_suspend' defined but not used [-Wunused-function] drivers/usb/dwc2/platform.c:237:12: warning: 'dwc2_resume' defined but not used [-Wunused-function] Annotate these functions with '__maybe_unused' to prevent the warnings. Reported-by: Olof's autobuilder Signed-off-by: Fabio Estevam --- drivers/usb/dwc2/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 57eb8a3..ff0ed0b 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -224,7 +224,7 @@ static int dwc2_driver_probe(struct platform_device *dev) return retval; } -static int dwc2_suspend(struct device *dev) +static int __maybe_unused dwc2_suspend(struct device *dev) that SET_SYSTEM_SLEEP_PM_OPS again. Rafael, do you mind taking a patch like below: I might, but -> diff --git a/include/linux/pm.h b/include/linux/pm.h index 383fd68..928e295 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -318,7 +318,6 @@ struct dev_pm_ops { int (*runtime_idle)(struct device *dev); }; -#ifdef CONFIG_PM_SLEEP #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ .suspend = suspend_fn, \ .resume = resume_fn, \ @@ -326,11 +325,7 @@ struct dev_pm_ops { .thaw = resume_fn, \ .poweroff = suspend_fn, \ .restore = resume_fn, -#else -#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) -#endif -#ifdef CONFIG_PM_SLEEP #define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ .suspend_late = suspend_fn, \ .resume_early = resume_fn, \ @@ -338,27 +333,16 @@ struct dev_pm_ops { .thaw_early = resume_fn, \ .poweroff_late = suspend_fn, \ .restore_early = resume_fn, -#else -#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) -#endif -#ifdef CONFIG_PM_RUNTIME #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ .runtime_suspend = suspend_fn, \ .runtime_resume = resume_fn, \ .runtime_idle = idle_fn, -#else -#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) -#endif -#ifdef CONFIG_PM #define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ .runtime_suspend = suspend_fn, \ .runtime_resume = resume_fn, \ .runtime_idle = idle_fn, -#else -#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) -#endif /* * Use this if you want to use the same suspend and resume callbacks for suspend nobody will ever build a kernel without CONFIG_PM -> that is not true. The "tiny kernel" people what to be able to unset CONFIG_PM in particular. or any of its friends anyway and all that ifdeferry or __maybe_unused just to silence compilers warnings are very annoying. We are modifying the power Kconfig in 3.19-rc1 so that PM_SLEEP will always select PM_RUNTIME, so some of the #ifdefs can safely go away. Rafael -- 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