Re: [PATCH v1] usb: dwc2: reset AHB hclk domain before init
On 8/12/2015 12:33 PM, Felipe Balbi wrote: On Wed, Aug 12, 2015 at 07:06:09PM +0800, Yunzhi Li wrote: Hi , 在 2015/8/11 22:12, Felipe Balbi 写道: Hi, On Tue, Aug 11, 2015 at 10:27:42AM +0800, Yunzhi Li wrote: We initiate dwc2 usb controller in BIOS, when kernel driver start-up we should reset AHB hclk domain to reset all AHB interface registers to default. Without this the FIFO value setting might be incorrect because calculating FIFO size need the power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers. This patch could avoid warnning massage like in rk3288 platform: [2.074764] dwc2 ff58.usb: 256 invalid for host_perio_tx_fifo_size. Check HW configuration. Signed-off-by: Yunzhi Li l...@rock-chips.com --- drivers/usb/dwc2/platform.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 9093530..3da21ab 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -42,6 +42,7 @@ #include linux/of_device.h #include linux/mutex.h #include linux/platform_device.h +#include linux/reset.h #include linux/usb/of.h @@ -165,6 +166,7 @@ static int dwc2_driver_probe(struct platform_device *dev) struct resource *res; struct phy *phy; struct usb_phy *uphy; + struct reset_control *rst; int retval; int irq; @@ -189,6 +191,16 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg-dev = dev-dev; + /* AHB hclk domain reset, set all AHB interface registers to default */ + rst = devm_reset_control_get_optional(dev-dev, ahb_reset); why isn't this done in core so PCI systems can also make use of it ? I have no ides about how to reset a PCI interface dwc2 controller, John could you please give some infomation about it ? Is it also needed for PCI interface dwc2 IP ? even on platform only, how do you know all users provide a ahb_reset reset controller ? Also where do you provide the ahb_reset? I don't see it as a property for dwc2. With regards to PCI, I'm also not sure how you'd accomplish something like this. But the platform I use at least doesn't need this. Regards, John -- 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: Huawei E3131
Hi Dan and Bjorn, thank you both for your detailed answers on this thread. Bjørn Mork wrote: Martin Mokrejs mmokr...@fold.natur.cuni.cz writes: Hi Bjorn, my have a new USB 3G modem sold in Czech Republic by T-Mobile. So far it works for me only using the option driver and pppd. The 'qmi-network /dev/cdc-wdm0' does not work for me. Maybe it has no QMI interface ('modprobe qmi_wwan' does not log any new device found through dmesg but maybe that is because it is already claimed by cdc_ncm driver)? I haven't seen the virtual CD-ROM associated media errors with my old Huawei E372. I believe I can ignore them but is that because of the modem firmware being ... suboptimal? BTW, usb_modeswitch used to log that it flipped a device. Isn't this needed anymore? Dont' know. Your log shows that the device is switched from 12d1:15ca to 12d1:1506. I assume that is usb_modeswitch doint its job: you are right, I forgot it is not logged in dmesg, here are the lines from syslog: Aug 12 21:23:19 vostro usb_modeswitch[3541]: switch device 12d1:15ca on 001/003 Aug 12 21:23:21 vostro root[3589]: usb_modeswitch: switched to 12d1:1506 on 001/004 [ 301.850141] usb 1-1.1: new high-speed USB device number 3 using xhci_hcd [ 301.954975] usb 1-1.1: New USB device found, idVendor=12d1, idProduct=15ca [ 301.954989] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 301.954995] usb 1-1.1: Product: HUAWEI Mobile [ 301.955000] usb 1-1.1: Manufacturer: HUAWEI [ 301.955014] usb 1-1.1: SerialNumber: [ 302.002613] usb-storage 1-1.1:1.0: USB Mass Storage device detected [ 302.003190] scsi host7: usb-storage 1-1.1:1.0 [ 303.016259] scsi 7:0:0:0: CD-ROMHUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2 [ 303.025890] sr 7:0:0:0: [sr1] scsi-1 drive [ 303.026802] sr 7:0:0:0: Attached scsi CD-ROM sr1 [ 303.027482] sr 7:0:0:0: Attached scsi generic sg3 type 5 [ 303.031504] scsi 7:0:0:1: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2 [ 303.032127] sd 7:0:0:1: Attached scsi generic sg4 type 0 [ 303.049740] sd 7:0:0:1: [sdc] Attached SCSI removable disk [ 303.106042] Buffer I/O error on dev sr1, logical block 512, async page read [ 303.359262] usb 1-1.1: USB disconnect, device number 3 [ 304.032875] usb 1-1.1: new high-speed USB device number 4 using xhci_hcd [ 304.137604] usb 1-1.1: New USB device found, idVendor=12d1, idProduct=1506 [ 304.137617] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 304.137624] usb 1-1.1: Product: HUAWEI Mobile [ 304.137629] usb 1-1.1: Manufacturer: HUAWEI [ 304.554118] huawei_cdc_ncm 1-1.1:1.1: MAC-Address: 82:a9:4a:09:84:2e [ 304.576776] huawei_cdc_ncm 1-1.1:1.1: cdc-wdm0: USB WDM device [ 304.577728] huawei_cdc_ncm 1-1.1:1.1 wwan0: register 'huawei_cdc_ncm' at usb-:0b:00.0-1.1, Huawei CDC NCM device, 82:a9:4a:09:84:2e [ 304.579135] usb-storage 1-1.1:1.4: USB Mass Storage device detected [ 304.579425] scsi host8: usb-storage 1-1.1:1.4 [ 304.579984] usb-storage 1-1.1:1.5: USB Mass Storage device detected [ 304.580141] scsi host9: usb-storage 1-1.1:1.5 [ 304.640300] huawei_cdc_ncm 1-1.1:1.1 wwp11s0u1u1i1: renamed from wwan0 And the last part here shows that your modem has a Huawei specific NCM interface, handled by the huawei_cdc_ncm driver. This is not a QMI modem. The huawei_cdc_ncm driver also provides a /dev/cdc-wdm0 device, but this device speaks AT commands, not QMI. You can use the /dev/cdc-wdm0 device with Huawei specific commands like AT^NDISDUP etc. Google that or use a ModemManager supporting it (not sure about the status here, though...). Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber1 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 2 bInterfaceProtocol 22 iInterface 8 CDC Network Control Model (NCM) The string descriptor is right. 255/2/22 is one of the class/subclass/protocol sets Huawei use for their vendor specific NCM variants. OK, thank you, so I will stay with pppd talking to ttyUSB0 at 460800 baudrate. It is puzzling Huawei sells a different hardware. I thought I could go with my old setup for Huawei E372 ..., well does not really matter. Martin -- 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: phy: phy-generic: Fix reset behaviour on legacy boot
The gpio-desc migration done in v4.0 caused a regression with legacy boots due to reversed reset logic. e.g. omap3-beagle USB host breaks on legacy boot. Request the reset GPIO with GPIOF_ACTIVE_LOW flag so that it matches the driver logic and pin behaviour. Fixes: e9f2cefb0cdc (usb: phy: generic: migrate to gpio_desc) Cc: sta...@vger.kernel.org # 4.0+ Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/phy/phy-generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index deee68e..0cd85f2 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -230,7 +230,8 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, clk_rate = pdata-clk_rate; needs_vcc = pdata-needs_vcc; if (gpio_is_valid(pdata-gpio_reset)) { - err = devm_gpio_request_one(dev, pdata-gpio_reset, 0, + err = devm_gpio_request_one(dev, pdata-gpio_reset, + GPIOF_ACTIVE_LOW, dev_name(dev)); if (!err) nop-gpiod_reset = -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/3] Enable EHCI-platform driver for use with ACPI
On Wed, Aug 12, 2015 at 04:51:27PM -0500, Jeremy Linton wrote: This patch set enables the USB on the ARM Juno development platform when using an ACPI kernel. This patch is in two primary parts. First It tweaks the code in acpi_check_dma() to support the recently added CCA attribute which describes a device which is not cache coherent. It then adds an error message if the device cannot be configured with the current DMA settings, finally it adds the ACPI PNP id to the acpi_match_table entry. Patch 1 I am unsure of (I just don't know enough about DMA), but for the other two it looks fine to me. Reviewed-by: Graeme Gregory graeme.greg...@linaro.org Jeremy Linton (3): Honor ACPI _CCA attribute setting Display a DMA error message Add ACPI bindings for the EHCI platform driver. drivers/usb/host/ehci-platform.c | 13 - include/acpi/acpi_bus.h | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe linux-acpi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] Display a DMA error message
On 2015/8/13 5:51, Jeremy Linton wrote: If the ehci driver fails to configure the dma settings then display a dev error instead of simply failing. This is triggered in an ACPI world if the user fails to set the _CCA on the device. Signed-off-by: Jeremy Linton jeremy.lin...@arm.com --- drivers/usb/host/ehci-platform.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 2593def..82e396f 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -162,8 +162,10 @@ static int ehci_platform_probe(struct platform_device *dev) err = dma_coerce_mask_and_coherent(dev-dev, pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); - if (err) + if (err) { + dev_err(dev-dev, Error: DMA setup failed\n); return err; + } irq = platform_get_irq(dev, 0); if (irq 0) { Reviewed-by: Hanjun Guo hanjun@linaro.org Thanks Hanjun -- 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/3] Add ACPI bindings for the EHCI platform driver.
Hi Jeremy, Just minor comments below. (resend as it's blocked by mailist) On 2015/8/13 5:51, Jeremy Linton wrote: This enables USB on the ARM juno board when booted with an ACPI kernel. The PNP id comes from the PNP/ACPI registry and describes a EHCI controller without debug. Signed-off-by: Jeremy Linton jeremy.lin...@arm.com --- drivers/usb/host/ehci-platform.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 82e396f..1807baa 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -27,6 +27,7 @@ #include linux/io.h #include linux/module.h #include linux/of.h +#include linux/acpi.h this file list the head file in alphabetical order, I think it's better to follow that rule. #include linux/phy/phy.h #include linux/platform_device.h #include linux/reset.h @@ -382,6 +383,13 @@ static const struct of_device_id vt8500_ehci_ids[] = { }; MODULE_DEVICE_TABLE(of, vt8500_ehci_ids); +static const struct acpi_device_id ehci_acpi_match[] = { + { PNP0D20, 0 }, + { } +}; +MODULE_DEVICE_TABLE(acpi, ehci_acpi_match); + + Single empty line will be fine :) static const struct platform_device_id ehci_platform_table[] = { { ehci-platform, 0 }, { } @@ -400,6 +408,7 @@ static struct platform_driver ehci_platform_driver = { .name = ehci-platform, .pm = ehci_platform_pm_ops, .of_match_table = vt8500_ehci_ids, + .acpi_match_table = ACPI_PTR(ehci_acpi_match), } }; With that minor fixes, Reviewed-by: Hanjun Guo hanjun@linaro.org Thanks Hanjun -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1] usb: dwc2: reset AHB hclk domain before init
On Thu, Aug 13, 2015 at 08:37:36AM +, John Youn wrote: On 8/12/2015 12:33 PM, Felipe Balbi wrote: On Wed, Aug 12, 2015 at 07:06:09PM +0800, Yunzhi Li wrote: Hi , 在 2015/8/11 22:12, Felipe Balbi 写道: Hi, On Tue, Aug 11, 2015 at 10:27:42AM +0800, Yunzhi Li wrote: We initiate dwc2 usb controller in BIOS, when kernel driver start-up we should reset AHB hclk domain to reset all AHB interface registers to default. Without this the FIFO value setting might be incorrect because calculating FIFO size need the power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers. This patch could avoid warnning massage like in rk3288 platform: [2.074764] dwc2 ff58.usb: 256 invalid for host_perio_tx_fifo_size. Check HW configuration. Signed-off-by: Yunzhi Li l...@rock-chips.com --- drivers/usb/dwc2/platform.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 9093530..3da21ab 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -42,6 +42,7 @@ #include linux/of_device.h #include linux/mutex.h #include linux/platform_device.h +#include linux/reset.h #include linux/usb/of.h @@ -165,6 +166,7 @@ static int dwc2_driver_probe(struct platform_device *dev) struct resource *res; struct phy *phy; struct usb_phy *uphy; +struct reset_control *rst; int retval; int irq; @@ -189,6 +191,16 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg-dev = dev-dev; +/* AHB hclk domain reset, set all AHB interface registers to default */ +rst = devm_reset_control_get_optional(dev-dev, ahb_reset); why isn't this done in core so PCI systems can also make use of it ? I have no ides about how to reset a PCI interface dwc2 controller, John could you please give some infomation about it ? Is it also needed for PCI interface dwc2 IP ? even on platform only, how do you know all users provide a ahb_reset reset controller ? Also where do you provide the ahb_reset? I don't see it as a property for dwc2. With regards to PCI, I'm also not sure how you'd accomplish something like this. But the platform I use at least doesn't need this. Is the reset controller optional ? That _optional should always return a valid pointer, right ? Even if that valid pointer is NULL :-) -- balbi signature.asc Description: Digital signature
[GIT PULL] USB patches for v4.3 merge window
Hi Greg, here's the big Gadget pull request. It contains 146 non-merge commits this time around. All patches have been soaking in next for quite a while and have also been tested with the platforms I have around. Let me know if you want anything to be changed. cheers The following changes since commit cbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f: Linux 4.2-rc4 (2015-07-26 12:26:21 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v4.3 for you to fetch changes up to 2f3cc24f07b8bfe8302a46ceb1ed58cde62cbd09: usb: musb: gadget: fix build break by adding missing 'break' (2015-08-07 09:25:46 -0500) usb: patches for v4.3 merge window New support for Allwinne SoC on the MUSB driver has been added to the list of glue layers. MUSB also got support for building all DMA engines in one binary; this will be great for distros. DWC3 now has no trace of dev_dbg()/dev_vdbg() usage. We will rely solely on tracing to debug DWC3. There was also a fix for memory corruption with EP0 when maxpacket size transfers are 512 bytes. Robert's EP capabilities flags is making EP selection a lot simpler. UDCs are now required to set these flags up when adding endpoints to the framework. Other than these, we have the usual set of miscelaneous cleanups and minor fixes. Signed-off-by: Felipe Balbi ba...@ti.com Chanwoo Choi (5): usb: dwc3: omap: Replace deprecated API of extcon usb: phy: omap-otg: Replace deprecated API of extcon usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API usb: renesas_usbhs: Replace deprecated API of extcon usb: phy: msm-usb: Replace deprecated API of extcon Dan Carpenter (2): usb: gadget: fotg210-udc: remove duplicate conditions usb: gadget: m66592-udc: forever loop in set_feature() Diego Viola (1): usb: gadget: composite.c: i18n is not an acronym Felipe Balbi (15): usb: dwc2: gadget: use | instead of + for bitmasks usb: dwc3: omap: drop dev_dbg() usage usb: dwc3: keystone: convert dev_dbg() to dev_err() usb: dwc3: exynos: switch dev_dbg() to dev_info() usb: dwc3: qcom: switch dev_dbg() to dev_info() usb: dwc3: st: remove two unnecessary messages usb: dwc3: drop CONFIG_USB_DWC3_DEBUG usb: dwc3: core: remove unnecessary dev_warn() usb: dwc3: gadget: add a trace when disabling EPs usb: dwc3: gadget: defer endpoint name change usb: gadget: f_uac2: fix build warning usb: musb: gadget: remove remaining DMA ifdeferry usb: musb: cppi41: allow it to work again usb: gadget: f_mass_storage: add mising linux/uaccess.h usb: gadget: legacy: nokia: add CONFIG_BLOCK dependency Fupan Li (1): usb: gadget: f_printer: fix deadlock caused by nested spinlock Hans de Goede (3): usb: musb: sunxi: Add support for the Allwinner sunxi musb controller usb: musb: sunxi: Add support for musb controller in A31 SoC usb: musb: sunxi: Add support for musb controller in A33 SoC Ivan T. Ivanov (2): usb: phy: qcom: New APQ8016/MSM8916 USB transceiver driver usb: phy: msm: Add D+/D- lines route control Kishon Vijay Abraham I (6): usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes usb: dwc3: ep0: use _roundup_ to calculate the transfer size usb: dwc3: ep0: preparation for handling non maxpacket aligned transfers 512 usb: dwc3; ep0: Modify _dwc3_ep0_start_trans_ API to take 'chain' parameter usb: dwc3: ep0: Add chained TRB support usb: dwc3: ep0: handle non maxpacket aligned transfers 512 Krzysztof Opasiak (7): usb: gadget: loopback: Remove out-of-date comment usb: gadget: SourceSink: Remove out-of-date comment usb: gadget: mass_storage: Free buffers if create lun fails usb: gadget: mass_storage: Place EXPORT_SYMBOL_GPL() after func definition usb: gadget: storage-common: Set FSG_MAX_LUNS to 16 usb: gadget: mass_storage: Fix freeing luns sysfs implementation usb: gadget: mass_storage: Use static array for luns Li Jun (20): usb: otg: add usb_otg_caps structure for otg capabilities doc: dt-binding: usb: add otg related properties usb: common: add API to update usb otg capabilities by device tree usb: chipidea: set usb otg capabilities usb: chipidea: update ci_otg_is_fsm_mode conditions usb: gadget: add usb otg descriptor allocate and init interface usb: gadget: configfs: allocate and init otg descriptor by otg capabilities usb: gadget: ether: allocate and init otg descriptor by otg capabilities usb: gadget: acm_ms: allocate and init otg descriptor by otg capabilities usb: gadget: audio: allocate and init otg descriptor by otg capabilities usb: gadget:
Re: [PATCH 3/3] Add ACPI bindings for the EHCI platform driver.
Hello Hanjun, On 08/13/2015 06:50 AM, Hanjun Guo wrote: With that minor fixes, Reviewed-by: Hanjun Guo hanjun@linaro.org Fixes applied, thanks. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] Add ACPI bindings for the EHCI platform driver.
Alan, On 08/13/2015 09:53 AM, Alan Stern wrote: With these changes: Applied.. Acked-by: Alan Stern st...@rowland.harvard.edu Thanks, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] Display a DMA error message
On Wed, 12 Aug 2015, Jeremy Linton wrote: If the ehci driver fails to configure the dma settings then display a dev error instead of simply failing. This is triggered in an ACPI world if the user fails to set the _CCA on the device. Signed-off-by: Jeremy Linton jeremy.lin...@arm.com --- drivers/usb/host/ehci-platform.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 2593def..82e396f 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -162,8 +162,10 @@ static int ehci_platform_probe(struct platform_device *dev) err = dma_coerce_mask_and_coherent(dev-dev, pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); - if (err) + if (err) { + dev_err(dev-dev, Error: DMA setup failed\n); return err; + } irq = platform_get_irq(dev, 0); if (irq 0) { Too bad the ohci-platform driver doesn't get the same update, but it clearly wouldn't belong in this patch set. Anyway, Acked-by: Alan Stern st...@rowland.harvard.edu Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] Add ACPI bindings for the EHCI platform driver.
On Wed, 12 Aug 2015, Jeremy Linton wrote: This enables USB on the ARM juno board when booted with an ACPI kernel. The PNP id comes from the PNP/ACPI registry and describes a EHCI controller without debug. Signed-off-by: Jeremy Linton jeremy.lin...@arm.com Looks okay, but... --- drivers/usb/host/ehci-platform.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 82e396f..1807baa 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -27,6 +27,7 @@ #include linux/io.h #include linux/module.h #include linux/of.h +#include linux/acpi.h #include linux/phy/phy.h #include linux/platform_device.h #include linux/reset.h @@ -382,6 +383,13 @@ static const struct of_device_id vt8500_ehci_ids[] = { }; MODULE_DEVICE_TABLE(of, vt8500_ehci_ids); +static const struct acpi_device_id ehci_acpi_match[] = { + { PNP0D20, 0 }, How about a comment on this line? Something like: + { PNP0D20, 0 }, /* EHCI controller without debug */ I realize the of_device_id table doesn't include similar comments, but there the entries are more or less self-documenting. The same cannot be said for PNP0D20. + { } +}; +MODULE_DEVICE_TABLE(acpi, ehci_acpi_match); + + Undesired extra blank line. static const struct platform_device_id ehci_platform_table[] = { { ehci-platform, 0 }, { } @@ -400,6 +408,7 @@ static struct platform_driver ehci_platform_driver = { .name = ehci-platform, .pm = ehci_platform_pm_ops, .of_match_table = vt8500_ehci_ids, + .acpi_match_table = ACPI_PTR(ehci_acpi_match), } }; With these changes: Acked-by: Alan Stern st...@rowland.harvard.edu Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: chipidea: reuse the platform_data to store the ci info
On Thu, 13 Aug 2015, Peter Chen wrote: Alan, do you have any suggestions? Currently, IP core driver and ehci core both takes its internal structure as driver data. Thanks. It's not just ehci-hcd: The USB core stores the hcd address as driver data. usb_create_shared_hcd() does: dev_set_drvdata(dev, hcd); (The core uses this value only in usb_hcd_platform_shutdown(), but other platform-glue drivers also store the hcd address there.) The standard answer is to put the Chipidea private data in the ehci_ci_priv structure. That's what it's meant for. Is that okay for you? Thanks, Alan. It is ok for ehci glue layer as a separate driver. But it is not ok for the drivers like having all hcd/gadget/otg part together, the IP core driver's suspend/resume/remove, sysfs will use driver's private data, unless the ehci platform device as child for IP core device, but it is not for gadget. If there is no better solution, I will use Rong's solution. In the old days, a single device could be a USB host controller and nothing else. Then later, a single device could be either a host controller or a device controller. Now a single device can be both. Obviously this causes problems for our original design, where the device's drvdata stored a pointer to the hcd structure or the udc structure. In principle, the drvdata should point to something that contains pointers to both the hcd and udc structures. Maybe also an otg structure. That would require a lot of changes to existing code but it might be worthwhile. Felipe, what do you think? Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/8][v2]usb:fsl:otg: Make fsl otg driver as tristate
Provide option to load fsl otg driver as loadable module. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com --- drivers/usb/phy/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 869c0cfcad..8a09267 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -19,7 +19,7 @@ config AB8500_USB in host mode, low speed. config FSL_USB2_OTG - bool Freescale USB OTG Transceiver Driver + tristate Freescale USB OTG Transceiver Driver depends on USB_EHCI_FSL USB_FSL_USB2 USB_OTG_FSM PM select USB_OTG select USB_PHY -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/8][v3]usb:fsl:otg: Combine host/gadget start/resume for ID change
Make call to fsl_otg_event for each id change even. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 3b8a9e5..689516d 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -733,6 +733,7 @@ irqreturn_t fsl_otg_isr(int irq, void *dev_id) { struct otg_fsm *fsm = ((struct fsl_otg *)dev_id)-fsm; struct usb_otg *otg = ((struct fsl_otg *)dev_id)-phy.otg; + struct fsl_otg *otg_dev = dev_id; u32 otg_int_src, otg_sc; otg_sc = fsl_readl(usb_dr_regs-otgsc); @@ -762,18 +763,8 @@ irqreturn_t fsl_otg_isr(int irq, void *dev_id) otg-gadget-is_a_peripheral = !fsm-id; VDBG(ID int (ID is %d)\n, fsm-id); - if (fsm-id) { /* switch to gadget */ - schedule_delayed_work( - ((struct fsl_otg *)dev_id)-otg_event, - 100); - } else {/* switch to host */ - cancel_delayed_work( - ((struct fsl_otg *)dev_id)- - otg_event); - fsl_otg_start_gadget(fsm, 0); - otg_drv_vbus(fsm, 1); - fsl_otg_start_host(fsm, 1); - } + schedule_delayed_work(otg_dev-otg_event, 100); + return IRQ_HANDLED; } } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 0/8][v2]Add OTG support for FSL socs
Please ignore v2 ... sent by mistake...please consider v3 patch-set -Original Message- From: Ramneek Mehresh [mailto:ramneek.mehr...@freescale.com] Sent: Thursday, August 13, 2015 11:55 PM To: linux-ker...@vger.kernel.org Cc: ba...@ti.com; st...@rowland.harvard.edu; gre...@linuxfoundation.org; linux-usb@vger.kernel.org; Mehresh Ramneek-B31383 ramneek.mehr...@freescale.com Subject: [PATCH 0/8][v2]Add OTG support for FSL socs Add support for otg for all freescale socs having internal usb phy. Ramneek Mehresh (8): usb:fsl:otg: Make fsl otg driver as tristate usb:fsl:otg: Add controller version based ULPI and UTMI phy usb:fsl:otg: Add support to add/remove usb host driver usb:fsl:otg: Signal host drv when host is otg usb:fsl:otg: Modify otg_event to start host drv usb:fsl:otg: Combine host/gadget start/resume for ID change usb:fsl:otg: Remove host drv upon otg bring-up usb:fsl:otg: Add host-gadget drv sync delay drivers/usb/host/ehci-fsl.c | 85 +-- drivers/usb/host/ehci-fsl.h | 20 ++ drivers/usb/phy/Kconfig | 2 +- drivers/usb/phy/phy-fsl-usb.c | 58 ++--- drivers/usb/phy/phy-fsl-usb.h | 7 include/linux/usb.h | 1 + 6 files changed, 139 insertions(+), 34 deletions(-) -- Changes for v2: - moved struct ehci_fsl out of ehci-fsl.c to ehci-fsl.h - made struct ehci_fsl private of struct ehci_hcd 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/8][v3]usb:fsl:otg: Signal host drv when host is otg
Set is_otg boolean flag to signal host driver when host is running in context of otg host suspend/resume. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 7 ++- include/linux/usb.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 4e58aee..815c22c 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -463,6 +463,7 @@ void otg_reset_controller(void) int fsl_otg_start_host(struct otg_fsm *fsm, int on) { struct usb_otg *otg = fsm-otg; + struct usb_bus *host = otg-host; struct device *dev; struct fsl_otg *otg_dev = container_of(otg-usb_phy, struct fsl_otg, phy); @@ -485,6 +486,7 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) else { otg_reset_controller(); VDBG(host on..\n); + host-is_otg = 1; if (dev-driver-pm dev-driver-pm-resume) { retval = dev-driver-pm-resume(dev); if (fsm-id) { @@ -510,8 +512,11 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) else { VDBG(host off..\n); if (dev dev-driver) { - if (dev-driver-pm dev-driver-pm-suspend) + if (dev-driver-pm + dev-driver-pm-suspend) { + host-is_otg = 1; retval = dev-driver-pm-suspend(dev); + } if (fsm-id) /* default-b */ fsl_otg_drv_vbus(fsm, 0); diff --git a/include/linux/usb.h b/include/linux/usb.h index 447fe29..2208822 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -355,6 +355,7 @@ struct usb_bus { * for control transfers? */ u8 otg_port;/* 0, or number of OTG/HNP port */ + unsigned is_otg:1; /* true when host is also otg */ unsigned is_b_host:1; /* true during some HNP roleswitches */ unsigned b_hnp_enable:1;/* OTG: did A-Host enable HNP? */ unsigned no_stop_on_short:1;/* -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host driver
Add workqueue to add/remove host driver (outside interrupt context) upon each id change. Signed-off-by: Li Yang le...@freescale.com Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com --- Changes for v3: - removed CONFIG_FSL_USB2_OTG and CONFIG_FSL_USB2_OTG_MODULE macros - removed call to usb_hcd_resume_root_hub(hcd) from ehci_fsl_drv_resume() drivers/usb/host/ehci-fsl.c | 71 - drivers/usb/host/ehci-fsl.h | 18 2 files changed, 69 insertions(+), 20 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 202dafb..ef04c5a 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -44,6 +44,31 @@ static struct hc_driver __read_mostly fsl_ehci_hc_driver; +static struct ehci_fsl *hcd_to_ehci_fsl(struct usb_hcd *hcd) +{ + return (struct ehci_fsl *)hcd_to_ehci(hcd)-priv; +} + +static void do_change_hcd(struct work_struct *work) +{ + struct ehci_fsl *ehci_fsl = container_of(work, struct ehci_fsl, + change_hcd_work); + struct usb_hcd *hcd = ehci_fsl-hcd; + void __iomem *non_ehci = hcd-regs; + int retval; + + if (ehci_fsl-hcd_add !ehci_fsl-have_hcd) { + writel(USBMODE_CM_HOST, non_ehci + FSL_SOC_USB_USBMODE); + /* host, gadget and otg share same int line */ + retval = usb_add_hcd(hcd, hcd-irq, IRQF_SHARED); + if (retval == 0) + ehci_fsl-have_hcd = 1; + } else if (!ehci_fsl-hcd_add ehci_fsl-have_hcd) { + usb_remove_hcd(hcd); + ehci_fsl-have_hcd = 0; + } +} + /* configure so an HC device and id are always provided */ /* always called with process context; sleeping is OK */ @@ -147,11 +172,15 @@ static int fsl_ehci_drv_probe(struct platform_device *pdev) goto err2; device_wakeup_enable(hcd-self.controller); -#ifdef CONFIG_USB_OTG if (pdata-operating_mode == FSL_USB2_DR_OTG) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + ehci_fsl-hcd = hcd; hcd-usb_phy = usb_get_phy(USB_PHY_TYPE_USB2); + + INIT_WORK(ehci_fsl-change_hcd_work, do_change_hcd); + dev_dbg(pdev-dev, hcd=0x%p ehci=0x%p, phy=0x%p\n, hcd, ehci, hcd-usb_phy); @@ -168,7 +197,7 @@ static int fsl_ehci_drv_probe(struct platform_device *pdev) goto err2; } } -#endif + return retval; err2: @@ -371,15 +400,6 @@ static int ehci_fsl_setup(struct usb_hcd *hcd) return retval; } -struct ehci_fsl { - struct ehci_hcd ehci; - -#ifdef CONFIG_PM - /* Saved USB PHY settings, need to restore after deep sleep. */ - u32 usb_ctrl; -#endif -}; - #ifdef CONFIG_PM #ifdef CONFIG_PPC_MPC512x @@ -527,24 +547,26 @@ static inline int ehci_fsl_mpc512x_drv_resume(struct device *dev) } #endif /* CONFIG_PPC_MPC512x */ -static struct ehci_fsl *hcd_to_ehci_fsl(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - - return container_of(ehci, struct ehci_fsl, ehci); -} - static int ehci_fsl_drv_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); void __iomem *non_ehci = hcd-regs; + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + struct usb_bus host = hcd-self; if (of_device_is_compatible(dev-parent-of_node, fsl,mpc5121-usb2-dr)) { return ehci_fsl_mpc512x_drv_suspend(dev); } + if (host.is_otg) { + /* remove hcd */ + ehci_fsl-hcd_add = 0; + schedule_work(ehci_fsl-change_hcd_work); + host.is_otg = 0; + return 0; + } + ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd), device_may_wakeup(dev)); if (!fsl_deep_sleep()) @@ -557,15 +579,24 @@ static int ehci_fsl_drv_suspend(struct device *dev) static int ehci_fsl_drv_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); struct ehci_hcd *ehci = hcd_to_ehci(hcd); void __iomem *non_ehci = hcd-regs; + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + struct usb_bus host = hcd-self; if (of_device_is_compatible(dev-parent-of_node, fsl,mpc5121-usb2-dr)) { return ehci_fsl_mpc512x_drv_resume(dev); } + if (host.is_otg) { + /* add hcd */ + ehci_fsl-hcd_add = 1; + schedule_work(ehci_fsl-change_hcd_work); + host.is_otg = 0; +
[PATCH 8/8][v3]usb:fsl:otg: Add host-gadget drv sync delay
Resolve synchronization issue between host and gadget drivers upon role-reversal. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Li Yang-R58472 le...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 689516d..5d678ea 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -544,8 +544,18 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) dev = otg-gadget-dev.parent; if (on) { - if (dev-driver-resume) + /* +* Delay gadget resume to synchronize between host and gadget +* drivers. Upon role-reversal host drv is shutdown by kernel +* worker thread. By the time host drv shuts down, controller +* gets programmed for gadget role. Shutting host drv after +* this results in controller getting reset, and it stops +* responding to otg events +*/ + if (dev-driver-resume) { + msleep(1000); dev-driver-resume(dev); + } } else { if (dev-driver-suspend) dev-driver-suspend(dev, otg_suspend_state); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/8][v3]usb:fsl:otg: Modify otg_event to start host drv
Add mechanism to start host driver from inside fsl_otg_even upon each id change interrupt. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 815c22c..3b8a9e5 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -677,6 +677,10 @@ static void fsl_otg_event(struct work_struct *work) fsl_otg_start_host(fsm, 0); otg_drv_vbus(fsm, 0); fsl_otg_start_gadget(fsm, 1); + } else { + fsl_otg_start_gadget(fsm, 0); + otg_drv_vbus(fsm, 1); + fsl_otg_start_host(fsm, 1); } } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/8][v3]usb:fsl:otg: Make fsl otg driver as tristate
Provide option to load fsl otg driver as loadable module. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com --- drivers/usb/phy/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 869c0cfcad..8a09267 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -19,7 +19,7 @@ config AB8500_USB in host mode, low speed. config FSL_USB2_OTG - bool Freescale USB OTG Transceiver Driver + tristate Freescale USB OTG Transceiver Driver depends on USB_EHCI_FSL USB_FSL_USB2 USB_OTG_FSM PM select USB_OTG select USB_PHY -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/8][v3] Add OTG support for FSL socs
Add support for otg for all freescale socs having internal usb phy. Ramneek Mehresh (8): usb:fsl:otg: Make fsl otg driver as tristate usb:fsl:otg: Add controller version based ULPI and UTMI phy usb:fsl:otg: Add support to add/remove usb host driver usb:fsl:otg: Signal host drv when host is otg usb:fsl:otg: Modify otg_event to start host drv usb:fsl:otg: Combine host/gadget start/resume for ID change usb:fsl:otg: Remove host drv upon otg bring-up usb:fsl:otg: Add host-gadget drv sync delay drivers/usb/host/ehci-fsl.c | 73 +++ drivers/usb/host/ehci-fsl.h | 18 +++ drivers/usb/phy/Kconfig | 2 +- drivers/usb/phy/phy-fsl-usb.c | 58 +- drivers/usb/phy/phy-fsl-usb.h | 7 + include/linux/usb.h | 1 + 6 files changed, 124 insertions(+), 35 deletions(-) -- Changes for v3: - removed CONFIG_FSL_USB2_OTG and CONFIG_FSL_USB2_OTG_MODULE macros - removed call to usb_hcd_resume_root_hub(hcd) from ehci_fsl_drv_resume() 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/8][v2]usb:fsl:otg: Signal host drv when host is otg
Set is_otg boolean flag to signal host driver when host is running in context of otg host suspend/resume. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 7 ++- include/linux/usb.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 4e58aee..815c22c 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -463,6 +463,7 @@ void otg_reset_controller(void) int fsl_otg_start_host(struct otg_fsm *fsm, int on) { struct usb_otg *otg = fsm-otg; + struct usb_bus *host = otg-host; struct device *dev; struct fsl_otg *otg_dev = container_of(otg-usb_phy, struct fsl_otg, phy); @@ -485,6 +486,7 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) else { otg_reset_controller(); VDBG(host on..\n); + host-is_otg = 1; if (dev-driver-pm dev-driver-pm-resume) { retval = dev-driver-pm-resume(dev); if (fsm-id) { @@ -510,8 +512,11 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) else { VDBG(host off..\n); if (dev dev-driver) { - if (dev-driver-pm dev-driver-pm-suspend) + if (dev-driver-pm + dev-driver-pm-suspend) { + host-is_otg = 1; retval = dev-driver-pm-suspend(dev); + } if (fsm-id) /* default-b */ fsl_otg_drv_vbus(fsm, 0); diff --git a/include/linux/usb.h b/include/linux/usb.h index 447fe29..2208822 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -355,6 +355,7 @@ struct usb_bus { * for control transfers? */ u8 otg_port;/* 0, or number of OTG/HNP port */ + unsigned is_otg:1; /* true when host is also otg */ unsigned is_b_host:1; /* true during some HNP roleswitches */ unsigned b_hnp_enable:1;/* OTG: did A-Host enable HNP? */ unsigned no_stop_on_short:1;/* -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/8][v2]usb:fsl:otg: Modify otg_event to start host drv
Add mechanism to start host driver from inside fsl_otg_even upon each id change interrupt. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 815c22c..3b8a9e5 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -677,6 +677,10 @@ static void fsl_otg_event(struct work_struct *work) fsl_otg_start_host(fsm, 0); otg_drv_vbus(fsm, 0); fsl_otg_start_gadget(fsm, 1); + } else { + fsl_otg_start_gadget(fsm, 0); + otg_drv_vbus(fsm, 1); + fsl_otg_start_host(fsm, 1); } } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/8][v2]usb:fsl:otg: Add controller version based ULPI and UTMI phy
Add controller version based ULPI and UTMI phy initialization for otg driver. Signed-off-by: Shengzhou Liu shengzhou@freescale.com Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 20 drivers/usb/phy/phy-fsl-usb.h | 7 +++ 2 files changed, 27 insertions(+) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 94eb292..4e58aee 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -923,12 +923,32 @@ int usb_otg_start(struct platform_device *pdev) temp = ~(PORTSC_PHY_TYPE_SEL | PORTSC_PTW); switch (pdata-phy_mode) { case FSL_USB2_PHY_ULPI: + if (pdata-controller_ver) { + /* controller version 1.6 or above */ + setbits32(p_otg-dr_mem_map-control, + USB_CTRL_ULPI_PHY_CLK_SEL); + /* +* Due to controller issue of PHY_CLK_VALID in ULPI +* mode, set USB_CTRL_USB_EN before checking +* PHY_CLK_VALID, otherwise PHY_CLK_VALID doesn't work +*/ + clrsetbits_be32(p_otg-dr_mem_map-control, + USB_CTRL_UTMI_PHY_EN, USB_CTRL_IOENB); + } temp |= PORTSC_PTS_ULPI; break; case FSL_USB2_PHY_UTMI_WIDE: temp |= PORTSC_PTW_16BIT; /* fall through */ case FSL_USB2_PHY_UTMI: + if (pdata-controller_ver) { + /* controller version 1.6 or above */ + setbits32(p_otg-dr_mem_map-control, + USB_CTRL_UTMI_PHY_EN); + /* Delay for UTMI PHY CLK to become stable - 10ms */ + mdelay(FSL_UTMI_PHY_DLY); + } + setbits32(p_otg-dr_mem_map-control, USB_CTRL_UTMI_PHY_EN); temp |= PORTSC_PTS_UTMI; /* fall through */ default: diff --git a/drivers/usb/phy/phy-fsl-usb.h b/drivers/usb/phy/phy-fsl-usb.h index 2314995..4a78fb3 100644 --- a/drivers/usb/phy/phy-fsl-usb.h +++ b/drivers/usb/phy/phy-fsl-usb.h @@ -199,6 +199,13 @@ /* control Register Bit Masks */ #define USB_CTRL_IOENB(0x12) #define USB_CTRL_ULPI_INT0EN (0x10) +#define USB_CTRL_WU_INT_EN(0x11) +#define USB_CTRL_LINE_STATE_FILTER__EN(0x13) +#define USB_CTRL_KEEP_OTG_ON (0x14) +#define USB_CTRL_OTG_PORT (0x15) +#define USB_CTRL_PLL_RESET(0x18) +#define USB_CTRL_UTMI_PHY_EN (0x19) +#define USB_CTRL_ULPI_PHY_CLK_SEL (0x110) /* BCSR5 */ #define BCSR5_INT_USB (0x02) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host driver
On Thu, 13 Aug 2015, Ramneek Mehresh wrote: Add workqueue to add/remove host driver (outside interrupt context) upon each id change. Signed-off-by: Li Yang le...@freescale.com Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com --- Changes for v3: - removed CONFIG_FSL_USB2_OTG and CONFIG_FSL_USB2_OTG_MODULE macros - removed call to usb_hcd_resume_root_hub(hcd) from ehci_fsl_drv_resume() drivers/usb/host/ehci-fsl.c | 71 - drivers/usb/host/ehci-fsl.h | 18 2 files changed, 69 insertions(+), 20 deletions(-) static int ehci_fsl_drv_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); void __iomem *non_ehci = hcd-regs; + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + struct usb_bus host = hcd-self; I just noticed this line. It does not look right at all; it does a structure copy instead of copying a pointer. if (of_device_is_compatible(dev-parent-of_node, fsl,mpc5121-usb2-dr)) { return ehci_fsl_mpc512x_drv_suspend(dev); } + if (host.is_otg) { + /* remove hcd */ + ehci_fsl-hcd_add = 0; + schedule_work(ehci_fsl-change_hcd_work); + host.is_otg = 0; And here you turn off the flag in the local copy of the structure, which accomplishes nothing. + return 0; + } + ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd), device_may_wakeup(dev)); if (!fsl_deep_sleep()) @@ -557,15 +579,24 @@ static int ehci_fsl_drv_suspend(struct device *dev) static int ehci_fsl_drv_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); struct ehci_hcd *ehci = hcd_to_ehci(hcd); void __iomem *non_ehci = hcd-regs; + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + struct usb_bus host = hcd-self; Same here. --- a/drivers/usb/host/ehci-fsl.h +++ b/drivers/usb/host/ehci-fsl.h @@ -63,4 +63,22 @@ #define UTMI_PHY_EN (19) #define ULPI_PHY_CLK_SEL(110) #define PHY_CLK_VALID(117) + +struct ehci_fsl { +#ifdef CONFIG_PM + /* Saved USB PHY settings, need to restore after deep sleep. */ + u32 usb_ctrl; +#endif Do you need this #ifdef? Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/8][v3]usb:fsl:otg: Remove host drv upon otg bring-up
Change have_hcd variable to remove/suspend host driver on completion of otg initialization for otg auto detect. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Li Yang-R58472 le...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/host/ehci-fsl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index ef04c5a..5dd3243 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -196,6 +196,8 @@ static int fsl_ehci_drv_probe(struct platform_device *pdev) retval = -ENODEV; goto err2; } + + ehci_fsl-have_hcd = 1; } return retval; -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/8][v3]usb:fsl:otg: Remove host drv upon otg bring-up
On Thu, 13 Aug 2015, Ramneek Mehresh wrote: Change have_hcd variable to remove/suspend host driver on completion of otg initialization for otg auto detect. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Li Yang-R58472 le...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/host/ehci-fsl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index ef04c5a..5dd3243 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -196,6 +196,8 @@ static int fsl_ehci_drv_probe(struct platform_device *pdev) retval = -ENODEV; goto err2; } + + ehci_fsl-have_hcd = 1; } return retval; Shouldn't this be merged into patch 3/8? It looks like it just fixes an oversight in the earlier patch. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/8][v2]Add OTG support for FSL socs
Add support for otg for all freescale socs having internal usb phy. Ramneek Mehresh (8): usb:fsl:otg: Make fsl otg driver as tristate usb:fsl:otg: Add controller version based ULPI and UTMI phy usb:fsl:otg: Add support to add/remove usb host driver usb:fsl:otg: Signal host drv when host is otg usb:fsl:otg: Modify otg_event to start host drv usb:fsl:otg: Combine host/gadget start/resume for ID change usb:fsl:otg: Remove host drv upon otg bring-up usb:fsl:otg: Add host-gadget drv sync delay drivers/usb/host/ehci-fsl.c | 85 +-- drivers/usb/host/ehci-fsl.h | 20 ++ drivers/usb/phy/Kconfig | 2 +- drivers/usb/phy/phy-fsl-usb.c | 58 ++--- drivers/usb/phy/phy-fsl-usb.h | 7 include/linux/usb.h | 1 + 6 files changed, 139 insertions(+), 34 deletions(-) -- Changes for v2: - moved struct ehci_fsl out of ehci-fsl.c to ehci-fsl.h - made struct ehci_fsl private of struct ehci_hcd 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: CP2108 write failure
Hi, On Thu, Aug 13, 2015 at 01:37:19PM -0500, Felipe Balbi wrote: Hi, I have reproduced this write failure very reliably with two different hosts (my xHCI Desktop and AM335x with MUSB). It's very simple to reproduce with the ruby script below: #!/usr/bin/env ruby 100.times do |amt| File.open(/dev/ttyUSB0, 'w') do |write| str = a * (amt + 1) puts writing #{str.length} bytes to #{write.path} write.puts str end end Basically, CP2108 stops sending data and starts NAKing any IN tokens from the host. Attached you can find a fresh sniffer capture of the problem reproduced with AM335x running today's linux-next. To read the sniffer capture, you'll need DataCenter SW which can be downloaded from [1] (there are binaries for Windows, Linux and Mac. You'll need gstreamer0.10 to run). There are ways to make it behave. If I add a reading thread reading from ttyUSB1 with a null modem cable routed from ttyUSB0 to ttyUSB1, then it works. It also works by adding a sleep or enough debugging messages. Let me know if you need any extra information to reproduce this problem. Attached you can also find a screenshot with a snipet of the sniffer capture showing the timed out control transfer and a little context around it. [1] http://www.totalphase.com/products/data-center/ resending without attachments, you guys already got it anyway :-p -- balbi signature.asc Description: Digital signature
[PATCH 8/8][v2]usb:fsl:otg: Add host-gadget drv sync delay
Resolve synchronization issue between host and gadget drivers upon role-reversal. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Li Yang-R58472 le...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 689516d..5d678ea 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -544,8 +544,18 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) dev = otg-gadget-dev.parent; if (on) { - if (dev-driver-resume) + /* +* Delay gadget resume to synchronize between host and gadget +* drivers. Upon role-reversal host drv is shutdown by kernel +* worker thread. By the time host drv shuts down, controller +* gets programmed for gadget role. Shutting host drv after +* this results in controller getting reset, and it stops +* responding to otg events +*/ + if (dev-driver-resume) { + msleep(1000); dev-driver-resume(dev); + } } else { if (dev-driver-suspend) dev-driver-suspend(dev, otg_suspend_state); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/8][v2]usb:fsl:otg: Remove host drv upon otg bring-up
Change have_hcd variable to remove/suspend host driver on completion of otg initialization for otg auto detect. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Li Yang-R58472 le...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/host/ehci-fsl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 81e4bf5..daca957 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -189,6 +189,8 @@ static int fsl_ehci_drv_probe(struct platform_device *pdev) retval = -ENODEV; goto err2; } + + ehci_fsl-have_hcd = 1; } #endif return retval; -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/8][v2]usb:fsl:otg: Combine host/gadget start/resume for ID change
Make call to fsl_otg_event for each id change even. Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com Reviewed-by: Fleming Andrew-AFLEMING aflem...@freescale.com Tested-by: Fleming Andrew-AFLEMING aflem...@freescale.com --- drivers/usb/phy/phy-fsl-usb.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 3b8a9e5..689516d 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -733,6 +733,7 @@ irqreturn_t fsl_otg_isr(int irq, void *dev_id) { struct otg_fsm *fsm = ((struct fsl_otg *)dev_id)-fsm; struct usb_otg *otg = ((struct fsl_otg *)dev_id)-phy.otg; + struct fsl_otg *otg_dev = dev_id; u32 otg_int_src, otg_sc; otg_sc = fsl_readl(usb_dr_regs-otgsc); @@ -762,18 +763,8 @@ irqreturn_t fsl_otg_isr(int irq, void *dev_id) otg-gadget-is_a_peripheral = !fsm-id; VDBG(ID int (ID is %d)\n, fsm-id); - if (fsm-id) { /* switch to gadget */ - schedule_delayed_work( - ((struct fsl_otg *)dev_id)-otg_event, - 100); - } else {/* switch to host */ - cancel_delayed_work( - ((struct fsl_otg *)dev_id)- - otg_event); - fsl_otg_start_gadget(fsm, 0); - otg_drv_vbus(fsm, 1); - fsl_otg_start_host(fsm, 1); - } + schedule_delayed_work(otg_dev-otg_event, 100); + return IRQ_HANDLED; } } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/8][v2]usb:fsl:otg: Add support to add/remove usb host driver
Add workqueue to add/remove host driver (outside interrupt context) upon each id change. Signed-off-by: Li Yang le...@freescale.com Signed-off-by: Ramneek Mehresh ramneek.mehr...@freescale.com --- drivers/usb/host/ehci-fsl.c | 83 ++--- drivers/usb/host/ehci-fsl.h | 20 +++ 2 files changed, 84 insertions(+), 19 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 5352e74..81e4bf5 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -44,6 +44,34 @@ static struct hc_driver __read_mostly fsl_ehci_hc_driver; +#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE) +static struct ehci_fsl *hcd_to_ehci_fsl(struct usb_hcd *hcd) +{ + return (struct ehci_fsl *)hcd_to_ehci(hcd)-priv; +} + +static void do_change_hcd(struct work_struct *work) +{ + struct ehci_fsl *ehci_fsl = container_of(work, struct ehci_fsl, + change_hcd_work); + struct usb_hcd *hcd = ehci_fsl-hcd; + void __iomem *non_ehci = hcd-regs; + int retval; + + if (ehci_fsl-hcd_add !ehci_fsl-have_hcd) { + writel(USBMODE_CM_HOST, non_ehci + FSL_SOC_USB_USBMODE); + /* host, gadget and otg share same int line */ + retval = usb_add_hcd(hcd, hcd-irq, IRQF_SHARED); + if (retval == 0) + ehci_fsl-have_hcd = 1; + } else if (!ehci_fsl-hcd_add ehci_fsl-have_hcd) { + usb_remove_hcd(hcd); + ehci_fsl-have_hcd = 0; + } +} +#endif + + /* configure so an HC device and id are always provided */ /* always called with process context; sleeping is OK */ @@ -136,11 +164,16 @@ static int fsl_ehci_drv_probe(struct platform_device *pdev) goto err2; device_wakeup_enable(hcd-self.controller); -#ifdef CONFIG_USB_OTG +#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE) if (pdata-operating_mode == FSL_USB2_DR_OTG) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + ehci_fsl-hcd = hcd; hcd-usb_phy = usb_get_phy(USB_PHY_TYPE_USB2); + + INIT_WORK(ehci_fsl-change_hcd_work, do_change_hcd); + dev_dbg(pdev-dev, hcd=0x%p ehci=0x%p, phy=0x%p\n, hcd, ehci, hcd-usb_phy); @@ -354,15 +387,6 @@ static int ehci_fsl_setup(struct usb_hcd *hcd) return retval; } -struct ehci_fsl { - struct ehci_hcd ehci; - -#ifdef CONFIG_PM - /* Saved USB PHY settings, need to restore after deep sleep. */ - u32 usb_ctrl; -#endif -}; - #ifdef CONFIG_PM #ifdef CONFIG_PPC_MPC512x @@ -510,24 +534,31 @@ static inline int ehci_fsl_mpc512x_drv_resume(struct device *dev) } #endif /* CONFIG_PPC_MPC512x */ -static struct ehci_fsl *hcd_to_ehci_fsl(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - - return container_of(ehci, struct ehci_fsl, ehci); -} - static int ehci_fsl_drv_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); void __iomem *non_ehci = hcd-regs; +#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE) + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + struct usb_bus host = hcd-self; +#endif + if (of_device_is_compatible(dev-parent-of_node, fsl,mpc5121-usb2-dr)) { return ehci_fsl_mpc512x_drv_suspend(dev); } +#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE) + if (host.is_otg) { + /* remove hcd */ + ehci_fsl-hcd_add = 0; + schedule_work(ehci_fsl-change_hcd_work); + host.is_otg = 0; + return 0; + } +#endif + ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd), device_may_wakeup(dev)); if (!fsl_deep_sleep()) @@ -540,15 +571,29 @@ static int ehci_fsl_drv_suspend(struct device *dev) static int ehci_fsl_drv_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); struct ehci_hcd *ehci = hcd_to_ehci(hcd); void __iomem *non_ehci = hcd-regs; +#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE) + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); + struct usb_bus host = hcd-self; +#endif if (of_device_is_compatible(dev-parent-of_node, fsl,mpc5121-usb2-dr)) { return ehci_fsl_mpc512x_drv_resume(dev); } +#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE) + if (host.is_otg) { + /* add hcd */ + ehci_fsl-hcd_add = 1; +
Re: [RFC][PATCH 1/2] usb: gadget: configfs: add MTP function
Hello, On 08/13/2015 09:12 PM, Amit Pundir wrote: his MTP function is based on years of work originally done in the Android kernel tree by: Mike Lockwoodlockw...@android.com Benoit Gobyben...@android.com Colin Crossccr...@android.com Arve Hjønnevåga...@android.com Peter Ohp...@broadcom.com Greg Hackmannghackm...@google.com Badhri Jagan Sridharanbad...@google.com I've folded the series up to make it easier to review, and to provide a coherent patch description. Post Gingerbread (Android v2.3), Android dropped USB Mass Storage in favor of Media Transfer Protocal (MTP), which is widely used for transferring media files to digital music players and similar applications. This USB gadget function implements MTP functionalty. Historically this function has been a part of Android composite gadget driver. Android composite driver was Android's solution for dynamic gadget function switching prior to the ConfigFS gadget being merged. There were failed few attempts in past http://marc.info/?l=linux-usbm=132451695808552 to upstream Android composite driver as well. Now this Android MTP gadget function has been re-implemented so as to be used as a generic ConfigFS function instead. Again, many thanks to Mike, Benoit, Colin, Arve, Peter, Greg and Badhri, as they are the real authors of this work. However, I've folded their patches together and modified it enough that I don't want them to be blamed for any mistakes I've made condensing their patches down. Cc: Mike Lockwoodlockw...@android.com Cc: Benoit Gobyben...@android.com Cc: Colin Crossccr...@android.com Cc: Arve Hjønnevåga...@android.com Cc: Peter Ohp...@broadcom.com Cc: Greg Hackmannghackm...@google.com Cc: Badhri Jagan Sridharanbad...@google.com Cc: Android Kernel Teamkernel-t...@android.com Cc: Greg Kroah-Hartmangre...@linuxfoundation.org Cc: Jonathan Corbetcor...@lwn.net Cc: Felipe Balbiba...@ti.com Cc: Andrzej Pietrasiewiczandrze...@samsung.com Cc: Laurent Pinchartlaurent.pinch...@ideasonboard.com Cc: Yegor Yefremovyegorsli...@googlemail.com Cc: Philippe Reynestrem...@gmail.com Cc: John Stultzjohn.stu...@linaro.org Cc: Sumit Semwalsumit.sem...@linaro.org Signed-off-by: Amit Pundiramit.pun...@linaro.org In my humble opinion adding such function to Linux kernel doesn't make any sense. By design, MTP is a protocol which requires access to userspace features esp. file system. It is very important to run MTP daemon with suitable user and LSM label and many many other issues which should be handled by userspace access policy. Moreover this is not a fully functional USB function but only some interface which can be used by mtp-responder (mtp-daemon - call it as you like) to communicate with host. As we have FunctionFS which allows to implement any USB function in as a userspace service. As MTP nature is more related to userspace I think that porting MTP daemon to use this is a right way to go. This should be much more reasonable than adding new function which also requires daemon for proper working. So why add another interface while we can use a generic one? Best regards, -- Krzysztof Opasiak Samsung RD Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v1 1/3] usb: dwc2: reset AHB hclk domain before init
On 8/11/2015 12:57 AM, Yunzhi Li wrote: We initiate dwc2 usb controller in BIOS, when kernel driver start-up we should reset AHB hclk domain to reset all AHB interface registers to default. Without this the FIFO value setting might be incorrect because calculating FIFO size need the power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers. This patch could avoid warnning massage like in rk3288 platform: [2.074764] dwc2 ff58.usb: 256 invalid for host_perio_tx_fifo_size. Check HW configuration. Signed-off-by: Yunzhi Li l...@rock-chips.com --- drivers/usb/dwc2/platform.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 9093530..ec6bf6b 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -42,6 +42,7 @@ #include linux/of_device.h #include linux/mutex.h #include linux/platform_device.h +#include linux/reset.h #include linux/usb/of.h @@ -165,6 +166,7 @@ static int dwc2_driver_probe(struct platform_device *dev) struct resource *res; struct phy *phy; struct usb_phy *uphy; + struct reset_control *rst; int retval; int irq; @@ -189,6 +191,16 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg-dev = dev-dev; + /* AHB hclk domain reset, set all AHB interface registers to default */ + rst = devm_reset_control_get_optional(dev-dev, ahb); + if (IS_ERR(rst)) { + dev_dbg(dev-dev, Can't get dwc2 AHB reset\n); + } else { + reset_control_assert(rst); + udelay(5); + reset_control_deassert(rst); + } + /* * Use reasonable defaults so platforms don't have to provide these. */ I didn't receive the other two patches in this series so I was confused about where the ahb_reset was coming from when I replied to your other patch. I see you changed the name and documented the DT so never mind. Another thing is that there probably shouldn't be a debug message on the IS_ERR condition since that is the common case and of no interest to other platforms. The other two resets you added aren't used by the driver anywhere right? Maybe those should be left out until they are. John -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH 2/2] usb: gadget: configfs: notify userspace of usb state changes
Hi, On Thu, Aug 13, 2015 at 09:42:17PM +0200, Krzysztof Opasiak wrote: Hello, On 08/13/2015 09:12 PM, Amit Pundir wrote: This is more of an RFC than an actual submission. There are few scattered #ifdefs..#endifs here and there which still need to be taken care of before going for actual submission. Currently there is no way with the upstream ConfigFS gadget to communicate state changes (connected, disconnected, configured), at the gadget level. Instead such state changes are handled function by function independently I presume. This is problematic, because some coordination between the functions, across the state changes, may be desired at the userspace level. Thus to address this issue, this patch send uevents to allow userspace to be notified of these usb state changes, allowing userspace to respond and configure the configfs gadget appropriately. This patch is based on an Android patchset originaly authored by Badhri Jagan Sridharanbad...@google.com to send uevent notifications to Android userpace for USB state changes. I've folded his patches together and modified it enough that I don't want him to be blamed for any mistakes I've made condensing his patches down. This patch introduces USB_CONFIGFS_UEVENT Kconfig to handle userspace notifications of usb state changes, and add setup and disconnect functions to intercept the setup requests from the usb_core. It also creates a sysfs device class entry and a device attribute (state) to read and respond to gadget's current state from userspace. As of now this sysfs device class (/sys/class/android_usb) and gadget device (/sys/class/android_usb/android0) with state attribute (/sys/class/android_usb/android0/state) are strictly tied up to facilitate Android userspace requests. But going forward we may want to bring all function devices (hid, printer etc) under a unified usb gadget device class e.g. /sys/class/usb_gadget/g_{func0,func1} etc.. Also I think it make sense to add this state attribute to the configfs usb gadget itself i.e. have something like /config/usb_gadget/g1/state to read USB gadget's current state. Since it is going to be consistent throughout all the functions tied up to that gadget. Again this is just an initial RFC, thoughts and feedback would be greatly appreciated. Cc: Mike Lockwoodlockw...@android.com Cc: Benoit Gobyben...@android.com Cc: Colin Crossccr...@android.com Cc: Arve Hjønnevåga...@android.com Cc: Peter Ohp...@broadcom.com Cc: Greg Hackmannghackm...@google.com Cc: Badhri Jagan Sridharanbad...@google.com Cc: Android Kernel Teamkernel-t...@android.com Cc: Greg Kroah-Hartmangre...@linuxfoundation.org Cc: Jonathan Corbetcor...@lwn.net Cc: Felipe Balbiba...@ti.com Cc: Andrzej Pietrasiewiczandrze...@samsung.com Cc: Laurent Pinchartlaurent.pinch...@ideasonboard.com Cc: Yegor Yefremovyegorsli...@googlemail.com Cc: Philippe Reynestrem...@gmail.com Cc: John Stultzjohn.stu...@linaro.org Cc: Sumit Semwalsumit.sem...@linaro.org Signed-off-by: Amit Pundiramit.pun...@linaro.org Generally I agree that there should be some way of notifying userspace about yes, and we already have a sysfs file for that. See udc-core.c: static void usb_gadget_state_work(struct work_struct *work) { struct usb_gadget *gadget = work_to_gadget(work); struct usb_udc *udc = gadget-udc; if (udc) sysfs_notify(udc-dev.kobj, NULL, state); } void usb_gadget_set_state(struct usb_gadget *gadget, enum usb_device_state state) { gadget-state = state; schedule_work(gadget-work); } EXPORT_SYMBOL_GPL(usb_gadget_set_state); If it's not working for any UDC, it just means the UDC needs to be patched and if we're missing any state, it means that either the UDC can't provide that IRQ, or we need to add more states to that enumeration (which I find unlikely). -- balbi signature.asc Description: Digital signature
Re: CP2108 write failure
On Thu, Aug 13, 2015 at 01:44:24PM -0500, Felipe Balbi wrote: Hi, On Thu, Aug 13, 2015 at 01:37:19PM -0500, Felipe Balbi wrote: Hi, I have reproduced this write failure very reliably with two different hosts (my xHCI Desktop and AM335x with MUSB). It's very simple to reproduce with the ruby script below: #!/usr/bin/env ruby 100.times do |amt| File.open(/dev/ttyUSB0, 'w') do |write| str = a * (amt + 1) puts writing #{str.length} bytes to #{write.path} write.puts str end end Basically, CP2108 stops sending data and starts NAKing any IN tokens from the host. Attached you can find a fresh sniffer capture of the problem reproduced with AM335x running today's linux-next. To read the sniffer capture, you'll need DataCenter SW which can be downloaded from [1] (there are binaries for Windows, Linux and Mac. You'll need gstreamer0.10 to run). There are ways to make it behave. If I add a reading thread reading from ttyUSB1 with a null modem cable routed from ttyUSB0 to ttyUSB1, then it works. It also works by adding a sleep or enough debugging messages. Let me know if you need any extra information to reproduce this problem. Attached you can also find a screenshot with a snipet of the sniffer capture showing the timed out control transfer and a little context around it. [1] http://www.totalphase.com/products/data-center/ resending without attachments, you guys already got it anyway :-p Do other usb-serial devices succeed with this test (pl2303, ftdi, etc.)? Given that there is no specific write-path code for this driver, it's using the usb-serial core, so odds are, the chip itself is just not liking being sent this much data all at once, so it dies. These really are horrible little chips, it's amazing they even work at all at times... 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: CP2108 write failure
On Thu, Aug 13, 2015 at 11:55:07AM -0700, Greg KH wrote: On Thu, Aug 13, 2015 at 01:44:24PM -0500, Felipe Balbi wrote: Hi, On Thu, Aug 13, 2015 at 01:37:19PM -0500, Felipe Balbi wrote: Hi, I have reproduced this write failure very reliably with two different hosts (my xHCI Desktop and AM335x with MUSB). It's very simple to reproduce with the ruby script below: #!/usr/bin/env ruby 100.times do |amt| File.open(/dev/ttyUSB0, 'w') do |write| str = a * (amt + 1) puts writing #{str.length} bytes to #{write.path} write.puts str end end Basically, CP2108 stops sending data and starts NAKing any IN tokens from the host. Attached you can find a fresh sniffer capture of the problem reproduced with AM335x running today's linux-next. To read the sniffer capture, you'll need DataCenter SW which can be downloaded from [1] (there are binaries for Windows, Linux and Mac. You'll need gstreamer0.10 to run). There are ways to make it behave. If I add a reading thread reading from ttyUSB1 with a null modem cable routed from ttyUSB0 to ttyUSB1, then it works. It also works by adding a sleep or enough debugging messages. Let me know if you need any extra information to reproduce this problem. Attached you can also find a screenshot with a snipet of the sniffer capture showing the timed out control transfer and a little context around it. [1] http://www.totalphase.com/products/data-center/ resending without attachments, you guys already got it anyway :-p Do other usb-serial devices succeed with this test (pl2303, ftdi, etc.)? FTDI seems to work fine (ran all the way to 5000+ bytes before I stopped it), no pl2303 here though :-s Given that there is no specific write-path code for this driver, it's using the usb-serial core, so odds are, the chip itself is just not liking being sent this much data all at once, so it dies. These really are horrible little chips, it's amazing they even work at all at times... that's what I figured, still good to check anyway. It doesn't seem to be reproducible with AM437x (which has a USB2-only XHCI implementation - yeah, don't ask), but maybe it's more related to extra latency due to XHCI running on a single core A9 in comparison to my 8-core desktop. Oh well, just blame the chip, I guess :-p -- balbi signature.asc Description: Digital signature
Re: [RFC][PATCH 1/2] usb: gadget: configfs: add MTP function
On Thu, Aug 13, 2015 at 09:34:46PM +0200, Krzysztof Opasiak wrote: Hello, On 08/13/2015 09:12 PM, Amit Pundir wrote: his MTP function is based on years of work originally done in the Android kernel tree by: Mike Lockwoodlockw...@android.com Benoit Gobyben...@android.com Colin Crossccr...@android.com Arve Hjønnevåga...@android.com Peter Ohp...@broadcom.com Greg Hackmannghackm...@google.com Badhri Jagan Sridharanbad...@google.com I've folded the series up to make it easier to review, and to provide a coherent patch description. Post Gingerbread (Android v2.3), Android dropped USB Mass Storage in favor of Media Transfer Protocal (MTP), which is widely used for transferring media files to digital music players and similar applications. This USB gadget function implements MTP functionalty. Historically this function has been a part of Android composite gadget driver. Android composite driver was Android's solution for dynamic gadget function switching prior to the ConfigFS gadget being merged. There were failed few attempts in past http://marc.info/?l=linux-usbm=132451695808552 to upstream Android composite driver as well. Now this Android MTP gadget function has been re-implemented so as to be used as a generic ConfigFS function instead. Again, many thanks to Mike, Benoit, Colin, Arve, Peter, Greg and Badhri, as they are the real authors of this work. However, I've folded their patches together and modified it enough that I don't want them to be blamed for any mistakes I've made condensing their patches down. Cc: Mike Lockwoodlockw...@android.com Cc: Benoit Gobyben...@android.com Cc: Colin Crossccr...@android.com Cc: Arve Hjønnevåga...@android.com Cc: Peter Ohp...@broadcom.com Cc: Greg Hackmannghackm...@google.com Cc: Badhri Jagan Sridharanbad...@google.com Cc: Android Kernel Teamkernel-t...@android.com Cc: Greg Kroah-Hartmangre...@linuxfoundation.org Cc: Jonathan Corbetcor...@lwn.net Cc: Felipe Balbiba...@ti.com Cc: Andrzej Pietrasiewiczandrze...@samsung.com Cc: Laurent Pinchartlaurent.pinch...@ideasonboard.com Cc: Yegor Yefremovyegorsli...@googlemail.com Cc: Philippe Reynestrem...@gmail.com Cc: John Stultzjohn.stu...@linaro.org Cc: Sumit Semwalsumit.sem...@linaro.org Signed-off-by: Amit Pundiramit.pun...@linaro.org In my humble opinion adding such function to Linux kernel doesn't make any sense. By design, MTP is a protocol which requires access to userspace features esp. file system. It is very important to run MTP daemon with suitable user and LSM label and many many other issues which should be handled by userspace access policy. Moreover this is not a fully functional USB function but only some interface which can be used by mtp-responder (mtp-daemon - call it as you like) to communicate with host. As we have FunctionFS which allows to implement any USB function in as a userspace service. As MTP nature is more related to userspace I think that porting MTP daemon to use this is a right way to go. This should be much more reasonable than adding new function which also requires daemon for proper working. So why add another interface while we can use a generic one? Isn't there already a userspace MTP daemon that uses the existing functionfs for usb gadgets? I thought I remember seeing that somewhere... 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][PATCH 1/2] usb: gadget: configfs: add MTP function
On 08/13/2015 09:57 PM, Greg Kroah-Hartman wrote: On Thu, Aug 13, 2015 at 09:34:46PM +0200, Krzysztof Opasiak wrote: Hello, On 08/13/2015 09:12 PM, Amit Pundir wrote: his MTP function is based on years of work originally done in the Android kernel tree by: Mike Lockwoodlockw...@android.com Benoit Gobyben...@android.com Colin Crossccr...@android.com Arve Hjønnevåga...@android.com Peter Ohp...@broadcom.com Greg Hackmannghackm...@google.com Badhri Jagan Sridharanbad...@google.com I've folded the series up to make it easier to review, and to provide a coherent patch description. Post Gingerbread (Android v2.3), Android dropped USB Mass Storage in favor of Media Transfer Protocal (MTP), which is widely used for transferring media files to digital music players and similar applications. This USB gadget function implements MTP functionalty. Historically this function has been a part of Android composite gadget driver. Android composite driver was Android's solution for dynamic gadget function switching prior to the ConfigFS gadget being merged. There were failed few attempts in past http://marc.info/?l=linux-usbm=132451695808552 to upstream Android composite driver as well. Now this Android MTP gadget function has been re-implemented so as to be used as a generic ConfigFS function instead. Again, many thanks to Mike, Benoit, Colin, Arve, Peter, Greg and Badhri, as they are the real authors of this work. However, I've folded their patches together and modified it enough that I don't want them to be blamed for any mistakes I've made condensing their patches down. Cc: Mike Lockwoodlockw...@android.com Cc: Benoit Gobyben...@android.com Cc: Colin Crossccr...@android.com Cc: Arve Hjønnevåga...@android.com Cc: Peter Ohp...@broadcom.com Cc: Greg Hackmannghackm...@google.com Cc: Badhri Jagan Sridharanbad...@google.com Cc: Android Kernel Teamkernel-t...@android.com Cc: Greg Kroah-Hartmangre...@linuxfoundation.org Cc: Jonathan Corbetcor...@lwn.net Cc: Felipe Balbiba...@ti.com Cc: Andrzej Pietrasiewiczandrze...@samsung.com Cc: Laurent Pinchartlaurent.pinch...@ideasonboard.com Cc: Yegor Yefremovyegorsli...@googlemail.com Cc: Philippe Reynestrem...@gmail.com Cc: John Stultzjohn.stu...@linaro.org Cc: Sumit Semwalsumit.sem...@linaro.org Signed-off-by: Amit Pundiramit.pun...@linaro.org In my humble opinion adding such function to Linux kernel doesn't make any sense. By design, MTP is a protocol which requires access to userspace features esp. file system. It is very important to run MTP daemon with suitable user and LSM label and many many other issues which should be handled by userspace access policy. Moreover this is not a fully functional USB function but only some interface which can be used by mtp-responder (mtp-daemon - call it as you like) to communicate with host. As we have FunctionFS which allows to implement any USB function in as a userspace service. As MTP nature is more related to userspace I think that porting MTP daemon to use this is a right way to go. This should be much more reasonable than adding new function which also requires daemon for proper working. So why add another interface while we can use a generic one? Isn't there already a userspace MTP daemon that uses the existing functionfs for usb gadgets? I thought I remember seeing that somewhere... I've found some interesting link[2] which may mean that Sailfish OS guys has some mtp implementation with functionfs backend: cite - /dev/mtp mtp functionfs rw,relatime cite Started digging and got it! This looks like mtp with ffs backend: https://github.com/nemomobile/buteo-mtp Didn't tested, even didn't try to compile, no guarantee;) Footnotes: 1 - http://reviewjolla.blogspot.com/2014/06/techspecs-android-on-jolla-phone.html Best regards, -- Krzysztof Opasiak Samsung RD Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC][PATCH 0/2] usb: gadget: add MTP function and Uevent userspace notifications
RFC on Android's ConfigFS based MTP function implementation and usage of Uevents to notify the userspace about the USB state changes. The MTP function is based on years of work originally done in the Android kernel tree by: Mike Lockwood lockw...@android.com Benoit Goby ben...@android.com Colin Cross ccr...@android.com Arve Hjønnevåg a...@android.com Peter Oh p...@broadcom.com Greg Hackmann ghackm...@google.com Badhri Jagan Sridharan bad...@google.com The Uevent notification patch is more of an RFC than an actual submission. It is based on Android patchset originaly authored by Badhri to send uevent notifications to Android userpace for USB state changes. I've folded the series up to make it easier to review, provided a coherent patch description and modified it enough that I don't want them to be blamed for any mistakes I've made condensing their patches down. Thoughts and feedback would be appreciated. Thanks, Amit Pundir Cc: Mike Lockwood lockw...@android.com Cc: Benoit Goby ben...@android.com Cc: Colin Cross ccr...@android.com Cc: Arve Hjønnevåg a...@android.com Cc: Peter Oh p...@broadcom.com Cc: Greg Hackmann ghackm...@google.com Cc: Badhri Jagan Sridharan bad...@google.com Cc: Android Kernel Team kernel-t...@android.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Jonathan Corbet cor...@lwn.net Cc: Felipe Balbi ba...@ti.com Cc: Andrzej Pietrasiewicz andrze...@samsung.com Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com Cc: Yegor Yefremov yegorsli...@googlemail.com Cc: Philippe Reynes trem...@gmail.com Cc: John Stultz john.stu...@linaro.org Cc: Sumit Semwal sumit.sem...@linaro.org Amit Pundir (2): usb: gadget: configfs: add MTP function usb: gadget: configfs: notify userspace of usb state changes Documentation/ABI/testing/configfs-usb-gadget-mtp |7 + Documentation/usb/gadget-testing.txt | 24 + drivers/usb/gadget/Kconfig| 21 + drivers/usb/gadget/configfs.c | 201 ++- drivers/usb/gadget/function/Makefile |2 + drivers/usb/gadget/function/f_mtp.c | 1365 + include/linux/usb/f_mtp.h | 23 + include/uapi/linux/usb/f_mtp.h| 61 + 8 files changed, 1702 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-mtp create mode 100644 drivers/usb/gadget/function/f_mtp.c create mode 100644 include/linux/usb/f_mtp.h create mode 100644 include/uapi/linux/usb/f_mtp.h -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] Honor ACPI _CCA attribute setting
Hi Jeremy, On 8/13/15 04:51, Jeremy Linton wrote: ACPI configurations can now mark devices as noncoherent, support that choice. Signed-off-by: Jeremy Linton jeremy.lin...@arm.com --- include/acpi/acpi_bus.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 83061ca..7ecb8e4 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -399,7 +399,7 @@ static inline bool acpi_check_dma(struct acpi_device *adev, bool *coherent) * case 1. Do not support and disable DMA. * case 2. Support but rely on arch-specific cache maintenance for * non-coherence DMA operations. -* Currently, we implement case 1 above. +* Currently, we implement case 2 above. * * For the case when _CCA is missing (i.e. cca_seen=0) and * platform specifies ACPI_CCA_REQUIRED, we do not support DMA, @@ -407,7 +407,8 @@ static inline bool acpi_check_dma(struct acpi_device *adev, bool *coherent) * * See acpi_init_coherency() for more info. */ - if (adev-flags.coherent_dma) { + if (adev-flags.coherent_dma || + (adev-flags.cca_seen IS_ENABLED(CONFIG_ARM64))) { ret = true; if (coherent) *coherent = adev-flags.coherent_dma; This change was in my earlier revisions for the original patch series to add ACPI CCA support. At the time, this was pushed back since we were not sure whether this would be a useful case, and whether such hardware exists. Would it be useful to document somewhere (may be in the GIT commit message) about which hardware might need this? Arnd/Catalin, any feedback on this? Thanks, Suravee -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v3 00/10] USB: chipidea misc patches
In this series, I add several new interfaces for chipidea driver, they are mainly for system configuration adjustment. The USB performance may be improved with these configuration changing, but each vendor driver owner needs to consult with your IC owner which configuration parameters are suitable for your system before changing it, and only change it if necessary. The other changes are for imx, it shows how imx uses these interfaces. Shawn, the patch [5/10] and [9/10] are dts changes, help to review it please. Shawn, there are no comments for week, I will queue chipidea changes for v4.3-rc1, would you help to queue dts changes (5/10 and 9/10), thanks. Peter Changes for v3: - Improve the binding doc according to Rob's comment [Patch 4/10, 8/10] Changes for v2: - Use the bit fields which are not used. [Patch 2/10, 6/10, 10/10] - According to Greg and Sascha comments, format patch 2/10's commit log. - using non-burst instead of unburst for patch 7/10 Peter Chen (10): usb: chipidea: udc: zero-length packet is only needed for TX usb: chipidea: define stream mode disable for both roles usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx Doc: usb: ci-hdrc-usb2: add ahb-burst-config for binding doc ARM: imx6: set ahb-burst-config as 0 for USB usb: chipidea: add ahb burst configuration interface usb: chipidea: usbmisc_imx: add non-burst setting for imx6 Doc: usb: ci-hdrc-usb2: add tx(rx)-burst-config-dword for binding doc ARM: imx6: change default burst size for USB usb: chipidea: add tx/rx burst size configuration interface .../devicetree/bindings/usb/ci-hdrc-usb2.txt | 17 ++ arch/arm/boot/dts/imx6qdl.dtsi | 12 + arch/arm/boot/dts/imx6sl.dtsi | 9 arch/arm/boot/dts/imx6sx.dtsi | 9 drivers/usb/chipidea/bits.h| 7 +++ drivers/usb/chipidea/ci.h | 1 + drivers/usb/chipidea/ci_hdrc_imx.c | 16 +++--- drivers/usb/chipidea/core.c| 62 +- drivers/usb/chipidea/udc.c | 2 +- drivers/usb/chipidea/usbmisc_imx.c | 12 - include/linux/usb/chipidea.h | 11 +++- 11 files changed, 147 insertions(+), 11 deletions(-) -- 1.9.1 N�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
Re: [PATCH v1 1/3] usb: dwc2: reset AHB hclk domain before init
在 2015/8/14 8:09, John Youn 写道: On 8/11/2015 12:57 AM, Yunzhi Li wrote: We initiate dwc2 usb controller in BIOS, when kernel driver start-up we should reset AHB hclk domain to reset all AHB interface registers to default. Without this the FIFO value setting might be incorrect because calculating FIFO size need the power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers. This patch could avoid warnning massage like in rk3288 platform: [2.074764] dwc2 ff58.usb: 256 invalid for host_perio_tx_fifo_size. Check HW configuration. .. I didn't receive the other two patches in this series so I was confused about where the ahb_reset was coming from when I replied to your other patch. I see you changed the name and documented the DT so never mind. Another thing is that there probably shouldn't be a debug message on the IS_ERR condition since that is the common case and of no interest to other platforms. The other two resets you added aren't used by the driver anywhere right? Maybe those should be left out until they are. John Hi John , Here is the other two patches : https://patchwork.kernel.org/patch/6989541/ https://patchwork.kernel.org/patch/6989531/ ahb_reset is hreset_n signal of dwc2 IP. Our rk3288 SoC implement connect this signal to a special register in clock ang reset unit (CRU) module, set this register will reset dwc2 control and status registers(CSR) to default value. You could find more info in DesignWare Cores USB 2.0 Hi Speed On-TheGo (OTG) Databook 3.10a 4.4.1 System Clock and Reset Signals. Our problem is that dwc2_get_hwparams() reads fifo size registers and reguards it as the power-on reset value, then dwc2_set_param_host_perio_tx_fifo_size() will check this value and make sure the new fifo size value is no bigger than the power-on reset value. But we init and set these fifo registers in BIOS, so here hw-xxx_fifo_size is not the real power-on reset vaule. So we hope to reset CSR before dwc2_get_hwparams(). I have another ideal: we might use GRSTCTL.CSftRst instead of hreset_n to reset dwc2 CSR. -- 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
[GIT PULL] USB: chipidea updates for v4.3-rc3
The following changes since commit e6bbe1d05353a29628a4ca72d88bac0bdcec5f38: Merge 4.2-rc6 into usb-next (2015-08-10 10:01:33 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git/ tags/usb-ci-v4.3-rc1 for you to fetch changes up to 96625eadca1bb8832fb502f0899a543695f1ba35: usb: chipidea: add tx/rx burst size configuration interface (2015-08-14 10:03:58 +0800) USB: chipidea updates for v4.3-rc1 The main changes are adding several system interfaces for tuning performance, and each vendors can adjust them according to their design configurations. Others are tiny improvements, like more well siTD supports, USB_DEVICE_A_HNP_SUPPORT supports, etc. Li Jun (1): usb: chipidea: debug: add runtime pm for register access Nicholas Krause (1): usb:chipidea:Make the function hw_alloc_repmap have a return type of void Peter Chen (17): usb: chipidea: add ttctrl.ttha control interface usb: chipidea: imx: enable CI_HDRC_SET_NON_ZERO_TTHA usb: chipidea: udc: add USB_DEVICE_A_HNP_SUPPORT request support usb: chipidea: otg_fsm: delete the duplicated reset controller operation usb: chipidea: introduce ci_platform_configure Doc: usb: ci-hdrc-usb2: add itc-setting at binding doc usb: chipidea: introduce ITC tuning interface usb: chipidea: host: delete the redundancy ci_hdrc struct usb: chipidea: host: override hcd reset API usb: chipidea: udc: zero-length packet is only needed for TX usb: chipidea: define stream mode disable for both roles usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx Doc: usb: ci-hdrc-usb2: add ahb-burst-config for binding doc usb: chipidea: add ahb burst configuration interface usb: chipidea: usbmisc_imx: add non-burst setting for imx6 Doc: usb: ci-hdrc-usb2: add tx(rx)-burst-config-dword for binding doc usb: chipidea: add tx/rx burst size configuration interface Tomeu Vizoso (1): usb: chipidea: imx: properly check for usbmisc .../devicetree/bindings/usb/ci-hdrc-usb2.txt | 20 drivers/usb/chipidea/bits.h| 12 +++ drivers/usb/chipidea/ci.h | 4 + drivers/usb/chipidea/ci_hdrc_imx.c | 17 +-- drivers/usb/chipidea/core.c| 115 ++--- drivers/usb/chipidea/debug.c | 6 ++ drivers/usb/chipidea/host.c| 26 +++-- drivers/usb/chipidea/otg_fsm.c | 1 - drivers/usb/chipidea/udc.c | 9 +- drivers/usb/chipidea/usbmisc_imx.c | 12 ++- include/linux/usb/chipidea.h | 14 ++- 11 files changed, 204 insertions(+), 32 deletions(-) -- Best Regards, Peter Chen -- 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: phy: phy-generic: Fix reset behaviour on legacy boot
On Thu, Aug 13, 2015 at 7:28 AM, Roger Quadros rog...@ti.com wrote: The gpio-desc migration done in v4.0 caused a regression with legacy boots due to reversed reset logic. e.g. omap3-beagle USB host breaks on legacy boot. Request the reset GPIO with GPIOF_ACTIVE_LOW flag so that it matches the driver logic and pin behaviour. Fixes: e9f2cefb0cdc (usb: phy: generic: migrate to gpio_desc) Cc: sta...@vger.kernel.org # 4.0+ Signed-off-by: Roger Quadros rog...@ti.com The USB on my mx51-babbage board still works fine with this change: Tested-by: Fabio Estevam fabio.este...@freescale.com -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC][PATCH 2/2] usb: gadget: configfs: notify userspace of usb state changes
This is more of an RFC than an actual submission. There are few scattered #ifdefs..#endifs here and there which still need to be taken care of before going for actual submission. Currently there is no way with the upstream ConfigFS gadget to communicate state changes (connected, disconnected, configured), at the gadget level. Instead such state changes are handled function by function independently I presume. This is problematic, because some coordination between the functions, across the state changes, may be desired at the userspace level. Thus to address this issue, this patch send uevents to allow userspace to be notified of these usb state changes, allowing userspace to respond and configure the configfs gadget appropriately. This patch is based on an Android patchset originaly authored by Badhri Jagan Sridharan bad...@google.com to send uevent notifications to Android userpace for USB state changes. I've folded his patches together and modified it enough that I don't want him to be blamed for any mistakes I've made condensing his patches down. This patch introduces USB_CONFIGFS_UEVENT Kconfig to handle userspace notifications of usb state changes, and add setup and disconnect functions to intercept the setup requests from the usb_core. It also creates a sysfs device class entry and a device attribute (state) to read and respond to gadget's current state from userspace. As of now this sysfs device class (/sys/class/android_usb) and gadget device (/sys/class/android_usb/android0) with state attribute (/sys/class/android_usb/android0/state) are strictly tied up to facilitate Android userspace requests. But going forward we may want to bring all function devices (hid, printer etc) under a unified usb gadget device class e.g. /sys/class/usb_gadget/g_{func0,func1} etc.. Also I think it make sense to add this state attribute to the configfs usb gadget itself i.e. have something like /config/usb_gadget/g1/state to read USB gadget's current state. Since it is going to be consistent throughout all the functions tied up to that gadget. Again this is just an initial RFC, thoughts and feedback would be greatly appreciated. Cc: Mike Lockwood lockw...@android.com Cc: Benoit Goby ben...@android.com Cc: Colin Cross ccr...@android.com Cc: Arve Hjønnevåg a...@android.com Cc: Peter Oh p...@broadcom.com Cc: Greg Hackmann ghackm...@google.com Cc: Badhri Jagan Sridharan bad...@google.com Cc: Android Kernel Team kernel-t...@android.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Jonathan Corbet cor...@lwn.net Cc: Felipe Balbi ba...@ti.com Cc: Andrzej Pietrasiewicz andrze...@samsung.com Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com Cc: Yegor Yefremov yegorsli...@googlemail.com Cc: Philippe Reynes trem...@gmail.com Cc: John Stultz john.stu...@linaro.org Cc: Sumit Semwal sumit.sem...@linaro.org Signed-off-by: Amit Pundir amit.pun...@linaro.org --- drivers/usb/gadget/Kconfig| 8 ++ drivers/usb/gadget/configfs.c | 201 +- 2 files changed, 207 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 65d110d..e1d1fc1 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -464,6 +464,14 @@ config USB_CONFIGFS_F_MTP the file level. Thus exposing the relevant content but hiding the system/restricted files. +config USB_CONFIGFS_UEVENT + bool Uevent notification of Gadget state + depends on USB_CONFIGFS + help + Enable uevent notifications to userspace when the gadget + state changes. The gadget can be in any of the following + three states: CONNECTED/DISCONNECTED/CONFIGURED + source drivers/usb/gadget/legacy/Kconfig endchoice diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 289e201..1575343 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -9,6 +9,15 @@ #include u_f.h #include u_os_desc.h +#ifdef CONFIG_USB_CONFIGFS_UEVENT +#include linux/platform_device.h +#include linux/kdev_t.h +#include linux/usb/ch9.h + +static struct class *usb_gadget_class; +static struct device *usb_gadget_device; +#endif + int check_user_usb_string(const char *name, struct usb_gadget_strings *stringtab_dev) { @@ -63,6 +72,12 @@ struct gadget_info { bool use_os_desc; char b_vendor_code; char qw_sign[OS_STRING_QW_SIGN_LEN]; +#ifdef CONFIG_USB_CONFIGFS_UEVENT + bool connected; + bool sw_connected; + struct work_struct work; + struct device *dev; +#endif }; struct config_usb_cfg { @@ -1444,13 +1459,143 @@ static void configfs_composite_unbind(struct usb_gadget *gadget) set_gadget_data(gadget, NULL); } +#ifdef CONFIG_USB_CONFIGFS_UEVENT +static ssize_t state_show(struct device *pdev, struct device_attribute *attr, + char *buf) +{ + struct gadget_info *dev = dev_get_drvdata(pdev); +
[RFC][PATCH 1/2] usb: gadget: configfs: add MTP function
This MTP function is based on years of work originally done in the Android kernel tree by: Mike Lockwood lockw...@android.com Benoit Goby ben...@android.com Colin Cross ccr...@android.com Arve Hjønnevåg a...@android.com Peter Oh p...@broadcom.com Greg Hackmann ghackm...@google.com Badhri Jagan Sridharan bad...@google.com I've folded the series up to make it easier to review, and to provide a coherent patch description. Post Gingerbread (Android v2.3), Android dropped USB Mass Storage in favor of Media Transfer Protocal (MTP), which is widely used for transferring media files to digital music players and similar applications. This USB gadget function implements MTP functionalty. Historically this function has been a part of Android composite gadget driver. Android composite driver was Android's solution for dynamic gadget function switching prior to the ConfigFS gadget being merged. There were failed few attempts in past http://marc.info/?l=linux-usbm=132451695808552 to upstream Android composite driver as well. Now this Android MTP gadget function has been re-implemented so as to be used as a generic ConfigFS function instead. Again, many thanks to Mike, Benoit, Colin, Arve, Peter, Greg and Badhri, as they are the real authors of this work. However, I've folded their patches together and modified it enough that I don't want them to be blamed for any mistakes I've made condensing their patches down. Cc: Mike Lockwood lockw...@android.com Cc: Benoit Goby ben...@android.com Cc: Colin Cross ccr...@android.com Cc: Arve Hjønnevåg a...@android.com Cc: Peter Oh p...@broadcom.com Cc: Greg Hackmann ghackm...@google.com Cc: Badhri Jagan Sridharan bad...@google.com Cc: Android Kernel Team kernel-t...@android.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Jonathan Corbet cor...@lwn.net Cc: Felipe Balbi ba...@ti.com Cc: Andrzej Pietrasiewicz andrze...@samsung.com Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com Cc: Yegor Yefremov yegorsli...@googlemail.com Cc: Philippe Reynes trem...@gmail.com Cc: John Stultz john.stu...@linaro.org Cc: Sumit Semwal sumit.sem...@linaro.org Signed-off-by: Amit Pundir amit.pun...@linaro.org --- Documentation/ABI/testing/configfs-usb-gadget-mtp |7 + Documentation/usb/gadget-testing.txt | 24 + drivers/usb/gadget/Kconfig| 13 + drivers/usb/gadget/function/Makefile |2 + drivers/usb/gadget/function/f_mtp.c | 1365 + include/linux/usb/f_mtp.h | 23 + include/uapi/linux/usb/f_mtp.h| 61 + 7 files changed, 1495 insertions(+) create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-mtp create mode 100644 drivers/usb/gadget/function/f_mtp.c create mode 100644 include/linux/usb/f_mtp.h create mode 100644 include/uapi/linux/usb/f_mtp.h diff --git a/Documentation/ABI/testing/configfs-usb-gadget-mtp b/Documentation/ABI/testing/configfs-usb-gadget-mtp new file mode 100644 index 000..6738bee --- /dev/null +++ b/Documentation/ABI/testing/configfs-usb-gadget-mtp @@ -0,0 +1,7 @@ +What: /config/usb-gadget/gadget/functions/mtp.name +Date: Aug 2015 +KernelVersion: 4.2 +Description: The purpose of this directory is to create and remove it. + + A corresponding USB function instance is created/removed. + There are no attributes here. diff --git a/Documentation/usb/gadget-testing.txt b/Documentation/usb/gadget-testing.txt index 5926780..7fb8494d4 100644 --- a/Documentation/usb/gadget-testing.txt +++ b/Documentation/usb/gadget-testing.txt @@ -20,6 +20,7 @@ provided by gadgets. 17. UAC2 function 18. UVC function 19. PRINTER function +20. MTP function 1. ACM function @@ -771,3 +772,26 @@ host: More advanced testing can be done with the prn_example described in Documentation/usb/gadget-printer.txt. + +20. MTP function +=== + +The function is provided by usb_f_mtp.ko module. + +Function-specific configfs interface + + +The function name to use when creating the function directory is mtp. +The function directory is intentionally empty and has no attributes as such. + +After creating the mtp function directory, link mtp function with the gadget +configuration by creating symbolic link, enable the gadget by writing a +suitable string to usb_gadget/gadget/UDC and start the mtp userspace daemon. + +Testing the mtp function + + +On the device: enable the gadget, and start the mtp userspace daemon. +On the host: if configured correctly the media storage device should auto-mount +itself, or use Linux mtp-tools package to browse/transfer the media content +instead. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index bcf83c0..65d110d 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -199,6 +199,9 @@ config USB_F_HID config USB_F_PRINTER
Re: [RFC][PATCH 2/2] usb: gadget: configfs: notify userspace of usb state changes
Hello, On 08/13/2015 09:12 PM, Amit Pundir wrote: This is more of an RFC than an actual submission. There are few scattered #ifdefs..#endifs here and there which still need to be taken care of before going for actual submission. Currently there is no way with the upstream ConfigFS gadget to communicate state changes (connected, disconnected, configured), at the gadget level. Instead such state changes are handled function by function independently I presume. This is problematic, because some coordination between the functions, across the state changes, may be desired at the userspace level. Thus to address this issue, this patch send uevents to allow userspace to be notified of these usb state changes, allowing userspace to respond and configure the configfs gadget appropriately. This patch is based on an Android patchset originaly authored by Badhri Jagan Sridharanbad...@google.com to send uevent notifications to Android userpace for USB state changes. I've folded his patches together and modified it enough that I don't want him to be blamed for any mistakes I've made condensing his patches down. This patch introduces USB_CONFIGFS_UEVENT Kconfig to handle userspace notifications of usb state changes, and add setup and disconnect functions to intercept the setup requests from the usb_core. It also creates a sysfs device class entry and a device attribute (state) to read and respond to gadget's current state from userspace. As of now this sysfs device class (/sys/class/android_usb) and gadget device (/sys/class/android_usb/android0) with state attribute (/sys/class/android_usb/android0/state) are strictly tied up to facilitate Android userspace requests. But going forward we may want to bring all function devices (hid, printer etc) under a unified usb gadget device class e.g. /sys/class/usb_gadget/g_{func0,func1} etc.. Also I think it make sense to add this state attribute to the configfs usb gadget itself i.e. have something like /config/usb_gadget/g1/state to read USB gadget's current state. Since it is going to be consistent throughout all the functions tied up to that gadget. Again this is just an initial RFC, thoughts and feedback would be greatly appreciated. Cc: Mike Lockwoodlockw...@android.com Cc: Benoit Gobyben...@android.com Cc: Colin Crossccr...@android.com Cc: Arve Hjønnevåga...@android.com Cc: Peter Ohp...@broadcom.com Cc: Greg Hackmannghackm...@google.com Cc: Badhri Jagan Sridharanbad...@google.com Cc: Android Kernel Teamkernel-t...@android.com Cc: Greg Kroah-Hartmangre...@linuxfoundation.org Cc: Jonathan Corbetcor...@lwn.net Cc: Felipe Balbiba...@ti.com Cc: Andrzej Pietrasiewiczandrze...@samsung.com Cc: Laurent Pinchartlaurent.pinch...@ideasonboard.com Cc: Yegor Yefremovyegorsli...@googlemail.com Cc: Philippe Reynestrem...@gmail.com Cc: John Stultzjohn.stu...@linaro.org Cc: Sumit Semwalsumit.sem...@linaro.org Signed-off-by: Amit Pundiramit.pun...@linaro.org Generally I agree that there should be some way of notifying userspace about gadget state but I'm not sure if this is proper way to go. In my opinion gadget-bus which has been discussed some time ago on linux-usb makes much more sense than this. Maybe I will be wrong but I guess that you are adding this feature to make android mtp-responder working properly in Linux (not android). Again if we use FFS instead of adding mtp function we don't need this notification as mtp-responder can get all the required informations about gadget (function) via ep0 using functionfs events. Best regards, -- Krzysztof Opasiak Samsung RD Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH 1/2] usb: gadget: configfs: add MTP function
On 08/13/2015 09:57 PM, Greg Kroah-Hartman wrote: On Thu, Aug 13, 2015 at 09:34:46PM +0200, Krzysztof Opasiak wrote: Hello, On 08/13/2015 09:12 PM, Amit Pundir wrote: his MTP function is based on years of work originally done in the Android kernel tree by: Mike Lockwoodlockw...@android.com Benoit Gobyben...@android.com Colin Crossccr...@android.com Arve Hjønnevåga...@android.com Peter Ohp...@broadcom.com Greg Hackmannghackm...@google.com Badhri Jagan Sridharanbad...@google.com I've folded the series up to make it easier to review, and to provide a coherent patch description. Post Gingerbread (Android v2.3), Android dropped USB Mass Storage in favor of Media Transfer Protocal (MTP), which is widely used for transferring media files to digital music players and similar applications. This USB gadget function implements MTP functionalty. Historically this function has been a part of Android composite gadget driver. Android composite driver was Android's solution for dynamic gadget function switching prior to the ConfigFS gadget being merged. There were failed few attempts in past http://marc.info/?l=linux-usbm=132451695808552 to upstream Android composite driver as well. Now this Android MTP gadget function has been re-implemented so as to be used as a generic ConfigFS function instead. Again, many thanks to Mike, Benoit, Colin, Arve, Peter, Greg and Badhri, as they are the real authors of this work. However, I've folded their patches together and modified it enough that I don't want them to be blamed for any mistakes I've made condensing their patches down. Cc: Mike Lockwoodlockw...@android.com Cc: Benoit Gobyben...@android.com Cc: Colin Crossccr...@android.com Cc: Arve Hjønnevåga...@android.com Cc: Peter Ohp...@broadcom.com Cc: Greg Hackmannghackm...@google.com Cc: Badhri Jagan Sridharanbad...@google.com Cc: Android Kernel Teamkernel-t...@android.com Cc: Greg Kroah-Hartmangre...@linuxfoundation.org Cc: Jonathan Corbetcor...@lwn.net Cc: Felipe Balbiba...@ti.com Cc: Andrzej Pietrasiewiczandrze...@samsung.com Cc: Laurent Pinchartlaurent.pinch...@ideasonboard.com Cc: Yegor Yefremovyegorsli...@googlemail.com Cc: Philippe Reynestrem...@gmail.com Cc: John Stultzjohn.stu...@linaro.org Cc: Sumit Semwalsumit.sem...@linaro.org Signed-off-by: Amit Pundiramit.pun...@linaro.org In my humble opinion adding such function to Linux kernel doesn't make any sense. By design, MTP is a protocol which requires access to userspace features esp. file system. It is very important to run MTP daemon with suitable user and LSM label and many many other issues which should be handled by userspace access policy. Moreover this is not a fully functional USB function but only some interface which can be used by mtp-responder (mtp-daemon - call it as you like) to communicate with host. As we have FunctionFS which allows to implement any USB function in as a userspace service. As MTP nature is more related to userspace I think that porting MTP daemon to use this is a right way to go. This should be much more reasonable than adding new function which also requires daemon for proper working. So why add another interface while we can use a generic one? Isn't there already a userspace MTP daemon that uses the existing functionfs for usb gadgets? I thought I remember seeing that somewhere... I know for sure that ADB and SDB has been ported to use functionfs. I can even see ADB with ffs backend working on my nexus 9 with 3.10 kernel. I've seen such mtp-responder implementation but that time it has not been published to open source. I don't know what is the current state... Best regards, -- Krzysztof Opasiak Samsung RD Institute Poland Samsung Electronics -- 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: 4.2 kernel trace when hot unplug a mounted USB/SATA/MMC devices with ext2/ext3/ext4 file system
On Wed, Aug 12, 2015 at 08:17:28PM -0700, Duc Dang wrote: Hi Theodore, Andreas, Jan, Andrew and All, We are seeing kernel trace when we disconnect an USB/SATA/MMC devices that has its ext2/ext3/ext4 partition currently mounted. These traces are seen with kernel 4.2-rc5 on APM Arm64 X-Gene platforms. Similar issue also happens on an x86 machine (Lenovo T420s running Fedora Core 22 (Linux 4.1.x)) Sounds like this issue: https://bugzilla.kernel.org/show_bug.cgi?id=101011 --D We also tested with xfs kernel and kernel complains with some error message but there is no trace: usb 1-1: USB disconnect, device number 3 XFS (sda1): Unmounting Filesystem XFS (sda1): metadata I/O error: block 0x1ddc12 (xlog_iodone) error 19 numblks 64 XFS (sda1): xfs_do_force_shutdown(0x2) called from line 1180 of file /projects/svdc/P4wsIPCSW/buildsw_shadowcat_2_03/shadowcat/linux/fs/xfs/xfs_log.c. Return address = 0xffc0003aa8d8 XFS (sda1): Log I/O Error Detected. Shutting down filesystem XFS (sda1): Unable to update superblock counters. Freespace may not be correct on next mount. XFS (sda1): xfs_log_force: error -5 returned. XFS (sda1): Please umount the filesystem and rectify the problem(s) Below are traces for each case. Do you aware of this issue and is there a fix for it? CASE 1: SATA with ext2 partition: EXT2-fs (sda1): previous I/O error to superblock detected Unable to handle kernel paging request at virtual address 1ff256000 pgd = ffc0e784b000 [1ff256000] *pgd=, *pud= Internal error: Oops: 9605 [#1] PREEMPT SMP Modules linked in: CPU: 4 PID: 1484 Comm: umount Not tainted 4.1.0-xgene_sw_2.03.05-beta_rc_pm #1 Hardware name: APM X-Gene Mustang board (DT) task: ffc1ed5d3840 ti: ffc0e79dc000 task.ti: ffc0e79dc000 PC is at __percpu_counter_add+0x2c/0x10c LR is at account_page_dirtied+0x78/0x12c pc : [ffc00043666c] lr : [ffc000147180] pstate: 81c5 sp : ffc0e79dfc40 x29: ffc0e79dfc40 x28: ffc0e79dc000 x27: ffc000927000 x26: 0027 x25: 011a x24: 0015 x23: 8000 x22: 0140 x21: ffc000d33000 x20: ffc1f6440fb8 x19: ffbec7b3e500 x18: x17: 007f8d95bfd0 x16: ffc0001dfad0 x15: 003b9aca x14: 0ffe x13: 0020 x12: 0101010101010101 x11: 0174 x10: 0006 x9 : ffc1fff1e35c x8 : 746564206b636f6c x7 : ffc000d33618 x6 : 0001ff256000 x5 : ffc0e79dfc40 x4 : ffc0e79dc000 x3 : x2 : 0020 x1 : 0001 x0 : 0001ff256000 Process umount (pid: 1484, stack limit = 0xffc0e79dc020) Stack: (0xffc0e79dfc40 to 0xffc0e79e) fc40: e79dfc70 ffc0 00147180 ffc0 c7b3e500 ffbe f6440f78 ffc1 fc60: e79dfc70 ffc0 0014716c ffc0 e79dfcb0 ffc0 001ccd7c ffc0 fc80: c7b3e500 ffbe f6b28f48 ffc1 f6b28f60 ffc1 e79dfca0 ffc0 fca0: f6b28f48 ffc1 e79dfd00 ffc0 001cdfd4 ffc0 fcc0: c7b3e500 ffbe ecf94400 ffc1 ee6022d8 ffc0 fce0: 8000 00226674 ffc0 e79dfd20 ffc0 fd00: e79dfd20 ffc0 0022ac84 ffc0 f6ff7000 ffc1 ecf94400 ffc1 fd20: e79dfd50 ffc0 0022ad0c ffc0 f677e380 ffc1 ecf94400 ffc1 fd40: f6ff7000 ffc1 ed5d3840 ffc1 e79dfd90 ffc0 001cb0c4 ffc0 fd60: f6ff7000 ffc1 f6ff70a8 ffc1 00946080 ffc0 001b5ff0 ffc0 fd80: f6ff7000 ffc1 e79dfdb0 ffc0 001a05e0 ffc0 fda0: f6ff7000 ffc1 0083 e79dfde0 ffc0 001a0958 ffc0 fdc0: f6b28d00 ffc1 0083 00db9000 ffc0 0015 fde0: e79dfe10 ffc0 001a0c68 ffc0 f6ff7000 ffc1 00d511e8 ffc0 fe00: 00db9000 ffc0 00d511e8 ffc0 e79dfe30 ffc0 001a1168 ffc0 fe20: f6ff7000 ffc1 e79dfe50 ffc0 001bcef0 ffc0 fe40: f6c8b080 ffc1 0015 e79dfe70 ffc0 001bcf94 ffc0 fe60: ed5d4190 ffc1 90a791c8 007f e79dfe80 ffc0 000ce47c ffc0 fe80: e79dfeb0 ffc0 00089800 ffc0 000c 79a5e4f0 0055 fea0: 90a791c8 007f dc5d82a0 007f 00085b54 ffc0 fec0: e79dfec0 ffc0 fee0: 8000 80808080 ff00: 80808080 0080 ff2f6172 fefefefe 0027 0004 ff20: 01010101 01010101 0030 0006 6974616f 6e2c656d ff40: 578b 90a79180 007f 756f8ed0 0055 ff60: 79a5e4f0 0055 79a5e4f0 0055 0002 ff80: 0002 79a5e550 0055 dc5d8410 007f ffa0: 79a5e530 0055 756f5df1 0055 dc5d82a0