serial/ftdi_sio byte loss / performance regression
Hi I have noticed that the ftdi_sio serial driver in recent kernel versions has very bad performance when used through the Python's serial library. As a test case I have a custom device that will send a continuous block of 5k characters once every few seconds over a RS-232 line (115200 baud) to an Olimex programmer (based on FT2232C, also tried one with FT2232H). Programmer is connected to a Linux system where a simple Python script reads the device: import serial comm = serial.Serial(/dev/ttyUSB0, 115200) while True: line = comm.readline() With kernels before 3.7.0 the script reads uncorrupted data while using newer kernels (including 3.9.4) the Python script sees heavy byte loss. top shows an 95% idle CPU. Only very slow transmissions (on the order of tens of bytes per second) will come through uncorrupted. Using git-bisect, I have found the commit that introduced this problem: 6f602912c9d0c84c2edbd446dd9f72660b701605 usb: serial: ftdi_sio: Add missing chars_in_buffer function This might also be related with the unusual way Python serial library reads the device. It uses select() with no timeout and single byte read()s in a loop. strace output: select(4, [3], [], [], NULL)= 1 (in [3]) read(3, D, 1) = 1 select(4, [3], [], [], NULL)= 1 (in [3]) read(3, E, 1) = 1 ... With sufficiently large read()s the byte loss can be eliminated. With the commit above, each select() now causes an additional round trip over USB to read the state of the hardware buffer. It's possible that constant status querying triggers some bug in the hardware or the query is simply too slow and causes overflows in the hardware buffer. Thanks for your help Tomaž -- 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
PROCES A ODKUPU VAŠÍ VYHRÁL CENU £ 7.500,000LIBRA BRITSKÁ LIBRA { GBP }
www.swisslotto.ch 2013 SWISSLOTTO Gratulujeme: Toto je oficiálně přinést do vaší pozornosti, že vaše e-mailová adresa získal pro vás on-line elektronickou loterii o probíhajícím Swisslotto platby loterie on-line přes náhodné elektronickým systémem e-mailovou volební qualification.The součet 7.500,000libra Great British Pounds { CZK} má být udělena vás v probíhajícím programu Swislotto, aby vám zpracovávat a využívat své vyhrál cenu, musíte jít vykupitelské politiky a strážní linek z vaší platební určené banky. V tomto nŘádek Vítězové loterie elektronických cvičení se vynořila z 7 kontinentů světa a 2013 vydání Swisslotto je zesílený vydání, přičemž vítězové vynořil ze seznamu kontinentech Afrika, Antarktida, Asie, Austrálie, Evropy, Severní Ameriky Jižní Amerika. Podle náhodné e-mailové adresy sčítací systém e-mailovou kvalifikaci vaše e-mailová adresa získal pro Vás součet 7.500,000libra Great British liber {GBP} a získala cenu patří do Vaší tudíž vaše jsou oprávněný uživatel e-mailové adresy se svou vítěznou viz níže: Vítězné číslo: 46689 \ 67 \ 2013k Směrování číslo: Vítěz # 5657 Výrobní kód: 56579Kl Vaše přesto je třeba ještě zpracovat, je to vaše právo je šťastným výhercem zpracovávat a využívat své vyhrál cenu přes normální prohlašovat postupu sami právního příjemce, pro procesí a čerpání vašeho vyhrál cenu posílat níže uvedené informace do centrální světa Široká agent i.de...@aol.com vám směrnic do průvodu a platební banku POSKYTNĚTE NÍŽE UVEDENÉ INFORMACE Příjmení: Jméno Druhé jméno: Pohlaví: Datum narození: Povolání: Číslo mobilního telefonu: Tel. Číslo: Národnost: Domovská adresa: Úřad nebo Poštovní adresa: Země: Současná Země: Výherní číslo: Směrovací číslo: Výrobní kód: kontakt : i.de...@aol.com Jste zaslat požadované informace popsané výše procesí a využívat svých mandátů získaly prize.Zákon, můžete jako právní příjemci této výhra v loterii zpracovávat pro nároky vašeho získal fond od svého určeného platebního banky tím, že cituje své vítězné údaje, jakož jak jdou podle pravidel a regulace střežících vykupující procesu procedure.Your se prosím doporučuje zkontrolovat e-maily denně, což nám pomáhá usnadnit průvod vaší cenu. Poznámka: Není-li přesměrovat informace k této e-mailovou adresu i.de...@aol.com nebo zvážit sám automaticky diskvalifikován. Děkovat Paní Anna Van - - - Copyright © 2013 Swiss loterie! Všechna práva vyhrazena -- 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: serial/ftdi_sio byte loss / performance regression
On Thu, Jun 06, 2013 at 10:50:36AM +0200, Tomaž Šolc wrote: Hi I have noticed that the ftdi_sio serial driver in recent kernel versions has very bad performance when used through the Python's serial library. As a test case I have a custom device that will send a continuous block of 5k characters once every few seconds over a RS-232 line (115200 baud) to an Olimex programmer (based on FT2232C, also tried one with FT2232H). Programmer is connected to a Linux system where a simple Python script reads the device: import serial comm = serial.Serial(/dev/ttyUSB0, 115200) while True: line = comm.readline() With kernels before 3.7.0 the script reads uncorrupted data while using newer kernels (including 3.9.4) the Python script sees heavy byte loss. top shows an 95% idle CPU. Only very slow transmissions (on the order of tens of bytes per second) will come through uncorrupted. Using git-bisect, I have found the commit that introduced this problem: 6f602912c9d0c84c2edbd446dd9f72660b701605 usb: serial: ftdi_sio: Add missing chars_in_buffer function This might also be related with the unusual way Python serial library reads the device. It uses select() with no timeout and single byte read()s in a loop. strace output: select(4, [3], [], [], NULL)= 1 (in [3]) read(3, D, 1) = 1 select(4, [3], [], [], NULL)= 1 (in [3]) read(3, E, 1) = 1 ... With sufficiently large read()s the byte loss can be eliminated. With the commit above, each select() now causes an additional round trip over USB to read the state of the hardware buffer. It's possible that constant status querying triggers some bug in the hardware or the query is simply too slow and causes overflows in the hardware buffer. You're absolutely right. This is a known issue (the select overhead) that was just recently fixed by commit a37025b5c7 (USB: ftdi_sio: fix chars_in_buffer overhead) in v3.10-rc3. Care to give v3.10-rc4 a try? Greg, perhaps we should consider backporting the wait-until-sent patches (i.e. 0693196fe..4746b6c6e)? Thanks, Johan -- 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 3/7] USB: chipidea: add PTW, PTS and STS handling
Hi, On Fri, May 31, 2013 at 08:38:45PM +0200, Michael Grzeschik wrote: From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to configure the PTW, PTS and STS bits inside the portsc register for host and device mode before the driver starts and the phy can be addressed as hardware implementation is designed. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- .../devicetree/bindings/usb/ci13xxx-imx.txt| 5 +++ drivers/usb/chipidea/bits.h| 15 ++- drivers/usb/chipidea/core.c| 49 ++ include/linux/usb/chipidea.h | 1 + 4 files changed, 69 insertions(+), 1 deletion(-) [snip] diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 050de85..93efe4e 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h [snip] /** * hw_device_reset: resets chip (execute without interruption) * @ci: the controller @@ -369,6 +410,9 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } + if (!dev-of_node dev-parent) + dev-of_node = dev-parent-of_node; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, res); if (IS_ERR(base)) @@ -408,6 +452,9 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } + if (!ci-platdata-phy_mode) + ci-platdata-phy_mode = of_usb_get_phy_mode(dev-of_node); + /* initialize role(s) before the interrupt is requested */ ret = ci_hdrc_host_init(ci); if (ret) @@ -434,6 +481,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) : CI_ROLE_GADGET; } + hw_phymode_configure(ci); + I just realised that this call has to be moved to hw_device_reset. As otherwise we will loose the configuration on any OTG case while changing from Host to Device and vice versa. The datasheet says that its value got reset on every controller reset. I will fix it in the next series. ret = ci_role_start(ci, ci-role); if (ret) { dev_err(dev, can't start %s role\n, ci_role(ci)-name); 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
[PATCH] qmi_wwan/cdc_ether: let qmi_wwan handle the Huawei E1820
Another QMI speaking Qualcomm based device, which should be driven by qmi_wwan, while cdc_ether should ignore it. Like on other Huawei devices, the wwan function can appear either as a single vendor specific interface or as a CDC ECM class function using separate control and data interfaces. The ECM control interface protocol is 0xff, likely in an attempt to indicate that vendor specific management is required. In addition to the near standard CDC class, Huawei also add vendor specific AT management commands to their firmwares. This is probably an attempt to support non-Windows systems using standard class drivers. Unfortunately, this part of the firmware is often buggy. Linux is much better off using whatever native vendor specific management protocol the device offers, and Windows uses, whenever possible. This means QMI in the case of Qualcomm based devices. The E1820 has been verified to work fine with QMI. Matching on interface number is necessary to distiguish the wwan function from serial functions in the single interface mode, as both function types will have class/subclass/function set to ff/ff/ff. The control interface number does not change in CDC ECM mode, so the interface number matching rule is sufficient to handle both modes. The cdc_ether blacklist entry is only relevant in CDC ECM mode, but using a similar interface number based rule helps document this as a transfer from one driver to another. Other Huawei 02/06/ff devices are left with the cdc_ether driver because we do not know whether they are based on Qualcomm chips. The Huawei specific AT command management is known to be somewhat hardware independent, and their usage of these class codes may also be independent of the modem hardware. Reported-by: Graham Inggs graham.in...@uct.ac.za Signed-off-by: Bjørn Mork bj...@mork.no --- drivers/net/usb/cdc_ether.c |6 ++ drivers/net/usb/qmi_wwan.c |1 + 2 files changed, 7 insertions(+) diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 078795f..04ee044 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -627,6 +627,12 @@ static const struct usb_device_id products [] = { .driver_info = 0, }, +/* Huawei E1820 - handled by qmi_wwan */ +{ + USB_DEVICE_INTERFACE_NUMBER(HUAWEI_VENDOR_ID, 0x14ac, 1), + .driver_info = 0, +}, + /* Realtek RTL8152 Based USB 2.0 Ethernet Adapters */ #if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE) { diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 86adfa0..d095d0d 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -519,6 +519,7 @@ static const struct usb_device_id products[] = { /* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)},/* Yota / Megafon M100-1 */ {QMI_FIXED_INTF(0x12d1, 0x140c, 1)},/* Huawei E173 */ + {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)},/* Huawei E1820 */ {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, -- 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] USB: option: blacklist network interface on Huawei E1820
The mode used by Windows for the Huawei E1820 will use the same ff/ff/ff class codes for both serial and network functions. Reported-by: Graham Inggs graham.in...@uct.ac.za Signed-off-by: Bjørn Mork bj...@mork.no --- drivers/usb/serial/option.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 93d02bc..66314c3 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -593,6 +593,8 @@ static const struct usb_device_id option_ids[] = { .driver_info = (kernel_ulong_t) huawei_cdc12_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t) huawei_cdc12_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x14ac, 0xff, 0xff, 0xff),/* Huawei E1820 */ + .driver_info = (kernel_ulong_t) net_intf1_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t) huawei_cdc12_blacklist }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) }, -- 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 v7 0/7] USB: add devicetree helpers for determining dr_mode and phy_type
changes since v6: - added patch descriptions where missing - added Felipes Acked-by - fixed wording in patch descriptions - moved hw_phymode_configure to hw_device_reset - added force-full-speed of property - fixed devm_usb_get_phy_by_phandle result error handling Michael Grzeschik (4): USB: add devicetree helpers for determining dr_mode and phy_type USB: chipidea: add PTW, PTS and STS handling USB: chipidea: ci13xxx-imx: move static pdata into probe function usb: chipidea: udc: add force-full-speed option Philipp Zabel (1): usb: chipidea: usbmisc: use module_platform_driver Sascha Hauer (2): USB chipidea: introduce dual role mode pdata flags USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy .../devicetree/bindings/usb/ci13xxx-imx.txt| 8 +++ drivers/usb/chipidea/bits.h| 17 - drivers/usb/chipidea/ci13xxx_imx.c | 51 ++ drivers/usb/chipidea/core.c| 78 -- drivers/usb/chipidea/usbmisc_imx.c | 12 +--- drivers/usb/phy/Makefile | 1 + drivers/usb/phy/of.c | 47 + drivers/usb/usb-common.c | 35 ++ include/linux/usb/chipidea.h | 3 +- include/linux/usb/of.h | 28 include/linux/usb/otg.h| 7 ++ include/linux/usb/phy.h| 9 +++ 12 files changed, 247 insertions(+), 49 deletions(-) create mode 100644 drivers/usb/phy/of.c create mode 100644 include/linux/usb/of.h -- 1.8.2.rc2 -- 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/7] USB: chipidea: ci13xxx-imx: move static pdata into probe function
From: Michael Grzeschik m.grzesc...@pengutronix.de The pdata structure gets copied anyway inside ci13xxx_add_device by platform_device_add. We don't need to have it static. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Signed-off-by: Sascha Hauer s.ha...@pengutronix.de Reviewed-by: Peter Chen peter.c...@freescale.com --- drivers/usb/chipidea/ci13xxx_imx.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 9cecfd5..18d83ab 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c @@ -87,17 +87,16 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data); /* End of common functions shared by usbmisc drivers*/ -static struct ci13xxx_platform_data ci13xxx_imx_platdata = { - .name = ci13xxx_imx, - .flags = CI13XXX_REQUIRE_TRANSCEIVER | - CI13XXX_PULLUP_ON_VBUS | - CI13XXX_DISABLE_STREAMING, - .capoffset = DEF_CAPOFFSET, -}; - static int ci13xxx_imx_probe(struct platform_device *pdev) { struct ci13xxx_imx_data *data; + struct ci13xxx_platform_data pdata = { + .name = ci13xxx_imx, + .capoffset = DEF_CAPOFFSET, + .flags = CI13XXX_REQUIRE_TRANSCEIVER | + CI13XXX_PULLUP_ON_VBUS | + CI13XXX_DISABLE_STREAMING, + }; struct platform_device *phy_pdev; struct resource *res; int ret; @@ -160,7 +159,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) data-reg_vbus = NULL; } - ci13xxx_imx_platdata.phy = data-phy; + pdata.phy = data-phy; if (!pdev-dev.dma_mask) pdev-dev.dma_mask = pdev-dev.coherent_dma_mask; @@ -178,7 +177,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) data-ci_pdev = ci13xxx_add_device(pdev-dev, pdev-resource, pdev-num_resources, - ci13xxx_imx_platdata); + pdata); if (IS_ERR(data-ci_pdev)) { ret = PTR_ERR(data-ci_pdev); dev_err(pdev-dev, -- 1.8.2.rc2 -- 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/7] usb: chipidea: usbmisc: use module_platform_driver
From: Philipp Zabel p.za...@pengutronix.de This patch converts the driver to use the module_platform_driver macro which makes the code smaller and a bit simpler. Signed-off-by: Philipp Zabel p.za...@pengutronix.de Signed-off-by: Michael Grzeschik m...@pengutronix.de --- drivers/usb/chipidea/usbmisc_imx.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 1c6610a..588bae8 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -243,17 +243,7 @@ static struct platform_driver usbmisc_imx_driver = { }, }; -static int usbmisc_imx_drv_init(void) -{ - return platform_driver_register(usbmisc_imx_driver); -} -subsys_initcall(usbmisc_imx_drv_init); - -static void usbmisc_imx_drv_exit(void) -{ - platform_driver_unregister(usbmisc_imx_driver); -} -module_exit(usbmisc_imx_drv_exit); +module_platform_driver(usbmisc_imx_driver); MODULE_ALIAS(platform:usbmisc-imx); MODULE_LICENSE(GPL v2); -- 1.8.2.rc2 -- 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/7] usb: chipidea: udc: add force-full-speed option
From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to set the chipidea udc into full-speed only mode. It can be set by the oftree property force-full-speed. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- Documentation/devicetree/bindings/usb/ci13xxx-imx.txt | 2 ++ drivers/usb/chipidea/bits.h | 2 ++ drivers/usb/chipidea/core.c | 6 ++ 3 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt index b4b5b79..1943aef 100644 --- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt +++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt @@ -18,6 +18,7 @@ Optional properties: - vbus-supply: regulator for vbus - disable-over-current: disable over current detect - external-vbus-divider: enables off-chip resistor divider for Vbus +- force-full-speed: limit the maximum connection speed to full-speed Examples: usb@02184000 { /* USB OTG */ @@ -28,4 +29,5 @@ usb@02184000 { /* USB OTG */ fsl,usbmisc = usbmisc 0; disable-over-current; external-vbus-divider; + force-full-speed; }; diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 93efe4e..4c14ab7 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -49,11 +49,13 @@ #define PORTSC_HSPBIT(9) #define PORTSC_PTC(0x0FUL 16) /* PTS and PTW for non lpm version only */ +#define PORTSC_PFSC BIT(24) #define PORTSC_PTS(d) d) 0x3) 30) | (((d) 0x4) ? BIT(25) : 0)) #define PORTSC_PTWBIT(28) #define PORTSC_STSBIT(29) /* DEVLC */ +#define DEVLC_PFSCBIT(23) #define DEVLC_PSPD(0x03UL 25) #define DEVLC_PSPD_HS (0x02UL 25) #define DEVLC_PTW BIT(27) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ae239c7..b70b1d0 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -65,6 +65,7 @@ #include linux/usb/otg.h #include linux/usb/chipidea.h #include linux/usb/of.h +#include linux/of_device.h #include linux/phy.h #include ci.h @@ -240,6 +241,11 @@ static void hw_phymode_configure(struct ci13xxx *ci) return; } + if (of_find_property(ci-dev-of_node, force-full-speed, NULL)) { + portsc |= PORTSC_PFSC; + lpm |= DEVLC_PFSC; + } + if (ci-hw_bank.lpm) { hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); hw_write(ci, OP_DEVLC, DEVLC_STS, sts); -- 1.8.2.rc2 -- 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/7] USB chipidea: introduce dual role mode pdata flags
From: Sascha Hauer s.ha...@pengutronix.de Even if a chipidea core is otg capable the board may not be. This allows to explicitly set the core to host/peripheral mode. Without these flags the driver falls back to the old behaviour. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- .../devicetree/bindings/usb/ci13xxx-imx.txt| 1 + drivers/usb/chipidea/core.c| 24 -- include/linux/usb/chipidea.h | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt index 184a8e0..b4b5b79 100644 --- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt +++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt @@ -9,6 +9,7 @@ Recommended properies: - phy_type: the type of the phy connected to the core. Should be one of utmi, utmi_wide, ulpi, serial or hsic. Without this property the PORTSC register won't be touched +- dr_mode: One of host, peripheral or otg. Defaults to otg Optional properties: - fsl,usbphy: phandler of usb phy that connects to the only one port diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 1083376..ae239c7 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -405,6 +405,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) struct resource *res; void __iomem*base; int ret; + enum usb_dr_mode dr_mode; if (!dev-platform_data) { dev_err(dev, platform data missing\n); @@ -456,14 +457,25 @@ static int ci_hdrc_probe(struct platform_device *pdev) if (!ci-platdata-phy_mode) ci-platdata-phy_mode = of_usb_get_phy_mode(dev-of_node); + if (!ci-platdata-dr_mode) + ci-platdata-dr_mode = of_usb_get_dr_mode(dev-of_node); + + if (ci-platdata-dr_mode == USB_DR_MODE_UNKNOWN) + ci-platdata-dr_mode = USB_DR_MODE_OTG; + + dr_mode = ci-platdata-dr_mode; /* initialize role(s) before the interrupt is requested */ - ret = ci_hdrc_host_init(ci); - if (ret) - dev_info(dev, doesn't support host\n); + if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { + ret = ci_hdrc_host_init(ci); + if (ret) + dev_info(dev, doesn't support host\n); + } - ret = ci_hdrc_gadget_init(ci); - if (ret) - dev_info(dev, doesn't support gadget\n); + if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) { + ret = ci_hdrc_gadget_init(ci); + if (ret) + dev_info(dev, doesn't support gadget\n); + } if (!ci-roles[CI_ROLE_HOST] !ci-roles[CI_ROLE_GADGET]) { dev_err(dev, no supported roles\n); diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 1a2aa18..b314647 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -20,7 +20,7 @@ struct ci13xxx_platform_data { #define CI13XXX_REQUIRE_TRANSCEIVERBIT(1) #define CI13XXX_PULLUP_ON_VBUS BIT(2) #define CI13XXX_DISABLE_STREAMING BIT(3) - + enum usb_dr_modedr_mode; #define CI13XXX_CONTROLLER_RESET_EVENT 0 #define CI13XXX_CONTROLLER_STOPPED_EVENT 1 void(*notify_event) (struct ci13xxx *ci, unsigned event); -- 1.8.2.rc2 -- 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/7] USB: add devicetree helpers for determining dr_mode and phy_type
From: Michael Grzeschik m.grzesc...@pengutronix.de This adds two little devicetree helper functions for determining the dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from the devicetree. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Signed-off-by: Sascha Hauer s.ha...@pengutronix.de Acked-by: Felipe Balbi ba...@ti.com --- drivers/usb/phy/Makefile | 1 + drivers/usb/phy/of.c | 47 +++ drivers/usb/usb-common.c | 35 +++ include/linux/usb/of.h | 28 include/linux/usb/otg.h | 7 +++ include/linux/usb/phy.h | 9 + 6 files changed, 127 insertions(+) create mode 100644 drivers/usb/phy/of.c create mode 100644 include/linux/usb/of.h diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index a9169cb..070eca3 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -5,6 +5,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG obj-$(CONFIG_USB_PHY) += phy.o +obj-$(CONFIG_OF) += of.o # transceiver drivers, keep the list sorted diff --git a/drivers/usb/phy/of.c b/drivers/usb/phy/of.c new file mode 100644 index 000..e6f3b74 --- /dev/null +++ b/drivers/usb/phy/of.c @@ -0,0 +1,47 @@ +/* + * USB of helper code + * + * 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. + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/of.h +#include linux/usb/of.h +#include linux/usb/otg.h + +static const char *usbphy_modes[] = { + [USBPHY_INTERFACE_MODE_UNKNOWN] = , + [USBPHY_INTERFACE_MODE_UTMI]= utmi, + [USBPHY_INTERFACE_MODE_UTMIW] = utmi_wide, + [USBPHY_INTERFACE_MODE_ULPI]= ulpi, + [USBPHY_INTERFACE_MODE_SERIAL] = serial, + [USBPHY_INTERFACE_MODE_HSIC]= hsic, +}; + +/** + * of_usb_get_phy_mode - Get phy mode for given device_node + * @np:Pointer to the given device_node + * + * The function gets phy interface string from property 'phy_type', + * and returns the correspondig enum usb_phy_interface + */ +enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) +{ + const char *phy_type; + int err, i; + + err = of_property_read_string(np, phy_type, phy_type); + if (err 0) + return USBPHY_INTERFACE_MODE_UNKNOWN; + + for (i = 0; i ARRAY_SIZE(usbphy_modes); i++) + if (!strcmp(phy_type, usbphy_modes[i])) + return i; + + return USBPHY_INTERFACE_MODE_UNKNOWN; +} +EXPORT_SYMBOL_GPL(of_usb_get_phy_mode); diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c index 0db0a91..027582d 100644 --- a/drivers/usb/usb-common.c +++ b/drivers/usb/usb-common.c @@ -13,7 +13,9 @@ #include linux/kernel.h #include linux/module.h +#include linux/of.h #include linux/usb/ch9.h +#include linux/usb/of.h #include linux/usb/otg.h const char *usb_otg_state_string(enum usb_otg_state state) @@ -79,4 +81,37 @@ const char *usb_state_string(enum usb_device_state state) } EXPORT_SYMBOL_GPL(usb_state_string); +#ifdef CONFIG_OF +static const char *usb_dr_modes[] = { + [USB_DR_MODE_UNKNOWN] = , + [USB_DR_MODE_HOST] = host, + [USB_DR_MODE_PERIPHERAL]= peripheral, + [USB_DR_MODE_OTG] = otg, +}; + +/** + * of_usb_get_dr_mode - Get dual role mode for given device_node + * @np:Pointer to the given device_node + * + * The function gets phy interface string from property 'dr_mode', + * and returns the correspondig enum usb_dr_mode + */ +enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) +{ + const char *dr_mode; + int err, i; + + err = of_property_read_string(np, dr_mode, dr_mode); + if (err 0) + return USB_DR_MODE_UNKNOWN; + + for (i = 0; i ARRAY_SIZE(usb_dr_modes); i++) + if (!strcmp(dr_mode, usb_dr_modes[i])) + return i; + + return USB_DR_MODE_UNKNOWN; +} +EXPORT_SYMBOL_GPL(of_usb_get_dr_mode); +#endif + MODULE_LICENSE(GPL); diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h new file mode 100644 index 000..e460a24 --- /dev/null +++ b/include/linux/usb/of.h @@ -0,0 +1,28 @@ +/* + * OF helpers for usb devices. + * + * This file is released under the GPLv2 + */ + +#ifndef __LINUX_USB_OF_H +#define __LINUX_USB_OF_H + +#include linux/usb/otg.h +#include linux/usb/phy.h + +#ifdef CONFIG_OF +enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np); +enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); +#else +static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) +{ + return
[PATCH 6/7] USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy
From: Sascha Hauer s.ha...@pengutronix.de This patch converts the driver to use devm_usb_get_phy_by_phandle which makes the code smaller and a bit simpler. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/usb/chipidea/ci13xxx_imx.c | 32 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 18d83ab..7e6f067 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c @@ -28,7 +28,6 @@ ((struct usb_phy *)platform_get_drvdata(pdev)) struct ci13xxx_imx_data { - struct device_node *phy_np; struct usb_phy *phy; struct platform_device *ci_pdev; struct clk *clk; @@ -97,9 +96,9 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) CI13XXX_PULLUP_ON_VBUS | CI13XXX_DISABLE_STREAMING, }; - struct platform_device *phy_pdev; struct resource *res; int ret; + struct usb_phy *phy; if (of_find_property(pdev-dev.of_node, fsl,usbmisc, NULL) !usbmisc_ops) @@ -131,18 +130,16 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) return ret; } - 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); - if (phy - try_module_get(phy_pdev-dev.driver-owner)) { - usb_phy_init(phy); - data-phy = phy; - } + phy = devm_usb_get_phy_by_phandle(pdev-dev, fsl,usbphy, 0); + if (!IS_ERR(phy)) { + ret = usb_phy_init(phy); + if (ret) { + dev_err(pdev-dev, unable to init phy: %d\n, ret); + goto err_clk; } + } else if (PTR_ERR(phy) == -EPROBE_DEFER) { + ret = -EPROBE_DEFER; + goto err_clk; } /* we only support host now, so enable vbus here */ @@ -153,7 +150,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) dev_err(pdev-dev, Failed to enable vbus regulator, err=%d\n, ret); - goto put_np; + goto err_clk; } } else { data-reg_vbus = NULL; @@ -207,9 +204,7 @@ disable_device: err: if (data-reg_vbus) regulator_disable(data-reg_vbus); -put_np: - if (data-phy_np) - of_node_put(data-phy_np); +err_clk: clk_disable_unprepare(data-clk); return ret; } @@ -229,9 +224,6 @@ static int ci13xxx_imx_remove(struct platform_device *pdev) module_put(data-phy-dev-driver-owner); } - if (data-phy_np) - of_node_put(data-phy_np); - clk_disable_unprepare(data-clk); return 0; -- 1.8.2.rc2 -- 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] usbnet: improve/fix status interrupt endpoint interval
On Thu, Jun 6, 2013 at 2:54 PM, Andreas Mohr a...@lisas.de wrote: On Thu, Jun 06, 2013 at 09:33:28AM +0800, Ming Lei wrote: On Thu, Jun 6, 2013 at 12:34 AM, Andreas Mohr a...@lisas.de wrote: Hi, On Wed, Jun 05, 2013 at 09:22:25AM +0800, Ming Lei wrote: On Wed, Jun 5, 2013 at 2:28 AM, Andreas Mohr a...@lisas.de wrote: Value 8 now managed to reduce powertop wakeups from ~ 540 to ~ 155 It means that your device only returns current link status instead of link change. IMO, it isn't a good behaviour for the device. I don't quite understand that. It is only concluded by the data you provided, when you get ~540 wakeups, that means basically device will return data for each polling from HC. Also I am wondering why you get ~540 wakeups, instead of ~360(330 + 30) (30 is guessed from ~155 wakup in 8ms interval) Hmm, right, with raw interval value having been specified as 3, this should have ended up as a cooked value of 3ms on full-speed, thus, given no further mcs7830 wakeup activity, we should remain at 330 something. Will investigate some more (e.g. a quick look at usbmon log timing, too). Did you check intr_complete() returns OK every time? Good hint, will check. It isn't a hard demand, which only means the poll interval by which HC sends IN token to device. I believe this number is meant to be a hard demand by the *device*, since a device is the authoritative party to know best about its own servicing requirements. Actually, just see quirks for USB devices, there are many devices which isn't worthy of trust, :-) I can easily believe that, having had my more than fair share of trouble already ;) Also some problems should have been reported on current interval value(larger than interval of endpoint) if it was hard demand, but luckly looks no such report found. Yep. As I said before, the link change is a low frequency event, so longer interval used by usbnet driver should be OK, right? ...minus the status flags for frames, which surely would be interesting, too :) (and minus the frequency requirements of the mcs7830 link change 20 times averaging mechanism, which expects a sufficiently high rate) Or, IOW, the thing that is a USB descriptor is to be seen as a *protocol* where a device signals its requirements (hopefully accurately, though!). And if it indicates a 1ms bInterval (which is the requested maximum(!!) number of milliseconds between transaction attempts [lvr usbfaq]), USB spec 2.0 doesn't say it is a maximum period between transactions, and only mentions that is a desired bus access period, see 5.7.4 Interrupt Transfer Bus Access Constraints. Oh, so perhaps we have a usbfaq which actually is a FAQWBA? ;) (I should really have a look at the specs directly...) AFAIK, linux-usb mailist is the best place for usbfaq, :-) Cc linux-usb already Is proper damage-less (overflows...) handling here a promise/guarantee that's made by the USB specs? Even there is overflow, it happens inside device, and it depends on implementation of device itself. IOW, the device is free to blow up on its own. Otherwise I wouldn't be so confident that a device is acting this way ;) If so, you can use the dev-status-desc.bInterval, so you may complain too much wakeup and CPU power consumed, and we need leverage. Yep, would surely be very useful to come up with a usbnet-side mechanism which flexibly keeps wakeups at a minimum, while still retrieving all data that it can get, and this for all devices(drivers) as handled by usbnet. For usbnet, generally speaking, the interrupt pipe is for polling the link change, which is a very low frequency event, so you don't need to worry about missing events if the interval is increased. Yeah, but then those status bits also contain other error info for every packet processed, thus it's also very useful to achieve polling that's frequent enough to properly grab info for all transferred ether frames, rather than merely concentrating on link change info. Actually, most of usbnet drivers only use interrupt pipe to retrieve link change(asix, smsc, ...). But if your device may provide other information via interrupt pipe and your driver requires that, you may keep the desired interval with extra power if it is worthy. Could you let us know what device may provide ether frame info and how your drivers use that? That should be all devices supported by mcs7830.c, where it's probably the + MCS7830_STATUS_ETHER_FRAME_OK = 0x0001, + MCS7830_STATUS_RETRIES_MORE_THAN_16 = 0x0002, + MCS7830_STATUS_COLLISION_OCCURRED_AFTER_64BYTES = 0x0004, + MCS7830_STATUS_PACKET_ABORTED_EXCESS_DEFERRAL = 0x0008, + MCS7830_STATUS_TX_STATUS_VECTOR_BITS_VALID = 0x4000, bits, provided for all transferred ether frames, when polled frequently enough. I don't know the exact meaning of the bits, but looks
[PATCH 2/7] USB: chipidea: add PTW, PTS and STS handling
From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to configure the PTW, PTS and STS bits inside the portsc register for host and device mode before the driver starts and the phy can be addressed as hardware implementation is designed. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- .../devicetree/bindings/usb/ci13xxx-imx.txt| 5 +++ drivers/usb/chipidea/bits.h| 15 ++- drivers/usb/chipidea/core.c| 48 ++ include/linux/usb/chipidea.h | 1 + 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt index 1c04a4c..184a8e0 100644 --- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt +++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt @@ -5,6 +5,11 @@ Required properties: - reg: Should contain registers location and length - interrupts: Should contain controller interrupt +Recommended properies: +- phy_type: the type of the phy connected to the core. Should be one + of utmi, utmi_wide, ulpi, serial or hsic. Without this + property the PORTSC register won't be touched + Optional properties: - fsl,usbphy: phandler of usb phy that connects to the only one port - fsl,usbmisc: phandler of non-core register device, with one argument diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 050de85..93efe4e 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -48,10 +48,23 @@ #define PORTSC_SUSP BIT(7) #define PORTSC_HSPBIT(9) #define PORTSC_PTC(0x0FUL 16) +/* PTS and PTW for non lpm version only */ +#define PORTSC_PTS(d) d) 0x3) 30) | (((d) 0x4) ? BIT(25) : 0)) +#define PORTSC_PTWBIT(28) +#define PORTSC_STSBIT(29) /* DEVLC */ #define DEVLC_PSPD(0x03UL 25) -#defineDEVLC_PSPD_HS (0x02UL 25) +#define DEVLC_PSPD_HS (0x02UL 25) +#define DEVLC_PTW BIT(27) +#define DEVLC_STS BIT(28) +#define DEVLC_PTS(d) (((d) 0x7) 29) + +/* Encoding for DEVLC_PTS and PORTSC_PTS */ +#define PTS_UTMI 0 +#define PTS_ULPI 2 +#define PTS_SERIAL3 +#define PTS_HSIC 4 /* OTGSC */ #define OTGSC_IDPU BIT(5) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 2ef0ce3..1083376 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -64,6 +64,8 @@ #include linux/usb/gadget.h #include linux/usb/otg.h #include linux/usb/chipidea.h +#include linux/usb/of.h +#include linux/phy.h #include ci.h #include udc.h @@ -208,6 +210,45 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base) return 0; } +static void hw_phymode_configure(struct ci13xxx *ci) +{ + u32 portsc, lpm, sts; + + switch (ci-platdata-phy_mode) { + case USBPHY_INTERFACE_MODE_UTMI: + portsc = PORTSC_PTS(PTS_UTMI); + lpm = DEVLC_PTS(PTS_UTMI); + break; + case USBPHY_INTERFACE_MODE_UTMIW: + portsc = PORTSC_PTS(PTS_UTMI) | PORTSC_PTW; + lpm = DEVLC_PTS(PTS_UTMI) | DEVLC_PTW; + break; + case USBPHY_INTERFACE_MODE_ULPI: + portsc = PORTSC_PTS(PTS_ULPI); + lpm = DEVLC_PTS(PTS_ULPI); + break; + case USBPHY_INTERFACE_MODE_SERIAL: + portsc = PORTSC_PTS(PTS_SERIAL); + lpm = DEVLC_PTS(PTS_SERIAL); + sts = 1; + break; + case USBPHY_INTERFACE_MODE_HSIC: + portsc = PORTSC_PTS(PTS_HSIC); + lpm = DEVLC_PTS(PTS_HSIC); + break; + default: + return; + } + + if (ci-hw_bank.lpm) { + hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); + } else { + hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); + } +} + /** * hw_device_reset: resets chip (execute without interruption) * @ci: the controller @@ -224,6 +265,7 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode) while (hw_read(ci, OP_USBCMD, USBCMD_RST)) udelay(10); /* not RTOS friendly */ + hw_phymode_configure(ci); if (ci-platdata-notify_event) ci-platdata-notify_event(ci, @@ -369,6 +411,9 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } + if (!dev-of_node dev-parent) + dev-of_node = dev-parent-of_node; + res = platform_get_resource(pdev,
Re: [PATCH 1/3] USB: serial: ports: add minor and port number
On Wed, Jun 05, 2013 at 10:55:39AM -0700, Greg KH wrote: From: Greg Kroah-Hartman gre...@linuxfoundation.org The usb_serial_port structure had the number field, which was the minor number for the port, which almost no one really cared about. They really wanted the number of the port within the device, which you had to subtract from the minor of the parent usb_serial_device structure. To clean this up, provide the real minor number of the port, and the number of the port within the serial device separately, as these numbers might not be related in the future. Bonus is that this cleans up a lot of logic in the drivers, and saves lines overall. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -2302,7 +2293,7 @@ static int send_cmd_write_baud_rate(stru /* Restore original value to disable access to divisor latch */ MAKE_CMD_WRITE_REG(currCmd, cmdLen, number, LCR, - edge_port-shadowLCR); +edge_port-shadowLCR); Unintended indentation change? status = write_cmd_usb(edge_port, cmdBuffer, cmdLen); if (status) { --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_s struct whiteheat_port_settings port_settings; unsigned int cflag = tty-termios.c_cflag; - port_settings.port = port-number + 1; + port_settings.port = port-port_number + 1; This is a bug that should be fixed separately and backported, as it prevents port configuration (e.g. set_termios) for ports with minor number greater than 0. I took the liberty to prepare a separate patch for v3.10, which you could rebase the series on. /* get the byte size */ switch (cflag CSIZE) { --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -37,7 +37,8 @@ * @serial: pointer back to the struct usb_serial owner of this port. * @port: pointer to the corresponding tty_port for this port. * @lock: spinlock to grab when updating portions of this structure. - * @number: the number of the port (the minor number). + * @minor: the minor number of the port + * @port_number: the port number of this struct usb_serial_device (starts at 0) Maybe @port_number: the struct usb_serial port number of this port (starts at 0) or something similar, would be more clear? * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe Looks good otherwise. Thanks, Johan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] USB: whiteheat: fix broken port configuration
When configuring the port (e.g. set_termios) the port minor number rather than the port number was used in the request (and they only coincide for minor number 0). Cc: sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/whiteheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index b9fca35..347caad 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_struct *tty) struct whiteheat_port_settings port_settings; unsigned int cflag = tty-termios.c_cflag; - port_settings.port = port-number + 1; + port_settings.port = port-number - port-serial-minor + 1; /* get the byte size */ switch (cflag CSIZE) { -- 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
Re: [PATCH 0/3] Increase the number of USB to serial devices we can support at once
Hi Greg, On 06/05/2013 07:54 PM, Greg KH wrote: Here are 3 patches that I've tested out on my system with only a small number of devices, but it seems to work, so why not let others try it out... It compiles and runs without any errors. My current setup has 272 ftdi devices connected: rescue on 172.18.24.141:/dev$ uname -a Linux bigrescue 3.10.0-rc3+ #1 SMP Thu Jun 6 12:21:06 CEST 2013 x86_64 GNU/Linux rescue on 172.18.24.141:/dev$ dmesg | tail -n 15 [ 3361.898725] usb 3-1.4.4: usb_probe_device [ 3361.898750] usb 3-1.4.4: configuration #1 chosen from 1 choice [ 3361.901598] usb 3-1.4.4: adding 3-1.4.4:1.0 (config #1, interface 0) [ 3361.906802] ftdi_sio 3-1.4.4:1.0: usb_probe_interface [ 3361.906830] ftdi_sio 3-1.4.4:1.0: usb_probe_interface - got id [ 3361.906875] ftdi_sio 3-1.4.4:1.0: FTDI USB Serial Device converter detected [ 3361.932490] usb 3-1.4.4: Detected FT232RL [ 3361.952189] usb 3-1.4.4: Number of endpoints 2 [ 3361.972791] usb 3-1.4.4: Endpoint 1 MaxPacketSize 64 [ 3361.994656] usb 3-1.4.4: Endpoint 2 MaxPacketSize 64 [ 3362.016309] usb 3-1.4.4: Setting MaxPacketSize 64 [ 3362.039764] usb 3-1.4.4: FTDI USB Serial Device converter now attached to ttyUSB271 [ 3362.075248] hub 3-1.2:1.0: state 7 ports 4 chg evt 0010 [ 3362.075676] hub 3-1.3:1.0: state 7 ports 4 chg evt 0010 [ 3362.076659] hub 3-1.4:1.0: state 7 ports 4 chg evt 0010 Sadly I only have FTDI single port interfaces and am therefore unable to test with other devices. Thanks for the effort! 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 2/3] USB: serial: make minor allocation dynamic
On Wed, Jun 05, 2013 at 10:54:55AM -0700, Greg KH wrote: From: Greg Kroah-Hartman gre...@linuxfoundation.org This moves the allocation of minor device numbers from a static array to be dynamic, using the idr interface. This means that you could potentially get gaps in a minor number range for a single USB serial device with multiple ports, but all should still work properly. Note, we still have the limitation of 255 USB to serial devices in the system, as that is all we are registering with the TTY layer at this point in time. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org [...] -static struct usb_serial *get_free_serial(struct usb_serial *serial, - int num_ports, unsigned int *minor) +static int get_free_port(struct usb_serial_port *port) { - unsigned int i, j; - int good_spot; - - dev_dbg(serial-interface-dev, %s %d\n, __func__, num_ports); + int i; - *minor = 0; mutex_lock(table_lock); - for (i = 0; i SERIAL_TTY_MINORS; ++i) { - if (serial_table[i]) - continue; + i = idr_alloc(serial_minors, port, 0, 0, GFP_KERNEL); + if (i 0) + goto exit; + port-minor = i; +exit: + mutex_unlock(table_lock); + return i; +} - good_spot = 1; - for (j = 1; j = num_ports-1; ++j) - if ((i+j = SERIAL_TTY_MINORS) || (serial_table[i+j])) { - good_spot = 0; - i += j; - break; - } - if (good_spot == 0) - continue; +static int get_free_serial(struct usb_serial *serial, int num_ports, +unsigned int *minor) +{ + unsigned int i; + unsigned int j; + int x; - *minor = i; - j = 0; - dev_dbg(serial-interface-dev, %s - minor base = %d\n, __func__, *minor); - for (i = *minor; (i (*minor + num_ports)) (i SERIAL_TTY_MINORS); ++i, ++j) { - serial_table[i] = serial; - serial-port[j]-minor = i; - serial-port[j]-port_number = i - *minor; - } - mutex_unlock(table_lock); - return serial; + dev_dbg(serial-interface-dev, %s %d\n, __func__, num_ports); + + *minor = 0x; You could use SERIAL_TTY_NO_MINOR here -- if needed at all, as it has already been set in create_serial. + for (i = 0; i num_ports; ++i) { + x = get_free_port(serial-port[i]); + if (x 0) + goto error; + if (*minor == 0x) + *minor = x; We must not update *minor until all port minors have been allocated, or idr_remove might get called for unallocated minors or even minor numbers of other ports in return_serial when the serial struct is destroyed. + serial-port[i]-port_number = i; } - mutex_unlock(table_lock); - return NULL; + return 0; +error: + /* unwind the already allocated minors */ + for (j = 0; j i; ++j) + idr_remove(serial_minors, serial-port[j]-minor); + return x; table_lock? } static void return_serial(struct usb_serial *serial) @@ -123,7 +128,7 @@ static void return_serial(struct usb_ser mutex_lock(table_lock); for (i = 0; i serial-num_ports; ++i) - serial_table[serial-minor + i] = NULL; + idr_remove(serial_minors, serial-port[i]-minor); mutex_unlock(table_lock); } [...] Looks good otherwise. Thanks, Johan -- 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 7/7] usb: chipidea: udc: add force-full-speed option
Michael Grzeschik m...@pengutronix.de writes: From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to set the chipidea udc into full-speed only mode. It can be set by the oftree property force-full-speed. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- Documentation/devicetree/bindings/usb/ci13xxx-imx.txt | 2 ++ drivers/usb/chipidea/bits.h | 2 ++ drivers/usb/chipidea/core.c | 6 ++ 3 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt index b4b5b79..1943aef 100644 --- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt +++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt @@ -18,6 +18,7 @@ Optional properties: - vbus-supply: regulator for vbus - disable-over-current: disable over current detect - external-vbus-divider: enables off-chip resistor divider for Vbus +- force-full-speed: limit the maximum connection speed to full-speed Examples: usb@02184000 { /* USB OTG */ @@ -28,4 +29,5 @@ usb@02184000 { /* USB OTG */ fsl,usbmisc = usbmisc 0; disable-over-current; external-vbus-divider; + force-full-speed; }; diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 93efe4e..4c14ab7 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -49,11 +49,13 @@ #define PORTSC_HSPBIT(9) #define PORTSC_PTC(0x0FUL 16) /* PTS and PTW for non lpm version only */ +#define PORTSC_PFSC BIT(24) #define PORTSC_PTS(d) d) 0x3) 30) | (((d) 0x4) ? BIT(25) : 0)) #define PORTSC_PTWBIT(28) #define PORTSC_STSBIT(29) /* DEVLC */ +#define DEVLC_PFSCBIT(23) #define DEVLC_PSPD(0x03UL 25) #define DEVLC_PSPD_HS (0x02UL 25) #define DEVLC_PTW BIT(27) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ae239c7..b70b1d0 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -65,6 +65,7 @@ #include linux/usb/otg.h #include linux/usb/chipidea.h #include linux/usb/of.h +#include linux/of_device.h #include linux/phy.h #include ci.h @@ -240,6 +241,11 @@ static void hw_phymode_configure(struct ci13xxx *ci) return; } + if (of_find_property(ci-dev-of_node, force-full-speed, NULL)) { Breaks compilation on x86, because of_device.h only includes of.h (which declares of_find_property()) under #ifdef CONFIG_OF_DEVICE. A *nasty* interface you've got yourselves there. Regards, -- 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] usb: chipidea: udc: add force-full-speed option
From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to set the chipidea udc into full-speed only mode. It can be set by the oftree property force-full-speed. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Signed-off-by: Marc Kleine-Budde m...@pengutronix.de --- Fixed the compilation issues on x86. Thanks to Alex, Michael Documentation/devicetree/bindings/usb/ci13xxx-imx.txt | 2 ++ drivers/usb/chipidea/bits.h | 2 ++ drivers/usb/chipidea/core.c | 6 ++ 3 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt index b4b5b79..1943aef 100644 --- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt +++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt @@ -18,6 +18,7 @@ Optional properties: - vbus-supply: regulator for vbus - disable-over-current: disable over current detect - external-vbus-divider: enables off-chip resistor divider for Vbus +- force-full-speed: limit the maximum connection speed to full-speed Examples: usb@02184000 { /* USB OTG */ @@ -28,4 +29,5 @@ usb@02184000 { /* USB OTG */ fsl,usbmisc = usbmisc 0; disable-over-current; external-vbus-divider; + force-full-speed; }; diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 93efe4e..4c14ab7 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -49,11 +49,13 @@ #define PORTSC_HSPBIT(9) #define PORTSC_PTC(0x0FUL 16) /* PTS and PTW for non lpm version only */ +#define PORTSC_PFSC BIT(24) #define PORTSC_PTS(d) d) 0x3) 30) | (((d) 0x4) ? BIT(25) : 0)) #define PORTSC_PTWBIT(28) #define PORTSC_STSBIT(29) /* DEVLC */ +#define DEVLC_PFSCBIT(23) #define DEVLC_PSPD(0x03UL 25) #define DEVLC_PSPD_HS (0x02UL 25) #define DEVLC_PTW BIT(27) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ae239c7..cf1c9ee 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -65,6 +65,7 @@ #include linux/usb/otg.h #include linux/usb/chipidea.h #include linux/usb/of.h +#include linux/of.h #include linux/phy.h #include ci.h @@ -240,6 +241,11 @@ static void hw_phymode_configure(struct ci13xxx *ci) return; } + if (of_property_read_bool(ci-dev-of_node, force-full-speed)) { + portsc |= PORTSC_PFSC; + lpm |= DEVLC_PFSC; + } + if (ci-hw_bank.lpm) { hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); hw_write(ci, OP_DEVLC, DEVLC_STS, sts); -- 1.8.2.rc2 -- 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 3 webcam stop captures
On Wed, 5 Jun 2013, Sarah Sharp wrote: This is a known issue. Your patch is just a work-around though, and we should fix the underlying issue, rather than papering over it by changing it to an uninterruptible sleep. The chromium team ran into a similar issue, and we're having a conversation about the right way to fix it: http://marc.info/?l=linux-kernelm=136944610123147w=2 We'll try to Cc you on that conversation as it moves forward. I noticed Julius's thread when he posted his patch. In general, I think he is right. Drivers, as a rule, should not use interruptible sleeps unless they know that they can never receive a signal (for example, if they are running in a kernel thread). There are exceptions, of course. But in these cases, the driver always has to take special care to handle an interrupted operation sensibly. In this case, is there any good reason why xhci-hcd allows itself to be interrupted during these waits? 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 v2] xhci: fix dma mask setup in xhci.c
This patch adds a check on whether the host machine supports the xHC DMA address mask and sets the DMA mask for coherent DMA address allocation via an explicit call to dma_set_coherent_mask(). According to DMA-API-HOWTO, if coherent DMA address mask has not been set explicitly via dma_set_coherent_mask(), and the driver calls dma_alloc_coherent() or dma_pool_create() to allocate consistent DMA memory blocks, the consistent DMA mapping interface will return by default DMA addresses which are 32-bit addressable. Hence, if 64-bit DMA mapping is supported, it is appropriate to call dma_set_coherent_mask() with DMA_BIT_MASK(64) to take advantage of it. Also, according to DMA-API-HOWTO, dma_set_coherent_mask() is guaranteed to set successfully the same or a smaller mask as dma_set_mask(). Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Changes from v1: fix of the following checkpatch warning, triggered in v1 WARNING: line over 80 characters drivers/usb/host/xhci.c | 33 +++-- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b4aa79d..2167b98 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4662,11 +4662,22 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) */ xhci = hcd_to_xhci(hcd); temp = xhci_readl(xhci, xhci-cap_regs-hcc_params); - if (HCC_64BIT_ADDR(temp)) { + /* +* Check if host machine supports 64 bit DMA address mask +* and enable it for both streaming and coherent DMA transfers. +* Otherwise, use 32bit DMA mask, if it is supported. +*/ + if (HCC_64BIT_ADDR(temp) + !dma_set_mask(hcd-self.controller, DMA_BIT_MASK(64))) { xhci_dbg(xhci, Enabling 64-bit DMA addresses.\n); - dma_set_mask(hcd-self.controller, DMA_BIT_MASK(64)); + dma_set_coherent_mask(hcd-self.controller, + DMA_BIT_MASK(64)); } else { - dma_set_mask(hcd-self.controller, DMA_BIT_MASK(32)); + if (dma_set_mask(hcd-self.controller, +DMA_BIT_MASK(32))) + goto error; + dma_set_coherent_mask(hcd-self.controller, + DMA_BIT_MASK(32)); } return 0; } @@ -4700,11 +4711,21 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) xhci_dbg(xhci, Reset complete\n); temp = xhci_readl(xhci, xhci-cap_regs-hcc_params); - if (HCC_64BIT_ADDR(temp)) { + /* +* Check if host machine supports 64 bit DMA address mask +* and enable it for both streaming and coherent DMA transfers. +* Otherwise, use 32bit DMA mask, if it is supported. +*/ + if (HCC_64BIT_ADDR(temp) + !dma_set_mask(hcd-self.controller, DMA_BIT_MASK(64))) { xhci_dbg(xhci, Enabling 64-bit DMA addresses.\n); - dma_set_mask(hcd-self.controller, DMA_BIT_MASK(64)); + dma_set_coherent_mask(hcd-self.controller, + DMA_BIT_MASK(64)); } else { - dma_set_mask(hcd-self.controller, DMA_BIT_MASK(32)); + if (dma_set_mask(hcd-self.controller, DMA_BIT_MASK(32))) + goto error; + dma_set_coherent_mask(hcd-self.controller, + DMA_BIT_MASK(32)); } xhci_dbg(xhci, Calling HCD init\n); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/3] Increase the number of USB to serial devices we can support at once
On Wed, Jun 05, 2013 at 10:54:26AM -0700, Greg KH wrote: Here are 3 patches that I've tested out on my system with only a small number of devices, but it seems to work, so why not let others try it out... These patches make the USB to serial core have the ability to support up to 3000 devices at once now. I'm curious how this works. What systems have 3000 usb ports ? Or are there some kind of multiplexer devices out there ? (If so, I'd like a link, I could use one of those). Dave -- 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 0/3] Increase the number of USB to serial devices we can support at once
On Thu, Jun 06, 2013 at 11:01:12AM -0400, Dave Jones wrote: On Wed, Jun 05, 2013 at 10:54:26AM -0700, Greg KH wrote: Here are 3 patches that I've tested out on my system with only a small number of devices, but it seems to work, so why not let others try it out... These patches make the USB to serial core have the ability to support up to 3000 devices at once now. I'm curious how this works. What systems have 3000 usb ports ? Or are there some kind of multiplexer devices out there ? (If so, I'd like a link, I could use one of those). You don't need a multiplexer, you can have a bunch of different USB root hubs in PCI slots, with USB hubs plugged into them, and lots of multi-port USB devices connected to them. Tobias has such a system with 272 single-port USB to serial devices connected, so it's not impossible to create. In thinking about it some more, I'll change that number to 500 for now, as it's a static array within the tty layer, and then work on making that dynamic so we don't have any limitations other than the number of minor numbers for a single major. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] wusbcore: reduce keepalive threshold from timeout/2 to timeout/3
This patch reduces the keepalive threshold of WUSB host controllers from timeout/2 to timeout/3. The keepalive timer fires every timeout/2 ms, but due to rounding errors and jitter, the host may decide not to send a keepalive at timeout/2. By the time the next timer fires, a full timeout period may have expired causing the device to be disconnected without ever having been sent a keepalive. Changing the keepalive threshold to timeout/3 ensures that at least one keepalive will be sent before a device is disconnected. The patch also updates the code to use msecs_to_jiffies consistently. Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c index 1d36531..33a1278 100644 --- a/drivers/usb/wusbcore/devconnect.c +++ b/drivers/usb/wusbcore/devconnect.c @@ -455,8 +455,8 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc) dev_err(dev, KEEPALIVE: device %u timed out\n, wusb_dev-addr); __wusbhc_dev_disconnect(wusbhc, wusb_port); - } else if (time_after(jiffies, wusb_dev-entry_ts + tt/2)) { - /* Approaching timeout cut out, need to refresh */ + } else if (time_after(jiffies, wusb_dev-entry_ts + tt/3)) { + /* Approaching timeout cut off, need to refresh */ ie-bDeviceAddress[keep_alives++] = wusb_dev-addr; } } @@ -1062,7 +1062,7 @@ int wusbhc_devconnect_start(struct wusbhc *wusbhc) wusbhc-wuie_host_info = hi; queue_delayed_work(wusbd, wusbhc-keep_alive_timer, - (wusbhc-trust_timeout*CONFIG_HZ)/1000/2); + msecs_to_jiffies(wusbhc-trust_timeout / 2)); return 0; diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c index 0faca16..c35ee43 100644 --- a/drivers/usb/wusbcore/wusbhc.c +++ b/drivers/usb/wusbcore/wusbhc.c @@ -75,12 +75,11 @@ static ssize_t wusb_trust_timeout_store(struct device *dev, result = -EINVAL; goto out; } - /* FIXME: maybe we should check for range validity? */ - wusbhc-trust_timeout = trust_timeout; + wusbhc-trust_timeout = min_t(unsigned, trust_timeout, 500); cancel_delayed_work(wusbhc-keep_alive_timer); flush_workqueue(wusbd); queue_delayed_work(wusbd, wusbhc-keep_alive_timer, - (trust_timeout * CONFIG_HZ)/1000/2); + msecs_to_jiffies(wusbhc-trust_timeout / 2)); out: return result 0 ? result : size; } -- 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/3] USB: serial: make minor allocation dynamic
On Thu, Jun 06, 2013 at 02:17:18PM +0200, Johan Hovold wrote: On Wed, Jun 05, 2013 at 10:54:55AM -0700, Greg KH wrote: From: Greg Kroah-Hartman gre...@linuxfoundation.org This moves the allocation of minor device numbers from a static array to be dynamic, using the idr interface. This means that you could potentially get gaps in a minor number range for a single USB serial device with multiple ports, but all should still work properly. Note, we still have the limitation of 255 USB to serial devices in the system, as that is all we are registering with the TTY layer at this point in time. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org [...] -static struct usb_serial *get_free_serial(struct usb_serial *serial, - int num_ports, unsigned int *minor) +static int get_free_port(struct usb_serial_port *port) { - unsigned int i, j; - int good_spot; - - dev_dbg(serial-interface-dev, %s %d\n, __func__, num_ports); + int i; - *minor = 0; mutex_lock(table_lock); - for (i = 0; i SERIAL_TTY_MINORS; ++i) { - if (serial_table[i]) - continue; + i = idr_alloc(serial_minors, port, 0, 0, GFP_KERNEL); + if (i 0) + goto exit; + port-minor = i; +exit: + mutex_unlock(table_lock); + return i; +} - good_spot = 1; - for (j = 1; j = num_ports-1; ++j) - if ((i+j = SERIAL_TTY_MINORS) || (serial_table[i+j])) { - good_spot = 0; - i += j; - break; - } - if (good_spot == 0) - continue; +static int get_free_serial(struct usb_serial *serial, int num_ports, + unsigned int *minor) +{ + unsigned int i; + unsigned int j; + int x; - *minor = i; - j = 0; - dev_dbg(serial-interface-dev, %s - minor base = %d\n, __func__, *minor); - for (i = *minor; (i (*minor + num_ports)) (i SERIAL_TTY_MINORS); ++i, ++j) { - serial_table[i] = serial; - serial-port[j]-minor = i; - serial-port[j]-port_number = i - *minor; - } - mutex_unlock(table_lock); - return serial; + dev_dbg(serial-interface-dev, %s %d\n, __func__, num_ports); + + *minor = 0x; You could use SERIAL_TTY_NO_MINOR here -- if needed at all, as it has already been set in create_serial. + for (i = 0; i num_ports; ++i) { + x = get_free_port(serial-port[i]); + if (x 0) + goto error; + if (*minor == 0x) + *minor = x; We must not update *minor until all port minors have been allocated, or idr_remove might get called for unallocated minors or even minor numbers of other ports in return_serial when the serial struct is destroyed. Good point. In looking at this further, I really need to drop the usb_serial structure's minor field completly, as it doesn't make sense anymore. I'll go rework all of that and post a v2 of this series, thanks. + serial-port[i]-port_number = i; } - mutex_unlock(table_lock); - return NULL; + return 0; +error: + /* unwind the already allocated minors */ + for (j = 0; j i; ++j) + idr_remove(serial_minors, serial-port[j]-minor); + return x; table_lock? Good catch, now fixed. } static void return_serial(struct usb_serial *serial) @@ -123,7 +128,7 @@ static void return_serial(struct usb_ser mutex_lock(table_lock); for (i = 0; i serial-num_ports; ++i) - serial_table[serial-minor + i] = NULL; + idr_remove(serial_minors, serial-port[i]-minor); mutex_unlock(table_lock); } [...] Looks good otherwise. Thanks for the review, much appreciated. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] USB: serial: ports: add minor and port number
On Thu, Jun 06, 2013 at 01:31:06PM +0200, Johan Hovold wrote: On Wed, Jun 05, 2013 at 10:55:39AM -0700, Greg KH wrote: From: Greg Kroah-Hartman gre...@linuxfoundation.org The usb_serial_port structure had the number field, which was the minor number for the port, which almost no one really cared about. They really wanted the number of the port within the device, which you had to subtract from the minor of the parent usb_serial_device structure. To clean this up, provide the real minor number of the port, and the number of the port within the serial device separately, as these numbers might not be related in the future. Bonus is that this cleans up a lot of logic in the drivers, and saves lines overall. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -2302,7 +2293,7 @@ static int send_cmd_write_baud_rate(stru /* Restore original value to disable access to divisor latch */ MAKE_CMD_WRITE_REG(currCmd, cmdLen, number, LCR, - edge_port-shadowLCR); + edge_port-shadowLCR); Unintended indentation change? Yeah, due to a previous change I made to this line, I'll go remove this, thanks. status = write_cmd_usb(edge_port, cmdBuffer, cmdLen); if (status) { --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_s struct whiteheat_port_settings port_settings; unsigned int cflag = tty-termios.c_cflag; - port_settings.port = port-number + 1; + port_settings.port = port-port_number + 1; This is a bug that should be fixed separately and backported, as it prevents port configuration (e.g. set_termios) for ports with minor number greater than 0. I took the liberty to prepare a separate patch for v3.10, which you could rebase the series on. Ah, I missed that, thanks, I've queued up your patch and rebased this series on it now. --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -37,7 +37,8 @@ * @serial: pointer back to the struct usb_serial owner of this port. * @port: pointer to the corresponding tty_port for this port. * @lock: spinlock to grab when updating portions of this structure. - * @number: the number of the port (the minor number). + * @minor: the minor number of the port + * @port_number: the port number of this struct usb_serial_device (starts at 0) Maybe @port_number: the struct usb_serial port number of this port (starts at 0) or something similar, would be more clear? Yeah, much better, thanks. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] USB: serial: increase the number of devices we support
From: Greg Kroah-Hartman gre...@linuxfoundation.org We had the limit of 255 USB to serial devices on one system for almost 15 years, with no complaints. But now it's time to move on from these tiny baby systems, and bump the number up to 512, which should last us a few more years: 512 is a nice number -- Tobias Winter Note, this is still a static value, and uses up tty core memory with this many tty devices allocated. Converting the driver to use TTY_DRIVER_DYNAMIC_DEV is the next thing to do in order to remove this limitation. Reported-by: Tobias Winter tob...@linuxdingsda.de Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/usb/serial/usb-serial.c |9 ++--- include/linux/usb/serial.h |3 --- 2 files changed, 6 insertions(+), 6 deletions(-) --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -43,6 +43,9 @@ #define DRIVER_AUTHOR Greg Kroah-Hartman gre...@linuxfoundation.org #define DRIVER_DESC USB Serial Driver core +#define USB_SERIAL_TTY_MAJOR 188 +#define USB_SERIAL_TTY_MINORS 512 /* should be enough for a while */ + /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead the MODULE_DEVICE_TABLE declarations in each serial driver cause the hotplug program to pull in whatever module is necessary @@ -460,7 +463,7 @@ static int serial_proc_show(struct seq_f char tmp[40]; seq_puts(m, usbserinfo:1.0 driver:2.0\n); - for (i = 0; i SERIAL_TTY_MINORS; ++i) { + for (i = 0; i USB_SERIAL_TTY_MINORS; ++i) { port = usb_serial_port_get_by_minor(i); if (port == NULL) continue; @@ -1229,7 +1232,7 @@ static int __init usb_serial_init(void) { int result; - usb_serial_tty_driver = alloc_tty_driver(SERIAL_TTY_MINORS); + usb_serial_tty_driver = alloc_tty_driver(USB_SERIAL_TTY_MINORS); if (!usb_serial_tty_driver) return -ENOMEM; @@ -1242,7 +1245,7 @@ static int __init usb_serial_init(void) usb_serial_tty_driver-driver_name = usbserial; usb_serial_tty_driver-name = ttyUSB; - usb_serial_tty_driver-major = SERIAL_TTY_MAJOR; + usb_serial_tty_driver-major = USB_SERIAL_TTY_MAJOR; usb_serial_tty_driver-minor_start = 0; usb_serial_tty_driver-type = TTY_DRIVER_TYPE_SERIAL; usb_serial_tty_driver-subtype = SERIAL_TYPE_NORMAL; --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -19,9 +19,6 @@ #include linux/sysrq.h #include linux/kfifo.h -#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ -#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ - /* The maximum number of ports one device can grab at once */ #define MAX_NUM_PORTS 8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/3] Increase the number of USB to serial devices we can support at once
Here's the updated patch set to increase the number of USB to serial devices that we can support at once. Changes from v1: - now only support 512 instead of 3000 devices, as that's all we really need / want at this point in time. - removed usb_serial.minor field as it doesn't make any sense now. - addressed review comments / issues found in first round of patches. Overall, the diffstat is still nice, we are removing more code than we are adding: drivers/staging/serqt_usb2/serqt_usb2.c | 36 +++- drivers/usb/serial/ark3116.c|4 drivers/usb/serial/bus.c|6 - drivers/usb/serial/console.c|2 drivers/usb/serial/cp210x.c |2 drivers/usb/serial/cypress_m8.c |4 drivers/usb/serial/digi_acceleport.c|6 - drivers/usb/serial/f81232.c |7 - drivers/usb/serial/garmin_gps.c |6 - drivers/usb/serial/io_edgeport.c| 60 + drivers/usb/serial/io_ti.c | 23 ++--- drivers/usb/serial/keyspan.c| 29 ++ drivers/usb/serial/metro-usb.c |4 drivers/usb/serial/mos7720.c| 39 drivers/usb/serial/mos7840.c| 59 - drivers/usb/serial/opticon.c|4 drivers/usb/serial/pl2303.c |4 drivers/usb/serial/quatech2.c |9 -- drivers/usb/serial/sierra.c |2 drivers/usb/serial/ssu100.c |2 drivers/usb/serial/ti_usb_3410_5052.c | 12 +- drivers/usb/serial/usb-serial.c | 139 drivers/usb/serial/usb_wwan.c |4 drivers/usb/serial/whiteheat.c | 22 ++--- include/linux/usb/serial.h | 15 +-- 25 files changed, 224 insertions(+), 276 deletions(-) This series is on top of my usb-linus branch of my usb.git tree on git.kernel.org, as it relies on some patches in there already. If there are no objections to these, I'll queue them up to be merged in 3.11. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/3] USB: serial: make minor allocation dynamic
From: Greg Kroah-Hartman gre...@linuxfoundation.org This moves the allocation of minor device numbers from a static array to be dynamic, using the idr interface. This means that you could potentially get gaps in a minor number range for a single USB serial device with multiple ports, but all should still work properly. We remove the 'minor' field from the usb_serial structure, as it no longer makes any sense for it (use the field in the usb_serial_port structure if you really want to know this number), and take the fact that we were overloading a number in this field to determine if we had initialized the minor numbers or not, and just use a flag variable instead. Note, we still have the limitation of 255 USB to serial devices in the system, as that is all we are registering with the TTY layer at this point in time. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/serqt_usb2/serqt_usb2.c | 15 +-- drivers/usb/serial/ark3116.c|2 drivers/usb/serial/f81232.c |2 drivers/usb/serial/io_edgeport.c|2 drivers/usb/serial/io_ti.c |2 drivers/usb/serial/mos7720.c|2 drivers/usb/serial/mos7840.c|7 - drivers/usb/serial/opticon.c|2 drivers/usb/serial/pl2303.c |2 drivers/usb/serial/quatech2.c |2 drivers/usb/serial/ssu100.c |2 drivers/usb/serial/ti_usb_3410_5052.c |2 drivers/usb/serial/usb-serial.c | 123 +++- drivers/usb/serial/usb_wwan.c |2 drivers/usb/serial/whiteheat.c |2 include/linux/usb/serial.h |6 - 16 files changed, 85 insertions(+), 90 deletions(-) --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -906,7 +906,7 @@ static int qt_open(struct tty_struct *tt qt_submit_urb_from_open(serial, port); } - dev_dbg(port-dev, serial number is %d\n, port-serial-minor); + dev_dbg(port-dev, minor number is %d\n, port-minor); dev_dbg(port-dev, Bulkin endpoint is %d\n, port-bulk_in_endpointAddress); dev_dbg(port-dev, @@ -1002,7 +1002,7 @@ static void qt_close(struct usb_serial_p status = 0; tty = tty_port_tty_get(port-port); - index = tty-index - serial-minor; + index = port-port_number; qt_port = qt_get_port_private(port); port0 = qt_get_port_private(serial-port[0]); @@ -1129,12 +1129,11 @@ static int qt_ioctl(struct tty_struct *t { struct usb_serial_port *port = tty-driver_data; struct quatech_port *qt_port = qt_get_port_private(port); - struct usb_serial *serial = get_usb_serial(port, __func__); unsigned int index; dev_dbg(port-dev, %s cmd 0x%04x\n, __func__, cmd); - index = tty-index - serial-minor; + index = port-port_number; if (cmd == TIOCMIWAIT) { while (qt_port != NULL) { @@ -1180,7 +1179,7 @@ static void qt_set_termios(struct tty_st int baud, divisor, remainder; int status; - index = tty-index - port-serial-minor; + index = port-port_number; switch (cflag CSIZE) { case CS5: @@ -1296,7 +1295,7 @@ static void qt_break(struct tty_struct * u16 index, onoff; unsigned int result; - index = tty-index - serial-minor; + index = port-port_number; qt_port = qt_get_port_private(port); @@ -1325,7 +1324,7 @@ static inline int qt_real_tiocmget(struc int status; unsigned int index; - index = tty-index - serial-minor; + index = port-port_number; status = BoxGetRegister(port-serial, index, MODEM_CONTROL_REGISTER, mcr); if (status = 0) { @@ -1364,7 +1363,7 @@ static inline int qt_real_tiocmset(struc int status; unsigned int index; - index = tty-index - serial-minor; + index = port-port_number; status = BoxGetRegister(port-serial, index, MODEM_CONTROL_REGISTER, mcr); if (status 0) --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -413,7 +413,7 @@ static int ark3116_ioctl(struct tty_stru /* XXX: Some of these values are probably wrong. */ memset(serstruct, 0, sizeof(serstruct)); serstruct.type = PORT_16654; - serstruct.line = port-serial-minor; + serstruct.line = port-minor; serstruct.port = port-port_number; serstruct.custom_divisor = 0; serstruct.baud_base = 460800; --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -294,7 +294,7 @@ static int f81232_ioctl(struct tty_struc case TIOCGSERIAL: memset(ser, 0, sizeof ser); ser.type = PORT_16654; - ser.line =
[PATCH v2 1/3] USB: serial: ports: add minor and port number
From: Greg Kroah-Hartman gre...@linuxfoundation.org The usb_serial_port structure had the number field, which was the minor number for the port, which almost no one really cared about. They really wanted the number of the port within the device, which you had to subtract from the minor of the parent usb_serial_device structure. To clean this up, provide the real minor number of the port, and the number of the port within the serial device separately, as these numbers might not be related in the future. Bonus is that this cleans up a lot of logic in the drivers, and saves lines overall. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org -- drivers/staging/serqt_usb2/serqt_usb2.c | 21 +++ drivers/usb/serial/ark3116.c|2 - drivers/usb/serial/bus.c|6 +-- drivers/usb/serial/console.c|2 - drivers/usb/serial/cp210x.c |2 - drivers/usb/serial/cypress_m8.c |4 +- drivers/usb/serial/digi_acceleport.c|6 --- drivers/usb/serial/f81232.c |5 +- drivers/usb/serial/garmin_gps.c |6 +-- drivers/usb/serial/io_edgeport.c| 58 drivers/usb/serial/io_ti.c | 21 --- drivers/usb/serial/keyspan.c| 29 +++- drivers/usb/serial/metro-usb.c |4 +- drivers/usb/serial/mos7720.c| 37 +--- drivers/usb/serial/mos7840.c| 52 +--- drivers/usb/serial/opticon.c|2 - drivers/usb/serial/pl2303.c |2 - drivers/usb/serial/quatech2.c |7 +-- drivers/usb/serial/sierra.c |2 - drivers/usb/serial/ti_usb_3410_5052.c | 10 ++--- drivers/usb/serial/usb-serial.c |7 ++- drivers/usb/serial/usb_wwan.c |2 - drivers/usb/serial/whiteheat.c | 20 +-- include/linux/usb/serial.h |6 ++- 24 files changed, 133 insertions(+), 180 deletions(-) --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -873,7 +873,7 @@ static int qt_open(struct tty_struct *tt result = qt_get_device(serial, port0-DeviceData); /* Port specific setups */ - result = qt_open_channel(serial, port-number, ChannelData); + result = qt_open_channel(serial, port-port_number, ChannelData); if (result 0) { dev_dbg(port-dev, qt_open_channel failed\n); return result; @@ -888,7 +888,7 @@ static int qt_open(struct tty_struct *tt (SERIAL_MSR_CTS | SERIAL_MSR_DSR | SERIAL_MSR_RI | SERIAL_MSR_CD); /* Set Baud rate to default and turn off (default)flow control here */ - result = qt_setuart(serial, port-number, DEFAULT_DIVISOR, DEFAULT_LCR); + result = qt_setuart(serial, port-port_number, DEFAULT_DIVISOR, DEFAULT_LCR); if (result 0) { dev_dbg(port-dev, qt_setuart failed\n); return result; @@ -906,7 +906,6 @@ static int qt_open(struct tty_struct *tt qt_submit_urb_from_open(serial, port); } - dev_dbg(port-dev, port number is %d\n, port-number); dev_dbg(port-dev, serial number is %d\n, port-serial-minor); dev_dbg(port-dev, Bulkin endpoint is %d\n, port-bulk_in_endpointAddress); @@ -1022,14 +1021,11 @@ static void qt_close(struct usb_serial_p /* Close uart channel */ status = qt_close_channel(serial, index); if (status 0) - dev_dbg(port-dev, - %s - port %d qt_close_channel failed.\n, - __func__, port-number); + dev_dbg(port-dev, %s - qt_close_channel failed.\n, __func__); port0-open_ports--; - dev_dbg(port-dev, qt_num_open_ports in close%d:in port%d\n, - port0-open_ports, port-number); + dev_dbg(port-dev, qt_num_open_ports in close%d\n, port0-open_ports); if (port0-open_ports == 0) { if (serial-port[0]-interrupt_in_urb) { @@ -1169,8 +1165,7 @@ static int qt_ioctl(struct tty_struct *t return 0; } - dev_dbg(port-dev, %s -No ioctl for that one. port = %d\n, - __func__, port-number); + dev_dbg(port-dev, %s -No ioctl for that one.\n, __func__); return -ENOIOCTLCMD; } @@ -1245,8 +1240,7 @@ static void qt_set_termios(struct tty_st /* Now determine flow control */ if (cflag CRTSCTS) { - dev_dbg(port-dev, %s - Enabling HW flow control port %d\n, - __func__, port-number); + dev_dbg(port-dev, %s - Enabling HW flow control\n, __func__); /* Enable RTS/CTS flow control */ status = BoxSetHW_FlowCtrl(port-serial, index, 1); @@ -1258,8 +1252,7 @@ static void qt_set_termios(struct tty_st } else {
[GIT PATCH] USB fixes for 3.10-rc5
The following changes since commit e4aa937ec75df0eea0bee03bffa3303ad36c986b: Linux 3.10-rc3 (2013-05-26 16:00:47 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ tags/usb-3.10-rc4 for you to fetch changes up to 73228a0538a70ebc4547bd09dee8971360dc1d87: USB: option,zte_ev: move most ZTE CDMA devices to zte_ev (2013-06-06 09:06:25 -0700) USB fixes for 3.10-rc4 Here are a number of USB bugfixes and new device ids for the 3.10-rc5 tree. Nothing major here, a number of new device ids (and movement from the option to the zte_ev driver of a number of ids that we had previously gotten wrong, some xhci bugfixes, some usb-serial driver fixes that were recently found, some host controller fixes / reverts, and a variety of smaller other things. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org Alan Stern (2): USB: revert periodic scheduling bugfix USB: EHCI: fix regression related to qh_refresh() Bjørn Mork (1): USB: option: blacklist network interface on Huawei E1820 Dan Williams (1): USB: option,zte_ev: move most ZTE CDMA devices to zte_ev Federico Manzan (1): usbfs: Increase arbitrary limit for USB 3 isopkt length George Cherian (1): usb: dwc3: gadget: free trb pool only from epnum 2 Greg Kroah-Hartman (2): Merge tag 'fixes-for-v3.10-rc4' of git://git.kernel.org/.../balbi/usb into usb-linus Merge tag 'for-usb-linus-2013-05-24' of git://git.kernel.org/.../sarah/xhci into usb-linus Johan Hovold (14): 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 USB: zte_ev: fix broken open USB: keyspan: fix bogus array index USB: keyspan: remove unused endpoint-array access USB: mos7720: fix hardware flow control USB: serial: fix TIOCMIWAIT return value USB: whiteheat: fix broken port configuration Peter Chen (2): usb: dwc3: pci: PHY should be deleted later than dwc3 core usb: dwc3: exynos: PHY should be deleted later than dwc3 core Richard Weinberger (1): USB: serial: Add Option GTM681W to qcserial device table. Robert Butora (1): USB: Serial: cypress_M8: Enable FRWD Dongle hidcom device Sarah Sharp (1): xhci: Disable D3cold for buggy TI redrivers. Sergio Aguirre (1): xhci-mem: init list heads at the beginning of init Tony Camuso (1): xhci - correct comp_mode_recovery_timer on return from hibernate Virupax Sadashivpetimath (1): usb: musb: make use_sg flag URB specific Vladimir Murzin (1): xhci: fix list access before init drivers/usb/core/devio.c | 10 --- drivers/usb/dwc3/dwc3-exynos.c | 2 +- drivers/usb/dwc3/dwc3-pci.c | 2 +- drivers/usb/dwc3/gadget.c| 16 --- drivers/usb/host/ehci-sched.c| 9 +-- drivers/usb/host/xhci-mem.c | 10 --- drivers/usb/host/xhci-pci.c | 8 ++ drivers/usb/host/xhci.c | 16 --- drivers/usb/host/xhci.h | 3 +++ drivers/usb/musb/musb_host.c | 18 ++--- drivers/usb/musb/musb_host.h | 1 + drivers/usb/serial/ark3116.c | 2 +- drivers/usb/serial/cypress_m8.c | 18 - drivers/usb/serial/cypress_m8.h | 4 +++ drivers/usb/serial/iuu_phoenix.c | 4 +-- drivers/usb/serial/keyspan.c | 10 --- drivers/usb/serial/mos7720.c | 25 - drivers/usb/serial/mos7840.c | 35 ++-- drivers/usb/serial/option.c | 26 +++--- drivers/usb/serial/qcserial.c| 1 + drivers/usb/serial/usb-serial.c | 4 +-- drivers/usb/serial/visor.c | 9 +++ drivers/usb/serial/whiteheat.c | 2 +- drivers/usb/serial/zte_ev.c | 58 24 files changed, 187 insertions(+), 106 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: wusbcore: add HWA-specific fields to usb_rpipe_descriptor
On Wed, Jun 05, 2013 at 11:08:18AM -0500, Thomas Pugliese wrote: On Wed, 5 Jun 2013, Thomas Pugliese wrote: On Tue, 4 Jun 2013, Thomas Pugliese wrote: This patch adds the HWA-specific RPIPE fields to usb_rpipe_descriptor and sets the appropriate values in usb/wusbcore/wa-rpipe.c:rpipe_aim. Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c index f0d546c..ed77ec7 100644 --- a/drivers/usb/wusbcore/wa-rpipe.c +++ b/drivers/usb/wusbcore/wa-rpipe.c @@ -317,6 +317,7 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, Actually, the maxburst and maxsequence values should be assigned from the wireless endpoint companion descriptor. I will send out a corrected patch shortly. Tom This updated patch adds the HWA specific members and sets them correctly based on the wireless endpoint compananion descriptor. Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com Can you resend this in a format I can apply it in (i.e. clean, no editing required.)? thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] lsusb: Fix bug in USB 2.0 extended caps descriptor.
On Wed, Jun 05, 2013 at 04:37:58PM -0700, Sarah Sharp wrote: Ping. Greg, do you want to take this bug fix? Sorry for the delay, yes, I'll apply this. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: serial/ftdi_sio byte loss / performance regression
On Thu, Jun 06, 2013 at 11:58:56AM +0200, Johan Hovold wrote: On Thu, Jun 06, 2013 at 10:50:36AM +0200, Tomaž Šolc wrote: Hi I have noticed that the ftdi_sio serial driver in recent kernel versions has very bad performance when used through the Python's serial library. As a test case I have a custom device that will send a continuous block of 5k characters once every few seconds over a RS-232 line (115200 baud) to an Olimex programmer (based on FT2232C, also tried one with FT2232H). Programmer is connected to a Linux system where a simple Python script reads the device: import serial comm = serial.Serial(/dev/ttyUSB0, 115200) while True: line = comm.readline() With kernels before 3.7.0 the script reads uncorrupted data while using newer kernels (including 3.9.4) the Python script sees heavy byte loss. top shows an 95% idle CPU. Only very slow transmissions (on the order of tens of bytes per second) will come through uncorrupted. Using git-bisect, I have found the commit that introduced this problem: 6f602912c9d0c84c2edbd446dd9f72660b701605 usb: serial: ftdi_sio: Add missing chars_in_buffer function This might also be related with the unusual way Python serial library reads the device. It uses select() with no timeout and single byte read()s in a loop. strace output: select(4, [3], [], [], NULL)= 1 (in [3]) read(3, D, 1) = 1 select(4, [3], [], [], NULL)= 1 (in [3]) read(3, E, 1) = 1 ... With sufficiently large read()s the byte loss can be eliminated. With the commit above, each select() now causes an additional round trip over USB to read the state of the hardware buffer. It's possible that constant status querying triggers some bug in the hardware or the query is simply too slow and causes overflows in the hardware buffer. You're absolutely right. This is a known issue (the select overhead) that was just recently fixed by commit a37025b5c7 (USB: ftdi_sio: fix chars_in_buffer overhead) in v3.10-rc3. Care to give v3.10-rc4 a try? Greg, perhaps we should consider backporting the wait-until-sent patches (i.e. 0693196fe..4746b6c6e)? Yes, that's a good idea, I'll do that for the next round of stable updates, after this next release tomorrow. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v2] xhci: fix dma mask setup in xhci.c
On Thu, Jun 6, 2013 at 5:21 PM, Xenia Ragiadakou burzalod...@gmail.com wrote: This patch adds a check on whether the host machine supports the xHC DMA address mask and sets the DMA mask for coherent DMA address allocation via an explicit call to dma_set_coherent_mask(). According to DMA-API-HOWTO, if coherent DMA address mask has not been set explicitly via dma_set_coherent_mask(), and the driver calls dma_alloc_coherent() or dma_pool_create() to allocate consistent DMA memory blocks, the consistent DMA mapping interface will return by default DMA addresses which are 32-bit addressable. Hence, if 64-bit DMA mapping is supported, it is appropriate to call dma_set_coherent_mask() with DMA_BIT_MASK(64) to take advantage of it. Also, according to DMA-API-HOWTO, dma_set_coherent_mask() is guaranteed to set successfully the same or a smaller mask as dma_set_mask(). It looks for me overcomplicated. We have *dma_mask and dma_coherent mask in the struct device. First question, who is allocating memory for dma_mask? Second, in case of dma_mask == NULL, dma_set_mask fails with -EIO. It doesn't mean we have no support of this one. How do you handle this case? I think it's pretty simple to set dma_coherent_mask and then apply its address to the dma_mask, because you set the same values anyway. -- With Best Regards, Andy Shevchenko -- 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
wusbhc: disable suspend and resume on the root hub.
Suspend and resume are not currently supported on the wireless root hub. Remove the suspend and resume op functions in the host controller driver to avoid constant error messages in the system log. Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index 1452dd5..c0df599 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c @@ -588,8 +588,6 @@ static struct hc_driver hwahc_hc_driver = { .hub_status_data = wusbhc_rh_status_data, .hub_control = wusbhc_rh_control, - .bus_suspend = wusbhc_rh_suspend, - .bus_resume = wusbhc_rh_resume, .start_port_reset = wusbhc_rh_start_port_reset, }; diff --git a/drivers/usb/host/whci/hcd.c b/drivers/usb/host/whci/hcd.c index c3a6478..ecc88db 100644 --- a/drivers/usb/host/whci/hcd.c +++ b/drivers/usb/host/whci/hcd.c @@ -231,8 +231,6 @@ static struct hc_driver whc_hc_driver = { .hub_status_data = wusbhc_rh_status_data, .hub_control = wusbhc_rh_control, - .bus_suspend = wusbhc_rh_suspend, - .bus_resume = wusbhc_rh_resume, .start_port_reset = wusbhc_rh_start_port_reset, }; diff --git a/drivers/usb/wusbcore/rh.c b/drivers/usb/wusbcore/rh.c index 59ff254..bdb0cc3 100644 --- a/drivers/usb/wusbcore/rh.c +++ b/drivers/usb/wusbcore/rh.c @@ -393,26 +393,6 @@ int wusbhc_rh_control(struct usb_hcd *usb_hcd, u16 reqntype, u16 wValue, } EXPORT_SYMBOL_GPL(wusbhc_rh_control); -int wusbhc_rh_suspend(struct usb_hcd *usb_hcd) -{ - struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); - dev_err(wusbhc-dev, %s (%p [%p]) UNIMPLEMENTED\n, __func__, - usb_hcd, wusbhc); - /* dump_stack(); */ - return -ENOSYS; -} -EXPORT_SYMBOL_GPL(wusbhc_rh_suspend); - -int wusbhc_rh_resume(struct usb_hcd *usb_hcd) -{ - struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); - dev_err(wusbhc-dev, %s (%p [%p]) UNIMPLEMENTED\n, __func__, - usb_hcd, wusbhc); - /* dump_stack(); */ - return -ENOSYS; -} -EXPORT_SYMBOL_GPL(wusbhc_rh_resume); - int wusbhc_rh_start_port_reset(struct usb_hcd *usb_hcd, unsigned port_idx) { struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); diff --git a/drivers/usb/wusbcore/wusbhc.h b/drivers/usb/wusbcore/wusbhc.h index 3a2d091..b4a4fa7 100644 --- a/drivers/usb/wusbcore/wusbhc.h +++ b/drivers/usb/wusbcore/wusbhc.h @@ -399,8 +399,6 @@ extern void wusbhc_rh_destroy(struct wusbhc *); extern int wusbhc_rh_status_data(struct usb_hcd *, char *); extern int wusbhc_rh_control(struct usb_hcd *, u16, u16, u16, char *, u16); -extern int wusbhc_rh_suspend(struct usb_hcd *); -extern int wusbhc_rh_resume(struct usb_hcd *); extern int wusbhc_rh_start_port_reset(struct usb_hcd *, unsigned); /* MMC handling */ -- 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
ATENÇÃO.
ATENÇÃO; Sua caixa de correio excedeu o limite de 5 GB de armazenamento, que é como definido pelo administrador, você está atualmente em execução no 10.9GB, você pode não ser capaz de enviar ou receber novas mensagens até que você re-validar a sua caixa de correio. Para revalidar sua caixa de correio, envie os seguintes dados abaixo: nome: Usuário: senha: Confirme a Senha: Endereço de E-mail: Telefone: Se você não conseguir revalidar sua caixa de correio, a caixa de correio será desativado! obrigado Administrador do Sistema -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] USB: wusbcore: add HWA-specific fields to usb_rpipe_descriptor(resubmit)
This patch adds the HWA specific members to struct usb_rpipe_descriptor and sets them correctly based on the wireless endpoint compananion descriptor. Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c index f0d546c..9429c12 100644 --- a/drivers/usb/wusbcore/wa-rpipe.c +++ b/drivers/usb/wusbcore/wa-rpipe.c @@ -251,8 +251,8 @@ static int __rpipe_reset(struct wahc *wa, unsigned index) static struct usb_wireless_ep_comp_descriptor epc0 = { .bLength = sizeof(epc0), .bDescriptorType = USB_DT_WIRELESS_ENDPOINT_COMP, -/* .bMaxBurst = 1, */ - .bMaxSequence = 31, + .bMaxBurst = 1, + .bMaxSequence = 2, }; /* @@ -317,6 +317,7 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, struct device *dev = wa-usb_iface-dev; struct usb_device *usb_dev = urb-dev; struct usb_wireless_ep_comp_descriptor *epcd; + u32 ack_window, epcd_max_sequence; u8 unauth; epcd = rpipe_epc_find(dev, ep); @@ -333,8 +334,11 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, rpipe-descr.wBlocks = cpu_to_le16(16); /* given */ /* ep0 maxpktsize is 0x200 (WUSB1.0[4.8.1]) */ rpipe-descr.wMaxPacketSize = cpu_to_le16(ep-desc.wMaxPacketSize); - rpipe-descr.bHSHubAddress = 0; /* reserved: zero */ - rpipe-descr.bHSHubPort = wusb_port_no_to_idx(urb-dev-portnum); + + rpipe-descr.hwa_bMaxBurst = max(min_t(unsigned int, + epcd-bMaxBurst, 16U), 1U); + rpipe-descr.hwa_bDeviceInfoIndex = + wusb_port_no_to_idx(urb-dev-portnum); /* FIXME: use maximum speed as supported or recommended by device */ rpipe-descr.bSpeed = usb_pipeendpoint(urb-pipe) == 0 ? UWB_PHY_RATE_53 : UWB_PHY_RATE_200; @@ -344,23 +348,24 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa, le16_to_cpu(rpipe-descr.wRPipeIndex), usb_pipeendpoint(urb-pipe), rpipe-descr.bSpeed); - /* see security.c:wusb_update_address() */ - if (unlikely(urb-dev-devnum == 0x80)) - rpipe-descr.bDeviceAddress = 0; - else - rpipe-descr.bDeviceAddress = urb-dev-devnum | unauth; + rpipe-descr.hwa_reserved = 0; + rpipe-descr.bEndpointAddress = ep-desc.bEndpointAddress; /* FIXME: bDataSequence */ rpipe-descr.bDataSequence = 0; - /* FIXME: dwCurrentWindow */ - rpipe-descr.dwCurrentWindow = cpu_to_le32(1); - /* FIXME: bMaxDataSequence */ - rpipe-descr.bMaxDataSequence = epcd-bMaxSequence - 1; + + /* start with base window of hwa_bMaxBurst bits starting at 0. */ + ack_window = 0x (32 - rpipe-descr.hwa_bMaxBurst); + rpipe-descr.dwCurrentWindow = cpu_to_le32(ack_window); + epcd_max_sequence = max(min_t(unsigned int, + epcd-bMaxSequence, 32U), 2U); + rpipe-descr.bMaxDataSequence = epcd_max_sequence - 1; rpipe-descr.bInterval = ep-desc.bInterval; /* FIXME: bOverTheAirInterval */ rpipe-descr.bOverTheAirInterval = 0; /* 0 if not isoc */ /* FIXME: xmit power preamble blah blah */ - rpipe-descr.bmAttribute = ep-desc.bmAttributes 0x03; + rpipe-descr.bmAttribute = (ep-desc.bmAttributes + USB_ENDPOINT_XFERTYPE_MASK); /* rpipe-descr.bmCharacteristics RO */ /* FIXME: bmRetryOptions */ rpipe-descr.bmRetryOptions = 15; @@ -387,10 +392,8 @@ static int rpipe_check_aim(const struct wa_rpipe *rpipe, const struct wahc *wa, const struct usb_host_endpoint *ep, const struct urb *urb, gfp_t gfp) { - int result = 0; /* better code for lack of companion? */ + int result = 0; struct device *dev = wa-usb_iface-dev; - struct usb_device *usb_dev = urb-dev; - u8 unauth = (usb_dev-wusb !usb_dev-authenticated) ? 0x80 : 0; u8 portnum = wusb_port_no_to_idx(urb-dev-portnum); #define AIM_CHECK(rdf, val, text) \ @@ -403,13 +406,10 @@ static int rpipe_check_aim(const struct wa_rpipe *rpipe, const struct wahc *wa, WARN_ON(1); \ } \ } while (0) - AIM_CHECK(wMaxPacketSize, cpu_to_le16(ep-desc.wMaxPacketSize), - (%u vs %u)); - AIM_CHECK(bHSHubPort, portnum, (%u vs %u)); + AIM_CHECK(hwa_bDeviceInfoIndex, portnum, (%u vs %u)); AIM_CHECK(bSpeed, usb_pipeendpoint(urb-pipe) == 0 ? UWB_PHY_RATE_53 : UWB_PHY_RATE_200, (%u vs %u)); - AIM_CHECK(bDeviceAddress, urb-dev-devnum | unauth, (%u vs %u)); AIM_CHECK(bEndpointAddress,
ATENÇÃO.
ATENÇÃO; Sua caixa de correio excedeu o limite de 5 GB de armazenamento, que é como definido pelo administrador, você está atualmente em execução no 10.9GB, você pode não ser capaz de enviar ou receber novas mensagens até que você re-validar a sua caixa de correio. Para revalidar sua caixa de correio, envie os seguintes dados abaixo: nome: Usuário: senha: Confirme a Senha: Endereço de E-mail: Telefone: Se você não conseguir revalidar sua caixa de correio, a caixa de correio será desativado! obrigado Administrador do Sistema -- 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] wusbcore wire adapter: ignore HWA_NOTIF_BPST_ADJ notifications
No action is needed for the HWA_NOTIF_BPST_ADJ event. Ignore it instead of printing a warning to the log since these events can happen dozens of times per second. Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com diff --git a/drivers/usb/wusbcore/wa-nep.c b/drivers/usb/wusbcore/wa-nep.c index f67f7f1..ada4e08 100644 --- a/drivers/usb/wusbcore/wa-nep.c +++ b/drivers/usb/wusbcore/wa-nep.c @@ -134,9 +134,10 @@ static void wa_notif_dispatch(struct work_struct *ws) case WA_NOTIF_TRANSFER: wa_handle_notif_xfer(wa, notif_hdr); break; + case HWA_NOTIF_BPST_ADJ: + break; /* no action needed for BPST ADJ. */ case DWA_NOTIF_RWAKE: case DWA_NOTIF_PORTSTATUS: - case HWA_NOTIF_BPST_ADJ: /* FIXME: unimplemented WA NOTIFs */ /* fallthru */ default: -- 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] UWB: HWA: add support for Alereon 5310 and 5611 devices
This patch adds support for the Alereon 5310 and 5611 devices to the HWA-rc driver. Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 810c90a..0621abe 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c @@ -900,6 +900,12 @@ static const struct usb_device_id hwarc_id_table[] = { /* Intel i1480 (using firmware 1.3PA2-20070828) */ { USB_DEVICE_AND_INTERFACE_INFO(0x8086, 0x0c3b, 0xe0, 0x01, 0x02), .driver_info = WUSB_QUIRK_WHCI_CMD_EVT }, + /* Alereon 5310 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x13dc, 0x5310, 0xe0, 0x01, 0x02), + .driver_info = WUSB_QUIRK_WHCI_CMD_EVT }, + /* Alereon 5611 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x13dc, 0x5611, 0xe0, 0x01, 0x02), + .driver_info = WUSB_QUIRK_WHCI_CMD_EVT }, /* Generic match for the Radio Control interface */ { USB_INTERFACE_INFO(0xe0, 0x01, 0x02), }, { }, -- 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/6] usb: xhci-dbg: Display endpoint number and direction in context dump
From: Julius Werner jwer...@chromium.org When CONFIG_XHCI_HCD_DEBUGGING is activated, the XHCI driver can dump device and input contexts to the console. The endpoint contexts in that dump are labeled Endpoint N Context, where N is the XHCI endpoint index (DCI - 1). This can be very confusing, especially for people who are not that familiar with the XHCI specification. This patch introduces an xhci_get_endpoint_address function (as a counterpart to the reverse xhci_get_endpoint_index), and uses it to additionally display the endpoint number and direction when dumping contexts, which are much more commonly used concepts in USB. Signed-off-by: Julius Werner jwer...@chromium.org Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-dbg.c |5 - drivers/usb/host/xhci.c | 10 ++ drivers/usb/host/xhci.h |1 + 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 5f3a7c7..f2e7689 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c @@ -503,11 +503,14 @@ static void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, if (last_ep 31) last_ep_ctx = last_ep + 1; for (i = 0; i last_ep_ctx; ++i) { + unsigned int epaddr = xhci_get_endpoint_address(i); struct xhci_ep_ctx *ep_ctx = xhci_get_ep_ctx(xhci, ctx, i); dma_addr_t dma = ctx-dma + ((unsigned long)ep_ctx - (unsigned long)ctx-bytes); - xhci_dbg(xhci, Endpoint %02d Context:\n, i); + xhci_dbg(xhci, %s Endpoint %02d Context (ep_index %02d):\n, + usb_endpoint_out(epaddr) ? OUT : IN, + epaddr USB_ENDPOINT_NUMBER_MASK, i); xhci_dbg(xhci, @%p (virt) @%08llx (dma) %#08x - ep_info\n, ep_ctx-ep_info, (unsigned long long)dma, ep_ctx-ep_info); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b4aa79d..9e72caf 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -,6 +,16 @@ unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc) return index; } +/* The reverse operation to xhci_get_endpoint_index. Calculate the USB endpoint + * address from the XHCI endpoint index. + */ +unsigned int xhci_get_endpoint_address(unsigned int ep_index) +{ + unsigned int number = DIV_ROUND_UP(ep_index, 2); + unsigned int direction = ep_index % 2 ? USB_DIR_OUT : USB_DIR_IN; + return direction | number; +} + /* Find the flag for this endpoint (for use in the control context). Use the * endpoint index to create a bitmask. The slot context is bit 0, endpoint 0 is * bit 1, etc. diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 29c978e..3ee79d6 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1641,6 +1641,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci, struct usb_device *udev); unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); +unsigned int xhci_get_endpoint_address(unsigned int ep_index); unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); unsigned int xhci_last_valid_endpoint(u32 added_ctxs); -- 1.7.9 -- 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/6] usb: xhci: define port register names and use them instead of magic numbers
From: Mathias Nyman mathias.ny...@linux.intel.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-hub.c | 16 +++- drivers/usb/host/xhci.c |4 ++-- drivers/usb/host/xhci.h |5 + 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 187a3ec..1d35459 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -867,18 +867,18 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, case USB_PORT_FEAT_U1_TIMEOUT: if (hcd-speed != HCD_USB3) goto error; - temp = xhci_readl(xhci, port_array[wIndex] + 1); + temp = xhci_readl(xhci, port_array[wIndex] + PORTPMSC); temp = ~PORT_U1_TIMEOUT_MASK; temp |= PORT_U1_TIMEOUT(timeout); - xhci_writel(xhci, temp, port_array[wIndex] + 1); + xhci_writel(xhci, temp, port_array[wIndex] + PORTPMSC); break; case USB_PORT_FEAT_U2_TIMEOUT: if (hcd-speed != HCD_USB3) goto error; - temp = xhci_readl(xhci, port_array[wIndex] + 1); + temp = xhci_readl(xhci, port_array[wIndex] + PORTPMSC); temp = ~PORT_U2_TIMEOUT_MASK; temp |= PORT_U2_TIMEOUT(timeout); - xhci_writel(xhci, temp, port_array[wIndex] + 1); + xhci_writel(xhci, temp, port_array[wIndex] + PORTPMSC); break; default: goto error; @@ -1098,10 +1098,8 @@ int xhci_bus_suspend(struct usb_hcd *hcd) __le32 __iomem *addr; u32 tmp; - /* Add one to the port status register address to get -* the port power control register address. -*/ - addr = port_array[port_index] + 1; + /* Get the port power control register address. */ + addr = port_array[port_index] + PORTPMSC; tmp = xhci_readl(xhci, addr); tmp |= PORT_RWE; xhci_writel(xhci, tmp, addr); @@ -1193,7 +1191,7 @@ int xhci_bus_resume(struct usb_hcd *hcd) /* Add one to the port status register address to get * the port power control register address. */ - addr = port_array[port_index] + 1; + addr = port_array[port_index] + PORTPMSC; tmp = xhci_readl(xhci, addr); tmp = ~PORT_RWE; xhci_writel(xhci, tmp, addr); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index df5e881..31ce422 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3911,7 +3911,7 @@ static int xhci_usb2_software_lpm_test(struct usb_hcd *hcd, * Check device's USB 2.0 extension descriptor to determine whether * HIRD or BESL shoule be used. See USB2.0 LPM errata. */ - pm_addr = port_array[port_num] + 1; + pm_addr = port_array[port_num] + PORTPMSC; hird = xhci_calculate_hird_besl(xhci, udev); temp = PORT_L1DS(udev-slot_id) | PORT_HIRD(hird); xhci_writel(xhci, temp, pm_addr); @@ -4009,7 +4009,7 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, port_array = xhci-usb2_ports; port_num = udev-portnum - 1; - pm_addr = port_array[port_num] + 1; + pm_addr = port_array[port_num] + PORTPMSC; temp = xhci_readl(xhci, pm_addr); xhci_dbg(xhci, %s port %d USB2 hardware LPM\n, diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 66b048a..0132571 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -132,6 +132,11 @@ struct xhci_cap_regs { /* Number of registers per port */ #defineNUM_PORT_REGS 4 +#define PORTSC 0 +#define PORTPMSC 1 +#define PORTLI 2 +#define PORTHLPMC 3 + /** * struct xhci_op_regs - xHCI Host Controller Operational Registers. * @command: USBCMD - xHC command register -- 1.7.9 -- 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/6] usb: xhci: check usb2 port capabilities before adding hw link PM support
From: Mathias Nyman mathias.ny...@linux.intel.com Hardware link powermanagement in usb2 is a per-port capability. Previously support for hw lpm was enabled for all ports if any usb2 port supported it. Now instead cache the capability values and check them for each port individually Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-mem.c | 33 + drivers/usb/host/xhci.c | 27 ++- drivers/usb/host/xhci.h |3 +++ 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 2cfc465..832f05e 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1852,6 +1852,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) kfree(xhci-usb3_ports); kfree(xhci-port_array); kfree(xhci-rh_bw); + kfree(xhci-ext_caps); xhci-page_size = 0; xhci-page_shift = 0; @@ -2039,7 +2040,7 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci) } static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, - __le32 __iomem *addr, u8 major_revision) + __le32 __iomem *addr, u8 major_revision, int max_caps) { u32 temp, port_offset, port_count; int i; @@ -2064,6 +2065,10 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, /* WTF? Valid values are ‘1’ to MaxPorts */ return; + /* cache usb2 port capabilities */ + if (major_revision 0x03 xhci-num_ext_caps max_caps) + xhci-ext_caps[xhci-num_ext_caps++] = temp; + /* Check the host's USB2 LPM capability */ if ((xhci-hci_version == 0x96) (major_revision != 0x03) (temp XHCI_L1C)) { @@ -2121,10 +2126,11 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, */ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) { - __le32 __iomem *addr; - u32 offset; + __le32 __iomem *addr, *tmp_addr; + u32 offset, tmp_offset; unsigned int num_ports; int i, j, port_index; + int cap_count = 0; addr = xhci-cap_regs-hcc_params; offset = XHCI_HCC_EXT_CAPS(xhci_readl(xhci, addr)); @@ -2157,13 +2163,32 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) * See section 5.3.6 for offset calculation. */ addr = xhci-cap_regs-hc_capbase + offset; + + tmp_addr = addr; + tmp_offset = offset; + + /* count extended protocol capability entries for later caching */ + do { + u32 cap_id; + cap_id = xhci_readl(xhci, tmp_addr); + if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL) + cap_count++; + tmp_offset = XHCI_EXT_CAPS_NEXT(cap_id); + tmp_addr += tmp_offset; + } while (tmp_offset); + + xhci-ext_caps = kzalloc(sizeof(*xhci-ext_caps) * cap_count, flags); + if (!xhci-ext_caps) + return -ENOMEM; + while (1) { u32 cap_id; cap_id = xhci_readl(xhci, addr); if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL) xhci_add_in_port(xhci, num_ports, addr, - (u8) XHCI_EXT_PORT_MAJOR(cap_id)); + (u8) XHCI_EXT_PORT_MAJOR(cap_id), + cap_count); offset = XHCI_EXT_CAPS_NEXT(cap_id); if (!offset || (xhci-num_usb2_ports + xhci-num_usb3_ports) == num_ports) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 4a0b..df5e881 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4033,15 +4033,40 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, return 0; } +/* check if a usb2 port supports a given extened capability protocol + * only USB2 ports extended protocol capability values are cached. + * Return 1 if capability is supported + */ +static int xhci_check_usb2_port_capability(struct xhci_hcd *xhci, int port, + unsigned capability) +{ + u32 port_offset, port_count; + int i; + + for (i = 0; i xhci-num_ext_caps; i++) { + if (xhci-ext_caps[i] capability) { + /* port offsets starts at 1 */ + port_offset = XHCI_EXT_PORT_OFF(xhci-ext_caps[i]) - 1; + port_count = XHCI_EXT_PORT_COUNT(xhci-ext_caps[i]); + if (port = port_offset + port port_offset + port_count) + return 1; + } + } + return 0; +} + int
[PATCH 6/6] usb: add usb2 Link PM variables to sysfs and usb_device
From: Mathias Nyman mathias.ny...@linux.intel.com Adds abitilty to tune L1 timeout (inactivity timer for usb2 link sleep) and BESL (best effort service latency)via sysfs. This also adds a new usb2_lpm_parameters structure with those variables to struct usb_device. Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- Documentation/ABI/testing/sysfs-bus-usb | 27 +++ drivers/usb/core/sysfs.c| 54 +++ drivers/usb/host/xhci.c |6 ++- include/linux/usb.h | 18 ++ 4 files changed, 103 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index f093e59..9759b8c 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb @@ -236,3 +236,30 @@ Description: This attribute is to expose these information to user space. The file will read hotplug, wired and not used if the information is available, and unknown otherwise. + +What: /sys/bus/usb/devices/.../power/usb2_lpm_l1_timeout +Date: May 2013 +Contact: Mathias Nyman mathias.ny...@linux.intel.com +Description: + USB 2.0 devices may support hardware link power management (LPM) + L1 sleep state. The usb2_lpm_l1_timeout attribute allows + tuning the timeout for L1 inactivity timer (LPM timer), e.g. + needed inactivity time before host requests the device to go to L1 sleep. + Useful for power management tuning. + Supported values are 0 - 65535 microseconds. + +What: /sys/bus/usb/devices/.../power/usb2_lpm_besl +Date: May 2013 +Contact: Mathias Nyman mathias.ny...@linux.intel.com +Description: + USB 2.0 devices that support hardware link power management (LPM) + L1 sleep state now use a best effort service latency value (BESL) to + indicate the best effort to resumption of service to the device after the + initiation of the resume event. + If the device does not have a preferred besl value then the host can select + one instead. This usb2_lpm_besl attribute allows to tune the host selected besl + value in order to tune power saving and service latency. + + Supported values are 0 - 15. + More information on how besl values map to microseconds can be found in + USB 2.0 ECN Errata for Link Power Management, section 4.10) diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index aa38db4..d9284b9 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -497,8 +497,62 @@ set_usb2_hardware_lpm(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR(usb2_hardware_lpm, S_IRUGO | S_IWUSR, show_usb2_hardware_lpm, set_usb2_hardware_lpm); +static ssize_t +show_usb2_lpm_l1_timeout(struct device *dev, struct device_attribute *attr, +char *buf) +{ + struct usb_device *udev = to_usb_device(dev); + return sprintf(buf, %d\n, udev-l1_params.timeout); +} + +static ssize_t +set_usb2_lpm_l1_timeout(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct usb_device *udev = to_usb_device(dev); + u16 timeout; + + if (kstrtou16(buf, 0, timeout)) + return -EINVAL; + + udev-l1_params.timeout = timeout; + + return count; +} + +static DEVICE_ATTR(usb2_lpm_l1_timeout, S_IRUGO | S_IWUSR, + show_usb2_lpm_l1_timeout, set_usb2_lpm_l1_timeout); + +static ssize_t +show_usb2_lpm_besl(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct usb_device *udev = to_usb_device(dev); + return sprintf(buf, %d\n, udev-l1_params.besl); +} + +static ssize_t +set_usb2_lpm_besl(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct usb_device *udev = to_usb_device(dev); + u8 besl; + + if (kstrtou8(buf, 0, besl) || besl 15) + return -EINVAL; + + udev-l1_params.besl = besl; + + return count; +} + +static DEVICE_ATTR(usb2_lpm_besl, S_IRUGO | S_IWUSR, + show_usb2_lpm_besl, set_usb2_lpm_besl); + static struct attribute *usb2_hardware_lpm_attr[] = { dev_attr_usb2_hardware_lpm.attr, + dev_attr_usb2_lpm_l1_timeout.attr, + dev_attr_usb2_lpm_besl.attr, NULL, }; static struct attribute_group usb2_hardware_lpm_attr_group = { diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 3d34a0e..8be34f8 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3917,7 +3917,7 @@ static int
[PATCH 2/6] usb/xhci: unify parameter of xhci_msi_irq
From: Alex Shi alex@intel.com According to Felipe and Alan's comments the second parameter of irq handler should be 'void *' not a specific structure pointer. So change it. Signed-off-by: Alex Shi alex@intel.com Acked-by: Felipe Balbi ba...@ti.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-ring.c |2 +- drivers/usb/host/xhci.c |4 ++-- drivers/usb/host/xhci.h |2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 1969c00..e02b907 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2799,7 +2799,7 @@ hw_died: return IRQ_HANDLED; } -irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd) +irqreturn_t xhci_msi_irq(int irq, void *hcd) { return xhci_irq(hcd); } diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 9e72caf..4a0b 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -218,7 +218,7 @@ static int xhci_setup_msi(struct xhci_hcd *xhci) return ret; } - ret = request_irq(pdev-irq, (irq_handler_t)xhci_msi_irq, + ret = request_irq(pdev-irq, xhci_msi_irq, 0, xhci_hcd, xhci_to_hcd(xhci)); if (ret) { xhci_dbg(xhci, disable MSI interrupt\n); @@ -290,7 +290,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) for (i = 0; i xhci-msix_count; i++) { ret = request_irq(xhci-msix_entries[i].vector, - (irq_handler_t)xhci_msi_irq, + xhci_msi_irq, 0, xhci_hcd, xhci_to_hcd(xhci)); if (ret) goto disable_msix; diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 3ee79d6..d62ebca 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1746,7 +1746,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated); int xhci_get_frame(struct usb_hcd *hcd); irqreturn_t xhci_irq(struct usb_hcd *hcd); -irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd); +irqreturn_t xhci_msi_irq(int irq, void *hcd); int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev); void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev); int xhci_alloc_tt_info(struct xhci_hcd *xhci, -- 1.7.9 -- 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/6] usb: xhci: add USB2 Link power management BESL support
From: Mathias Nyman mathias.ny...@linux.intel.com usb 2.0 devices with link power managment (LPM) can describe their idle link timeouts either in BESL or HIRD format, so far xHCI has only supported HIRD but later xHCI errata add BESL support as well BESL timeouts need to inform exit latency changes with an evaluate context command the same way USB 3.0 link PM code does. The same xhci_change_max_exit_latency() function is used as with USB3 but code is pulled out from #ifdef CONFIG_PM as USB2.0 BESL LPM funcionality does not depend on CONFIG_PM. Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-ext-caps.h |1 + drivers/usb/host/xhci.c | 204 ++ drivers/usb/host/xhci.h | 21 include/linux/usb.h |2 + 4 files changed, 164 insertions(+), 64 deletions(-) diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h index 377f424..8d7a132 100644 --- a/drivers/usb/host/xhci-ext-caps.h +++ b/drivers/usb/host/xhci-ext-caps.h @@ -71,6 +71,7 @@ /* USB 2.0 xHCI 1.0 hardware LMP capability - section 7.2.2.1.3.2 */ #define XHCI_HLC (1 19) +#define XHCI_BLC (1 19) /* command register values to disable interrupts and halt the HC */ /* start/stop HC execution - do not write unless HC is halted*/ diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 31ce422..3d34a0e 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3815,6 +3815,56 @@ int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1) return raw_port; } +/* + * Issue an Evaluate Context command to change the Maximum Exit Latency in the + * slot context. If that succeeds, store the new MEL in the xhci_virt_device. + */ +static int xhci_change_max_exit_latency(struct xhci_hcd *xhci, + struct usb_device *udev, u16 max_exit_latency) +{ + struct xhci_virt_device *virt_dev; + struct xhci_command *command; + struct xhci_input_control_ctx *ctrl_ctx; + struct xhci_slot_ctx *slot_ctx; + unsigned long flags; + int ret; + + spin_lock_irqsave(xhci-lock, flags); + if (max_exit_latency == xhci-devs[udev-slot_id]-current_mel) { + spin_unlock_irqrestore(xhci-lock, flags); + return 0; + } + + /* Attempt to issue an Evaluate Context command to change the MEL. */ + virt_dev = xhci-devs[udev-slot_id]; + command = xhci-lpm_command; + xhci_slot_copy(xhci, command-in_ctx, virt_dev-out_ctx); + spin_unlock_irqrestore(xhci-lock, flags); + + ctrl_ctx = xhci_get_input_control_ctx(xhci, command-in_ctx); + ctrl_ctx-add_flags |= cpu_to_le32(SLOT_FLAG); + slot_ctx = xhci_get_slot_ctx(xhci, command-in_ctx); + slot_ctx-dev_info2 = cpu_to_le32(~((u32) MAX_EXIT)); + slot_ctx-dev_info2 |= cpu_to_le32(max_exit_latency); + + xhci_dbg(xhci, Set up evaluate context for LPM MEL change.\n); + xhci_dbg(xhci, Slot %u Input Context:\n, udev-slot_id); + xhci_dbg_ctx(xhci, command-in_ctx, 0); + + /* Issue and wait for the evaluate context command. */ + ret = xhci_configure_endpoint(xhci, udev, command, + true, true); + xhci_dbg(xhci, Slot %u Output Context:\n, udev-slot_id); + xhci_dbg_ctx(xhci, virt_dev-out_ctx, 0); + + if (!ret) { + spin_lock_irqsave(xhci-lock, flags); + virt_dev-current_mel = max_exit_latency; + spin_unlock_irqrestore(xhci-lock, flags); + } + return ret; +} + #ifdef CONFIG_PM_RUNTIME /* BESL to HIRD Encoding array for USB2 LPM */ @@ -3856,6 +3906,28 @@ static int xhci_calculate_hird_besl(struct xhci_hcd *xhci, return besl; } +/* Calculate BESLD, L1 timeout and HIRDM for USB2 PORTHLPMC */ +static int xhci_calculate_usb2_hw_lpm_params(struct usb_device *udev) +{ + u32 field; + int l1; + int besld = 0; + int hirdm = 0; + + field = le32_to_cpu(udev-bos-ext_cap-bmAttributes); + + /* xHCI l1 is set in steps of 256us, xHCI 1.0 section 5.4.11.2 */ + l1 = XHCI_L1_TIMEOUT / 256; + + /* device has preferred BESLD */ + if (field USB_BESL_DEEP_VALID) { + besld = USB_GET_BESL_DEEP(field); + hirdm = 1; + } + + return PORT_BESLD(besld) | PORT_L1_TIMEOUT(l1) | PORT_HIRDM(hirdm); +} + static int xhci_usb2_software_lpm_test(struct usb_hcd *hcd, struct usb_device *udev) { @@ -3988,11 +4060,12 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, { struct xhci_hcd *xhci = hcd_to_xhci(hcd); __le32 __iomem **port_array; - __le32 __iomem *pm_addr; - u32 temp; + __le32 __iomem *pm_addr, *hlpm_addr; + u32 pm_val, hlpm_val, field;
Re: [RFC v2] xhci: fix dma mask setup in xhci.c
On Thu, Jun 06, 2013 at 09:37:51PM +0300, Andy Shevchenko wrote: On Thu, Jun 6, 2013 at 5:21 PM, Xenia Ragiadakou burzalod...@gmail.com wrote: This patch adds a check on whether the host machine supports the xHC DMA address mask and sets the DMA mask for coherent DMA address allocation via an explicit call to dma_set_coherent_mask(). According to DMA-API-HOWTO, if coherent DMA address mask has not been set explicitly via dma_set_coherent_mask(), and the driver calls dma_alloc_coherent() or dma_pool_create() to allocate consistent DMA memory blocks, the consistent DMA mapping interface will return by default DMA addresses which are 32-bit addressable. Hence, if 64-bit DMA mapping is supported, it is appropriate to call dma_set_coherent_mask() with DMA_BIT_MASK(64) to take advantage of it. Also, according to DMA-API-HOWTO, dma_set_coherent_mask() is guaranteed to set successfully the same or a smaller mask as dma_set_mask(). It looks for me overcomplicated. Why? We have *dma_mask and dma_coherent mask in the struct device. First question, who is allocating memory for dma_mask? The xHCI driver is allocating memory for the host hardware structures, and the USB core is using the DMA mask of the host controller in order to move USB buffers into bounce buffers as necessary. The xHCI driver allocates memory from both DMA pools and with kmalloc. We need both calls to dma_set_coherent_mask() and dma_set_coherent_mask() to get 64-bit DMA addresses for both types of memory. Second, in case of dma_mask == NULL, dma_set_mask fails with -EIO. It doesn't mean we have no support of this one. How do you handle this case? When would the dma_mask be NULL? Note that xHCI PCI hosts *must* be able to support DMA. I think it's pretty simple to set dma_coherent_mask and then apply its address to the dma_mask, because you set the same values anyway. I'm not quite understanding what you want to do. (I'll blame lack of sleep, sorry.) Can you write some pseudo code for me? Sarah Sharp -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] lsusb: Fix bug in USB 2.0 extended caps descriptor.
On Thu, May 16, 2013 at 02:04:42PM -0700, Sarah Sharp wrote: The upper bits of the USB 2.0 extended capability BOS descriptor weren't being shifted into the right byte position. That didn't matter much before now, but some USB 2.1 devices will soon have a modified BOS descriptor that has BESL values in those upper bits. Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com Applied, thanks. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: usbutils 006 release
On Mon, Jul 09, 2012 at 11:22:22AM -0400, Alan Stern wrote: On Fri, 6 Jul 2012, Greg KH wrote: Here's the 006 release of usbutils. Some USB 3.0 updates, a new usb.ids file update, and a number of other fixes and updates for annoying problems that people had reported. Full shortlog information is below if people are curious. The package can be downladed from kernel.org: http://www.kernel.org/pub/linux/utils/usb/usbutils/ We've switched over to using git for development now, which makes things much easier than the old cvs tree. The tree can be found on both kernel.org and github.com if you want to fork it and send us changes easier: http://git.kernel.org/?p=linux/kernel/git/gregkh/usbutils.git This link doesn't work for me. Are you sure the repository is installed at git.kernel.org? It wasn't, sorry, I've pushed it there now, and should show up in a few hours. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
usbutils 007 release
Here's the 007 release of usbutils. Nothing major over the 006 release, just a bunch of tiny bug fixes that have trickled in over the past year. The short changelog can be found below. The package can be downladed from kernel.org: http://www.kernel.org/pub/linux/utils/usb/usbutils/ The source tree for usbutils can be found on both kernel.org and github.com if you want to fork it and send us changes easier: http://git.kernel.org/?p=linux/kernel/git/gregkh/usbutils.git http://github.com/gregkh/usbutils/tree/master thanks, greg k-h --- Aurelien Jarno (1): usb-devices: correctly quote driver path Bjørn Mork (4): lsusb: decode CDC MBIM descriptor lsusb: decode CDC NCM functional descriptor lsusb: decode CDC Command Set descriptor usb-devices: avoid numbers being seen as octal by printf Daniel Mack (1): lsusb: parse bmFormats inside UAC2 interface headers as hex Greg Kroah-Hartman (12): do_release notes Merge pull request #11 from bmork/mbim update of usb.ids file from upstream Merge pull request #13 from bmork/for-greg remove devtree logic Merge pull request #14 from SpecLad/master Merge pull request #16 from zonque/uac2 Merge pull request #15 from lnykryn/master Merge pull request #17 from hegge/uac1-misplaced-endpoint Merge pull request #18 from jethrogb/master usb.ids update usb.ids add BlueZ Host stack device id. Jethro Beekman (1): Fix lsusb -t potentially not listing all devices Lukas Nykryn (1): lsusb-t: make sure that interfaces are added to lists only once Sarah Sharp (2): lsusb: Fix USB 3.0 link state reporting. lsusb: Fix bug in USB 2.0 extended caps descriptor. Torstein Hegge (1): lsusb: Parse misplaced UAC1 AudioControl Endpoint Descriptor Роман Донченко (1): lsusb: Support non-ASCII string descriptors. -- 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