Re: [PATCH v5 2/3] extcon: Palmas Extcon Driver
On 05/27/2013 02:54 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 11:04 AM, Chanwoo Choi wrote: Hi Kishon, I have some comment about this patch and upload modified patch to following repository (extcon-for-palmas). - http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-for-palmasid=f2b7cb80699cbe1a5fd6c97ef2c600915f8d7f2c This patchset include patch related to other module ,so I need your opinion to apply this patchset to git repository. yeah.. Still there is some confusion with palmas_set_switch_smps10(). I think we can remove it for now and add it separately later. By this at least we can have device mode fully functional in OMAP5. What do you think? I agree your opinion. But, I propose some fixes about palmas_set_switch_smps10(). I dont' prefer to call global function in exton-palmas.c from palmas-regulator.c. So, Why don't you use regulator consumer instead of global function? You can register specific regulator for enabling or disabling SMPS10_SWITCH_EN and then control SMPS10_SWITCH_EN bit through regulator framework in extcon-palmas.c without calling global function. Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/3] extcon: Palmas Extcon Driver
On Monday 27 May 2013 11:38 AM, Chanwoo Choi wrote: On 05/27/2013 02:54 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 11:04 AM, Chanwoo Choi wrote: Hi Kishon, I have some comment about this patch and upload modified patch to following repository (extcon-for-palmas). - http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-for-palmasid=f2b7cb80699cbe1a5fd6c97ef2c600915f8d7f2c This patchset include patch related to other module ,so I need your opinion to apply this patchset to git repository. yeah.. Still there is some confusion with palmas_set_switch_smps10(). I think we can remove it for now and add it separately later. By this at least we can have device mode fully functional in OMAP5. What do you think? I agree your opinion. But, I propose some fixes about palmas_set_switch_smps10(). I dont' prefer to call global function in exton-palmas.c from palmas-regulator.c. So, Why don't you use regulator consumer instead of global function? You can register specific regulator for enabling or disabling SMPS10_SWITCH_EN and then control SMPS10_SWITCH_EN bit through regulator framework in extcon-palmas.c without calling global function. Along with this, I also like to make the VBUS regulator control to be optional here. Currently it is mandatory. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/3] extcon: Palmas Extcon Driver
Hi, On Monday 27 May 2013 11:52 AM, Laxman Dewangan wrote: On Monday 27 May 2013 11:38 AM, Chanwoo Choi wrote: On 05/27/2013 02:54 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 11:04 AM, Chanwoo Choi wrote: Hi Kishon, I have some comment about this patch and upload modified patch to following repository (extcon-for-palmas). - http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-for-palmasid=f2b7cb80699cbe1a5fd6c97ef2c600915f8d7f2c This patchset include patch related to other module ,so I need your opinion to apply this patchset to git repository. yeah.. Still there is some confusion with palmas_set_switch_smps10(). I think we can remove it for now and add it separately later. By this at least we can have device mode fully functional in OMAP5. What do you think? I agree your opinion. But, I propose some fixes about palmas_set_switch_smps10(). I dont' prefer to call global function in exton-palmas.c from palmas-regulator.c. So, Why don't you use regulator consumer instead of global function? You can register specific regulator for enabling or disabling SMPS10_SWITCH_EN and then control SMPS10_SWITCH_EN bit through regulator framework in extcon-palmas.c without calling global function. Along with this, I also like to make the VBUS regulator control to be optional here. Currently it is mandatory. But dint you just tell on my v4 of this patch that you don’t require this. http://www.spinics.net/lists/linux-doc/msg10638.html Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/3] extcon: Palmas Extcon Driver
On Monday 27 May 2013 12:11 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 12:06 PM, Laxman Dewangan wrote: On Monday 27 May 2013 12:01 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 11:52 AM, Laxman Dewangan wrote: On Monday 27 May 2013 11:38 AM, Chanwoo Choi wrote: On 05/27/2013 02:54 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 11:04 AM, Chanwoo Choi wrote: Hi Kishon, I have some comment about this patch and upload modified patch to following repository (extcon-for-palmas). - http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-for-palmasid=f2b7cb80699cbe1a5fd6c97ef2c600915f8d7f2c This patchset include patch related to other module ,so I need your opinion to apply this patchset to git repository. yeah.. Still there is some confusion with palmas_set_switch_smps10(). I think we can remove it for now and add it separately later. By this at least we can have device mode fully functional in OMAP5. What do you think? I agree your opinion. But, I propose some fixes about palmas_set_switch_smps10(). I dont' prefer to call global function in exton-palmas.c from palmas-regulator.c. So, Why don't you use regulator consumer instead of global function? You can register specific regulator for enabling or disabling SMPS10_SWITCH_EN and then control SMPS10_SWITCH_EN bit through regulator framework in extcon-palmas.c without calling global function. Along with this, I also like to make the VBUS regulator control to be optional here. Currently it is mandatory. But dint you just tell on my v4 of this patch that you don’t require this. http://www.spinics.net/lists/linux-doc/msg10638.html In V4, I said remove this VBUS control and my mean was to remove all regulator calls for VBUS enabled/disable. I saw you just remove the platform data option to have this control and made VBUS mandatory. Probably some gap here. Indeed.. I think then we should stick back to how it was with my v4 or else it would break OMAP. The regulator calls can't be moved anywhere else as it is specific to PALMAS. I was thinking that extcon driver just detect the cable type and notify to the client. After cable detection, the next level of configuration should be done in the respective client. On Tegra platform, for ID pin detection, Tegra SOC is capable of detect the ID pin presence or Palma is capable. Depending on the board design, how the ID pin routed from USB connector to PMIC or to Tegra, we enable corresponding detection logic. Once the USB driver got notification for ID pin presence (by any means), the enabling of VBUS (as the Tegra will work as Host now and need to supply VBUS), is done in USB driver. Not sure about the OMAP here. So in above context, I really do not want to have the VBUS control on extcon driver from Tegra context. If it is require in OMAP context then please make it as optional so that we can satisfy for Tegra and Omap platform. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: chipidea: usbmisc_imx: Staticize usbmisc_imx_drv_init/exit
On Fri, May 24, 2013 at 04:38:29PM -0300, Fabio Estevam wrote: From: Fabio Estevam fabio.este...@freescale.com Fix the following sparse warnings: drivers/usb/chipidea/usbmisc_imx.c:246:5: warning: symbol 'usbmisc_imx_drv_init' was not declared. Should it be static? drivers/usb/chipidea/usbmisc_imx.c:252:6: warning: symbol 'usbmisc_imx_drv_exit' was not declared. Should it be static? Acked-by: Shawn Guo shawn@linaro.org Since we are at it, we may want to add __init/__exit for the functions as well. Shawn Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/chipidea/usbmisc_imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 714a6bd..1c6610a 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -243,13 +243,13 @@ static struct platform_driver usbmisc_imx_driver = { }, }; -int usbmisc_imx_drv_init(void) +static int usbmisc_imx_drv_init(void) { return platform_driver_register(usbmisc_imx_driver); } subsys_initcall(usbmisc_imx_drv_init); -void usbmisc_imx_drv_exit(void) +static void usbmisc_imx_drv_exit(void) { platform_driver_unregister(usbmisc_imx_driver); } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] usb: dwc3: omap: Intialize the register offset values for OMAP5 and AM437x
This patch Initializes the register offset values depending on the X_MAJOR of USBOTGSS_REVISION register. Also adds register offset defines and new debug register defines. X_MAJOR is 1 for OMAP5 and 2 for AM437x. Register offsets are cached in dwc3_omap struct for reg reads and writes. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index a354b4c..e9e9b58a 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -61,21 +61,38 @@ #define USBOTGSS_REVISION 0x #define USBOTGSS_SYSCONFIG 0x0010 #define USBOTGSS_IRQ_EOI 0x0020 +#define USBOTGSS_EOI_OFFSET0x0008 #define USBOTGSS_IRQSTATUS_RAW_0 0x0024 #define USBOTGSS_IRQSTATUS_0 0x0028 #define USBOTGSS_IRQENABLE_SET_0 0x002c #define USBOTGSS_IRQENABLE_CLR_0 0x0030 +#define USBOTGSS_IRQ0_OFFSET 0x0004 #define USBOTGSS_IRQSTATUS_RAW_1 0x0034 #define USBOTGSS_IRQSTATUS_1 0x0038 #define USBOTGSS_IRQENABLE_SET_1 0x003c #define USBOTGSS_IRQENABLE_CLR_1 0x0040 +#define USBOTGSS_IRQSTATUS_EOI_MISC0x0030 +#define USBOTGSS_IRQSTATUS_RAW_MISC0x0034 +#define USBOTGSS_IRQSTATUS_MISC0x0038 +#define USBOTGSS_IRQENABLE_SET_MISC0x003c +#define USBOTGSS_IRQENABLE_CLR_MISC0x0040 +#define USBOTGSS_IRQMISC_OFFSET0x03fc #define USBOTGSS_UTMI_OTG_CTRL 0x0080 #define USBOTGSS_UTMI_OTG_STATUS 0x0084 +#define USBOTGSS_UTMI_OTG_OFFSET 0x0480 +#define USBOTGSS_TXFIFO_DEPTH 0x0508 +#define USBOTGSS_RXFIFO_DEPTH 0x050c #define USBOTGSS_MMRAM_OFFSET 0x0100 #define USBOTGSS_FLADJ 0x0104 #define USBOTGSS_DEBUG_CFG 0x0108 #define USBOTGSS_DEBUG_DATA0x010c +#define USBOTGSS_DEV_EBC_EN0x0110 +#define USBOTGSS_DEBUG_OFFSET 0x0600 +/* REVISION REGISTER */ +#define USBOTGSS_REVISION_XMAJOR(reg) ((reg 8) 0x7) +#define USBOTGSS_REVISION_XMAJOR1 1 +#define USBOTGSS_REVISION_XMAJOR2 2 /* SYSCONFIG REGISTER */ #define USBOTGSS_SYSCONFIG_DMADISABLE (1 16) @@ -300,6 +317,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) int irq; int utmi_mode = 0; + int x_major; u32 reg; @@ -356,6 +374,31 @@ static int dwc3_omap_probe(struct platform_device *pdev) return ret; } + reg = dwc3_omap_readl(omap-base, USBOTGSS_REVISION); + omap-revision = reg; + x_major = USBOTGSS_REVISION_XMAJOR(reg); + + /* Differentiate between OMAP5 and AM437x */ + switch (x_major) { + case USBOTGSS_REVISION_XMAJOR1: + omap-irq_eoi_offset = 0; + omap-irq0_offset = 0; + omap-irqmisc_offset = 0; + omap-utmi_otg_offset = 0; + omap-debug_offset = 0; + break; + case USBOTGSS_REVISION_XMAJOR2: + /* FALLTHROUGH */ + default: + /* Default to the latest revision */ + omap-irq_eoi_offset = USBOTGSS_EOI_OFFSET; + omap-irq0_offset = USBOTGSS_IRQ0_OFFSET; + omap-irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; + omap-utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; + omap-debug_offset = USBOTGSS_DEBUG_OFFSET; + break; + } + reg = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS); of_property_read_u32(node, utmi-mode, utmi_mode); -- 1.8.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] usb: dwc3: omap Modify dwc3_omap_readl/writel with offsets
This patch modifies dwc3_omap_readl/writel calls to accomodate both OMAP5 and AM437x reg maps (It uses the cached register offsets). Also renames OMAP5 IRQ1 as IRQMISC, IRQ1 bits as IRQMISC bits. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 136 +-- 1 file changed, 80 insertions(+), 56 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index e9e9b58a..d43f7bf 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -67,10 +67,18 @@ #define USBOTGSS_IRQENABLE_SET_0 0x002c #define USBOTGSS_IRQENABLE_CLR_0 0x0030 #define USBOTGSS_IRQ0_OFFSET 0x0004 -#define USBOTGSS_IRQSTATUS_RAW_1 0x0034 -#define USBOTGSS_IRQSTATUS_1 0x0038 -#define USBOTGSS_IRQENABLE_SET_1 0x003c -#define USBOTGSS_IRQENABLE_CLR_1 0x0040 +#define USBOTGSS_IRQSTATUS_RAW_1 0x0030 +#define USBOTGSS_IRQSTATUS_1 0x0034 +#define USBOTGSS_IRQENABLE_SET_1 0x0038 +#define USBOTGSS_IRQENABLE_CLR_1 0x003c +#define USBOTGSS_IRQSTATUS_RAW_2 0x0040 +#define USBOTGSS_IRQSTATUS_2 0x0044 +#define USBOTGSS_IRQENABLE_SET_2 0x0048 +#define USBOTGSS_IRQENABLE_CLR_2 0x004c +#define USBOTGSS_IRQSTATUS_RAW_3 0x0050 +#define USBOTGSS_IRQSTATUS_3 0x0054 +#define USBOTGSS_IRQENABLE_SET_3 0x0058 +#define USBOTGSS_IRQENABLE_CLR_3 0x005c #define USBOTGSS_IRQSTATUS_EOI_MISC0x0030 #define USBOTGSS_IRQSTATUS_RAW_MISC0x0034 #define USBOTGSS_IRQSTATUS_MISC0x0038 @@ -102,17 +110,17 @@ /* IRQS0 BITS */ #define USBOTGSS_IRQO_COREIRQ_ST (1 0) -/* IRQ1 BITS */ -#define USBOTGSS_IRQ1_DMADISABLECLR(1 17) -#define USBOTGSS_IRQ1_OEVT (1 16) -#define USBOTGSS_IRQ1_DRVVBUS_RISE (1 13) -#define USBOTGSS_IRQ1_CHRGVBUS_RISE(1 12) -#define USBOTGSS_IRQ1_DISCHRGVBUS_RISE (1 11) -#define USBOTGSS_IRQ1_IDPULLUP_RISE(1 8) -#define USBOTGSS_IRQ1_DRVVBUS_FALL (1 5) -#define USBOTGSS_IRQ1_CHRGVBUS_FALL(1 4) -#define USBOTGSS_IRQ1_DISCHRGVBUS_FALL (1 3) -#define USBOTGSS_IRQ1_IDPULLUP_FALL(1 0) +/* IRQMISC BITS */ +#define USBOTGSS_IRQMISC_DMADISABLECLR (1 17) +#define USBOTGSS_IRQMISC_OEVT (1 16) +#define USBOTGSS_IRQMISC_DRVVBUS_RISE (1 13) +#define USBOTGSS_IRQMISC_CHRGVBUS_RISE (1 12) +#define USBOTGSS_IRQMISC_DISCHRGVBUS_RISE (1 11) +#define USBOTGSS_IRQMISC_IDPULLUP_RISE (1 8) +#define USBOTGSS_IRQMISC_DRVVBUS_FALL (1 5) +#define USBOTGSS_IRQMISC_CHRGVBUS_FALL (1 4) +#define USBOTGSS_IRQMISC_DISCHRGVBUS_FALL (1 3) +#define USBOTGSS_IRQMISC_IDPULLUP_FALL (1 0) /* UTMI_OTG_CTRL REGISTER */ #define USBOTGSS_UTMI_OTG_CTRL_DRVVBUS (1 5) @@ -173,38 +181,44 @@ int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) case OMAP_DWC3_ID_GROUND: dev_dbg(omap-dev, ID GND\n); - val = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS); + val = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS + + omap-utmi_otg_offset); val = ~(USBOTGSS_UTMI_OTG_STATUS_IDDIG | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID | USBOTGSS_UTMI_OTG_STATUS_SESSEND); val |= USBOTGSS_UTMI_OTG_STATUS_SESSVALID | USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT; - dwc3_omap_writel(omap-base, USBOTGSS_UTMI_OTG_STATUS, val); + dwc3_omap_writel(omap-base, USBOTGSS_UTMI_OTG_STATUS + + omap-utmi_otg_offset, val); break; case OMAP_DWC3_VBUS_VALID: dev_dbg(omap-dev, VBUS Connect\n); - val = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS); + val = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS + + omap-utmi_otg_offset); val = ~USBOTGSS_UTMI_OTG_STATUS_SESSEND; val |= USBOTGSS_UTMI_OTG_STATUS_IDDIG | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID | USBOTGSS_UTMI_OTG_STATUS_SESSVALID | USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT; - dwc3_omap_writel(omap-base, USBOTGSS_UTMI_OTG_STATUS, val); + dwc3_omap_writel(omap-base, USBOTGSS_UTMI_OTG_STATUS + + omap-utmi_otg_offset, val); break; case
[PATCH 1/3] usb: dwc3: omap: Adding am437x specific register map changes
AM437x and OMAP5 dwc3 subsytem have different register map. Major differences are as follows. OMAP5 has one main interrupt and one misc interrupt Aegis has four main interrupts and one misc interrupt. Miscellanous Interrupt offsets are changed. UTMI OTG Control and Status Registers offsets are changed. DEBUG Configuration and Status Registers are changed. The main intend of the patch is to re-use the same wrapper driver for both OMAP5 and AM437x, by using the x_major in revision register and adjusting the offsets. This patch adds the register map offsets and adds offset variables in struct dwc3_omap to cache the offsets Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 34638b9..a354b4c 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -122,6 +122,12 @@ struct dwc3_omap { void __iomem*base; u32 utmi_otg_status; + u32 utmi_otg_offset; + u32 irqmisc_offset; + u32 irq_eoi_offset; + u32 debug_offset; + u32 irq0_offset; + u32 revision; u32 dma_status:1; }; -- 1.8.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] Adding AM437x support to dwc3-omap glue
Initial patch set to add support for dwc3 in am437x platform. This patch series addresses the regiter map differences between OMAP5 and AM437x, to re-use the same driver. AM437x and OMAP5 dwc3 subsytem have different register map. Major differences are as follows. OMAP5 has one main interrupt and one misc interrupt Aegis has four main interrupts and one misc interrupt. Miscellanous Interrupt offsets are changed. UTMI OTG Control and Status Registers offsets are changed. DEBUG Configuration and Status Registers are changed. The main intend of the patch is to re-use the same wrapper driver for both OMAP5 and AM437x, by using the x_major in revision register and adjusting the offsets. George Cherian (3): usb: dwc3: omap: Adding am437x specific register map changes usb: dwc3: omap: Intialize the register offset values for OMAP5 and AM437x usb: dwc3: omap Modify dwc3_omap_readl/writel with offsets drivers/usb/dwc3/dwc3-omap.c | 183 ++- 1 file changed, 128 insertions(+), 55 deletions(-) -- 1.8.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Unable to reinsert the am35x MUSB module
On 04/24/2013 05:23 PM, Felipe Balbi wrote: commit 145cadfc79a41633364940df6279e2c131f633b2 Author: Felipe Balbi ba...@ti.com Date: Wed Apr 24 17:21:42 2013 +0300 usb: musb: fix incorrect usage of resource pointer We can't simply pass the resource pointer from our device down to our children, otherwise module reinsertion will not work as the resource will continue to be marked as busy. Fix it by building a proper struct resource for our child musb device. Signed-off-by: Felipe Balbi ba...@ti.com Successfully tested after applying relevant changes for am35x (cm-t3517 board) in kernel v3.7.2. Tested-by: Dmitry Lifshitz lifsh...@compulab.co.il diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 5e63b16..6ba8439 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c @@ -450,6 +450,7 @@ static u64 bfin_dmamask = DMA_BIT_MASK(32); static int bfin_probe(struct platform_device *pdev) { + struct resource musb_resources[2]; struct musb_hdrc_platform_data *pdata = pdev-dev.platform_data; struct platform_device *musb; struct bfin_glue*glue; @@ -479,8 +480,21 @@ static int bfin_probe(struct platform_device *pdev) platform_set_drvdata(pdev, glue); - ret = platform_device_add_resources(musb, pdev-resource, - pdev-num_resources); + memset(musb_resources, 0x00, sizeof(*musb_resources) * + ARRAY_SIZE(musb_resources)); + + musb_resources[0].name = pdev-resource[0].name; + musb_resources[0].start = pdev-resource[0].start; + musb_resources[0].end = pdev-resource[0].end; + musb_resources[0].flags = pdev-resource[0].flags; + + musb_resources[1].name = pdev-resource[1].name; + musb_resources[1].start = pdev-resource[1].start; + musb_resources[1].end = pdev-resource[1].end; + musb_resources[1].flags = pdev-resource[1].flags; + + ret = platform_device_add_resources(musb, musb_resources, + ARRAY_SIZE(musb_resources)); if (ret) { dev_err(pdev-dev, failed to add resources\n); goto err3; diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index b903b74..0da6f64 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -476,6 +476,7 @@ static u64 da8xx_dmamask = DMA_BIT_MASK(32); static int da8xx_probe(struct platform_device *pdev) { + struct resource musb_resources[2]; struct musb_hdrc_platform_data *pdata = pdev-dev.platform_data; struct platform_device *musb; struct da8xx_glue *glue; @@ -521,8 +522,21 @@ static int da8xx_probe(struct platform_device *pdev) platform_set_drvdata(pdev, glue); - ret = platform_device_add_resources(musb, pdev-resource, - pdev-num_resources); + memset(musb_resources, 0x00, sizeof(*musb_resources) * + ARRAY_SIZE(musb_resources)); + + musb_resources[0].name = pdev-resource[0].name; + musb_resources[0].start = pdev-resource[0].start; + musb_resources[0].end = pdev-resource[0].end; + musb_resources[0].flags = pdev-resource[0].flags; + + musb_resources[1].name = pdev-resource[1].name; + musb_resources[1].start = pdev-resource[1].start; + musb_resources[1].end = pdev-resource[1].end; + musb_resources[1].flags = pdev-resource[1].flags; + + ret = platform_device_add_resources(musb, musb_resources, + ARRAY_SIZE(musb_resources)); if (ret) { dev_err(pdev-dev, failed to add resources\n); goto err5; diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index bea6cc3..f8aeaf2 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -509,6 +509,7 @@ static u64 davinci_dmamask = DMA_BIT_MASK(32); static int davinci_probe(struct platform_device *pdev) { + struct resource musb_resources[2]; struct musb_hdrc_platform_data *pdata = pdev-dev.platform_data; struct platform_device *musb; struct davinci_glue *glue; @@ -553,8 +554,21 @@ static int davinci_probe(struct platform_device *pdev) platform_set_drvdata(pdev, glue); - ret = platform_device_add_resources(musb, pdev-resource, - pdev-num_resources); + memset(musb_resources, 0x00, sizeof(*musb_resources) * + ARRAY_SIZE(musb_resources)); + + musb_resources[0].name = pdev-resource[0].name; + musb_resources[0].start = pdev-resource[0].start; + musb_resources[0].end = pdev-resource[0].end; + musb_resources[0].flags = pdev-resource[0].flags; + + musb_resources[1].name = pdev-resource[1].name; + musb_resources[1].start = pdev-resource[1].start; + musb_resources[1].end =
AW: Freescale P1022 SoC hangs when initializing USB
Hi list, I'm experiencing problems while booting on a Freescale P1013 based board. It hangs on USB initialization: [3.763584] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [3.770519] ehci-pci: EHCI PCI platform driver [3.775116] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [3.781972] fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller [3.788812] fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1 The corresponding device-tree: usb@22000 { #address-cells = 1; #size-cells = 0; compatible = fsl-usb2-dr; reg = 0x22000 0x1000; interrupt-parent = mpic; interrupts = 28 0x2 0 0; phy_type = ulpi; }; usb@23000 { #address-cells = 1; #size-cells = 0; compatible = fsl-usb2-dr; reg = 0x23000 0x1000; interrupt-parent = mpic; interrupts = 46 0x2 0 0; phy_type = ulpi; }; please change compatible property in both nodes to compatible = fsl-usb2-dr-v1.6, fsl-usb2-dr; and try again to see if it helps. Thanks, Anatolij This solves the boot hang, thanks a lot Johannes -- 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/4] usb: dwc3: gadget: free trb pool only from epnum 2
we never allocate a TRB pool for physical endpoints 0 and 1 so trying to free it (a invalid TRB pool pointer) will lead us in a warning while removing dwc3.ko module. In order to fix the situation, all we have to do is skip dwc3_free_trb_pool() for physical endpoints 0 and 1 just as we while deleting endpoints from the endpoints list. Signed-off-by: George Cherian george.cher...@ti.com Signed-off-by: Felipe Balbi ba...@ti.com --- drivers/usb/dwc3/gadget.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2b6e7e0..1c246f9 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1706,12 +1706,20 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) dep = dwc-eps[epnum]; if (!dep) continue; + /* +* physical endpoints 0 and 1 are special. They form the +* bi-directional USB endpoint 0. +* +* For those two physical endpoints, we don't allocate a TRB +* pool nor do we add them the endpoints list. Due to that, we +* should these two operations otherwise we would end up with +* all sorts of bugs when removing dwc3.ko. +*/ - dwc3_free_trb_pool(dep); - - if (epnum != 0 epnum != 1) + if (epnum != 0 epnum != 1) { + dwc3_free_trb_pool(dep); list_del(dep-endpoint.ep_list); - + } kfree(dep); } } -- 1.8.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/3] extcon: Palmas Extcon Driver
Hi, On Monday 27 May 2013 12:26 PM, Laxman Dewangan wrote: On Monday 27 May 2013 12:11 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 12:06 PM, Laxman Dewangan wrote: On Monday 27 May 2013 12:01 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 11:52 AM, Laxman Dewangan wrote: On Monday 27 May 2013 11:38 AM, Chanwoo Choi wrote: On 05/27/2013 02:54 PM, Kishon Vijay Abraham I wrote: Hi, On Monday 27 May 2013 11:04 AM, Chanwoo Choi wrote: Hi Kishon, I have some comment about this patch and upload modified patch to following repository (extcon-for-palmas). - http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=extcon-for-palmasid=f2b7cb80699cbe1a5fd6c97ef2c600915f8d7f2c This patchset include patch related to other module ,so I need your opinion to apply this patchset to git repository. yeah.. Still there is some confusion with palmas_set_switch_smps10(). I think we can remove it for now and add it separately later. By this at least we can have device mode fully functional in OMAP5. What do you think? I agree your opinion. But, I propose some fixes about palmas_set_switch_smps10(). I dont' prefer to call global function in exton-palmas.c from palmas-regulator.c. So, Why don't you use regulator consumer instead of global function? You can register specific regulator for enabling or disabling SMPS10_SWITCH_EN and then control SMPS10_SWITCH_EN bit through regulator framework in extcon-palmas.c without calling global function. Along with this, I also like to make the VBUS regulator control to be optional here. Currently it is mandatory. But dint you just tell on my v4 of this patch that you don’t require this. http://www.spinics.net/lists/linux-doc/msg10638.html In V4, I said remove this VBUS control and my mean was to remove all regulator calls for VBUS enabled/disable. I saw you just remove the platform data option to have this control and made VBUS mandatory. Probably some gap here. Indeed.. I think then we should stick back to how it was with my v4 or else it would break OMAP. The regulator calls can't be moved anywhere else as it is specific to PALMAS. I was thinking that extcon driver just detect the cable type and notify to the client. After cable detection, the next level of configuration should be done in the respective client. On Tegra platform, for ID pin detection, Tegra SOC is capable of detect the ID pin presence or Palma is capable. Depending on the board design, how the ID pin routed from USB connector to PMIC or to Tegra, we enable corresponding detection logic. Once the USB driver got notification for ID pin presence (by any means), the enabling of VBUS (as the Tegra will work as Host now and need to supply VBUS), is done in USB driver. Not sure about the OMAP here. I think I got your point here. Will check and send a patch. Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/4] usb: dwc3: gadget: free trb pool only from epnum 2
-Original Message- From: Cherian, George Sent: Monday, May 27, 2013 2:36 PM To: linux-usb@vger.kernel.org; linux-o...@vger.kernel.org; linux- ker...@vger.kernel.org Cc: Balbi, Felipe; gre...@linuxfoundation.org; Cherian, George Subject: [PATCH 1/4] usb: dwc3: gadget: free trb pool only from epnum 2 Please read [PATCH 1/4] as [PATCH 1/1]. we never allocate a TRB pool for physical endpoints 0 and 1 so trying to free it (a invalid TRB pool pointer) will lead us in a warning while removing dwc3.ko module. In order to fix the situation, all we have to do is skip dwc3_free_trb_pool() for physical endpoints 0 and 1 just as we while deleting endpoints from the endpoints list. Signed-off-by: George Cherian george.cher...@ti.com Signed-off-by: Felipe Balbi ba...@ti.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Raise the maximum number of usb-serial devices to 256
Raise the maximum number of usb-serial devices to 256, which is the actual limit supported by the codebase. Signed-off-by: Jakob-Tobias Winter tob...@linuxdingsda.de Tested-by: Jakob-Tobias Winter tob...@linuxdingsda.de --- include/linux/usb/serial.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 302ddf5..c0ce5ed 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -20,7 +20,7 @@ #include linux/kfifo.h #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ -#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ +#define SERIAL_TTY_MINORS 256 /* loads of devices :) */ #define SERIAL_TTY_NO_MINOR255 /* No minor was assigned */ /* The maximum number of ports one device can grab at once */ -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V4] usb: ehci-s5p: skip phy setup for Exynos5440 based platforms
From: Thomas Abraham thomas...@samsung.com Exynos5440 does not require any explict USB phy configuration. So skip the USB phy configuration for Exynos5440 based platforms. Signed-off-by: Thomas Abraham thomas...@samsung.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Jingoo Han jg1@samsung.com --- Changes since v3: - added empty_platdata as Alan Stern guided. Changes since v2: - changed all occurrences of s5p_ehci-pdata-phy*. - set s5p_ehci-pdata to NULL. Changes since v1: - re-based on the latest 'linux-next' tree drivers/usb/host/ehci-s5p.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 379037f..7cc26e6 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c @@ -50,6 +50,8 @@ struct s5p_ehci_hcd { struct s5p_ehci_platdata *pdata; }; +static struct s5p_ehci_platdata empty_platdata; + #define to_s5p_ehci(hcd) (struct s5p_ehci_hcd *)(hcd_to_ehci(hcd)-priv) static void s5p_setup_vbus_gpio(struct platform_device *pdev) @@ -101,6 +103,13 @@ static int s5p_ehci_probe(struct platform_device *pdev) return -ENOMEM; } s5p_ehci = to_s5p_ehci(hcd); + + if (of_device_is_compatible(pdev-dev.of_node, + samsung,exynos5440-ehci)) { + s5p_ehci-pdata = empty_platdata; + goto skip_phy; + } + phy = devm_usb_get_phy(pdev-dev, USB_PHY_TYPE_USB2); if (IS_ERR(phy)) { /* Fallback to pdata */ @@ -116,6 +125,8 @@ static int s5p_ehci_probe(struct platform_device *pdev) s5p_ehci-otg = phy-otg; } +skip_phy: + s5p_ehci-clk = devm_clk_get(pdev-dev, usbhost); if (IS_ERR(s5p_ehci-clk)) { @@ -277,6 +288,7 @@ static const struct dev_pm_ops s5p_ehci_pm_ops = { #ifdef CONFIG_OF static const struct of_device_id exynos_ehci_match[] = { { .compatible = samsung,exynos4210-ehci }, + { .compatible = samsung,exynos5440-ehci }, {}, }; MODULE_DEVICE_TABLE(of, exynos_ehci_match); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Linux USB file storage gadget with new UDC
Hi, I am able to solve the SCSI command timeout problem by adding a code to check the hardware register busy bit continuously, in kagen2_ep_queue(): do { read_hardware_register_busy_bit } while (hardware_is_busy) This is silly. Drivers shouldn't poll in this way. That's what interrupts are for. however, it causes the linux prompt to be non-responsive because the checking hardware register code is run continuously. If i add a schedule() to the do-while loop, the kagen2_ep_queue() will not be continued. How to go about fixing this dilemma? I can't say much more without seeing the code. However, you should not need to wait for the hardware to do something -- instead the interrupt handler routine should be called when the hardware is finished. Yes, it is silly. The hardware interrupt is not being generated for every SCSI command received, so the driver has to poll. I put the polling code in a thread, and this dilemma is fixed. I still observe the SCSI_WRITE_10 command time out sometimes. When time out happens, the gadget log shows: g_file_storage gadget: invalid CBW: len 512 sig 0x6f007442 g_file_storage gadget: bulk-in set wedge Is it because the gadget expects 31 byte command, but 512 byte data is received instead? The full UDC/gadget log is attached. Hope it is useful. If not, i will add in more printk statements. Thanks, victor EP1 OUT IRQ 0x28 [start_transfer] f8 6005fff0 ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 31 512 31 [kagen2_ep_queue] 43425355 4d g_file_storage gadget: bulk-out, length 31: : 55 53 42 43 4d 00 00 00 00 02 00 00 00 00 0a 2a 0010: 00 00 00 00 04 00 00 01 00 00 00 00 00 00 00 EP1 OUT IRQ 0x28 g_file_storage gadget: SCSI command: WRITE(10); Dc=10, Do=512; Hc=10, Ho=512 [start_transfer] 43425355 4d ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 512 512 512 [kagen2_ep_queue] f8 fff0 g_file_storage gadget-lun0: file write 512 @ 2048 - 512 g_file_storage gadget: before calling send_status g_file_storage gadget: bulk-in, length 13: : 55 53 42 53 4d 00 00 00 00 00 00 00 00 [start_transfer] 53425355 4d ept1 in queue len 0xd, buffer 0xc0c3c000 0: 0x53425355 4: 0x4d 8: 0x0 bulk_in_complete -- 0, 13/13 EP1 OUT IRQ 0x28 [start_transfer] f8 fff0 ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 31 512 31 [kagen2_ep_queue] 43425355 4e g_file_storage gadget: bulk-out, length 31: : 55 53 42 43 4e 00 00 00 00 02 00 00 00 00 0a 2a 0010: 00 00 00 00 06 00 00 01 00 00 00 00 00 00 00 EP1 OUT IRQ 0x28 g_file_storage gadget: SCSI command: WRITE(10); Dc=10, Do=512; Hc=10, Ho=512 [start_transfer] 43425355 4e ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 512 512 512 [kagen2_ep_queue] 6f007442 7000 g_file_storage gadget-lun0: file write 512 @ 3072 - 512 g_file_storage gadget: before calling send_status g_file_storage gadget: bulk-in, length 13: : 55 53 42 53 4e 00 00 00 00 00 00 00 00 [start_transfer] 53425355 4e ept1 in queue len 0xd, buffer 0xc0c3c000 0: 0x53425355 4: 0x4e 8: 0x0 bulk_in_complete -- 0, 13/13 EP1 OUT IRQ 0x28 [start_transfer] 6f007442 7000 ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 31 512 31 [kagen2_ep_queue] 43425355 4f g_file_storage gadget: bulk-out, length 31: : 55 53 42 43 4f 00 00 00 00 02 00 00 00 00 0a 2a 0010: 00 00 00 00 02 00 00 01 00 00 00 00 00 00 00 EP1 OUT IRQ 0x28 g_file_storage gadget: SCSI command: WRITE(10); Dc=10, Do=512; Hc=10, Ho=512 [start_transfer] 43425355 4f ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 512 512 512 [kagen2_ep_queue] f8 fff0 g_file_storage gadget-lun0: file write 512 @ 1024 - 512 g_file_storage gadget: before calling send_status g_file_storage gadget: bulk-in, length 13: : 55 53 42 53 4f 00 00 00 00 00 00 00 00 [start_transfer] 53425355 4f ept1 in queue len 0xd, buffer 0xc0c3c000 0: 0x53425355 4: 0x4f 8: 0x0 bulk_in_complete -- 0, 13/13 [start_transfer] f8 fff0 ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue EP1 OUT IRQ 0x28 after kagen2_ep_queue kagen2_ep_queue 31 512 31 EP1 OUT IRQ 0x28 [kagen2_ep_queue] 43425355 50 g_file_storage gadget: bulk-out, length 31: : 55 53 42 43 50 00 00 00 00 02 00 00 00 00 0a 2a 0010: 00 00 00 00 06 00 00 01 00 00 00 00 00 00 00 g_file_storage gadget: SCSI command: WRITE(10); Dc=10, Do=512; Hc=10, Ho=512 [start_transfer] 43425355 50 ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 512 512 512 [kagen2_ep_queue] 6f007442 7000 g_file_storage gadget-lun0: file write 512 @ 3072 - 512 g_file_storage gadget: before calling send_status g_file_storage gadget: bulk-in, length 13:
[RFC] raise the maximum number of usb-serial devices to 512
Hi, I did a bit more fiddling with the usb-serial stack and got it to support more than 256 devices. I tested it with up to 281 FTDI singleport adapters. (After that i ran out of usb cables.. ) Signed-off-by: Jakob-Tobias Winter tob...@linuxdingsda.de --- include/linux/usb/serial.h |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 302ddf5..ab5e01b 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -20,7 +20,7 @@ #include linux/kfifo.h #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ -#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ +#define SERIAL_TTY_MINORS 512 /* loads of devices :) */ #define SERIAL_TTY_NO_MINOR255 /* No minor was assigned */ /* The maximum number of ports one device can grab at once */ @@ -80,7 +80,7 @@ struct usb_serial_port { struct usb_serial *serial; struct tty_port port; spinlock_t lock; - unsigned char number; + unsigned short number; unsigned char *interrupt_in_buffer; struct urb *interrupt_in_urb; @@ -159,7 +159,7 @@ struct usb_serial { unsigned char disconnected:1; unsigned char suspending:1; unsigned char attached:1; - unsigned char minor; + unsigned short minor; unsigned char num_ports; unsigned char num_port_pointers; charnum_interrupt_in; -- 1.7.10.4 To avoid possible regressions, I also modified a few drivers: Signed-off-by: Jakob-Tobias Winter tob...@linuxdingsda.de --- drivers/usb/serial/io_edgeport.c |2 +- drivers/usb/serial/mos7720.c |2 +- drivers/usb/serial/mos7840.c |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 1477e85..eac8641 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -2266,7 +2266,7 @@ static int send_cmd_write_baud_rate(struct edgeport_port *edge_port, int cmdLen = 0; int divisor; int status; - unsigned char number = + unsigned short number = edge_port-port-number - edge_port-port-serial-minor; if (edge_serial-is_epic diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index cc0e543..81cbc84 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -1468,7 +1468,7 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port, struct usb_serial *serial; int divisor; int status; - unsigned char number; + unsigned short number; if (mos7720_port == NULL) return -1; diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index a0d5ea5..2d62efb 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -1718,7 +1718,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, int divisor = 0; int status; __u16 Data; - unsigned char number; + unsigned short number; __u16 clk_sel_val; struct usb_serial_port *port; -- 1.7.10.4 But since I don't have those types of hardware, I can't test it. Also I'm not sure if I took everything that can break into account as I don't have any kernel coding experience. To whom it may concern, here is the kern.log http://linuxdingsda.de/~wintix/kern.log and again the output of `lsusb | sort`, now with up to 127 devices on a single USB root hub: http://de.pastebin.ca/2383084 Thanks, Tobias -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] usb: chipidea: udc: configure iso endpoints
Hi Alexander, On Thu, May 16, 2013 at 04:05:24PM +0800, Peter Chen wrote: On Thu, May 16, 2013 at 09:53:57AM +0200, Michael Grzeschik wrote: This patch adds iso endpoint support to the device controller. It makes use of the multiplication bits in the maxpacket field of the endpoint and calculates the multiplier bits for each transfer description on every request. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- Changes since v1: - fixed style issues and typo - changed bitops to human readable operations drivers/usb/chipidea/core.c | 2 +- drivers/usb/chipidea/udc.c | 20 +++- drivers/usb/chipidea/udc.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 450107e..3cdb889 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -43,7 +43,7 @@ * * TODO List * - OTG - * - Isochronous Interrupt Traffic + * - Interrupt Traffic * - Handle requests which spawns into several TDs * - GET_STATUS(device) - always reports 0 * - Gadget API (majority of optional features) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 519ead2..e9a57bb0 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -466,6 +466,14 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) mEp-qh.ptr-td.token = cpu_to_le32(~(TD_STATUS_HALTED|TD_STATUS_ACTIVE)); + if (mEp-type == USB_ENDPOINT_XFER_ISOC) { + u32 mul = mReq-req.length / mEp-ep.maxpacket; + + if (mReq-req.length % mEp-ep.maxpacket) + mul++; + mEp-qh.ptr-cap |= mul __ffs(QH_MULT); + } + wmb(); /* synchronize before ep prime */ ret = hw_ep_prime(ci, mEp-num, mEp-dir, @@ -678,6 +686,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req, } } + if (usb_endpoint_xfer_isoc(mEp-ep.desc) + mReq-req.length (1 + mEp-ep.mult) * mEp-ep.maxpacket) { + dev_err(mEp-ci-dev, request length too big for isochronous\n); + return -EMSGSIZE; + } + /* first nuke then test link, e.g. previous status has not sent */ if (!list_empty(mReq-queue)) { dev_err(mEp-ci-dev, request already in queue\n); @@ -1060,7 +1074,8 @@ static int ep_enable(struct usb_ep *ep, mEp-num = usb_endpoint_num(desc); mEp-type = usb_endpoint_type(desc); - mEp-ep.maxpacket = usb_endpoint_maxp(desc); + mEp-ep.maxpacket = usb_endpoint_maxp(desc) 0x07ff; + mEp-ep.mult = QH_ISO_MULT(usb_endpoint_maxp(desc)); if (mEp-type == USB_ENDPOINT_XFER_CONTROL) cap |= QH_IOS; @@ -1246,6 +1261,9 @@ static int ep_set_halt(struct usb_ep *ep, int value) if (ep == NULL || mEp-ep.desc == NULL) return -EINVAL; + if (usb_endpoint_xfer_isoc(mEp-ep.desc)) + return -EOPNOTSUPP; + spin_lock_irqsave(mEp-lock, flags); #ifndef STALL_IN diff --git a/drivers/usb/chipidea/udc.h b/drivers/usb/chipidea/udc.h index d12e8b5..a75724a 100644 --- a/drivers/usb/chipidea/udc.h +++ b/drivers/usb/chipidea/udc.h @@ -50,6 +50,7 @@ struct ci13xxx_qh { #define QH_MAX_PKT(0x07FFUL 16) #define QH_ZLTBIT(29) #define QH_MULT (0x0003UL 30) +#define QH_ISO_MULT(x) ((x 11) 0x03) /* 1 */ u32 curr; /* 2 - 8 */ Reviewed-by: Peter Chen peter.c...@freescale.com can you give me a comment to that patch. I would like to know if it's good to go, or if it needs more care. Thanks, Michael -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC V7 PATCH 0/3] USB: OHCI: Start splitting up the driver
This series of patches begins the process of splitting ohci-hcd up into a core library module and independent pci driver modules. Patch 1/3 prepares the way by exporting a few functions from ohci-hcd and adding a new mechanism for platform-specific drivers to initialize their hc_driver structures. This deserves to be done in the core because almost all of the entries in these structures are pure boilerplate -- practically none of the drivers need to override more than three of the standard core values. Patch 2/3 is part of separating the ohci pci host controller driver from ohci-hcd host code. Moved sb800_prefetch() function from ohci-pci.c to pci-quirks.c file and EXPORTed, this is part of the effort to move the ohci pci related code to generic pci code. Patch 3/3 separate out ohci-pci into independent driver modules. Manjunath Goudar (3): USB: OHCI: prepare to make ohci-hcd a library module USB: OHCI: Generic changes to make ohci-pci a separate driver USB: OHCI: make ohci-pci a separate driver drivers/usb/host/Kconfig |4 +- drivers/usb/host/Makefile |3 + drivers/usb/host/ohci-hcd.c | 132 +-- drivers/usb/host/ohci-hub.c |1 - drivers/usb/host/ohci-pci.c | 152 - drivers/usb/host/ohci-q.c |6 +- drivers/usb/host/ohci.h | 17 + drivers/usb/host/pci-quirks.c | 13 drivers/usb/host/pci-quirks.h |2 + 9 files changed, 181 insertions(+), 149 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC V7 PATCH 1/3] USB: OHCI: prepare to make ohci-hcd a library module
This patch prepares ohci-hcd for being split up into a core library and separate platform driver modules. A generic ohci_hc_driver structure is created, containing all the standard values, and a new mechanism is added whereby a driver module can specify a set of overrides to those values. In addition the ohci_restart(),ohci_suspend() and ohci_resume() routines need to be EXPORTed for use by the drivers. Added ohci_setip(() and ohci_start() routine for to start the generic controller rather than each having its own idiosyncratic approach. This allow to clean duplicated code in most of SOC driver In V2: -ohci_hcd_init() ohci_run() and ohci_stop() are not made non-static. -Adds the ohci_setup() and ohci_start() routine. In V3: -purpose of ohci_setup() and ohci_start() function description written in the patch description. -ohci_init() are not made non-static but now called beginning of the ohci_restart(). -ohci_run() signature change reverted back. -unrelated changes removed. -duplicate comment line removed. -inline ohci_suspend() and ohci_resume() is not needed so removed from ohci.h file. In V4: -ohci-init() EXPORTed because it is called by all bus glue modules. -ohci-setup() removed from 1/2 added into 2/2 patch. In V5: -Again ohci_setup() is added and EXPORTed because to replace the ohci_init() from all bus glues. -ohci_init() is not made non-static function. In V6: -ohci_init() call is removed from ohci_quirk_nec_worker(), because it is already called in ohci_restart(). Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org Acked-by: Alan Stern st...@rowland.harvard.edu Cc: Arnd Bergmann a...@arndb.de Cc: Greg KH g...@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-hcd.c | 103 +++ drivers/usb/host/ohci-hub.c |1 - drivers/usb/host/ohci-pci.c |7 --- drivers/usb/host/ohci.h | 17 +++ 4 files changed, 111 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 9e6de95..13ebbb7 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -79,13 +79,7 @@ static const charhcd_name [] = ohci_hcd; #include pci-quirks.h static void ohci_dump (struct ohci_hcd *ohci, int verbose); -static int ohci_init (struct ohci_hcd *ohci); static void ohci_stop (struct usb_hcd *hcd); - -#if defined(CONFIG_PM) || defined(CONFIG_PCI) -static int ohci_restart (struct ohci_hcd *ohci); -#endif - #ifdef CONFIG_PCI static void sb800_prefetch(struct ohci_hcd *ohci, int on); #else @@ -768,6 +762,30 @@ retry: return 0; } +/* ohci_setup routine for generic controller initialization */ + +int ohci_setup(struct usb_hcd *hcd) +{ + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + + return ohci_init(ohci); +} +EXPORT_SYMBOL_GPL(ohci_setup); + +/* ohci_start routine for generic controller start of all OHCI bus glue */ +static int ohci_start(struct usb_hcd *hcd) +{ + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + int ret; + + ret = ohci_run(ohci); + if (ret 0) { + ohci_err(ohci, can't start\n); + ohci_stop(hcd); + } + return ret; +} + /*-*/ /* an interrupt happens */ @@ -949,12 +967,13 @@ static void ohci_stop (struct usb_hcd *hcd) #if defined(CONFIG_PM) || defined(CONFIG_PCI) /* must not be called from interrupt context */ -static int ohci_restart (struct ohci_hcd *ohci) +int ohci_restart(struct ohci_hcd *ohci) { int temp; int i; struct urb_priv *priv; + ohci_init(ohci); spin_lock_irq(ohci-lock); ohci-rh_state = OHCI_RH_HALTED; @@ -1008,12 +1027,13 @@ static int ohci_restart (struct ohci_hcd *ohci) ohci_dbg(ohci, restart complete\n); return 0; } +EXPORT_SYMBOL_GPL(ohci_restart); #endif #ifdef CONFIG_PM -static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup) +int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); unsigned long flags; @@ -1031,9 +1051,10 @@ static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup) return 0; } +EXPORT_SYMBOL_GPL(ohci_suspend); -static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated) +int ohci_resume(struct usb_hcd *hcd, bool hibernated) { struct ohci_hcd *ohci = hcd_to_ohci(hcd); int port; @@ -1081,8 +1102,72 @@ static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated) return 0; } +EXPORT_SYMBOL_GPL(ohci_resume); + +#endif + +/*-*/ + +/* + * Generic structure: This gets copied for platform drivers so that + * individual entries can be overridden as needed. + */ +static const struct
[RFC V7 PATCH 2/3] USB: OHCI: Generic changes to make ohci-pci a separate driver
Note that this changes is part of separating the ohci pci host controller driver from ohci-hcd host code. This contains : -Moved sb800_prefetch() function from ohci-pci.c to pci-quirks.c file and EXPORTed, this is part of the effort to move the ohci pci related code to generic pci code. -Passed device argument instead of ohci_hcd in sb800_prefetch() function to avoid extra include file in pci-quirks.c. V2: -Passed device argment instead of pci_dev, then we use to_pci_dev() to get the pci_dev structure. Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org Cc: Arnd Bergmann a...@arndb.de Cc: Greg KH g...@kroah.com Cc: Alan Stern st...@rowland.harvard.edu Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-hcd.c |9 - drivers/usb/host/ohci-pci.c | 13 - drivers/usb/host/ohci-q.c |6 -- drivers/usb/host/pci-quirks.c | 13 + drivers/usb/host/pci-quirks.h |2 ++ 5 files changed, 19 insertions(+), 24 deletions(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 13ebbb7..82f586a 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -80,15 +80,6 @@ static const charhcd_name [] = ohci_hcd; static void ohci_dump (struct ohci_hcd *ohci, int verbose); static void ohci_stop (struct usb_hcd *hcd); -#ifdef CONFIG_PCI -static void sb800_prefetch(struct ohci_hcd *ohci, int on); -#else -static inline void sb800_prefetch(struct ohci_hcd *ohci, int on) -{ - return; -} -#endif - #include ohci-hub.c #include ohci-dbg.c diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 2c27a5f..c3fa936 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -168,19 +168,6 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd) return 0; } -static void sb800_prefetch(struct ohci_hcd *ohci, int on) -{ - struct pci_dev *pdev; - u16 misc; - - pdev = to_pci_dev(ohci_to_hcd(ohci)-self.controller); - pci_read_config_word(pdev, 0x50, misc); - if (on == 0) - pci_write_config_word(pdev, 0x50, misc 0xfcff); - else - pci_write_config_word(pdev, 0x50, misc | 0x0300); -} - /* List of quirks for OHCI */ static const struct pci_device_id ohci_pci_quirks[] = { { diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index 88731b7..df4a670 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c @@ -41,6 +41,7 @@ finish_urb(struct ohci_hcd *ohci, struct urb *urb, int status) __releases(ohci-lock) __acquires(ohci-lock) { +struct device *dev = ohci_to_hcd(ohci)-self.controller; // ASSERT (urb-hcpriv != 0); urb_free_priv (ohci, urb-hcpriv); @@ -55,7 +56,7 @@ __acquires(ohci-lock) if (quirk_amdiso(ohci)) usb_amd_quirk_pll_enable(); if (quirk_amdprefetch(ohci)) - sb800_prefetch(ohci, 0); + sb800_prefetch(dev, 0); } break; case PIPE_INTERRUPT: @@ -580,6 +581,7 @@ static void td_submit_urb ( struct urb *urb ) { struct urb_priv *urb_priv = urb-hcpriv; + struct device *dev = ohci_to_hcd(ohci)-self.controller; dma_addr_t data; int data_len = urb-transfer_buffer_length; int cnt = 0; @@ -689,7 +691,7 @@ static void td_submit_urb ( if (quirk_amdiso(ohci)) usb_amd_quirk_pll_disable(); if (quirk_amdprefetch(ohci)) - sb800_prefetch(ohci, 1); + sb800_prefetch(dev, 1); } periodic = ohci_to_hcd(ohci)-self.bandwidth_isoc_reqs++ == 0 ohci_to_hcd(ohci)-self.bandwidth_int_reqs == 0; diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 4c338ec..b9848e4 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -91,6 +91,19 @@ static struct amd_chipset_info { static DEFINE_SPINLOCK(amd_lock); +void sb800_prefetch(struct device *dev, int on) +{ + u16 misc; + struct pci_dev *pdev = to_pci_dev(dev); + + pci_read_config_word(pdev, 0x50, misc); + if (on == 0) + pci_write_config_word(pdev, 0x50, misc 0xfcff); + else + pci_write_config_word(pdev, 0x50, misc | 0x0300); +} +EXPORT_SYMBOL_GPL(sb800_prefetch); + int usb_amd_find_chipset_info(void) { u8 rev = 0; diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h index 7f69a39..4b8a209 100644 --- a/drivers/usb/host/pci-quirks.h +++ b/drivers/usb/host/pci-quirks.h @@ -11,11 +11,13 @@ void usb_amd_quirk_pll_enable(void); bool usb_is_intel_switchable_xhci(struct pci_dev *pdev); void
[RFC V7 PATCH 3/3] USB: OHCI: make ohci-pci a separate driver
This patch splits the PCI portion of ohci-hcd out into its own separate driver module, called ohci-pci. The major point of difficulty lies in ohci-pci's many vendor- and device-specific workarounds. Some of them have to be applied before calling ohci_start() some after, which necessitates a fair amount of code motion. The other platform drivers require much smaller changes. The complete sb800_prefetch() function moved to ohci-q.c,because its only related to ohci-pci driver. V2: - few specific content of pci related code in ohci_pci_start function has been moved to ohci_pci_reset and rest of the generic code is written in ohci_start of ohci-hcd.c file. V3: - ohci_restart() has been called in ohci_pci_reset() function for to reset the ohci pci. V4: -sb800_prefetch() moved to ohci-q.c,because its only related to ohci-pci. -no longer _creating_ CONFIG_USB_OHCI_PCI,creating CONFIG_USB_OHCI_HCD_PCI. -overrides renamed with pci_override,its giving proper meaning. V5: -sb800_prefetch() moved to pci-quirks.c,because its only related to pci. V6: -sb800_prefetch() function has been moved to pci-quirks.c made as separate patch in 2/3. -Most of the generic ohci pci changes moved in 2/3 patch,now this is complete ohci-pci separation patch. V7: -Unrelated include file has been removed from ohci.h file. Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org Cc: Arnd Bergmann a...@arndb.de Cc: Greg KH g...@kroah.com Cc: Alan Stern st...@rowland.harvard.edu Cc: linux-usb@vger.kernel.org --- drivers/usb/host/Kconfig|4 +- drivers/usb/host/Makefile |3 + drivers/usb/host/ohci-hcd.c | 20 +-- drivers/usb/host/ohci-pci.c | 132 +++ 4 files changed, 51 insertions(+), 108 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 64d7209..7e75387 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -377,7 +377,7 @@ config USB_FUSBH200_HCD module will be called fusbh200-hcd. config USB_OHCI_HCD - tristate OHCI HCD support + tristate OHCI HCD (USB 1.1) support depends on USB_ARCH_HAS_OHCI select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 depends on USB_ISP1301 || !ARCH_LPC32XX @@ -446,7 +446,7 @@ config USB_OHCI_HCD_PPC_OF default USB_OHCI_HCD_PPC_OF_BE || USB_OHCI_HCD_PPC_OF_LE config USB_OHCI_HCD_PCI - bool OHCI support for PCI-bus USB controllers + tristate OHCI support for PCI-bus USB controllers depends on PCI (STB03xxx || PPC_MPC52xx || USB_OHCI_HCD_PPC_OF) default y select USB_OHCI_LITTLE_ENDIAN diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 661c558..2214ded 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -42,7 +42,10 @@ obj-$(CONFIG_USB_EHCI_TEGRA)+=ehci-tegra.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o + obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o +obj-$(CONFIG_USB_OHCI_HCD_PCI) += ohci-pci.o + obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o obj-$(CONFIG_USB_FHCI_HCD) += fhci.o obj-$(CONFIG_USB_XHCI_HCD) += xhci-hcd.o diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 82f586a..4a83031 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1166,11 +1166,6 @@ MODULE_AUTHOR (DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE (GPL); -#ifdef CONFIG_PCI -#include ohci-pci.c -#define PCI_DRIVER ohci_pci_driver -#endif - #if defined(CONFIG_ARCH_SA1100) defined(CONFIG_SA) #include ohci-sa.c #define SA_DRIVER ohci_hcd_sa_driver @@ -1266,7 +1261,7 @@ MODULE_LICENSE (GPL); #define PLATFORM_DRIVERohci_platform_driver #endif -#if!defined(PCI_DRIVER) \ +#if!IS_ENABLED(CONFIG_USB_OHCI_HCD_PCI) \ !defined(PLATFORM_DRIVER) \ !defined(OMAP1_PLATFORM_DRIVER) \ !defined(OMAP3_PLATFORM_DRIVER) \ @@ -1341,12 +1336,6 @@ static int __init ohci_hcd_mod_init(void) goto error_sa; #endif -#ifdef PCI_DRIVER - retval = pci_register_driver(PCI_DRIVER); - if (retval 0) - goto error_pci; -#endif - #ifdef SM501_OHCI_DRIVER retval = platform_driver_register(SM501_OHCI_DRIVER); if (retval 0) @@ -1440,10 +1429,6 @@ static int __init ohci_hcd_mod_init(void) platform_driver_unregister(SM501_OHCI_DRIVER); error_sm501: #endif -#ifdef PCI_DRIVER - pci_unregister_driver(PCI_DRIVER); - error_pci: -#endif #ifdef SA_DRIVER sa_driver_unregister(SA_DRIVER); error_sa: @@ -1508,9 +1493,6 @@ static void __exit ohci_hcd_mod_exit(void) #ifdef SM501_OHCI_DRIVER platform_driver_unregister(SM501_OHCI_DRIVER); #endif -#ifdef PCI_DRIVER -
Re: [RFC] raise the maximum number of usb-serial devices to 512
Tobias Winter tob...@linuxdingsda.de writes: Hi, I did a bit more fiddling with the usb-serial stack and got it to support more than 256 devices. I tested it with up to 281 FTDI singleport adapters. (After that i ran out of usb cables.. ) Signed-off-by: Jakob-Tobias Winter tob...@linuxdingsda.de --- include/linux/usb/serial.h |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 302ddf5..ab5e01b 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -20,7 +20,7 @@ #include linux/kfifo.h #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ -#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ +#define SERIAL_TTY_MINORS 512 /* loads of devices :) */ #define SERIAL_TTY_NO_MINOR255 /* No minor was assigned */ /* The maximum number of ports one device can grab at once */ Note the special meaning assigned to 255, which is the reason for the original limit being 254. I believe you need to deal with this in the allocation code if you are going to increase the number like this? Did the ttyUSB255 device work? Might be as simple as changing the SERIAL_TTY_NO_MINOR macro. I don't know.. But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :) Bjørn -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] usb: chipidea: udc: configure iso endpoints
Michael Grzeschik m...@pengutronix.de writes: Hi Alexander, Hi, On Thu, May 16, 2013 at 04:05:24PM +0800, Peter Chen wrote: On Thu, May 16, 2013 at 09:53:57AM +0200, Michael Grzeschik wrote: This patch adds iso endpoint support to the device controller. It makes use of the multiplication bits in the maxpacket field of the endpoint and calculates the multiplier bits for each transfer description on every request. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- Changes since v1: - fixed style issues and typo - changed bitops to human readable operations drivers/usb/chipidea/core.c | 2 +- drivers/usb/chipidea/udc.c | 20 +++- drivers/usb/chipidea/udc.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 450107e..3cdb889 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -43,7 +43,7 @@ * * TODO List * - OTG - * - Isochronous Interrupt Traffic + * - Interrupt Traffic * - Handle requests which spawns into several TDs * - GET_STATUS(device) - always reports 0 * - Gadget API (majority of optional features) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 519ead2..e9a57bb0 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -466,6 +466,14 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) mEp-qh.ptr-td.token = cpu_to_le32(~(TD_STATUS_HALTED|TD_STATUS_ACTIVE)); + if (mEp-type == USB_ENDPOINT_XFER_ISOC) { + u32 mul = mReq-req.length / mEp-ep.maxpacket; + + if (mReq-req.length % mEp-ep.maxpacket) + mul++; + mEp-qh.ptr-cap |= mul __ffs(QH_MULT); + } + wmb(); /* synchronize before ep prime */ ret = hw_ep_prime(ci, mEp-num, mEp-dir, @@ -678,6 +686,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req, } } + if (usb_endpoint_xfer_isoc(mEp-ep.desc) + mReq-req.length (1 + mEp-ep.mult) * mEp-ep.maxpacket) { + dev_err(mEp-ci-dev, request length too big for isochronous\n); + return -EMSGSIZE; + } + /* first nuke then test link, e.g. previous status has not sent */ if (!list_empty(mReq-queue)) { dev_err(mEp-ci-dev, request already in queue\n); @@ -1060,7 +1074,8 @@ static int ep_enable(struct usb_ep *ep, mEp-num = usb_endpoint_num(desc); mEp-type = usb_endpoint_type(desc); - mEp-ep.maxpacket = usb_endpoint_maxp(desc); + mEp-ep.maxpacket = usb_endpoint_maxp(desc) 0x07ff; + mEp-ep.mult = QH_ISO_MULT(usb_endpoint_maxp(desc)); if (mEp-type == USB_ENDPOINT_XFER_CONTROL) cap |= QH_IOS; @@ -1246,6 +1261,9 @@ static int ep_set_halt(struct usb_ep *ep, int value) if (ep == NULL || mEp-ep.desc == NULL) return -EINVAL; + if (usb_endpoint_xfer_isoc(mEp-ep.desc)) + return -EOPNOTSUPP; + spin_lock_irqsave(mEp-lock, flags); #ifndef STALL_IN diff --git a/drivers/usb/chipidea/udc.h b/drivers/usb/chipidea/udc.h index d12e8b5..a75724a 100644 --- a/drivers/usb/chipidea/udc.h +++ b/drivers/usb/chipidea/udc.h @@ -50,6 +50,7 @@ struct ci13xxx_qh { #define QH_MAX_PKT(0x07FFUL 16) #define QH_ZLTBIT(29) #define QH_MULT (0x0003UL 30) +#define QH_ISO_MULT(x)((x 11) 0x03) /* 1 */ u32 curr; /* 2 - 8 */ Reviewed-by: Peter Chen peter.c...@freescale.com can you give me a comment to that patch. I would like to know if it's good to go, or if it needs more care. Looks good. Adding to my branch in a bit. Thanks, -- Alex -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/8] USB: mos7840: fix DMA to stack
Fix regression introduced by commit 0eafe4de1a (USB: serial: mos7840: add support for MCS7810 devices) which used stack-allocated buffers for control messages. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/mos7840.c | 35 +++ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index a0d5ea5..7e99808 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -2142,13 +2142,21 @@ static int mos7840_ioctl(struct tty_struct *tty, static int mos7810_check(struct usb_serial *serial) { int i, pass_count = 0; + u8 *buf; __u16 data = 0, mcr_data = 0; __u16 test_pattern = 0x55AA; + int res; + + buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL); + if (!buf) + return 0; /* failed to identify 7810 */ /* Store MCR setting */ - usb_control_msg(serial-dev, usb_rcvctrlpipe(serial-dev, 0), + res = usb_control_msg(serial-dev, usb_rcvctrlpipe(serial-dev, 0), MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, - mcr_data, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); + buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); + if (res == VENDOR_READ_LENGTH) + mcr_data = *buf; for (i = 0; i 16; i++) { /* Send the 1-bit test pattern out to MCS7810 test pin */ @@ -2158,9 +2166,12 @@ static int mos7810_check(struct usb_serial *serial) MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); /* Read the test pattern back */ - usb_control_msg(serial-dev, usb_rcvctrlpipe(serial-dev, 0), - MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, data, - VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); + res = usb_control_msg(serial-dev, + usb_rcvctrlpipe(serial-dev, 0), MCS_RDREQ, + MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, + VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); + if (res == VENDOR_READ_LENGTH) + data = *buf; /* If this is a MCS7810 device, both test patterns must match */ if (((test_pattern i) ^ (~data 1)) 0x0001) @@ -2174,6 +2185,8 @@ static int mos7810_check(struct usb_serial *serial) MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); + kfree(buf); + if (pass_count == 16) return 1; @@ -2183,11 +2196,17 @@ static int mos7810_check(struct usb_serial *serial) static int mos7840_calc_num_ports(struct usb_serial *serial) { __u16 data = 0x00; + u8 *buf; int mos7840_num_ports; - usb_control_msg(serial-dev, usb_rcvctrlpipe(serial-dev, 0), - MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, data, - VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); + buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); + if (buf) { + usb_control_msg(serial-dev, usb_rcvctrlpipe(serial-dev, 0), + MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, + VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); + data = *buf; + kfree(buf); + } if (serial-dev-descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || serial-dev-descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/8] USB: ark3116: fix control-message timeout
The control-message timeout is specified in milliseconds and should not depend on HZ. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/ark3116.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 3b16118..40e7fd9 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -43,7 +43,7 @@ #define DRIVER_NAME ark3116 /* usb timeout of 1 second */ -#define ARK_TIMEOUT (1*HZ) +#define ARK_TIMEOUT 1000 static const struct usb_device_id id_table[] = { { USB_DEVICE(0x6547, 0x0232) }, -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/8] USB: mos7720: fix message timeouts
The control and bulk-message timeouts are specified in milliseconds and should not depend on HZ. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/mos7720.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 7752cff..6eac266 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -40,7 +40,7 @@ #define DRIVER_DESC Moschip USB Serial Driver /* default urb timeout */ -#define MOS_WDR_TIMEOUT(HZ * 5) +#define MOS_WDR_TIMEOUT5000 #define MOS_MAX_PORT 0x02 #define MOS_WRITE 0x0E @@ -1938,7 +1938,7 @@ static int mos7720_startup(struct usb_serial *serial) /* setting configuration feature to one */ usb_control_msg(serial-dev, usb_sndctrlpipe(serial-dev, 0), - (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); + (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000); /* start the interrupt urb */ ret_val = usb_submit_urb(serial-port[0]-interrupt_in_urb, GFP_KERNEL); @@ -1981,7 +1981,7 @@ static void mos7720_release(struct usb_serial *serial) /* wait for synchronous usb calls to return */ if (mos_parport-msg_pending) wait_for_completion_timeout(mos_parport-syncmsg_compl, - MOS_WDR_TIMEOUT); + msecs_to_jiffies(MOS_WDR_TIMEOUT)); parport_remove_port(mos_parport-pp); usb_set_serial_data(serial, NULL); -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/8] USB: serial: fixes for v3.10
Here's a few more usb-serial fixes for v3.10. Johan Johan Hovold (8): USB: serial: fix Treo/Kyocera interrrupt-in urb context USB: visor: fix initialisation of Treo/Kyocera devices USB: mos7720: fix DMA to stack USB: mos7840: fix DMA to stack USB: ark3116: fix control-message timeout USB: iuu_phoenix: fix bulk-message timeout USB: mos7720: fix message timeouts USB: zte_ev: fix control-message timeouts drivers/usb/serial/ark3116.c | 2 +- drivers/usb/serial/iuu_phoenix.c | 4 ++-- drivers/usb/serial/mos7720.c | 23 +-- drivers/usb/serial/mos7840.c | 35 +++ drivers/usb/serial/visor.c | 9 + drivers/usb/serial/zte_ev.c | 28 ++-- 6 files changed, 70 insertions(+), 31 deletions(-) -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/8] USB: mos7720: fix DMA to stack
The read_mos_reg function is called with stack-allocated buffers, which must not be used for control messages. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/mos7720.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index cc0e543..7752cff 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -227,11 +227,22 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, __u8 requesttype = (__u8)0xc0; __u16 index = get_reg_index(reg); __u16 value = get_reg_value(reg, serial_portnum); - int status = usb_control_msg(usbdev, pipe, request, requesttype, value, -index, data, 1, MOS_WDR_TIMEOUT); - if (status 0) + u8 *buf; + int status; + + buf = kmalloc(1, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + status = usb_control_msg(usbdev, pipe, request, requesttype, value, +index, buf, 1, MOS_WDR_TIMEOUT); + if (status == 1) + *data = *buf; + else if (status 0) dev_err(usbdev-dev, mos7720: usb_control_msg() failed: %d, status); + kfree(buf); + return status; } -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/8] USB: iuu_phoenix: fix bulk-message timeout
The bulk-message timeout is specified in milliseconds and should not depend on HZ. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/iuu_phoenix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 9d74c27..790673e 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -287,7 +287,7 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count) usb_bulk_msg(serial-dev, usb_sndbulkpipe(serial-dev, port-bulk_out_endpointAddress), buf, -count, actual, HZ * 1); +count, actual, 1000); if (status != IUU_OPERATION_OK) dev_dbg(port-dev, %s - error = %2x\n, __func__, status); @@ -307,7 +307,7 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count) usb_bulk_msg(serial-dev, usb_rcvbulkpipe(serial-dev, port-bulk_in_endpointAddress), buf, -count, actual, HZ * 1); +count, actual, 1000); if (status != IUU_OPERATION_OK) dev_dbg(port-dev, %s - error = %2x\n, __func__, status); -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/8] USB: serial: fix Treo/Kyocera interrrupt-in urb context
The first and second interrupt-in urbs are swapped for some Treo/Kyocera devices, but the urb context was never updated with the new port. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/visor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 7573ec8..8d1a3e6 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -564,6 +564,7 @@ static int treo_attach(struct usb_serial *serial) dest-bulk_in_endpointAddress = src-bulk_in_endpointAddress;\ dest-bulk_in_buffer = src-bulk_in_buffer; \ dest-interrupt_in_urb = src-interrupt_in_urb; \ + dest-interrupt_in_urb-context = dest; \ dest-interrupt_in_endpointAddress = \ src-interrupt_in_endpointAddress;\ dest-interrupt_in_buffer = src-interrupt_in_buffer; \ -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/8] USB: zte_ev: fix control-message timeouts
The control-message timeout is specified in milliseconds and should not depend on HZ. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/zte_ev.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c index 39ee737..b9a88f2 100644 --- a/drivers/usb/serial/zte_ev.c +++ b/drivers/usb/serial/zte_ev.c @@ -53,7 +53,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x22, 0x21, 0x0001, 0x, NULL, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); dev_dbg(dev, result = %d\n, result); /* send 2st cmd and recieve data */ @@ -65,7 +65,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x21, 0xa1, 0x, 0x, buf, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); debug_data(dev, __func__, len, buf, result); /* send 3 cmd */ @@ -84,7 +84,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x20, 0x21, 0x, 0x, buf, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); debug_data(dev, __func__, len, buf, result); /* send 4 cmd */ @@ -95,7 +95,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x22, 0x21, 0x0003, 0x, NULL, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); dev_dbg(dev, result = %d\n, result); /* send 5 cmd */ @@ -107,7 +107,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x21, 0xa1, 0x, 0x, buf, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); debug_data(dev, __func__, len, buf, result); /* send 6 cmd */ @@ -126,7 +126,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x20, 0x21, 0x, 0x, buf, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); debug_data(dev, __func__, len, buf, result); kfree(buf); @@ -178,7 +178,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x22, 0x21, 0x0002, 0x, NULL, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); dev_dbg(dev, result = %d\n, result); /* send 2st ctl cmd(CTL21 22 03 00 00 00 00 00 ) */ @@ -186,7 +186,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x22, 0x21, 0x0003, 0x, NULL, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); dev_dbg(dev, result = %d\n, result); /* send 3st cmd and recieve data */ @@ -198,7 +198,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x21, 0xa1, 0x, 0x, buf, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); debug_data(dev, __func__, len, buf, result); /* send 4 cmd */ @@ -217,7 +217,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x20, 0x21, 0x, 0x, buf, len, -HZ * USB_CTRL_GET_TIMEOUT); +USB_CTRL_GET_TIMEOUT); debug_data(dev, __func__, len, buf, result); /* send 5 cmd */ @@ -228,7 +228,7 @@ static void
[PATCH 2/8] USB: visor: fix initialisation of Treo/Kyocera devices
Fix regression introduced by commit 214916f2e (USB: visor: reimplement using generic framework) which broke initialisation of Treo/Kyocera devices that re-mapped bulk-in endpoints. Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/visor.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 8d1a3e6..9910aa2 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -560,9 +560,17 @@ static int treo_attach(struct usb_serial *serial) */ #define COPY_PORT(dest, src) \ do { \ + int i; \ + \ + for (i = 0; i ARRAY_SIZE(src-read_urbs); ++i) { \ + dest-read_urbs[i] = src-read_urbs[i]; \ + dest-read_urbs[i]-context = dest; \ + dest-bulk_in_buffers[i] = src-bulk_in_buffers[i]; \ + } \ dest-read_urb = src-read_urb; \ dest-bulk_in_endpointAddress = src-bulk_in_endpointAddress;\ dest-bulk_in_buffer = src-bulk_in_buffer; \ + dest-bulk_in_size = src-bulk_in_size; \ dest-interrupt_in_urb = src-interrupt_in_urb; \ dest-interrupt_in_urb-context = dest; \ dest-interrupt_in_endpointAddress = \ -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] chipidea: ci13xxx_imx: Fix error path
If usbmisc_ops-post() fails it should point the error path to release all previously acquired resources, so adjust it to call ci13xxx_remove_device(). While at it, remove the unnecessary 'plat_ci' indirection, as we can directly use the private structure. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/chipidea/ci13xxx_imx.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 585099a..a9afd06 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c @@ -99,7 +99,7 @@ static struct ci13xxx_platform_data ci13xxx_imx_platdata = { static int ci13xxx_imx_probe(struct platform_device *pdev) { struct ci13xxx_imx_data *data; - struct platform_device *plat_ci, *phy_pdev; + struct platform_device *phy_pdev; struct device_node *phy_np; struct resource *res; struct regulator *reg_vbus; @@ -187,11 +187,11 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) } } - plat_ci = ci13xxx_add_device(pdev-dev, + data-ci_pdev = ci13xxx_add_device(pdev-dev, pdev-resource, pdev-num_resources, ci13xxx_imx_platdata); - if (IS_ERR(plat_ci)) { - ret = PTR_ERR(plat_ci); + if (IS_ERR(data-ci_pdev)) { + ret = PTR_ERR(data-ci_pdev); dev_err(pdev-dev, Can't register ci_hdrc platform device, err=%d\n, ret); @@ -203,11 +203,10 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) if (ret) { dev_err(pdev-dev, usbmisc post failed, ret=%d\n, ret); - goto put_np; + goto disable_device; } } - data-ci_pdev = plat_ci; platform_set_drvdata(pdev, data); pm_runtime_no_callbacks(pdev-dev); @@ -215,6 +214,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) return 0; +disable_device: + ci13xxx_remove_device(data-ci_pdev); err: if (reg_vbus) regulator_disable(reg_vbus); -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] chipidea: ci13xxx_imx: Remove reg_vbus
There is no need to keep a 'reg_vbus' indirection, so get rid of it. The motivation for doing this change is that in the case of error, the current code only sets the local reg_vbus to NULL instead of updating the private structure 'data-reg_vbus'. Updating only the local reg_vbus is wrong, since we currently check for data-reg_vbus in the ci13xxx_imx_remove() function. In order to avoid such issue, just use 'data-reg_vbus' directly. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/chipidea/ci13xxx_imx.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index a9afd06..1661cac 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c @@ -102,7 +102,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) struct platform_device *phy_pdev; struct device_node *phy_np; struct resource *res; - struct regulator *reg_vbus; struct pinctrl *pinctrl; int ret; @@ -157,18 +156,17 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) } /* we only support host now, so enable vbus here */ - reg_vbus = devm_regulator_get(pdev-dev, vbus); - if (!IS_ERR(reg_vbus)) { - ret = regulator_enable(reg_vbus); + data-reg_vbus = devm_regulator_get(pdev-dev, vbus); + if (!IS_ERR(data-reg_vbus)) { + ret = regulator_enable(data-reg_vbus); if (ret) { dev_err(pdev-dev, Failed to enable vbus regulator, err=%d\n, ret); goto put_np; } - data-reg_vbus = reg_vbus; } else { - reg_vbus = NULL; + data-reg_vbus = NULL; } ci13xxx_imx_platdata.phy = data-phy; @@ -217,8 +215,8 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) disable_device: ci13xxx_remove_device(data-ci_pdev); err: - if (reg_vbus) - regulator_disable(reg_vbus); + if (data-reg_vbus) + regulator_disable(data-reg_vbus); put_np: if (phy_np) of_node_put(phy_np); -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] chipidea: ci13xxx_imx: Check if 'data-phy_np' is not NULL
Similarly as it is done in ci13xxx_imx_remove(), only calls of_node_put if data-phy_np is not NULL. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/chipidea/ci13xxx_imx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 1661cac..8b2d6cf 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c @@ -239,7 +239,8 @@ static int ci13xxx_imx_remove(struct platform_device *pdev) module_put(data-phy-dev-driver-owner); } - of_node_put(data-phy_np); + if (data-phy_np) + of_node_put(data-phy_np); clk_disable_unprepare(data-clk); -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] chipidea: ci13xxx_imx: Remove 'phy_np'
There is no need to keep a local 'phy_np' as we can directly use the private structure in data-phy_np. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- drivers/usb/chipidea/ci13xxx_imx.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 8b2d6cf..0810a19 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c @@ -100,7 +100,6 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) { struct ci13xxx_imx_data *data; struct platform_device *phy_pdev; - struct device_node *phy_np; struct resource *res; struct pinctrl *pinctrl; int ret; @@ -140,10 +139,9 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) return ret; } - phy_np = of_parse_phandle(pdev-dev.of_node, fsl,usbphy, 0); - if (phy_np) { - data-phy_np = phy_np; - phy_pdev = of_find_device_by_node(phy_np); + data-phy_np = of_parse_phandle(pdev-dev.of_node, fsl,usbphy, 0); + if (data-phy_np) { + phy_pdev = of_find_device_by_node(data-phy_np); if (phy_pdev) { struct usb_phy *phy; phy = pdev_to_phy(phy_pdev); @@ -218,8 +216,8 @@ err: if (data-reg_vbus) regulator_disable(data-reg_vbus); put_np: - if (phy_np) - of_node_put(phy_np); + if (data-phy_np) + of_node_put(data-phy_np); clk_disable_unprepare(data-clk); return ret; } -- 1.8.1.2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC V7 PATCH 0/3] USB: OHCI: Start splitting up the driver
On 27 May 2013 17:55, Manjunath Goudar manjunath.gou...@linaro.org wrote: This series of patches begins the process of splitting ohci-hcd up into a core library module and independent pci driver modules. Patch 1/3 prepares the way by exporting a few functions from ohci-hcd and adding a new mechanism for platform-specific drivers to initialize their hc_driver structures. This deserves to be done in the core because almost all of the entries in these structures are pure boilerplate -- practically none of the drivers need to override more than three of the standard core values. Patch 2/3 is part of separating the ohci pci host controller driver from ohci-hcd host code. Moved sb800_prefetch() function from ohci-pci.c to pci-quirks.c file and EXPORTed, this is part of the effort to move the ohci pci related code to generic pci code. Patch 3/3 separate out ohci-pci into independent driver modules. You need to tell everybody what has changed from V6 to V7.. -- 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] extcon: Palmas Extcon Driver
From: Graeme Gregory g...@slimlogic.co.uk This is the driver for the USB comparator built into the palmas chip. It handles the various USB OTG events that can be generated by cable insertion/removal. Signed-off-by: Graeme Gregory g...@slimlogic.co.uk Signed-off-by: Moiz Sonasath m-sonas...@ti.com Signed-off-by: Ruchika Kharwar ruch...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Signed-off-by: George Cherian george.cher...@ti.com [kis...@ti.com: adapted palmas usb driver to use the extcon framework] Signed-off-by: Sebastien Guiriec s-guir...@ti.com Signed-off-by: Chanwoo Choi cw00.c...@samsung.com Signed-off-by: Myungjoo Ham myungjoo@samsung.com --- Changes from v5: * removed regulator calls from palmas-usb as some platforms wont need it. These are now done in dwc3-omap.c as it is needed for OMAP. * removed all references to phy_companion as none of it is validated (SRP) and all of them were currently unreachable code. Changes from v4: * removed no_control_vbus property (to be used if the platform wants to use its own vbus control. * removed unnecessary headers * moved the palmas_usb_state to palmas.h * misc cleanups *A checkpatch warning WARNING: static const char * array should probably be static const char * constis ignored since it introduces a compilation warning. Changes from v3: * adapted the driver to extcon framework (so moved to drivers/extcon) * removed palmas_usb_(write/read) and replaced all calls with palmas_(read/write). * ignored a checkpatch warning in the line static const char *palmas_extcon_cable[] = { as it seemed to be incorrect? * removed all references to OMAP in this driver. * couldn't test this driver with mainline as omap5 panda is not booting with mainline. * A comment to change to platform_get_irq from regmap is not done as I felt the data should come from regmap in this case. Changes from v2: * Moved the driver to drivers/usb/phy/ * Added a bit more explanation in Kconfig .../devicetree/bindings/extcon/extcon-twl.txt | 15 ++ drivers/extcon/Kconfig | 7 + drivers/extcon/Makefile| 1 + drivers/extcon/extcon-palmas.c | 246 + include/linux/mfd/palmas.h | 26 ++- 5 files changed, 283 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-twl.txt create mode 100644 drivers/extcon/extcon-palmas.c diff --git a/Documentation/devicetree/bindings/extcon/extcon-twl.txt b/Documentation/devicetree/bindings/extcon/extcon-twl.txt new file mode 100644 index 000..58f531a --- /dev/null +++ b/Documentation/devicetree/bindings/extcon/extcon-twl.txt @@ -0,0 +1,15 @@ +EXTCON FOR TWL CHIPS + +PALMAS USB COMPARATOR +Required Properties: + - compatible : Should be ti,palmas-usb or ti,twl6035-usb + - vbus-supply : phandle to the regulator device tree node. + +Optional Properties: + - ti,wakeup : To enable the wakeup comparator in probe + +palmas-usb { + compatible = ti,twl6035-usb, ti,palmas-usb; + vbus-supply = smps10_reg; + ti,wakeup; +}; diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig index 3297301..63f454e 100644 --- a/drivers/extcon/Kconfig +++ b/drivers/extcon/Kconfig @@ -53,4 +53,11 @@ config EXTCON_ARIZONA with Wolfson Arizona devices. These are audio CODECs with advanced audio accessory detection support. +config EXTCON_PALMAS + tristate Palmas USB EXTCON support + depends on MFD_PALMAS + help + Say Y here to enable support for USB peripheral and USB host + detection by palmas usb. + endif # MULTISTATE_SWITCH diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile index f98a3c4..540e2c3 100644 --- a/drivers/extcon/Makefile +++ b/drivers/extcon/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_EXTCON_ADC_JACK) += extcon-adc-jack.o obj-$(CONFIG_EXTCON_MAX77693) += extcon-max77693.o obj-$(CONFIG_EXTCON_MAX8997) += extcon-max8997.o obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o +obj-$(CONFIG_EXTCON_PALMAS)+= extcon-palmas.o diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c new file mode 100644 index 000..b752a0a --- /dev/null +++ b/drivers/extcon/extcon-palmas.c @@ -0,0 +1,246 @@ +/* + * Palmas USB transceiver driver + * + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Graeme Gregory g...@slimlogic.co.uk + * Author: Kishon Vijay Abraham I kis...@ti.com + * + * Based on twl6030_usb.c + * + * Author: Hema HK hem...@ti.com + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty
[PATCH v2] usb: dwc3: use extcon fwrk to receive connect/disconnect notification
Modified dwc3-omap to receive connect and disconnect notification using extcon framework. Also did the necessary cleanups required after adapting to extcon framework. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Chanwoo Choi cw00.c...@samsung.com --- Changes from v1: * regulator enable/disable is now done here instead of palmas-usb as some users of palmas-usb wont need regulator. drivers/usb/dwc3/dwc3-omap.c | 103 ++ include/linux/usb/dwc3-omap.h | 30 2 files changed, 85 insertions(+), 48 deletions(-) delete mode 100644 include/linux/usb/dwc3-omap.h diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 34638b9..158f903 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -43,13 +43,14 @@ #include linux/spinlock.h #include linux/platform_device.h #include linux/platform_data/dwc3-omap.h -#include linux/usb/dwc3-omap.h #include linux/pm_runtime.h #include linux/dma-mapping.h #include linux/ioport.h #include linux/io.h #include linux/of.h #include linux/of_platform.h +#include linux/extcon.h +#include linux/regulator/consumer.h #include linux/usb/otg.h @@ -124,9 +125,21 @@ struct dwc3_omap { u32 utmi_otg_status; u32 dma_status:1; + + struct extcon_specific_cable_nb extcon_vbus_dev; + struct extcon_specific_cable_nb extcon_id_dev; + struct notifier_block vbus_nb; + struct notifier_block id_nb; + + struct regulator*vbus_reg; }; -static struct dwc3_omap*_omap; +enum omap_dwc3_vbus_id_status { + OMAP_DWC3_ID_FLOAT, + OMAP_DWC3_ID_GROUND, + OMAP_DWC3_VBUS_OFF, + OMAP_DWC3_VBUS_VALID, +}; static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset) { @@ -138,18 +151,21 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value) writel(value, base + offset); } -int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) +static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, + enum omap_dwc3_vbus_id_status status) { - u32 val; - struct dwc3_omap*omap = _omap; - - if (!omap) - return -EPROBE_DEFER; + int ret; + u32 val; switch (status) { case OMAP_DWC3_ID_GROUND: dev_dbg(omap-dev, ID GND\n); + ret = regulator_enable(omap-vbus_reg); + if (ret) { + dev_dbg(omap-dev, regulator enable failed\n); + return; + } val = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS); val = ~(USBOTGSS_UTMI_OTG_STATUS_IDDIG | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID @@ -162,6 +178,11 @@ int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) case OMAP_DWC3_VBUS_VALID: dev_dbg(omap-dev, VBUS Connect\n); + ret = regulator_enable(omap-vbus_reg); + if (ret) { + dev_dbg(omap-dev, regulator enable failed\n); + return; + } val = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS); val = ~USBOTGSS_UTMI_OTG_STATUS_SESSEND; val |= USBOTGSS_UTMI_OTG_STATUS_IDDIG @@ -182,15 +203,13 @@ int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) val |= USBOTGSS_UTMI_OTG_STATUS_SESSEND | USBOTGSS_UTMI_OTG_STATUS_IDDIG; dwc3_omap_writel(omap-base, USBOTGSS_UTMI_OTG_STATUS, val); + regulator_disable(omap-vbus_reg); break; default: - dev_dbg(omap-dev, ID float\n); + dev_dbg(omap-dev, invalid state\n); } - - return 0; } -EXPORT_SYMBOL_GPL(dwc3_omap_mailbox); static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) { @@ -282,6 +301,32 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap) static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32); +static int dwc3_omap_id_notifier(struct notifier_block *nb, + unsigned long event, void *ptr) +{ + struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, id_nb); + + if (event) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); + else + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_FLOAT); + + return NOTIFY_DONE; +} + +static int dwc3_omap_vbus_notifier(struct notifier_block *nb, + unsigned long event, void *ptr) +{ + struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, vbus_nb); + + if (event) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); + else + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF); + + return NOTIFY_DONE; +} + static int dwc3_omap_probe(struct platform_device
Re: [PATCH 2/2] usb-serial: Moxa UPORT 12XX/14XX/16XX driver
On Sun, May 26, 2013 at 07:19:03PM +0200, Andrew Lunn wrote: On Sun, May 26, 2013 at 06:04:24PM +0200, Johan Hovold wrote: On Sun, May 26, 2013 at 01:00:51PM +0200, Andrew Lunn wrote: [...] +/* + * mxuport_prepare_write_buffer - fill in the buffer, ready for + * sending + * + * Add a four byte header containing the port number and the number of + * bytes of data in the message. Return the number of bytes in the + * buffer. + */ +static int mxuport_prepare_write_buffer(struct usb_serial_port *port, + void *dest, size_t size) +{ + struct mxuport_port *mx_port = usb_get_serial_port_data(port); + unsigned char *buf = dest; + int count; + + count = kfifo_out_locked(port-write_fifo, buf + 4, size - 4, + port-lock); + + put_unaligned_be16(mx_port-portno, buf); + put_unaligned_be16(count, buf + 2); + + dev_dbg(port-dev, %s - port %d, size %d count %d, __func__, + mx_port-portno, size, count); + + return count + 4; +} + +/* + * mxuport_write_start - kick off an URB write + * @port:Pointer to the struct usb_serial_port data + * + * Returns zero on success, or a negative errno value + */ +static int mxuport_write_start(struct usb_serial_port *port) +{ + struct usb_serial *serial = port-serial; + struct urb *urb; + int count, result; + unsigned long flags; + int i; + struct usb_serial_port *port0; + + if (test_and_set_bit_lock(USB_SERIAL_WRITE_BUSY, port-flags)) + return 0; + + /* All data goes over port 0 endpoints */ + port0 = serial-port[0]; + +retry: + spin_lock_irqsave(port-lock, flags); + if (!port0-write_urbs_free || !kfifo_len(port-write_fifo)) { + clear_bit_unlock(USB_SERIAL_WRITE_BUSY, port-flags); + spin_unlock_irqrestore(port-lock, flags); + return 0; + } + i = (int)find_first_bit(port0-write_urbs_free, + ARRAY_SIZE(port0-write_urbs)); + spin_unlock_irqrestore(port-lock, flags); + + urb = port0-write_urbs[i]; + count = mxuport_prepare_write_buffer(port, urb-transfer_buffer, + port0-bulk_out_size); + urb-transfer_buffer_length = count; + if (debug) + usb_serial_debug_data(port-dev, __func__, count, + urb-transfer_buffer); + spin_lock_irqsave(port-lock, flags); + port-tx_bytes += count; + spin_unlock_irqrestore(port-lock, flags); + + clear_bit(i, port0-write_urbs_free); + + /* Set the context to point to the real port, not port 0 */ + urb-context = port; + + result = usb_submit_urb(urb, GFP_ATOMIC); + if (result) { + dev_err_console(port, %s - error submitting urb: %d\n, + __func__, result); + set_bit(i, port0-write_urbs_free); + spin_lock_irqsave(port-lock, flags); + port-tx_bytes -= count; + spin_unlock_irqrestore(port-lock, flags); + + clear_bit_unlock(USB_SERIAL_WRITE_BUSY, port-flags); + return result; + } + + /* Try sending off another urb, unless in irq context (in which case + * there will be no free urb). */ + if (!in_irq()) + goto retry; + + clear_bit_unlock(USB_SERIAL_WRITE_BUSY, port-flags); + + return 0; +} + +/* + * mxuport_write - write function + * @tty: Pointer to struct tty_struct for the device + * @port:Pointer to the usb_serial_port structure for the device + * @buf: Pointer to the data to write + * @count: Number of bytes to write + * + * Returns the number of characters actually written, which may be anything + * from zero to @count. If an error occurs, it returns the negative errno + * value. + */ +static int mxuport_write(struct tty_struct *tty, struct usb_serial_port *port, + const unsigned char *buf, int count) +{ + int result; + + if (!count) + return 0; + + count = kfifo_in_locked(port-write_fifo, buf, count, port-lock); + result = mxuport_write_start(port); + if (result) + return result; + + return count; +} + +/* + * mxuport_write_bulk_callback - A write has completed + * + * Now that the write is complete, update the count of transmitted + * characters and make the URB is available to be reused. Start the + * next transmission. + */ + +static void mxuport_write_bulk_callback(struct urb *urb) +{ + unsigned long flags; + struct usb_serial_port *port = urb-context; + struct usb_serial_port *port0 = port-serial-port[0]; + + int err = urb-status; + int i; + + dev_dbg(port-dev, %s\n, __func__); + + for (i = 0; i ARRAY_SIZE(port0-write_urbs); ++i) + if (port0-write_urbs[i] == urb) +
Re: [PATCH V4] usb: ehci-s5p: skip phy setup for Exynos5440 based platforms
On Mon, 27 May 2013, Jingoo Han wrote: From: Thomas Abraham thomas...@samsung.com Exynos5440 does not require any explict USB phy configuration. So skip the USB phy configuration for Exynos5440 based platforms. Signed-off-by: Thomas Abraham thomas...@samsung.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Jingoo Han jg1@samsung.com --- Changes since v3: - added empty_platdata as Alan Stern guided. Changes since v2: - changed all occurrences of s5p_ehci-pdata-phy*. - set s5p_ehci-pdata to NULL. Changes since v1: - re-based on the latest 'linux-next' tree Acked-by: Alan Stern st...@rowland.harvard.edu -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC V7 PATCH 1/3] USB: OHCI: prepare to make ohci-hcd a library module
On Mon, 27 May 2013, Manjunath Goudar wrote: This patch prepares ohci-hcd for being split up into a core library and separate platform driver modules. A generic ohci_hc_driver structure is created, containing all the standard values, and a new mechanism is added whereby a driver module can specify a set of overrides to those values. In addition the ohci_restart(),ohci_suspend() and ohci_resume() routines need to be EXPORTed for use by the drivers. Added ohci_setip(() and ohci_start() routine for to start the generic controller rather than each having its own idiosyncratic approach. This allow to clean duplicated code in most of SOC driver In V2: -ohci_hcd_init() ohci_run() and ohci_stop() are not made non-static. -Adds the ohci_setup() and ohci_start() routine. There's one thing we forgot about: +/* ohci_setup routine for generic controller initialization */ + +int ohci_setup(struct usb_hcd *hcd) +{ + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + + return ohci_init(ohci); +} +EXPORT_SYMBOL_GPL(ohci_setup); This routine needs to call ohci_hcd_init() before ohci_init(). 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: [RFC V7 PATCH 2/3] USB: OHCI: Generic changes to make ohci-pci a separate driver
On Mon, 27 May 2013, Manjunath Goudar wrote: Note that this changes is part of separating the ohci pci host controller driver from ohci-hcd host code. This contains : -Moved sb800_prefetch() function from ohci-pci.c to pci-quirks.c file and EXPORTed, this is part of the effort to move the ohci pci related code to generic pci code. -Passed device argument instead of ohci_hcd in sb800_prefetch() function to avoid extra include file in pci-quirks.c. V2: -Passed device argment instead of pci_dev, then we use to_pci_dev() to get the pci_dev structure. Acked-by: Alan Stern st...@rowland.harvard.edu -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC V7 PATCH 3/3] USB: OHCI: make ohci-pci a separate driver
On Mon, 27 May 2013, Manjunath Goudar wrote: This patch splits the PCI portion of ohci-hcd out into its own separate driver module, called ohci-pci. The major point of difficulty lies in ohci-pci's many vendor- and device-specific workarounds. Some of them have to be applied before calling ohci_start() some after, which necessitates a fair amount of code motion. The other platform drivers require much smaller changes. The complete sb800_prefetch() function moved to ohci-q.c,because its only related to ohci-pci driver. V2: - few specific content of pci related code in ohci_pci_start function has been moved to ohci_pci_reset and rest of the generic code is written in ohci_start of ohci-hcd.c file. V3: - ohci_restart() has been called in ohci_pci_reset() function for to reset the ohci pci. V4: -sb800_prefetch() moved to ohci-q.c,because its only related to ohci-pci. -no longer _creating_ CONFIG_USB_OHCI_PCI,creating CONFIG_USB_OHCI_HCD_PCI. -overrides renamed with pci_override,its giving proper meaning. V5: -sb800_prefetch() moved to pci-quirks.c,because its only related to pci. V6: -sb800_prefetch() function has been moved to pci-quirks.c made as separate patch in 2/3. -Most of the generic ohci pci changes moved in 2/3 patch,now this is complete ohci-pci separation patch. V7: -Unrelated include file has been removed from ohci.h file. One tiny mistake still remains... @@ -242,94 +249,24 @@ static int ohci_pci_reset (struct usb_hcd *hcd) ret = quirk(hcd); } } - if (ret == 0) { - ohci_hcd_init (ohci); - return ohci_init (ohci); - } ... + if (ret == 0) + ohci_setup(hcd); This should say ret = ohci_setup(hcd); so that errors in ohci_setup() won't be ignored. + /* + * After ohci setup RWC may not be set for add-in PCI cards. + * This transfers PCI PM wakeup capabilities. + */ + if (device_can_wakeup(pdev-dev)) + ohci-hc_control |= OHCI_CTRL_RWC; return ret; } 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
MUSB multiplatform work?
Hi Felipe, We've gone through remaining work items for getting the ARM kernel to full multiplatform support again, and MUSB came up. I'm sure you have your own thoughts on this, but I'd like to know if there is already a plan in place. From what I can see, the driver in PIO mode should almost work on multiple platforms, but there are a couple of compile-time dependencies in it that need to be turned into run-time conditionals. In particular the TUSB version seem sufficiently different that it needs some extra work to be a true run-time option. The DMA support as far as I can tell has never been intended to be usable in a multiplatform setup, but that also seems doable. Looking just at the #ifdef statements in the driver, I found that the following things need to be addressed: * abstract musb_write_fifo and musb_read_fifo into callbacks * move fifo_mode setting into glue driver for runtime selection * turn TUSB compile-time switches into run-time conditionals * turn musb_ep_select into run-time switch * make is_dma_capable/is_cppi_enabled/tusb_dma_omap run-time conditionals * abtract dma_controller_create/destroy interface Aside from this, a recent discussion with Maxime has brought up that the Allwinner A1x platform (mach-sunxi) contains an MUSB variant that is currently used with an independently implemented device driver, see https://github.com/linux-sunxi/linux-sunxi/tree/sunxi-3.0/drivers/usb/sun5i_usb I wonder if you have any insight on how that can be integrated into musb, or whether it is likely to be a compatible version to start with. Arnd -- 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: Linux USB file storage gadget with new UDC
On Mon, 27 May 2013, victor yeo wrote: I can't say much more without seeing the code. However, you should not need to wait for the hardware to do something -- instead the interrupt handler routine should be called when the hardware is finished. Yes, it is silly. The hardware interrupt is not being generated for every SCSI command received, so the driver has to poll. I put the polling code in a thread, and this dilemma is fixed. Are you sure about this? If it is correct, you should _fix_ the interrupt problem. Don't try to work around it by creating a new thread. Figure out why there isn't an interrupt. Does your driver forget to set an interrupt-enable bit? I still observe the SCSI_WRITE_10 command time out sometimes. When time out happens, the gadget log shows: g_file_storage gadget: invalid CBW: len 512 sig 0x6f007442 g_file_storage gadget: bulk-in set wedge Is it because the gadget expects 31 byte command, but 512 byte data is received instead? No. It is because kagen2_ep_queue returned _before_ a new command was received, probably as a result of your polling thread. Since there was no new command, the data in the buffer was wrong. The full UDC/gadget log is attached. Hope it is useful. If not, i will add in more printk statements. You can see the problem in the log: g_file_storage gadget: bulk-in, length 13: : 55 53 42 53 50 00 00 00 00 00 00 00 00 [start_transfer] 53425355 50 ept1 in queue len 0xd, buffer 0xc0c3c000 0: 0x53425355 4: 0x50 8: 0x0 bulk_in_complete -- 0, 13/13 That was the end of the previous command. Now the gadget waits for a new command to arrive. [start_transfer] 6f007442 7000 ept1 out queue len 0x200, buffer 0xc1338000 before kagen2_ep_queue after kagen2_ep_queue kagen2_ep_queue 512 512 512 [kagen2_ep_queue] 6f007442 7000 kagen2_ep_queue returned but there was no interrupt. This means no new data was received, so the old data is still in the buffer. g_file_storage gadget: bulk_out_complete -- 0, 512/31 g_file_storage gadget: invalid CBW: len 512 sig 0x6f007442 g_file_storage gadget: bulk-in set wedge That 0x6f007442 is the old data from the previous command, as you can see from the log messages (it is the same data that was present when kagen2_ep_queue was called). 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: usb-audio regression 3.8.5-3.9.2
On Sat, 25 May 2013, Tobias Diedrich wrote: I've recently upgraded my kernel from 3.8.5 to 3.9.2 and ran into an issue with usb-audio: With two different usb-headsets, pulseaudio is now regularily losing the microphone audio stream (which just gets 'stuck', i.e. the level indicator bar in pavucontrol doesn't move anymore, but is not at 0). Every time this happens I get kernel messages like these: May 25 11:05:01 nukunuku kernel: [43611.510661] delay: estimated 221, actual 0 May 25 11:06:02 nukunuku kernel: [43672.086015] delay: estimated 222, actual 1 May 25 11:06:02 nukunuku kernel: [43672.102018] delay: estimated 133, actual 0 May 25 11:07:03 nukunuku kernel: [43733.814401] delay: estimated 133, actual 0 May 25 11:08:02 nukunuku kernel: [43792.636147] delay: estimated 89, actual 0 May 25 11:10:03 nukunuku kernel: [43913.539550] cannot submit urb (err = -18) May 25 11:10:03 nukunuku kernel: [43913.539610] cannot submit urb (err = -18) May 25 11:10:03 nukunuku kernel: [43913.539622] cannot submit urb (err = -18) May 25 11:10:03 nukunuku kernel: [43913.539630] cannot submit urb (err = -18) May 25 11:10:03 nukunuku kernel: [43913.539637] cannot submit urb (err = -18) May 25 11:10:03 nukunuku kernel: [43913.539643] cannot submit urb (err = -18) May 25 11:10:03 nukunuku kernel: [43913.539658] cannot submit urb (err = -18) May 25 11:10:03 nukunuku kernel: [43913.539664] cannot submit urb (err = -18) Now, replugging the headset fixes the issue temporarily until it happens again, but that's a bit annoying if you're in a video call... 00:10.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller (rev 03) 00:10.1 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller (rev 03) 00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller (rev 11) 00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 11) 00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller (rev 11) 00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 11) usb-audio devices in question: Bus 003 Device 004: ID 041e:0401 Creative Technology, Ltd Bus 004 Device 002: ID 041e:30df Creative Technology, Ltd Bus 004 Device 003: ID 047f:c009 Plantronics, Inc. Please post the contents of /sys/kernel/debug/usb/devices. 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: [regression] USB: EHCI: changes related to qh_refresh()
On Mon, 27 May 2013, Oleksij Rempel wrote: Am 27.05.2013 17:24, schrieb Alan Stern: On Mon, 27 May 2013, Oleksij Rempel wrote: Hello Alan, i have regression with this patch: commit c1fdb68e3d73741630ca16695cf9176c233be7ed Author: Alan Stern st...@rowland.harvard.edu Date: Fri Mar 22 13:30:43 2013 -0400 USB: EHCI: changes related to qh_refresh() This patch (as1638) makes several changes to the ehci-hcd driver, all related to the qh_refresh() function. This function must be called whenever an idle QH gets linked back into either the async or the periodic schedule. Change a BUG_ON() in the qh_update routine to a WARN_ON(). Since this code runs in atomic context, a BUG_ON() would immediately freeze the whole system. Remove two unneeded calls to qh_refresh(), one when a QH is initialized and one when a QH becomes idle. Adjust the adjacent comments accordingly. all devices seems to work fine except rts5139. It is not working an I get this warnings: Are you certain this commit is responsible for the errors? How did you check? i did git bisect. But i also compared results with git reset --hard ... last working version is 3.9.0-rc4-00046-gc79041a. I can't revert this commit on current master HEAD. Hmmm. Maybe we can narrow this down. What happens if you apply only parts of the commit? For example, on top of c97041a, try applying only the hunks that change ehci-sched.c. If that works, try applying also only the last hunk affecting ehci-q.c. If that works, try applying also the two previous hunks. 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
[RFC PATCH 0/2] dma-unmap: allow to only unmap completed DMA buffer
This patchset tries to loose the check on DMA buffer size in check_unmap() of dma-debug first, then only unmap the actual completed DMA buffer in USB unmap path. Considered that DMA unmapping often runs in hard irq context, the patch set may save irq handling time. And the improvement can be observed on ARMv7(Pandaboard) with the chage, at average ~25us is saved about ehci irq handling under usbnet ping test case. 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
[RFC PATCH 1/2] dma-debug: allow size to become smaller in dma_unmap
This patch looses the check on DMA buffer size for streaming DMA unmap, based on the below fact: - it is common to see only part of DMA transfer is completed, especially in case of DMA_FROM_DEVICE So it isn't necessary to unmap the whole DMA buffer inside DMA unmapping, and unmapping the actual completed buffer should be more efficient. Considered that unmapping is often called in hard irq context, time of irq handling can be saved. Cc: Shuah Khan shuah.k...@hp.com Cc: Joerg Roedel j...@8bytes.org Cc: Andrew Morton a...@linux-foundation.org Cc: Alexander Duyck alexander.h.du...@intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Signed-off-by: Ming Lei ming@canonical.com --- lib/dma-debug.c | 39 ++- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/dma-debug.c b/lib/dma-debug.c index d87a17a..202c522 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c @@ -857,6 +857,7 @@ static void check_unmap(struct dma_debug_entry *ref) struct dma_debug_entry *entry; struct hash_bucket *bucket; unsigned long flags; + unsigned int size_invalid = 0; bucket = get_hash_bucket(ref, flags); entry = bucket_find_exact(bucket, ref); @@ -879,13 +880,8 @@ static void check_unmap(struct dma_debug_entry *ref) return; } - if (ref-size != entry-size) { - err_printk(ref-dev, entry, DMA-API: device driver frees - DMA memory with different size - [device address=0x%016llx] [map size=%llu bytes] - [unmap size=%llu bytes]\n, - ref-dev_addr, entry-size, ref-size); - } + if (ref-size entry-size) + size_invalid = 1; if (ref-type != entry-type) { err_printk(ref-dev, entry, DMA-API: device driver frees @@ -894,18 +890,27 @@ static void check_unmap(struct dma_debug_entry *ref) [mapped as %s] [unmapped as %s]\n, ref-dev_addr, ref-size, type2name[entry-type], type2name[ref-type]); - } else if ((entry-type == dma_debug_coherent) - (ref-paddr != entry-paddr)) { - err_printk(ref-dev, entry, DMA-API: device driver frees - DMA memory with different CPU address - [device address=0x%016llx] [size=%llu bytes] - [cpu alloc address=0x%016llx] - [cpu free address=0x%016llx], - ref-dev_addr, ref-size, - (unsigned long long)entry-paddr, - (unsigned long long)ref-paddr); + } else if (entry-type == dma_debug_coherent) { + if (ref-paddr != entry-paddr) + err_printk(ref-dev, entry, DMA-API: device driver frees + DMA memory with different CPU address + [device address=0x%016llx] [size=%llu bytes] + [cpu alloc address=0x%016llx] + [cpu free address=0x%016llx], + ref-dev_addr, ref-size, + (unsigned long long)entry-paddr, + (unsigned long long)ref-paddr); + if (ref-size != entry-size) + size_invalid = 1; } + if (size_invalid) + err_printk(ref-dev, entry, DMA-API: device driver frees + DMA memory with different size + [device address=0x%016llx] [map size=%llu bytes] + [unmap size=%llu bytes]\n, + ref-dev_addr, entry-size, ref-size); + if (ref-sg_call_ents ref-type == dma_debug_sg ref-sg_call_ents != entry-sg_call_ents) { err_printk(ref-dev, entry, DMA-API: device driver frees -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] USB: hcd: only unmap the actual completed DMA buffer
This patch only unmap the actual completed DMA buffer instead of the whole transfer buffer. It is common to see only part of DMA transfer is completed, especially in case of DMA_FROM_DEVICE because the length of incoming traffic often is unknown before submitting URB, so this patch may improve USB DMA unmapping which runs in hard irq context. The patch has been tested on ARMv7(Pandaboard), and it is observed that at average ~25us is saved about ehci interrupt handling on below usbnet test case: - Pandaboard: IP address is IP_A - on one x86 box, run below command: #ping -f -s 1472 IP_A - compute ehci interrupt handling time on Pandaboard during ping test Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Ming Lei ming@canonical.com --- drivers/usb/core/hcd.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 53baa87..2722487 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1374,12 +1374,12 @@ void usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) else if (urb-transfer_flags URB_DMA_MAP_PAGE) dma_unmap_page(hcd-self.controller, urb-transfer_dma, - urb-transfer_buffer_length, + urb-actual_length, dir); else if (urb-transfer_flags URB_DMA_MAP_SINGLE) dma_unmap_single(hcd-self.controller, urb-transfer_dma, - urb-transfer_buffer_length, + urb-actual_length, dir); else if (urb-transfer_flags URB_MAP_LOCAL) hcd_free_coherent(urb-dev-bus, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [regression] USB: EHCI: changes related to qh_refresh()
Am 27.05.2013 17:59, schrieb Alan Stern: On Mon, 27 May 2013, Oleksij Rempel wrote: Am 27.05.2013 17:24, schrieb Alan Stern: On Mon, 27 May 2013, Oleksij Rempel wrote: Hello Alan, i have regression with this patch: commit c1fdb68e3d73741630ca16695cf9176c233be7ed Author: Alan Stern st...@rowland.harvard.edu Date: Fri Mar 22 13:30:43 2013 -0400 USB: EHCI: changes related to qh_refresh() This patch (as1638) makes several changes to the ehci-hcd driver, all related to the qh_refresh() function. This function must be called whenever an idle QH gets linked back into either the async or the periodic schedule. Change a BUG_ON() in the qh_update routine to a WARN_ON(). Since this code runs in atomic context, a BUG_ON() would immediately freeze the whole system. Remove two unneeded calls to qh_refresh(), one when a QH is initialized and one when a QH becomes idle. Adjust the adjacent comments accordingly. all devices seems to work fine except rts5139. It is not working an I get this warnings: Are you certain this commit is responsible for the errors? How did you check? i did git bisect. But i also compared results with git reset --hard ... last working version is 3.9.0-rc4-00046-gc79041a. I can't revert this commit on current master HEAD. Hmmm. Maybe we can narrow this down. What happens if you apply only parts of the commit? For example, on top of c97041a, try applying only the hunks that change ehci-sched.c. If that works, try applying also only the last hunk affecting ehci-q.c. If that works, try applying also the two previous hunks. after ehci-sched.c hank i have this problem again: +++ b/drivers/usb/host/ehci-sched.c @@ -792,7 +792,6 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh unsignedframe; /* 0..(qh-period - 1), or NO_FRAME */ struct ehci_qh_hw *hw = qh-hw; - qh_refresh(ehci, qh); hw-hw_next = EHCI_LIST_END(ehci); frame = qh-start; @@ -844,8 +843,6 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh } else ehci_dbg (ehci, reused qh %p schedule\n, qh); - /* stuff into the periodic schedule */ - qh_link_periodic(ehci, qh); done: return status; } @@ -891,6 +888,12 @@ static int intr_submit ( qh = qh_append_tds(ehci, urb, qtd_list, epnum, urb-ep-hcpriv); BUG_ON (qh == NULL); + /* stuff into the periodic schedule */ + if (qh-qh_state == QH_STATE_IDLE) { + qh_refresh(ehci, qh); + qh_link_periodic(ehci, qh); + } + /* ... update usbfs periodic stats */ ehci_to_hcd(ehci)-self.bandwidth_int_reqs++; -- Regards, Oleksij -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] USB: hcd: only unmap the actual completed DMA buffer
Hello. On 27-05-2013 20:13, Ming Lei wrote: This patch only unmap the actual completed DMA buffer instead of the whole transfer buffer. Who will unmap the rest of the buffer? It is common to see only part of DMA transfer is completed, especially in case of DMA_FROM_DEVICE because the length of incoming traffic often is unknown before submitting URB, so this patch may improve USB DMA unmapping which runs in hard irq context. The patch has been tested on ARMv7(Pandaboard), and it is observed that at average ~25us is saved about ehci interrupt handling on below usbnet test case: - Pandaboard: IP address is IP_A - on one x86 box, run below command: #ping -f -s 1472 IP_A - compute ehci interrupt handling time on Pandaboard during ping test This seems just crazy to me. What has been mapped, should be unmapped. Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Ming Lei ming@canonical.com --- drivers/usb/core/hcd.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ARM: OMAP4: USB_EHCI_HCD needs USB_PHY and NOP_USB_XCEIV
On Saturday 25 May 2013, Adrien Vergé wrote: On OMAP4 platforms, EHCI HCD needs the physical layer signalling activated, along with the NOP USB Transceiver driver. Otherwise, the kernel boots without registering any USB device. This does not actually sound like a critical error: If a user forgets to enable a driver, that driver will not be loaded. Of course the kernel should not just crash when a non-essential driver is missing, and it should not fail to build, but your description sounds harmless. Am I missing something? This patch applies to Linux 3.10-rc2. Signed-off-by: Adrien Vergé adrienve...@gmail.com --- diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index de94f26..47959d7 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -44,6 +44,8 @@ endif # USB_XHCI_HCD config USB_EHCI_HCD tristate EHCI HCD (USB 2.0) support This is the wrong place: it should be in USB_EHCI_HCD_OMAP if any. depends on USB_ARCH_HAS_EHCI + select USB_PHY if ARCH_OMAP4 + select NOP_USB_XCEIV if ARCH_OMAP4 ---help--- The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0 high speed (480 Mbit/sec, 60 Mbyte/sec) host controller hardware. 'select'ing USB_PHY sounds wrong too, I think you mean 'depends on'. Also note that Roger Quadros has just removed the 'select NOP_USB_XCEIV' there, I think you should coordinate with him. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 0/2] dma-unmap: allow to only unmap completed DMA buffer
On Tue, 28 May 2013, Ming Lei wrote: This patchset tries to loose the check on DMA buffer size in check_unmap() of dma-debug first, then only unmap the actual completed DMA buffer in USB unmap path. Considered that DMA unmapping often runs in hard irq context, the patch set may save irq handling time. And the improvement can be observed on ARMv7(Pandaboard) with the chage, at average ~25us is saved about ehci irq handling under usbnet ping test case. Are you aware that these changes directly contradict the advice in Documentation/DMA-API.txt? That file says: void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction direction) Unmaps the region previously mapped. All the parameters passed in must be identical to those passed in (and returned) by the mapping API. If you are going to make a change like this then you have to change the documentation too. But in fact I doubt that the proposed change will work correctly in all circumstances. For example, if an IOMMU is present. 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: [RFC PATCH 1/2] dma-debug: allow size to become smaller in dma_unmap
On 05/27/2013 09:13 AM, Ming Lei wrote: This patch looses the check on DMA buffer size for streaming DMA unmap, based on the below fact: - it is common to see only part of DMA transfer is completed, especially in case of DMA_FROM_DEVICE So it isn't necessary to unmap the whole DMA buffer inside DMA unmapping, and unmapping the actual completed buffer should be more efficient. Considered that unmapping is often called in hard irq context, time of irq handling can be saved. Cc: Shuah Khan shuah.k...@hp.com Cc: Joerg Roedel j...@8bytes.org Cc: Andrew Morton a...@linux-foundation.org Cc: Alexander Duyck alexander.h.du...@intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Signed-off-by: Ming Lei ming@canonical.com What you are proposing doesn't make much sense. If you are only wanting to use part of a buffer then just use the dma_sync primitives. The idea behind unmapping a buffer is to free any resources associated with it. Calling map once, and unmap multiple times per buffer is just asking for trouble in the form of use after free or memory leaks. Thanks, Alex -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC V7 PATCH 3/3] USB: OHCI: make ohci-pci a separate driver
On Monday 27 May 2013, Manjunath Goudar wrote: This patch splits the PCI portion of ohci-hcd out into its own separate driver module, called ohci-pci. The major point of difficulty lies in ohci-pci's many vendor- and device-specific workarounds. Some of them have to be applied before calling ohci_start() some after, which necessitates a fair amount of code motion. The other platform drivers require much smaller changes. The complete sb800_prefetch() function moved to ohci-q.c,because its only related to ohci-pci driver. I just gave this a little test run in qemu and on my server. @@ -446,7 +446,7 @@ config USB_OHCI_HCD_PPC_OF default USB_OHCI_HCD_PPC_OF_BE || USB_OHCI_HCD_PPC_OF_LE config USB_OHCI_HCD_PCI - bool OHCI support for PCI-bus USB controllers + tristate OHCI support for PCI-bus USB controllers depends on PCI (STB03xxx || PPC_MPC52xx || USB_OHCI_HCD_PPC_OF) default y select USB_OHCI_LITTLE_ENDIAN There is a preexisting bug in this symbol: USB_OHCI_HCD_PCI was previously unused, and has a bogus 'depends' line, which causes it to not be selectable on anything but PPC. You have to change this to only 'depends on PCI'. } - if (ret == 0) { - ohci_hcd_init (ohci); - return ohci_init (ohci); - } - return ret; -} I found that the call to ohci_hcd_init() that is removed here is not getting added in any other place, which caused a NULL pointer dereference the first time we actually try to use the driver. Adding the call back into the new ohci_setup function makes it work again. Please fold the patch below into your patch, unless Alan discovers something wrong with it. Signed-off-by: Arnd Bergmann a...@arndb.de diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f948e8f..eef6dc5 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -454,7 +454,7 @@ config USB_OHCI_HCD_PPC_OF config USB_OHCI_HCD_PCI tristate OHCI support for PCI-bus USB controllers - depends on PCI (STB03xxx || PPC_MPC52xx || USB_OHCI_HCD_PPC_OF) + depends on PCI default y select USB_OHCI_CORE select USB_OHCI_LITTLE_ENDIAN diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 3da8c3a..5601139 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -763,6 +763,8 @@ int ohci_setup(struct usb_hcd *hcd) { struct ohci_hcd *ohci = hcd_to_ohci(hcd); + ohci_hcd_init(ohci); + return ohci_init(ohci); } EXPORT_SYMBOL_GPL(ohci_setup); diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index ea088c1..3133354 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -250,7 +250,7 @@ static int ohci_pci_reset (struct usb_hcd *hcd) } } if (ret == 0) - ohci_setup(hcd); + ret = ohci_setup(hcd); /* * After ohci setup RWC may not be set for add-in PCI cards. * This transfers PCI PM wakeup capabilities. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] usb: dwc3: use extcon fwrk to receive connect/disconnect notification
On 05/27/2013 10:35 PM, Kishon Vijay Abraham I wrote: Modified dwc3-omap to receive connect and disconnect notification using extcon framework. Also did the necessary cleanups required after adapting to extcon framework. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Chanwoo Choi cw00.c...@samsung.com --- Changes from v1: * regulator enable/disable is now done here instead of palmas-usb as some users of palmas-usb wont need regulator. drivers/usb/dwc3/dwc3-omap.c | 103 ++ include/linux/usb/dwc3-omap.h | 30 2 files changed, 85 insertions(+), 48 deletions(-) delete mode 100644 include/linux/usb/dwc3-omap.h I think that usb or other maintainer have to confirm this patch for applying extcon-next branch. Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6] extcon: Palmas Extcon Driver
On 05/27/2013 10:33 PM, Kishon Vijay Abraham I wrote: From: Graeme Gregory g...@slimlogic.co.uk This is the driver for the USB comparator built into the palmas chip. It handles the various USB OTG events that can be generated by cable insertion/removal. Signed-off-by: Graeme Gregory g...@slimlogic.co.uk Signed-off-by: Moiz Sonasath m-sonas...@ti.com Signed-off-by: Ruchika Kharwar ruch...@ti.com Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Signed-off-by: George Cherian george.cher...@ti.com [kis...@ti.com: adapted palmas usb driver to use the extcon framework] Signed-off-by: Sebastien Guiriec s-guir...@ti.com Signed-off-by: Chanwoo Choi cw00.c...@samsung.com Signed-off-by: Myungjoo Ham myungjoo@samsung.com --- Changes from v5: * removed regulator calls from palmas-usb as some platforms wont need it. These are now done in dwc3-omap.c as it is needed for OMAP. * removed all references to phy_companion as none of it is validated (SRP) and all of them were currently unreachable code. Changes from v4: * removed no_control_vbus property (to be used if the platform wants to use its own vbus control. * removed unnecessary headers * moved the palmas_usb_state to palmas.h * misc cleanups *A checkpatch warning WARNING: static const char * array should probably be static const char * constis ignored since it introduces a compilation warning. Changes from v3: * adapted the driver to extcon framework (so moved to drivers/extcon) * removed palmas_usb_(write/read) and replaced all calls with palmas_(read/write). * ignored a checkpatch warning in the line static const char *palmas_extcon_cable[] = { as it seemed to be incorrect? * removed all references to OMAP in this driver. * couldn't test this driver with mainline as omap5 panda is not booting with mainline. * A comment to change to platform_get_irq from regmap is not done as I felt the data should come from regmap in this case. Changes from v2: * Moved the driver to drivers/usb/phy/ * Added a bit more explanation in Kconfig .../devicetree/bindings/extcon/extcon-twl.txt | 15 ++ drivers/extcon/Kconfig | 7 + drivers/extcon/Makefile| 1 + drivers/extcon/extcon-palmas.c | 246 + include/linux/mfd/palmas.h | 26 ++- 5 files changed, 283 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-twl.txt create mode 100644 drivers/extcon/extcon-palmas.c Applied only this patch. you can check on following git repository: http://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/log/?h=extcon-next Thanks, Chanwoo Choi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 1/4] arm: omap: Add phy binding info for musb in plat data
Hi Tony, On Friday 17 May 2013 06:52 PM, Kishon Vijay Abraham I wrote: In order for controllers to get PHY in case of non dt boot, the phy binding information (phy label) should be added in the platform data of the controller. This series would be needed to get MUSB working in OMAP3 boards for non-dt boot case. Do you think this is good enough to go in this rc cycle? Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] usb: dwc3: use extcon fwrk to receive connect/disconnect notification
On Tuesday 28 May 2013 07:54 AM, Chanwoo Choi wrote: On 05/27/2013 10:35 PM, Kishon Vijay Abraham I wrote: Modified dwc3-omap to receive connect and disconnect notification using extcon framework. Also did the necessary cleanups required after adapting to extcon framework. Signed-off-by: Kishon Vijay Abraham I kis...@ti.com Acked-by: Chanwoo Choi cw00.c...@samsung.com --- Changes from v1: * regulator enable/disable is now done here instead of palmas-usb as some users of palmas-usb wont need regulator. drivers/usb/dwc3/dwc3-omap.c | 103 ++ include/linux/usb/dwc3-omap.h | 30 2 files changed, 85 insertions(+), 48 deletions(-) delete mode 100644 include/linux/usb/dwc3-omap.h I think that usb or other maintainer have to confirm this patch for applying extcon-next branch. Ok. I'll check with Felipe. Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html