Re: [Bug 71431] USB Keyboard and Mouse are not recognized after boot via vl-805
Mirthful day, On Sun, Mar 02, 2014 at 09:44:19PM +, bugzilla-dae...@bugzilla.kernel.org wrote: https://bugzilla.kernel.org/show_bug.cgi?id=71431 --- Comment #1 from Greg Kroah-Hartman g...@kroah.com --- On Sun, Mar 02, 2014 at 08:01:09PM +, bugzilla-dae...@bugzilla.kernel.org wrote: https://bugzilla.kernel.org/show_bug.cgi?id=71431 Bug ID: 71431 Summary: USB Keyboard and Mouse are not recognized after boot Product: Drivers Version: 2.5 Kernel Version: 3.2.0-59, 3.2.13 Please send this to the linux-usb@vger.kernel.org mailing list. Also be sure you have CONFIG_HID enabled in your kernel configuration. yes CONFIG_HID should be enabled, I have been running the same System/configuration on a GA-78LMT-USB3 mainboard with the same USB Keyboard and Mouse without any problems. I'm running Kubuntu 12.04 with the 3.2.0-59 kernel and tried with 12.04-beta with the same results. Mirthful greetings Peter -- Peter Esselborn, Luftpumpe Fahrradhandel GmbH, Heidelberger Landstraße 190, 64297 Darmstadt, phon +49 6151 291884, fax +49 6151 292739 Öffnungszeiten: Mo - Fr 9.00 - 18.30, Sa 9.00 - 14.00, Mi Ruhetag http://www.luftpumpe.de, Epost: pe...@luftpumpe.de __ Bankverbindung HRB 4274 Amtsgericht Darmstadt GLS-Gemeinschaftsbank Geschäftsführer: IBAN: DE47 4306 0967 8016 8486 00 Peter Esselborn BIC: GENODEM1GLSUSTID: DE 111647013 Konto: 8016848600 BLZ: 430 609 67 -- 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 v9 0/9] USB Host support for OMAP5 uEVM
Hi Tony, On 03/01/2014 12:56 AM, Tony Lindgren wrote: * Roger Quadros rog...@ti.com [140227 06:21]: Hi, This patchset brings up USB Host ports and Ethernet port on the OMAP5 uEVM board. It also does some cleanup with respect to DT clock binding for the mfd/omap-usb-host driver. Please queue these for -next. Lee, I've folded some platform data dependent patches with mfd patches so that they don't break functionality when applied individually. You can safely pull in all MFD patches (1 to 6). Tony Benoit, Can you please accept patches 7, 8 and 9? Are 7, 8 and 9 safe to queue separately from the MFD changes or do they need to wait for the MFD changes to get merged first? They are safe to queue separately. cheers, -roger -- 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 v12 01/15] usb: doc: phy-mxs: Add more compatible strings
Add fsl,imx6q-usbphy for imx6dq and imx6dl, add fsl,imx6sl-usbphy for imx6sl, and fsl,imx23-usbphy is still a fallback for other strings. Signed-off-by: Peter Chen peter.c...@freescale.com --- Documentation/devicetree/bindings/usb/mxs-phy.txt |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index 5835b27..ea5134a 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt @@ -1,7 +1,11 @@ * Freescale MXS USB Phy Device Required properties: -- compatible: Should be fsl,imx23-usbphy +- compatible: should contain: + * fsl,imx23-usbphy for imx23 and imx28 + * fsl,imx6q-usbphy for imx6dq and imx6dl + * fsl,imx6sl-usbphy for imx6sl + fsl,imx23-usbphy is still a fallback for other strings - reg: Should contain registers location and length - interrupts: Should contain phy interrupt -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 03/15] usb: phy-mxs: Add auto clock and power setting
The auto setting is used to open related power and clocks automatically after receiving wakeup signal. With this feature, the PHY's clock and power can be recovered correctly from low power mode, it is guaranteed by IC logic. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 20 +--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index cf58d8e..d7adca3 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,11 @@ #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) +#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) +#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) +#define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) +#define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) #define BM_USBPHY_CTRL_ENUTMILEVEL3BIT(15) #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) @@ -96,9 +101,18 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) /* Power up the PHY */ writel(0, base + HW_USBPHY_PWD); - /* enable FS/LS device */ - writel(BM_USBPHY_CTRL_ENUTMILEVEL2 | - BM_USBPHY_CTRL_ENUTMILEVEL3, + /* +* USB PHY Ctrl Setting +* - Auto clock/power on +* - Enable full/low speed support +*/ + writel(BM_USBPHY_CTRL_ENAUTOSET_USBCLKS | + BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE | + BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD | + BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE | + BM_USBPHY_CTRL_ENAUTO_PWRON_PLL | + BM_USBPHY_CTRL_ENUTMILEVEL2 | + BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); return 0; -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 05/15] usb: phy-mxs: Add anatop regmap
It is needed by imx6 SoC series, but not for imx23 and imx28. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index d7adca3..2411e05 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -21,6 +21,8 @@ #include linux/err.h #include linux/io.h #include linux/of_device.h +#include linux/regmap.h +#include linux/mfd/syscon.h #define DRIVER_NAME mxs_phy @@ -87,6 +89,7 @@ struct mxs_phy { struct usb_phy phy; struct clk *clk; const struct mxs_phy_data *data; + struct regmap *regmap_anatop; }; static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) @@ -197,6 +200,7 @@ static int mxs_phy_probe(struct platform_device *pdev) int ret; const struct of_device_id *of_id = of_match_device(mxs_phy_dt_ids, pdev-dev); + struct device_node *np = pdev-dev.of_node; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(pdev-dev, res); @@ -216,6 +220,17 @@ static int mxs_phy_probe(struct platform_device *pdev) return -ENOMEM; } + /* Some SoCs don't have anatop registers */ + if (of_get_property(np, fsl,anatop, NULL)) { + mxs_phy-regmap_anatop = syscon_regmap_lookup_by_phandle + (np, fsl,anatop); + if (IS_ERR(mxs_phy-regmap_anatop)) { + dev_dbg(pdev-dev, + failed to find regmap for anatop\n); + return PTR_ERR(mxs_phy-regmap_anatop); + } + } + mxs_phy-phy.io_priv= base; mxs_phy-phy.dev= pdev-dev; mxs_phy-phy.label = DRIVER_NAME; -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 02/15] usb: phy-mxs: Add platform judgement code
The mxs-phy has several bugs and features at different versions, the driver code can get it through of_device_id.data. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 58 ++-- 1 files changed, 49 insertions(+), 9 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index b42897b..cf58d8e 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012-2013 Freescale Semiconductor, Inc. * Copyright (C) 2012 Marek Vasut ma...@denx.de * on behalf of DENX Software Engineering GmbH * @@ -20,6 +20,7 @@ #include linux/delay.h #include linux/err.h #include linux/io.h +#include linux/of_device.h #define DRIVER_NAME mxs_phy @@ -34,13 +35,55 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) + +/* Do disconnection between PHY and controller without vbus */ +#define MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS BIT(0) + +/* + * The PHY will be in messy if there is a wakeup after putting + * bus to suspend (set portsc.suspendM) but before setting PHY to low + * power mode (set portsc.phcd). + */ +#define MXS_PHY_ABNORMAL_IN_SUSPENDBIT(1) + +/* + * The SOF sends too fast after resuming, it will cause disconnection + * between host and high speed device. + */ +#define MXS_PHY_SENDING_SOF_TOO_FAST BIT(2) + +struct mxs_phy_data { + unsigned int flags; +}; + +static const struct mxs_phy_data imx23_phy_data = { + .flags = MXS_PHY_ABNORMAL_IN_SUSPEND | MXS_PHY_SENDING_SOF_TOO_FAST, +}; + +static const struct mxs_phy_data imx6q_phy_data = { + .flags = MXS_PHY_SENDING_SOF_TOO_FAST | + MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, +}; + +static const struct mxs_phy_data imx6sl_phy_data = { + .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, +}; + +static const struct of_device_id mxs_phy_dt_ids[] = { + { .compatible = fsl,imx6sl-usbphy, .data = imx6sl_phy_data, }, + { .compatible = fsl,imx6q-usbphy, .data = imx6q_phy_data, }, + { .compatible = fsl,imx23-usbphy, .data = imx23_phy_data, }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); + struct mxs_phy { struct usb_phy phy; struct clk *clk; + const struct mxs_phy_data *data; }; -#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) - static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -138,6 +181,8 @@ static int mxs_phy_probe(struct platform_device *pdev) struct clk *clk; struct mxs_phy *mxs_phy; int ret; + const struct of_device_id *of_id = + of_match_device(mxs_phy_dt_ids, pdev-dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(pdev-dev, res); @@ -168,6 +213,7 @@ static int mxs_phy_probe(struct platform_device *pdev) mxs_phy-phy.type = USB_PHY_TYPE_USB2; mxs_phy-clk = clk; + mxs_phy-data = of_id-data; platform_set_drvdata(pdev, mxs_phy); @@ -187,12 +233,6 @@ static int mxs_phy_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id mxs_phy_dt_ids[] = { - { .compatible = fsl,imx23-usbphy, }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); - static struct platform_driver mxs_phy_driver = { .probe = mxs_phy_probe, .remove = mxs_phy_remove, -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 04/15] usb: doc: phy-mxs: update binding for adding anatop phandle
Add anatop phandle which is used to access anatop registers to control PHY's power and other USB operations. Signed-off-by: Peter Chen peter.c...@freescale.com --- Documentation/devicetree/bindings/usb/mxs-phy.txt |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index ea5134a..cef181a 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt @@ -8,10 +8,12 @@ Required properties: fsl,imx23-usbphy is still a fallback for other strings - reg: Should contain registers location and length - interrupts: Should contain phy interrupt +- fsl,anatop: phandle for anatop register, it is only for imx6 SoC series Example: usbphy1: usbphy@020c9000 { compatible = fsl,imx6q-usbphy, fsl,imx23-usbphy; reg = 0x020c9000 0x1000; interrupts = 0 44 0x04; + fsl,anatop = anatop; }; -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 00/15] Add power management support for mxs phy
The serial adds power management support for MXS PHY, it includes: - Add one PHY API .set_wakeup, and related API implementation at mxs phy driver - misc changes and bug fixes for mxs phy to support low power mode and wakeup. It is based on the lastest Greg's 3.14-rc3. Changes for v12: - typo at 9/15, %s/waken/woken Changes for v11: - Change the descrition of adding compatible string, and add mention that fsl,imx23-usbphy is still a fallback for other strings. [1/15] Changes for v10: - Nothing related with function change. - It adds dt maintainers to To list, and cc devicet...@vger.kernel.org, wait dt-maintainer's ack for 1/15, 4/15. - Add last three dts patches for reference which have already at Shawn's tree. Changes for v9: - Fix the build warning if CONFIG_SUSPEND is not set Changes for v8: - Shawn has already applied two dts patches, so delete them at v8 version, http://marc.info/?l=linux-arm-kernelm=138785188404939w=2 - Using of_get_property to avoid imx6 fail at probe when using old DTB [5/12] - Do not consider failure if alias id is not existed, it can avoid fail at probe when using old DTB [8/12] - We don't need more changes for [8/12] change due to we use mxs_phy-port_id == as condition Changes for v7: - Fixed indentation problem at binding doc [1/14] - s/ganranteed/guaranteed, and add explanation for auto setting [3/14] - add static before SIMPLE_DEV_PM_OPS [13/14] - add one patch to change usb device description [7/14] - Delete the .nofity_suspend and .notify_resume due to Felipe does not agree to add them as PHY API, will use other ways to implement them in future. Changes for v6: - Add description for IC bug fixes logic. [9/15] - Move is_imx6q_phy and is_imx6sl_phy from [9/15] to [14/15] - %s/mxs_phy_clock_switch/mxs_phy_clock_switch_delay to reflect the function meaning more precise [15/15] Changes for v5: Add Marc and Michael Grzeschik's commnets - typo error at [2/15] - sqhash patches which introducing mxs_phy_disconnect_line and fixed but at this function. [13/15] - Introducing flag MXS_PHY_NEED_IP_FIX who stands for the SoCs who have IC fixes. [2/15, 8/15] - Delete one patch for low speed connection problem at every rare situations due to the root cause has still not found. Peter Chen (15): usb: doc: phy-mxs: Add more compatible strings usb: phy-mxs: Add platform judgement code usb: phy-mxs: Add auto clock and power setting usb: doc: phy-mxs: update binding for adding anatop phandle usb: phy-mxs: Add anatop regmap usb: phy-mxs: change description of usb device speed usb: phy-mxs: Enable IC fixes for related SoCs usb: phy-mxs: add controller id usb: phy: Add set_wakeup API usb: phy-mxs: Add implementation of set_wakeup usb: phy-mxs: Add system suspend/resume API usb: phy-mxs: Add sync time after controller clear phcd ARM: dts: mxs: add mxs phy controller id ARM: dts: imx6: add anatop phandle for usbphy ARM: dts: imx6: add mxs phy controller id Documentation/devicetree/bindings/usb/mxs-phy.txt |8 +- arch/arm/boot/dts/imx23.dtsi |1 + arch/arm/boot/dts/imx28.dtsi |2 + arch/arm/boot/dts/imx6qdl.dtsi|4 + arch/arm/boot/dts/imx6sl.dtsi |4 + drivers/usb/phy/phy-mxs-usb.c | 310 - include/linux/usb/phy.h | 16 + 7 files changed, 330 insertions(+), 15 deletions(-) -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 13/15] ARM: dts: mxs: add mxs phy controller id
We need to use controller id to access different register regions for mxs phy. Signed-off-by: Peter Chen peter.c...@freescale.com Signed-off-by: Shawn Guo shawn@linaro.org --- arch/arm/boot/dts/imx23.dtsi |1 + arch/arm/boot/dts/imx28.dtsi |2 ++ 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index 581b754..8a99a64 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi @@ -23,6 +23,7 @@ serial1 = auart1; spi0 = ssp0; spi1 = ssp1; + usbphy0 = usbphy0; }; cpus { diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index f8e9b20..7da22b3 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -32,6 +32,8 @@ serial4 = auart4; spi0 = ssp1; spi1 = ssp2; + usbphy0 = usbphy0; + usbphy1 = usbphy1; }; cpus { -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 14/15] ARM: dts: imx6: add anatop phandle for usbphy
Add anatop phandle for usbphy Signed-off-by: Peter Chen peter.c...@freescale.com Signed-off-by: Shawn Guo shawn@linaro.org --- arch/arm/boot/dts/imx6qdl.dtsi |2 ++ arch/arm/boot/dts/imx6sl.dtsi |2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index fb28b2e..047b147 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -557,6 +557,7 @@ reg = 0x020c9000 0x1000; interrupts = 0 44 0x04; clocks = clks 182; + fsl,anatop = anatop; }; usbphy2: usbphy@020ca000 { @@ -564,6 +565,7 @@ reg = 0x020ca000 0x1000; interrupts = 0 45 0x04; clocks = clks 183; + fsl,anatop = anatop; }; snvs@020cc000 { diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 28558f1..30322b5 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -489,6 +489,7 @@ reg = 0x020c9000 0x1000; interrupts = 0 44 0x04; clocks = clks IMX6SL_CLK_USBPHY1; + fsl,anatop = anatop; }; usbphy2: usbphy@020ca000 { @@ -496,6 +497,7 @@ reg = 0x020ca000 0x1000; interrupts = 0 45 0x04; clocks = clks IMX6SL_CLK_USBPHY2; + fsl,anatop = anatop; }; snvs@020cc000 { -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 09/15] usb: phy: Add set_wakeup API
This API is used to set wakeup enable at PHY registers, in that case, the PHY can be waken up from suspend due to external events, like vbus change, dp/dm change and id change. Signed-off-by: Peter Chen peter.c...@freescale.com --- include/linux/usb/phy.h | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 6c0b1c5..353053a 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -111,6 +111,13 @@ struct usb_phy { int (*set_suspend)(struct usb_phy *x, int suspend); + /* +* Set wakeup enable for PHY, in that case, the PHY can be +* woken up from suspend status due to external events, +* like vbus change, dp/dm change and id. +*/ + int (*set_wakeup)(struct usb_phy *x, bool enabled); + /* notify phy connect status change */ int (*notify_connect)(struct usb_phy *x, enum usb_device_speed speed); @@ -265,6 +272,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend) } static inline int +usb_phy_set_wakeup(struct usb_phy *x, bool enabled) +{ + if (x x-set_wakeup) + return x-set_wakeup(x, enabled); + else + return 0; +} + +static inline int usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) { if (x x-notify_connect) -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 15/15] ARM: dts: imx6: add mxs phy controller id
We need to use controller id to access different register regions for mxs phy. Signed-off-by: Peter Chen peter.c...@freescale.com Signed-off-by: Shawn Guo shawn@linaro.org --- arch/arm/boot/dts/imx6qdl.dtsi |2 ++ arch/arm/boot/dts/imx6sl.dtsi |2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index 047b147..581c4c9 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -33,6 +33,8 @@ spi1 = ecspi2; spi2 = ecspi3; spi3 = ecspi4; + usbphy0 = usbphy1; + usbphy1 = usbphy2; }; intc: interrupt-controller@00a01000 { diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 30322b5..a06d939 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -27,6 +27,8 @@ spi1 = ecspi2; spi2 = ecspi3; spi3 = ecspi4; + usbphy0 = usbphy1; + usbphy1 = usbphy2; }; cpus { -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 07/15] usb: phy-mxs: Enable IC fixes for related SoCs
Two PHY bugs are fixed by IC logic, but these bits are not enabled by default, so we enable them at driver. The two bugs are: MXS_PHY_ABNORMAL_IN_SUSPEND and MXS_PHY_SENDING_SOF_TOO_FAST which are described at code. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 23 +-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 1663a66..cb71135 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,10 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_IP 0x90 +#define HW_USBPHY_IP_SET 0x94 +#define HW_USBPHY_IP_CLR 0x98 + #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) @@ -42,6 +46,8 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define BM_USBPHY_IP_FIX (BIT(17) | BIT(18)) + #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) /* Do disconnection between PHY and controller without vbus */ @@ -60,6 +66,14 @@ */ #define MXS_PHY_SENDING_SOF_TOO_FAST BIT(2) +/* + * IC has bug fixes logic, they include + * MXS_PHY_ABNORMAL_IN_SUSPEND and MXS_PHY_SENDING_SOF_TOO_FAST + * which are described at above flags, the RTL will handle it + * according to different versions. + */ +#define MXS_PHY_NEED_IP_FIXBIT(3) + struct mxs_phy_data { unsigned int flags; }; @@ -70,11 +84,13 @@ static const struct mxs_phy_data imx23_phy_data = { static const struct mxs_phy_data imx6q_phy_data = { .flags = MXS_PHY_SENDING_SOF_TOO_FAST | - MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, + MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | + MXS_PHY_NEED_IP_FIX, }; static const struct mxs_phy_data imx6sl_phy_data = { - .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, + .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | + MXS_PHY_NEED_IP_FIX, }; static const struct of_device_id mxs_phy_dt_ids[] = { @@ -118,6 +134,9 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); + if (mxs_phy-data-flags MXS_PHY_NEED_IP_FIX) + writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET); + return 0; } -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 06/15] usb: phy-mxs: change description of usb device speed
Change high speed to HS Change non-high speed to FS/LS Implementation of notify_suspend and notify_resume will be different according to mxs_phy_data-flags. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 2411e05..1663a66 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -168,8 +168,8 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend) static int mxs_phy_on_connect(struct usb_phy *phy, enum usb_device_speed speed) { - dev_dbg(phy-dev, %s speed device has connected\n, - (speed == USB_SPEED_HIGH) ? high : non-high); + dev_dbg(phy-dev, %s device has connected\n, + (speed == USB_SPEED_HIGH) ? HS : FS/LS); if (speed == USB_SPEED_HIGH) writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, @@ -181,8 +181,8 @@ static int mxs_phy_on_connect(struct usb_phy *phy, static int mxs_phy_on_disconnect(struct usb_phy *phy, enum usb_device_speed speed) { - dev_dbg(phy-dev, %s speed device has disconnected\n, - (speed == USB_SPEED_HIGH) ? high : non-high); + dev_dbg(phy-dev, %s device has disconnected\n, + (speed == USB_SPEED_HIGH) ? HS : FS/LS); if (speed == USB_SPEED_HIGH) writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 12/15] usb: phy-mxs: Add sync time after controller clear phcd
After clear portsc.phcd, PHY needs 200us stable time for switch 32K clock to AHB clock. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 31ef59f..c42bdf0 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy) return mxs_phy-data == imx6sl_phy_data; } +/* + * PHY needs some 32K cycles to switch from 32K clock to + * bus (such as AHB/AXI, etc) clock. + */ +static void mxs_phy_clock_switch_delay(void) +{ + usleep_range(300, 400); +} + static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -261,6 +270,7 @@ static int mxs_phy_init(struct usb_phy *phy) int ret; struct mxs_phy *mxs_phy = to_mxs_phy(phy); + mxs_phy_clock_switch_delay(); ret = clk_prepare_enable(mxs_phy-clk); if (ret) return ret; @@ -289,6 +299,7 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend) x-io_priv + HW_USBPHY_CTRL_SET); clk_disable_unprepare(mxs_phy-clk); } else { + mxs_phy_clock_switch_delay(); ret = clk_prepare_enable(mxs_phy-clk); if (ret) return ret; -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 10/15] usb: phy-mxs: Add implementation of set_wakeup
When we need the PHY can be waken up by external signals, we can call this API. Besides, we call mxs_phy_disconnect_line at this API to close the connection between USB PHY and controller, after that, the line state from controller is SE0. Once the PHY is out of power, without calling mxs_phy_disconnect_line, there are unknown wakeups due to dp/dm floating at device mode. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 116 + 1 files changed, 116 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 3009ab5..da2eb6c 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,9 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_DEBUG_SET0x54 +#define HW_USBPHY_DEBUG_CLR0x58 + #define HW_USBPHY_IP 0x90 #define HW_USBPHY_IP_SET 0x94 #define HW_USBPHY_IP_CLR 0x98 @@ -39,6 +42,9 @@ #define BM_USBPHY_CTRL_CLKGATE BIT(30) #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) #define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENVBUSCHG_WKUP BIT(23) +#define BM_USBPHY_CTRL_ENIDCHG_WKUPBIT(22) +#define BM_USBPHY_CTRL_ENDPDMCHG_WKUP BIT(21) #define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) #define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) #define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) @@ -48,6 +54,25 @@ #define BM_USBPHY_IP_FIX (BIT(17) | BIT(18)) +#define BM_USBPHY_DEBUG_CLKGATEBIT(30) + +/* Anatop Registers */ +#define ANADIG_USB1_VBUS_DET_STAT 0x1c0 +#define ANADIG_USB2_VBUS_DET_STAT 0x220 + +#define ANADIG_USB1_LOOPBACK_SET 0x1e4 +#define ANADIG_USB1_LOOPBACK_CLR 0x1e8 +#define ANADIG_USB2_LOOPBACK_SET 0x244 +#define ANADIG_USB2_LOOPBACK_CLR 0x248 + +#define BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALIDBIT(3) +#define BM_ANADIG_USB2_VBUS_DET_STAT_VBUS_VALIDBIT(3) + +#define BM_ANADIG_USB1_LOOPBACK_UTMI_DIG_TST1 BIT(2) +#define BM_ANADIG_USB1_LOOPBACK_TSTI_TX_EN BIT(5) +#define BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 BIT(2) +#define BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN BIT(5) + #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) /* Do disconnection between PHY and controller without vbus */ @@ -141,6 +166,79 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) return 0; } +/* Return true if the vbus is there */ +static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy) +{ + unsigned int vbus_value; + + if (mxs_phy-port_id == 0) + regmap_read(mxs_phy-regmap_anatop, + ANADIG_USB1_VBUS_DET_STAT, + vbus_value); + else if (mxs_phy-port_id == 1) + regmap_read(mxs_phy-regmap_anatop, + ANADIG_USB2_VBUS_DET_STAT, + vbus_value); + + if (vbus_value BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALID) + return true; + else + return false; +} + +static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) +{ + void __iomem *base = mxs_phy-phy.io_priv; + u32 reg; + + if (disconnect) + writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, + base + HW_USBPHY_DEBUG_CLR); + + if (mxs_phy-port_id == 0) { + reg = disconnect ? ANADIG_USB1_LOOPBACK_SET + : ANADIG_USB1_LOOPBACK_CLR; + regmap_write(mxs_phy-regmap_anatop, reg, + BM_ANADIG_USB1_LOOPBACK_UTMI_DIG_TST1 | + BM_ANADIG_USB1_LOOPBACK_TSTI_TX_EN); + } else if (mxs_phy-port_id == 1) { + reg = disconnect ? ANADIG_USB2_LOOPBACK_SET + : ANADIG_USB2_LOOPBACK_CLR; + regmap_write(mxs_phy-regmap_anatop, reg, + BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 | + BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN); + } + + if (!disconnect) + writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, + base + HW_USBPHY_DEBUG_SET); + + /* Delay some time, and let Linestate be SE0 for controller */ + if (disconnect) + usleep_range(500, 1000); +} + +static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) +{ + bool vbus_is_on = false; + + /* If the SoCs don't need to disconnect line without vbus, quit */ + if (!(mxs_phy-data-flags MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS)) + return; + + /* If the SoCs don't have anatop, quit */ + if (!mxs_phy-regmap_anatop) +
[PATCH v12 08/15] usb: phy-mxs: add controller id
It is used to access un-regulator registers according to different controllers. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index cb71135..3009ab5 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -106,6 +106,7 @@ struct mxs_phy { struct clk *clk; const struct mxs_phy_data *data; struct regmap *regmap_anatop; + int port_id; }; static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) @@ -250,6 +251,11 @@ static int mxs_phy_probe(struct platform_device *pdev) } } + ret = of_alias_get_id(np, usbphy); + if (ret 0) + dev_dbg(pdev-dev, failed to get alias id, errno %d\n, ret); + mxs_phy-port_id = ret; + mxs_phy-phy.io_priv= base; mxs_phy-phy.dev= pdev-dev; mxs_phy-phy.label = DRIVER_NAME; -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v12 11/15] usb: phy-mxs: Add system suspend/resume API
We need this to keep PHY's power on or off during the system suspend mode. If we need to enable USB wakeup, then we must keep PHY's power being on during the system suspend mode. Otherwise, we need to keep PHY's power being off to save power. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 61 + 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index da2eb6c..31ef59f 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -57,6 +57,10 @@ #define BM_USBPHY_DEBUG_CLKGATEBIT(30) /* Anatop Registers */ +#define ANADIG_ANA_MISC0 0x150 +#define ANADIG_ANA_MISC0_SET 0x154 +#define ANADIG_ANA_MISC0_CLR 0x158 + #define ANADIG_USB1_VBUS_DET_STAT 0x1c0 #define ANADIG_USB2_VBUS_DET_STAT 0x220 @@ -65,6 +69,9 @@ #define ANADIG_USB2_LOOPBACK_SET 0x244 #define ANADIG_USB2_LOOPBACK_CLR 0x248 +#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG BIT(12) +#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL BIT(11) + #define BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALIDBIT(3) #define BM_ANADIG_USB2_VBUS_DET_STAT_VBUS_VALIDBIT(3) @@ -134,6 +141,16 @@ struct mxs_phy { int port_id; }; +static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy) +{ + return mxs_phy-data == imx6q_phy_data; +} + +static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy) +{ + return mxs_phy-data == imx6sl_phy_data; +} + static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -387,6 +404,8 @@ static int mxs_phy_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mxs_phy); + device_set_wakeup_capable(pdev-dev, true); + ret = usb_add_phy_dev(mxs_phy-phy); if (ret) return ret; @@ -403,6 +422,47 @@ static int mxs_phy_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static void mxs_phy_enable_ldo_in_suspend(struct mxs_phy *mxs_phy, bool on) +{ + unsigned int reg = on ? ANADIG_ANA_MISC0_SET : ANADIG_ANA_MISC0_CLR; + + /* If the SoCs don't have anatop, quit */ + if (!mxs_phy-regmap_anatop) + return; + + if (is_imx6q_phy(mxs_phy)) + regmap_write(mxs_phy-regmap_anatop, reg, + BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG); + else if (is_imx6sl_phy(mxs_phy)) + regmap_write(mxs_phy-regmap_anatop, + reg, BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL); +} + +static int mxs_phy_system_suspend(struct device *dev) +{ + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + mxs_phy_enable_ldo_in_suspend(mxs_phy, true); + + return 0; +} + +static int mxs_phy_system_resume(struct device *dev) +{ + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + mxs_phy_enable_ldo_in_suspend(mxs_phy, false); + + return 0; +} +#endif /* CONFIG_PM_SLEEP */ + +static SIMPLE_DEV_PM_OPS(mxs_phy_pm, mxs_phy_system_suspend, + mxs_phy_system_resume); + static struct platform_driver mxs_phy_driver = { .probe = mxs_phy_probe, .remove = mxs_phy_remove, @@ -410,6 +470,7 @@ static struct platform_driver mxs_phy_driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, .of_match_table = mxs_phy_dt_ids, + .pm = mxs_phy_pm, }, }; -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] phy-omap-usb2 driver enhancements
This series * Adds suport for AM437x USB2 PHY driver * Address DRA7 PHY errata for false disconnect * New compatible for OMAP5 Austin Beam (1): phy: omap-usb2: Provide workaround for USB2PHY false disconnect George Cherian (2): phy: omap-usb2: Adapt phy-omap-usb2 for AM437x phy: omap-usb2: Add different compatible for OMAP5 Documentation/devicetree/bindings/usb/usb-phy.txt | 6 +- drivers/phy/phy-omap-usb2.c | 106 +++--- include/linux/usb/omap_usb.h | 12 +++ 3 files changed, 111 insertions(+), 13 deletions(-) -- 1.8.3.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 1/3] phy: omap-usb2: Adapt phy-omap-usb2 for AM437x
Adapt phy-omap-usb2 driver for AM437x. - Add new comaptible ti,am437x-usb2 for AM437x - Pass proper data to differentiate AM437x and others. - AM437x doesnot support set_vbus and start_srp. - Also update the Documentation to add new compatible. Signed-off-by: George Cherian george.cher...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 4 +- drivers/phy/phy-omap-usb2.c | 49 +-- include/linux/usb/omap_usb.h | 9 + 3 files changed, 49 insertions(+), 13 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index c0245c8..b3fa409 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -3,7 +3,9 @@ USB PHY OMAP USB2 PHY Required properties: - - compatible: Should be ti,omap-usb2 + - compatible: Should be either of + * ti,omap-usb2 for OMAP4, OMAP5, DRA7 + * ti,am437x-usb2 for AM437x - reg : Address and length of the register set for the device. - #phy-cells: determine the number of cells that should be given in the phandle while referencing this phy. diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 7699752..d54f24b 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -144,6 +144,31 @@ static struct phy_ops ops = { .owner = THIS_MODULE, }; +#ifdef CONFIG_OF +static const struct usb_phy_data omap_usb2_data = { + .label = omap_usb2, + .flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS, +}; + +static const struct usb_phy_data am437x_usb2_data = { + .label = am437x_usb2, + .flags = 0, +}; + +static const struct of_device_id omap_usb2_id_table[] = { + { + .compatible = ti,omap-usb2, + .data = omap_usb2_data, + }, + { + .compatible = ti,am437x-usb2, + .data = am437x_usb2_data, + }, + {}, +}; +MODULE_DEVICE_TABLE(of, omap_usb2_id_table); +#endif + static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; @@ -153,10 +178,16 @@ static int omap_usb2_probe(struct platform_device *pdev) struct device_node *node = pdev-dev.of_node; struct device_node *control_node; struct platform_device *control_pdev; + const struct of_device_id *of_id; + struct usb_phy_data *phy_data; + + of_id = of_match_device(of_match_ptr(omap_usb2_id_table), pdev-dev); - if (!node) + if (!of_id) return -EINVAL; + phy_data = (struct usb_phy_data *)of_id-data; + phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL); if (!phy) { dev_err(pdev-dev, unable to allocate memory for USB2 PHY\n); @@ -172,7 +203,7 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-dev= pdev-dev; phy-phy.dev= phy-dev; - phy-phy.label = omap-usb2; + phy-phy.label = phy_data-label; phy-phy.set_suspend= omap_usb2_suspend; phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; @@ -196,8 +227,10 @@ static int omap_usb2_probe(struct platform_device *pdev) otg-set_host = omap_usb_set_host; otg-set_peripheral = omap_usb_set_peripheral; - otg-set_vbus = omap_usb_set_vbus; - otg-start_srp = omap_usb_start_srp; + if (phy_data-flags OMAP_USB2_HAS_SET_VBUS) + otg-set_vbus = omap_usb_set_vbus; + if (phy_data-flags OMAP_USB2_HAS_START_SRP) + otg-start_srp = omap_usb_start_srp; otg-phy= phy-phy; platform_set_drvdata(pdev, phy); @@ -297,14 +330,6 @@ static const struct dev_pm_ops omap_usb2_pm_ops = { #define DEV_PM_OPS NULL #endif -#ifdef CONFIG_OF -static const struct of_device_id omap_usb2_id_table[] = { - { .compatible = ti,omap-usb2 }, - {} -}; -MODULE_DEVICE_TABLE(of, omap_usb2_id_table); -#endif - static struct platform_driver omap_usb2_driver = { .probe = omap_usb2_probe, .remove = omap_usb2_remove, diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h index 6ae2936..034161d 100644 --- a/include/linux/usb/omap_usb.h +++ b/include/linux/usb/omap_usb.h @@ -42,6 +42,15 @@ struct omap_usb { u8 is_suspended:1; }; +struct usb_phy_data { + const char *label; + u32 flags; +}; + +/* Driver Flags */ +#define OMAP_USB2_HAS_START_SRP (1 0) +#define OMAP_USB2_HAS_SET_VBUS (1 1) + #definephy_to_omapusb(x) container_of((x), struct omap_usb, phy) #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) -- 1.8.3.1 -- To unsubscribe from this list: send the line
[PATCH 2/3] phy: omap-usb2: Provide workaround for USB2PHY false disconnect
From: Austin Beam austinb...@ti.com Enable the dra7x errata workaround for false disconnect problem with USB2PHY. False disconnects were detected with some of the devices. Reduce the sensitivity of the disconnect logic within the USB2PHY subsystem to enusre these false disconnects are not registered. [george.cher...@ti.com] While at that, pass proper flags for each SoC's. This is a common driver used across OMAP4,OMAP5,DRA7xx and AM437x USB2PHY. False disconnect workaround is currently applicable for only DRA7x. Update the Documentation also to add new comaptible. Signed-off-by: Austin Beam austinb...@ti.com Signed-off-by: George Cherian george.cher...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 3 +- drivers/phy/phy-omap-usb2.c | 48 +++ include/linux/usb/omap_usb.h | 3 ++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index b3fa409..03de61a5 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -4,7 +4,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be either of - * ti,omap-usb2 for OMAP4, OMAP5, DRA7 + * ti,omap-usb2 for OMAP4 and OMAP5 + * ti,dra7x-usb2 for DRA7 * ti,am437x-usb2 for AM437x - reg : Address and length of the register set for the device. - #phy-cells: determine the number of cells that should be given in the diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index d54f24b..80ba7f0 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -31,6 +31,9 @@ #include linux/phy/phy.h #include linux/of_platform.h +#define USB2PHY_DISCON_BYP_LATCH (1 31) +#define USB2PHY_ANA_CONFIG1 0x4c + /** * omap_usb2_set_comparator - links the comparator present in the sytem with * this phy @@ -138,7 +141,30 @@ static int omap_usb_power_on(struct phy *x) return 0; } +static int omap_usb_init(struct phy *x) +{ + struct omap_usb *phy = phy_get_drvdata(x); + u32 val; + + if (phy-flags OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { + /* +* +* Reduce the sensitivity of internal PHY by enabling the +* DISCON_BYP_LATCH of the USB2PHY_ANA_CONFIG1 register. This +* resolves issues with certain devices which can otherwise +* be prone to false disconnects. +* +*/ + val = omap_usb_readl(phy-phy_base, USB2PHY_ANA_CONFIG1); + val |= USB2PHY_DISCON_BYP_LATCH; + omap_usb_writel(phy-phy_base, USB2PHY_ANA_CONFIG1, val); + } + + return 0; +} + static struct phy_ops ops = { + .init = omap_usb_init, .power_on = omap_usb_power_on, .power_off = omap_usb_power_off, .owner = THIS_MODULE, @@ -150,6 +176,11 @@ static const struct usb_phy_data omap_usb2_data = { .flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS, }; +static const struct usb_phy_data dra7x_usb2_data = { + .label = dra7x_usb2, + .flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT, +}; + static const struct usb_phy_data am437x_usb2_data = { .label = am437x_usb2, .flags = 0, @@ -161,6 +192,10 @@ static const struct of_device_id omap_usb2_id_table[] = { .data = omap_usb2_data, }, { + .compatible = ti,dra7x-usb2, + .data = dra7x_usb2_data, + }, + { .compatible = ti,am437x-usb2, .data = am437x_usb2_data, }, @@ -173,6 +208,7 @@ static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; struct phy *generic_phy; + struct resource *res; struct phy_provider *phy_provider; struct usb_otg *otg; struct device_node *node = pdev-dev.of_node; @@ -208,6 +244,18 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; + if (phy_data-flags OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(pdev-dev, memory resource not available\n); + return -ENODEV; + } + phy-phy_base = devm_request_and_ioremap(pdev-dev, res); + if (!phy-phy_base) + return -ENOMEM; + phy-flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; + } + control_node = of_parse_phandle(node, ctrl-module, 0); if (!control_node) { dev_err(pdev-dev, Failed to get control device
[PATCH 2/3] phy: omap-usb2: Provide workaround for USB2PHY false disconnect
From: Austin Beam austinb...@ti.com Enable the dra7x errata workaround for false disconnect problem with USB2PHY. False disconnects were detected with some of the devices. Reduce the sensitivity of the disconnect logic within the USB2PHY subsystem to enusre these false disconnects are not registered. [george.cher...@ti.com] While at that, pass proper flags for each SoC's. This is a common driver used across OMAP4,OMAP5,DRA7xx and AM437x USB2PHY. False disconnect workaround is currently applicable for only DRA7x. Update the Documentation also to add new comaptible. Signed-off-by: Austin Beam austinb...@ti.com Signed-off-by: George Cherian george.cher...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 3 +- drivers/phy/phy-omap-usb2.c | 48 +++ include/linux/usb/omap_usb.h | 3 ++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index b3fa409..03de61a5 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -4,7 +4,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be either of - * ti,omap-usb2 for OMAP4, OMAP5, DRA7 + * ti,omap-usb2 for OMAP4 and OMAP5 + * ti,dra7x-usb2 for DRA7 * ti,am437x-usb2 for AM437x - reg : Address and length of the register set for the device. - #phy-cells: determine the number of cells that should be given in the diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index d54f24b..80ba7f0 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -31,6 +31,9 @@ #include linux/phy/phy.h #include linux/of_platform.h +#define USB2PHY_DISCON_BYP_LATCH (1 31) +#define USB2PHY_ANA_CONFIG1 0x4c + /** * omap_usb2_set_comparator - links the comparator present in the sytem with * this phy @@ -138,7 +141,30 @@ static int omap_usb_power_on(struct phy *x) return 0; } +static int omap_usb_init(struct phy *x) +{ + struct omap_usb *phy = phy_get_drvdata(x); + u32 val; + + if (phy-flags OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { + /* +* +* Reduce the sensitivity of internal PHY by enabling the +* DISCON_BYP_LATCH of the USB2PHY_ANA_CONFIG1 register. This +* resolves issues with certain devices which can otherwise +* be prone to false disconnects. +* +*/ + val = omap_usb_readl(phy-phy_base, USB2PHY_ANA_CONFIG1); + val |= USB2PHY_DISCON_BYP_LATCH; + omap_usb_writel(phy-phy_base, USB2PHY_ANA_CONFIG1, val); + } + + return 0; +} + static struct phy_ops ops = { + .init = omap_usb_init, .power_on = omap_usb_power_on, .power_off = omap_usb_power_off, .owner = THIS_MODULE, @@ -150,6 +176,11 @@ static const struct usb_phy_data omap_usb2_data = { .flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS, }; +static const struct usb_phy_data dra7x_usb2_data = { + .label = dra7x_usb2, + .flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT, +}; + static const struct usb_phy_data am437x_usb2_data = { .label = am437x_usb2, .flags = 0, @@ -161,6 +192,10 @@ static const struct of_device_id omap_usb2_id_table[] = { .data = omap_usb2_data, }, { + .compatible = ti,dra7x-usb2, + .data = dra7x_usb2_data, + }, + { .compatible = ti,am437x-usb2, .data = am437x_usb2_data, }, @@ -173,6 +208,7 @@ static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; struct phy *generic_phy; + struct resource *res; struct phy_provider *phy_provider; struct usb_otg *otg; struct device_node *node = pdev-dev.of_node; @@ -208,6 +244,18 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; + if (phy_data-flags OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(pdev-dev, memory resource not available\n); + return -ENODEV; + } + phy-phy_base = devm_request_and_ioremap(pdev-dev, res); + if (!phy-phy_base) + return -ENOMEM; + phy-flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; + } + control_node = of_parse_phandle(node, ctrl-module, 0); if (!control_node) { dev_err(pdev-dev, Failed to get control device
[PATCH 3/3] phy: omap-usb2: Add different compatible for OMAP5
Add a new compatible for OMAP5 since it does not use any of the OTG operations as of now. HAS_SRP and SET_VBUS functionalities are used only for OMAP4. Update the Documentation also to add new comaptible. Signed-off-by: George Cherian george.cher...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 3 ++- drivers/phy/phy-omap-usb2.c | 9 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index 03de61a5..ec199a5 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -4,7 +4,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be either of - * ti,omap-usb2 for OMAP4 and OMAP5 + * ti,omap-usb2 for OMAP4 + * ti,omap5-usb2 for OMAP5 * ti,dra7x-usb2 for DRA7 * ti,am437x-usb2 for AM437x - reg : Address and length of the register set for the device. diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 80ba7f0..4af778f 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -176,6 +176,11 @@ static const struct usb_phy_data omap_usb2_data = { .flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS, }; +static const struct usb_phy_data omap5_usb2_data = { + .label = omap5_usb2, + .flags = 0, +}; + static const struct usb_phy_data dra7x_usb2_data = { .label = dra7x_usb2, .flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT, @@ -192,6 +197,10 @@ static const struct of_device_id omap_usb2_id_table[] = { .data = omap_usb2_data, }, { + .compatible = ti,omap5-usb2, + .data = omap5_usb2_data, + }, + { .compatible = ti,dra7x-usb2, .data = dra7x_usb2_data, }, -- 1.8.3.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: 3.13-rc1 regression: Scatter-gather list issues at SuperSpeed only
From: Alan Stern When testing 3.14-rc1 with a USB 3.0 Lexar flash drive, the drive fails to be mounted. ... That revealed the SCSI request fails because the USB core is rejecting a scatter-gather list with an entry that isn't aligned to the max packet size: Feb 28 09:45:30 xanatos kernel: [ 376.449316] usb 2-2: URB sg entry 0 of 17, size 1536 not a multiple of ep1in max packet 1024 Notice the request length: 1536. That's three 512-byte sectors. A little unusual, since most I/O is done in units of pages, which are 4096 bytes. ... Some of this behavior is to be expected. 1536 isn't a multiple of 1024 (the maxpacket size when running at SuperSpeed), but it _is_ a multiple of 512 (the maxpacket size when running at high speed). Therefore the failure won't occur when the drive is attached to an EHCI controller or is behind a USB-2 hub. It should be possible to modify the driver so that it is only necessary to have a 1024 byte boundary within a ring segment. The last fragment that crosses a 1k boundary would need to be truncated and then followed by a link TRB. The only real difficulty is that you then don't know how many TRBs will be needed until you actually start writing them. Which might mean moving the ring expansion down into the code that actually writes the TRBs. I also think it might be worth queueing some requests as URBs rather than expanding the rings so that they fit. However to do that you probably need to apply some of the 'simplifiaction' patches I wrote first (or equivalent patches). David -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] phy: omap-usb2: Provide workaround for USB2PHY false disconnect
From: Austin Beam austinb...@ti.com Enable the dra7x errata workaround for false disconnect problem with USB2PHY. False disconnects were detected with some of the devices. Reduce the sensitivity of the disconnect logic within the USB2PHY subsystem to enusre these false disconnects are not registered. [george.cher...@ti.com] While at that, pass proper flags for each SoC's. This is a common driver used across OMAP4,OMAP5,DRA7xx and AM437x USB2PHY. False disconnect workaround is currently applicable for only DRA7x. Update the Documentation also to add new comaptible. Signed-off-by: Austin Beam austinb...@ti.com Signed-off-by: George Cherian george.cher...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/usb/usb-phy.txt | 3 +- drivers/phy/phy-omap-usb2.c | 48 +++ include/linux/usb/omap_usb.h | 3 ++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt index b3fa409..03de61a5 100644 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt @@ -4,7 +4,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be either of - * ti,omap-usb2 for OMAP4, OMAP5, DRA7 + * ti,omap-usb2 for OMAP4 and OMAP5 + * ti,dra7x-usb2 for DRA7 * ti,am437x-usb2 for AM437x - reg : Address and length of the register set for the device. - #phy-cells: determine the number of cells that should be given in the diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index d54f24b..80ba7f0 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -31,6 +31,9 @@ #include linux/phy/phy.h #include linux/of_platform.h +#define USB2PHY_DISCON_BYP_LATCH (1 31) +#define USB2PHY_ANA_CONFIG1 0x4c + /** * omap_usb2_set_comparator - links the comparator present in the sytem with * this phy @@ -138,7 +141,30 @@ static int omap_usb_power_on(struct phy *x) return 0; } +static int omap_usb_init(struct phy *x) +{ + struct omap_usb *phy = phy_get_drvdata(x); + u32 val; + + if (phy-flags OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { + /* +* +* Reduce the sensitivity of internal PHY by enabling the +* DISCON_BYP_LATCH of the USB2PHY_ANA_CONFIG1 register. This +* resolves issues with certain devices which can otherwise +* be prone to false disconnects. +* +*/ + val = omap_usb_readl(phy-phy_base, USB2PHY_ANA_CONFIG1); + val |= USB2PHY_DISCON_BYP_LATCH; + omap_usb_writel(phy-phy_base, USB2PHY_ANA_CONFIG1, val); + } + + return 0; +} + static struct phy_ops ops = { + .init = omap_usb_init, .power_on = omap_usb_power_on, .power_off = omap_usb_power_off, .owner = THIS_MODULE, @@ -150,6 +176,11 @@ static const struct usb_phy_data omap_usb2_data = { .flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS, }; +static const struct usb_phy_data dra7x_usb2_data = { + .label = dra7x_usb2, + .flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT, +}; + static const struct usb_phy_data am437x_usb2_data = { .label = am437x_usb2, .flags = 0, @@ -161,6 +192,10 @@ static const struct of_device_id omap_usb2_id_table[] = { .data = omap_usb2_data, }, { + .compatible = ti,dra7x-usb2, + .data = dra7x_usb2_data, + }, + { .compatible = ti,am437x-usb2, .data = am437x_usb2_data, }, @@ -173,6 +208,7 @@ static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; struct phy *generic_phy; + struct resource *res; struct phy_provider *phy_provider; struct usb_otg *otg; struct device_node *node = pdev-dev.of_node; @@ -208,6 +244,18 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; + if (phy_data-flags OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(pdev-dev, memory resource not available\n); + return -ENODEV; + } + phy-phy_base = devm_request_and_ioremap(pdev-dev, res); + if (!phy-phy_base) + return -ENOMEM; + phy-flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; + } + control_node = of_parse_phandle(node, ctrl-module, 0); if (!control_node) { dev_err(pdev-dev, Failed to get control device
[PATCH v5 6/6] arm/dts: added dt properties to adapt to the new phy framwork
Added device tree bindings for dwc3, usb2 and usb3 PHYs. The documentation of these can be found at Documentation/devicetree/bindings/phy/phy-bindings.txt and Documentation/devicetree/bindings/phy/ti-phy.txt. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- arch/arm/boot/dts/omap5.dtsi |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index a72813a..1c68558 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi @@ -732,7 +732,8 @@ compatible = snps,dwc3; reg = 0x4a03 0x1; interrupts = GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH; - usb-phy = usb2_phy, usb3_phy; + phys = usb2_phy, usb3_phy; + phy-names = usb2-phy, usb3-phy; dr_mode = peripheral; tx-fifo-resize; }; @@ -749,6 +750,7 @@ compatible = ti,omap-usb2; reg = 0x4a084000 0x7c; ctrl-module = omap_control_usb2phy; + #phy-cells = 0; }; usb3_phy: usb3phy@4a084400 { @@ -758,6 +760,7 @@ 0x4a084c00 0x40; reg-names = phy_rx, phy_tx, pll_ctrl; ctrl-module = omap_control_usb3phy; + #phy-cells = 0; }; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 5/6] phy: omap-usb2: move omap_usb.h from linux/usb/ to linux/phy/
No functional change. Moved omap_usb.h from linux/usb/ to linux/phy/. Also removed the unused members of struct omap_usb (after phy-omap-pipe3 started using it's own header file) Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/phy/phy-omap-usb2.c |2 +- include/linux/{usb = phy}/omap_usb.h |3 --- 2 files changed, 1 insertion(+), 4 deletions(-) rename include/linux/{usb = phy}/omap_usb.h (95%) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 705af5a..9c3f056 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -21,7 +21,7 @@ #include linux/slab.h #include linux/of.h #include linux/io.h -#include linux/usb/omap_usb.h +#include linux/phy/omap_usb.h #include linux/usb/phy_companion.h #include linux/clk.h #include linux/err.h diff --git a/include/linux/usb/omap_usb.h b/include/linux/phy/omap_usb.h similarity index 95% rename from include/linux/usb/omap_usb.h rename to include/linux/phy/omap_usb.h index 6ae2936..19d343c3 100644 --- a/include/linux/usb/omap_usb.h +++ b/include/linux/phy/omap_usb.h @@ -33,13 +33,10 @@ struct usb_dpll_params { struct omap_usb { struct usb_phy phy; struct phy_companion*comparator; - void __iomem*pll_ctrl_base; struct device *dev; struct device *control_dev; struct clk *wkupclk; - struct clk *sys_clk; struct clk *optclk; - u8 is_suspended:1; }; #definephy_to_omapusb(x) container_of((x), struct omap_usb, phy) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 0/6] Make dwc3 use Generic PHY Framework
Added support for optional PHY in dwc3 as not all SoCs having PHYs for DWC3 should be programmed. While this can be considered as a temporary fix, a long term solution would be to add 'nop' PHY for platforms that does not have programmable PHY. Adapted DWC3 and USB3 PHY to use Generic PHY framework. Also changed the name of USB3 PHY driver to PIPE3 PHY driver since the same driver has to be used for SATA and PCIE too. Changes from v4: (sending the entire patch series again) * check the return values of phy_init and phy_power_on * print errors if power_on or power_off of PHY fails. Changes from v3: (Sent only adapt dwc3 core to use Generic PHY Framework) * avoided using quirks and rely on the return values of PHY APIs to find the presence of PHY. Changes from v2: * added a couple of fixes. One is invoking phy_resume after phy_init and the other is power off phy in error patch * used quirks to identify if a particular platform does not have PHYs * removed using separate header for pipe3 driver and also removed all referencs to SATA and PCIe in pipe3 driver since it's not yet adapted for those drivers. Changes from v1: * The logic in which the driver detects the presence of PHYs has changed. * patch ordering has changed * udelay is replaced with usleep_range * A patch to remove set_suspend callback which was deferred from Generic PHY Framework series has been included. Kishon Vijay Abraham I (6): usb: dwc3: core: support optional PHYs usb: dwc3: adapt dwc3 core to use Generic PHY Framework drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2 phy: omap-usb2: move omap_usb.h from linux/usb/ to linux/phy/ arm/dts: added dt properties to adapt to the new phy framwork Documentation/devicetree/bindings/usb/dwc3.txt |6 +- arch/arm/boot/dts/omap5.dtsi |5 +- drivers/phy/Kconfig| 11 + drivers/phy/Makefile |1 + drivers/phy/phy-omap-usb2.c| 27 +-- .../phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} | 240 drivers/usb/dwc3/core.c| 116 +++--- drivers/usb/dwc3/core.h|7 + drivers/usb/phy/Kconfig| 11 - drivers/usb/phy/Makefile |1 - include/linux/{usb = phy}/omap_usb.h |3 - 11 files changed, 264 insertions(+), 164 deletions(-) rename drivers/{usb/phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} (54%) rename include/linux/{usb = phy}/omap_usb.h (95%) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 4/6] usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2
Now that omap-usb2 is adapted to the new generic PHY framework, *set_suspend* ops can be removed from omap-usb2 driver. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Felipe Balbi ba...@ti.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/phy/phy-omap-usb2.c | 25 - 1 file changed, 25 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 7699752..705af5a 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -98,28 +98,6 @@ static int omap_usb_set_peripheral(struct usb_otg *otg, return 0; } -static int omap_usb2_suspend(struct usb_phy *x, int suspend) -{ - struct omap_usb *phy = phy_to_omapusb(x); - int ret; - - if (suspend !phy-is_suspended) { - omap_control_usb_phy_power(phy-control_dev, 0); - pm_runtime_put_sync(phy-dev); - phy-is_suspended = 1; - } else if (!suspend phy-is_suspended) { - ret = pm_runtime_get_sync(phy-dev); - if (ret 0) { - dev_err(phy-dev, get_sync failed with err %d\n, ret); - return ret; - } - omap_control_usb_phy_power(phy-control_dev, 1); - phy-is_suspended = 0; - } - - return 0; -} - static int omap_usb_power_off(struct phy *x) { struct omap_usb *phy = phy_get_drvdata(x); @@ -173,7 +151,6 @@ static int omap_usb2_probe(struct platform_device *pdev) phy-phy.dev= phy-dev; phy-phy.label = omap-usb2; - phy-phy.set_suspend= omap_usb2_suspend; phy-phy.otg= otg; phy-phy.type = USB_PHY_TYPE_USB2; @@ -190,8 +167,6 @@ static int omap_usb2_probe(struct platform_device *pdev) } phy-control_dev = control_pdev-dev; - - phy-is_suspended = 1; omap_control_usb_phy_power(phy-control_dev, 0); otg-set_host = omap_usb_set_host; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 3/6] drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework
Adapted omap-usb3 PHY driver to Generic PHY Framework and moved phy-omap-usb3 driver in drivers/usb/phy to drivers/phy and also renamed the file to phy-ti-pipe3 since this same driver will be used for SATA PHY and PCIE PHY. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- drivers/phy/Kconfig| 11 + drivers/phy/Makefile |1 + .../phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} | 240 drivers/usb/phy/Kconfig| 11 - drivers/usb/phy/Makefile |1 - 5 files changed, 158 insertions(+), 106 deletions(-) rename drivers/{usb/phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} (54%) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index c7a551c..e3ec7d1 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -40,6 +40,17 @@ config OMAP_USB2 The USB OTG controller communicates with the comparator using this driver. +config TI_PIPE3 + tristate TI PIPE3 PHY Driver + depends on ARCH_OMAP2PLUS || COMPILE_TEST + select GENERIC_PHY + select OMAP_CONTROL_USB + help + Enable this to support the PIPE3 PHY that is part of TI SOCs. This + driver takes care of all the PHY functionality apart from comparator. + This driver interacts with the OMAP Control PHY Driver to power + on/off the PHY. + config TWL4030_USB tristate TWL4030 USB Transceiver Driver depends on TWL4030_CORE REGULATOR_TWL4030 USB_MUSB_OMAP2PLUS diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index b57c253..32e3f94 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -8,4 +8,5 @@ obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o +obj-$(CONFIG_TI_PIPE3) += phy-ti-pipe3.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/phy/phy-ti-pipe3.c similarity index 54% rename from drivers/usb/phy/phy-omap-usb3.c rename to drivers/phy/phy-ti-pipe3.c index 0c6ba29..67b189d 100644 --- a/drivers/usb/phy/phy-omap-usb3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -1,5 +1,5 @@ /* - * omap-usb3 - USB PHY, talking to dwc3 controller in OMAP. + * phy-ti-pipe3 - PIPE3 PHY driver. * * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com * This program is free software; you can redistribute it and/or modify @@ -19,10 +19,11 @@ #include linux/module.h #include linux/platform_device.h #include linux/slab.h -#include linux/usb/omap_usb.h +#include linux/phy/phy.h #include linux/of.h #include linux/clk.h #include linux/err.h +#include linux/io.h #include linux/pm_runtime.h #include linux/delay.h #include linux/usb/omap_control_usb.h @@ -52,17 +53,34 @@ /* * This is an Empirical value that works, need to confirm the actual - * value required for the USB3PHY_PLL_CONFIGURATION2.PLL_IDLE status - * to be correctly reflected in the USB3PHY_PLL_STATUS register. + * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status + * to be correctly reflected in the PIPE3PHY_PLL_STATUS register. */ # define PLL_IDLE_TIME 100; -struct usb_dpll_map { +struct pipe3_dpll_params { + u16 m; + u8 n; + u8 freq:3; + u8 sd; + u32 mf; +}; + +struct ti_pipe3 { + void __iomem*pll_ctrl_base; + struct device *dev; + struct device *control_dev; + struct clk *wkupclk; + struct clk *sys_clk; + struct clk *optclk; +}; + +struct pipe3_dpll_map { unsigned long rate; - struct usb_dpll_params params; + struct pipe3_dpll_params params; }; -static struct usb_dpll_map dpll_map[] = { +static struct pipe3_dpll_map dpll_map[] = { {1200, {1250, 5, 4, 20, 0} }, /* 12 MHz */ {1680, {3125, 20, 4, 20, 0} }, /* 16.8 MHz */ {1920, {1172, 8, 4, 20, 65537} }, /* 19.2 MHz */ @@ -71,7 +89,18 @@ static struct usb_dpll_map dpll_map[] = { {3840, {3125, 47, 4, 20, 92843} }, /* 38.4 MHz */ }; -static struct usb_dpll_params *omap_usb3_get_dpll_params(unsigned long rate) +static inline u32 ti_pipe3_readl(void __iomem *addr, unsigned offset) +{ + return __raw_readl(addr + offset); +} + +static inline void ti_pipe3_writel(void __iomem *addr, unsigned offset, + u32 data) +{ + __raw_writel(data, addr + offset); +} + +static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(unsigned long rate) { int i; @@ -83,110 +112,123 @@ static struct usb_dpll_params *omap_usb3_get_dpll_params(unsigned long rate) return NULL; } -static int omap_usb3_suspend(struct usb_phy *x,
[PATCH v5 2/6] usb: dwc3: adapt dwc3 core to use Generic PHY Framework
Adapted dwc3 core to use the Generic PHY Framework. So for init, exit, power_on and power_off the following APIs are used phy_init(), phy_exit(), phy_power_on() and phy_power_off(). However using the old USB phy library wont be removed till the PHYs of all other SoC's using dwc3 core is adapted to the Generic PHY Framework. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com --- Documentation/devicetree/bindings/usb/dwc3.txt |6 +- drivers/usb/dwc3/core.c| 86 +--- drivers/usb/dwc3/core.h|7 ++ 3 files changed, 89 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index e807635..471366d 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -6,11 +6,13 @@ Required properties: - compatible: must be snps,dwc3 - reg : Address and length of the register set for the device - interrupts: Interrupts used by the dwc3 controller. + +Optional properties: - usb-phy : array of phandle for the PHY device. The first element in the array is expected to be a handle to the USB2/HS PHY and the second element is expected to be a handle to the USB3/SS PHY - -Optional properties: + - phys: from the *Generic PHY* bindings + - phy-names: from the *Generic PHY* bindings - tx-fifo-resize: determines if the FIFO *has* to be reallocated. This is usually a subnode to DWC3 glue to which it is connected. diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 225a4d6..497234a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -61,9 +61,10 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode) * dwc3_core_soft_reset - Issues core soft reset and PHY reset * @dwc: pointer to our context structure */ -static void dwc3_core_soft_reset(struct dwc3 *dwc) +static int dwc3_core_soft_reset(struct dwc3 *dwc) { u32 reg; + int ret; /* Before Resetting PHY, put Core in Reset */ reg = dwc3_readl(dwc-regs, DWC3_GCTL); @@ -82,6 +83,15 @@ static void dwc3_core_soft_reset(struct dwc3 *dwc) usb_phy_init(dwc-usb2_phy); usb_phy_init(dwc-usb3_phy); + ret = phy_init(dwc-usb2_generic_phy); + if (ret 0) + return ret; + + ret = phy_init(dwc-usb3_generic_phy); + if (ret 0) { + phy_exit(dwc-usb2_generic_phy); + return ret; + } mdelay(100); /* Clear USB3 PHY reset */ @@ -100,6 +110,8 @@ static void dwc3_core_soft_reset(struct dwc3 *dwc) reg = dwc3_readl(dwc-regs, DWC3_GCTL); reg = ~DWC3_GCTL_CORESOFTRESET; dwc3_writel(dwc-regs, DWC3_GCTL, reg); + + return 0; } /** @@ -381,7 +393,9 @@ static int dwc3_core_init(struct dwc3 *dwc) cpu_relax(); } while (true); - dwc3_core_soft_reset(dwc); + ret = dwc3_core_soft_reset(dwc); + if (ret) + goto err0; reg = dwc3_readl(dwc-regs, DWC3_GCTL); reg = ~DWC3_GCTL_SCALEDOWN_MASK; @@ -446,6 +460,8 @@ err2: err1: usb_phy_shutdown(dwc-usb2_phy); usb_phy_shutdown(dwc-usb3_phy); + phy_exit(dwc-usb2_generic_phy); + phy_exit(dwc-usb3_generic_phy); err0: return ret; @@ -453,14 +469,12 @@ err0: static void dwc3_core_exit(struct dwc3 *dwc) { - if (!IS_ERR(dwc-usb2_phy)) - usb_phy_shutdown(dwc-usb2_phy); - if (!IS_ERR(dwc-usb3_phy)) - usb_phy_shutdown(dwc-usb3_phy); - dwc3_free_scratch_buffers(dwc); usb_phy_shutdown(dwc-usb2_phy); usb_phy_shutdown(dwc-usb3_phy); + phy_exit(dwc-usb2_generic_phy); + phy_exit(dwc-usb3_generic_phy); + } #define DWC3_ALIGN_MASK(16 - 1) @@ -551,6 +565,32 @@ static int dwc3_probe(struct platform_device *pdev) } } + dwc-usb2_generic_phy = devm_phy_get(dev, usb2-phy); + if (IS_ERR(dwc-usb2_generic_phy)) { + ret = PTR_ERR(dwc-usb2_generic_phy); + if (ret == -ENOSYS || ret == -ENODEV) { + dwc-usb2_generic_phy = NULL; + } else if (ret == -EPROBE_DEFER) { + return ret; + } else { + dev_err(dev, no usb2 phy configured\n); + return ret; + } + } + + dwc-usb3_generic_phy = devm_phy_get(dev, usb3-phy); + if (IS_ERR(dwc-usb3_generic_phy)) { + ret = PTR_ERR(dwc-usb3_generic_phy); + if (ret == -ENOSYS || ret == -ENODEV) { + dwc-usb3_generic_phy = NULL; + } else if (ret == -EPROBE_DEFER) { + return ret; + } else { + dev_err(dev, no usb3 phy configured\n); + return ret; + } +
[PATCH v5 1/6] usb: dwc3: core: support optional PHYs
Since PHYs for dwc3 is optional (not all SoCs having PHYs for DWC3 should be programmed), do not return from probe if the USB PHY library returns -ENODEV as that indicates the platform does not have a programmable PHY. While this can be considered as a temporary fix, a long term solution would be to add 'nop' PHY for platforms that does not have programmable PHY. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Reviewed-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 34 ++ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7d0cb34..225a4d6 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -529,32 +529,26 @@ static int dwc3_probe(struct platform_device *pdev) if (IS_ERR(dwc-usb2_phy)) { ret = PTR_ERR(dwc-usb2_phy); - - /* -* if -ENXIO is returned, it means PHY layer wasn't -* enabled, so it makes no sense to return -EPROBE_DEFER -* in that case, since no PHY driver will ever probe. -*/ - if (ret == -ENXIO) + if (ret == -ENXIO || ret == -ENODEV) { + dwc-usb2_phy = NULL; + } else if (ret == -EPROBE_DEFER) { return ret; - - dev_err(dev, no usb2 phy configured\n); - return -EPROBE_DEFER; + } else { + dev_err(dev, no usb2 phy configured\n); + return ret; + } } if (IS_ERR(dwc-usb3_phy)) { ret = PTR_ERR(dwc-usb3_phy); - - /* -* if -ENXIO is returned, it means PHY layer wasn't -* enabled, so it makes no sense to return -EPROBE_DEFER -* in that case, since no PHY driver will ever probe. -*/ - if (ret == -ENXIO) + if (ret == -ENXIO || ret == -ENODEV) { + dwc-usb3_phy = NULL; + } else if (ret == -EPROBE_DEFER) { return ret; - - dev_err(dev, no usb3 phy configured\n); - return -EPROBE_DEFER; + } else { + dev_err(dev, no usb3 phy configured\n); + return ret; + } } dwc-xhci_resources[0].start = res-start; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 0/6] Make dwc3 use Generic PHY Framework
Hi Kishon, Which tree are these patches based on? cheers, -roger On 03/03/2014 01:38 PM, Kishon Vijay Abraham I wrote: Added support for optional PHY in dwc3 as not all SoCs having PHYs for DWC3 should be programmed. While this can be considered as a temporary fix, a long term solution would be to add 'nop' PHY for platforms that does not have programmable PHY. Adapted DWC3 and USB3 PHY to use Generic PHY framework. Also changed the name of USB3 PHY driver to PIPE3 PHY driver since the same driver has to be used for SATA and PCIE too. Changes from v4: (sending the entire patch series again) * check the return values of phy_init and phy_power_on * print errors if power_on or power_off of PHY fails. Changes from v3: (Sent only adapt dwc3 core to use Generic PHY Framework) * avoided using quirks and rely on the return values of PHY APIs to find the presence of PHY. Changes from v2: * added a couple of fixes. One is invoking phy_resume after phy_init and the other is power off phy in error patch * used quirks to identify if a particular platform does not have PHYs * removed using separate header for pipe3 driver and also removed all referencs to SATA and PCIe in pipe3 driver since it's not yet adapted for those drivers. Changes from v1: * The logic in which the driver detects the presence of PHYs has changed. * patch ordering has changed * udelay is replaced with usleep_range * A patch to remove set_suspend callback which was deferred from Generic PHY Framework series has been included. Kishon Vijay Abraham I (6): usb: dwc3: core: support optional PHYs usb: dwc3: adapt dwc3 core to use Generic PHY Framework drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2 phy: omap-usb2: move omap_usb.h from linux/usb/ to linux/phy/ arm/dts: added dt properties to adapt to the new phy framwork Documentation/devicetree/bindings/usb/dwc3.txt |6 +- arch/arm/boot/dts/omap5.dtsi |5 +- drivers/phy/Kconfig| 11 + drivers/phy/Makefile |1 + drivers/phy/phy-omap-usb2.c| 27 +-- .../phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} | 240 drivers/usb/dwc3/core.c| 116 +++--- drivers/usb/dwc3/core.h|7 + drivers/usb/phy/Kconfig| 11 - drivers/usb/phy/Makefile |1 - include/linux/{usb = phy}/omap_usb.h |3 - 11 files changed, 264 insertions(+), 164 deletions(-) rename drivers/{usb/phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} (54%) rename include/linux/{usb = phy}/omap_usb.h (95%) -- 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 v5 0/6] Make dwc3 use Generic PHY Framework
Roger, On Monday 03 March 2014 05:51 PM, Roger Quadros wrote: Hi Kishon, Which tree are these patches based on? mainline + Felipe's testing/next + Revert usb: dwc3: core: enable Suspend bit for USB2/3 PHYs + Revert usb: dwc3: preparation for adapting dwc3 to generic phy framework Thanks Kishon cheers, -roger On 03/03/2014 01:38 PM, Kishon Vijay Abraham I wrote: Added support for optional PHY in dwc3 as not all SoCs having PHYs for DWC3 should be programmed. While this can be considered as a temporary fix, a long term solution would be to add 'nop' PHY for platforms that does not have programmable PHY. Adapted DWC3 and USB3 PHY to use Generic PHY framework. Also changed the name of USB3 PHY driver to PIPE3 PHY driver since the same driver has to be used for SATA and PCIE too. Changes from v4: (sending the entire patch series again) * check the return values of phy_init and phy_power_on * print errors if power_on or power_off of PHY fails. Changes from v3: (Sent only adapt dwc3 core to use Generic PHY Framework) * avoided using quirks and rely on the return values of PHY APIs to find the presence of PHY. Changes from v2: * added a couple of fixes. One is invoking phy_resume after phy_init and the other is power off phy in error patch * used quirks to identify if a particular platform does not have PHYs * removed using separate header for pipe3 driver and also removed all referencs to SATA and PCIe in pipe3 driver since it's not yet adapted for those drivers. Changes from v1: * The logic in which the driver detects the presence of PHYs has changed. * patch ordering has changed * udelay is replaced with usleep_range * A patch to remove set_suspend callback which was deferred from Generic PHY Framework series has been included. Kishon Vijay Abraham I (6): usb: dwc3: core: support optional PHYs usb: dwc3: adapt dwc3 core to use Generic PHY Framework drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2 phy: omap-usb2: move omap_usb.h from linux/usb/ to linux/phy/ arm/dts: added dt properties to adapt to the new phy framwork Documentation/devicetree/bindings/usb/dwc3.txt |6 +- arch/arm/boot/dts/omap5.dtsi |5 +- drivers/phy/Kconfig| 11 + drivers/phy/Makefile |1 + drivers/phy/phy-omap-usb2.c| 27 +-- .../phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} | 240 drivers/usb/dwc3/core.c| 116 +++--- drivers/usb/dwc3/core.h|7 + drivers/usb/phy/Kconfig| 11 - drivers/usb/phy/Makefile |1 - include/linux/{usb = phy}/omap_usb.h |3 - 11 files changed, 264 insertions(+), 164 deletions(-) rename drivers/{usb/phy/phy-omap-usb3.c = phy/phy-ti-pipe3.c} (54%) rename include/linux/{usb = phy}/omap_usb.h (95%) -- 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
usb modem not working on xhci host
hi all: when I plug 3g modem dongle to ehci port, it works But when I plug in xhci port, it cannot successfully doing the modem mode change. The related 3G modem driver should be independent by host type, right? Below is my host environment and I also attach log about plug in xhci and ehci. ( as you can see in ehci log, the 3g modem can change to modem mode successfully) 00:14.0 USB controller: Intel Corporation Panther Point USB xHCI Host Controller (rev 04) (prog-if 30 [XHCI]) Subsystem: Lenovo Device 21f7 Flags: bus master, medium devsel, latency 0, IRQ 40 Memory at f260 (64-bit, non-prefetchable) [size=64K] Capabilities: access denied Kernel driver in use: xhci_hcd [20043.678076] usb 3-1: USB disconnect, device number 31 [20050.235962] usb 1-1.2: new high-speed USB device number 16 using ehci-pci [20050.334882] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1446 [20050.337862] usb 1-1.2: New USB device strings: Mfr=3, Product=2, SerialNumber=0 [20050.340685] usb 1-1.2: Product: HUAWEI Mobile [20050.343022] usb 1-1.2: Manufacturer: HUAWEI Technology [20050.347185] usb-storage 1-1.2:1.0: USB Mass Storage device detected [20050.348408] scsi116 : usb-storage 1-1.2:1.0 [20050.350633] usb-storage 1-1.2:1.1: USB Mass Storage device detected [20050.353079] scsi117 : usb-storage 1-1.2:1.1 [20051.350203] scsi 116:0:0:0: CD-ROMHUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2 [20051.354209] scsi 117:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2 [20051.357444] sr0: scsi-1 drive [20051.359681] sr 116:0:0:0: Attached scsi CD-ROM sr0 [20051.361846] sr 116:0:0:0: Attached scsi generic sg1 type 5 [20051.364925] sd 117:0:0:0: Attached scsi generic sg2 type 0 [20051.368804] sd 117:0:0:0: [sdb] Attached SCSI removable disk [20051.462065] usb 1-1.2: USB disconnect, device number 16 [20051.466012] scsi 117:0:0:0: rejecting I/O to offline device [20051.468190] scsi 117:0:0:0: killing request [20055.618056] usb 1-1.2: new high-speed USB device number 17 using ehci-pci [20055.713401] usb 1-1.2: New USB device found, idVendor=12d1, idProduct=1436 [20055.715448] usb 1-1.2: New USB device strings: Mfr=4, Product=3, SerialNumber=0 [20055.717477] usb 1-1.2: Product: HUAWEI Mobile [20055.719465] usb 1-1.2: Manufacturer: HUAWEI Technology [20055.724692] usb-storage 1-1.2:1.0: USB Mass Storage device detected [20055.727146] option 1-1.2:1.0: GSM modem (1-port) converter detected [20055.729346] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0 [20055.731406] usb-storage 1-1.2:1.1: USB Mass Storage device detected [20055.735213] cdc_ether 1-1.2:1.1 wwan0: register 'cdc_ether' at usb-:00:1a.0-1.2, Mobile Broadband Network Device, 02:50:f3:00:00:00 [20055.736548] usb-storage 1-1.2:1.3: USB Mass Storage device detected [20055.738153] option 1-1.2:1.3: GSM modem (1-port) converter detected [20055.739706] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1 [20055.740660] usb-storage 1-1.2:1.4: USB Mass Storage device detected [20055.741740] option 1-1.2:1.4: GSM modem (1-port) converter detected [20055.743124] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2 [20055.744105] usb-storage 1-1.2:1.5: USB Mass Storage device detected [20055.745711] scsi122 : usb-storage 1-1.2:1.5 [20055.747201] usb-storage 1-1.2:1.6: USB Mass Storage device detected [20055.749722] scsi123 : usb-storage 1-1.2:1.6 [20056.748638] scsi 122:0:0:0: CD-ROMHUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2 [20056.753896] scsi 123:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2 [20056.757543] sr0: scsi-1 drive [20056.760088] sr 122:0:0:0: Attached scsi CD-ROM sr0 [20056.761289] sr 122:0:0:0: Attached scsi generic sg1 type 5 [20056.762580] sd 123:0:0:0: Attached scsi generic sg2 type 0 [20056.769739] sd 123:0:0:0: [sdb] Attached SCSI removable disk [20030.333022] usb 3-1: new high-speed USB device number 31 using xhci_hcd [20030.355575] usb 3-1: New USB device found, idVendor=12d1, idProduct=1446 [20030.357627] usb 3-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0 [20030.359654] usb 3-1: Product: HUAWEI Mobile [20030.361649] usb 3-1: Manufacturer: HUAWEI Technology [20030.365767] usb-storage 3-1:1.0: USB Mass Storage device detected [20030.368209] scsi114 : usb-storage 3-1:1.0 [20030.370372] usb-storage 3-1:1.1: USB Mass Storage device detected [20030.372697] scsi115 : usb-storage 3-1:1.1 [20031.371542] scsi 114:0:0:0: CD-ROMHUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2 [20031.376507] sr0: scsi-1 drive [20031.378831] sr 114:0:0:0: Attached scsi CD-ROM sr0 [20031.378975] scsi 115:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2 [20031.383303] sr 114:0:0:0: Attached scsi generic sg1 type 5 [20031.385041] sd 115:0:0:0: Attached scsi generic sg2 type 0 [20031.389105] sd 115:0:0:0: [sdb] Attached SCSI removable disk
Re: [PATCH v6 5/8] phy: Add new Exynos USB PHY driver
Hi, On Wednesday 29 January 2014 10:59 PM, Kamil Debski wrote: Add a new driver for the Exynos USB PHY. The new driver uses the generic PHY framework. The driver includes support for the Exynos 4x10 and 4x12 SoC families. Can the PHY part of this series be merged independently of the controller part? Thanks Kishon Signed-off-by: Kamil Debski k.deb...@samsung.com --- .../devicetree/bindings/phy/samsung-phy.txt| 55 Documentation/phy/samsung-usb2.txt | 135 drivers/phy/Kconfig| 29 ++ drivers/phy/Makefile |3 + drivers/phy/phy-exynos4210-usb2.c | 257 drivers/phy/phy-exynos4x12-usb2.c | 323 drivers/phy/phy-samsung-usb2.c | 227 ++ drivers/phy/phy-samsung-usb2.h | 67 8 files changed, 1096 insertions(+) create mode 100644 Documentation/phy/samsung-usb2.txt create mode 100644 drivers/phy/phy-exynos4210-usb2.c create mode 100644 drivers/phy/phy-exynos4x12-usb2.c create mode 100644 drivers/phy/phy-samsung-usb2.c create mode 100644 drivers/phy/phy-samsung-usb2.h diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index c0fccaa..6668c41 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -20,3 +20,58 @@ Required properties: - compatible : should be samsung,exynos5250-dp-video-phy; - reg : offset and length of the Display Port PHY register set; - #phy-cells : from the generic PHY bindings, must be 0; + +Samsung S5P/EXYNOS SoC series USB PHY +- + +Required properties: +- compatible : should be one of the listed compatibles: + - samsung,exynos4210-usb2-phy + - samsung,exynos4x12-usb2-phy +- reg : a list of registers used by phy driver + - first and obligatory is the location of phy modules registers +- samsung,sysreg-phandle - handle to syscon used to control the system registers +- samsung,pmureg-phandle - handle to syscon used to control PMU registers +- #phy-cells : from the generic phy bindings, must be 1; +- clocks and clock-names: + - the phy clocks is required by the phy module + - next for each of the phys a clock has to be assigned, this clock + will be used to determine clocking frequency for the phys + (the labels are specified in the paragraph below) + +The first phandle argument in the PHY specifier identifies the PHY, its +meaning is compatible dependent. For the currently supported SoCs (Exynos 4210 +and Exynos 4212) it is as follows: + 0 - USB device (device), + 1 - USB host (host), + 2 - HSIC0 (hsic0), + 3 - HSIC1 (hsic1), + +Exynos 4210 and Exynos 4212 use mode switching and require that mode switch +register is supplied. + +Example: + +For Exynos 4412 (compatible with Exynos 4212): + +usbphy: phy@125b { + compatible = samsung,exynos4212-usb2-phy; + reg = 0x125b 0x100 0x10020704 0x0c 0x1001021c 0x4; + clocks = clock 305, clock 2, clock 2, clock 2, + clock 2; + clock-names = phy, device, host, hsic0, hsic1; + status = okay; + #phy-cells = 1; + samsung,sysreg-phandle = sys_reg; + samsung,pmureg-phandle = pmu_reg; +}; + +Then the PHY can be used in other nodes such as: + +phy-consumer@1234 { + phys = usbphy 2; + phy-names = phy; +}; + +Refer to DT bindings documentation of particular PHY consumer devices for more +information about required PHYs and the way of specification. diff --git a/Documentation/phy/samsung-usb2.txt b/Documentation/phy/samsung-usb2.txt new file mode 100644 index 000..9f5826e --- /dev/null +++ b/Documentation/phy/samsung-usb2.txt @@ -0,0 +1,135 @@ +.--+ +| Samsung USB 2.0 PHY adaptation layer | ++-+' + +| 1. Description ++ + +The architecture of the USB 2.0 PHY module in Samsung SoCs is similar +among many SoCs. In spite of the similarities it proved difficult to +create a one driver that would fit all these PHY controllers. Often +the differences were minor and were found in particular bits of the +registers of the PHY. In some rare cases the order of register writes or +the PHY powering up process had to be altered. This adaptation layer is +a compromise between having separate drivers and having a single driver +with added support for many special cases. + +| 2. Files description ++-- + +- phy-samsung-usb2.c + This is the main file of the adaptation layer. This file contains + the probe function and
Re: [PATCH v6 8/8] usb: ehci-exynos: Change to use phy provided by the generic phy framework
On 05.02.2014 18:30, Olof Johansson wrote: On Wed, Feb 5, 2014 at 7:57 AM, Kamil Debski k.deb...@samsung.com wrote: Hi Olof, Thank you for your review. From: Olof Johansson [mailto:o...@lixom.net] Sent: Wednesday, January 29, 2014 9:55 PM Hi, On Wed, Jan 29, 2014 at 9:29 AM, Kamil Debski k.deb...@samsung.com wrote: Change the phy provider used from the old one using the USB phy framework to a new one using the Generic phy framework. Signed-off-by: Kamil Debski k.deb...@samsung.com --- .../devicetree/bindings/usb/exynos-usb.txt | 13 +++ drivers/usb/host/ehci-exynos.c | 97 +--- 2 files changed, 76 insertions(+), 34 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt b/Documentation/devicetree/bindings/usb/exynos-usb.txt index d967ba1..25e199a 100644 --- a/Documentation/devicetree/bindings/usb/exynos-usb.txt +++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt @@ -12,6 +12,10 @@ Required properties: - interrupts: interrupt number to the cpu. - clocks: from common clock binding: handle to usb clock. - clock-names: from common clock binding: Shall be usbhost. + - port: if in the SoC there are EHCI phys, they should be listed here. +One phy per port. Each port should have its reg entry with a +consecutive number. Also it should contain phys and phy-names entries +specifying the phy used by the port. Optional properties: - samsung,vbus-gpio: if present, specifies the GPIO that @@ -27,6 +31,15 @@ Example: clocks = clock 285; clock-names = usbhost; + + #address-cells = 1; + #size-cells = 0; + port@0 { + reg = 0; + phys = usb2phy 1; + phy-names = host; + status = disabled; + }; }; OHCI [...] @@ -102,14 +132,26 @@ static int exynos_ehci_probe(struct platform_device *pdev) samsung,exynos5440-ehci)) goto skip_phy; - phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2); - if (IS_ERR(phy)) { - usb_put_hcd(hcd); - dev_warn(pdev-dev, no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } else { - exynos_ehci-phy = phy; - exynos_ehci-otg = phy-otg; + for_each_available_child_of_node(pdev-dev.of_node, child) { + err = of_property_read_u32(child, reg, phy_number); + if (err) { + dev_err(pdev-dev, Failed to parse device tree\n); + of_node_put(child); + return err; + } + if (phy_number = PHY_NUMBER) { + dev_err(pdev-dev, Failed to parse device tree - number out of range\n); + of_node_put(child); + return -EINVAL; + } + phy = devm_of_phy_get(pdev-dev, child, 0); + of_node_put(child); + if (IS_ERR(phy)) { + dev_err(pdev-dev, Failed to get phy number %d, + phy_number); + return PTR_ERR(phy); + } + exynos_ehci-phy[phy_number] = phy; this looks like it is now breaking older device trees, where ports might not be described. Since device tree interfaces need to be backwards compatible, you still need to handle the old case of not having ports described. There are two ways of doing this: 1. Fall back to the old behavior if there are no ports 2. Use a new compatible value for the new model with port subnodes, and if the old compatible value is used, then fall back to the old behavior. I'm guessing (1) might be easiest since you can check for the presence of #address-cells to tell if this is just an old style node, or if it's a new-style node without any ports below it. The ultimate goal is to remove the old phy driver. Unfortunately this has to be synced with the new USB3 phy driver by Vivek Gautam. I think he is also close to completion. What about this case? In the end the old driver will be removed and no longer be supported. Having backward compatibility in mind, it is possible to have the old and the new phy driver together in one kernel release. But do we want to have two drivers doing the same thing at the same time? It is mostly irrelevant if there is a new driver or not -- the old device tree has to keep working. In this case it would mean that the new driver needs to work with older device trees as well, or people will see functionality regressing. The device tree is a description of the hardware, not an extension of the driver. The problem with this case is that when the original driver was added there was no way to bind PHY providers and consumers together. Basically there was no generic PHY subsystem. Instead the hacky USB
RE: [PATCH v6 5/8] phy: Add new Exynos USB PHY driver
Hi Kishon, From: Kishon Vijay Abraham I [mailto:kis...@ti.com] Sent: Monday, March 03, 2014 3:28 PM Hi, On Wednesday 29 January 2014 10:59 PM, Kamil Debski wrote: Add a new driver for the Exynos USB PHY. The new driver uses the generic PHY framework. The driver includes support for the Exynos 4x10 and 4x12 SoC families. Can the PHY part of this series be merged independently of the controller part? I see no problems with merging the PHY part independently. However, I would like to post an updated version of these patches. I am working on them now and should send them tomorrow. Best wishes, -- Kamil Debski Samsung RD Institute Poland Signed-off-by: Kamil Debski k.deb...@samsung.com --- .../devicetree/bindings/phy/samsung-phy.txt| 55 Documentation/phy/samsung-usb2.txt | 135 drivers/phy/Kconfig| 29 ++ drivers/phy/Makefile |3 + drivers/phy/phy-exynos4210-usb2.c | 257 drivers/phy/phy-exynos4x12-usb2.c | 323 drivers/phy/phy-samsung-usb2.c | 227 ++ drivers/phy/phy-samsung-usb2.h | 67 8 files changed, 1096 insertions(+) create mode 100644 Documentation/phy/samsung-usb2.txt create mode 100644 drivers/phy/phy-exynos4210-usb2.c create mode 100644 drivers/phy/phy-exynos4x12-usb2.c create mode 100644 drivers/phy/phy-samsung-usb2.c create mode 100644 drivers/phy/phy-samsung-usb2.h diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index c0fccaa..6668c41 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -20,3 +20,58 @@ Required properties: - compatible : should be samsung,exynos5250-dp-video-phy; - reg : offset and length of the Display Port PHY register set; - #phy-cells : from the generic PHY bindings, must be 0; + +Samsung S5P/EXYNOS SoC series USB PHY +- + +Required properties: +- compatible : should be one of the listed compatibles: + - samsung,exynos4210-usb2-phy + - samsung,exynos4x12-usb2-phy +- reg : a list of registers used by phy driver + - first and obligatory is the location of phy modules registers +- samsung,sysreg-phandle - handle to syscon used to control the +system registers +- samsung,pmureg-phandle - handle to syscon used to control PMU +registers +- #phy-cells : from the generic phy bindings, must be 1; +- clocks and clock-names: + - the phy clocks is required by the phy module + - next for each of the phys a clock has to be assigned, this clock + will be used to determine clocking frequency for the phys + (the labels are specified in the paragraph below) + +The first phandle argument in the PHY specifier identifies the PHY, +its meaning is compatible dependent. For the currently supported SoCs +(Exynos 4210 and Exynos 4212) it is as follows: + 0 - USB device (device), + 1 - USB host (host), + 2 - HSIC0 (hsic0), + 3 - HSIC1 (hsic1), + +Exynos 4210 and Exynos 4212 use mode switching and require that mode +switch register is supplied. + +Example: + +For Exynos 4412 (compatible with Exynos 4212): + +usbphy: phy@125b { + compatible = samsung,exynos4212-usb2-phy; + reg = 0x125b 0x100 0x10020704 0x0c 0x1001021c 0x4; + clocks = clock 305, clock 2, clock 2, clock 2, + clock 2; + clock-names = phy, device, host, hsic0, hsic1; + status = okay; + #phy-cells = 1; + samsung,sysreg-phandle = sys_reg; + samsung,pmureg-phandle = pmu_reg; }; + +Then the PHY can be used in other nodes such as: + +phy-consumer@1234 { + phys = usbphy 2; + phy-names = phy; +}; + +Refer to DT bindings documentation of particular PHY consumer devices +for more information about required PHYs and the way of specification. diff --git a/Documentation/phy/samsung-usb2.txt b/Documentation/phy/samsung-usb2.txt new file mode 100644 index 000..9f5826e --- /dev/null +++ b/Documentation/phy/samsung-usb2.txt @@ -0,0 +1,135 @@ +.--- - +--+ +| Samsung USB 2.0 PHY adaptation layer | ++--- --+' + +| 1. Description ++ + +The architecture of the USB 2.0 PHY module in Samsung SoCs is similar +among many SoCs. In spite of the similarities it proved difficult to +create a one driver that would fit all these PHY controllers. Often +the differences were minor and were found in
[PATCH 06/12] phy: omap: Select OMAP_OCP2SCP bus driver
The OMAP_USB2 and OMAP_PIP3 phy devices will not be detected if the OMAP_OCP2SCP driver is not present. So select it. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/phy/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2f02ec8..afdab3e 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -44,6 +44,7 @@ config OMAP_USB2 depends on USB_PHY select GENERIC_PHY select OMAP_CONTROL_PHY + select OMAP_OCP2SCP help Enable this to support the transceiver that is part of SOC. This driver takes care of all the PHY functionality apart from comparator. @@ -55,6 +56,7 @@ config TI_PIPE3 depends on ARCH_OMAP2PLUS || COMPILE_TEST select GENERIC_PHY select OMAP_CONTROL_PHY + select OMAP_OCP2SCP help Enable this to support the PIPE3 PHY that is part of TI SOCs. This driver takes care of all the PHY functionality apart from comparator. -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/12] phy: ti-pipe3: Fix suspend/resume and module reload
Due to Errata i783, SATA breaks if its DPLL is idled. The recommeded workaround to issue a softreset to the SATA controller doesn't seem to work. Here we just prevent SATA DPLL from Idling and hence avoid the issue altogether. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/phy/phy-ti-pipe3.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index d3c085a..611f7c3 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -238,6 +238,10 @@ static int ti_pipe3_exit(struct phy *x) u32 val; unsigned long timeout; + /* SATA DPLL can't be powered down due to Errata i783 */ + if (of_device_is_compatible(phy-dev-of_node, ti,phy-pipe3-sata)) + return 0; + /* Put DPLL in IDLE mode */ val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_CONFIGURATION2); val |= PLL_IDLE; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/12] ARM: DRA7: hwmod: Add ocp2scp3 and sata hwmods
From: Nikhil Devshatwar nikhil...@ti.com Add hwmods for ocp2scp3 and sata modules. [Roger Q] Clean up. CC: Benoit Cousson bcous...@baylibre.com CC: Paul Walmsley p...@pwsan.com Signed-off-by: Balaji T K balaj...@ti.com Signed-off-by: Nikhil Devshatwar nikhil...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 41 +++ 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index 18f333c..c180b54 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c @@ -1215,6 +1215,40 @@ static struct omap_hwmod dra7xx_ocp2scp1_hwmod = { }, }; +/* ocp2scp3 */ +static struct omap_hwmod dra7xx_ocp2scp3_hwmod; +static struct omap_hwmod_addr_space dra7xx_ocp2scp3_addrs[] = { + { + .name = ocp2scp3, + .pa_start = 0x4a09, + .pa_end = 0x4a09001f, + .flags = ADDR_TYPE_RT + }, + { } +}; + +/* l4_cfg - ocp2scp3 */ +static struct omap_hwmod_ocp_if dra7xx_l4_cfg__ocp2scp3 = { + .master = dra7xx_l4_cfg_hwmod, + .slave = dra7xx_ocp2scp3_hwmod, + .clk= l4_root_clk_div, + .addr = dra7xx_ocp2scp3_addrs, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +static struct omap_hwmod dra7xx_ocp2scp3_hwmod = { + .name = ocp2scp3, + .class = dra7xx_ocp2scp_hwmod_class, + .clkdm_name = l3init_clkdm, + .prcm = { + .omap4 = { + .clkctrl_offs = DRA7XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET, + .context_offs = DRA7XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET, + .modulemode = MODULEMODE_HWCTRL, + }, + }, +}; + /* * 'qspi' class * @@ -1268,9 +1302,6 @@ static struct omap_hwmod_class dra7xx_sata_hwmod_class = { }; /* sata */ -static struct omap_hwmod_opt_clk sata_opt_clks[] = { - { .role = ref_clk, .clk = sata_ref_clk }, -}; static struct omap_hwmod dra7xx_sata_hwmod = { .name = sata, @@ -1278,6 +1309,7 @@ static struct omap_hwmod dra7xx_sata_hwmod = { .clkdm_name = l3init_clkdm, .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, .main_clk = func_48m_fclk, + .mpu_rt_idx = 1, .prcm = { .omap4 = { .clkctrl_offs = DRA7XX_CM_L3INIT_SATA_CLKCTRL_OFFSET, @@ -1285,8 +1317,6 @@ static struct omap_hwmod dra7xx_sata_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, - .opt_clks = sata_opt_clks, - .opt_clks_cnt = ARRAY_SIZE(sata_opt_clks), }; /* @@ -2683,6 +2713,7 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { dra7xx_l4_per1__mmc4, dra7xx_l4_cfg__mpu, dra7xx_l4_cfg__ocp2scp1, + dra7xx_l4_cfg__ocp2scp3, dra7xx_l3_main_1__qspi, dra7xx_l4_cfg__sata, dra7xx_l4_cfg__smartreflex_core, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/12] ARM: dts: dra7: add OCP2SCP3 and SATA nodes
From: Balaji T K balaj...@ti.com Add nodes for OCP2SCP3 bus, SATA controller and SATA PHY. [Roger Q] Clean up. CC: Benoit Cousson bcous...@baylibre.com Signed-off-by: Balaji T K balaj...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/dra7.dtsi | 39 +++ 1 file changed, 39 insertions(+) diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 1fd75aa..74e44bc 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi @@ -621,6 +621,45 @@ dma-names = tx0, rx0; status = disabled; }; + + omap_control_sata: control-phy@4a002374 { + compatible = ti,control-phy-pipe3; + reg = 0x4a002374 0x4; + reg-names = power; + clocks = sys_clkin1; + clock-names = sysclk; + }; + + /* OCP2SCP3 */ + ocp2scp@4a09 { + compatible = ti,omap-ocp2scp; + #address-cells = 1; + #size-cells = 1; + ranges; + reg = 0x4a09 0x20; + ti,hwmods = ocp2scp3; + sata_phy: phy@4A096000 { + compatible = ti,phy-pipe3-sata; + reg = 0x4A096000 0x80, /* phy_rx */ + 0x4A096400 0x64, /* phy_tx */ + 0x4A096800 0x40; /* pll_ctrl */ + reg-names = phy_rx, phy_tx, pll_ctrl; + ctrl-module = omap_control_sata; + clocks = sys_clkin1; + clock-names = sysclk; + #phy-cells = 0; + }; + }; + + sata: sata@4a141100 { + compatible = snps,dwc-ahci; + reg = 0x4a14 0x1100, 0x4a141100 0x7; + interrupts = GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH; + phys = sata_phy; + phy-names = sata-phy; + clocks = sata_ref_clk; + ti,hwmods = sata; + }; }; }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/12] ARM: dts: omap5: add sata node
From: Balaji T K balaj...@ti.com Add support for sata. [Roger Q] Clean up. CC: Benoit Cousson bcous...@baylibre.com CC: Tony Lindgren t...@atomide.com Signed-off-by: Balaji T K balaj...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/omap5.dtsi | 40 1 file changed, 40 insertions(+) diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index a7f5930..8e55e97 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi @@ -806,6 +806,46 @@ #thermal-sensor-cells = 1; }; + + omap_control_sata: control-phy@4a002374 { + compatible = ti,control-phy-pipe3; + reg = 0x4a002374 0x4; + reg-names = power; + clocks = sys_clkin; + clock-names = sysclk; + }; + + /* OCP2SCP3 */ + ocp2scp@4a09 { + compatible = ti,omap-ocp2scp; + #address-cells = 1; + #size-cells = 1; + reg = 0x4a09 0x20; + ranges; + ti,hwmods = ocp2scp3; + sata_phy: phy@4a096000 { + compatible = ti,phy-pipe3-sata; + reg = 0x4A096000 0x80, /* phy_rx */ + 0x4A096400 0x64, /* phy_tx */ + 0x4A096800 0x40; /* pll_ctrl */ + reg-names = phy_rx, phy_tx, pll_ctrl; + ctrl-module = omap_control_sata; + clocks = sys_clkin; + clock-names = sysclk; + #phy-cells = 0; + }; + }; + + sata: sata@4a141100 { + compatible = snps,dwc-ahci; + reg = 0x4a14 0x1100, 0x4a141100 0x7; + interrupts = GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH; + phys = sata_phy; + phy-names = sata-phy; + clocks = sata_ref_clk; + ti,hwmods = sata; + }; + }; }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/12] phy: ti-pipe3: streamline PHY operations
Limit .power_on() and .power_off() to just control the PHY power and not the DPLL. The DPLL will be enabled in .init() and idled in .exit(). Don't reprogram the DPLL if it has been already locked by the bootloader. This fixes a problem with SATA, where it fails if SATA was used by the bootloader. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/phy/phy-ti-pipe3.c | 114 + 1 file changed, 63 insertions(+), 51 deletions(-) diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index ee8871d..d3c085a 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -47,7 +47,8 @@ #definePLL_SD_MASK 0x0003FC00 #definePLL_SD_SHIFT10 #defineSET_PLL_GO 0x1 -#definePLL_TICOPWDN0x1 +#define PLL_LDOPWDNBIT(15) +#define PLL_TICOPWDN BIT(16) #definePLL_LOCK0x2 #definePLL_IDLE0x1 @@ -56,7 +57,8 @@ * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status * to be correctly reflected in the PIPE3PHY_PLL_STATUS register. */ -# define PLL_IDLE_TIME 100; +#define PLL_IDLE_TIME 100 /* in milliseconds */ +#define PLL_LOCK_TIME 100 /* in milliseconds */ struct pipe3_dpll_params { u16 m; @@ -132,24 +134,6 @@ static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy) static int ti_pipe3_power_off(struct phy *x) { struct ti_pipe3 *phy = phy_get_drvdata(x); - int val; - int timeout = PLL_IDLE_TIME; - - val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_CONFIGURATION2); - val |= PLL_IDLE; - ti_pipe3_writel(phy-pll_ctrl_base, PLL_CONFIGURATION2, val); - - do { - val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_STATUS); - if (val PLL_TICOPWDN) - break; - udelay(5); - } while (--timeout); - - if (!timeout) { - dev_err(phy-dev, power off failed\n); - return -EBUSY; - } omap_control_phy_power(phy-control_dev, 0); @@ -159,44 +143,34 @@ static int ti_pipe3_power_off(struct phy *x) static int ti_pipe3_power_on(struct phy *x) { struct ti_pipe3 *phy = phy_get_drvdata(x); - int val; - int timeout = PLL_IDLE_TIME; - - val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_CONFIGURATION2); - val = ~PLL_IDLE; - ti_pipe3_writel(phy-pll_ctrl_base, PLL_CONFIGURATION2, val); - do { - val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_STATUS); - if (!(val PLL_TICOPWDN)) - break; - udelay(5); - } while (--timeout); - - if (!timeout) { - dev_err(phy-dev, power on failed\n); - return -EBUSY; - } + omap_control_phy_power(phy-control_dev, 1); return 0; } -static void ti_pipe3_dpll_relock(struct ti_pipe3 *phy) +static int ti_pipe3_dpll_wait_lock(struct ti_pipe3 *phy) { u32 val; unsigned long timeout; - ti_pipe3_writel(phy-pll_ctrl_base, PLL_GO, SET_PLL_GO); - - timeout = jiffies + msecs_to_jiffies(20); + timeout = jiffies + msecs_to_jiffies(PLL_LOCK_TIME); do { + cpu_relax(); val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_STATUS); if (val PLL_LOCK) break; - } while (!WARN_ON(time_after(jiffies, timeout))); + } while (!time_after(jiffies, timeout)); + + if (!(val PLL_LOCK)) { + dev_err(phy-dev, DPLL failed to lock\n); + return -EBUSY; + } + + return 0; } -static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy) +static int ti_pipe3_dpll_program(struct ti_pipe3 *phy) { u32 val; struct pipe3_dpll_params *dpll_params; @@ -230,27 +204,65 @@ static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy) val |= dpll_params-sd PLL_SD_SHIFT; ti_pipe3_writel(phy-pll_ctrl_base, PLL_CONFIGURATION3, val); - ti_pipe3_dpll_relock(phy); + ti_pipe3_writel(phy-pll_ctrl_base, PLL_GO, SET_PLL_GO); - return 0; + return ti_pipe3_dpll_wait_lock(phy); } static int ti_pipe3_init(struct phy *x) { struct ti_pipe3 *phy = phy_get_drvdata(x); - int ret; + u32 val; + int ret = 0; - ret = ti_pipe3_dpll_lock(phy); - if (ret) - return ret; + /* Bring it out of IDLE if it is IDLE */ + val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_CONFIGURATION2); + if (val PLL_IDLE) { + val = ~PLL_IDLE; + ti_pipe3_writel(phy-pll_ctrl_base, PLL_CONFIGURATION2, val); + ret = ti_pipe3_dpll_wait_lock(phy); + } - omap_control_phy_power(phy-control_dev, 1); + /* Program the DPLL only if not locked */ + val =
[PATCH 07/12] ARM: OMAP5: hwmod: Add ocp2scp3 and sata hwmods
From: Keshava Munegowda keshava_mgo...@ti.com Create hwmods for ocp2scp3 and sata modules. [Roger Q] Clean up. CC: Benoit Cousson bcous...@baylibre.com CC: Paul Walmsley p...@pwsan.com CC: Tony Lindgren t...@atomide.com Signed-off-by: Balaji T K balaj...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 73 ++ 1 file changed, 73 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index e297d62..227a69f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c @@ -1726,6 +1726,77 @@ static struct omap_hwmod omap54xx_wd_timer2_hwmod = { }, }; +/* + * 'ocp2scp' class + * bridge to transform ocp interface protocol to scp (serial control port) + * protocol + */ +/* ocp2scp3 */ +static struct omap_hwmod omap54xx_ocp2scp3_hwmod; +/* l4_cfg - ocp2scp3 */ +static struct omap_hwmod_ocp_if omap54xx_l4_cfg__ocp2scp3 = { + .master = omap54xx_l4_cfg_hwmod, + .slave = omap54xx_ocp2scp3_hwmod, + .clk= l4_root_clk_div, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +static struct omap_hwmod omap54xx_ocp2scp3_hwmod = { + .name = ocp2scp3, + .class = omap54xx_ocp2scp_hwmod_class, + .clkdm_name = l3init_clkdm, + .prcm = { + .omap4 = { + .clkctrl_offs = OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET, + .context_offs = OMAP54XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET, + .modulemode = MODULEMODE_HWCTRL, + }, + }, +}; + +/* + * 'sata' class + * sata: serial ata interface gen2 compliant ( 1 rx/ 1 tx) + */ + +static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = { + .sysc_offs = 0x, + .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | + SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | + MSTANDBY_SMART | MSTANDBY_SMART_WKUP), + .sysc_fields= omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class omap54xx_sata_hwmod_class = { + .name = sata, + .sysc = omap54xx_sata_sysc, +}; + +/* sata */ +static struct omap_hwmod omap54xx_sata_hwmod = { + .name = sata, + .class = omap54xx_sata_hwmod_class, + .clkdm_name = l3init_clkdm, + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, + .main_clk = func_48m_fclk, + .mpu_rt_idx = 1, + .prcm = { + .omap4 = { + .clkctrl_offs = OMAP54XX_CM_L3INIT_SATA_CLKCTRL_OFFSET, + .context_offs = OMAP54XX_RM_L3INIT_SATA_CONTEXT_OFFSET, + .modulemode = MODULEMODE_SWCTRL, + }, + }, +}; + +/* l4_cfg - sata */ +static struct omap_hwmod_ocp_if omap54xx_l4_cfg__sata = { + .master = omap54xx_l4_cfg_hwmod, + .slave = omap54xx_sata_hwmod, + .clk= l3_iclk_div, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; /* * Interfaces @@ -2399,6 +2470,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { omap54xx_l4_cfg__usb_tll_hs, omap54xx_l4_cfg__usb_otg_ss, omap54xx_l4_wkup__wd_timer2, + omap54xx_l4_cfg__ocp2scp3, + omap54xx_l4_cfg__sata, NULL, }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/12] phy: rename struct omap_control_usb to struct omap_control_phy
From: Kishon Vijay Abraham I kis...@ti.com Rename struct omap_control_usb to struct omap_control_phy since it can be used to control PHY of USB, SATA and PCIE. Also move the driver and include files under *phy* and made the corresponding changes in the users of phy-omap-control. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/phy/Kconfig | 14 +- drivers/phy/Makefile | 1 + drivers/phy/phy-omap-control.c | 320 +++ drivers/phy/phy-omap-usb2.c | 8 +- drivers/phy/phy-ti-pipe3.c | 8 +- drivers/usb/musb/omap2430.c | 2 +- drivers/usb/phy/Kconfig | 10 -- drivers/usb/phy/Makefile | 1 - drivers/usb/phy/phy-omap-control.c | 319 -- include/linux/phy/omap_control_phy.h | 89 ++ include/linux/usb/omap_control_usb.h | 89 -- 11 files changed, 431 insertions(+), 430 deletions(-) create mode 100644 drivers/phy/phy-omap-control.c delete mode 100644 drivers/usb/phy/phy-omap-control.c create mode 100644 include/linux/phy/omap_control_phy.h delete mode 100644 include/linux/usb/omap_control_usb.h diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index bb238d4..2f02ec8 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -28,12 +28,22 @@ config PHY_MVEBU_SATA depends on OF select GENERIC_PHY +config OMAP_CONTROL_PHY + tristate OMAP CONTROL PHY Driver + help + Enable this to add support for the PHY part present in the control + module. This driver has API to power on the USB2 PHY and to write to + the mailbox. The mailbox is present only in omap4 and the register to + power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an + additional register to power on USB3 PHY/SATA PHY/PCIE PHY + (PIPE3 PHY). + config OMAP_USB2 tristate OMAP USB2 PHY Driver depends on ARCH_OMAP2PLUS depends on USB_PHY select GENERIC_PHY - select OMAP_CONTROL_USB + select OMAP_CONTROL_PHY help Enable this to support the transceiver that is part of SOC. This driver takes care of all the PHY functionality apart from comparator. @@ -44,7 +54,7 @@ config TI_PIPE3 tristate TI PIPE3 PHY Driver depends on ARCH_OMAP2PLUS || COMPILE_TEST select GENERIC_PHY - select OMAP_CONTROL_USB + select OMAP_CONTROL_PHY help Enable this to support the PIPE3 PHY that is part of TI SOCs. This driver takes care of all the PHY functionality apart from comparator. diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 32e3f94..7518497 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o obj-$(CONFIG_TI_PIPE3) += phy-ti-pipe3.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_OMAP_CONTROL_PHY) += phy-omap-control.o diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c new file mode 100644 index 000..17fc200 --- /dev/null +++ b/drivers/phy/phy-omap-control.c @@ -0,0 +1,320 @@ +/* + * omap-control-phy.c - The PHY part of control module. + * + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Kishon Vijay Abraham I kis...@ti.com + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include linux/module.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/of.h +#include linux/of_device.h +#include linux/err.h +#include linux/io.h +#include linux/clk.h +#include linux/phy/omap_control_phy.h + +/** + * omap_control_phy_power - power on/off the phy using control module reg + * @dev: the control module device + * @on: 0 or 1, based on powering on or off the PHY + */ +void omap_control_phy_power(struct device *dev, int on) +{ + u32 val; + unsigned long rate; + struct omap_control_phy *control_phy; + + if (IS_ERR(dev) || !dev) { + pr_err(%s: invalid device\n, __func__); + return; + } + + control_phy = dev_get_drvdata(dev); + if (!control_phy) { + dev_err(dev, %s: invalid control phy device\n, __func__); + return; + } + + if (control_phy-type ==
[PATCH 05/12] phy: ti-pipe3: Add SATA DPLL support
USB and SATA DPLLs need different settings. Provide the SATA DPLL settings and use the proper DPLL settings based on device tree node's compatible_id. Update the DT binding information. Signed-off-by: Roger Quadros rog...@ti.com --- Documentation/devicetree/bindings/phy/ti-phy.txt | 3 +- drivers/phy/phy-ti-pipe3.c | 76 +--- 2 files changed, 57 insertions(+), 22 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt index 41dc132..6a65081 100644 --- a/Documentation/devicetree/bindings/phy/ti-phy.txt +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt @@ -49,7 +49,8 @@ usb2phy@4a0ad080 { TI PIPE3 PHY Required properties: - - compatible: Should be ti,phy-usb3. ti,omap-usb3 is deprecated. + - compatible: Should be ti,phy-usb3 or ti,phy-pipe3-sata. + ti,omap-usb3 is deprecated. - reg : Address and length of the register set for the device. - reg-names: The names of the register addresses corresponding to the registers filled in reg. diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 3662e28..ee8871d 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -66,6 +66,11 @@ struct pipe3_dpll_params { u32 mf; }; +struct pipe3_dpll_map { + unsigned long rate; + struct pipe3_dpll_params params; +}; + struct ti_pipe3 { void __iomem*pll_ctrl_base; struct device *dev; @@ -73,20 +78,27 @@ struct ti_pipe3 { struct clk *wkupclk; struct clk *sys_clk; struct clk *optclk; + struct pipe3_dpll_map *dpll_map; }; -struct pipe3_dpll_map { - unsigned long rate; - struct pipe3_dpll_params params; -}; - -static struct pipe3_dpll_map dpll_map[] = { +static struct pipe3_dpll_map dpll_map_usb[] = { {1200, {1250, 5, 4, 20, 0} }, /* 12 MHz */ {1680, {3125, 20, 4, 20, 0} }, /* 16.8 MHz */ {1920, {1172, 8, 4, 20, 65537} }, /* 19.2 MHz */ {2000, {1000, 7, 4, 10, 0} }, /* 20 MHz */ {2600, {1250, 12, 4, 20, 0} }, /* 26 MHz */ {3840, {3125, 47, 4, 20, 92843} }, /* 38.4 MHz */ + { },/* Terminator */ +}; + +static struct pipe3_dpll_map dpll_map_sata[] = { + {1200, {1000, 7, 4, 6, 0} },/* 12 MHz */ + {1680, {714, 7, 4, 6, 0} }, /* 16.8 MHz */ + {1920, {625, 7, 4, 6, 0} }, /* 19.2 MHz */ + {2000, {600, 7, 4, 6, 0} }, /* 20 MHz */ + {2600, {461, 7, 4, 6, 0} }, /* 26 MHz */ + {3840, {312, 7, 4, 6, 0} }, /* 38.4 MHz */ + { },/* Terminator */ }; static inline u32 ti_pipe3_readl(void __iomem *addr, unsigned offset) @@ -100,15 +112,20 @@ static inline void ti_pipe3_writel(void __iomem *addr, unsigned offset, __raw_writel(data, addr + offset); } -static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(unsigned long rate) +static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy) { - int i; + unsigned long rate; + struct pipe3_dpll_map *dpll_map = phy-dpll_map; - for (i = 0; i ARRAY_SIZE(dpll_map); i++) { - if (rate == dpll_map[i].rate) - return dpll_map[i].params; + rate = clk_get_rate(phy-sys_clk); + + for (; dpll_map-rate; dpll_map++) { + if (rate == dpll_map-rate) + return dpll_map-params; } + dev_err(phy-dev, No DPLL configuration for %lu Hz SYS CLK\n, rate); + return NULL; } @@ -182,16 +199,11 @@ static void ti_pipe3_dpll_relock(struct ti_pipe3 *phy) static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy) { u32 val; - unsigned long rate; struct pipe3_dpll_params *dpll_params; - rate = clk_get_rate(phy-sys_clk); - dpll_params = ti_pipe3_get_dpll_params(rate); - if (!dpll_params) { - dev_err(phy-dev, - No DPLL configuration for %lu Hz SYS CLK\n, rate); + dpll_params = ti_pipe3_get_dpll_params(phy); + if (!dpll_params) return -EINVAL; - } val = ti_pipe3_readl(phy-pll_ctrl_base, PLL_CONFIGURATION1); val = ~PLL_REGN_MASK; @@ -244,6 +256,10 @@ static struct phy_ops ops = { .owner = THIS_MODULE, }; +#ifdef CONFIG_OF +static const struct of_device_id ti_pipe3_id_table[]; +#endif + static int ti_pipe3_probe(struct platform_device *pdev) { struct ti_pipe3 *phy; @@ -253,8 +269,10 @@ static int ti_pipe3_probe(struct platform_device *pdev) struct device_node *node = pdev-dev.of_node; struct device_node *control_node; struct platform_device *control_pdev; +
[PATCH 00/12] ARM: OMAP: SATA support for OMAP5 DRA7
Hi, This series adds SATA support for OMAP5 uevm and DRA7-evm boards. - Cleans up the ti-pipe3 PHY driver - Adds SATA DPLL support to ti-pipe3 PHY driver - Adds SATA nodes to hwmod and SoC DT data Patches are based on [1]. To test SATA you will also need [2]. [1] - http://article.gmane.org/gmane.linux.kernel/1658825 [2] - http://article.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/7285 cheers, -roger --- Balaji T K (2): ARM: dts: omap5: add sata node ARM: dts: dra7: add OCP2SCP3 and SATA nodes Keshava Munegowda (1): ARM: OMAP5: hwmod: Add ocp2scp3 and sata hwmods Kishon Vijay Abraham I (1): phy: rename struct omap_control_usb to struct omap_control_phy Nikhil Devshatwar (1): ARM: DRA7: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros (7): phy: omap-control: Update DT binding information phy: ti-pipe3: cleanup clock handling ARM: dts: omap5: Add clocks to usb3_phy node phy: ti-pipe3: Add SATA DPLL support phy: omap: Select OMAP_OCP2SCP bus driver phy: ti-pipe3: streamline PHY operations phy: ti-pipe3: Fix suspend/resume and module reload Documentation/devicetree/bindings/phy/ti-phy.txt | 28 +- Documentation/devicetree/bindings/usb/omap-usb.txt | 24 -- arch/arm/boot/dts/dra7.dtsi| 39 +++ arch/arm/boot/dts/omap5.dtsi | 42 +++ arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 73 + arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 41 ++- drivers/phy/Kconfig| 16 +- drivers/phy/Makefile | 1 + drivers/phy/phy-omap-control.c | 320 + drivers/phy/phy-omap-usb2.c| 8 +- drivers/phy/phy-ti-pipe3.c | 257 ++--- drivers/usb/musb/omap2430.c| 2 +- drivers/usb/phy/Kconfig| 10 - drivers/usb/phy/Makefile | 1 - drivers/usb/phy/phy-omap-control.c | 319 include/linux/phy/omap_control_phy.h | 89 ++ include/linux/usb/omap_control_usb.h | 89 -- 17 files changed, 798 insertions(+), 561 deletions(-) create mode 100644 drivers/phy/phy-omap-control.c delete mode 100644 drivers/usb/phy/phy-omap-control.c create mode 100644 include/linux/phy/omap_control_phy.h delete mode 100644 include/linux/usb/omap_control_usb.h -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/12] phy: omap-control: Update DT binding information
Move omap-control binding information to the right location. Signed-off-by: Roger Quadros rog...@ti.com --- Documentation/devicetree/bindings/phy/ti-phy.txt | 25 ++ Documentation/devicetree/bindings/usb/omap-usb.txt | 24 - 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt index 207e14c..41dc132 100644 --- a/Documentation/devicetree/bindings/phy/ti-phy.txt +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt @@ -1,5 +1,30 @@ TI PHY: DT DOCUMENTATION FOR PHYs in TI PLATFORMs +OMAP CONTROL PHY + +Required properties: + - compatible: Should be one of + ti,control-phy-otghs - if it has otghs_control mailbox register as on OMAP4. + ti,control-phy-usb2 - if it has Power down bit in control_dev_conf register +e.g. USB2_PHY on OMAP5. + ti,control-phy-pipe3 - if it has DPLL and individual Rx Tx power control +e.g. USB3 PHY and SATA PHY on OMAP5. + ti,control-phy-dra7usb2 - if it has power down register like USB2 PHY on +DRA7 platform. + ti,control-phy-am437usb2 - if it has power down register like USB2 PHY on +AM437 platform. + - reg : Address and length of the register set for the device. It contains + the address of otghs_control for control-phy-otghs or power register + for other types. + - reg-names: should be otghs_control control-phy-otghs and power for + other types. + +omap_control_usb: omap-control-usb@4a002300 { +compatible = ti,control-phy-otghs; +reg = 0x4a00233c 0x4; +reg-names = otghs_control; +}; + OMAP USB2 PHY Required properties: diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt index c495135..38b2fae 100644 --- a/Documentation/devicetree/bindings/usb/omap-usb.txt +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt @@ -76,27 +76,3 @@ omap_dwc3 { ranges; }; -OMAP CONTROL USB - -Required properties: - - compatible: Should be one of - ti,control-phy-otghs - if it has otghs_control mailbox register as on OMAP4. - ti,control-phy-usb2 - if it has Power down bit in control_dev_conf register - e.g. USB2_PHY on OMAP5. - ti,control-phy-pipe3 - if it has DPLL and individual Rx Tx power control - e.g. USB3 PHY and SATA PHY on OMAP5. - ti,control-phy-dra7usb2 - if it has power down register like USB2 PHY on - DRA7 platform. - ti,control-phy-am437usb2 - if it has power down register like USB2 PHY on - AM437 platform. - - reg : Address and length of the register set for the device. It contains - the address of otghs_control for control-phy-otghs or power register - for other types. - - reg-names: should be otghs_control control-phy-otghs and power for - other types. - -omap_control_usb: omap-control-usb@4a002300 { - compatible = ti,control-phy-otghs; - reg = 0x4a00233c 0x4; - reg-names = otghs_control; -}; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/12] ARM: dts: omap5: Add clocks to usb3_phy node
The pipe3-phy driver expects certain named clocks. Provide the necessary clocks. CC: Benoît Cousson bcous...@baylibre.com CC: Tony Lindgren t...@atomide.com Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/omap5.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 1c68558..a7f5930 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi @@ -760,6 +760,8 @@ 0x4a084c00 0x40; reg-names = phy_rx, phy_tx, pll_ctrl; ctrl-module = omap_control_usb3phy; + clocks = usb_phy_cm_clk32k, sys_clkin; + clock-names = wkupclk, sysclk; #phy-cells = 0; }; }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/12] phy: ti-pipe3: cleanup clock handling
As this driver is no longer USB specific, use generic clock names. - Fix PLL_SD_SHIFT from 9 to 10 - As optclk and wkupclk may not be always required, don't bail out if they aren't available. - Don't separate prepare/unprepare clock from enable/disable. This ensures optimal power savings. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/phy/phy-ti-pipe3.c | 57 ++ 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 54859fc..3662e28 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c @@ -45,7 +45,7 @@ #definePLL_SELFREQDCO_MASK 0x000E #definePLL_SELFREQDCO_SHIFT0x1 #definePLL_SD_MASK 0x0003FC00 -#definePLL_SD_SHIFT0x9 +#definePLL_SD_SHIFT10 #defineSET_PLL_GO 0x1 #definePLL_TICOPWDN0x1 #definePLL_LOCK0x2 @@ -270,23 +270,17 @@ static int ti_pipe3_probe(struct platform_device *pdev) phy-dev= pdev-dev; - phy-wkupclk = devm_clk_get(phy-dev, usb_phy_cm_clk32k); - if (IS_ERR(phy-wkupclk)) { - dev_err(pdev-dev, unable to get usb_phy_cm_clk32k\n); - return PTR_ERR(phy-wkupclk); - } - clk_prepare(phy-wkupclk); + phy-wkupclk = devm_clk_get(phy-dev, wkupclk); + if (IS_ERR(phy-wkupclk)) + dev_dbg(pdev-dev, unable to get wkupclk\n); - phy-optclk = devm_clk_get(phy-dev, usb_otg_ss_refclk960m); - if (IS_ERR(phy-optclk)) { - dev_err(pdev-dev, unable to get usb_otg_ss_refclk960m\n); - return PTR_ERR(phy-optclk); - } - clk_prepare(phy-optclk); + phy-optclk = devm_clk_get(phy-dev, optclk); + if (IS_ERR(phy-optclk)) + dev_dbg(pdev-dev, unable to get optclk\n); - phy-sys_clk = devm_clk_get(phy-dev, sys_clkin); + phy-sys_clk = devm_clk_get(phy-dev, sysclk); if (IS_ERR(phy-sys_clk)) { - pr_err(%s: unable to get sys_clkin\n, __func__); + dev_err(pdev-dev, unable to get sysclk\n); return -EINVAL; } @@ -326,10 +320,6 @@ static int ti_pipe3_probe(struct platform_device *pdev) static int ti_pipe3_remove(struct platform_device *pdev) { - struct ti_pipe3 *phy = platform_get_drvdata(pdev); - - clk_unprepare(phy-wkupclk); - clk_unprepare(phy-optclk); if (!pm_runtime_suspended(pdev-dev)) pm_runtime_put(pdev-dev); pm_runtime_disable(pdev-dev); @@ -343,8 +333,10 @@ static int ti_pipe3_runtime_suspend(struct device *dev) { struct ti_pipe3 *phy = dev_get_drvdata(dev); - clk_disable(phy-wkupclk); - clk_disable(phy-optclk); + if (!IS_ERR(phy-wkupclk)) + clk_disable_unprepare(phy-wkupclk); + if (!IS_ERR(phy-optclk)) + clk_disable_unprepare(phy-optclk); return 0; } @@ -354,22 +346,27 @@ static int ti_pipe3_runtime_resume(struct device *dev) u32 ret = 0; struct ti_pipe3 *phy = dev_get_drvdata(dev); - ret = clk_enable(phy-optclk); - if (ret) { - dev_err(phy-dev, Failed to enable optclk %d\n, ret); - goto err1; + if (!IS_ERR(phy-optclk)) { + ret = clk_prepare_enable(phy-optclk); + if (ret) { + dev_err(phy-dev, Failed to enable optclk %d\n, ret); + goto err1; + } } - ret = clk_enable(phy-wkupclk); - if (ret) { - dev_err(phy-dev, Failed to enable wkupclk %d\n, ret); - goto err2; + if (!IS_ERR(phy-wkupclk)) { + ret = clk_prepare_enable(phy-wkupclk); + if (ret) { + dev_err(phy-dev, Failed to enable wkupclk %d\n, ret); + goto err2; + } } return 0; err2: - clk_disable(phy-optclk); + if (!IS_ERR(phy-optclk)) + clk_disable_unprepare(phy-optclk); err1: return ret; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: gadget: return the right length in ffs_epfile_io()
Hi, On Thu, Feb 27, 2014 at 02:49:31PM +0800, Chuansheng Liu wrote: When the request length is aligned to maxpacketsize, sometimes the return length ret the user space requested len. At that time, we will use min_t(size_t, ret, len) to limit the size in case of user data buffer overflow. But we need return the min_t(size_t, ret, len) to tell the user space rightly also. Signed-off-by: Chuansheng Liu chuansheng@intel.com --- drivers/usb/gadget/f_fs.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 2b43343..31ee7af 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -687,10 +687,12 @@ static ssize_t ffs_epfile_io(struct file *file, * space for. */ ret = ep-status; - if (read ret 0 - unlikely(copy_to_user(buf, data, - min_t(size_t, ret, len - ret = -EFAULT; + if (read ret 0) { + ret = min_t(size_t, ret, len); + + if (unlikely(copy_to_user(buf, data, ret))) + ret = -EFAULT; + } please rebase on my testing/next branch -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
On Fri, Feb 28, 2014 at 03:34:01PM +0100, Gregory CLEMENT wrote: The debug trace in the atmel_usba_stop function made the assumption that the driver pointer passed in parameter was not NULL. Since the commit usb: gadget: udc-core: fix a regression during gadget driver unbinding, it was no more always true. This lead to a kernel crash. This commit now use the driver pointer stored in udc which fixes this issue. Since the commit which have triggered this issue was backported to the 3.2 stable branch, then this one should also be backported to the same kernel. Cc: sta...@vger.kernel.org # v3.2+ Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding) this line shouldn't be here and you're missing a SoB line, can't take this patch, sorry. -- balbi signature.asc Description: Digital signature
Re: [PATCH v5 0/6] Make dwc3 use Generic PHY Framework
Hi, On Mon, Mar 03, 2014 at 05:08:09PM +0530, Kishon Vijay Abraham I wrote: Added support for optional PHY in dwc3 as not all SoCs having PHYs for DWC3 should be programmed. While this can be considered as a temporary fix, a long term solution would be to add 'nop' PHY for platforms that does not have programmable PHY. Adapted DWC3 and USB3 PHY to use Generic PHY framework. Also changed the name of USB3 PHY driver to PIPE3 PHY driver since the same driver has to be used for SATA and PCIE too. Changes from v4: (sending the entire patch series again) * check the return values of phy_init and phy_power_on * print errors if power_on or power_off of PHY fails. Changes from v3: (Sent only adapt dwc3 core to use Generic PHY Framework) * avoided using quirks and rely on the return values of PHY APIs to find the presence of PHY. Changes from v2: * added a couple of fixes. One is invoking phy_resume after phy_init and the other is power off phy in error patch * used quirks to identify if a particular platform does not have PHYs * removed using separate header for pipe3 driver and also removed all referencs to SATA and PCIe in pipe3 driver since it's not yet adapted for those drivers. Changes from v1: * The logic in which the driver detects the presence of PHYs has changed. * patch ordering has changed * udelay is replaced with usleep_range * A patch to remove set_suspend callback which was deferred from Generic PHY Framework series has been included. Kishon Vijay Abraham I (6): usb: dwc3: core: support optional PHYs usb: dwc3: adapt dwc3 core to use Generic PHY Framework drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework usb: phy: omap-usb2: remove *set_suspend* callback from omap-usb2 phy: omap-usb2: move omap_usb.h from linux/usb/ to linux/phy/ arm/dts: added dt properties to adapt to the new phy framwork patches 1 and 2 are in my testing/next, I guess 3,4,5 and 6 have no direct dependency on those, right ? -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
On Mon, Mar 03, 2014 at 05:38:49PM +0100, Gregory CLEMENT wrote: On 03/03/2014 17:33, Felipe Balbi wrote: On Fri, Feb 28, 2014 at 03:34:01PM +0100, Gregory CLEMENT wrote: The debug trace in the atmel_usba_stop function made the assumption that the driver pointer passed in parameter was not NULL. Since the commit usb: gadget: udc-core: fix a regression during gadget driver unbinding, it was no more always true. This lead to a kernel crash. This commit now use the driver pointer stored in udc which fixes this issue. Since the commit which have triggered this issue was backported to the 3.2 stable branch, then this one should also be backported to the same kernel. Cc: sta...@vger.kernel.org # v3.2+ Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding) this line shouldn't be here and you're missing a SoB line, can't take this patch, sorry. Right, I forgot the -s option for this commit. and you want the Fixes line be before the Cc: line, right? right, that should do it. cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH v2] phy-rcar-gen2-usb: add device tree support
Hi, On Sat, Mar 01, 2014 at 04:07:53AM +0300, Sergei Shtylyov wrote: Add support of the device tree probing for the Renesas R-Car generation 2 SoCs documenting the device tree binding as necessary. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Unless someone on devicetree@vger gives me an ACK pretty soon, I'm afraid this patch will miss v3.15. --- This patch is against the 'next' branch of Felipe Balbi's 'usb.git' repo. Changes in version 2: - restored devm_clk_get() call and the error handling logic in the probe() method, removed clk_put() call in the remove() method. Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt | 29 +++ drivers/usb/phy/phy-rcar-gen2-usb.c | 42 ++-- 2 files changed, 68 insertions(+), 3 deletions(-) Index: usb/Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt === --- /dev/null +++ usb/Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt @@ -0,0 +1,29 @@ +* Renesas R-Car generation 2 USB PHY + +This file provides information on what the device node for the R-Car generation +2 USB PHY contains. + +Required properties: +- compatible: renesas,usb-phy-r8a7790 if the device is a part of R8A7790 SoC. + renesas,usb-phy-r8a7791 if the device is a part of R8A7791 SoC. +- reg: offset and length of the register block. +- clocks: clock phandle and specifier pair. +- clock-names: string, clock input name, must be usbhs. + +Optional properties: +- renesas,channel0-pci: boolean, specify when USB channel 0 should be connected + to PCI EHCI/OHCI; otherwise, it will be connected to the + USBHS controller. +- renesas,channel2-pci: boolean, specify when USB channel 2 should be connected + to PCI EHCI/OHCI; otherwise, it will be connected to the + USBSS controller (xHCI). I wonder if these two properties should be taken care by pinctrl framework instead. + +Example (Lager board): + + usb-phy@e6590100 { + compatible = renesas,usb-phy-r8a7790; + reg = 0 0xe6590100 0 0x100; + clocks = mstp7_clks R8A7790_CLK_HSUSB; + clock-names = usbhs; + renesas,channel2-pci; + }; Index: usb/drivers/usb/phy/phy-rcar-gen2-usb.c === --- usb.orig/drivers/usb/phy/phy-rcar-gen2-usb.c +++ usb/drivers/usb/phy/phy-rcar-gen2-usb.c @@ -1,8 +1,8 @@ /* * Renesas R-Car Gen2 USB phy driver * - * Copyright (C) 2013 Renesas Solutions Corp. - * Copyright (C) 2013 Cogent Embedded, Inc. + * Copyright (C) 2013-2014 Renesas Solutions Corp. + * Copyright (C) 2013-2014 Cogent Embedded, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -13,6 +13,7 @@ #include linux/delay.h #include linux/io.h #include linux/module.h +#include linux/of.h #include linux/platform_data/usb-rcar-gen2-phy.h #include linux/platform_device.h #include linux/spinlock.h @@ -167,6 +168,37 @@ out: spin_unlock_irqrestore(priv-lock, flags); } +#ifdef CONFIG_OF +static struct rcar_gen2_phy_platform_data * +rcar_gen2_usb_phy_parse_dt(struct device *dev) +{ + struct device_node *np = dev-of_node; + struct rcar_gen2_phy_platform_data *pdata; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return NULL; + + pdata-chan0_pci = of_property_read_bool(np, renesas,channel0-pci); + pdata-chan2_pci = of_property_read_bool(np, renesas,channel2-pci); + + return pdata; +} + +static const struct of_device_id rcar_gen2_usb_phy_match_table[] = { + { .compatible = renesas,usb-phy-r8a7790 }, + { .compatible = renesas,usb-phy-r8a7791 }, + { } +}; +MODULE_DEVICE_TABLE(of, rcar_gen2_usb_phy_match_table); +#else +static inline struct rcar_gen2_phy_platform_data * +rcar_gen2_usb_phy_parse_dt(struct device *dev) +{ + return NULL; +} +#endif + static int rcar_gen2_usb_phy_probe(struct platform_device *pdev) { struct device *dev = pdev-dev; @@ -177,7 +209,10 @@ static int rcar_gen2_usb_phy_probe(struc struct clk *clk; int retval; - pdata = dev_get_platdata(dev); + if (dev-of_node) + pdata = rcar_gen2_usb_phy_parse_dt(dev); + else + pdata = dev_get_platdata(dev); if (!pdata) { dev_err(dev, No platform data\n); return -EINVAL; @@ -236,6 +271,7 @@ static int rcar_gen2_usb_phy_remove(stru static struct platform_driver rcar_gen2_usb_phy_driver = { .driver = { .name = usb_phy_rcar_gen2, + .of_match_table = of_match_ptr(rcar_gen2_usb_phy_match_table), }, .probe =
Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
On 03/03/2014 17:33, Felipe Balbi wrote: On Fri, Feb 28, 2014 at 03:34:01PM +0100, Gregory CLEMENT wrote: The debug trace in the atmel_usba_stop function made the assumption that the driver pointer passed in parameter was not NULL. Since the commit usb: gadget: udc-core: fix a regression during gadget driver unbinding, it was no more always true. This lead to a kernel crash. This commit now use the driver pointer stored in udc which fixes this issue. Since the commit which have triggered this issue was backported to the 3.2 stable branch, then this one should also be backported to the same kernel. Cc: sta...@vger.kernel.org # v3.2+ Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding) this line shouldn't be here and you're missing a SoB line, can't take this patch, sorry. Right, I forgot the -s option for this commit. and you want the Fixes line be before the Cc: line, right? Thanks, Gregory -- Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
The debug trace in the atmel_usba_stop function made the assumption that the driver pointer passed in parameter was not NULL. Since the commit usb: gadget: udc-core: fix a regression during gadget driver unbinding, it was no more always true. This lead to a kernel crash. This commit now use the driver pointer stored in udc which fixes this issue. Since the commit which have triggered this issue was backported to the 3.2 stable branch, then this one should also be backported to the same kernel. Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding) Cc: sta...@vger.kernel.org # v3.2+ Signed-off-by: Gregory CLEMENT gregory.clem...@free-electrons.com --- Changelog: v1 - v2 Fixed the signature block in the commit log drivers/usb/gadget/atmel_usba_udc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 52771d4c44bc..167843de2d8a 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -1827,12 +1827,12 @@ static int atmel_usba_stop(struct usb_gadget *gadget, toggle_bias(0); usba_writel(udc, CTRL, USBA_DISABLE_MASK); - udc-driver = NULL; - clk_disable_unprepare(udc-hclk); clk_disable_unprepare(udc-pclk); - DBG(DBG_GADGET, unregistered driver `%s'\n, driver-driver.name); + DBG(DBG_GADGET, unregistered driver `%s'\n, udc-driver-driver.name); + + udc-driver = NULL; return 0; } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: gadget: atmel_usba: fix crash when no endpoint are specified
On Mon, Mar 03, 2014 at 05:46:34PM +0100, Alexandre Belloni wrote: Hi Felipe, On 28/02/2014 at 15:35:42 +0100, Nicolas Ferre wrote : On 27/02/2014 16:42, Alexandre Belloni : If no endpoints are present in the device tree, the kernel will cras hwith the s/cras hwith/crash with/ Do you want me to send a v2 with that typo corrected or could you correct it when applying ? I'll fix it up, don't worry. -- balbi signature.asc Description: Digital signature
Re: [PATCH v2] phy-rcar-gen2-usb: add device tree support
Hello. On 03/03/2014 07:44 PM, Felipe Balbi wrote: Add support of the device tree probing for the Renesas R-Car generation 2 SoCs documenting the device tree binding as necessary. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Unless someone on devicetree@vger gives me an ACK pretty soon, I'm afraid this patch will miss v3.15. Ugh, the USB acceptance window is getting very short... --- This patch is against the 'next' branch of Felipe Balbi's 'usb.git' repo. Changes in version 2: - restored devm_clk_get() call and the error handling logic in the probe() method, removed clk_put() call in the remove() method. Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt | 29 +++ drivers/usb/phy/phy-rcar-gen2-usb.c | 42 ++-- 2 files changed, 68 insertions(+), 3 deletions(-) Index: usb/Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt === --- /dev/null +++ usb/Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt @@ -0,0 +1,29 @@ +* Renesas R-Car generation 2 USB PHY + +This file provides information on what the device node for the R-Car generation +2 USB PHY contains. + +Required properties: +- compatible: renesas,usb-phy-r8a7790 if the device is a part of R8A7790 SoC. + renesas,usb-phy-r8a7791 if the device is a part of R8A7791 SoC. +- reg: offset and length of the register block. +- clocks: clock phandle and specifier pair. +- clock-names: string, clock input name, must be usbhs. + +Optional properties: +- renesas,channel0-pci: boolean, specify when USB channel 0 should be connected + to PCI EHCI/OHCI; otherwise, it will be connected to the + USBHS controller. +- renesas,channel2-pci: boolean, specify when USB channel 2 should be connected + to PCI EHCI/OHCI; otherwise, it will be connected to the + USBSS controller (xHCI). I wonder if these two properties should be taken care by pinctrl framework instead. No, the internal port multiplexing is controlled by the PHY itself, see the driver source. The same way it was with USB port 1 of the generation 1 R-Car SoCs. WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: gadget: atmel_usba: fix crash when no endpoint are specified
Hi Felipe, On 28/02/2014 at 15:35:42 +0100, Nicolas Ferre wrote : On 27/02/2014 16:42, Alexandre Belloni : If no endpoints are present in the device tree, the kernel will cras hwith the s/cras hwith/crash with/ Do you want me to send a v2 with that typo corrected or could you correct it when applying ? -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] phy-rcar-gen2-usb: add device tree support
Hi, On Mon, Mar 03, 2014 at 08:50:33PM +0300, Sergei Shtylyov wrote: Hello. On 03/03/2014 07:44 PM, Felipe Balbi wrote: Add support of the device tree probing for the Renesas R-Car generation 2 SoCs documenting the device tree binding as necessary. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Unless someone on devicetree@vger gives me an ACK pretty soon, I'm afraid this patch will miss v3.15. Ugh, the USB acceptance window is getting very short... well, -rc5 is already out... I want to have at least 2 weeks of linux-next soakage (yes, I just coined a new term heh). Since most releases go up to -rc7, it's about time to close the tree ;-) --- This patch is against the 'next' branch of Felipe Balbi's 'usb.git' repo. Changes in version 2: - restored devm_clk_get() call and the error handling logic in the probe() method, removed clk_put() call in the remove() method. Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt | 29 +++ drivers/usb/phy/phy-rcar-gen2-usb.c | 42 ++-- 2 files changed, 68 insertions(+), 3 deletions(-) Index: usb/Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt === --- /dev/null +++ usb/Documentation/devicetree/bindings/usb/rcar-gen2-phy.txt @@ -0,0 +1,29 @@ +* Renesas R-Car generation 2 USB PHY + +This file provides information on what the device node for the R-Car generation +2 USB PHY contains. + +Required properties: +- compatible: renesas,usb-phy-r8a7790 if the device is a part of R8A7790 SoC. + renesas,usb-phy-r8a7791 if the device is a part of R8A7791 SoC. +- reg: offset and length of the register block. +- clocks: clock phandle and specifier pair. +- clock-names: string, clock input name, must be usbhs. + +Optional properties: +- renesas,channel0-pci: boolean, specify when USB channel 0 should be connected + to PCI EHCI/OHCI; otherwise, it will be connected to the + USBHS controller. +- renesas,channel2-pci: boolean, specify when USB channel 2 should be connected + to PCI EHCI/OHCI; otherwise, it will be connected to the + USBSS controller (xHCI). I wonder if these two properties should be taken care by pinctrl framework instead. No, the internal port multiplexing is controlled by the PHY itself, see the driver source. The same way it was with USB port 1 of the generation 1 R-Car SoCs. ok, fair enough. -- balbi signature.asc Description: Digital signature
Re: MAX3421E Linux driver?
On Sun, Mar 2, 2014 at 10:04 AM, Peter Stuge pe...@stuge.se wrote: David Mosberger wrote: +++ b/drivers/usb/host/Kconfig @@ -4,6 +4,16 @@ comment USB Host Controller Drivers depends on USB +config USB_MAX3421_HCD + tristate MAX3421 HCD (USB-over-SPI) support + depends on USB + help + The Maxim MAX3421E Host Controller Interface supports + standard USB 1.1 high-speed hardware. I'd suggest supports USB 2.0-compliant full-speed devices instead. Yeah, that comment was old and wrong. I fixed that per your suggestion, thanks. And before you assume that high-speed devices (flash drives, wlan, etc) don't work correctly because of something your driver does I would strongly recommend to perform the same tests using another full-speed HC, e.g. by using uhci_hcd as the only hcd, disabling ehci_hcd, on EHCI hardware. I've seen high-speed-capable devices work quite poorly at full-speed; who cares about correctness when there is performance? At first, we had problems recognizing high-speed devices, but that must have been a silly bug since it got fixed without me even trying. Certainly there can be cases where high-speed devices wouldn't work properly at full speed, but I don't think I'm ready to blame the devices over my driver just yet. I may change my mind on this, of course. ;-) --david -- eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768 -- 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: gadget: add temporary __uses_feature_flags
during the conversion to a new method of finding proper endpoints, we need to give our users a grace period until full conversion is finished. This patch adds a new internal and temporary __uses_feature_flags flag which will tell gadget framework that this UDC has been converted to the new feature flag-based endpoint scheme. Once all gadget drivers are converted, this flag will be removed. Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/gadget.c | 1 + drivers/usb/gadget/epautoconf.c | 48 + drivers/usb/gadget/s3c-hsotg.c | 1 + include/linux/usb/gadget.h | 2 ++ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index eaf8537..54b40ce 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2733,6 +2733,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc-gadget.speed = USB_SPEED_UNKNOWN; dwc-gadget.sg_supported= true; dwc-gadget.name= dwc3-gadget; + dwc-gadget.__uses_feature_flags = true; /* * Per databook, DWC3 needs buffer size to be aligned to MaxPacketSize diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index d82ec71..1a71a14 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -61,31 +61,33 @@ ep_matches ( if (USB_ENDPOINT_XFER_CONTROL == type) return 0; - /* first check feature flags */ - if (usb_endpoint_dir_in(desc)) - if (!ep-has_dir_in) - return 0; + if (gadget-__uses_feature_flags) { + /* first check feature flags */ + if (usb_endpoint_dir_in(desc)) + if (!ep-has_dir_in) + return 0; - if (usb_endpoint_dir_out(desc)) - if (!ep-has_dir_out) - return 0; + if (usb_endpoint_dir_out(desc)) + if (!ep-has_dir_out) + return 0; - switch (type) { - case USB_ENDPOINT_XFER_CONTROL: - /* only ep0 */ - return 0; - case USB_ENDPOINT_XFER_BULK: - if (ep-has_bulk) - goto match; - break; - case USB_ENDPOINT_XFER_INT: - if (ep-has_interrupt) - goto match; - break; - case USB_ENDPOINT_XFER_ISOC: - if (ep-has_isochronous) - goto match; - break; + switch (type) { + case USB_ENDPOINT_XFER_CONTROL: + /* only ep0 */ + return 0; + case USB_ENDPOINT_XFER_BULK: + if (ep-has_bulk) + goto match; + break; + case USB_ENDPOINT_XFER_INT: + if (ep-has_interrupt) + goto match; + break; + case USB_ENDPOINT_XFER_ISOC: + if (ep-has_isochronous) + goto match; + break; + } } /* some other naming convention */ diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9f9e2ce..c75576a 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3641,6 +3641,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) hsotg-gadget.max_speed = USB_SPEED_HIGH; hsotg-gadget.ops = s3c_hsotg_gadget_ops; hsotg-gadget.name = dev_name(dev); + hsotg-gadget.__uses_feature_flags = true; /* reset the system */ diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index abd836e..f52b191 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -536,6 +536,7 @@ struct usb_gadget_ops { * enabled HNP support. * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to * MaxPacketSize. + * @__uses_feature_flags: true when UDC uses new feature flags (temporary) * * Gadgets have a mostly-portable gadget driver implementing device * functions, handling all usb configurations and interfaces. Gadget @@ -576,6 +577,7 @@ struct usb_gadget { unsigneda_hnp_support:1; unsigneda_alt_hnp_support:1; unsignedquirk_ep_out_aligned_size:1; + unsigned__uses_feature_flags:1; }; #define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/3] usb: gadget: epautoconf: check feature flags
On Fri, Feb 28, 2014 at 08:55:43AM +0100, Robert Baldyga wrote: On 12/17/2013 02:23 AM, Felipe Balbi wrote: Start matching endpoints against feature flags, this will help us dropping the naming conventions currently used by the Gadget Framework. Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/gadget/epautoconf.c | 30 -- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index feaaa7b..b362046 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -62,6 +62,33 @@ ep_matches ( if (USB_ENDPOINT_XFER_CONTROL == type) return 0; + /* first check feature flags */ + if (usb_endpoint_dir_in(desc)) + if (!ep-has_dir_in) + return 0; + + if (usb_endpoint_dir_out(desc)) + if (!ep-has_dir_out) + return 0; You should add support for this flags in UDC drivers, or make it usable for drivers which don't support this. Gadget drivers cannot bind to UDC if its driver have not set this flags. Currently the only UDC driver which has support for this is dwc3. It's a big issue. I should have tested with a non-converted UDC, sorry. Just sent a patch which wrapps all that around __uses_feature_flags temporary flag. cheers -- balbi signature.asc Description: Digital signature
ax88179_178a problems on AMD platform with ASMedia xhci controller
I've just installed the latest 3.14.0-rc5 kernel on an AMD box that has the ASMedia 1042 xhci controller and an ASX ax88179 USB3 Ge card. This is still working as badly as it did last time I tried it. (When I added a lot of diagnostics to try to find out what was wrong.) When I ran 'ifconfig eth1 192.168.x.x' the kernel message buffer is spammed with messages from the generic ethernet code reporting: kevent 4 may have been missed. This is because ax88179_status(...) contains: if (netif_carrier_ok() != link) { usbnet_link_change(...); ... but the corresponding netif_carrier_on() doesn't happen until much later (possibly for the same reason that transmits are delayed). I think the hardware reports its status every 128ms. If I ping the interface (from the only other system on that ethernet network), the ping times vary, but are typically larger than 20ms and anything upto 200ms (some outward ones are faster). I did add some diagnostics a while ago (rc2 ish) and thought the delays were in the transmit path. dmesg also gets spammed with ERROR Transfer event TRB DMA ptr not part of current TD. I don't remember looking at why (for this case). I've just looked t the ping timings closely. The elapsed times (ms) are: 7, 30, 53, 76, 99, 122, 18, 41, 64, 87, 110, 5, 28 ... So each response is about 22ms later than the previous on - until the delay would exceed 128ms, when 128ms is removed. So something is only looking at something every 128ms. This might be related to the status indications every 128ms, but I thought I'd determined that the delay was between the tx setup and end of tx interrupt. I don't have a USB3 monitor, and the USB2 one I have has an unusable graphical interface. In any case this all makes this combination completely unusable. I was planning on doing some tests for link TRBs - but it doesn't work well enough to even attempt those. David -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
On 03/03/2014 at 17:48:34 +0100, Gregory CLEMENT wrote : The debug trace in the atmel_usba_stop function made the assumption that the driver pointer passed in parameter was not NULL. Since the commit usb: gadget: udc-core: fix a regression during gadget driver unbinding, it was no more always true. This lead to a kernel crash. This commit now use the driver pointer stored in udc which fixes this issue. Since the commit which have triggered this issue was backported to the 3.2 stable branch, then this one should also be backported to the same kernel. Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding) Cc: sta...@vger.kernel.org # v3.2+ Signed-off-by: Gregory CLEMENT gregory.clem...@free-electrons.com Acked-by: Alexandre Belloni alexandre.bell...@free-electrons.com --- Changelog: v1 - v2 Fixed the signature block in the commit log drivers/usb/gadget/atmel_usba_udc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 52771d4c44bc..167843de2d8a 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c @@ -1827,12 +1827,12 @@ static int atmel_usba_stop(struct usb_gadget *gadget, toggle_bias(0); usba_writel(udc, CTRL, USBA_DISABLE_MASK); - udc-driver = NULL; - clk_disable_unprepare(udc-hclk); clk_disable_unprepare(udc-pclk); - DBG(DBG_GADGET, unregistered driver `%s'\n, driver-driver.name); + DBG(DBG_GADGET, unregistered driver `%s'\n, udc-driver-driver.name); + + udc-driver = NULL; return 0; } -- 1.8.1.2 -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/1] xhci: fixes for 3.14
Hi Greg, Here's a small xhci fix for 3.14 rc Only one patch that prevents a panic on xhci_suspend() during xhci initialization on some specific intel platforms if autosuspend is set to 0. We're already at rc5 and I'm not sure what is acceptable anymore at this stage in the cycle. -Mathias Mathias Nyman (1): xhci: Prevent runtime pm from autosuspending during initialization drivers/usb/host/xhci-pci.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 1.8.1.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 v3 1/1] xhci: Prevent runtime pm from autosuspending during initialization
xHCI driver has its own pci probe function that will call usb_hcd_pci_probe to register its usb-2 bus, and then continue to manually register the usb-3 bus. usb_hcd_pci_probe does a pm_runtime_put_noidle at the end and might thus trigger a runtime suspend before the usb-3 bus is ready. Prevent the runtime suspend by increasing the usage count in the beginning of xhci_pci_probe, and decrease it once the usb-3 bus is ready. xhci-platform driver is not using usb_hcd_pci_probe to set up busses and should not need to have it's usage count increased during probe. Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com Acked-by: Dan Williams dan.j.willi...@intel.com Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com Cc: sta...@vger.kernel.org --- drivers/usb/host/xhci-pci.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 04f986d..753857f 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -190,6 +190,10 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) struct usb_hcd *hcd; driver = (struct hc_driver *)id-driver_data; + + /* Prevent runtime suspending between USB-2 and USB-3 initialization */ + pm_runtime_get_noresume(dev-dev); + /* Register the USB 2.0 roothub. * FIXME: USB core must know to register the USB 2.0 roothub first. * This is sort of silly, because we could just set the HCD driver flags @@ -199,7 +203,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) retval = usb_hcd_pci_probe(dev, id); if (retval) - return retval; + goto put_runtime_pm; /* USB 2.0 roothub is stored in the PCI device now. */ hcd = dev_get_drvdata(dev-dev); @@ -228,12 +232,17 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) if (xhci-quirks XHCI_LPM_SUPPORT) hcd_to_bus(xhci-shared_hcd)-root_hub-lpm_capable = 1; + /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ + pm_runtime_put_noidle(dev-dev); + return 0; put_usb3_hcd: usb_put_hcd(xhci-shared_hcd); dealloc_usb2_hcd: usb_hcd_pci_remove(dev); +put_runtime_pm: + pm_runtime_put_noidle(dev-dev); return retval; } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Card reader not working properly with xHCI
Am 01.03.2014 12:13, schrieb Richard Schütz: Am 26.02.2014 22:41, schrieb Richard Schütz: Am 26.02.2014 16:31, schrieb Alan Stern: On Tue, 25 Feb 2014, Sarah Sharp wrote: On Tue, Feb 25, 2014 at 11:22:57PM +0100, Richard Sch�tz wrote: Hi everybody! I am experiencing a problem with my USB card reader and xHCI. Simply using dd to write an image to a SD card results in USB resets after a few seconds. Reading with dd or using cp after creating a filesystem on the card also triggers the issue but usually not as quick as writing to it with dd. All in all it is unusable. Sometimes these resets also happen immediately after connecting the reader. With EHCI everything just works fine. Did it ever work under xHCI? If so, which kernel version did it work on? Unfortunately I am not quite sure, if I ever used that reader with xHCI on this machine. If so, it was some time ago and I do not remember the kernel version anymore. At least with longterm kernel 3.10.32 it is broken, too. I'm Ccing the usb-storage developers, in case the usbmon trace provides some insight. It doesn't. usb 1-2: reset high-speed USB device number 19 using xhci_hcd xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8801b6837600 xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8801b6837640 sd 22:0:0:0: [sdb] Media Changed sd 22:0:0:0: [sdb] Result: hostbyte=0x00 driverbyte=0x08 sd 22:0:0:0: [sdb] Sense Key : 0x6 [current] Info fld=0x0 sd 22:0:0:0: [sdb] ASC=0x28 ASCQ=0x0 sd 22:0:0:0: [sdb] CDB: cdb[0]=0x28: 28 00 00 00 1d 20 00 00 08 00 end_request: I/O error, dev sdb, sector 7456 sd 22:0:0:0: [sdb] No Caching mode page found sd 22:0:0:0: [sdb] Assuming drive cache: write through sd 22:0:0:0: [sdb] No Caching mode page found sd 22:0:0:0: [sdb] Assuming drive cache: write through sdb: unknown partition table It might help you to turn on CONFIG_USB_STORAGE_DEBUG, to see which SCSI command is failing. CONFIG_USB_STORAGE_DEBUG is a lot less helpful for examining SCSI commands than a usbmon trace, because it includes lots of extraneous information. It's meant more for debugging the usb-storage driver itself than for debugging device problems. The command was an ordinary READ, same as a bunch of others that worked fine. And the failure occurred in the command phase, not the data phase: The host doesn't receive an ACK response to the CBW packet. Can you blacklist the usb-storage driver, and get the lsusb output when the device is plugged into a USB 3.0 port? I'd like to see the SuperSpeed Endpoint Companion Descriptor, to see what the Link PM U1/U2 timeout values are. Being a card reader, it is almost certainly a USB-2 device. This is backed up by the fact that it ran at high speed, not SuperSpeed, when connected to an xHCI controller. Therefore it doesn't have U1/U2 timeouts. The card reader itself is not a SuperSpeed device, but a Hi-Speed one that I am trying to use on a SuperSpeed port. Sorry for not pointing out that clearly enough. So, no clue what is going wrong here? Any advice how I could help debugging this further? Today I noticed that this issue also affects my external harddrive. Kernel log with dynamic debugging activated for USB modules is attached. (Now gzipped - looks like the uncompressed version was to big for the linux-usb list. What is the size limit anyway?) # lsusb -d 174c:55aa -v Bus 002 Device 004: ID 174c:55aa ASMedia Technology Inc. ASMedia 2105 SATA bridge Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 3.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 9 idVendor 0x174c ASMedia Technology Inc. idProduct 0x55aa ASMedia 2105 SATA bridge bcdDevice1.00 iManufacturer 2 01234567890123456789012345678901234567890123 iProduct3 External HDD iSerial 1 20130119076F bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 44 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower0mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data
Re: [PATCH 06/12] phy: omap: Select OMAP_OCP2SCP bus driver
* Roger Quadros rog...@ti.com [140303 07:11]: The OMAP_USB2 and OMAP_PIP3 phy devices will not be detected if the OMAP_OCP2SCP driver is not present. So select it. Selecting drivers like this will easily lead into missing dependencies. Especially it's bad for tristate driver options that people may want to have as loadable modules. How about instead depends on OMAP_OCP2SCP? Regards, Tony Signed-off-by: Roger Quadros rog...@ti.com --- drivers/phy/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2f02ec8..afdab3e 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -44,6 +44,7 @@ config OMAP_USB2 depends on USB_PHY select GENERIC_PHY select OMAP_CONTROL_PHY + select OMAP_OCP2SCP help Enable this to support the transceiver that is part of SOC. This driver takes care of all the PHY functionality apart from comparator. @@ -55,6 +56,7 @@ config TI_PIPE3 depends on ARCH_OMAP2PLUS || COMPILE_TEST select GENERIC_PHY select OMAP_CONTROL_PHY + select OMAP_OCP2SCP help Enable this to support the PIPE3 PHY that is part of TI SOCs. This driver takes care of all the PHY functionality apart from comparator. -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/12] phy: omap-control: Update DT binding information
* Roger Quadros rog...@ti.com [140303 07:10]: Move omap-control binding information to the right location. Signed-off-by: Roger Quadros rog...@ti.com --- Documentation/devicetree/bindings/phy/ti-phy.txt | 25 ++ Documentation/devicetree/bindings/usb/omap-usb.txt | 24 - 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt index 207e14c..41dc132 100644 --- a/Documentation/devicetree/bindings/phy/ti-phy.txt +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt @@ -1,5 +1,30 @@ TI PHY: DT DOCUMENTATION FOR PHYs in TI PLATFORMs +OMAP CONTROL PHY + +Required properties: + - compatible: Should be one of + ti,control-phy-otghs - if it has otghs_control mailbox register as on OMAP4. + ti,control-phy-usb2 - if it has Power down bit in control_dev_conf register +e.g. USB2_PHY on OMAP5. + ti,control-phy-pipe3 - if it has DPLL and individual Rx Tx power control +e.g. USB3 PHY and SATA PHY on OMAP5. + ti,control-phy-dra7usb2 - if it has power down register like USB2 PHY on +DRA7 platform. + ti,control-phy-am437usb2 - if it has power down register like USB2 PHY on +AM437 platform. To me it seems that you can leave out all the above. You can set these falgs flags directly in the driver based on the compatible flag. Then just initialize the .data in the driver based on the compatible flag. + - reg : Address and length of the register set for the device. It contains + the address of otghs_control for control-phy-otghs or power register + for other types. + - reg-names: should be otghs_control control-phy-otghs and power for + other types. + +omap_control_usb: omap-control-usb@4a002300 { +compatible = ti,control-phy-otghs; +reg = 0x4a00233c 0x4; +reg-names = otghs_control; +}; Then you would instead have something like this: compatible = ti,am347-control-phy-otghs; That way you can initialize things without a need for custom bindings. Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 part1 1/8] usb: disable port power control if not supported in wHubCharacteristics
On Fri, 28 Feb 2014, Dan Williams wrote: A hub indicates whether it supports per-port power control via the wHubCharacteristics field in its descriptor. If it is not supported a hub will still emulate ClearPortPower(PORT_POWER) requests by stopping the link state machine. However, since this does not save power do not bother suspending. This also consolidates support checks into a hub_is_port_power_switchable() helper. Signed-off-by: Dan Williams dan.j.willi...@intel.com This patch looks pretty good. I would change only a comment: --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -171,12 +171,14 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) pm_runtime_set_active(port_dev-dev); - /* It would be dangerous if user space couldn't - * prevent usb device from being powered off. So don't - * enable port runtime pm if failed to expose port's pm qos. + /* It would be dangerous if user space couldn't prevent usb The comment style should be fixed: /* * It would... + * device from being powered off. So don't enable port runtime + * pm if failed to expose port's pm qos, or if the hub does not + * support power switching if failed lacks a subject. And the final sentence lacks a period. */ - if (!dev_pm_qos_expose_flags(port_dev-dev, - PM_QOS_FLAG_NO_POWER_OFF)) + if (hub_is_port_power_switchable(hub) + dev_pm_qos_expose_flags(port_dev-dev, + PM_QOS_FLAG_NO_POWER_OFF) == 0) pm_runtime_enable(port_dev-dev); The order of the tests described in the comment should match the order of the tests in the code. Aside from these things, Acked-by: Alan Stern st...@rowland.harvard.edu Alan Stern -- 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 RESEND] SCSI: sd: don't fail if the device doesn't recognize SYNCHRONIZE CACHE
From: Alan Stern st...@rowland.harvard.edu Evidently some wacky USB-ATA bridges don't recognize the SYNCHRONIZE CACHE command, as shown in this email thread: http://marc.info/?t=13897835622r=1w=2 The fact that we can't tell them to drain their caches shouldn't prevent the system from going into suspend. Therefore sd_sync_cache() shouldn't return an error if the device replies with an Invalid Command ASC. Signed-off-by: Alan Stern st...@rowland.harvard.edu Reported-by: Sven Neumann s.neum...@raumfeld.com Tested-by: Daniel Mack zon...@gmail.com CC: Oliver Neukum oli...@neukum.org CC: sta...@vger.kernel.org --- Hi, this patch has been around for awhile, but hasn't gained much attraction, and hasn't been merged anywhere yet. Which is sad, as it fixes a bug on real hardware when going to suspend :) Could anyone from the SCSI people have a quick look maybe? Thanks, Daniel drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 470954a..36d1a23 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1463,8 +1463,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp) sd_print_sense_hdr(sdkp, sshdr); /* we need to evaluate the error return */ if (scsi_sense_valid(sshdr) - /* 0x3a is medium not present */ - sshdr.asc == 0x3a) + (sshdr.asc == 0x3a || /* medium not present */ +sshdr.asc == 0x20))/* invalid command */ /* this is no error here */ return 0; -- 1.8.5.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 v6 part1 2/8] usb: rename usb_port device objects
On Fri, 28 Feb 2014, Dan Williams wrote: The current port name portX is ambiguous. Before adding more port messages rename ports to hub-device-name-portX This is an ABI change, but the suspicion is that it will go unnoticed as the port power control implementation has been broken since its introduction. If however, someone was relying on the old name we can add sysfs links from the old name to the new name. Additionally, it unifies/simplifies port dev_printk messages and modifies instances of: dev_XXX(hub-intfdev, ...port %d... dev_XXX(hdev-dev, ...port%d... into: dev_XXX(port_dev-dev, ... Now that the names are unique usb_port devices it would be nice if they could be included in /sys/bus/usb. However, it turns out that this breaks 'lsusb -t'. For now, create a dummy port driver so that print messages are prefixed usb 1-1-port3 rather than the subsystem-ambiguous 1-1-port3. Finally, it corrects an odd usage of sscanf(port%d) in usb-acpi.c. Suggested-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Dan Williams dan.j.willi...@intel.com This looks all right. diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4e967f613e70..6014a790441f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -408,26 +408,25 @@ static int set_port_feature(struct usb_device *hdev, int port1, int feature) * USB 2.0 spec Section 11.24.2.7.1.10 and table 11-7 * for info about using port indicators */ -static void set_port_led( - struct usb_hub *hub, - int port1, - int selector -) +static void set_port_led(struct usb_hub *hub, int port1, int selector) { - int status = set_port_feature(hub-hdev, (selector 8) | port1, + struct usb_port *port_dev = hub-ports[port1 - 1]; + int status; + char *led; + + status = set_port_feature(hub-hdev, (selector 8) | port1, USB_PORT_FEAT_INDICATOR); - if (status 0) - dev_dbg (hub-intfdev, - port %d indicator %s status %d\n, - port1, - ({ char *s; switch (selector) { - case HUB_LED_AMBER: s = amber; break; - case HUB_LED_GREEN: s = green; break; - case HUB_LED_OFF: s = off; break; - case HUB_LED_AUTO: s = auto; break; - default: s = ??; break; - } s; }), - status); + if (selector == HUB_LED_AMBER) + led = amber; + else if (selector == HUB_LED_GREEN) + led = green; + else if (selector == HUB_LED_OFF) + led = off; + else if (selector == HUB_LED_AUTO) + led = auto; + else + led = ??; This ought to be a switch statement. Otherwise, Acked-by: Alan Stern st...@rowland.harvard.edu Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 part1 3/8] usb: cleanup setting udev-removable from port_dev-connect_type
On Fri, 28 Feb 2014, Dan Williams wrote: Once usb-acpi has set the port's connect type the usb_device's -removable attribute can be set in the standard location set_usb_port_removable(). This also changes behavior in the case where the firmware says that the port connect type is unknown. In that case just use the default setting determined from the hub descriptor. Suggested-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Dan Williams dan.j.willi...@intel.com Good clean-up. @@ -155,36 +156,15 @@ static struct acpi_device *usb_acpi_find_companion(struct device *dev) */ if (is_usb_device(dev)) { udev = to_usb_device(dev); - port1 = udev-portnum; - if (udev-parent) { - struct usb_hub *hub; - - hub = usb_hub_to_struct_hub(udev-parent); - /* - * According usb port's connect type to set usb device's - * removability. - */ - switch (hub-ports[port1 - 1]-connect_type) { - case USB_PORT_CONNECT_TYPE_HOT_PLUG: - udev-removable = USB_DEVICE_REMOVABLE; - break; - case USB_PORT_CONNECT_TYPE_HARD_WIRED: - udev-removable = USB_DEVICE_FIXED; - break; - default: - udev-removable = USB_DEVICE_REMOVABLE_UNKNOWN; - break; - } - + if (udev-parent) return NULL; - } /* root hub's parent is the usb hcd. */ - return acpi_find_child_device(ACPI_COMPANION(dev-parent), - port1, false); + port1 = udev-portnum; + adev = ACPI_COMPANION(dev-parent); + return acpi_find_child_device(adev, port1, false); Does this entirely make sense? As far as I can see, port1 is never going to be anything other than 0. After all, root hubs don't have upstream ports. I don't know what ACPI expects to see here. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 part1 1/8] usb: disable port power control if not supported in wHubCharacteristics
On Mon, 2014-03-03 at 16:18 -0500, Alan Stern wrote: On Fri, 28 Feb 2014, Dan Williams wrote: A hub indicates whether it supports per-port power control via the wHubCharacteristics field in its descriptor. If it is not supported a hub will still emulate ClearPortPower(PORT_POWER) requests by stopping the link state machine. However, since this does not save power do not bother suspending. This also consolidates support checks into a hub_is_port_power_switchable() helper. Signed-off-by: Dan Williams dan.j.willi...@intel.com This patch looks pretty good. I would change only a comment: --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -171,12 +171,14 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) pm_runtime_set_active(port_dev-dev); - /* It would be dangerous if user space couldn't -* prevent usb device from being powered off. So don't -* enable port runtime pm if failed to expose port's pm qos. + /* It would be dangerous if user space couldn't prevent usb The comment style should be fixed: /* * It would... +* device from being powered off. So don't enable port runtime +* pm if failed to expose port's pm qos, or if the hub does not +* support power switching if failed lacks a subject. And the final sentence lacks a period. */ - if (!dev_pm_qos_expose_flags(port_dev-dev, - PM_QOS_FLAG_NO_POWER_OFF)) + if (hub_is_port_power_switchable(hub) +dev_pm_qos_expose_flags(port_dev-dev, + PM_QOS_FLAG_NO_POWER_OFF) == 0) pm_runtime_enable(port_dev-dev); The order of the tests described in the comment should match the order of the tests in the code. Yeah, I just tacked on to the existing comment. Rewritten properly now. Aside from these things, Acked-by: Alan Stern st...@rowland.harvard.edu Thanks. 8-- Subject: usb: disable port power control if not supported in wHubCharacteristics From: Dan Williams dan.j.willi...@intel.com A hub indicates whether it supports per-port power control via the wHubCharacteristics field in its descriptor. If it is not supported a hub will still emulate ClearPortPower(PORT_POWER) requests by stopping the link state machine. However, since this does not save power do not bother suspending. This also consolidates support checks into a hub_is_port_power_switchable() helper. Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Dan Williams dan.j.willi...@intel.com --- drivers/usb/core/hub.c |8 ++-- drivers/usb/core/hub.h | 10 ++ drivers/usb/core/port.c | 13 - 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 519f2c3594b2..4e967f613e70 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -810,8 +810,6 @@ static unsigned hub_power_on(struct usb_hub *hub, bool do_delay) int port1; unsigned pgood_delay = hub-descriptor-bPwrOn2PwrGood * 2; unsigned delay; - u16 wHubCharacteristics = - le16_to_cpu(hub-descriptor-wHubCharacteristics); /* Enable power on each port. Some hubs have reserved values * of LPSM ( 2) in their descriptors, even though they are @@ -819,7 +817,7 @@ static unsigned hub_power_on(struct usb_hub *hub, bool do_delay) * but only emulate it. In all cases, the ports won't work * unless we send these messages to the hub. */ - if ((wHubCharacteristics HUB_CHAR_LPSM) 2) + if (hub_is_port_power_switchable(hub)) dev_dbg(hub-intfdev, enabling power on all ports\n); else dev_dbg(hub-intfdev, trying to enable port power on @@ -4383,8 +4381,6 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, struct usb_device *hdev = hub-hdev; struct device *hub_dev = hub-intfdev; struct usb_hcd *hcd = bus_to_hcd(hdev-bus); - unsigned wHubCharacteristics = - le16_to_cpu(hub-descriptor-wHubCharacteristics); struct usb_device *udev; int status, i; unsigned unit_load; @@ -4469,7 +4465,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, test_bit(port1, hub-removed_bits)) { /* maybe switch power back on (e.g. root hub was reset) */ - if ((wHubCharacteristics HUB_CHAR_LPSM) 2 + if (hub_is_port_power_switchable(hub) !port_is_power_on(hub, portstatus)) set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index df629a310e44..baf5b48b79f7 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -111,6 +111,16 @@ extern int hub_port_debounce(struct usb_hub
Re: MAX3421E Linux driver?
On 03/01/2014 07:53 AM, David Mosberger wrote: Attached is v0.1 of the max3421 driver. This one actually is trying to do (mostly) the right things. It's event-driven (no busy-waiting anymore). The URB-scheduling implemented in max3421_next_ep() is still simplistic: it runs all periodic transfers, then runs non-periodic transfers until there is no more (useful) work to do or the next frame starts. With this version of the driver: 1. A USB-keyboard seems to work reliably (as per evtest anyhow). 2. Several USB mass-storage devices get recognized correctly. There are still some issues with reliably writing data, though. 3. Some WIFI dongles are starting to work. I'd be very interested in getting feedback on this driver as this is the first time I tried my hands at a USB host-controller driver. Without going too much into detail wrt the actual implementation, here are two things that caught my eye: 1. Your patch has a large number of style issues, which scripts/checkpatch.pl will tell you more about. 2. Is there any good reason for not using the regmap abstraction framework for the SPI layer? It has convenience functions for bit fiddling, a register cache and a nice debugging interface through debugfs, among other things. See include/linux/regmap.h. Also, out of curiosity: which SPI master controller are you using in your setup? Is the whole thing actually fast enough for real-world applications? Which data rates are you able to get through on mass-storage devices for instance? Thanks, Daniel -- 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: v3.14-rc2+ WARNING: CPU: 0 PID: 24108 at fs/sysfs/group.c:216 sysfs_remove_group+0xa3/0xb0()
On Mon, 17 Feb 2014, James Bottomley wrote: You can tell by the way the stack trace doesn't mention USB at all. In fact, this is a known SCSI problem. It has been fixed by these two patches: http://marc.info/?l=linux-scsim=139031645920152w=2 http://marc.info/?l=linux-scsim=139031650720168w=2 If these patches have appeared in any git repositories yet, I don't know where. James, what happened to those two target-reap-infrastructure patches? They don't seem to have reached linux-next yet, and I can't find them in your SCSI repository on git.kernel.org. Yes, I'm just about to build it. I usually start at -rc1, but got a little behind because of pressure of work. I need them to go through a full regression cycle just to make sure there aren't any new bugs, but then they'll get backported to the stable kernels. James, these two patches appear still not to be merged in any of your branches on git.kernel.org. Will they get there in time for the next merge window? Alan Stern -- 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: 3.13-rc1 regression: Scatter-gather list issues at SuperSpeed only
Greg, Dave, Freddy, question about cross-subsystem reverts below: On Fri, Feb 28, 2014 at 04:15:12PM -0500, Alan Stern wrote: On Fri, 28 Feb 2014, Sarah Sharp wrote: When testing 3.14-rc1 with a USB 3.0 Lexar flash drive, the drive fails to be mounted. I added a bit of debugging to the USB core: That revealed the SCSI request fails because the USB core is rejecting a scatter-gather list with an entry that isn't aligned to the max packet size: Feb 28 09:45:30 xanatos kernel: [ 376.449316] usb 2-2: URB sg entry 0 of 17, size 1536 not a multiple of ep1in max packet 1024 Notice the request length: 1536. That's three 512-byte sectors. A little unusual, since most I/O is done in units of pages, which are 4096 bytes. It's failing because of commit 247bf557273d xhci 1.0: Limit arbitrarily-aligned scatter gather. That commit clears the hcd-self.no_sg_constraint flag if the host is a 1.0 host (which my Panther Point host is). It was put in to avoid TD fragment issues on 1.0 hosts with ethernet devices. (Note, this also means that David Laight's potential work-around patch [1] wouldn't help if arbitrary-length scatter gather bigger than a ring segment was submitted.) The behavior for reproducing this is odd. I can only reproduce this on my Ubuntu 13.10 laptop with Intel Panther Point xHCI, when the device is running at SuperSpeed. If I plug the device into an EHCI port, or behind a USB 2.0 hub plugged into an xHCI port, I never see these arbitrary-length scatter-gather list entries. Dan can't reproduce this on his Intel Haswell machine running Fedora at all. Some of this behavior is to be expected. 1536 isn't a multiple of 1024 (the maxpacket size when running at SuperSpeed), but it _is_ a multiple of 512 (the maxpacket size when running at high speed). Therefore the failure won't occur when the drive is attached to an EHCI controller or is behind a USB-2 hub. Ah, that makes sense now. Does the same thing happen if you prevent the system from automatically trying to mount the volume? If the system doesn't automatically mount the volume, the error doesn't occur. If we can't figure out how to get max-packet sized scatter-gather list entries from the mass storage driver, Mathias is going to need to: The SG entries don't come from usb-storage; they come from the block layer. As far as I know, there is no way to tell the block layer that each element in an SG list (except the last) must be a multiple of some specific size. revert commit 3804fad45411 USBNET: ax88179_178a: enable tso if usb host supports sg dma revert commit 247bf557273d xhci 1.0: Limit arbitrarily-aligned scatter gather. And we'll need to focus on getting the TD fragments supported in 3.16. So far we've gotten away with this at high speed or below, because no USB mass-storage devices have a block size smaller than 512 (at least, none that I've ever heard of). But when the maxpacket size is 1024, a request for an odd number of blocks can cause trouble. Ok, we can't have SuperSpeed mass storage devices broken, so it looks like we'll have to revert the last patch to add scatter-gather to the ASIX driver to avoid that breakage. That means Mathias is going to need to revert those two commits then, since he's taking over pushing xHCI driver bug fixes this kernel. Greg, Dave, Freddy, how do you want to handle reverting commit 3804fad45411? Should that come through Dave's networking tree or Greg's USB tree? Sarah Sharp -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 part1 2/8] usb: rename usb_port device objects
On Mon, 2014-03-03 at 16:31 -0500, Alan Stern wrote: On Fri, 28 Feb 2014, Dan Williams wrote: The current port name portX is ambiguous. Before adding more port messages rename ports to hub-device-name-portX This is an ABI change, but the suspicion is that it will go unnoticed as the port power control implementation has been broken since its introduction. If however, someone was relying on the old name we can add sysfs links from the old name to the new name. Additionally, it unifies/simplifies port dev_printk messages and modifies instances of: dev_XXX(hub-intfdev, ...port %d... dev_XXX(hdev-dev, ...port%d... into: dev_XXX(port_dev-dev, ... Now that the names are unique usb_port devices it would be nice if they could be included in /sys/bus/usb. However, it turns out that this breaks 'lsusb -t'. For now, create a dummy port driver so that print messages are prefixed usb 1-1-port3 rather than the subsystem-ambiguous 1-1-port3. Finally, it corrects an odd usage of sscanf(port%d) in usb-acpi.c. Suggested-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Dan Williams dan.j.willi...@intel.com This looks all right. diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4e967f613e70..6014a790441f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -408,26 +408,25 @@ static int set_port_feature(struct usb_device *hdev, int port1, int feature) * USB 2.0 spec Section 11.24.2.7.1.10 and table 11-7 * for info about using port indicators */ -static void set_port_led( - struct usb_hub *hub, - int port1, - int selector -) +static void set_port_led(struct usb_hub *hub, int port1, int selector) { - int status = set_port_feature(hub-hdev, (selector 8) | port1, + struct usb_port *port_dev = hub-ports[port1 - 1]; + int status; + char *led; + + status = set_port_feature(hub-hdev, (selector 8) | port1, USB_PORT_FEAT_INDICATOR); - if (status 0) - dev_dbg (hub-intfdev, - port %d indicator %s status %d\n, - port1, - ({ char *s; switch (selector) { - case HUB_LED_AMBER: s = amber; break; - case HUB_LED_GREEN: s = green; break; - case HUB_LED_OFF: s = off; break; - case HUB_LED_AUTO: s = auto; break; - default: s = ??; break; - } s; }), - status); + if (selector == HUB_LED_AMBER) + led = amber; + else if (selector == HUB_LED_GREEN) + led = green; + else if (selector == HUB_LED_OFF) + led = off; + else if (selector == HUB_LED_AUTO) + led = auto; + else + led = ??; This ought to be a switch statement. Otherwise, It's more lines with breaks, but I went ahead and made a proper to_led_name() helper with a switch statement. 8--- Subject: usb: rename usb_port device objects From: Dan Williams dan.j.willi...@intel.com The current port name portX is ambiguous. Before adding more port messages rename ports to hub-device-name-portX This is an ABI change, but the suspicion is that it will go unnoticed as the port power control implementation has been broken since its introduction. If however, someone was relying on the old name we can add sysfs links from the old name to the new name. Additionally, it unifies/simplifies port dev_printk messages and modifies instances of: dev_XXX(hub-intfdev, ...port %d... dev_XXX(hdev-dev, ...port%d... into: dev_XXX(port_dev-dev, ... Now that the names are unique usb_port devices it would be nice if they could be included in /sys/bus/usb. However, it turns out that this breaks 'lsusb -t'. For now, create a dummy port driver so that print messages are prefixed usb 1-1-port3 rather than the subsystem-ambiguous 1-1-port3. Finally, it corrects an odd usage of sscanf(port%d) in usb-acpi.c. Suggested-by: Alan Stern st...@rowland.harvard.edu Acked-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Dan Williams dan.j.willi...@intel.com --- drivers/usb/core/hub.c | 274 ++- drivers/usb/core/port.c | 10 +- drivers/usb/core/usb-acpi.c | 60 + drivers/usb/core/usb.h |4 - 4 files changed, 159 insertions(+), 189 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4e967f613e70..71e1a0a9f222 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -404,30 +404,35 @@ static int set_port_feature(struct usb_device *hdev, int port1, int feature) NULL, 0, 1000); } +static char *to_led_name(int selector) +{ + switch (selector) { + case HUB_LED_AMBER: + return amber; + case HUB_LED_GREEN: + return green; +
xhci-errors in combination with dm-crypt
Hello everyone, I'd like to encrypt my external HDD using dm-crypt (luks) via USB 3.0. The crypto-container creation works, but writing to it doesn't: kernel: usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5c80kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5cc0kernel: usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5c80kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5cc0kernel: usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5c80kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5cc0kernel: usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5c80kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5cc0kernel: xhci_hcd :00:14.0: Timeout while waiting for address device command kernel: xhci_hcd :00:14.0: Timeout while waiting for address device command kernel: usb 4-2: device not accepting address 2, error -62 kernel: usb 4-2: USB disconnect, device number 2 kernel: scsi 12:0:0:0: rejecting I/O to offline device kernel: scsi 12:0:0:0: [sdc] killing request kernel: scsi 12:0:0:0: [sdc] Unhandled error code kernel: scsi 12:0:0:0: [sdc] kernel: Result: hostbyte=0x01 driverbyte=0x00 kernel: scsi 12:0:0:0: [sdc] CDB: kernel: cdb[0]=0x2a: 2a 00 00 00 10 41 00 00 12 00 kernel: end_request: I/O error, dev sdc, sector 4161 kernel: quiet_error: 1601 callbacks suppressed kernel: Buffer I/O error on device dm-5, logical block 2 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 3 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 4 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 5 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 6 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 7 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 8 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 9 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 10 kernel: lost page write due to I/O error on dm-5 kernel: Buffer I/O error on device dm-5, logical block 11 kernel: lost page write due to I/O error on dm-5 kernel: scsi 12:0:0:0: rejecting I/O to offline device kernel: scsi 12:0:0:0: [sdc] killing request kernel: scsi 12:0:0:0: [sdc] Unhandled error code kernel: scsi 12:0:0:0: [sdc] kernel: Result: hostbyte=0x01 driverbyte=0x00 kernel: scsi 12:0:0:0: [sdc] CDB: kernel: cdb[0]=0x2a: 2a 00 00 00 10 53 00 00 18 00 kernel: end_request: I/O error, dev sdc, sector 4179 kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5c80 kernel: xhci_hcd :00:14.0: xHCI xhci_drop_endpoint called with disabled ep 8800c37e5cc0 USB 2.0 (ehci-pci) works fine (direct, filesystem, crypto). With USB 3.0, both direct access using 'dd' and filesystem access is possible. Only direct access to the cryptdevice fails (including 'mkfs.ext4'). If I create a filesystem on the crypto device via USB 2.0, I can access it via USB 3.0 as well. % uname -r 3.13.5-1 (also tested on 3.14rc4) % lspci -nn | grep USB 00:14.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller [8086:1e31] (rev 04) 00:1a.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 [8086:1e2d] (rev 04) 00:1d.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 [8086:1e26] (rev 04) % sudo lsusb -v -d 4971:1014 Bus 004 Device 003: ID 4971:1014 SimpleTech Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 3.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 9 idVendor 0x4971 SimpleTech idProduct 0x1014 bcdDevice0.00 iManufacturer 10 HGST iProduct 11 Touro Mobile 3.0 iSerial 3 21001311250002300511 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType
Re: [PATCH v6 part1 4/8] usb: assign default peer ports for root hubs
On Fri, 28 Feb 2014, Dan Williams wrote: Assume that the peer of a superspeed port is the port with the same id on the shared_hcd root hub. This identification scheme is required of external hubs by the USB3 spec [1]. However, for root hubs, tier mismatch may be in effect [2]. Tier mismatch can only be enumerated via platform firmware. For now, simply perform the nominal association. Once the root hub is marked as unregistered we block attempts to walk the -shared_hcd pointer to find a root-peer port. [1]: usb 3.1 section 10.3.3 [2]: xhci 1.1 appendix D Signed-off-by: Dan Williams dan.j.willi...@intel.com Okay, I think the locking still isn't right. Below is an example patch showing how it ought to work. Basically, all the locking can be done in hub.c; port.c doesn't have to worry about it at all. diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2518c3250750..e380b8a80830 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2778,9 +2778,17 @@ void usb_remove_hcd(struct usb_hcd *hcd) hcd-state = HC_STATE_QUIESCING; dev_dbg(hcd-self.controller, roothub graceful disconnect\n); + + /* + * Flush + disable peering operations, and atomically update the + * hcd state relative to other root hub state + * changes/evaluations + */ + mutex_lock(usb_port_peer_mutex); spin_lock_irq (hcd_root_hub_lock); hcd-rh_registered = 0; spin_unlock_irq (hcd_root_hub_lock); + mutex_unlock(usb_port_peer_mutex); Not needed. We don't care whether the root hub device is registered; we only care whether it qualifies as a hub according to the tests in usb_hub_to_struct_hub. @@ -171,7 +235,15 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) port_dev-dev.driver = usb_port_driver; dev_set_name(port_dev-dev, %s-port%d, dev_name(hub-hdev-dev), port1); + + mutex_lock(usb_port_peer_mutex); + hub-ports[port1 - 1] = port_dev; retval = device_register(port_dev-dev); + if (retval == 0) + peer = find_default_peer(hub, port1); + if (peer) + link_peers(port_dev, peer); + mutex_unlock(usb_port_peer_mutex); if (retval) goto error_register; The mutex stuff won't be needed here. The other changes are good. @@ -196,9 +268,15 @@ exit: return retval; } -void usb_hub_remove_port_device(struct usb_hub *hub, -int port1) +void usb_hub_remove_port_device(struct usb_hub *hub, int port1) { - device_unregister(hub-ports[port1 - 1]-dev); + struct usb_port *port_dev = hub-ports[port1 - 1]; + struct usb_port *peer; + + mutex_lock(usb_port_peer_mutex); + peer = port_dev-peer; + if (peer) + unlink_peers(port_dev, peer); + device_unregister(port_dev-dev); + mutex_unlock(usb_port_peer_mutex); } Likewise here. This is how I think the locking should work. I haven't carefully thought through all the possibilities, so please double-check that this really will do what we want. Alan Stern Index: usb-3.14/drivers/usb/core/hub.c === --- usb-3.14.orig/drivers/usb/core/hub.c +++ usb-3.14/drivers/usb/core/hub.c @@ -55,6 +55,9 @@ static DECLARE_WAIT_QUEUE_HEAD(khubd_wai static struct task_struct *khubd_task; +/* synchronize hub-port add/remove and peering operations */ +static DEFINE_MUTEX(usb_port_peer_mutex); + /* cycle leds on hubs that aren't blinking for attention */ static bool blinkenlights = 0; module_param (blinkenlights, bool, S_IRUGO); @@ -1300,6 +1303,7 @@ static int hub_configure(struct usb_hub char *message = out of memory; unsigned unit_load; unsigned full_load; + unsigned maxchild; hub-buffer = kmalloc(sizeof(*hub-buffer), GFP_KERNEL); if (!hub-buffer) { @@ -1338,12 +1342,11 @@ static int hub_configure(struct usb_hub goto fail; } - hdev-maxchild = hub-descriptor-bNbrPorts; - dev_info (hub_dev, %d port%s detected\n, hdev-maxchild, - (hdev-maxchild == 1) ? : s); + maxchild = hub-descriptor-bNbrPorts; + dev_info (hub_dev, %d port%s detected\n, maxchild, + (maxchild == 1) ? : s); - hub-ports = kzalloc(hdev-maxchild * sizeof(struct usb_port *), -GFP_KERNEL); + hub-ports = kzalloc(maxchild * sizeof(struct usb_port *), GFP_KERNEL); if (!hub-ports) { ret = -ENOMEM; goto fail; @@ -1364,11 +1367,11 @@ static int hub_configure(struct usb_hub int i; charportstr[USB_MAXCHILDREN + 1]; - for (i = 0; i hdev-maxchild; i++) + for (i = 0; i maxchild; i++) portstr[i] = hub-descriptor-u.hs.DeviceRemovable
[PATCH] usb: dwc2: Add function to calculate correct FIFO sizes
From: Dinh Nguyen dingu...@altera.com The dwc2 IP on the SOCFPGA cannot use the default HW configured FIFO sizes. The total FIFO depth as read from GHWCFG3 reports 0x1f80 or 8064 32-bit words. But the GRXFSIZ, GNPTXFSIZ, and HPTXFSIZ register defaults to 0x2000 or 8192 32-bit words. So the driver cannot just use the fifo sizes as read from those registers. For platforms that face the same issue, this commits sets the RX, periodic TX, and non-periodic TX fifo size to those that are recommended v2.93a spec for the DWC2 IP. Signed-off-by: Dinh Nguyen dingu...@altera.com Cc: Paul Zimmerman pa...@synopsys.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/usb/dwc2/core.c | 41 + 1 file changed, 41 insertions(+) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 1d12988..e8e394c 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -507,6 +507,44 @@ void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg) writel(intmsk, hsotg-regs + GINTMSK); } +/* + * dwc2_calculate_dynamic_fifo() - Calculates the default fifo size + * For system that have a total fifo depth that is smaller than the default + * RX + TX fifo size. + * + * @hsotg: Programming view of DWC_otg controller + */ +static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg) +{ + struct dwc2_core_params *params = hsotg-core_params; + struct dwc2_hw_params *hw = hsotg-hw_params; + u32 rxfsiz, nptxfsiz, ptxfsiz, total_fifo_size; + + total_fifo_size = hw-total_fifo_size; + rxfsiz = params-host_rx_fifo_size; + nptxfsiz = params-host_nperio_tx_fifo_size; + ptxfsiz = params-host_perio_tx_fifo_size; + + if (total_fifo_size = (rxfsiz + nptxfsiz + ptxfsiz)) + /* Params are valid, nothing to do */ + return; + else { + /* min rx fifo size = ((largest packet/4)*2)+2 */ + rxfsiz = (512/4) * 2 + 2; + /* min non-periodic tx fifo depth */ + nptxfsiz = 2 * (512/4); + /* min periodic tx fifo depth */ + ptxfsiz = (512 * 3)/4; + } + + if (total_fifo_size (rxfsiz + nptxfsiz + ptxfsiz)) + dev_err(hsotg-dev, invalid fifo sizes\n); + + params-host_rx_fifo_size = rxfsiz; + params-host_nperio_tx_fifo_size = nptxfsiz; + params-host_perio_tx_fifo_size = ptxfsiz; +} + static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) { struct dwc2_core_params *params = hsotg-core_params; @@ -515,6 +553,9 @@ static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) if (!params-enable_dynamic_fifo) return; + /* Calculate the correct FIFO sizes */ + dwc2_calculate_dynamic_fifo(hsotg); + /* Rx FIFO */ grxfsiz = readl(hsotg-regs + GRXFSIZ); dev_dbg(hsotg-dev, initial grxfsiz=%08x\n, grxfsiz); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: xhci-errors in combination with dm-crypt
On 03.03.2014 22:55, Merlin Chlosta wrote: % uname -r 3.13.5-1 (also tested on 3.14rc4) It works on 3.10.30-1-lts, I forgot to mention that. -- 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: gadget: add temporary __uses_feature_flags
On Mon, Mar 03, 2014 at 02:46:32PM -0800, Greg KH wrote: On Mon, Mar 03, 2014 at 11:04:02AM -0600, Felipe Balbi wrote: during the conversion to a new method of finding proper endpoints, we need to give our users a grace period until full conversion is finished. Who are these users? kernel developers? Or end-users? kernel developers. This patch adds a new internal and temporary __uses_feature_flags flag which will tell gadget framework that this UDC has been converted to the new feature flag-based endpoint scheme. Once all gadget drivers are converted, this flag will be removed. Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/gadget.c | 1 + drivers/usb/gadget/epautoconf.c | 48 + drivers/usb/gadget/s3c-hsotg.c | 1 + include/linux/usb/gadget.h | 2 ++ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index eaf8537..54b40ce 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2733,6 +2733,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc-gadget.speed = USB_SPEED_UNKNOWN; dwc-gadget.sg_supported= true; dwc-gadget.name= dwc3-gadget; + dwc-gadget.__uses_feature_flags = true; I don't really understand what this is doing for anyone. Can't we just fix up all in-kernel users of the flags properly? I can try to do that, yes, but for v3.15 might be quite a bit of work. Anyway, I guess we still have a few days left. cheers -- balbi signature.asc Description: Digital signature
[PATCHv2 2/3] usb: s3c-hsotg: Move s3c-hsotg into dwc2 folder
From: Dinh Nguyen dingu...@altera.com Moves the s3c-hsotg driver into the dwc2 folder and use the dwc2 defines in hw.h. The s3c-hostg driver will now be built with a kconfig option under the dwc2 kconfig. USB_DWC2_HOST and USB_S3C_HSOTG are mutually exclusive build options. Signed-off-by: Dinh Nguyen dingu...@altera.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Paul Zimmerman pa...@synopsys.com Cc: Felipe Balbi ba...@ti.com Cc: Ben Dooks ben-li...@fluff.org Cc: Matt Porter mpor...@linaro.org Cc: Kukjin Kim kgene@samsung.com Cc: Stephen Warren swar...@wwwdotorg.org Cc: Matthijs Kooijman matth...@stdin.nl Cc: Jingoo Han jg1@samsung.com Cc: Sachin Kamat sachin.ka...@linaro.org Cc: Robert Baldyga r.bald...@samsung.com --- v2: - Fix whitespace damage - Redo s3c_hsotg_handle_rx() to use dwc2 definitions - Use FIFOSIZE_DEPTH_GET --- drivers/usb/dwc2/Kconfig | 15 ++ drivers/usb/dwc2/Makefile| 15 +- drivers/usb/{gadget = dwc2}/s3c-hsotg.c | 415 +++--- drivers/usb/gadget/Kconfig |7 - drivers/usb/gadget/Makefile |1 - drivers/usb/gadget/s3c-hsotg.h | 378 --- 6 files changed, 231 insertions(+), 600 deletions(-) rename drivers/usb/{gadget = dwc2}/s3c-hsotg.c (91%) delete mode 100644 drivers/usb/gadget/s3c-hsotg.h diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig index be947d6..ce14859 100644 --- a/drivers/usb/dwc2/Kconfig +++ b/drivers/usb/dwc2/Kconfig @@ -20,6 +20,21 @@ config USB_DWC2 if USB_DWC2 +config USB_DWC2_HOST + bool Host only mode + depends on USB=y || USB=USB_DWC2 + default y + help + Select this when you want to use DWC2 in host mode only, + thereby the gadget feature will be regressed. + +config USB_S3C_HSOTG + depends on (ARM || USB_GADGET=y) !USB_DWC2_HOST + tristate Designware/S3C HS/OtG USB Device controller + help + The Designware USB2.0 high-speed gadget controller + integrated into many SoCs. + config USB_DWC2_DEBUG bool Enable Debugging Messages help diff --git a/drivers/usb/dwc2/Makefile b/drivers/usb/dwc2/Makefile index 11529d3..2778e16 100644 --- a/drivers/usb/dwc2/Makefile +++ b/drivers/usb/dwc2/Makefile @@ -1,9 +1,15 @@ ccflags-$(CONFIG_USB_DWC2_DEBUG) += -DDEBUG ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG +ifeq ($(CONFIG_USB_DWC2_HOST),y) obj-$(CONFIG_USB_DWC2) += dwc2.o - dwc2-y += core.o core_intr.o +dwc2-y += hcd.o hcd_intr.o +dwc2-y += hcd_queue.o hcd_ddma.o +endif +obj-$(CONFIG_USB_S3C_HSOTG)+= s3c_hsotg.o +s3c_hsotg-y+= s3c-hsotg.o + # NOTE: This driver at present only implements the Host mode # of the controller. The existing s3c-hsotg driver supports @@ -13,13 +19,12 @@ dwc2-y += core.o core_intr.o # that is done, Host mode will become an optional feature that # is selected with a config option. -dwc2-y += hcd.o hcd_intr.o -dwc2-y += hcd_queue.o hcd_ddma.o - ifneq ($(CONFIG_PCI),) obj-$(CONFIG_USB_DWC2) += dwc2_pci.o endif -obj-$(CONFIG_USB_DWC2) += dwc2_platform.o +ifneq ($(CONFIG_USB_DWC2_HOST),) + obj-$(CONFIG_USB_DWC2) += dwc2_platform.o +endif dwc2_pci-y += pci.o dwc2_platform-y+= platform.o diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/dwc2/s3c-hsotg.c similarity index 91% rename from drivers/usb/gadget/s3c-hsotg.c rename to drivers/usb/dwc2/s3c-hsotg.c index 1172eae..9bb1ed7 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/dwc2/s3c-hsotg.c @@ -37,7 +37,7 @@ #include linux/usb/phy.h #include linux/platform_data/s3c-hsotg.h -#include s3c-hsotg.h +#include hw.h static const char * const s3c_hsotg_supply_names[] = { vusb_d, /* digital USB supply, 1.2V */ @@ -340,9 +340,8 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) /* set FIFO sizes to 2048/1024 */ writel(2048, hsotg-regs + GRXFSIZ); - writel(GNPTXFSIZ_NPTxFStAddr(2048) | - GNPTXFSIZ_NPTxFDep(1024), - hsotg-regs + GNPTXFSIZ); + writel((2048 FIFOSIZE_STARTADDR_SHIFT) | + (1024 FIFOSIZE_DEPTH_SHIFT), hsotg-regs + GNPTXFSIZ); /* * arange all the rest of the TX FIFOs, as some versions of this @@ -362,10 +361,10 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) for (ep = 1; ep = 15; ep++) { val = addr; - val |= size DPTXFSIZn_DPTxFSize_SHIFT; + val |= size FIFOSIZE_DEPTH_SHIFT; addr += size; - writel(val,
[PATCHv2 3/3] usb: s3c-hsotg: Move s3c-hsotg data structures
From: Dinh Nguyen dingu...@altera.com This patch moves the data structures that are in the s3c-hsotg source into core.h. This is a necessary step towards unifying the s3c-hsotg and dwc2 into a single DRD. Signed-off-by: Dinh Nguyen dingu...@altera.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Paul Zimmerman pa...@synopsys.com Cc: Felipe Balbi ba...@ti.com Cc: Ben Dooks ben-li...@fluff.org Cc: Matt Porter mpor...@linaro.org Cc: Kukjin Kim kgene@samsung.com Cc: Stephen Warren swar...@wwwdotorg.org Cc: Matthijs Kooijman matth...@stdin.nl Cc: Jingoo Han jg1@samsung.com Cc: Sachin Kamat sachin.ka...@linaro.org Cc: Robert Baldyga r.bald...@samsung.com --- v2: none --- drivers/usb/dwc2/core.h | 182 ++ drivers/usb/dwc2/s3c-hsotg.c | 180 + 2 files changed, 183 insertions(+), 179 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 648519c..1efd10c 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -37,6 +37,10 @@ #ifndef __DWC2_CORE_H__ #define __DWC2_CORE_H__ +#include linux/phy/phy.h +#include linux/regulator/consumer.h +#include linux/usb/gadget.h +#include linux/usb/otg.h #include linux/usb/phy.h #include hw.h @@ -54,6 +58,184 @@ static inline void do_write(u32 value, void *addr) /* Maximum number of Endpoints/HostChannels */ #define MAX_EPS_CHANNELS 16 +/* s3c-hsotg declarations */ +static const char * const s3c_hsotg_supply_names[] = { + vusb_d, /* digital USB supply, 1.2V */ + vusb_a, /* analog USB supply, 1.1V */ +}; + +/* + * EP0_MPS_LIMIT + * + * Unfortunately there seems to be a limit of the amount of data that can + * be transferred by IN transactions on EP0. This is either 127 bytes or 3 + * packets (which practically means 1 packet and 63 bytes of data) when the + * MPS is set to 64. + * + * This means if we are wanting to move 127 bytes of data, we need to + * split the transactions up, but just doing one packet at a time does + * not work (this may be an implicit DATA0 PID on first packet of the + * transaction) and doing 2 packets is outside the controller's limits. + * + * If we try to lower the MPS size for EP0, then no transfers work properly + * for EP0, and the system will fail basic enumeration. As no cause for this + * has currently been found, we cannot support any large IN transfers for + * EP0. + */ +#define EP0_MPS_LIMIT 64 + +struct s3c_hsotg; +struct s3c_hsotg_req; + +/** + * struct s3c_hsotg_ep - driver endpoint definition. + * @ep: The gadget layer representation of the endpoint. + * @name: The driver generated name for the endpoint. + * @queue: Queue of requests for this endpoint. + * @parent: Reference back to the parent device structure. + * @req: The current request that the endpoint is processing. This is + * used to indicate an request has been loaded onto the endpoint + * and has yet to be completed (maybe due to data move, or simply + * awaiting an ack from the core all the data has been completed). + * @debugfs: File entry for debugfs file for this endpoint. + * @lock: State lock to protect contents of endpoint. + * @dir_in: Set to true if this endpoint is of the IN direction, which + * means that it is sending data to the Host. + * @index: The index for the endpoint registers. + * @mc: Multi Count - number of transactions per microframe + * @interval - Interval for periodic endpoints + * @name: The name array passed to the USB core. + * @halted: Set if the endpoint has been halted. + * @periodic: Set if this is a periodic ep, such as Interrupt + * @isochronous: Set if this is a isochronous ep + * @sent_zlp: Set if we've sent a zero-length packet. + * @total_data: The total number of data bytes done. + * @fifo_size: The size of the FIFO (for periodic IN endpoints) + * @fifo_load: The amount of data loaded into the FIFO (periodic IN) + * @last_load: The offset of data for the last start of request. + * @size_loaded: The last loaded size for DxEPTSIZE for periodic IN + * + * This is the driver's state for each registered enpoint, allowing it + * to keep track of transactions that need doing. Each endpoint has a + * lock to protect the state, to try and avoid using an overall lock + * for the host controller as much as possible. + * + * For periodic IN endpoints, we have fifo_size and fifo_load to try + * and keep track of the amount of data in the periodic FIFO for each + * of these as we don't have a status register that tells us how much + * is in each of them. (note, this may actually be useless information + * as in shared-fifo mode periodic in acts like a single-frame packet + * buffer than a fifo) + */ +struct s3c_hsotg_ep { + struct usb_ep ep; + struct list_headqueue; + struct s3c_hsotg*parent; + struct s3c_hsotg_req*req; + struct dentry *debugfs; + +
[PATCH] Remove fifo sizes from dwc2 usb driver from socfpga.dtsi
From: Dinh Nguyen dingu...@altera.com Remove reading the fifo sizes from dts in platform.c Add dwc2_calculate_dynamic_fifo Conflicts: arch/arm/boot/dts/socfpga.dtsi drivers/staging/dwc2/core.c --- arch/arm/boot/dts/socfpga.dtsi |8 --- drivers/usb/dwc2/core.c| 49 drivers/usb/dwc2/platform.c| 20 3 files changed, 45 insertions(+), 32 deletions(-) diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi index 03e7a6d..e4c0f72 100644 --- a/arch/arm/boot/dts/socfpga.dtsi +++ b/arch/arm/boot/dts/socfpga.dtsi @@ -860,10 +860,6 @@ clock-names = otg; phys = usbphy0; phy-names = usb2-phy; - enable-dynamic-fifo = 1; - host-rx-fifo-size = 0xa00; - host-perio-tx-fifo-size = 0xa00; - host-nperio-tx-fifo-size = 0xa00; dma-desc-enable = 0; status = disabled; }; @@ -876,10 +872,6 @@ clock-names = otg; phys = usbphy0; phy-names = usb2-phy; - enable-dynamic-fifo = 1; - host-rx-fifo-size = 0xa00; - host-perio-tx-fifo-size = 0xa00; - host-nperio-tx-fifo-size = 0xa00; dma-desc-enable = 0; status = disabled; }; diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 6d001b5..3acb7ee 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -478,6 +478,38 @@ void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg) writel(intmsk, hsotg-regs + GINTMSK); } +static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg) +{ + struct dwc2_core_params *params = hsotg-core_params; + struct dwc2_hw_params *hw = hsotg-hw_params; + u32 rxfsiz, nptxfsiz, ptxfsiz, total_fifo_size; + + total_fifo_size = hw-total_fifo_size; + rxfsiz = params-host_rx_fifo_size; + nptxfsiz = params-host_nperio_tx_fifo_size; + ptxfsiz = params-host_perio_tx_fifo_size; + + if (total_fifo_size = (rxfsiz + nptxfsiz + ptxfsiz)) + /* Params are valid, nothing to do */ + return; + else { + /* min rx fifo size = ((largest packet/4)*2)+2 */ + rxfsiz = (((1024/4) + 1 + 1) * 3) + 1; + /* min non-periodic tx fifo depth */ + nptxfsiz = 3 * (1024/4); + /* min periodic tx fifo depth */ + ptxfsiz = ((1024*3)/4) * 3; + } + + if (total_fifo_size (rxfsiz + nptxfsiz + ptxfsiz)) + dev_err(hsotg-dev, invalid fifo sizes\n); + + params-host_rx_fifo_size = rxfsiz; + params-host_nperio_tx_fifo_size = nptxfsiz; + params-host_perio_tx_fifo_size = ptxfsiz; +} + + static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) { struct dwc2_core_params *params = hsotg-core_params; @@ -495,19 +527,28 @@ static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) writel(grxfsiz, hsotg-regs + GRXFSIZ); dev_dbg(hsotg-dev, new grxfsiz=%08x\n, readl(hsotg-regs + GRXFSIZ)); + /* Calculate the correct FIFO sizes */ + dwc2_calculate_dynamic_fifo(hsotg); + + /* Rx FIFO */ + printk(initial grxfsiz=%08x\n, + readl(hsotg-regs + GRXFSIZ)); + writel(params-host_rx_fifo_size, hsotg-regs + GRXFSIZ); + printk(new grxfsiz=%08x\n, readl(hsotg-regs + GRXFSIZ)); + /* Non-periodic Tx FIFO */ - dev_dbg(hsotg-dev, initial gnptxfsiz=%08x\n, + printk(initial gnptxfsiz=%08x\n, readl(hsotg-regs + GNPTXFSIZ)); nptxfsiz = params-host_nperio_tx_fifo_size FIFOSIZE_DEPTH_SHIFT FIFOSIZE_DEPTH_MASK; nptxfsiz |= params-host_rx_fifo_size FIFOSIZE_STARTADDR_SHIFT FIFOSIZE_STARTADDR_MASK; writel(nptxfsiz, hsotg-regs + GNPTXFSIZ); - dev_dbg(hsotg-dev, new gnptxfsiz=%08x\n, + printk(new gnptxfsiz=%08x\n, readl(hsotg-regs + GNPTXFSIZ)); /* Periodic Tx FIFO */ - dev_dbg(hsotg-dev, initial hptxfsiz=%08x\n, + printk(initial hptxfsiz=%08x\n, readl(hsotg-regs + HPTXFSIZ)); hptxfsiz = params-host_perio_tx_fifo_size FIFOSIZE_DEPTH_SHIFT FIFOSIZE_DEPTH_MASK; @@ -515,7 +556,7 @@ static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) params-host_nperio_tx_fifo_size) FIFOSIZE_STARTADDR_SHIFT FIFOSIZE_STARTADDR_MASK; writel(hptxfsiz, hsotg-regs + HPTXFSIZ); - dev_dbg(hsotg-dev, new hptxfsiz=%08x\n, + printk(new hptxfsiz=%08x\n, readl(hsotg-regs + HPTXFSIZ)); if
[PATCHv2 0/3] usb: dwc2/s3c-hsotg: Move the s3c-hsotg driver into dwc2
From: Dinh Nguyen dingu...@altera.com Hi, This is a shortened version of the v1 patch to combine the dwc2/s3c-hsotg into a single dual-role driver. The series will only move the s3c-hsotg driver into the dwc2 folder, use the defines in the dwc2 hw.h, and removes the s3c-hsotg.h defines. This will make the dual-role combining work a bit easier to review in the future. For now, the dwc2 and s3c-hsotg will be separate drivers. Thanks, Dinh Nguyen (3): usb: dwc2: Add defines to support the s3c-hsotg driver usb: s3c-hsotg: Move s3c-hsotg into dwc2 folder usb: s3c-hsotg: Move s3c-hsotg data structures drivers/usb/dwc2/Kconfig | 15 + drivers/usb/dwc2/Makefile| 15 +- drivers/usb/dwc2/core.h | 182 + drivers/usb/dwc2/hw.h| 11 +- drivers/usb/{gadget = dwc2}/s3c-hsotg.c | 593 +++--- drivers/usb/gadget/Kconfig |7 - drivers/usb/gadget/Makefile |1 - drivers/usb/gadget/s3c-hsotg.h | 378 --- 8 files changed, 420 insertions(+), 782 deletions(-) rename drivers/usb/{gadget = dwc2}/s3c-hsotg.c (85%) delete mode 100644 drivers/usb/gadget/s3c-hsotg.h --- Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Paul Zimmerman pa...@synopsys.com Cc: Felipe Balbi ba...@ti.com Cc: Ben Dooks ben-li...@fluff.org Cc: Matt Porter mpor...@linaro.org Cc: Kukjin Kim kgene@samsung.com Cc: Stephen Warren swar...@wwwdotorg.org Cc: Matthijs Kooijman matth...@stdin.nl Cc: Jingoo Han jg1@samsung.com Cc: Sachin Kamat sachin.ka...@linaro.org Cc: Robert Baldyga r.bald...@samsung.com -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] staging/usbip: change usbip userspace to include new uapi usbip.h
usbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. A new uapi usbip.h now defines the usbip device status for kernel and userspace to use. Change usbip userspace to include uapi usbip.h for usbip device status. Signed-off-by: Shuah Khan shuah...@samsung.com --- .../staging/usbip/userspace/libsrc/usbip_common.h| 18 +- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.h b/drivers/staging/usbip/userspace/libsrc/usbip_common.h index 2cb81b3..5af59d4 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.h +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.h @@ -15,6 +15,7 @@ #include syslog.h #include unistd.h #include linux/usb/ch9.h +#include ../../uapi/usbip.h #ifndef USBIDS_FILE #define USBIDS_FILE /usr/share/hwdata/usb.ids @@ -77,23 +78,6 @@ extern int usbip_use_debug ; abort();\ } while (0) -/* FIXME: how to sync with drivers/usbip_common.h ? */ -enum usbip_device_status { - /* sdev is available. */ - SDEV_ST_AVAILABLE = 0x01, - /* sdev is now used. */ - SDEV_ST_USED, - /* sdev is unusable because of a fatal error. */ - SDEV_ST_ERROR, - - /* vdev does not connect a remote device. */ - VDEV_ST_NULL, - /* vdev is used, but the USB address is not assigned yet */ - VDEV_ST_NOTASSIGNED, - VDEV_ST_USED, - VDEV_ST_ERROR -}; - struct usbip_usb_interface { uint8_t bInterfaceClass; uint8_t bInterfaceSubClass; -- 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 v2 1/3] staging/usbip: add uapi header to export usbip kernel interfaces
usbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. Adding an usbip uapi header file will define the kernel - userspace interface for this device status. This new uapi file is added under usbip/uapi to keep the staging tree code self-contained. When usbip moves to mainline drivers, this file should be moved under uapi/linux Signed-off-by: Shuah Khan shuah...@samsung.com --- drivers/staging/usbip/uapi/usbip.h | 26 ++ 1 file changed, 26 insertions(+) create mode 100644 drivers/staging/usbip/uapi/usbip.h diff --git a/drivers/staging/usbip/uapi/usbip.h b/drivers/staging/usbip/uapi/usbip.h new file mode 100644 index 000..fa5db30 --- /dev/null +++ b/drivers/staging/usbip/uapi/usbip.h @@ -0,0 +1,26 @@ +/* + * usbip.h + * + * USBIP uapi defines and function prototypes etc. +*/ + +#ifndef _UAPI_LINUX_USBIP_H +#define _UAPI_LINUX_USBIP_H + +/* usbip device status - exported in usbip device sysfs status */ +enum usbip_device_status { + /* sdev is available. */ + SDEV_ST_AVAILABLE = 0x01, + /* sdev is now used. */ + SDEV_ST_USED, + /* sdev is unusable because of a fatal error. */ + SDEV_ST_ERROR, + + /* vdev does not connect a remote device. */ + VDEV_ST_NULL, + /* vdev is used, but the USB address is not assigned yet */ + VDEV_ST_NOTASSIGNED, + VDEV_ST_USED, + VDEV_ST_ERROR +}; +#endif /* _UAPI_LINUX_USBIP_H */ -- 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 v2 0/3] staging/usbip: add new uapi header usbip.h
usbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. Adding an usbip uapi header file will define the kernel - userspace interface for this device status. This new uapi file is added under usbip/uapi to keep the staging tree code self-contained. When usbip moves to mainline drivers, this file should be moved under uapi/linux usbip kernel and userspace are changed to use this new header file. Shuah Khan (3): staging/usbip: add uapi header to export usbip kernel interfaces staging/usbip: change usbip to include new uapi usbip.h staging/usbip: change usbip userspace to include new uapi usbip.h drivers/staging/usbip/uapi/usbip.h | 26 drivers/staging/usbip/usbip_common.h | 19 ++ .../staging/usbip/userspace/libsrc/usbip_common.h | 18 +- 3 files changed, 29 insertions(+), 34 deletions(-) create mode 100644 drivers/staging/usbip/uapi/usbip.h -- 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 v2 2/3] staging/usbip: change usbip to include new uapi usbip.h
usbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. A new uapi usbip.h now defines the usbip device status for kernel and userspace to use. Change usbip kernel space to include uapi usbip.h for usbip device status. Signed-off-by: Shuah Khan shuah...@samsung.com --- drivers/staging/usbip/usbip_common.h | 19 ++- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/staging/usbip/usbip_common.h b/drivers/staging/usbip/usbip_common.h index 7e6c543..732fb63 100644 --- a/drivers/staging/usbip/usbip_common.h +++ b/drivers/staging/usbip/usbip_common.h @@ -29,6 +29,7 @@ #include linux/types.h #include linux/usb.h #include linux/wait.h +#include uapi/usbip.h #define USBIP_VERSION 1.0.0 @@ -235,22 +236,6 @@ enum usbip_side { USBIP_STUB, }; -enum usbip_status { - /* sdev is available. */ - SDEV_ST_AVAILABLE = 0x01, - /* sdev is now used. */ - SDEV_ST_USED, - /* sdev is unusable because of a fatal error. */ - SDEV_ST_ERROR, - - /* vdev does not connect a remote device. */ - VDEV_ST_NULL, - /* vdev is used, but the USB address is not assigned yet */ - VDEV_ST_NOTASSIGNED, - VDEV_ST_USED, - VDEV_ST_ERROR -}; - /* event handler */ #define USBIP_EH_SHUTDOWN (1 0) #define USBIP_EH_BYE (1 1) @@ -271,7 +256,7 @@ enum usbip_status { /* a common structure for stub_device and vhci_device */ struct usbip_device { enum usbip_side side; - enum usbip_status status; + enum usbip_device_status status; /* lock for status */ spinlock_t lock; -- 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
Re: [PATCH v6 part1 3/8] usb: cleanup setting udev-removable from port_dev-connect_type
On Mon, 2014-03-03 at 16:36 -0500, Alan Stern wrote: On Fri, 28 Feb 2014, Dan Williams wrote: Once usb-acpi has set the port's connect type the usb_device's -removable attribute can be set in the standard location set_usb_port_removable(). This also changes behavior in the case where the firmware says that the port connect type is unknown. In that case just use the default setting determined from the hub descriptor. Suggested-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Dan Williams dan.j.willi...@intel.com Good clean-up. @@ -155,36 +156,15 @@ static struct acpi_device *usb_acpi_find_companion(struct device *dev) */ if (is_usb_device(dev)) { udev = to_usb_device(dev); - port1 = udev-portnum; - if (udev-parent) { - struct usb_hub *hub; - - hub = usb_hub_to_struct_hub(udev-parent); - /* -* According usb port's connect type to set usb device's -* removability. -*/ - switch (hub-ports[port1 - 1]-connect_type) { - case USB_PORT_CONNECT_TYPE_HOT_PLUG: - udev-removable = USB_DEVICE_REMOVABLE; - break; - case USB_PORT_CONNECT_TYPE_HARD_WIRED: - udev-removable = USB_DEVICE_FIXED; - break; - default: - udev-removable = USB_DEVICE_REMOVABLE_UNKNOWN; - break; - } - + if (udev-parent) return NULL; - } /* root hub's parent is the usb hcd. */ - return acpi_find_child_device(ACPI_COMPANION(dev-parent), - port1, false); + port1 = udev-portnum; + adev = ACPI_COMPANION(dev-parent); + return acpi_find_child_device(adev, port1, false); Does this entirely make sense? As far as I can see, port1 is never going to be anything other than 0. After all, root hubs don't have upstream ports. I don't know what ACPI expects to see here. ACPI wants to know which child to find and in this case there is only ever one child of the hcd, the root hub. It will always be at ACPI-address zero relative to the hcd device. Indeed it does not make sense to derive the port number given we are always looking for '0'. So while we are making the other cleanup might as well remove this irrelevant lookup of the port number. 8- Subject: usb: cleanup setting udev-removable from port_dev-connect_type From: Dan Williams dan.j.willi...@intel.com Once usb-acpi has set the port's connect type the usb_device's -removable attribute can be set in the standard location set_usb_port_removable(). This also changes behavior in the case where the firmware says that the port connect type is unknown. In that case just use the default setting determined from the hub descriptor. Note, we no longer pass udev-portnum to acpi_find_child_device() in the root hub case since: 1/ the usb-core sets this to zero 2/ acpi always expects zero ...just pass zero. Suggested-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Dan Williams dan.j.willi...@intel.com --- drivers/usb/core/hub.c | 22 +- drivers/usb/core/usb-acpi.c | 34 ++ 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 71e1a0a9f222..67de9b63a98d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2283,6 +2283,22 @@ static void set_usb_port_removable(struct usb_device *udev) udev-removable = USB_DEVICE_REMOVABLE; else udev-removable = USB_DEVICE_FIXED; + + /* +* Platform firmware may have populated an alternative value for +* removable. If the parent port has a known connect_type use +* that instead. +*/ + switch (hub-ports[udev-portnum - 1]-connect_type) { + case USB_PORT_CONNECT_TYPE_HOT_PLUG: + udev-removable = USB_DEVICE_REMOVABLE; + break; + case USB_PORT_CONNECT_TYPE_HARD_WIRED: + udev-removable = USB_DEVICE_FIXED; + break; + default: /* use what was set above */ + break; + } } /** @@ -2352,11 +2368,7 @@ int usb_new_device(struct usb_device *udev) device_enable_async_suspend(udev-dev); - /* -* check whether the hub marks this port as non-removable. Do it -* now so that platform-specific data can override it in -* device_add() -*/ + /* check whether the hub or firmware marks this port as non-removable */ if (udev-parent) set_usb_port_removable(udev); diff
RE: ax88179_178a problems on AMD platform with ASMedia xhci controller
Yep basically the nic doesn't work with the Asmedia 1042. Not only that though, I moved to a SandyBridge platform and... The nic stops working very quickly when using an onboard Etron controller. The nic also stops working quickly when using an addon card with Renesas controller. I have a Genesyslogic USB 3.0 hub... The nic also dies with the hub etron However everything is completely stable with this combination... Renesas controller + Genesyslogic 3.0 hub + SG disabled Anything else will eventually result in the nic becoming unresponsive. Regards, Will Trives -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 part1 4/8] usb: assign default peer ports for root hubs
On Mon, 2014-03-03 at 17:21 -0500, Alan Stern wrote: On Fri, 28 Feb 2014, Dan Williams wrote: Assume that the peer of a superspeed port is the port with the same id on the shared_hcd root hub. This identification scheme is required of external hubs by the USB3 spec [1]. However, for root hubs, tier mismatch may be in effect [2]. Tier mismatch can only be enumerated via platform firmware. For now, simply perform the nominal association. Once the root hub is marked as unregistered we block attempts to walk the -shared_hcd pointer to find a root-peer port. [1]: usb 3.1 section 10.3.3 [2]: xhci 1.1 appendix D Signed-off-by: Dan Williams dan.j.willi...@intel.com Okay, I think the locking still isn't right. Below is an example patch showing how it ought to work. Basically, all the locking can be done in hub.c; port.c doesn't have to worry about it at all. diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2518c3250750..e380b8a80830 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2778,9 +2778,17 @@ void usb_remove_hcd(struct usb_hcd *hcd) hcd-state = HC_STATE_QUIESCING; dev_dbg(hcd-self.controller, roothub graceful disconnect\n); + + /* +* Flush + disable peering operations, and atomically update the +* hcd state relative to other root hub state +* changes/evaluations +*/ + mutex_lock(usb_port_peer_mutex); spin_lock_irq (hcd_root_hub_lock); hcd-rh_registered = 0; spin_unlock_irq (hcd_root_hub_lock); + mutex_unlock(usb_port_peer_mutex); Not needed. We don't care whether the root hub device is registered; we only care whether it qualifies as a hub according to the tests in usb_hub_to_struct_hub. In general I agree, and I like the compartmentalization of only needing to take the lock in hub.c. But I still think we have a hole with a scenario like the following (granted, this should never happen in current code...): CPU1CPU2 usb_remove_hcd(hcdA) ... mutex_lock(peer_lock) hdevA-maxchild = 0; mutex_unlock(peer_lock) usb_add_hcd(hcdB) ... mutex_lock(peer_lock) peer_hdev = hdevA usb_put_dev(hdevA) // free hubA = usb_hub_to_struct_hub(hdevA) // use after free Am I missing something that mitigates this? I still think we need to check against -rh_registered. Otherwise changes look good and I have folded this into the patch. -- Dan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 part1 4/8] usb: assign default peer ports for root hubs
On Mon, Mar 3, 2014 at 5:13 PM, Dan Williams dan.j.willi...@intel.com wrote: On Mon, 2014-03-03 at 17:21 -0500, Alan Stern wrote: On Fri, 28 Feb 2014, Dan Williams wrote: Assume that the peer of a superspeed port is the port with the same id on the shared_hcd root hub. This identification scheme is required of external hubs by the USB3 spec [1]. However, for root hubs, tier mismatch may be in effect [2]. Tier mismatch can only be enumerated via platform firmware. For now, simply perform the nominal association. Once the root hub is marked as unregistered we block attempts to walk the -shared_hcd pointer to find a root-peer port. [1]: usb 3.1 section 10.3.3 [2]: xhci 1.1 appendix D Signed-off-by: Dan Williams dan.j.willi...@intel.com Okay, I think the locking still isn't right. Below is an example patch showing how it ought to work. Basically, all the locking can be done in hub.c; port.c doesn't have to worry about it at all. diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2518c3250750..e380b8a80830 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2778,9 +2778,17 @@ void usb_remove_hcd(struct usb_hcd *hcd) hcd-state = HC_STATE_QUIESCING; dev_dbg(hcd-self.controller, roothub graceful disconnect\n); + + /* +* Flush + disable peering operations, and atomically update the +* hcd state relative to other root hub state +* changes/evaluations +*/ + mutex_lock(usb_port_peer_mutex); spin_lock_irq (hcd_root_hub_lock); hcd-rh_registered = 0; spin_unlock_irq (hcd_root_hub_lock); + mutex_unlock(usb_port_peer_mutex); Not needed. We don't care whether the root hub device is registered; we only care whether it qualifies as a hub according to the tests in usb_hub_to_struct_hub. In general I agree, and I like the compartmentalization of only needing to take the lock in hub.c. But I still think we have a hole with a scenario like the following (granted, this should never happen in current code...): CPU1CPU2 usb_remove_hcd(hcdA) ... mutex_lock(peer_lock) hdevA-maxchild = 0; mutex_unlock(peer_lock) usb_add_hcd(hcdB) ... mutex_lock(peer_lock) hdevA = hcdA-self.root_hub usb_put_dev(hdevA) // free hubA = usb_hub_to_struct_hub(hdevA) // use after free ...and if this is a hole then so is the hcdA-self.root_hub. It makes sense that when the host controller breaks the peering relationship at the root it should hold the lock and clear -shared_hcd and -primary_hcd. -- 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
basics of runtime d3 for xhci.
Can anyone please explain me, how runtime d3 works for xhci. I am trying to understand generic code/control flow. When usb bus is ideal, how RTD3 (runtime d3) will be triggered and which code is involved in it. Thank you. -- Regards, Pratik -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 part1 4/8] usb: assign default peer ports for root hubs
On Mon, 2014-03-03 at 17:13 -0800, Dan Williams wrote: On Mon, 2014-03-03 at 17:21 -0500, Alan Stern wrote: On Fri, 28 Feb 2014, Dan Williams wrote: Assume that the peer of a superspeed port is the port with the same id on the shared_hcd root hub. This identification scheme is required of external hubs by the USB3 spec [1]. However, for root hubs, tier mismatch may be in effect [2]. Tier mismatch can only be enumerated via platform firmware. For now, simply perform the nominal association. Once the root hub is marked as unregistered we block attempts to walk the -shared_hcd pointer to find a root-peer port. [1]: usb 3.1 section 10.3.3 [2]: xhci 1.1 appendix D Signed-off-by: Dan Williams dan.j.willi...@intel.com Okay, I think the locking still isn't right. Below is an example patch showing how it ought to work. Basically, all the locking can be done in hub.c; port.c doesn't have to worry about it at all. diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2518c3250750..e380b8a80830 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2778,9 +2778,17 @@ void usb_remove_hcd(struct usb_hcd *hcd) hcd-state = HC_STATE_QUIESCING; dev_dbg(hcd-self.controller, roothub graceful disconnect\n); + + /* + * Flush + disable peering operations, and atomically update the + * hcd state relative to other root hub state + * changes/evaluations + */ + mutex_lock(usb_port_peer_mutex); spin_lock_irq (hcd_root_hub_lock); hcd-rh_registered = 0; spin_unlock_irq (hcd_root_hub_lock); + mutex_unlock(usb_port_peer_mutex); Not needed. We don't care whether the root hub device is registered; we only care whether it qualifies as a hub according to the tests in usb_hub_to_struct_hub. In general I agree, and I like the compartmentalization of only needing to take the lock in hub.c. But I still think we have a hole with a scenario like the following (granted, this should never happen in current code...): CPU1CPU2 usb_remove_hcd(hcdA) ... mutex_lock(peer_lock) hdevA-maxchild = 0; mutex_unlock(peer_lock) usb_add_hcd(hcdB) ... mutex_lock(peer_lock) peer_hdev = hdevA usb_put_dev(hdevA) // free hubA = usb_hub_to_struct_hub(hdevA) // use after free Am I missing something that mitigates this? I still think we need to check against -rh_registered. Otherwise changes look good and I have folded this into the patch. Ok, so the root issue is that the peering code needs to see hcd-primary_hcd = NULL to know that there is no longer a peer. I update usb_remove_hcd() to clear out -shared_hcd and -primary_hcd under the peer lock before we allow the root hub to be freed. I add some description of the new locking scheme to the changelog as well. 8-- Subject: usb: assign default peer ports for root hubs From: Dan Williams dan.j.willi...@intel.com Assume that the peer of a superspeed port is the port with the same id on the shared_hcd root hub. This identification scheme is required of external hubs by the USB3 spec [1]. However, for root hubs, tier mismatch may be in effect [2]. Tier mismatch can only be enumerated via platform firmware. For now, simply perform the nominal association. Once the root hub is marked as unregistered we block attempts to walk the -shared_hcd pointer to find a root-peer port. A new lock 'usb_port_peer_mutex' is introduced to synchronize port device add/remove with peer lookups. We hold the lock for the duration of registration allowing default peers (and later firmware identified peers) to be discovered. We also hold the lock whenever hub devices are validated (hdev-maxchild set to non-zero) and invalidated (hdev-maxchild set to zero). Marking a hub valid and registering its ports is a locked operation and conversely invalidating a hub and removing its ports is another locked operation. This prevents a port from associating with an invalid peer. Finally, we hold the lock when breaking the shared hcd relationship at usb_remove_hcd() time. [1]: usb 3.1 section 10.3.3 [2]: xhci 1.1 appendix D Cc: Alan Stern st...@rowland.harvard.edu [alan: usb_port_peer_mutex locking scheme] Signed-off-by: Dan Williams dan.j.willi...@intel.com --- drivers/usb/core/hcd.c | 21 - drivers/usb/core/hub.c | 37 ++ drivers/usb/core/hub.h |2 + drivers/usb/core/port.c | 78 --- 4 files changed, 118 insertions(+), 20 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2518c3250750..259990a982f3 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2766,6 +2766,8 @@