[PATCH] usb: phy: samsung: Add support to set pmu isolation
Adding support to parse device node data in order to get required properties to set pmu isolation for usb-phy. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- Changes from v5: - Using a global spin_lock member in 'samsung_usbphy' structure to be used in samsung_usbphy_init() and samsung_usbphy_shutdown() to take care of all register initialization sequence. - Addressing few nits: - Using devphy_reg_offset instead of 'pmureg_devphy_offset' - Using if else block instead of ternary conditional statement in samsung_usbphy_set_isolation() - Using 'bool' type instead of 'int' for 'on' argument in samsung_usbphy_set_isolation() - Amending few comments. .../devicetree/bindings/usb/samsung-usbphy.txt | 36 + drivers/usb/phy/samsung-usbphy.c | 161 +--- 2 files changed, 175 insertions(+), 22 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt index 7b26e2d..22d06cf 100644 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -9,3 +9,39 @@ Required properties: - compatible : should be samsung,exynos4210-usbphy - reg : base physical address of the phy registers and length of memory mapped region. + +Optional properties: +- #address-cells: should be '1' when usbphy node has a child node with 'reg' + property. +- #size-cells: should be '1' when usbphy node has a child node with 'reg' + property. +- ranges: allows valid translation between child's address space and parent's + address space. + +- The child node 'usbphy-sys' to the node 'usbphy' is for the system controller + interface for usb-phy. It should provide the following information required by + usb-phy controller to control phy. + - reg : base physical address of PHY_CONTROL registers. + The size of this register is the total sum of size of all PHY_CONTROL + registers that the SoC has. For example, the size will be + '0x4' in case we have only one PHY_CONTROL register (e.g. + OTHERS register in S3C64XX or USB_PHY_CONTROL register in S5PV210) + and, '0x8' in case we have two PHY_CONTROL registers (e.g. + USBDEVICE_PHY_CONTROL and USBHOST_PHY_CONTROL registers in exynos4x). + and so on. + +Example: + - Exynos4210 + + usbphy@125B { + #address-cells = 1; + #size-cells = 1; + compatible = samsung,exynos4210-usbphy; + reg = 0x125B 0x100; + ranges; + + usbphy-sys { + /* USB device and host PHY_CONTROL registers */ + reg = 0x10020704 0x8; + }; + }; diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c index 5c5e1bb5..7eec7c3 100644 --- a/drivers/usb/phy/samsung-usbphy.c +++ b/drivers/usb/phy/samsung-usbphy.c @@ -24,6 +24,7 @@ #include linux/err.h #include linux/io.h #include linux/of.h +#include linux/of_address.h #include linux/usb/otg.h #include linux/platform_data/samsung-usbphy.h @@ -60,20 +61,46 @@ #define MHZ (1000*1000) #endif +#define S3C64XX_USBPHY_ENABLE (0x1 16) +#define EXYNOS_USBPHY_ENABLE (0x1 0) + enum samsung_cpu_type { TYPE_S3C64XX, TYPE_EXYNOS4210, }; /* + * struct samsung_usbphy_drvdata - driver data for various SoC variants + * @cpu_type: machine identifier + * @devphy_en_mask: device phy enable mask for PHY CONTROL register + * @devphy_reg_offset: offset to DEVICE PHY CONTROL register from + *mapped address of system controller. + * + * Here we have a separate mask for device type phy. + * Having different masks for host and device type phy helps + * in setting independent masks in case of SoCs like S5PV210, + * in which PHY0 and PHY1 enable bits belong to same register + * placed at position 0 and 1 respectively. + * Although for newer SoCs like exynos these bits belong to + * different registers altogether placed at position 0. + */ +struct samsung_usbphy_drvdata { + int cpu_type; + int devphy_en_mask; + u32 devphy_reg_offset; +}; + +/* * struct samsung_usbphy - transceiver driver state * @phy: transceiver structure * @plat: platform data * @dev: The parent device supplied to the probe function * @clk: usb phy clock - * @regs: usb phy register memory base + * @regs: usb phy controller registers memory base + * @pmuregs: USB device PHY_CONTROL register memory base * @ref_clk_freq: reference clock frequency selection - * @cpu_type: machine identifier + * @drv_data: driver data available for different SoCs + * @lock: lock for phy operations */ struct samsung_usbphy { struct usb_phy phy; @@ -81,12 +108,64 @@ struct
Re: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver
Hi, On 2013-01-11 03:45, Ming Lei wrote: Cc netdev and usb lists. On Fri, Jan 11, 2013 at 9:17 AM, fre...@asix.com.tw wrote: From: Freddy Xin fre...@asix.com.tw This patch adds a driver for ASIX's AX88179 family of USB 3.0/2.0 to gigabit ethernet adapters. It's based on the AX88xxx driver but the usb commands used to access registers for AX88179 are completely different. This driver had been verified on x86 system with AX88179/AX88178A and Sitcomm LN-032 USB dongles. Signed-off-by: Freddy Xin fre...@asix.com.tw --- drivers/net/usb/Kconfig| 18 + drivers/net/usb/Makefile |1 + drivers/net/usb/ax88179_178a.c | 1457 3 files changed, 1476 insertions(+) create mode 100644 drivers/net/usb/ax88179_178a.c [...] diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c new file mode 100644 index 000..47504ea --- /dev/null +++ b/drivers/net/usb/ax88179_178a.c [...] +static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, + u16 size, void *data) +{ + int ret; + ret = usbnet_read_cmd(dev, cmd, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, index, data, size); + + if (ret != size ret = 0) + return -EINVAL; + return ret; +} + +static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, +u16 size, void *data) +{ + return usbnet_write_cmd(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR + | USB_RECIP_DEVICE, value, index, data, size); +} + +static void +ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, + u16 size, void *data) +{ + usbnet_write_cmd_async(dev, cmd, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, index, data, size); +} + ax88179_read_cmd, ax88179_write_cmd, and ax88179_write_cmd_async duplicate code from asix_common.c. [...] +static int ax88179_get_eeprom(struct net_device *net, + struct ethtool_eeprom *eeprom, u8 *data) +{ + struct usbnet *dev = netdev_priv(net); + u16 *ebuf = (u16 *)data; + int i; + + /* Crude hack to ensure that we don't overwrite memory +* if an odd length is supplied Have a look at asix_get_eeprom() in asix_common.c for a better implementation. There is also code for programming the eeprom (asix_set_eeprom in asix_common.c), can this be used for the AX88179/178A as well? Regards, Christian +*/ + if (eeprom-len % 2) + return -EINVAL; + + /* ax8817x returns 2 bytes from eeprom on read */ + for (i = 0; i eeprom-len / 2; i++) { + if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM, + eeprom-offset + i, 1, 2, ebuf[i]) 0) + return -EINVAL; + } + return 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: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3
On Fri, Jan 11, 2013 at 03:23:59AM +, Chen Peter-B29397 wrote: Some recent patch has caused fsl_mxc_udc.c driver to fail compilation because it can't find mach/hardware.h anymore. I would like this to be fixed still during this -rc cycle. Me too, who's sending a patch? :) Hi Peter, Who is currently working on the i.mx USB? I am working on it, but there are two versions, this one and chipidea's. Anyway, I will send a patch to fix this problem. if you're already using chipidea, then send me a patch removing this driver and focus your effort on chipidea. -- balbi signature.asc Description: Digital signature
RE: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3
I am working on it, but there are two versions, this one and chipidea's. Anyway, I will send a patch to fix this problem. if you're already using chipidea, then send me a patch removing this driver and focus your effort on chipidea. Added Sascha Now, not all of FSL i.mx USB can move to use chipidea due to some platform and USB PHY problem. -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3
Hi, On Fri, Jan 11, 2013 at 08:35:29AM +, Chen Peter-B29397 wrote: I am working on it, but there are two versions, this one and chipidea's. Anyway, I will send a patch to fix this problem. if you're already using chipidea, then send me a patch removing this driver and focus your effort on chipidea. Added Sascha Now, not all of FSL i.mx USB can move to use chipidea due to some platform and USB PHY problem. then we need to target fixing those problems and moving to chipidea completely at some point. There's no reason to duplicate efforts if we already have a re-usable driver in tree, right ? Let's fix this build break and focus on making sure all i.MX platforms can use chipidea so we can drop fsl udc on next merge window. That would be a great patchset to see. -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: phy: samsung: Add support to set pmu isolation
On 01/11/2013 09:08 AM, Vivek Gautam wrote: Adding support to parse device node data in order to get required properties to set pmu isolation for usb-phy. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com Thanks for addressing my all comments, Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.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: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3
-Original Message- From: Felipe Balbi [mailto:ba...@ti.com] Sent: Friday, January 11, 2013 4:41 PM To: Chen Peter-B29397 Cc: ba...@ti.com; ker...@pengutronix.de; Li Yang-R58472; Greg KH; linux- u...@vger.kernel.org; linuxppc-...@lists.ozlabs.org Subject: Re: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3 Hi, On Fri, Jan 11, 2013 at 08:35:29AM +, Chen Peter-B29397 wrote: I am working on it, but there are two versions, this one and chipidea's. Anyway, I will send a patch to fix this problem. if you're already using chipidea, then send me a patch removing this driver and focus your effort on chipidea. Added Sascha Now, not all of FSL i.mx USB can move to use chipidea due to some platform and USB PHY problem. then we need to target fixing those problems and moving to chipidea completely at some point. There's no reason to duplicate efforts if we already have a re-usable driver in tree, right ? Let's fix this build break and focus on making sure all i.MX platforms can use chipidea so we can drop fsl udc on next merge window. That would be a great patchset to see. I do agree that we need move to use the chipidea driver and eventually remove the fsl udc driver, but there were many users of the current driver such as PowerPC and Coldfire platforms besides the i.MX platforms. The support for them with chipidea driver could also be broken for now. I would suggest to have a transitional period that both drivers are kept while new development be based on the new driver. Added Ramneek. What do you think of the current status for chipidea driver on PowerPC platforms? Regards, Leo -- 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 01/14] mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
Tony, On 01/11/2013 01:45 AM, Tony Lindgren wrote: * Roger Quadros rog...@ti.com [130110 08:54]: Let's have a single platform data structure for the OMAP's High-Speed USB host subsystem instead of having 3 separate ones i.e. one for board data, one for USB Host (UHH) module and one for USB-TLL module. This makes the code much simpler and avoids creating multiple copies of platform data. I can apply just this patch alone into an immutable branch that we all can merge in as needed as long as we have acks for the USB and MFD parts. Or does this one need to be changed based on Alan's comments on the EHCI lib related changes? This does not depend on EHCI lib based changes but it depends on the OMAP USB Host cleanup series posted earlier. regards, -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
Re: [PATCH 04/14] usb: phy: nop: Handle power supply regulator for the PHY
On 01/10/2013 08:06 PM, Sergei Shtylyov wrote: Hello. On 01/10/2013 07:51 PM, Roger Quadros wrote: We use vcc as the supply name for the PHY's power supply. The power supply will be enabled during .init() and disabled during .shutdown() Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/otg/nop-usb-xceiv.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index 163f972..1c6db10 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c [...] @@ -70,6 +72,11 @@ static int nop_init(struct usb_phy *phy) { struct nop_usb_xceiv *nop = dev_get_drvdata(phy-dev); +if (nop-vcc) { +if (regulator_enable(nop-vcc)) +dev_err(phy-dev, Failed to enable power\n); +} Could be collapsed into single *if*. Right. + if (nop-clk) clk_enable(nop-clk); @@ -82,6 +89,11 @@ static void nop_shutdown(struct usb_phy *phy) if (nop-clk) clk_disable(nop-clk); + +if (nop-vcc) { +if (regulator_disable(nop-vcc)) +dev_err(phy-dev, Failed to disable power\n); +} Same here. OK. I'll fix them in next spin. --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
RE: [PATCH] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver
Hi, +static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, + u16 size, void *data) { + int ret; + ret = usbnet_read_cmd(dev, cmd, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, index, data, size); + + if (ret != size ret = 0) + return -EINVAL; + return ret; +} + +static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, +u16 size, void *data) { + return usbnet_write_cmd(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR + | USB_RECIP_DEVICE, value, index, +data, size); } + +static void +ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, + u16 size, void *data) { + usbnet_write_cmd_async(dev, cmd, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, index, data, size); } + ax88179_read_cmd, ax88179_write_cmd, and ax88179_write_cmd_async duplicate code from asix_common.c. Do you mean that I should merge this driver into asix_common and asix_devices, or just reuse the functions that had been implemented? [...] +static int ax88179_get_eeprom(struct net_device *net, + struct ethtool_eeprom *eeprom, u8 +*data) { + struct usbnet *dev = netdev_priv(net); + u16 *ebuf = (u16 *)data; + int i; + + /* Crude hack to ensure that we don't overwrite memory +* if an odd length is supplied Have a look at asix_get_eeprom() in asix_common.c for a better implementation. There is also code for programming the eeprom (asix_set_eeprom in asix_common.c), can this be used for the AX88179/178A as well? Thanks, I will check whether the eeprom access functions in asix_common.c can be used in the driver or not. Regards, Freddy +*/ + if (eeprom-len % 2) + return -EINVAL; + + /* ax8817x returns 2 bytes from eeprom on read */ + for (i = 0; i eeprom-len / 2; i++) { + if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM, + eeprom-offset + i, 1, 2, ebuf[i]) 0) + return -EINVAL; + } + return 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: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3
Hi, On Fri, Jan 11, 2013 at 09:24:16AM +, Li Yang-R58472 wrote: -Original Message- From: Felipe Balbi [mailto:ba...@ti.com] Sent: Friday, January 11, 2013 4:41 PM To: Chen Peter-B29397 Cc: ba...@ti.com; ker...@pengutronix.de; Li Yang-R58472; Greg KH; linux- u...@vger.kernel.org; linuxppc-...@lists.ozlabs.org Subject: Re: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3 Hi, On Fri, Jan 11, 2013 at 08:35:29AM +, Chen Peter-B29397 wrote: I am working on it, but there are two versions, this one and chipidea's. Anyway, I will send a patch to fix this problem. if you're already using chipidea, then send me a patch removing this driver and focus your effort on chipidea. Added Sascha Now, not all of FSL i.mx USB can move to use chipidea due to some platform and USB PHY problem. then we need to target fixing those problems and moving to chipidea completely at some point. There's no reason to duplicate efforts if we already have a re-usable driver in tree, right ? Let's fix this build break and focus on making sure all i.MX platforms can use chipidea so we can drop fsl udc on next merge window. That would be a great patchset to see. I do agree that we need move to use the chipidea driver and eventually remove the fsl udc driver, but there were many users of the current driver such as PowerPC and Coldfire platforms besides the i.MX platforms. The support for them with chipidea driver could also be broken for now. I would suggest to have a transitional period that both drivers are kept while new development be based on the new driver. right, right. That can be done as long as 'transitional period' isn't 20 years. At least make a plan to remove fsl udc, if it doesn't happen in the next 4 merge windows, I will remove it myself to force people to reuse other drivers. There is no reason to keep both drivers around. Added Ramneek. What do you think of the current status for chipidea driver on PowerPC platforms? that would be great to know, indeed. -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: phy: samsung: Add support to set pmu isolation
Hi Sylwester, On Fri, Jan 11, 2013 at 2:51 PM, Sylwester Nawrocki s.nawro...@samsung.com wrote: On 01/11/2013 09:08 AM, Vivek Gautam wrote: Adding support to parse device node data in order to get required properties to set pmu isolation for usb-phy. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com Thanks for addressing my all comments, Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com Thanks for the review and help. :-) -- Thanks Regards Vivek -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 17 +++ drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 11 files changed, 82 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..67e353d 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx25); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx25); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx25); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..ef66eaf 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx31); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx31); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx31); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..69fe9c8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx35); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx35); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx35); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0); clk_register_clkdev(clk[nfc_div], NULL, imx25-nand.0);
[PATCH 2/2]linux-usb:optimize to match the Huawei USB storage devices and support new switch command
From: fangxiaozhi huana...@huawei.com 1. Optimize the match rules with new macro for Huawei USB storage devices, to avoid to load USB storage driver for the modem interface with Huawei devices. 2. Add to support new switch command for new Huawei USB dongles. Signed-off-by: fangxiaozhi huana...@huawei.com diff -uprN linux-3.8-rc3_orig/drivers/usb/storage/initializers.c linux-3.8-rc3/drivers/usb/storage/initializers.c --- linux-3.8-rc3_orig/drivers/usb/storage/initializers.c 2013-01-11 17:53:19.757842845 +0800 +++ linux-3.8-rc3/drivers/usb/storage/initializers.c2013-01-11 17:55:04.137841849 +0800 @@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_dat return 0; } -/* This places the HUAWEI E220 devices in multi-port mode */ -int usb_stor_huawei_e220_init(struct us_data *us) +/* This places the HUAWEI usb dongles in multi-port mode */ +static int usb_stor_huawei_feature_init(struct us_data *us) { int result; @@ -104,3 +104,71 @@ int usb_stor_huawei_e220_init(struct us_ US_DEBUGP(Huawei mode set result is %d\n, result); return 0; } + +/* It will send a scsi switch command called rewind' to huawei dongle. + * When the dongle receives this command at the first time, + * it will reboot immediately. After rebooted, it will ignore this command. + * So it is unnecessary to read its response. */ +static int usb_stor_huawei_scsi_init(struct us_data *us) +{ + int result = 0; + int act_len = 0; + struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us-iobuf; + char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + bcbw-Signature = cpu_to_le32(US_BULK_CB_SIGN); + bcbw-Tag = 0; + bcbw-DataTransferLength = 0; + bcbw-Flags = bcbw-Lun = 0; + bcbw-Length = sizeof(rewind_cmd); + memset(bcbw-CDB, 0, sizeof(bcbw-CDB)); + memcpy(bcbw-CDB, rewind_cmd, sizeof(rewind_cmd)); + + result = usb_stor_bulk_transfer_buf(us, us-send_bulk_pipe, bcbw, + US_BULK_CB_WRAP_LEN, act_len); + US_DEBUGP(transfer actual length=%d, result=%d\n, act_len, result); + return result; +} + +/* It tries to find the supported Huawei USB dongles. + * In Huawei, they assign the following product IDs + * for all of their mobile broadband dongles, + * including the new dongles in the future. + * So if the product ID is not included in this list, + * it means it is not Huawei's mobile broadband dongles.*/ +static int usb_stor_huawei_dongles_pid(struct us_data *us) +{ + struct usb_interface_descriptor *idesc; + int idProduct; + + idesc = us-pusb_intf-cur_altsetting-desc; + idProduct = us-pusb_dev-descriptor.idProduct; + /* The first port is CDROM, +* means the dongle in the single port mode, +* and a switch command is required to be sent. */ + if (idesc idesc-bInterfaceNumber == 0) { + if ((idProduct == 0x1001) + || (idProduct == 0x1003) + || (idProduct == 0x1004) + || (idProduct = 0x1401 idProduct = 0x1500) + || (idProduct = 0x1505 idProduct = 0x1600) + || (idProduct = 0x1c02 idProduct = 0x2202)) { + return 1; + } + } + return 0; +} + +int usb_stor_huawei_init(struct us_data *us) +{ + int result = 0; + + if (usb_stor_huawei_dongles_pid(us)) { + if (us-pusb_dev-descriptor.idProduct = 0x1446) + result = usb_stor_huawei_scsi_init(us); + else + result = usb_stor_huawei_feature_init(us); + } + return result; +} diff -uprN linux-3.8-rc3_orig/drivers/usb/storage/initializers.h linux-3.8-rc3/drivers/usb/storage/initializers.h --- linux-3.8-rc3_orig/drivers/usb/storage/initializers.h 2013-01-11 17:53:19.758842845 +0800 +++ linux-3.8-rc3/drivers/usb/storage/initializers.h2013-01-11 17:55:04.767841843 +0800 @@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data * flash reader */ int usb_stor_ucr61s2b_init(struct us_data *us); -/* This places the HUAWEI E220 devices in multi-port mode */ -int usb_stor_huawei_e220_init(struct us_data *us); +/* This places the HUAWEI usb dongles in multi-port mode */ +int usb_stor_huawei_init(struct us_data *us); Binary files linux-3.8-rc3_orig/drivers/usb/storage/initializers.o and linux-3.8-rc3/drivers/usb/storage/initializers.o differ diff -uprN linux-3.8-rc3_orig/drivers/usb/storage/unusual_devs.h linux-3.8-rc3/drivers/usb/storage/unusual_devs.h --- linux-3.8-rc3_orig/drivers/usb/storage/unusual_devs.h 2013-01-11 17:53:19.757842845 +0800 +++ linux-3.8-rc3/drivers/usb/storage/unusual_devs.h2013-01-11 17:55:15.964841737 +0800 @@
RE: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3
-Original Message- From: Felipe Balbi [mailto:ba...@ti.com] Sent: Friday, January 11, 2013 3:18 PM To: Li Yang-R58472 Cc: ba...@ti.com; Chen Peter-B29397; Mehresh Ramneek-B31383; ker...@pengutronix.de; Greg KH; linux-usb@vger.kernel.org; linuxppc- d...@lists.ozlabs.org Subject: Re: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3 Hi, On Fri, Jan 11, 2013 at 09:24:16AM +, Li Yang-R58472 wrote: -Original Message- From: Felipe Balbi [mailto:ba...@ti.com] Sent: Friday, January 11, 2013 4:41 PM To: Chen Peter-B29397 Cc: ba...@ti.com; ker...@pengutronix.de; Li Yang-R58472; Greg KH; linux- u...@vger.kernel.org; linuxppc-...@lists.ozlabs.org Subject: Re: [BUILD BREAK] usb: gadget: fsl_mxc_udc can't compile on current v3.8-rc3 Hi, On Fri, Jan 11, 2013 at 08:35:29AM +, Chen Peter-B29397 wrote: I am working on it, but there are two versions, this one and chipidea's. Anyway, I will send a patch to fix this problem. if you're already using chipidea, then send me a patch removing this driver and focus your effort on chipidea. Added Sascha Now, not all of FSL i.mx USB can move to use chipidea due to some platform and USB PHY problem. then we need to target fixing those problems and moving to chipidea completely at some point. There's no reason to duplicate efforts if we already have a re-usable driver in tree, right ? Let's fix this build break and focus on making sure all i.MX platforms can use chipidea so we can drop fsl udc on next merge window. That would be a great patchset to see. I do agree that we need move to use the chipidea driver and eventually remove the fsl udc driver, but there were many users of the current driver such as PowerPC and Coldfire platforms besides the i.MX platforms. The support for them with chipidea driver could also be broken for now. I would suggest to have a transitional period that both drivers are kept while new development be based on the new driver. right, right. That can be done as long as 'transitional period' isn't 20 years. At least make a plan to remove fsl udc, if it doesn't happen in the next 4 merge windows, I will remove it myself to force people to reuse other drivers. There is no reason to keep both drivers around. Added Ramneek. What do you think of the current status for chipidea driver on PowerPC platforms? that would be great to know, indeed. -- balbi As per my info, chipidea drv has never been tested for any ppc platforms we have... Also not sure how long chipidea will be used for ppc platforms... Let me get back to you on this -Ramneek -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
Hi, On Fri, Jan 11, 2013 at 05:56:28PM +0800, Peter Chen wrote: It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com this is too big for -rc, can you break it down into smaller pieces ? -- balbi signature.asc Description: Digital signature
Re: [PATCH 07/14] usb: ehci-omap: Instantiate PHY devices if required
On 01/10/2013 10:48 PM, Alan Stern wrote: On Thu, 10 Jan 2013, Roger Quadros wrote: If the OMAP's Host controller is in PHY mode then we instantiate a platform device for the PHY (one for each port in PHY mode) and hold a reference to it so that we can use the usb_phy API, e.g. while suspend/resume. The platform data for the PHY must be supplied in the newly added .phy_config parameter in struct usbhs_omap_platform_data. The end goal is to move the PHY's reset and power handling code out of the ehci-omap driver and into the phy driver. As mentioned in another thread, I would prefer to have these changes to ehci-omap.c made after the driver is converted to the new ehci-hcd is a library scheme. The patch below does the conversion; it is meant to apply on top of the similar patch for ehci-mxc posted recently on the linux-usb mailing list. After this conversion, the omap_ehci_hcd private data structure doesn't have to be allocated specifically. It can be handled in the same way as the private data structure in the ehci-mxc patch. I haven't even tried to compile this. Please let me know how it works. Alan, Thanks for the patch. I've pasted the version that builds and works and put you as the Author of the patch, hope it is fine. I could not find the equivalent ehci-mxc implementation though. Any pointers to that? Thanks. cheers, -roger From fafa9c787bcf2ff3f46c07c045997614d7a8a417 Mon Sep 17 00:00:00 2001 From: Alan Stern st...@rowland.harvard.edu Date: Fri, 11 Jan 2013 12:37:01 +0200 Subject: [PATCH] USB: ehci-omap: Convert to platform driver Convert ehci-omap into a platform driver and use ehci-hcd as a library. CC: Alan Stern st...@rowland.harvard.edu Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/host/Kconfig |2 +- drivers/usb/host/Makefile|1 + drivers/usb/host/ehci-hcd.c |6 +--- drivers/usb/host/ehci-omap.c | 76 +++--- 4 files changed, 37 insertions(+), 48 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index d6bb128..432a463 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -155,7 +155,7 @@ config USB_EHCI_MXC Variation of ARC USB block used in some Freescale chips. config USB_EHCI_HCD_OMAP - bool EHCI support for OMAP3 and later chips + tristate EHCI support for OMAP3 and later chips depends on USB_EHCI_HCD ARCH_OMAP default y ---help--- diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 1eb4c30..8a8d079 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -26,6 +26,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)+= ehci-platform.o +obj-$(CONFIG_USB_EHCI_HCD_OMAP)+= ehci-omap.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index c97503b..c44ef1d 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1260,11 +1260,6 @@ MODULE_LICENSE (GPL); #define PLATFORM_DRIVERehci_hcd_sh_driver #endif -#ifdef CONFIG_USB_EHCI_HCD_OMAP -#include ehci-omap.c -#definePLATFORM_DRIVER ehci_hcd_omap_driver -#endif - #ifdef CONFIG_PPC_PS3 #include ehci-ps3.c #definePS3_SYSTEM_BUS_DRIVER ps3_ehci_driver @@ -1352,6 +1347,7 @@ MODULE_LICENSE (GPL); #if !IS_ENABLED(CONFIG_USB_EHCI_PCI) \ !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) \ + !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) \ !defined(CONFIG_USB_CHIPIDEA_HOST) \ !defined(PLATFORM_DRIVER) \ !defined(PS3_SYSTEM_BUS_DRIVER) \ diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index b96a4bf..6388aa6 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -36,6 +36,9 @@ * - convert to use hwmod and runtime PM */ +#include linux/kernel.h +#include linux/module.h +#include linux/io.h #include linux/platform_device.h #include linux/slab.h #include linux/usb/ulpi.h @@ -43,6 +46,10 @@ #include linux/pm_runtime.h #include linux/gpio.h #include linux/clk.h +#include linux/usb.h +#include linux/usb/hcd.h + +#include ehci.h #include linux/platform_data/usb-omap.h @@ -57,9 +64,11 @@ #defineEHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 #defineEHCI_INSNREG05_ULPI_WRDATA_SHIFT0 -/*-*/ +#define DRIVER_DESC OMAP-EHCI Host Controller driver -static const struct hc_driver ehci_omap_hc_driver; +static const char hcd_name[] = ehci-omap; + +/*-*/ static inline void ehci_write(void __iomem *base, u32 reg, u32 val) @@
Re: [PATCH 07/14] usb: ehci-omap: Instantiate PHY devices if required
On 01/11/2013 12:59 PM, Roger Quadros wrote: On 01/10/2013 10:48 PM, Alan Stern wrote: On Thu, 10 Jan 2013, Roger Quadros wrote: If the OMAP's Host controller is in PHY mode then we instantiate a platform device for the PHY (one for each port in PHY mode) and hold a reference to it so that we can use the usb_phy API, e.g. while suspend/resume. The platform data for the PHY must be supplied in the newly added .phy_config parameter in struct usbhs_omap_platform_data. The end goal is to move the PHY's reset and power handling code out of the ehci-omap driver and into the phy driver. As mentioned in another thread, I would prefer to have these changes to ehci-omap.c made after the driver is converted to the new ehci-hcd is a library scheme. The patch below does the conversion; it is meant to apply on top of the similar patch for ehci-mxc posted recently on the linux-usb mailing list. After this conversion, the omap_ehci_hcd private data structure doesn't have to be allocated specifically. It can be handled in the same way as the private data structure in the ehci-mxc patch. I haven't even tried to compile this. Please let me know how it works. Alan, Thanks for the patch. I've pasted the version that builds and works and put you as the Author of the patch, hope it is fine. I could not find the equivalent ehci-mxc implementation though. Any pointers to that? Thanks. OK I found it. Previously I was searching in the archives :P. 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
Re: [PATCH 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
On Fri, Jan 11, 2013 at 12:56:51PM +0200, Felipe Balbi wrote: Hi, On Fri, Jan 11, 2013 at 05:56:28PM +0800, Peter Chen wrote: It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com this is too big for -rc, can you break it down into smaller pieces ? This is a patch missed from my series that enables multiplatform support for IMX (because the driver is not enabled in defconfig, sorry). To me, it's logically one patch to convert the driver over to use platform_device_id. It does not make much sense to split it. Shawn -- 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: ehci-hcd compile error
On 01/10/2013 10:28 PM, Alan Stern wrote: On Thu, 10 Jan 2013, Felipe Balbi wrote: -ENOROGER :-p On Thu, Jan 10, 2013 at 08:23:56PM +0200, Felipe Balbi wrote: Hi On Thu, Jan 10, 2013 at 12:01:09PM -0500, Alan Stern wrote: On Thu, 10 Jan 2013, Felipe Balbi wrote: Hi, On Thu, Jan 10, 2013 at 10:36:27AM -0500, Alan Stern wrote: On Thu, 10 Jan 2013, Felipe Balbi wrote: Hi Alan, with v3.8-rc3, ehci-hcd fails to compile for ARM if I use allmodconfig: drivers/usb/host/ehci-hcd.c:1285:0: warning: PLATFORM_DRIVER redefined [enabled by default] drivers/usb/host/ehci-hcd.c:1255:0: note: this is the location of the previous definition drivers/usb/host/ehci-mxc.c:280:31: warning: 'ehci_mxc_driver' defined but not used [-Wunused-variable] drivers/usb/host/ehci-hcd.c:1285:0: warning: PLATFORM_DRIVER redefined [enabled by default] drivers/usb/host/ehci-hcd.c:1255:0: note: this is the location of the previous definition Looks like the recent ARM multi-arch patches didn't take into account EHCI-hcd. Do you know why this problem didn't occur in 3.6-rc2? I don't see any changes in -rc3 that would account for it (although I didn't look terribly thoroughly). It's probably there, I just didn't look at it either :-) It seems clear that CONFIG_EHCI_HCD_PLATFORM needs to be mutually exclusive with all the old-style drivers, in order to prevent this sort of conflict. I just don't see why it never came up before... you can't do that as you will break ARM single zImage builds. As you point out below, they are already broken. Now it becomes easy to see why giving ehci its own platform_device/driver would've been a lot easier ;-) Not at all. We merely need to finish the conversion that I started. It should be pretty easy to convert ehci-mxc over to the new scheme. I don't have time to do it right now, but soon... ehci-mxc isn't the only one redefining PLATFORM_DRIVER. All of below are potential offenders: drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_fsl_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_mxc_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_hcd_sh_driver drivers/usb/host/ehci-hcd.c:#definePLATFORM_DRIVER ehci_hcd_omap_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_orion_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_hcd_w90x900_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_atmel_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_octeon_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER vt8500_ehci_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER spear_ehci_hcd_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_msm_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_hcd_tilegx_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_hcd_msp_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER tegra_ehci_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER s5p_ehci_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_grlib_driver drivers/usb/host/ehci-hcd.c:#definePLATFORM_DRIVER ehci_mv_driver drivers/usb/host/ehci-hcd.c:#define PLATFORM_DRIVER ehci_hcd_sead3_driver Yes; those all are old-style drivers. Most of them can be converted to the new scheme with relatively little effort; a few will require more work. In fact, the only drivers that _have_ been converted so far are ehci-pci, chipidea, and ehci-platform. Fair enough... Roger Quadros (now in Cc) can probably help converting ehci-omap to the new scheme if you're willing to provide your review :-) Yes, I saw that and was going to recommend to him that the conversion should be done before his changes are applied. :-) Roger, I'll send you a patch for ehci-omap.c shortly. You should base your work on top of it (after testing to make sure that it works okay). It wouldn't hurt to add some restrictions to the Kconfig entry for CONFIG_USB_EHCI_HCD_PLATFORM too. Ok, maybe add a #warn fix your freaking driver dude!! to the non-converted ones would make people help ? Heh. :-) Here's my attempt to convert ehci-mxc. I don't have any simple way even to compile it. Please try it out to make sure that it fixes the build problem without introducing any other errors. Alan Stern Index: usb-3.7/drivers/usb/host/Kconfig === --- usb-3.7.orig/drivers/usb/host/Kconfig +++ usb-3.7/drivers/usb/host/Kconfig @@ -148,7 +148,7 @@ config USB_EHCI_FSL Variation of ARC USB block used in some Freescale chips.
[Resend PATCH V4 0/10] usb: usb port power off mechanism anc expose usb port connect type
Change since v1: optimize the export connect type patch and adjust the DeviceRemovalbe flag in the rh_call_control() after GetHubDescriptor request being processed. move all debounce operation to usb port's runtime resume callback(). Add did_runtime_put in the struct usb_port to call pm_runtime_get/put(portdev) paired. using pm_runtime_get/put(portdev) to allow or prohibit device to be power off inside of pm qos request in the kernel side. Change since v2: Correct some link breaks. Add did_runtime_put in the usb_disconnect() before calling pm_runtime_put(portdev). Provide two seperate functions usb_device_allow_power_off() and usb_device_prevent_power_off() instead of just one. Change since v3: Set did_runtime_put to false in usb_disconnect() when its value is true Add comment about not enable port runtime pm if fail to expose port's pm qos. and call pm_runtime_set_active(portdev) unconditionally. rename usb_device_allow_prevent_power_off with usb_device_control_power_off Modify be power off to be powered off Expose dev_pm_qos_flags() symbol in order to ensure usb core can compile as module. Resend v4: make patch PM/Qos: Expose dev_pm_qos_flags symbol as first patch to avoid compilation error during git bisect correct some comments. This Patchset is based on usb-next tree commit 102ee001912 Merge tag 'for-usb-next-2013-01-03' This patchset is to add usb port power off mechanism and merge with patchset usb: expose DeviceRemovable to user space via sysfs attribute. Patchset usb: expose DeviceRemovable to user space via sysfs attribute. http://marc.info/?l=linux-usbm=135279430410171w=2 with some link break corrects The main discussion about usb port power off mechanism is in the following link: http://marc.info/?l=linux-usbm=134818340017208w=2 PM/Qos: Expose dev_pm_qos_flags symbol usb: Add driver/usb/core/(port.c,hub.h) files USB: Set usb port's DeviceRemovable according acpi information usb: Add portX/connect_type attribute to expose usb port's connect type usb: Create link files between child device and usb port device. usb: Register usb port's acpi power resources usb: add runtime pm support for usb port device usb: add usb port auto power off mechanism usb: expose usb port's pm qos flags to user space usb: add usb_device_allow_power_off() and usb_device_prevent_power_off() function. -- 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
[Resend PATCH v4 01/10] PM/Qos: Expose dev_pm_qos_flags symbol
The dev_pm_qos_flags() will be used in the usb core which could be compiled as a module. This patch is to export it. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/base/power/qos.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index ff46387..e26b380 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -91,6 +91,7 @@ enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask) return ret; } +EXPORT_SYMBOL(dev_pm_qos_flags); /** * __dev_pm_qos_read_value - Get PM QoS constraint for a given device. -- 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
[Resend PATCH v4 02/10] usb: Add driver/usb/core/(port.c,hub.h) files
This patch is to create driver/usb/core/(port.c,hub.h) files and move usb port related code into port.c. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/Makefile |1 + drivers/usb/core/hub.c| 107 + drivers/usb/core/hub.h| 97 drivers/usb/core/port.c | 66 4 files changed, 165 insertions(+), 106 deletions(-) create mode 100644 drivers/usb/core/hub.h create mode 100644 drivers/usb/core/port.c diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile index 26059b9..5e847ad 100644 --- a/drivers/usb/core/Makefile +++ b/drivers/usb/core/Makefile @@ -7,6 +7,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o usbcore-y += devio.o notify.o generic.o quirks.o devices.o +usbcore-y += port.o usbcore-$(CONFIG_PCI) += hcd-pci.o usbcore-$(CONFIG_ACPI) += usb-acpi.o diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index ae10862..f5caf72 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -30,7 +30,7 @@ #include asm/uaccess.h #include asm/byteorder.h -#include usb.h +#include hub.h /* if we are in debug mode, always announce new devices */ #ifdef DEBUG @@ -42,62 +42,6 @@ #define USB_VENDOR_GENESYS_LOGIC 0x05e3 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 -struct usb_port { - struct usb_device *child; - struct device dev; - struct dev_state *port_owner; - enum usb_port_connect_type connect_type; -}; - -struct usb_hub { - struct device *intfdev; /* the interface device */ - struct usb_device *hdev; - struct kref kref; - struct urb *urb; /* for interrupt polling pipe */ - - /* buffer for urb ... with extra space in case of babble */ - char(*buffer)[8]; - union { - struct usb_hub_status hub; - struct usb_port_status port; - } *status;/* buffer for status reports */ - struct mutexstatus_mutex; /* for the status buffer */ - - int error; /* last reported error */ - int nerrors;/* track consecutive errors */ - - struct list_headevent_list; /* hubs w/data or errs ready */ - unsigned long event_bits[1]; /* status change bitmask */ - unsigned long change_bits[1]; /* ports with logical connect - status change */ - unsigned long busy_bits[1]; /* ports being reset or - resumed */ - unsigned long removed_bits[1]; /* ports with a removed - device present */ - unsigned long wakeup_bits[1]; /* ports that have signaled - remote wakeup */ -#if USB_MAXCHILDREN 31 /* 8*sizeof(unsigned long) - 1 */ -#error event_bits[] is too short! -#endif - - struct usb_hub_descriptor *descriptor; /* class descriptor */ - struct usb_tt tt; /* Transaction Translator */ - - unsignedmA_per_port;/* current for each child */ - - unsignedlimited_power:1; - unsignedquiescing:1; - unsigneddisconnected:1; - - unsignedquirk_check_port_auto_suspend:1; - - unsignedhas_indicators:1; - u8 indicator[USB_MAXCHILDREN]; - struct delayed_work leds; - struct delayed_work init_work; - struct usb_port **ports; -}; - static inline int hub_is_superspeed(struct usb_device *hdev) { return (hdev-descriptor.bDeviceProtocol == USB_HUB_PR_SS); @@ -168,9 +112,6 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); #define HUB_DEBOUNCE_STEP25 #define HUB_DEBOUNCE_STABLE 100 -#define to_usb_port(_dev) \ - container_of(_dev, struct usb_port, dev) - static int usb_reset_and_verify_device(struct usb_device *udev); static inline char *portspeed(struct usb_hub *hub, int portstatus) @@ -1294,52 +1235,6 @@ static int hub_post_reset(struct usb_interface *intf) return 0; } -static void usb_port_device_release(struct device *dev) -{ - struct usb_port *port_dev = to_usb_port(dev); - - kfree(port_dev); -} - -static void usb_hub_remove_port_device(struct usb_hub *hub, - int port1) -{ - device_unregister(hub-ports[port1 - 1]-dev); -} - -struct device_type usb_port_device_type = { - .name = usb_port, -
[Resend PATCH v4 04/10] usb: Add portX/connect_type attribute to expose usb port's connect type
Some platforms provide usb port connect types through ACPI. This patch is to add this new attribute to expose these information to user space. Signed-off-by: Lan Tianyu tianyu@intel.com --- Documentation/ABI/testing/sysfs-bus-usb |9 +++ drivers/usb/core/port.c | 43 +++ 2 files changed, 52 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index b6fbe51..c8baaf5 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb @@ -227,3 +227,12 @@ Contact: Lan Tianyu tianyu@intel.com Description: The /sys/bus/usb/devices/.../(hub interface)/portX is usb port device's sysfs directory. + +What: /sys/bus/usb/devices/.../(hub interface)/portX/connect_type +Date: January 2013 +Contact: Lan Tianyu tianyu@intel.com +Description: + Some platforms provide usb port connect types through ACPI. + This attribute is to expose these information to user space. + The file will read hotplug, wired and not used if the + information is available, and unknown otherwise. diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 2bc1cef..824e90b 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -18,6 +18,48 @@ #include hub.h +static const struct attribute_group *port_dev_group[]; + +static ssize_t show_port_connect_type(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct usb_port *port_dev = to_usb_port(dev); + char *result; + + switch (port_dev-connect_type) { + case USB_PORT_CONNECT_TYPE_HOT_PLUG: + result = hotplug; + break; + case USB_PORT_CONNECT_TYPE_HARD_WIRED: + result = hardwired; + break; + case USB_PORT_NOT_USED: + result = not used; + break; + default: + result = unknown; + break; + } + + return sprintf(buf, %s\n, result); +} +static DEVICE_ATTR(connect_type, S_IRUGO, show_port_connect_type, + NULL); + +static struct attribute *port_dev_attrs[] = { + dev_attr_connect_type.attr, + NULL, +}; + +static struct attribute_group port_dev_attr_grp = { + .attrs = port_dev_attrs, +}; + +static const struct attribute_group *port_dev_group[] = { + port_dev_attr_grp, + NULL, +}; + static void usb_port_device_release(struct device *dev) { struct usb_port *port_dev = to_usb_port(dev); @@ -43,6 +85,7 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) hub-ports[port1 - 1] = port_dev; port_dev-dev.parent = hub-intfdev; + port_dev-dev.groups = port_dev_group; port_dev-dev.type = usb_port_device_type; dev_set_name(port_dev-dev, port%d, port1); -- 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
[Resend PATCH v4 05/10] usb: Create link files between child device and usb port device.
To show the relationship between usb port and child device, add link file port under usb device's sysfs directoy and device under usb port device's sysfs directory. They are linked to each other. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 7a893b0..05bdb04 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1978,6 +1978,14 @@ void usb_disconnect(struct usb_device **pdev) usb_disable_device(udev, 0); usb_hcd_synchronize_unlinks(udev); + if (udev-parent) { + struct usb_port *port_dev = + hdev_to_hub(udev-parent)-ports[udev-portnum - 1]; + + sysfs_remove_link(udev-dev.kobj, port); + sysfs_remove_link(port_dev-dev.kobj, device); + } + usb_remove_ep_devs(udev-ep0); usb_unlock_device(udev); @@ -2270,6 +2278,24 @@ int usb_new_device(struct usb_device *udev) goto fail; } + /* Create link files between child device and usb port device. */ + if (udev-parent) { + struct usb_port *port_dev = + hdev_to_hub(udev-parent)-ports[udev-portnum - 1]; + + err = sysfs_create_link(udev-dev.kobj, + port_dev-dev.kobj, port); + if (err) + goto fail; + + err = sysfs_create_link(port_dev-dev.kobj, + udev-dev.kobj, device); + if (err) { + sysfs_remove_link(udev-dev.kobj, port); + goto fail; + } + } + (void) usb_create_ep_devs(udev-dev, udev-ep0, udev); usb_mark_last_busy(udev); pm_runtime_put_sync_autosuspend(udev-dev); -- 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
[Resend PATCH v4 03/10] USB: Set usb port's DeviceRemovable according acpi information
ACPI provide _PLD and _UPC aml methods to describe usb port visibility and connectability. This patch is to add usb_hub_adjust_DeviceRemovable() to adjust usb hub port's DeviceRemovable according ACPI information and invoke it in the rh_call_control(). When hub descriptor request is issued at first time, usb port device isn't created and usb port is not bound with acpi. So first hub descriptor request is not changed based on ACPI information. After usb port devices being created, call usb_hub_adjust_DeviceRemovable in the hub_configure() and then set hub port's DeviceRemovable according ACPI information and this also works for non-root hub. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hcd.c |4 drivers/usb/core/hub.c | 48 drivers/usb/core/usb.h |3 +++ 3 files changed, 55 insertions(+) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 4225d5e..6687302 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -619,6 +619,10 @@ nongeneric: status = hcd-driver-hub_control (hcd, typeReq, wValue, wIndex, tbuf, wLength); + + if (typeReq == GetHubDescriptor) + usb_hub_adjust_deviceremovable(hcd-self.root_hub, + (struct usb_hub_descriptor *)tbuf); break; error: /* protocol stall on error */ diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index f5caf72..7a893b0 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1500,6 +1500,8 @@ static int hub_configure(struct usb_hub *hub, dev_err(hub-intfdev, couldn't create port%d device.\n, i + 1); + usb_hub_adjust_deviceremovable(hdev, hub-descriptor); + hub_activate(hub, HUB_INIT); return 0; @@ -5162,6 +5164,52 @@ usb_get_hub_port_connect_type(struct usb_device *hdev, int port1) return hub-ports[port1 - 1]-connect_type; } +void usb_hub_adjust_deviceremovable(struct usb_device *hdev, + struct usb_hub_descriptor *desc) +{ + enum usb_port_connect_type connect_type; + int i; + + if (!hub_is_superspeed(hdev)) { + for (i = 1; i = hdev-maxchild; i++) { + connect_type = + usb_get_hub_port_connect_type(hdev, i); + + if (connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) { + u8 mask = 1 (i%8); + + if (!(desc-u.hs.DeviceRemovable[i/8] mask)) { + dev_dbg(hdev-dev, usb port%d's DeviceRemovable is changed to 1 according to platform information.\n, + i); + desc-u.hs.DeviceRemovable[i/8] + |= mask; + } + } + } + } else { + u16 port_removable = + le16_to_cpu(desc-u.ss.DeviceRemovable); + + for (i = 1; i = hdev-maxchild; i++) { + connect_type = + usb_get_hub_port_connect_type(hdev, i); + + if (connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) { + u16 mask = 1 i; + + if (!(port_removable mask)) { + dev_dbg(hdev-dev, usb port%d's DeviceRemovable is changed to 1 according to platform information.\n, + i); + port_removable |= mask; + } + } + } + + desc-u.ss.DeviceRemovable = + cpu_to_le16(port_removable); + } +} + #ifdef CONFIG_ACPI /** * usb_get_hub_port_acpi_handle - Get the usb port's acpi handle diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 1c528c1..3f18f2d 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -1,5 +1,6 @@ #include linux/pm.h #include linux/acpi.h +#include linux/usb/ch11.h struct dev_state; @@ -173,6 +174,8 @@ extern enum usb_port_connect_type usb_get_hub_port_connect_type(struct usb_device *hdev, int port1); extern void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1, enum usb_port_connect_type type); +extern void usb_hub_adjust_deviceremovable(struct usb_device *hdev, + struct usb_hub_descriptor *desc); #ifdef CONFIG_ACPI extern int usb_acpi_register(void); -- 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
[Resend PATCH v4 06/10] usb: Register usb port's acpi power resources
This patch is to register usb port's acpi power resources. Create link between usb port device and its acpi power resource. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/port.c |3 +++ drivers/usb/core/usb-acpi.c | 20 drivers/usb/core/usb.h |6 ++ 3 files changed, 29 insertions(+) diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 824e90b..2365d5e 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -64,6 +64,7 @@ static void usb_port_device_release(struct device *dev) { struct usb_port *port_dev = to_usb_port(dev); + usb_acpi_unregister_power_resources(dev); kfree(port_dev); } @@ -93,6 +94,8 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) if (retval) goto error_register; + usb_acpi_register_power_resources(port_dev-dev); + return 0; error_register: diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index cef4252..558ab01 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c @@ -216,6 +216,26 @@ static struct acpi_bus_type usb_acpi_bus = { .find_device = usb_acpi_find_device, }; +int usb_acpi_register_power_resources(struct device *dev) +{ + acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev); + + if (!port_handle) + return -ENODEV; + + if (acpi_power_resource_register_device(dev, port_handle) 0) + return -ENODEV; + return 0; +} + +void usb_acpi_unregister_power_resources(struct device *dev) +{ + acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev); + + if (port_handle) + acpi_power_resource_unregister_device(dev, port_handle); +} + int usb_acpi_register(void) { return register_acpi_bus_type(usb_acpi_bus); diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 3f18f2d..386f562 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -182,7 +182,13 @@ extern int usb_acpi_register(void); extern void usb_acpi_unregister(void); extern acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, int port1); +extern int usb_acpi_register_power_resources(struct device *dev); +extern void usb_acpi_unregister_power_resources(struct device *dev); #else static inline int usb_acpi_register(void) { return 0; }; static inline void usb_acpi_unregister(void) { }; +static inline int usb_acpi_register_power_resources(struct usb_device *udev) + { return 0; }; +static inline int usb_acpi_unregister_power_resources(struct usb_device *udev) + { }; #endif -- 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
[Resend PATCH v4 07/10] usb: add runtime pm support for usb port device
This patch is to add runtime pm callback for usb port device. Set/clear PORT_POWER feature in the resume/suspend callbak. Add portnum for struct usb_port to record port number. Do pm_rumtime_get_sync/put(portdev) when a device is plugged/unplugged to prevent it from being powered off when it is active. Acked-by: Rafael J. Wysocki rafael.j.wyso...@intel.com Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c | 18 ++ drivers/usb/core/hub.h |4 drivers/usb/core/port.c | 43 +++ 3 files changed, 65 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 05bdb04..a0dfdc5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -714,6 +714,18 @@ static void hub_tt_work(struct work_struct *work) spin_unlock_irqrestore (hub-tt.lock, flags); } +int usb_hub_set_port_power(struct usb_device *hdev, int port1, + bool set) +{ + int ret; + + if (set) + ret = set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); + else + ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_POWER); + return ret; +} + /** * usb_hub_clear_tt_buffer - clear control/bulk TT state in high speed hub * @urb: an URB associated with the failed or incomplete split transaction @@ -1556,6 +1568,7 @@ static void hub_disconnect(struct usb_interface *intf) kfree(hub-status); kfree(hub-buffer); + pm_suspend_ignore_children(intf-dev, false); kref_put(hub-kref, hub_release); } @@ -1658,6 +1671,7 @@ descriptor_error: usb_set_intfdata (intf, hub); intf-needs_remote_wakeup = 1; + pm_suspend_ignore_children(intf-dev, true); if (hdev-speed == USB_SPEED_HIGH) highspeed_hubs++; @@ -1984,6 +1998,8 @@ void usb_disconnect(struct usb_device **pdev) sysfs_remove_link(udev-dev.kobj, port); sysfs_remove_link(port_dev-dev.kobj, device); + + pm_runtime_put(port_dev-dev); } usb_remove_ep_devs(udev-ep0); @@ -2294,6 +2310,8 @@ int usb_new_device(struct usb_device *udev) sysfs_remove_link(udev-dev.kobj, port); goto fail; } + + pm_runtime_get_sync(port_dev-dev); } (void) usb_create_ep_devs(udev-dev, udev-ep0, udev); diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index d16a7c9..8ea6bc8 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -79,12 +79,14 @@ struct usb_hub { * @dev: generic device interface * @port_owner: port's owner * @connect_type: port's connect type + * @portnum: port index num based one */ struct usb_port { struct usb_device *child; struct device dev; struct dev_state *port_owner; enum usb_port_connect_type connect_type; + u8 portnum; }; #define to_usb_port(_dev) \ @@ -94,4 +96,6 @@ extern int usb_hub_create_port_device(struct usb_hub *hub, int port1); extern void usb_hub_remove_port_device(struct usb_hub *hub, int port1); +extern int usb_hub_set_port_power(struct usb_device *hdev, + int port1, bool set); diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 2365d5e..a966596 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -17,6 +17,7 @@ */ #include hub.h +#include linux/pm_qos.h static const struct attribute_group *port_dev_group[]; @@ -68,9 +69,48 @@ static void usb_port_device_release(struct device *dev) kfree(port_dev); } +static int usb_port_runtime_resume(struct device *dev) +{ + struct usb_port *port_dev = to_usb_port(dev); + struct usb_device *hdev = to_usb_device(dev-parent-parent); + struct usb_interface *intf = to_usb_interface(dev-parent); + int retval; + + usb_autopm_get_interface(intf); + retval = usb_hub_set_port_power(hdev, port_dev-portnum, true); + usb_autopm_put_interface(intf); + return retval; +} + +static int usb_port_runtime_suspend(struct device *dev) +{ + struct usb_port *port_dev = to_usb_port(dev); + struct usb_device *hdev = to_usb_device(dev-parent-parent); + struct usb_interface *intf = to_usb_interface(dev-parent); + int retval; + + if (dev_pm_qos_flags(port_dev-dev, PM_QOS_FLAG_NO_POWER_OFF) + == PM_QOS_FLAGS_ALL) + return -EAGAIN; + + usb_autopm_get_interface(intf); + retval = usb_hub_set_port_power(hdev, port_dev-portnum, false); + usb_autopm_put_interface(intf); + return retval; +} + +static const struct dev_pm_ops usb_port_pm_ops = { +#ifdef CONFIG_USB_SUSPEND + .runtime_suspend = usb_port_runtime_suspend, + .runtime_resume = usb_port_runtime_resume, + .runtime_idle = pm_generic_runtime_idle, +#endif +}; + struct
[Resend PATCH v4 08/10] usb: add usb port auto power off mechanism
This patch is to add usb port auto power off mechanism. When usb device is suspending, usb core will suspend usb port and usb port runtime pm callback will clear PORT_POWER feature to power off port if all conditions were met. These conditions are remote wakeup disable, pm qos NO_POWER_OFF flag clear and persist enable. When it resumes, power on port again. Add did_runtime_put in the struct usb_port in order to call pm_runtime_get/put(portdev) paired during suspending and resuming. Acked-by: Rafael J. Wysocki rafael.j.wyso...@intel.com Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/hub.c | 65 --- drivers/usb/core/hub.h |9 +++ drivers/usb/core/port.c | 40 +++-- 3 files changed, 103 insertions(+), 11 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index a0dfdc5..c81d374 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -26,6 +26,7 @@ #include linux/mutex.h #include linux/freezer.h #include linux/random.h +#include linux/pm_qos.h #include asm/uaccess.h #include asm/byteorder.h @@ -108,7 +109,7 @@ MODULE_PARM_DESC(use_both_schemes, DECLARE_RWSEM(ehci_cf_port_reset_rwsem); EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); -#define HUB_DEBOUNCE_TIMEOUT 1500 +#define HUB_DEBOUNCE_TIMEOUT 2000 #define HUB_DEBOUNCE_STEP25 #define HUB_DEBOUNCE_STABLE 100 @@ -127,7 +128,7 @@ static inline char *portspeed(struct usb_hub *hub, int portstatus) } /* Note that hdev or one of its children must be locked! */ -static struct usb_hub *hdev_to_hub(struct usb_device *hdev) +struct usb_hub *hdev_to_hub(struct usb_device *hdev) { if (!hdev || !hdev-actconfig || !hdev-maxchild) return NULL; @@ -393,7 +394,7 @@ static int clear_hub_feature(struct usb_device *hdev, int feature) /* * USB 2.0 spec Section 11.24.2.2 */ -static int clear_port_feature(struct usb_device *hdev, int port1, int feature) +int clear_port_feature(struct usb_device *hdev, int port1, int feature) { return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port1, @@ -718,11 +719,16 @@ int usb_hub_set_port_power(struct usb_device *hdev, int port1, bool set) { int ret; + struct usb_hub *hub = hdev_to_hub(hdev); + struct usb_port *port_dev = hub-ports[port1 - 1]; if (set) ret = set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); else ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_POWER); + + if (!ret) + port_dev-power_is_on = set; return ret; } @@ -802,7 +808,11 @@ static unsigned hub_power_on(struct usb_hub *hub, bool do_delay) dev_dbg(hub-intfdev, trying to enable port power on non-switchable hub\n); for (port1 = 1; port1 = hub-descriptor-bNbrPorts; port1++) - set_port_feature(hub-hdev, port1, USB_PORT_FEAT_POWER); + if (hub-ports[port1 - 1]-power_is_on) + set_port_feature(hub-hdev, port1, USB_PORT_FEAT_POWER); + else + clear_port_feature(hub-hdev, port1, + USB_PORT_FEAT_POWER); /* Wait at least 100 msec for power to become stable */ delay = max(pgood_delay, (unsigned) 100); @@ -1134,10 +1144,16 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) set_bit(port1, hub-change_bits); } else if (udev-persist_enabled) { + struct usb_port *port_dev = hub-ports[port1 - 1]; + #ifdef CONFIG_PM udev-reset_resume = 1; #endif - set_bit(port1, hub-change_bits); + /* Don't set the change_bits when the device +* was powered off. +*/ + if (port_dev-power_is_on) + set_bit(port1, hub-change_bits); } else { /* The power session is gone; tell khubd */ @@ -1999,7 +2015,10 @@ void usb_disconnect(struct usb_device **pdev) sysfs_remove_link(udev-dev.kobj, port); sysfs_remove_link(port_dev-dev.kobj, device); - pm_runtime_put(port_dev-dev); + if (!port_dev-did_runtime_put) + pm_runtime_put(port_dev-dev); + else + port_dev-did_runtime_put = false; } usb_remove_ep_devs(udev-ep0); @@ -2831,6 +2850,7 @@ EXPORT_SYMBOL_GPL(usb_enable_ltm); int usb_port_suspend(struct usb_device *udev, pm_message_t msg) { struct usb_hub *hub = hdev_to_hub(udev-parent); + struct usb_port *port_dev = hub-ports[udev-portnum - 1]; int
[Resend PATCH v4 10/10] usb: add usb_device_allow_power_off() and usb_device_prevent_power_off() function.
Some usb devices can't be resumed correctly after power off. This patch is to add usb_device_allow_power_off() and usb_device_prevent_power_off() for device's driver. Call pm_runtime_get_sync(portdev) to increase port's usage count and then port will not be suspended. The device will not be powered off. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/port.c | 28 include/linux/usb.h | 12 2 files changed, 40 insertions(+) diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index a44523e..1b1c95e 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -18,9 +18,37 @@ #include hub.h #include linux/pm_qos.h +#include linux/module.h static const struct attribute_group *port_dev_group[]; +/** + * usb_device_control_power_off - Allow or prohibit power off device. + * @udev: target usb device + * @allow: choice of allow or prohibit + * + * Call pm_runtime_get/put_sync(portdev) to allow or prohibit target + * usb device to be powered off in the kernel. The operations of setting + * true and false should be couple. The default status is allowed. + */ +int usb_device_control_power_off(struct usb_device *udev, bool allow) +{ + struct usb_port *port_dev; + + if (!udev-parent) + return -EINVAL; + + port_dev = hdev_to_hub(udev-parent)-ports[udev-portnum - 1]; + + if (allow) + pm_runtime_put_sync(port_dev-dev); + else + pm_runtime_get_sync(port_dev-dev); + + return 0; +} +EXPORT_SYMBOL_GPL(usb_device_control_power_off); + static ssize_t show_port_connect_type(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/include/linux/usb.h b/include/linux/usb.h index 689b14b..db1bac2 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -581,6 +581,18 @@ extern struct usb_device *usb_get_dev(struct usb_device *dev); extern void usb_put_dev(struct usb_device *dev); extern struct usb_device *usb_hub_find_child(struct usb_device *hdev, int port1); +extern int usb_device_control_power_off(struct usb_device *udev, + bool allow); + +static inline int usb_device_allow_power_off(struct usb_device *udev) +{ + return usb_device_control_power_off(udev, true); +} + +static inline int usb_device_prevent_power_off(struct usb_device *udev) +{ + return usb_device_control_power_off(udev, false); +} /** * usb_hub_for_each_child - iterate over all child devices on the hub -- 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
[Resend PATCH v4 09/10] usb: expose usb port's pm qos flags to user space
This patch is to expose usb port's pm qos flags(pm_qos_no_power_off, pm_qos_remote_wakeup) to user space. User can set pm_qos_no_power_off flag to prohibit the port from being powered off. Signed-off-by: Lan Tianyu tianyu@intel.com --- drivers/usb/core/port.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 77400f8..a44523e 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -65,6 +65,7 @@ static void usb_port_device_release(struct device *dev) { struct usb_port *port_dev = to_usb_port(dev); + dev_pm_qos_hide_flags(dev); usb_acpi_unregister_power_resources(dev); kfree(port_dev); } @@ -172,7 +173,15 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) goto error_register; pm_runtime_set_active(port_dev-dev); - pm_runtime_enable(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. +*/ + if (!dev_pm_qos_expose_flags(port_dev-dev, + PM_QOS_FLAG_NO_POWER_OFF)) + pm_runtime_enable(port_dev-dev); + usb_acpi_register_power_resources(port_dev-dev); return 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
Verificación de su cuenta de correo
Su buzón ha superado el límite de 2 GB de almacenamiento también se define por su administrador, son 2.30GB correr, no puede ser capaz de enviar o recibir nuevos mensajes hasta que se confirme su buzón. Para volver a validar su buzón de correo. hacer haga clic en el enlace de abajo: https://docs.google.com/spreadsheet/viewform?formkey=dGVSWDFhRjd5Q1hIZWdFVlhnWU0tbFE6MQ System Manager MR Fernando Andrés (webmail Administrador) -- 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/4] usb: phy: samsung: Add host phy support to samsung-phy driver
Hi Doug, Sorry!! for the delayed response. On Thu, Dec 20, 2012 at 4:31 AM, Doug Anderson diand...@chromium.org wrote: Vivek, I don't really have a good 1 foot view about how all of the USB bits fit together, but a few detail-oriented comments below. On Tue, Dec 18, 2012 at 6:43 AM, Vivek Gautam gautam.vi...@samsung.com wrote: This patch adds host phy support to samsung-usbphy.c and further adds support for samsung's exynos5250 usb-phy. Signed-off-by: Praveen Paneri p.pan...@samsung.com Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- .../devicetree/bindings/usb/samsung-usbphy.txt | 25 +- drivers/usb/phy/Kconfig|2 +- drivers/usb/phy/samsung-usbphy.c | 465 ++-- include/linux/usb/samsung_usb_phy.h| 13 + 4 files changed, 454 insertions(+), 51 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt index a7b28b2..2ec5400 100644 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -1,23 +1,38 @@ * Samsung's usb phy transceiver -The Samsung's phy transceiver is used for controlling usb otg phy for -s3c-hsotg usb device controller. +The Samsung's phy transceiver is used for controlling usb phy for +s3c-hsotg as well as ehci-s5p and ohci-exynos usb controllers +across Samsung SOCs. TODO: Adding the PHY binding with controller(s) according to the under developement generic PHY driver. Required properties: + +Exynos4210: - compatible : should be samsung,exynos4210-usbphy - reg : base physical address of the phy registers and length of memory mapped region. +Exynos5250: +- compatible : should be samsung,exynos5250-usbphy +- reg : base physical address of the phy registers and length of memory mapped + region. + Optional properties: - samsung,usb-phyhandle : should point to usb-phyhandle sub-node which provides binding data to enable/disable device PHY handled by - PMU register. + PMU register; or to configure usb2.0 phy handled by + SYSREG. Required properties: - compatible : should be samsung,usbdev-phyctrl for - DEVICE type phy. + DEVICE type phy; or + should be samsung,usbhost-phyctrl for + HOST type phy; or + should be samsung,usb-phycfg for + USB2.0 PHY_CFG. - samsung,phyhandle-reg: base physical address of - PHY_CONTROL register in PMU. +PHY_CONTROL register in PMU; +or USB2.0 PHY_CFG register +in SYSREG. - samsung,enable-mask : should be '1' diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 17ad743..13c0eaf 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -47,7 +47,7 @@ config USB_RCAR_PHY config SAMSUNG_USBPHY bool Samsung USB PHY controller Driver - depends on USB_S3C_HSOTG + depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS select USB_OTG_UTILS help Enable this to support Samsung USB phy controller for samsung diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c index 4ceabe3..621348a 100644 --- a/drivers/usb/phy/samsung-usbphy.c +++ b/drivers/usb/phy/samsung-usbphy.c @@ -5,7 +5,8 @@ * * Author: Praveen Paneri p.pan...@samsung.com * - * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller + * Samsung USB-PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and + * OHCI-EXYNOS controllers. * * 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 @@ -24,7 +25,7 @@ #include linux/err.h #include linux/io.h #include linux/of.h -#include linux/usb/otg.h +#include linux/usb/samsung_usb_phy.h #include linux/platform_data/samsung-usbphy.h /* Register definitions */ @@ -56,6 +57,103 @@ #define RSTCON_HLINK_SWRST (0x1 1) #define RSTCON_SWRST (0x1 0) +/* EXYNOS5 */ +#define EXYNOS5_PHY_HOST_CTRL0 (0x00) + +#define HOST_CTRL0_PHYSWRSTALL (0x1 31) + +#define HOST_CTRL0_REFCLKSEL_MASK (0x3) +#define HOST_CTRL0_REFCLKSEL_XTAL (0x0 19) +#define HOST_CTRL0_REFCLKSEL_EXTL
Re: [PATCH 1/1] usb: fsl-mxc-udc: fix build error due to mach/hardware.h
Hi, On Fri, Jan 11, 2013 at 05:56:28PM +0800, Peter Chen wrote: It changes the driver to use platform_device_id rather than cpu_is_xxx to determine the SoC type, and updates the platform code accordingly. Compile ok at imx_v6_v7_defconfig with CONFIG_USB_FSL_USB2 enable. Tested at mx51 bbg board, it works ok after enable phy clock (Need another patch to fix this problem) Signed-off-by: Peter Chen peter.c...@freescale.com --- arch/arm/mach-imx/clk-imx25.c |6 +- arch/arm/mach-imx/clk-imx27.c |6 +- arch/arm/mach-imx/clk-imx31.c |6 +- arch/arm/mach-imx/clk-imx35.c |6 +- arch/arm/mach-imx/clk-imx51-imx53.c |6 +- arch/arm/mach-imx/devices/devices-common.h|1 + arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c | 15 +++--- drivers/usb/gadget/fsl_mxc_udc.c | 17 +++ drivers/usb/gadget/fsl_udc_core.c | 52 +--- drivers/usb/gadget/fsl_usb2_udc.h | 13 -- include/linux/fsl_devices.h |8 +++ 11 files changed, 82 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index b197aa7..67e353d 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_ahb], ahb, mxc-ehci.2); clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_ahb], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx25); + clk_register_clkdev(clk[usbotg_ahb], ahb, imx-udc-mx25); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx25); clk_register_clkdev(clk[nfc_ipg_per], NULL, imx25-nand.0); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, imx35-cspi.0); diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 4c1d1e4..1ffe3b5 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], ahb, imx21-fb.0); clk_register_clkdev(clk[csi_ahb_gate], ahb, imx27-camera.0); clk_register_clkdev(clk[per4_gate], per, imx27-camera.0); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ipg_gate], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usb_ahb_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx27); + clk_register_clkdev(clk[usb_ipg_gate], ipg, imx-udc-mx27); + clk_register_clkdev(clk[usb_ahb_gate], ahb, imx-udc-mx27); clk_register_clkdev(clk[usb_div], per, mxc-ehci.0); clk_register_clkdev(clk[usb_ipg_gate], ipg, mxc-ehci.0); clk_register_clkdev(clk[usb_ahb_gate], ahb, mxc-ehci.0); diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index 8be64e0..ef66eaf 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], per, mxc-ehci.2); clk_register_clkdev(clk[usb_gate], ahb, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); - clk_register_clkdev(clk[usb_div_post], per, fsl-usb2-udc); - clk_register_clkdev(clk[usb_gate], ahb, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div_post], per, imx-udc-mx31); + clk_register_clkdev(clk[usb_gate], ahb, imx-udc-mx31); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx31); clk_register_clkdev(clk[csi_gate], NULL, mx3-camera.0); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], per, imx21-uart.0); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 66f3d65..69fe9c8 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], per, mxc-ehci.2); clk_register_clkdev(clk[ipg], ipg, mxc-ehci.2); clk_register_clkdev(clk[usbotg_gate], ahb, mxc-ehci.2); - clk_register_clkdev(clk[usb_div], per, fsl-usb2-udc); - clk_register_clkdev(clk[ipg], ipg, fsl-usb2-udc); - clk_register_clkdev(clk[usbotg_gate], ahb, fsl-usb2-udc); + clk_register_clkdev(clk[usb_div], per, imx-udc-mx35); + clk_register_clkdev(clk[ipg], ipg, imx-udc-mx35); + clk_register_clkdev(clk[usbotg_gate], ahb, imx-udc-mx35); clk_register_clkdev(clk[wdog_gate], NULL, imx2-wdt.0);
Re: [PATCH v5 2/4] usb: phy: samsung: Add host phy support to samsung-phy driver
Hi, On Fri, Jan 11, 2013 at 06:10:48PM +0530, Vivek Gautam wrote: Hi Doug, Sorry!! for the delayed response. On Thu, Dec 20, 2012 at 4:31 AM, Doug Anderson diand...@chromium.org wrote: Vivek, I don't really have a good 1 foot view about how all of the USB bits fit together, but a few detail-oriented comments below. On Tue, Dec 18, 2012 at 6:43 AM, Vivek Gautam gautam.vi...@samsung.com wrote: This patch adds host phy support to samsung-usbphy.c and further adds support for samsung's exynos5250 usb-phy. Signed-off-by: Praveen Paneri p.pan...@samsung.com Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- .../devicetree/bindings/usb/samsung-usbphy.txt | 25 +- drivers/usb/phy/Kconfig|2 +- drivers/usb/phy/samsung-usbphy.c | 465 ++-- include/linux/usb/samsung_usb_phy.h| 13 + 4 files changed, 454 insertions(+), 51 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt index a7b28b2..2ec5400 100644 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -1,23 +1,38 @@ * Samsung's usb phy transceiver -The Samsung's phy transceiver is used for controlling usb otg phy for -s3c-hsotg usb device controller. +The Samsung's phy transceiver is used for controlling usb phy for +s3c-hsotg as well as ehci-s5p and ohci-exynos usb controllers +across Samsung SOCs. TODO: Adding the PHY binding with controller(s) according to the under developement generic PHY driver. Required properties: + +Exynos4210: - compatible : should be samsung,exynos4210-usbphy - reg : base physical address of the phy registers and length of memory mapped region. +Exynos5250: +- compatible : should be samsung,exynos5250-usbphy +- reg : base physical address of the phy registers and length of memory mapped + region. + Optional properties: - samsung,usb-phyhandle : should point to usb-phyhandle sub-node which provides binding data to enable/disable device PHY handled by - PMU register. + PMU register; or to configure usb2.0 phy handled by + SYSREG. Required properties: - compatible : should be samsung,usbdev-phyctrl for - DEVICE type phy. + DEVICE type phy; or + should be samsung,usbhost-phyctrl for + HOST type phy; or + should be samsung,usb-phycfg for + USB2.0 PHY_CFG. - samsung,phyhandle-reg: base physical address of - PHY_CONTROL register in PMU. +PHY_CONTROL register in PMU; +or USB2.0 PHY_CFG register +in SYSREG. - samsung,enable-mask : should be '1' diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 17ad743..13c0eaf 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -47,7 +47,7 @@ config USB_RCAR_PHY config SAMSUNG_USBPHY bool Samsung USB PHY controller Driver - depends on USB_S3C_HSOTG + depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS select USB_OTG_UTILS help Enable this to support Samsung USB phy controller for samsung diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c index 4ceabe3..621348a 100644 --- a/drivers/usb/phy/samsung-usbphy.c +++ b/drivers/usb/phy/samsung-usbphy.c @@ -5,7 +5,8 @@ * * Author: Praveen Paneri p.pan...@samsung.com * - * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller + * Samsung USB-PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and + * OHCI-EXYNOS controllers. * * 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 @@ -24,7 +25,7 @@ #include linux/err.h #include linux/io.h #include linux/of.h -#include linux/usb/otg.h +#include linux/usb/samsung_usb_phy.h #include linux/platform_data/samsung-usbphy.h /* Register definitions */ @@ -56,6 +57,103 @@ #define RSTCON_HLINK_SWRST (0x1 1) #define RSTCON_SWRST (0x1 0) +/* EXYNOS5 */ +#define EXYNOS5_PHY_HOST_CTRL0 (0x00) + +#define
Re: [PATCH RFC] usb: dwc3: Remove dwc3 dependency on gadget.
Hi Felipe, On Thu, Jan 10, 2013 at 6:32 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Mon, Dec 24, 2012 at 07:28:33PM +0530, Vivek Gautam wrote: DWC3 controller curretly depends on CONFIG_USB and CONFIG_USB_GADGET. Some hardware may like to use only host feature on dwc3. So, removing the dependency of USB_DWC3 on USB_GADGET and further modulating the dwc3 core to enable gadget features only with USB_GADGET. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com CC: Doug Anderson diand...@chromium.org right, right... Eventually we need to do it, but you're only making gadget side optional. Host side should be optional too, but then you need to make sure we don't build dwc3 without gadget and host. Yes, true we need to make host side also optional, build dwc3 only when either of host or gadget are built. Maybe make a mode selection for Host-only, Peripheral-only, Dual-Role Device ?? True this will be good idea to use modes: host only, gadget only or dual role. May be the platform glue layers can use them later to put the controller in a specific mode ? More comments below... diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index f6a6e07..b70dcf1 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -1,7 +1,7 @@ config USB_DWC3 tristate DesignWare USB3 DRD Core Support - depends on (USB USB_GADGET) - select USB_OTG_UTILS + depends on USB + select USB_OTG_UTILS if USB_GADGET we want USB_OTG_UTILS also on host-only builds because host side, eventually, will have to learn how to control its PHYs. Ok. select USB_XHCI_PLATFORM if USB_SUPPORT USB_XHCI_HCD help Say Y or M here if your system has a Dual Role SuperSpeed diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile index 4502648..8f469cb 100644 --- a/drivers/usb/dwc3/Makefile +++ b/drivers/usb/dwc3/Makefile @@ -5,7 +5,7 @@ obj-$(CONFIG_USB_DWC3)+= dwc3.o dwc3-y := core.o dwc3-y += host.o -dwc3-y += gadget.o ep0.o +obj-$(CONFIG_USB_GADGET) += gadget.o ep0.o this is wrong. CONFIG_USB_GADGET is tristate, so this should be: ifneq($(CONFIG_USB_GADGET),) dwc3-y += gadget.o ep0.o endif or something similar True, missed taking into account that CONFIG_USB_GADGET is tristate :-( Will amend this as suggested. diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4999563..4dc7ef2 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -865,7 +865,14 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc); int dwc3_host_init(struct dwc3 *dwc); void dwc3_host_exit(struct dwc3 *dwc); +#ifdef CONFIG_USB_GADGET not taking into account module builds. ditto int dwc3_gadget_init(struct dwc3 *dwc); void dwc3_gadget_exit(struct dwc3 *dwc); +#else +static inline int dwc3_gadget_init(struct dwc3 *dwc) +{ return -EINVAL; } +static inline void dwc3_gadget_exit(struct dwc3 *dwc) +{ } +#endif #endif /* __DRIVERS_USB_DWC3_CORE_H */ diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index d4a30f1..553bbaa 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -535,7 +535,8 @@ static ssize_t dwc3_testmode_write(struct file *file, testmode = 0; spin_lock_irqsave(dwc-lock, flags); - dwc3_gadget_set_test_mode(dwc, testmode); + if (dwc3_gadget_set_test_mode(dwc, testmode)) + dev_dbg(dwc-dev, host: Invalid request\n); spin_unlock_irqrestore(dwc-lock, flags); return count; wrong, if you don't have gadget mode, you just don't create this file. dwc3-core makes call to dwc3_debugfs_init() invariably depending on DEBUG_FS. Will this not go ahead and create this file ? I think i am missing here something. :-( @@ -638,7 +639,8 @@ static ssize_t dwc3_link_state_write(struct file *file, return -EINVAL; spin_lock_irqsave(dwc-lock, flags); - dwc3_gadget_set_link_state(dwc, state); + if (dwc3_gadget_set_link_state(dwc, state)) + dev_dbg(dwc-dev, host: Invalid request\n); likewise. spin_unlock_irqrestore(dwc-lock, flags); return count; diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h index 99e6d72..28e82db 100644 --- a/drivers/usb/dwc3/gadget.h +++ b/drivers/usb/dwc3/gadget.h @@ -105,8 +105,16 @@ static inline void dwc3_gadget_move_request_queued(struct dwc3_request *req) void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, int status); +#ifdef CONFIG_USB_GADGET not taking into account CONFIG_USB_GADGET=m missed taking into account that CONFIG_USB_GADGET is tristate :-( Will amend this patch accordingly. -- Thanks Regards Vivek -- To unsubscribe from this list: send the line unsubscribe linux-usb in the
Re: [PATCH v5 2/4] usb: phy: samsung: Add host phy support to samsung-phy driver
Hi Felipe, On Fri, Jan 11, 2013 at 6:28 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Fri, Jan 11, 2013 at 06:10:48PM +0530, Vivek Gautam wrote: Hi Doug, Sorry!! for the delayed response. On Thu, Dec 20, 2012 at 4:31 AM, Doug Anderson diand...@chromium.org wrote: Vivek, I don't really have a good 1 foot view about how all of the USB bits fit together, but a few detail-oriented comments below. On Tue, Dec 18, 2012 at 6:43 AM, Vivek Gautam gautam.vi...@samsung.com wrote: This patch adds host phy support to samsung-usbphy.c and further adds support for samsung's exynos5250 usb-phy. Signed-off-by: Praveen Paneri p.pan...@samsung.com Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- .../devicetree/bindings/usb/samsung-usbphy.txt | 25 +- drivers/usb/phy/Kconfig|2 +- drivers/usb/phy/samsung-usbphy.c | 465 ++-- include/linux/usb/samsung_usb_phy.h| 13 + 4 files changed, 454 insertions(+), 51 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt index a7b28b2..2ec5400 100644 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -1,23 +1,38 @@ * Samsung's usb phy transceiver -The Samsung's phy transceiver is used for controlling usb otg phy for -s3c-hsotg usb device controller. +The Samsung's phy transceiver is used for controlling usb phy for +s3c-hsotg as well as ehci-s5p and ohci-exynos usb controllers +across Samsung SOCs. TODO: Adding the PHY binding with controller(s) according to the under developement generic PHY driver. Required properties: + +Exynos4210: - compatible : should be samsung,exynos4210-usbphy - reg : base physical address of the phy registers and length of memory mapped region. +Exynos5250: +- compatible : should be samsung,exynos5250-usbphy +- reg : base physical address of the phy registers and length of memory mapped + region. + Optional properties: - samsung,usb-phyhandle : should point to usb-phyhandle sub-node which provides binding data to enable/disable device PHY handled by - PMU register. + PMU register; or to configure usb2.0 phy handled by + SYSREG. Required properties: - compatible : should be samsung,usbdev-phyctrl for - DEVICE type phy. + DEVICE type phy; or + should be samsung,usbhost-phyctrl for + HOST type phy; or + should be samsung,usb-phycfg for + USB2.0 PHY_CFG. - samsung,phyhandle-reg: base physical address of - PHY_CONTROL register in PMU. +PHY_CONTROL register in PMU; +or USB2.0 PHY_CFG register +in SYSREG. - samsung,enable-mask : should be '1' diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 17ad743..13c0eaf 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -47,7 +47,7 @@ config USB_RCAR_PHY config SAMSUNG_USBPHY bool Samsung USB PHY controller Driver - depends on USB_S3C_HSOTG + depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS select USB_OTG_UTILS help Enable this to support Samsung USB phy controller for samsung diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c index 4ceabe3..621348a 100644 --- a/drivers/usb/phy/samsung-usbphy.c +++ b/drivers/usb/phy/samsung-usbphy.c @@ -5,7 +5,8 @@ * * Author: Praveen Paneri p.pan...@samsung.com * - * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller + * Samsung USB-PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and + * OHCI-EXYNOS controllers. * * 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 @@ -24,7 +25,7 @@ #include linux/err.h #include linux/io.h #include linux/of.h -#include linux/usb/otg.h +#include linux/usb/samsung_usb_phy.h #include linux/platform_data/samsung-usbphy.h /* Register definitions */ @@ -56,6 +57,103 @@ #define RSTCON_HLINK_SWRST (0x1 1) #define RSTCON_SWRST (0x1 0) +/*
Re: [PATCH RFC] usb: dwc3: Remove dwc3 dependency on gadget.
Hi, On Fri, Jan 11, 2013 at 07:13:55PM +0530, Vivek Gautam wrote: On Thu, Jan 10, 2013 at 6:32 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Mon, Dec 24, 2012 at 07:28:33PM +0530, Vivek Gautam wrote: DWC3 controller curretly depends on CONFIG_USB and CONFIG_USB_GADGET. Some hardware may like to use only host feature on dwc3. So, removing the dependency of USB_DWC3 on USB_GADGET and further modulating the dwc3 core to enable gadget features only with USB_GADGET. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com CC: Doug Anderson diand...@chromium.org right, right... Eventually we need to do it, but you're only making gadget side optional. Host side should be optional too, but then you need to make sure we don't build dwc3 without gadget and host. Yes, true we need to make host side also optional, build dwc3 only when either of host or gadget are built. btw, make the default Dual-Role, if user/defconfig doesn't select anything we want to build with all features. Maybe make a mode selection for Host-only, Peripheral-only, Dual-Role Device ?? True this will be good idea to use modes: host only, gadget only or dual role. May be the platform glue layers can use them later to put the controller in a specific mode ? probably not as that's likely to change from board to board. int dwc3_gadget_init(struct dwc3 *dwc); void dwc3_gadget_exit(struct dwc3 *dwc); +#else +static inline int dwc3_gadget_init(struct dwc3 *dwc) +{ return -EINVAL; } +static inline void dwc3_gadget_exit(struct dwc3 *dwc) +{ } +#endif #endif /* __DRIVERS_USB_DWC3_CORE_H */ diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index d4a30f1..553bbaa 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -535,7 +535,8 @@ static ssize_t dwc3_testmode_write(struct file *file, testmode = 0; spin_lock_irqsave(dwc-lock, flags); - dwc3_gadget_set_test_mode(dwc, testmode); + if (dwc3_gadget_set_test_mode(dwc, testmode)) + dev_dbg(dwc-dev, host: Invalid request\n); spin_unlock_irqrestore(dwc-lock, flags); return count; wrong, if you don't have gadget mode, you just don't create this file. dwc3-core makes call to dwc3_debugfs_init() invariably depending on DEBUG_FS. Will this not go ahead and create this file ? I think i am missing here something. :-( right, you can change dwc3_debugfs_init() to take into account the fact that you're a gadget/drd or host-only. In case of host only, you stil want regdump to be available :-) -- balbi signature.asc Description: Digital signature
how to disable usb hub suspend function
Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Thank you !
Re: [PATCH RFC] usb: dwc3: Remove dwc3 dependency on gadget.
Hi, On Fri, Jan 11, 2013 at 7:29 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Fri, Jan 11, 2013 at 07:13:55PM +0530, Vivek Gautam wrote: On Thu, Jan 10, 2013 at 6:32 PM, Felipe Balbi ba...@ti.com wrote: Hi, On Mon, Dec 24, 2012 at 07:28:33PM +0530, Vivek Gautam wrote: DWC3 controller curretly depends on CONFIG_USB and CONFIG_USB_GADGET. Some hardware may like to use only host feature on dwc3. So, removing the dependency of USB_DWC3 on USB_GADGET and further modulating the dwc3 core to enable gadget features only with USB_GADGET. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com CC: Doug Anderson diand...@chromium.org right, right... Eventually we need to do it, but you're only making gadget side optional. Host side should be optional too, but then you need to make sure we don't build dwc3 without gadget and host. Yes, true we need to make host side also optional, build dwc3 only when either of host or gadget are built. btw, make the default Dual-Role, if user/defconfig doesn't select anything we want to build with all features. Yes we can try something like this ? if (USB || USB_GADGET) menuconfig USB_DWC3 tristate DesignWare USB3 DRD Core Support ... if USB_DWC3 choice default USB_DWC3_DUAL_ROLE_MODE ... config USB_DWC3_HOST_MODE ... config USB_DWC3_DEVICE_MODE ... config USB_DWC3_DUAL_ROLE_MODE ... endchoice .. .. endif endif Maybe make a mode selection for Host-only, Peripheral-only, Dual-Role Device ?? True this will be good idea to use modes: host only, gadget only or dual role. May be the platform glue layers can use them later to put the controller in a specific mode ? probably not as that's likely to change from board to board. int dwc3_gadget_init(struct dwc3 *dwc); void dwc3_gadget_exit(struct dwc3 *dwc); +#else +static inline int dwc3_gadget_init(struct dwc3 *dwc) +{ return -EINVAL; } +static inline void dwc3_gadget_exit(struct dwc3 *dwc) +{ } +#endif #endif /* __DRIVERS_USB_DWC3_CORE_H */ diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index d4a30f1..553bbaa 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -535,7 +535,8 @@ static ssize_t dwc3_testmode_write(struct file *file, testmode = 0; spin_lock_irqsave(dwc-lock, flags); - dwc3_gadget_set_test_mode(dwc, testmode); + if (dwc3_gadget_set_test_mode(dwc, testmode)) + dev_dbg(dwc-dev, host: Invalid request\n); spin_unlock_irqrestore(dwc-lock, flags); return count; wrong, if you don't have gadget mode, you just don't create this file. dwc3-core makes call to dwc3_debugfs_init() invariably depending on DEBUG_FS. Will this not go ahead and create this file ? I think i am missing here something. :-( right, you can change dwc3_debugfs_init() to take into account the fact that you're a gadget/drd or host-only. In case of host only, you stil want regdump to be available :-) So in dwc3_debugfs_init() we shall actually create just 'regdump' file in case of host only mode, otherwise keep the dwc3_debugfs_init() happy with creating other files too. Right ? -- Thanks Regards Vivek -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 0/4] Adding usb2.0 host-phy support for exynos5250
Changes from v5: - Rebased on top of latest patches: usb: phy: samsung: Introducing usb phy driver for hsotg (v9) usb: phy: samsung: Add support to set pmu isolation (v6) As a result adding hostphy enable mask and hostphy register offsets to driver data in order to access the HOSTPHY CONTROL register. - Adding member 'otg' to struct samsung-usbphy so that its consumers can call otg-set_host so as to make 'phy' aware of the consumer type: HOST/DEVICE - Adding 'otg' to 'struct s5p_ehci_hcd' and 'struct exynos_ohci_hcd' which keeps track of 'otg' of the controllers' phy. This then sets the host. - Moved samsung_usbphy_set_type() calls from ehci-s5p and ohci-exynos to phy driver itself where based on phy_type it is called. - Added separate macro definition for USB20PHY_CFG register to select between host/device type usb link. - Removing unnecessary argument 'phy_type' from samsung_usbphy_set_type() and samsung_usbphy_cfg_sel(). - Addressed few nits: -- added macro for 'KHZ' -- removing useless 'if' from samsung_usbphy_cfg_sel() -- keeping the place of clk_get intact and requesting driver data before that. Vivek Gautam (4): ARM: EXYNOS: Update move usb-phy types to generic include layer usb: phy: samsung: Add host phy support to samsung-phy driver USB: ehci-s5p: Add phy driver support USB: ohci-exynos: Add phy driver support .../devicetree/bindings/usb/samsung-usbphy.txt | 12 +- drivers/usb/host/ehci-s5p.c| 81 +++- drivers/usb/host/ohci-exynos.c | 85 +++- drivers/usb/phy/Kconfig|2 +- drivers/usb/phy/samsung-usbphy.c | 512 ++-- include/linux/usb/samsung_usb_phy.h| 16 + 6 files changed, 635 insertions(+), 73 deletions(-) create mode 100644 include/linux/usb/samsung_usb_phy.h -- 1.7.6.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 v6 3/4] USB: ehci-s5p: Add phy driver support
Adding the phy driver to ehci-s5p. Keeping the platform data for continuing the smooth operation for boards which still uses it Signed-off-by: Vivek Gautam gautam.vi...@samsung.com Acked-by: Jingoo Han jg1@samsung.com --- drivers/usb/host/ehci-s5p.c | 80 +++--- 1 files changed, 59 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 46ca5ef..d603e6e 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c @@ -17,6 +17,7 @@ #include linux/platform_device.h #include linux/of_gpio.h #include linux/platform_data/usb-ehci-s5p.h +#include linux/usb/phy.h #include linux/usb/samsung_usb_phy.h #include plat/usb-phy.h @@ -33,6 +34,9 @@ struct s5p_ehci_hcd { struct device *dev; struct usb_hcd *hcd; struct clk *clk; + struct usb_phy *phy; + struct usb_otg *otg; + struct s5p_ehci_platdata *pdata; }; static const struct hc_driver s5p_ehci_hc_driver = { @@ -66,6 +70,26 @@ static const struct hc_driver s5p_ehci_hc_driver = { .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, }; +static void s5p_ehci_phy_enable(struct s5p_ehci_hcd *s5p_ehci) +{ + struct platform_device *pdev = to_platform_device(s5p_ehci-dev); + + if (s5p_ehci-phy) + usb_phy_init(s5p_ehci-phy); + else if (s5p_ehci-pdata-phy_init) + s5p_ehci-pdata-phy_init(pdev, USB_PHY_TYPE_HOST); +} + +static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci) +{ + struct platform_device *pdev = to_platform_device(s5p_ehci-dev); + + if (s5p_ehci-phy) + usb_phy_shutdown(s5p_ehci-phy); + else if (s5p_ehci-pdata-phy_exit) + s5p_ehci-pdata-phy_exit(pdev, USB_PHY_TYPE_HOST); +} + static void s5p_setup_vbus_gpio(struct platform_device *pdev) { int err; @@ -88,20 +112,15 @@ static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32); static int s5p_ehci_probe(struct platform_device *pdev) { - struct s5p_ehci_platdata *pdata; + struct s5p_ehci_platdata *pdata = pdev-dev.platform_data; struct s5p_ehci_hcd *s5p_ehci; struct usb_hcd *hcd; struct ehci_hcd *ehci; struct resource *res; + struct usb_phy *phy; int irq; int err; - pdata = pdev-dev.platform_data; - if (!pdata) { - dev_err(pdev-dev, No platform data defined\n); - return -EINVAL; - } - /* * Right now device-tree probed devices don't get dma_mask set. * Since shared usb code relies on it, set it here for now. @@ -119,6 +138,20 @@ static int s5p_ehci_probe(struct platform_device *pdev) if (!s5p_ehci) return -ENOMEM; + phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2); + if (IS_ERR_OR_NULL(phy)) { + /* Fallback to pdata */ + if (!pdata) { + dev_warn(pdev-dev, no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } else { + s5p_ehci-pdata = pdata; + } + } else { + s5p_ehci-phy = phy; + s5p_ehci-otg = phy-otg; + } + s5p_ehci-dev = pdev-dev; hcd = usb_create_hcd(s5p_ehci_hc_driver, pdev-dev, @@ -164,8 +197,10 @@ static int s5p_ehci_probe(struct platform_device *pdev) goto fail_io; } - if (pdata-phy_init) - pdata-phy_init(pdev, USB_PHY_TYPE_HOST); + if (s5p_ehci-otg) + s5p_ehci-otg-set_host(s5p_ehci-otg, s5p_ehci-hcd-self); + + s5p_ehci_phy_enable(s5p_ehci); ehci = hcd_to_ehci(hcd); ehci-caps = hcd-regs; @@ -176,13 +211,15 @@ static int s5p_ehci_probe(struct platform_device *pdev) err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) { dev_err(pdev-dev, Failed to add USB HCD\n); - goto fail_io; + goto fail_add_hcd; } platform_set_drvdata(pdev, s5p_ehci); return 0; +fail_add_hcd: + s5p_ehci_phy_disable(s5p_ehci); fail_io: clk_disable_unprepare(s5p_ehci-clk); fail_clk: @@ -192,14 +229,15 @@ fail_clk: static int s5p_ehci_remove(struct platform_device *pdev) { - struct s5p_ehci_platdata *pdata = pdev-dev.platform_data; struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev); struct usb_hcd *hcd = s5p_ehci-hcd; usb_remove_hcd(hcd); - if (pdata pdata-phy_exit) - pdata-phy_exit(pdev, USB_PHY_TYPE_HOST); + if (s5p_ehci-otg) + s5p_ehci-otg-set_host(s5p_ehci-otg, s5p_ehci-hcd-self); + + s5p_ehci_phy_disable(s5p_ehci); clk_disable_unprepare(s5p_ehci-clk); @@ -223,14 +261,14 @@ static int s5p_ehci_suspend(struct device *dev) struct s5p_ehci_hcd *s5p_ehci = dev_get_drvdata(dev);
[PATCH v6 2/4] usb: phy: samsung: Add host phy support to samsung-phy driver
This patch adds host phy support to samsung-usbphy driver and further adds support for samsung's exynos5250 usb-phy. Signed-off-by: Praveen Paneri p.pan...@samsung.com Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- .../devicetree/bindings/usb/samsung-usbphy.txt | 12 +- drivers/usb/phy/Kconfig|2 +- drivers/usb/phy/samsung-usbphy.c | 512 ++-- 3 files changed, 495 insertions(+), 31 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt index 22d06cf..0331949 100644 --- a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -1,15 +1,23 @@ * Samsung's usb phy transceiver -The Samsung's phy transceiver is used for controlling usb otg phy for -s3c-hsotg usb device controller. +The Samsung's phy transceiver is used for controlling usb phy for +s3c-hsotg as well as ehci-s5p and ohci-exynos usb controllers +across Samsung SOCs. TODO: Adding the PHY binding with controller(s) according to the under developement generic PHY driver. Required properties: + +Exynos4210: - compatible : should be samsung,exynos4210-usbphy - reg : base physical address of the phy registers and length of memory mapped region. +Exynos5250: +- compatible : should be samsung,exynos5250-usbphy +- reg : base physical address of the phy registers and length of memory mapped + region. + Optional properties: - #address-cells: should be '1' when usbphy node has a child node with 'reg' property. diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 36a85b6..fae4d08 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -48,7 +48,7 @@ config USB_RCAR_PHY config SAMSUNG_USBPHY bool Samsung USB PHY controller Driver - depends on USB_S3C_HSOTG + depends on USB_S3C_HSOTG || USB_EHCI_S5P || USB_OHCI_EXYNOS select USB_OTG_UTILS help Enable this to support Samsung USB phy controller for samsung diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c index 7eec7c3..d2b6642 100644 --- a/drivers/usb/phy/samsung-usbphy.c +++ b/drivers/usb/phy/samsung-usbphy.c @@ -5,7 +5,8 @@ * * Author: Praveen Paneri p.pan...@samsung.com * - * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller + * Samsung USB2.0 PHY transceiver; talks to S3C HS OTG controller, EHCI-S5P and + * OHCI-EXYNOS controllers. * * 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 @@ -21,11 +22,13 @@ #include linux/platform_device.h #include linux/clk.h #include linux/delay.h +#include linux/device.h #include linux/err.h #include linux/io.h #include linux/of.h #include linux/of_address.h #include linux/usb/otg.h +#include linux/usb/samsung_usb_phy.h #include linux/platform_data/samsung-usbphy.h /* Register definitions */ @@ -57,24 +60,131 @@ #define RSTCON_HLINK_SWRST (0x1 1) #define RSTCON_SWRST (0x1 0) +/* EXYNOS5 */ +#define EXYNOS5_PHY_HOST_CTRL0 (0x00) + +#define HOST_CTRL0_PHYSWRSTALL (0x1 31) + +#define HOST_CTRL0_REFCLKSEL_MASK (0x3) +#define HOST_CTRL0_REFCLKSEL_XTAL (0x0 19) +#define HOST_CTRL0_REFCLKSEL_EXTL (0x1 19) +#define HOST_CTRL0_REFCLKSEL_CLKCORE (0x2 19) + +#define HOST_CTRL0_FSEL_MASK (0x7 16) +#define HOST_CTRL0_FSEL(_x)((_x) 16) +#define HOST_CTRL0_FSEL_CLKSEL_50M (0x7) +#define HOST_CTRL0_FSEL_CLKSEL_24M (0x5) +#define HOST_CTRL0_FSEL_CLKSEL_20M (0x4) +#define HOST_CTRL0_FSEL_CLKSEL_19200K (0x3) +#define HOST_CTRL0_FSEL_CLKSEL_12M (0x2) +#define HOST_CTRL0_FSEL_CLKSEL_10M (0x1) +#define HOST_CTRL0_FSEL_CLKSEL_9600K (0x0) + +#define HOST_CTRL0_TESTBURNIN (0x1 11) +#define HOST_CTRL0_RETENABLE (0x1 10) +#define HOST_CTRL0_COMMONON_N (0x1 9) +#define HOST_CTRL0_SIDDQ (0x1 6) +#define HOST_CTRL0_FORCESLEEP (0x1 5) +#define HOST_CTRL0_FORCESUSPEND(0x1 4) +#define HOST_CTRL0_WORDINTERFACE (0x1 3) +#define HOST_CTRL0_UTMISWRST (0x1 2) +#define HOST_CTRL0_LINKSWRST (0x1 1) +#define HOST_CTRL0_PHYSWRST(0x1 0) + +#define EXYNOS5_PHY_HOST_TUNE0 (0x04) + +#define EXYNOS5_PHY_HSIC_CTRL1 (0x10) + +#define EXYNOS5_PHY_HSIC_TUNE1 (0x14) + +#define EXYNOS5_PHY_HSIC_CTRL2 (0x20) + +#define EXYNOS5_PHY_HSIC_TUNE2 (0x24) + +#define HSIC_CTRL_REFCLKSEL_MASK
[PATCH v6 1/4] ARM: EXYNOS: Update move usb-phy types to generic include layer
Updating the names of usb-phy types to more generic names: USB_PHY_TYPE_DEIVCE USB_PHY_TYPE_HOST; and further update its dependencies. Signed-off-by: Praveen Paneri p.pan...@samsung.com Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- Changes from v5: - None drivers/usb/host/ehci-s5p.c |9 + drivers/usb/host/ohci-exynos.c |9 + include/linux/usb/samsung_usb_phy.h | 16 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 include/linux/usb/samsung_usb_phy.h diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 319dcfa..46ca5ef 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c @@ -17,6 +17,7 @@ #include linux/platform_device.h #include linux/of_gpio.h #include linux/platform_data/usb-ehci-s5p.h +#include linux/usb/samsung_usb_phy.h #include plat/usb-phy.h #define EHCI_INSNREG00(base) (base + 0x90) @@ -164,7 +165,7 @@ static int s5p_ehci_probe(struct platform_device *pdev) } if (pdata-phy_init) - pdata-phy_init(pdev, S5P_USB_PHY_HOST); + pdata-phy_init(pdev, USB_PHY_TYPE_HOST); ehci = hcd_to_ehci(hcd); ehci-caps = hcd-regs; @@ -198,7 +199,7 @@ static int s5p_ehci_remove(struct platform_device *pdev) usb_remove_hcd(hcd); if (pdata pdata-phy_exit) - pdata-phy_exit(pdev, S5P_USB_PHY_HOST); + pdata-phy_exit(pdev, USB_PHY_TYPE_HOST); clk_disable_unprepare(s5p_ehci-clk); @@ -229,7 +230,7 @@ static int s5p_ehci_suspend(struct device *dev) rc = ehci_suspend(hcd, do_wakeup); if (pdata pdata-phy_exit) - pdata-phy_exit(pdev, S5P_USB_PHY_HOST); + pdata-phy_exit(pdev, USB_PHY_TYPE_HOST); clk_disable_unprepare(s5p_ehci-clk); @@ -246,7 +247,7 @@ static int s5p_ehci_resume(struct device *dev) clk_prepare_enable(s5p_ehci-clk); if (pdata pdata-phy_init) - pdata-phy_init(pdev, S5P_USB_PHY_HOST); + pdata-phy_init(pdev, USB_PHY_TYPE_HOST); /* DMA burst Enable */ writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd-regs)); diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index aa3b884..804fb62 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -15,6 +15,7 @@ #include linux/of.h #include linux/platform_device.h #include linux/platform_data/usb-exynos.h +#include linux/usb/samsung_usb_phy.h #include plat/usb-phy.h struct exynos_ohci_hcd { @@ -153,7 +154,7 @@ static int exynos_ohci_probe(struct platform_device *pdev) } if (pdata-phy_init) - pdata-phy_init(pdev, S5P_USB_PHY_HOST); + pdata-phy_init(pdev, USB_PHY_TYPE_HOST); ohci = hcd_to_ohci(hcd); ohci_hcd_init(ohci); @@ -184,7 +185,7 @@ static int exynos_ohci_remove(struct platform_device *pdev) usb_remove_hcd(hcd); if (pdata pdata-phy_exit) - pdata-phy_exit(pdev, S5P_USB_PHY_HOST); + pdata-phy_exit(pdev, USB_PHY_TYPE_HOST); clk_disable_unprepare(exynos_ohci-clk); @@ -229,7 +230,7 @@ static int exynos_ohci_suspend(struct device *dev) clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags); if (pdata pdata-phy_exit) - pdata-phy_exit(pdev, S5P_USB_PHY_HOST); + pdata-phy_exit(pdev, USB_PHY_TYPE_HOST); clk_disable_unprepare(exynos_ohci-clk); @@ -249,7 +250,7 @@ static int exynos_ohci_resume(struct device *dev) clk_prepare_enable(exynos_ohci-clk); if (pdata pdata-phy_init) - pdata-phy_init(pdev, S5P_USB_PHY_HOST); + pdata-phy_init(pdev, USB_PHY_TYPE_HOST); ohci_resume(hcd, false); diff --git a/include/linux/usb/samsung_usb_phy.h b/include/linux/usb/samsung_usb_phy.h new file mode 100644 index 000..9167826 --- /dev/null +++ b/include/linux/usb/samsung_usb_phy.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co.Ltd + * http://www.samsung.com/ + * + * Defines phy types for samsung usb phy controllers - HOST or DEIVCE. + * + * 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. + */ + +enum samsung_usb_phy_type { + USB_PHY_TYPE_DEVICE, + USB_PHY_TYPE_HOST, +}; -- 1.7.6.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: ehci-hcd compile error
On Fri, 11 Jan 2013, Roger Quadros wrote: --- usb-3.7.orig/drivers/usb/host/ehci.h +++ usb-3.7/drivers/usb/host/ehci.h @@ -221,6 +221,8 @@ struct ehci_hcd { /* one per controlle #ifdef DEBUG struct dentry *debug_dir; #endif + + unsigned long priv[0];/* platform-specific data */ Why can't it be void * ? It can. I don't see that it makes any difference one way or the other, and I don't see any strong reason for changing it to void *. Also we need to put a comment there stating that priv must be the last member in this structure, else it won't work. Good point. I'll update the comment. 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: how to disable usb hub suspend function
On Fri, Jan 11, 2013 at 10:16 PM, gavin.kx gavin...@qq.com wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Suppose you mean USB autosuspend, you can disable it by below command: echo on /sys/bus/usb/devices/HUB-DEV/power/control and HUB-DEV is the hub device's name. Thanks, -- Ming Lei -- 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: how to disable usb hub suspend function
On Fri, 11 Jan 2013, gavin.kx wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Thank you ! You can prevent any USB device from suspending by doing: echo on /sys/bus/usb/devices/.../power/control Fill in the ... part with the path for the device you want. 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: Re: how to disable usb hub suspend function
Thank you for your reply. i also want to know by do this, do other devices also can do suspending ? gavin.kx From: Alan Stern Date: 2013-01-11 23:11 To: gavin.kx CC: linux-usb Subject: Re: how to disable usb hub suspend function On Fri, 11 Jan 2013, gavin.kx wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Thank you ! You can prevent any USB device from suspending by doing: echo on /sys/bus/usb/devices/.../power/control Fill in the ... part with the path for the device you want. Alan SternN�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
Re: [PATCH 07/14] usb: ehci-omap: Instantiate PHY devices if required
On Fri, 11 Jan 2013, Roger Quadros wrote: Alan, Thanks for the patch. I've pasted the version that builds and works and put you as the Author of the patch, hope it is fine. As far as I can see, yours is the same as what I posted except that: You altered the changes to ehci-hcd.c and Makefile to remove the dependency on the ehci-mxc patch; You made an unimportant whitespace change in ehci-omap.c (moved a blank line before ehci_write()). Right? It's hard to compare the patches directly because the one you posted was whitespace-damaged. Anyway, if this is okay and there's nothing wrong with the ehci-mxc change (other than the comment for ehci-priv), I'll submit both of them to Greg soon. 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: Re: how to disable usb hub suspend function
i have found the document Thank you very much. current to the USB host controllers during hibernation. (It's possible to work around the hibernation-forces-disconnect problem by using the USB Persist facility.) The reset_resume method is used by the USB Persist facility (see Documentation/usb/persist.txt) and it can also be used under certain circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a device is reset during a resume and the driver does not have a reset_resume method, the driver won't receive any notification about the resume. Later kernels will call the driver's disconnect method; 2.6.23 doesn't do this. gavin.kx From: Alan Stern Date: 2013-01-11 23:11 To: gavin.kx CC: linux-usb Subject: Re: how to disable usb hub suspend function On Fri, 11 Jan 2013, gavin.kx wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Thank you ! You can prevent any USB device from suspending by doing: echo on /sys/bus/usb/devices/.../power/control Fill in the ... part with the path for the device you want. Alan SternN�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
Re: [PATCH 07/14] usb: ehci-omap: Instantiate PHY devices if required
On 01/11/2013 05:28 PM, Alan Stern wrote: On Fri, 11 Jan 2013, Roger Quadros wrote: Alan, Thanks for the patch. I've pasted the version that builds and works and put you as the Author of the patch, hope it is fine. As far as I can see, yours is the same as what I posted except that: You altered the changes to ehci-hcd.c and Makefile to remove the dependency on the ehci-mxc patch; You made an unimportant whitespace change in ehci-omap.c (moved a blank line before ehci_write()). Right? It's hard to compare the patches directly because the one you posted was whitespace-damaged. My bad pasting it. Patch is attached now. Apart from what you mentioned I did some more trivial changes. e.g. + !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) \ instead of + !defined(CONFIG_USB_EHCI_HCD_OMAP) \ use ehci_hcd_omap_driver instead of ehci_omap_driver Anyway, if this is okay and there's nothing wrong with the ehci-mxc change (other than the comment for ehci-priv), I'll submit both of them to Greg soon. OK, thanks. I tried using ehci-priv in ehci-omap driver but noticed that the private data gets corrupted after the EHCI controller is running and has enumerated a few devices. If I disable USB_DEBUG then things are fine. Could it be possible that someone is overflowing data when USB_DEBUG is enabled? My implementation is pasted below. (May contain whitespace errors due to MS exchange). Patch 2 attached in case. What was happening there is that omap_priv-phy was not the same during remove() as it was set to during probe(). Would be nice if you could check if the same happens with ehci-mxc. cheers, -roger diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 6388aa6..23c9b9c 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -70,6 +70,11 @@ static const char hcd_name[] = ehci-omap; /*-*/ +struct omap_ehci_hcd { + struct usb_hcd *hcd; + struct usb_phy **phy; /* one PHY for each port */ + int nports; +}; static inline void ehci_write(void __iomem *base, u32 reg, u32 val) { @@ -194,6 +199,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) struct usbhs_omap_platform_data *pdata = dev-platform_data; struct resource *res; struct usb_hcd *hcd; + struct omap_ehci_hcd*omap_hcd; + struct usb_phy *phy; void __iomem*regs; int ret = -ENODEV; int irq; @@ -208,6 +215,25 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) return -ENODEV; } + if (!pdata) { + dev_err(dev, Missing platform data\n); + return -ENODEV; + } + + omap_hcd = devm_kzalloc(pdev-dev, sizeof(*omap_hcd), GFP_KERNEL); + if (!omap_hcd) { + dev_err(dev, Memory allocation failed\n); + return -ENOMEM; + } + + omap_hcd-nports = pdata-nports; + i = sizeof(struct usb_phy *) * omap_hcd-nports; + omap_hcd-phy = devm_kzalloc(pdev-dev, i, GFP_KERNEL); + if (!omap_hcd-phy) { + dev_err(dev, Memory allocation failed\n); + return -ENOMEM; + } + irq = platform_get_irq_byname(pdev, ehci-irq); if (irq 0) { dev_err(dev, EHCI irq failed\n); @@ -238,9 +264,15 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) hcd-rsrc_start = res-start; hcd-rsrc_len = resource_size(res); hcd-regs = regs; + omap_hcd-hcd = hcd; + + platform_set_drvdata(pdev, omap_hcd); /* get ehci regulator and enable */ - for (i = 0 ; i OMAP3_HS_USB_PORTS ; i++) { + for (i = 0 ; i omap_hcd-nports ; i++) { + struct platform_device *phy_pdev; + struct usbhs_phy_config *phy_config; + if (pdata-port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) { pdata-regulator[i] = NULL; continue; @@ -254,6 +286,33 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) } else { regulator_enable(pdata-regulator[i]); } + + /* instantiate PHY */ + if (!pdata-phy_config[i]) { + dev_dbg(dev, missing phy_config for port %d\n, i); + continue; + } + + phy_config = pdata-phy_config[i]; + phy_pdev = platform_device_register_data(pdev-dev, + phy_config-name, i, phy_config-pdata, + phy_config-pdata_size); + if (IS_ERR(phy_pdev)) { +
Re: ehci-hcd compile error
On 01/11/2013 05:09 PM, Alan Stern wrote: On Fri, 11 Jan 2013, Roger Quadros wrote: --- usb-3.7.orig/drivers/usb/host/ehci.h +++ usb-3.7/drivers/usb/host/ehci.h @@ -221,6 +221,8 @@ struct ehci_hcd { /* one per controlle #ifdef DEBUG struct dentry *debug_dir; #endif + + unsigned long priv[0];/* platform-specific data */ Why can't it be void * ? It can. I don't see that it makes any difference one way or the other, and I don't see any strong reason for changing it to void *. OK. In include/linux/usb/hcd.h it is defined as unsigned long hcd_priv[0] __attribute__ ((aligned(sizeof(s64; commit explains USB: fix ehci alignment error The Kirkwood gave an unaligned memory access error on line 742 of drivers/usb/host/echi-hcd.c: ehci-last_periodic_enable = ktime_get_real(); might be worth setting to the same. 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
Re: [PATCH 07/14] usb: ehci-omap: Instantiate PHY devices if required
On Fri, Jan 11, 2013 at 06:03:21PM +0200, Roger Quadros wrote: diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h index d63eb7d..927b8a1 100644 --- a/include/linux/platform_data/usb-omap.h +++ b/include/linux/platform_data/usb-omap.h @@ -38,6 +38,12 @@ enum usbhs_omap_port_mode { OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM }; +struct usbhs_phy_config { + char *name; /* binds to device driver */ You may wish to consider making this const. -- 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
[PATCHv2] USB: select USB_ARCH_HAS_EHCI for MXS
Commit 09f6ffde (USB: EHCI: fix build error by making ChipIdea host a normal EHCI driver) introduced a dependency on USB_EHCI_HCD for the chipidea USB host driver, that in turns depends on USB_ARCH_HAS_EHCI. If this symbol is not set for MXS, the MXS boards are not able to use the chipidea driver anymore. Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com --- drivers/usb/Kconfig |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 4c90b51..640ae6c 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -37,6 +37,7 @@ config USB_ARCH_HAS_EHCI default y if ARCH_W90X900 default y if ARCH_AT91 default y if ARCH_MXC + default y if ARCH_MXS default y if ARCH_OMAP3 default y if ARCH_CNS3XXX default y if ARCH_VT8500 -- 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
simulate Isochronous IN transfers
Hello, I have been successful at testing code and getting data on my virtual Fedrora 17 machine, using libusb on the Host side and dummy_hcd and g_zero gadget driver on the device side. The source/sink and loopback testing works fine... However, as I am waiting for hardware to be developed and tested I would like to keep advancing my simulations to include isochronous transfers IN to the host from the simulated device. It appears that the dummy_hcd module does not support the isochronous transfers. Can anyone recommend a way to simulated the device end for these types of transfers, in a manner similar to what is being done with dummy_hcd,g_zero and the f_sourcesink module. thanks, dc -- 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 01/14] mfd: omap-usb-host: Consolidate OMAP USB-HS platform data
* Roger Quadros rog...@ti.com [130111 01:43]: Tony, On 01/11/2013 01:45 AM, Tony Lindgren wrote: * Roger Quadros rog...@ti.com [130110 08:54]: Let's have a single platform data structure for the OMAP's High-Speed USB host subsystem instead of having 3 separate ones i.e. one for board data, one for USB Host (UHH) module and one for USB-TLL module. This makes the code much simpler and avoids creating multiple copies of platform data. I can apply just this patch alone into an immutable branch that we all can merge in as needed as long as we have acks for the USB and MFD parts. Or does this one need to be changed based on Alan's comments on the EHCI lib related changes? This does not depend on EHCI lib based changes but it depends on the OMAP USB Host cleanup series posted earlier. Can we first apply just the minimal platform_data + board file + clock changes? That way I can apply those to some immutable tree for everybody to use, and we cut off the dependency to the driver changes for the rest of the patches. And then I'm off the hook for the rest of the patches :) 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 07/14] usb: ehci-omap: Instantiate PHY devices if required
On Fri, 11 Jan 2013, Roger Quadros wrote: Apart from what you mentioned I did some more trivial changes. e.g. + !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) \ instead of + !defined(CONFIG_USB_EHCI_HCD_OMAP) \ Ah, that's a very good catch. There's another entry needing the same thing. I'll put that in a separate preliminary patch, and also put the ehci-priv addition in there instead of including it with the ehci-mxc update. use ehci_hcd_omap_driver instead of ehci_omap_driver Now fixed. I tried using ehci-priv in ehci-omap driver but noticed that the private data gets corrupted after the EHCI controller is running and has enumerated a few devices. If I disable USB_DEBUG then things are fine. Could it be possible that someone is overflowing data when USB_DEBUG is enabled? My implementation is pasted below. (May contain whitespace errors due to MS exchange). Patch 2 attached in case. What was happening there is that omap_priv-phy was not the same during remove() as it was set to during probe(). I don't understand -- your second patch doesn't use ehci-priv at all. How can the private data be getting corrupted? Below is an updated version of your second patch. You'll need to resolve one or two merge errors because it's not based on the same starting point as yours. (And it totally omits the part affecting usb-omap.h.) But it will show you what needs to be done in order to use ehci-priv. Would be nice if you could check if the same happens with ehci-mxc. I can't -- I don't have an ARM-based system. But if you still see problems, I can test with ehci-pci. Alan Stern Index: usb-3.7/drivers/usb/host/ehci-omap.c === --- usb-3.7.orig/drivers/usb/host/ehci-omap.c +++ usb-3.7/drivers/usb/host/ehci-omap.c @@ -69,6 +69,10 @@ static const char hcd_name[] = ehci-oma /*-*/ +struct omap_ehci_hcd { + struct usb_phy **phy; /* one PHY for each port */ + int nports; +}; static inline void ehci_write(void __iomem *base, u32 reg, u32 val) { @@ -177,7 +181,8 @@ static void disable_put_regulator( static struct hc_driver __read_mostly ehci_omap_hc_driver; static const struct ehci_driver_overrides ehci_omap_overrides __initdata = { - .reset =omap_ehci_init, + .reset =omap_ehci_init, + .extra_priv_size = sizeof(struct omap_ehci_hcd), }; /** @@ -193,6 +198,8 @@ static int ehci_hcd_omap_probe(struct pl struct ehci_hcd_omap_platform_data *pdata = dev-platform_data; struct resource *res; struct usb_hcd *hcd; + struct omap_ehci_hcd*omap_hcd; + struct usb_phy *phy; void __iomem*regs; int ret = -ENODEV; int irq; @@ -207,6 +214,11 @@ static int ehci_hcd_omap_probe(struct pl return -ENODEV; } + if (!pdata) { + dev_err(dev, Missing platform data\n); + return -ENODEV; + } + irq = platform_get_irq_byname(pdev, ehci-irq); if (irq 0) { dev_err(dev, EHCI irq failed\n); @@ -238,8 +250,24 @@ static int ehci_hcd_omap_probe(struct pl hcd-rsrc_len = resource_size(res); hcd-regs = regs; + omap_hcd = (struct omap_ehci_hcd *) (hcd_to_ehci(hcd))-priv; + + omap_hcd-nports = pdata-nports; + i = sizeof(struct usb_phy *) * omap_hcd-nports; + omap_hcd-phy = devm_kzalloc(pdev-dev, i, GFP_KERNEL); + if (!omap_hcd-phy) { + dev_err(dev, Memory allocation failed\n); + ret = -ENOMEM; + goto err_alloc_phy; + } + + platform_set_drvdata(pdev, hcd); + /* get ehci regulator and enable */ - for (i = 0 ; i OMAP3_HS_USB_PORTS ; i++) { + for (i = 0 ; i omap_hcd-nports ; i++) { + struct platform_device *phy_pdev; + struct usbhs_phy_config *phy_config; + if (pdata-port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) { pdata-regulator[i] = NULL; continue; @@ -253,6 +281,33 @@ static int ehci_hcd_omap_probe(struct pl } else { regulator_enable(pdata-regulator[i]); } + + /* instantiate PHY */ + if (!pdata-phy_config[i]) { + dev_dbg(dev, missing phy_config for port %d\n, i); + continue; + } + + phy_config = pdata-phy_config[i]; + phy_pdev = platform_device_register_data(pdev-dev, + phy_config-name, i, phy_config-pdata, + phy_config-pdata_size); +
Re: simulate Isochronous IN transfers
On Fri, 11 Jan 2013, Dan Clapp wrote: Hello, I have been successful at testing code and getting data on my virtual Fedrora 17 machine, using libusb on the Host side and dummy_hcd and g_zero gadget driver on the device side. The source/sink and loopback testing works fine... However, as I am waiting for hardware to be developed and tested I would like to keep advancing my simulations to include isochronous transfers IN to the host from the simulated device. It appears that the dummy_hcd module does not support the isochronous transfers. No, it doesn't. Can anyone recommend a way to simulated the device end for these types of transfers, in a manner similar to what is being done with dummy_hcd,g_zero and the f_sourcesink module. At the risk of sounding obvious, the way to do it is to add isochronous support to dummy-hcd. That would be a fairly large job, though. 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
linux-3.7.1: kmemleak reports in comm usb-storage?
Hi, I am not sure how should I interpret this but I am attaching the whole kmemleak file I have after # w 23:02:23 up 2 days, 2:43, 16 users, load average: 2.17, 1.85, 1.51 [cut] I have several SATA drives connected over USB 2 and 3 (and mounted) but am not accessing them. Maybe there is even a way to check whether the ext3/4 filesystem was modified since the mount time? Maybe it does not matter to you anyways. Picking just one of the reports, the whole file is attached to this email. unreferenced object 0x8803d9328528 (size 16): comm usb-storage, pid 5611, jiffies 4302959774 (age 102275.730s) hex dump (first 16 bytes): 01 00 00 00 01 00 00 00 80 75 2c 5f 03 88 ff ff .u,_ backtrace: [815b1dbd] kmemleak_alloc+0x21/0x3e [81110536] slab_post_alloc_hook+0x28/0x2a [81112a6e] __kmalloc+0xf2/0x104 [8138f418] kzalloc+0xf/0x11 [81391c6c] xhci_urb_enqueue+0xc1/0x3af [81373d82] usb_hcd_submit_urb+0x60b/0x6d2 [81374bf7] usb_submit_urb+0x3dd/0x3f3 [8139cb64] usb_stor_msg_common+0xb0/0x144 [8139ceb6] usb_stor_bulk_transfer_buf+0x57/0x99 [8139d224] usb_stor_Bulk_transport+0x151/0x2a0 [8139da01] usb_stor_invoke_transport+0x162/0x455 [8139ca29] usb_stor_transparent_scsi_command+0x9/0xb [8139eb62] usb_stor_control_thread+0x151/0x233 [8108fde6] kthread+0xac/0xb4 [815da6ac] ret_from_fork+0x7c/0xb0 [] 0x Please let me know if you need more info, like lsusb or whatever. Martin unreferenced object 0x88040b1c5230 (size 256): comm swapper/0, pid 1, jiffies 4294937570 (age 182492.630s) hex dump (first 32 bytes): 00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .N.. ff ff ff ff ff ff ff ff 38 3f 5d 82 ff ff ff ff 8?]. backtrace: [815b1dbd] kmemleak_alloc+0x21/0x3e [81110536] slab_post_alloc_hook+0x28/0x2a [81112a6e] __kmalloc+0xf2/0x104 [81302bd5] kzalloc.constprop.14+0xe/0x10 [81303036] device_private_init+0x14/0x63 [81305110] dev_set_drvdata+0x19/0x2f [815c1ed4] i801_probe+0x5e/0x451 [81280fb3] local_pci_probe+0x5b/0xa2 [81282074] pci_device_probe+0xc8/0xf7 [813056cd] driver_probe_device+0xa9/0x1c1 [8130583f] __driver_attach+0x5a/0x7e [81303f7a] bus_for_each_dev+0x57/0x83 [81305276] driver_attach+0x19/0x1b [81304e48] bus_add_driver+0xa8/0x1fa [81305cb1] driver_register+0x8c/0x106 [81281c6d] __pci_register_driver+0x5a/0x5e unreferenced object 0x88034b2fe578 (size 16): comm usb-storage, pid 5508, jiffies 4302958885 (age 102279.640s) hex dump (first 16 bytes): 01 00 00 00 01 00 00 00 58 1b 6d d2 03 88 ff ff X.m. backtrace: [815b1dbd] kmemleak_alloc+0x21/0x3e [81110536] slab_post_alloc_hook+0x28/0x2a [81112a6e] __kmalloc+0xf2/0x104 [8138f418] kzalloc+0xf/0x11 [81391c6c] xhci_urb_enqueue+0xc1/0x3af [81373d82] usb_hcd_submit_urb+0x60b/0x6d2 [81374bf7] usb_submit_urb+0x3dd/0x3f3 [8139cb64] usb_stor_msg_common+0xb0/0x144 [8139ceb6] usb_stor_bulk_transfer_buf+0x57/0x99 [8139d224] usb_stor_Bulk_transport+0x151/0x2a0 [8139d8d5] usb_stor_invoke_transport+0x36/0x455 [8139ca29] usb_stor_transparent_scsi_command+0x9/0xb [8139eb62] usb_stor_control_thread+0x151/0x233 [8108fde6] kthread+0xac/0xb4 [815da6ac] ret_from_fork+0x7c/0xb0 [] 0x unreferenced object 0x88034b2fee10 (size 16): comm usb-storage, pid 5508, jiffies 4302958885 (age 102279.640s) hex dump (first 16 bytes): 01 00 00 00 01 00 00 00 58 1b 6d d2 03 88 ff ff X.m. backtrace: [815b1dbd] kmemleak_alloc+0x21/0x3e [81110536] slab_post_alloc_hook+0x28/0x2a [81112a6e] __kmalloc+0xf2/0x104 [8138f418] kzalloc+0xf/0x11 [81391c6c] xhci_urb_enqueue+0xc1/0x3af [81373d82] usb_hcd_submit_urb+0x60b/0x6d2 [81374bf7] usb_submit_urb+0x3dd/0x3f3 [8139cb64] usb_stor_msg_common+0xb0/0x144 [8139ceb6] usb_stor_bulk_transfer_buf+0x57/0x99 [8139d224] usb_stor_Bulk_transport+0x151/0x2a0 [8139d8d5] usb_stor_invoke_transport+0x36/0x455 [8139ca29] usb_stor_transparent_scsi_command+0x9/0xb [8139eb62] usb_stor_control_thread+0x151/0x233 [8108fde6] kthread+0xac/0xb4 [815da6ac] ret_from_fork+0x7c/0xb0 [] 0x unreferenced object 0x88034b2fe488 (size 16): comm usb-storage, pid 5508, jiffies 4302958886 (age 102279.660s) hex dump (first 16 bytes): 01 00
Re: Linux USB redirection
Hi, I got USBIP to work with LinuxMint 13 on both server and client side. I want to implement USB redir. on XRDP server. Xrdp server runs on a Linux system and allows multiple low power clients to connect to it, and to each client it presents a GUI desktop. If a USB device is plugged into a low power client, it should be redirected to the GUI session running on the Xrdp server. All this I can now do using USBIP. Before starting the integration of USBIP and xrdp, I have two questions: 1) is it possible to limit the USB redirected device to just one user? If yes, how? 2) vhci_hcd.ko implements a virtual hub. Is it possible to have one hub per connected user? If yes, how? thanks for your help. Chirkut On Thu, Jan 10, 2013 at 11:55 PM, Abhijit Pawar abhi.c.pa...@gmail.com wrote: On 01/11/2013 09:27 AM, Chirkut Daruwalla wrote: Hello everyone, I've been focusing (for now) on getting USBIP to work and its been an uphill battle. On LinuxMint 14 64bit I am able to build all the modules. I'm also able to load usbip-core.ko. But when I load vhci-hcd.ko, the load is successful but immediately after that the system just hangs completely - no response to keyboard or mouse, but no kernel crash. Only way out is to do a power cycle. can you try inserting vhci module on client linux machine from where you want to see the virtual usb device? On LinuxMint 13 64 bit (kernel 3.2.0.23) I'm unable to build the kernel modules if I use the code that comes with the distro. Here is the error I get: make M=/usr/src/modules/usbip/src LD /usr/src/modules/usbip/src/built-in.o CC [M] /usr/src/modules/usbip/src/stub_dev.o /usr/src/modules/usbip/src/stub_dev.c: In function ‘stub_probe’: /usr/src/modules/usbip/src/stub_dev.c:392:42: error: ‘struct device’ has no member named ‘bus_id’ If I use the sources from kernel.org, then I'm able to build ok and load all the modules, but system hangs in the same way as above the moment I run 'usbip attach' Has anyone been able to successfully build and run USBIP on 3.1 or 3.2 kernels? If yes, your help would be greatly appreciated! I have tested it on 32 bit fedora with stock kernel 3.1.0-7.fc16.i686. It works as expected. thanks Chirkut On Tue, Jan 8, 2013 at 12:44 AM, Anil Nair anilcol...@gmail.com wrote: Hello Abhijit and David, Thanks for pointing that out. And thanks for the help. :) -- Regards, Anil Nair -- - Abhijit -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] arm: tegra: Add new DT property to USB node.
On Mon, Dec 17, 2012 at 05:04:41PM -0500, Alan Stern wrote: On Mon, 17 Dec 2012, Stephen Warren wrote: On 12/13/2012 11:59 PM, Venu Byravarasu wrote: As Tegra USB host driver is using instance number for resetting PORT0 twice, adding a new DT property for handling this. Alan, Greg, Felip,e This series looks fine to me. I'd like to take all the Tegra-related USB patches through the Tegra tree for 3.9 if possible (so I'm looking for your acks here). I believe Venu plans to significantly clean up the EHCI/PHY driver split for Tegra, rework the drivers, and add support for Tegra30 in addition to Tegra20. Some of this requires changes to some Tegra board files and device trees to maintain git bisect I don't know for sure yet, but I believe that rework may also end up conflicting with other clock-related rework that will show up for Tegra in 3.9. Are you OK with this? I'll certainly look for your review/acks on the patches before picking them up though. Regarding the changes to drivers/usb/host/ehci-tegra.c: Acked-by: Alan Stern st...@rowland.harvard.edu That's fine with me as well, feel free to think that I have now dropped all tegra-related patches from my queue, you can take them all :) thanks, greg k-h -- 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 RESEND 2/2] usb: host: tegra: Resetting PORT0 based on information received via DT.
On Thu, Jan 03, 2013 at 01:29:32PM -0700, Stephen Warren wrote: On 01/03/2013 12:29 AM, Venu Byravarasu wrote: Tegra USB host driver is using port instance number, to handle some of the hardware issues on SOC e.g. reset PORT0 twice etc. As instance number based handling looks ugly, making use of information passed through DT for achieving this. Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com Acked-by: Alan Stern st...@rowland.harvard.edu Greg, recall that I'm hoping to take this series through the Tegra tree in order to manage EHCI/PHY/clock dependencies. I'm hoping to get your ack if required, or is Alan's sufficient for this? Thanks. Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] usb: phy: use kzalloc to allocate struct tegra_usb_phy
On Fri, Dec 21, 2012 at 01:54:55PM -0700, Stephen Warren wrote: On 12/20/2012 11:34 PM, Venu Byravarasu wrote: Use kzalloc instead of kmalloc to allocate struct tegra_usb_phy. This ensures that all function pointers in member u_phy are initialized to NULL. Seems fine to me. For the record, I'd like to take this through the Tegra tree with all the other Tegra-related USB patches in order to manage any dependencies, with the USB maintainers' Acks. Thanks. Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND 2/2] usb: host: tegra: Resetting PORT0 based on information received via DT.
On 01/11/2013 05:14 PM, Greg KH wrote: On Thu, Jan 03, 2013 at 01:29:32PM -0700, Stephen Warren wrote: On 01/03/2013 12:29 AM, Venu Byravarasu wrote: Tegra USB host driver is using port instance number, to handle some of the hardware issues on SOC e.g. reset PORT0 twice etc. As instance number based handling looks ugly, making use of information passed through DT for achieving this. Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com Acked-by: Alan Stern st...@rowland.harvard.edu Greg, recall that I'm hoping to take this series through the Tegra tree in order to manage EHCI/PHY/clock dependencies. I'm hoping to get your ack if required, or is Alan's sufficient for this? Thanks. Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org Thanks, applied to Tegra's for-3.9/usb branch. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] usb: phy: use kzalloc to allocate struct tegra_usb_phy
On 01/11/2013 05:14 PM, Greg KH wrote: On Fri, Dec 21, 2012 at 01:54:55PM -0700, Stephen Warren wrote: On 12/20/2012 11:34 PM, Venu Byravarasu wrote: Use kzalloc instead of kmalloc to allocate struct tegra_usb_phy. This ensures that all function pointers in member u_phy are initialized to NULL. Seems fine to me. For the record, I'd like to take this through the Tegra tree with all the other Tegra-related USB patches in order to manage any dependencies, with the USB maintainers' Acks. Thanks. Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org Thanks, applied to Tegra's for-3.9/usb branch. -- 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/4] usb: phy: samsung: Add host phy support to samsung-phy driver
Vivek, On Fri, Jan 11, 2013 at 4:40 AM, Vivek Gautam gautamvivek1...@gmail.com wrote: +#define HOST_CTRL0_REFCLKSEL_MASK (0x3) +#define HOST_CTRL0_REFCLKSEL_XTAL (0x0 19) +#define HOST_CTRL0_REFCLKSEL_EXTL (0x1 19) +#define HOST_CTRL0_REFCLKSEL_CLKCORE (0x2 19) + +#define HOST_CTRL0_FSEL_MASK (0x7 16) +#define HOST_CTRL0_FSEL(_x)((_x) 16) +#define HOST_CTRL0_FSEL_CLKSEL_50M (0x7) +#define HOST_CTRL0_FSEL_CLKSEL_24M (0x5) +#define HOST_CTRL0_FSEL_CLKSEL_20M (0x4) +#define HOST_CTRL0_FSEL_CLKSEL_19200K (0x3) +#define HOST_CTRL0_FSEL_CLKSEL_12M (0x2) +#define HOST_CTRL0_FSEL_CLKSEL_10M (0x1) +#define HOST_CTRL0_FSEL_CLKSEL_9600K (0x0) Add the shifts to the #defines and remove HOST_CTRL0_FSEL(_x). That makes it match the older phy more closely. Wouldn't it hamper the readability when shifts are used ?? I mean if we have something like this - phyhost |= HOST_CTRL0_FSEL(phyclk) so, if we are using the shifts then phyhost |= (HOST_CTRL0_FSEL_CLKSEL_24M HOST_CTRL0_FSEL_SHIFT) I was actually suggesting modifying the #defines like this: #define HOST_CTRL0_FSEL_SHIFT 16 #define HOST_CTRL0_FSEL_MASK (0x7 HOST_CTRL0_FSEL_SHIFT) #define HOST_CTRL0_FSEL_CLKSEL_50M (0x7 HOST_CTRL0_FSEL_SHIFT) #define HOST_CTRL0_FSEL_CLKSEL_24M (0x5 HOST_CTRL0_FSEL_SHIFT) #define HOST_CTRL0_FSEL_CLKSEL_20M (0x4 HOST_CTRL0_FSEL_SHIFT) #define HOST_CTRL0_FSEL_CLKSEL_19200K (0x3 HOST_CTRL0_FSEL_SHIFT) #define HOST_CTRL0_FSEL_CLKSEL_12M (0x2 HOST_CTRL0_FSEL_SHIFT) #define HOST_CTRL0_FSEL_CLKSEL_10M (0x1 HOST_CTRL0_FSEL_SHIFT) #define HOST_CTRL0_FSEL_CLKSEL_9600K (0x0 HOST_CTRL0_FSEL_SHIFT) ...then the code doesn't need to think about shifts, right? if (IS_ERR(ref_clk)) { dev_err(sphy-dev, Failed to get reference clock\n); return PTR_ERR(ref_clk); } - switch (clk_get_rate(ref_clk)) { - case 12 * MHZ: - refclk_freq = PHYCLK_CLKSEL_12M; - break; - case 24 * MHZ: - refclk_freq = PHYCLK_CLKSEL_24M; - break; - case 48 * MHZ: - refclk_freq = PHYCLK_CLKSEL_48M; - break; - default: - if (sphy-cpu_type == TYPE_S3C64XX) - refclk_freq = PHYCLK_CLKSEL_48M; - else + if (sphy-cpu_type == TYPE_EXYNOS5250) { + /* set clock frequency for PLL */ + switch (clk_get_rate(ref_clk)) { + case 96 * 10: nit: change to 9600 * KHZ to match; below too. sure. + refclk_freq |= HOST_CTRL0_FSEL_CLKSEL_9600K; Why |= with 0? kept this just to keep things look similar :-). will remove this line, My comment was about keeping things similar. Right now the 5250 code has the |= and the non-5250 code doesn't. I don't care which is picked but the two sides of the if should be symmetric. See parts of the patch below. + break; + case 10 * MHZ: + refclk_freq |= HOST_CTRL0_FSEL_CLKSEL_10M; + break; + case 12 * MHZ: + refclk_freq |= HOST_CTRL0_FSEL_CLKSEL_12M; + break; + case 192 * 10: + refclk_freq |= HOST_CTRL0_FSEL_CLKSEL_19200K; + break; + case 20 * MHZ: + refclk_freq |= HOST_CTRL0_FSEL_CLKSEL_20M; + break; + case 50 * MHZ: + refclk_freq |= HOST_CTRL0_FSEL_CLKSEL_50M; + break; + case 24 * MHZ: + default: + /* default reference clock */ + refclk_freq |= HOST_CTRL0_FSEL_CLKSEL_24M; + break; + } + } else { + switch (clk_get_rate(ref_clk)) { + case 12 * MHZ: + refclk_freq = PHYCLK_CLKSEL_12M; + break; + case 24 * MHZ: refclk_freq = PHYCLK_CLKSEL_24M; - break; + break; + case 48 * MHZ: + refclk_freq = PHYCLK_CLKSEL_48M; + break; + default: + if (sphy-cpu_type == TYPE_S3C64XX) + refclk_freq = PHYCLK_CLKSEL_48M; + else + refclk_freq = PHYCLK_CLKSEL_24M; + break; + } } clk_put(ref_clk); return refclk_freq; } -Doug -- To
回复: Re: how to disable usb hub suspend function
i use it on the android platform, and i can't generate the control file. what can i do ? gavin.kx From: Alan Stern Date: 2013-01-11 23:11 To: gavin.kx CC: linux-usb Subject: Re: how to disable usb hub suspend function On Fri, 11 Jan 2013, gavin.kx wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Thank you ! You can prevent any USB device from suspending by doing: echo on /sys/bus/usb/devices/.../power/control Fill in the ... part with the path for the device you want. Alan Stern
Re: Re: how to disable usb hub suspend function
i use it on the android platform, and i can't generate the control file. what can i do ? gavin.kx From: Ming Lei Date: 2013-01-11 23:10 To: gavin.kx CC: linux-usb Subject: Re: how to disable usb hub suspend function On Fri, Jan 11, 2013 at 10:16 PM, gavin.kx gavin...@qq.com wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Suppose you mean USB autosuspend, you can disable it by below command: echo on /sys/bus/usb/devices/HUB-DEV/power/control and HUB-DEV is the hub device's name. Thanks, -- Ming Lei ..
回复: 回复: how to disable usb hub suspend function
i use it on the android platform, and i can't generate the control file. what can i do ? gavin.kx From: Alan Stern Date: 2013-01-11 23:11 To: gavin.kx CC: linux-usb Subject: Re: how to disable usb hub suspend function On Fri, 11 Jan 2013, gavin.kx wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Thank you ! You can prevent any USB device from suspending by doing: echo on /sys/bus/usb/devices/.../power/control Fill in the ... part with the path for the device you want. Alan Stern
[usb:usb-next 4/10] drivers/usb/misc/usb3503.c:238 usb3503_probe() error: we previously assumed 'pdata' could be null (see line 196)
Hi Dongjin, FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next head: f8be6bfc5da027952e827a503e747fde5393adcc commit: 6a099c63650e50ebf7d1259b859a3d230aec4207 [4/10] USB: misc: Add USB3503 High-Speed Hub Controller drivers/usb/misc/usb3503.c:238 usb3503_probe() error: we previously assumed 'pdata' could be null (see line 196) vim +/pdata +238 drivers/usb/misc/usb3503.c 6a099c63 Dongjin Kim 2012-12-08 190return -ENOMEM; 6a099c63 Dongjin Kim 2012-12-08 191} 6a099c63 Dongjin Kim 2012-12-08 192 6a099c63 Dongjin Kim 2012-12-08 193i2c_set_clientdata(i2c, hub); 6a099c63 Dongjin Kim 2012-12-08 194hub-client = i2c; 6a099c63 Dongjin Kim 2012-12-08 195 6a099c63 Dongjin Kim 2012-12-08 @196if (!pdata) { 6a099c63 Dongjin Kim 2012-12-08 197dev_dbg(i2c-dev, missing platform data\n); 6a099c63 Dongjin Kim 2012-12-08 198} else { 6a099c63 Dongjin Kim 2012-12-08 199hub-gpio_intn = pdata-gpio_intn; 6a099c63 Dongjin Kim 2012-12-08 200hub-gpio_connect = pdata-gpio_connect; 6a099c63 Dongjin Kim 2012-12-08 201hub-gpio_reset = pdata-gpio_reset; 6a099c63 Dongjin Kim 2012-12-08 202hub-mode = pdata-initial_mode; 6a099c63 Dongjin Kim 2012-12-08 203} 6a099c63 Dongjin Kim 2012-12-08 204 6a099c63 Dongjin Kim 2012-12-08 205if (gpio_is_valid(hub-gpio_intn)) { 6a099c63 Dongjin Kim 2012-12-08 206err = gpio_request_one(hub-gpio_intn, 6a099c63 Dongjin Kim 2012-12-08 207 GPIOF_OUT_INIT_HIGH, usb3503 intn); 6a099c63 Dongjin Kim 2012-12-08 208if (err) { 6a099c63 Dongjin Kim 2012-12-08 209dev_err(i2c-dev, 6a099c63 Dongjin Kim 2012-12-08 210unable to request GPIO %d as connect pin (%d)\n, 6a099c63 Dongjin Kim 2012-12-08 211 hub-gpio_intn, err); 6a099c63 Dongjin Kim 2012-12-08 212goto err_gpio_intn; 6a099c63 Dongjin Kim 2012-12-08 213} 6a099c63 Dongjin Kim 2012-12-08 214} 6a099c63 Dongjin Kim 2012-12-08 215 6a099c63 Dongjin Kim 2012-12-08 216if (gpio_is_valid(hub-gpio_connect)) { 6a099c63 Dongjin Kim 2012-12-08 217err = gpio_request_one(hub-gpio_connect, 6a099c63 Dongjin Kim 2012-12-08 218 GPIOF_OUT_INIT_HIGH, usb3503 connect); 6a099c63 Dongjin Kim 2012-12-08 219if (err) { 6a099c63 Dongjin Kim 2012-12-08 220dev_err(i2c-dev, 6a099c63 Dongjin Kim 2012-12-08 221unable to request GPIO %d as connect pin (%d)\n, 6a099c63 Dongjin Kim 2012-12-08 222 hub-gpio_connect, err); 6a099c63 Dongjin Kim 2012-12-08 223goto err_gpio_connect; 6a099c63 Dongjin Kim 2012-12-08 224} 6a099c63 Dongjin Kim 2012-12-08 225} 6a099c63 Dongjin Kim 2012-12-08 226 6a099c63 Dongjin Kim 2012-12-08 227if (gpio_is_valid(hub-gpio_reset)) { 6a099c63 Dongjin Kim 2012-12-08 228err = gpio_request_one(hub-gpio_reset, 6a099c63 Dongjin Kim 2012-12-08 229 GPIOF_OUT_INIT_LOW, usb3503 reset); 6a099c63 Dongjin Kim 2012-12-08 230if (err) { 6a099c63 Dongjin Kim 2012-12-08 231dev_err(i2c-dev, 6a099c63 Dongjin Kim 2012-12-08 232unable to request GPIO %d as reset pin (%d)\n, 6a099c63 Dongjin Kim 2012-12-08 233 hub-gpio_reset, err); 6a099c63 Dongjin Kim 2012-12-08 234goto err_gpio_reset; 6a099c63 Dongjin Kim 2012-12-08 235} 6a099c63 Dongjin Kim 2012-12-08 236} 6a099c63 Dongjin Kim 2012-12-08 237 6a099c63 Dongjin Kim 2012-12-08 @238usb3503_switch_mode(hub, pdata-initial_mode); 6a099c63 Dongjin Kim 2012-12-08 239 6a099c63 Dongjin Kim 2012-12-08 240dev_info(i2c-dev, %s: probed on %s mode\n, __func__, 6a099c63 Dongjin Kim 2012-12-08 241(hub-mode == USB3503_MODE_HUB) ? hub : standby); --- 0-DAY kernel build testing backend Open Source Technology Center Fengguang Wu, Yuanhan Liu Intel Corporation -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [usb:usb-next 4/10] drivers/usb/misc/usb3503.c:238 usb3503_probe() error: we previously assumed 'pdata' could be null (see line 196)
Hello, Thanks for your notification. Do I need to send another patch on top of it to fix the warning or should I create a new patch version 2 and when should I do? Sorry, I am just new at patch work process. Regasds, Dongjin. 2013/1/12 Fengguang Wu fengguang...@intel.com: Hi Dongjin, FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next head: f8be6bfc5da027952e827a503e747fde5393adcc commit: 6a099c63650e50ebf7d1259b859a3d230aec4207 [4/10] USB: misc: Add USB3503 High-Speed Hub Controller drivers/usb/misc/usb3503.c:238 usb3503_probe() error: we previously assumed 'pdata' could be null (see line 196) vim +/pdata +238 drivers/usb/misc/usb3503.c 6a099c63 Dongjin Kim 2012-12-08 190return -ENOMEM; 6a099c63 Dongjin Kim 2012-12-08 191} 6a099c63 Dongjin Kim 2012-12-08 192 6a099c63 Dongjin Kim 2012-12-08 193i2c_set_clientdata(i2c, hub); 6a099c63 Dongjin Kim 2012-12-08 194hub-client = i2c; 6a099c63 Dongjin Kim 2012-12-08 195 6a099c63 Dongjin Kim 2012-12-08 @196if (!pdata) { 6a099c63 Dongjin Kim 2012-12-08 197dev_dbg(i2c-dev, missing platform data\n); 6a099c63 Dongjin Kim 2012-12-08 198} else { 6a099c63 Dongjin Kim 2012-12-08 199hub-gpio_intn = pdata-gpio_intn; 6a099c63 Dongjin Kim 2012-12-08 200hub-gpio_connect = pdata-gpio_connect; 6a099c63 Dongjin Kim 2012-12-08 201hub-gpio_reset = pdata-gpio_reset; 6a099c63 Dongjin Kim 2012-12-08 202hub-mode = pdata-initial_mode; 6a099c63 Dongjin Kim 2012-12-08 203} 6a099c63 Dongjin Kim 2012-12-08 204 6a099c63 Dongjin Kim 2012-12-08 205if (gpio_is_valid(hub-gpio_intn)) { 6a099c63 Dongjin Kim 2012-12-08 206err = gpio_request_one(hub-gpio_intn, 6a099c63 Dongjin Kim 2012-12-08 207 GPIOF_OUT_INIT_HIGH, usb3503 intn); 6a099c63 Dongjin Kim 2012-12-08 208if (err) { 6a099c63 Dongjin Kim 2012-12-08 209dev_err(i2c-dev, 6a099c63 Dongjin Kim 2012-12-08 210 unable to request GPIO %d as connect pin (%d)\n, 6a099c63 Dongjin Kim 2012-12-08 211 hub-gpio_intn, err); 6a099c63 Dongjin Kim 2012-12-08 212goto err_gpio_intn; 6a099c63 Dongjin Kim 2012-12-08 213} 6a099c63 Dongjin Kim 2012-12-08 214} 6a099c63 Dongjin Kim 2012-12-08 215 6a099c63 Dongjin Kim 2012-12-08 216if (gpio_is_valid(hub-gpio_connect)) { 6a099c63 Dongjin Kim 2012-12-08 217err = gpio_request_one(hub-gpio_connect, 6a099c63 Dongjin Kim 2012-12-08 218 GPIOF_OUT_INIT_HIGH, usb3503 connect); 6a099c63 Dongjin Kim 2012-12-08 219if (err) { 6a099c63 Dongjin Kim 2012-12-08 220dev_err(i2c-dev, 6a099c63 Dongjin Kim 2012-12-08 221 unable to request GPIO %d as connect pin (%d)\n, 6a099c63 Dongjin Kim 2012-12-08 222 hub-gpio_connect, err); 6a099c63 Dongjin Kim 2012-12-08 223goto err_gpio_connect; 6a099c63 Dongjin Kim 2012-12-08 224} 6a099c63 Dongjin Kim 2012-12-08 225} 6a099c63 Dongjin Kim 2012-12-08 226 6a099c63 Dongjin Kim 2012-12-08 227if (gpio_is_valid(hub-gpio_reset)) { 6a099c63 Dongjin Kim 2012-12-08 228err = gpio_request_one(hub-gpio_reset, 6a099c63 Dongjin Kim 2012-12-08 229 GPIOF_OUT_INIT_LOW, usb3503 reset); 6a099c63 Dongjin Kim 2012-12-08 230if (err) { 6a099c63 Dongjin Kim 2012-12-08 231dev_err(i2c-dev, 6a099c63 Dongjin Kim 2012-12-08 232 unable to request GPIO %d as reset pin (%d)\n, 6a099c63 Dongjin Kim 2012-12-08 233 hub-gpio_reset, err); 6a099c63 Dongjin Kim 2012-12-08 234goto err_gpio_reset; 6a099c63 Dongjin Kim 2012-12-08 235} 6a099c63 Dongjin Kim 2012-12-08 236} 6a099c63 Dongjin Kim 2012-12-08 237 6a099c63 Dongjin Kim 2012-12-08 @238usb3503_switch_mode(hub, pdata-initial_mode); 6a099c63 Dongjin Kim 2012-12-08 239 6a099c63 Dongjin Kim 2012-12-08 240dev_info(i2c-dev, %s: probed on %s mode\n, __func__, 6a099c63 Dongjin Kim 2012-12-08 241(hub-mode == USB3503_MODE_HUB) ? hub : standby); --- 0-DAY kernel build testing backend Open Source Technology Center Fengguang Wu, Yuanhan Liu Intel Corporation -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [usb:usb-next 4/10] drivers/usb/misc/usb3503.c:238 usb3503_probe() error: we previously assumed 'pdata' could be null (see line 196)
Dongjin, Do I need to send another patch on top of it to fix the warning or Yes, you'll need to send another incremental fix to Greg. Thanks, Fengguang -- 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
回复: 回复: how to disable usb hub suspend function
not only disable auto suspend, also disable usb suspend when system suspend. gavin.kx 发件人: gavin.kx 发送时间: 2013-01-12 09:57 收件人: Alan Stern 抄送: linux-usb 主题: 回复: 回复: how to disable usb hub suspend function i use it on the android platform, and i can't generate the control file. what can i do ? gavin.kx From: Alan Stern Date: 2013-01-11 23:11 To: gavin.kx CC: linux-usb Subject: Re: how to disable usb hub suspend function On Fri, 11 Jan 2013, gavin.kx wrote: Dear sir: i have a project that need disable usb hub suspend function, How can i do ? Thank you ! You can prevent any USB device from suspending by doing: echo on /sys/bus/usb/devices/.../power/control Fill in the ... part with the path for the device you want. Alan SternN�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
[PATCH] usb: misc: usb3503_probe() can be static
Signed-off-by: Fengguang Wu fengguang...@intel.com --- drivers/usb/misc/usb3503.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-next.orig/drivers/usb/misc/usb3503.c 2013-01-12 13:12:34.367933402 +0800 +++ linux-next/drivers/usb/misc/usb3503.c 2013-01-12 13:12:37.251933471 +0800 @@ -178,7 +178,7 @@ err_hubmode: return err; } -int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) +static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct usb3503_platform_data *pdata = i2c-dev.platform_data; struct usb3503 *hub; -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: USB device cannot be reconnected and khubd blocked for more than 120 seconds
On Fri, Jan 11, 2013 at 10:04 PM, Alex Riesen raa.l...@gmail.com wrote: Hi, the USB stick (an Cruzer Titanium 2GB) was not recognized at any of the USB ports of this system (an System76 lemu4 laptop, XHCI device) after it was removed. If I attempt to insert it again in any of the ports (one of the two USB3, or the USB2) the led on the stick lights up shortly and if off again. There is no media detection messages in the dmesg output, only that from the first time: usb 1-1.2: new high-speed USB device number 3 using ehci-pci usb 1-1.2: New USB device found, idVendor=0781, idProduct=5408 usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-1.2: Product: U3 Titanium usb 1-1.2: Manufacturer: SanDisk Corporation usb 1-1.2: SerialNumber: 187A3A60F1E9 scsi6 : usb-storage 1-1.2:1.0 io scheduler deadline registered (default) usb 1-1.2: USB disconnect, device number 3 The kernel is v3.8-rc3. I never had this problem in 3.7. I could almost reproduce the problem later in a simplified setup (init=/bin/bash) on USB3 ports by inserting and removing the stick quickly. Almost - because the USB3 ports recovered after some time, while the USB2 port never experienced the problem. One more detail: I usually use the noop elevator. That time it was the deadline. And I just reproduced it easily with deadline. -- 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