Re: [PATCH] usb: hcd: get/put device and hcd for hcd_buffers()
* Sebastian Andrzej Siewior | 2014-12-06 00:23:27 [+0100]: I had one patch doing that. Let me grab it out on Monday. okay, this is it. Laurent, any idea why this could not fly? I haven't seen anything odd so far. diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 7c8322d4fc63..d656c7de25ef 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1703,6 +1703,7 @@ static void uvc_unregister_video(struct uvc_device *dev) stream-vdev = NULL; uvc_debugfs_cleanup_stream(stream); + uvc_video_enable(stream, 0); } /* Decrement the stream count and call uvc_delete explicitly if there @@ -1950,10 +1951,6 @@ static void uvc_disconnect(struct usb_interface *intf) */ usb_set_intfdata(intf, NULL); - if (intf-cur_altsetting-desc.bInterfaceSubClass == - UVC_SC_VIDEOSTREAMING) - return; - dev-state |= UVC_DEV_DISCONNECTED; uvc_unregister_video(dev); -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS566 with usb-id 0bc2:a013
Like the JMicron JMS567 enclosures with the JMS566 choke on report-opcodes, so avoid it. Tested-and-reported-by: Takeo Nakayama javh...@gmx.com Cc: sta...@vger.kernel.org # 3.16 Signed-off-by: Hans de Goede hdego...@redhat.com --- drivers/usb/storage/unusual_uas.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 2918376..2f0a3d3 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -111,6 +111,13 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x, 0x, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), +/* Reported-by: Takeo Nakayama javh...@gmx.com */ +UNUSUAL_DEV(0x357d, 0x7788, 0x, 0x, + JMicron, + JMS566, + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_NO_REPORT_OPCODES), + /* Reported-by: Hans de Goede hdego...@redhat.com */ UNUSUAL_DEV(0x4971, 0x1012, 0x, 0x, Hitachi, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] usb: hcd: get/put device and hcd for hcd_buffers()
From: Greg Kroah-Hartman On Fri, Dec 05, 2014 at 09:03:57PM +0100, Sebastian Andrzej Siewior wrote: Consider the following scenario: - plugin a webcam - play the stream via gst-launch-0.10 v4l2src device=/dev/video0 - remove the USB-HCD during playback via rmmod $HCD and now wait for the crash Which you deserve, why did you ever remove a kernel module? That's racy and _never_ recommended, which is why it never happens automatically and only root can do it. Really drivers and subsystems should have the required locking (etc) to ensure that kernel modules can either be unloaded, or that the unload request itself fails if the device is busy. It shouldn't be considered a 'shoot self in foot' operation. OTOH there are likely to be bugs. David N�r��yb�X��ǧv�^�){.n�+{��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
[PATCH v3 0/5]
Patches to add support for Rockchip usb phys.Add a new Rockchip usb phy driver and modify dwc2 controller driver to make dwc2 platform devices support a generic PHY framework driver. This patch set has been tested on my rk3288-evb and power off the usb phys would reduce about 60mW power budget in total during sustem suspend. Changes in v3: - Use BIT macro instead of bit shift ops. - Rename the config entry to PHY_ROCKCHIP_USB. - Fix coding style: both branches of the if() which only one branch of the conditional statement is a single statement should have braces. - No need to test dwc2-phy for NULL before calling generic phy APIs. - Add more context about the changes in the long description. Yunzhi Li (5): phy: add a driver for the Rockchip SoC internal USB2.0 PHY Documentation: bindings: add doc for the Rockchip usb PHY usb: dwc2: add generic PHY framework support for dwc2 usb controler platform driver. ARM: dts: add rk3288 usb PHY ARM: dts: Enable usb PHY on rk3288-evb board .../devicetree/bindings/phy/rockchip-usb-phy.txt | 22 +++ arch/arm/boot/dts/rk3288-evb.dtsi | 4 + arch/arm/boot/dts/rk3288.dtsi | 13 ++ drivers/phy/Kconfig| 7 + drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-usb.c | 179 + drivers/usb/dwc2/gadget.c | 33 ++-- drivers/usb/dwc2/platform.c| 36 - 8 files changed, 272 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt create mode 100644 drivers/phy/phy-rockchip-usb.c -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/5] usb: dwc2: add generic PHY framework support for dwc2 usb controler platform driver.
Get PHY parameters from devicetree and power off usb PHY during system suspend. Signed-off-by: Yunzhi Li l...@rock-chips.com --- Changes in v3: - Fix coding style: both branches of the if() which only one branch of the conditional statement is a single statement should have braces. - No need to test dwc2-phy for NULL before calling generic phy APIs. drivers/usb/dwc2/gadget.c | 33 - drivers/usb/dwc2/platform.c | 36 ++-- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 200168e..2601c61 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3410,8 +3410,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) { struct device *dev = hsotg-dev; struct s3c_hsotg_plat *plat = dev-platform_data; - struct phy *phy; - struct usb_phy *uphy; struct s3c_hsotg_ep *eps; int epnum; int ret; @@ -3421,30 +3419,23 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) hsotg-phyif = GUSBCFG_PHYIF16; /* -* Attempt to find a generic PHY, then look for an old style -* USB PHY, finally fall back to pdata +* If platform probe couldn't find a generic PHY or an old style +* USB PHY, fall back to pdata */ - phy = devm_phy_get(dev, usb2-phy); - if (IS_ERR(phy)) { - uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(uphy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(dev); - if (!plat) { - dev_err(dev, - no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } - hsotg-plat = plat; - } else - hsotg-uphy = uphy; - } else { - hsotg-phy = phy; + if (IS_ERR_OR_NULL(hsotg-phy) IS_ERR_OR_NULL(hsotg-uphy)) { + plat = dev_get_platdata(dev); + if (!plat) { + dev_err(dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } + hsotg-plat = plat; + } else if (hsotg-phy) { /* * If using the generic PHY framework, check if the PHY bus * width is 8-bit and set the phyif appropriately. */ - if (phy_get_bus_width(phy) == 8) + if (phy_get_bus_width(hsotg-phy) == 8) hsotg-phyif = GUSBCFG_PHYIF8; } diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 6a795aa..ae095f0 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -155,6 +155,8 @@ static int dwc2_driver_probe(struct platform_device *dev) struct dwc2_core_params defparams; struct dwc2_hsotg *hsotg; struct resource *res; + struct phy *phy; + struct usb_phy *uphy; int retval; int irq; @@ -212,6 +214,24 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg-dr_mode = of_usb_get_dr_mode(dev-dev.of_node); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY +*/ + phy = devm_phy_get(dev-dev, usb2-phy); + if (IS_ERR(phy)) { + hsotg-phy = NULL; + uphy = devm_usb_get_phy(dev-dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) + hsotg-uphy = NULL; + else + hsotg-uphy = uphy; + } else { + hsotg-phy = phy; + phy_power_on(hsotg-phy); + phy_init(hsotg-phy); + } + spin_lock_init(hsotg-lock); mutex_init(hsotg-init_mutex); retval = dwc2_gadget_init(hsotg, irq); @@ -231,8 +251,15 @@ static int __maybe_unused dwc2_suspend(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_suspend(dwc2); + } else { + if (dwc2-lx_state == DWC2_L0) + return 0; + phy_exit(dwc2-phy); + phy_power_off(dwc2-phy); + + } return ret; } @@ -241,8 +268,13 @@ static int __maybe_unused dwc2_resume(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_resume(dwc2); + } else { + phy_power_on(dwc2-phy); + phy_init(dwc2-phy); + + } return ret; } -- 2.0.0
Re: [PATCH] mfd: dln2: add suspend/resume functionality
On Fri, Dec 05, 2014 at 03:05:45PM +0200, Octavian Purdila wrote: On Fri, Dec 5, 2014 at 2:06 PM, Johan Hovold jo...@kernel.org wrote: On Fri, Dec 05, 2014 at 01:51:17PM +0200, Octavian Purdila wrote: On Fri, Dec 5, 2014 at 12:17 PM, Johan Hovold jo...@kernel.org wrote: And surely you need to resubmit the read urbs in resume, or you will never receive any more data. How did you test this patch? The resume cb is not called in my setup (kvm), only reset_resume. Please make sure to test your patches on proper hardware. It was tested with the proper hardware, I was just testing it in the setup we use, which is kvm with USB pass through. I was referring to your kvm setup. Johan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC] usb: dwc3: add DWC3_SKIP_USB3PHY and DWC3_SKIP_USB2_PHY quirks
Hi list, On platforms which has native usb hosts/phys and pci-dwc3 controller, the dwc3 core may get the wrong usb2_phy and usb3_phy by devm_usb_get_phy(). It depends on which usb phy driver is initialized firstly, the usb_phy_generic or the native/real usb phy driver. Before all old USB phy library usage removed, the solution I can have is to add DWC3_SKIP_USB3PHY and DWC3_SKIP_USB2_PHY quirks and set them in dwc3-pci. Could such modification can be accepted? If not, could you please give alternative suggestions? Thanks, Jisheng -- 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 v4 1/3] mfd: add support for Cypress CYUSBS234 USB Serial Bridge controller
On Sat, Nov 29, 2014 at 11:49:04AM +0530, Muthu Mani wrote: Adds support for USB-I2C/GPIO interfaces of Cypress Semiconductor CYUSBS234 USB-Serial Bridge controller. Details about the device can be found at: http://www.cypress.com/?rID=84126 Signed-off-by: Muthu Mani m...@cypress.com Signed-off-by: Rajaram Regupathy r...@cypress.com --- This patch as well as the other two patches in the series is white-space damaged. Please always make sure to run your patches through checkpatch.pl before submission (and/or fix your mailer). Also use git-send-email when submitting your series so that the individual patches get threaded properly. And always increase (or add a resend prefix) when resending. I got two v4 series in my inbox. No idea what's the difference, if any. Thanks, Johan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v4 1/3] mfd: add support for Cypress CYUSBS234 USB Serial Bridge controller
On Sat, Nov 29, 2014 at 11:49:04AM +0530, Muthu Mani wrote: Adds support for USB-I2C/GPIO interfaces of Cypress Semiconductor CYUSBS234 USB-Serial Bridge controller. Details about the device can be found at: http://www.cypress.com/?rID=84126 Signed-off-by: Muthu Mani m...@cypress.com Signed-off-by: Rajaram Regupathy r...@cypress.com --- This patch as well as the other two patches in the series is white-space damaged. Please always make sure to run your patches through checkpatch.pl before submission (and/or fix your mailer). Also use git-send-email when submitting your series so that the individual patches get threaded properly. Sorry about the inconvenience. I ran checkpatch.pl for all the patches before I submitted them using git-send-email. checkpatch doesn't show any error. I used the following command to submit patch. Please let me know if anything wrong. $ git format-patch -s -n -v4 master..Driver_v4 $ git send-email --smtp-encryption=tls --smtp-server=mail-server --smtp-user=m...@cypress.com --smtp-server-port=port# --to=Samuel Ortiz sa...@linux.intel.com --to=Lee Jones lee.jo...@linaro.org --to=Wolfram Sang w...@the-dreams.de --to=Linus Walleij linus.wall...@linaro.org --to=Alexandre Courbot gnu...@gmail.com --to=gre...@linuxfoundation.org --to=Johan Hovold jo...@kernel.org --cc=linux-usb@vger.kernel.org --cc=linux-ker...@vger.kernel.org --cc=linux-...@vger.kernel.org --cc=linux-g...@vger.kernel.org v4-0001-mfd-add-support-for-Cypress-CYUSBS234-USB-Serial-.patch And always increase (or add a resend prefix) when resending. I got two v4 series in my inbox. No idea what's the difference, if any. In the second v4 patch, I added Greg KH and usb group. There is no code changes. I will take care when I resend again. Thanks, Muthu Thanks, Johan This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. -- 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] mfd: dln2: add suspend/resume functionality
On Mon, Dec 8, 2014 at 12:57 PM, Johan Hovold jo...@kernel.org wrote: On Fri, Dec 05, 2014 at 03:05:45PM +0200, Octavian Purdila wrote: On Fri, Dec 5, 2014 at 2:06 PM, Johan Hovold jo...@kernel.org wrote: On Fri, Dec 05, 2014 at 01:51:17PM +0200, Octavian Purdila wrote: On Fri, Dec 5, 2014 at 12:17 PM, Johan Hovold jo...@kernel.org wrote: And surely you need to resubmit the read urbs in resume, or you will never receive any more data. How did you test this patch? The resume cb is not called in my setup (kvm), only reset_resume. Please make sure to test your patches on proper hardware. It was tested with the proper hardware, I was just testing it in the setup we use, which is kvm with USB pass through. I was referring to your kvm setup. I see the same behavior (reset_resume called) when testing on bare bone hardware. BTW, KVM allows me to test more thoroughly, as I can use custom SSDT tables required by i2c devices to find their IRQs. -- 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 v4 1/3] mfd: add support for Cypress CYUSBS234 USB Serial Bridge controller
On Mon, Dec 08, 2014 at 04:00:13PM +, Muthu Mani wrote: On Sat, Nov 29, 2014 at 11:49:04AM +0530, Muthu Mani wrote: Adds support for USB-I2C/GPIO interfaces of Cypress Semiconductor CYUSBS234 USB-Serial Bridge controller. Details about the device can be found at: http://www.cypress.com/?rID=84126 Signed-off-by: Muthu Mani m...@cypress.com Signed-off-by: Rajaram Regupathy r...@cypress.com --- This patch as well as the other two patches in the series is white-space damaged. Please always make sure to run your patches through checkpatch.pl before submission (and/or fix your mailer). Also use git-send-email when submitting your series so that the individual patches get threaded properly. Sorry about the inconvenience. I ran checkpatch.pl for all the patches before I submitted them using git-send-email. checkpatch doesn't show any error. Then the problem could be your mail server. All (leading) tabs have been converted to spaces. I used the following command to submit patch. Please let me know if anything wrong. $ git format-patch -s -n -v4 master..Driver_v4 $ git send-email --smtp-encryption=tls --smtp-server=mail-server --smtp-user=m...@cypress.com --smtp-server-port=port# --to=Samuel Ortiz sa...@linux.intel.com --to=Lee Jones lee.jo...@linaro.org --to=Wolfram Sang w...@the-dreams.de --to=Linus Walleij linus.wall...@linaro.org --to=Alexandre Courbot gnu...@gmail.com --to=gre...@linuxfoundation.org --to=Johan Hovold jo...@kernel.org --cc=linux-usb@vger.kernel.org --cc=linux-ker...@vger.kernel.org --cc=linux-...@vger.kernel.org --cc=linux-g...@vger.kernel.org v4-0001-mfd-add-support-for-Cypress-CYUSBS234-USB-Serial-.patch Have a look at git-send-email's --thread switch. Depending on your settings you may only need to specify all three patches to git-send-email at once to have them threaded properly. And always increase (or add a resend prefix) when resending. I got two v4 series in my inbox. No idea what's the difference, if any. In the second v4 patch, I added Greg KH and usb group. There is no code changes. I will take care when I resend again. Thanks, Muthu Thanks, Johan This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. Make sure not to include such disclaimers when posting to public mailing lists. Thanks, Johan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
VFS and LSM issues
Dear All, I'm Krzysztof Opasiak from SRPOL (Samsung). I'm working on USB support in Tizen and mainline. In those works we use two Virtual File Systems - ConfigFS and FunctionFS. Recently I have tried to use them with SMACK and I ran into a few issues. Most of them looks to be a generic problem with many FS and LSM. You can find description of those issues and my research just below in 3 points. I'm not a VFS/LSM specialist so your help is very welcome;) 1) Issues with function FS It's a VFS which allow to provide custom USB function as userspace program. I know that may be quite new for you so let's define this as a VFS which works as follow: $ modprobe g_ffs $ mkdir /tmp/mount_root $ mount none -t functionfs /tmp/mount_root $ ls /tmp/mount_root ep0 # now we run our program which writes some data to ep0 # and based on this kernel creates epX # you can find one in tools/usb/ffs-test.c $ ./my_program /tmp/mount_root $ ls /tmp/mount_root ep0 ep1 ep2 Ok so now we would like to use this together with smack. Especially with smackfsdef mount option. First two steps go as above and then: $ mount none -t functionfs -o smackfsdef=my_label /tmp/mount_root $ ls -Z /tmp/mount_root/ _ ep0 Ops! Some bug here we requested to use my_label but we got _. When we run our program, rest of epX will get desired label (my_label). I have started to dig in kernel to find what happen and probably I found out where is a problem. Let's look to mount_fs() code which is executed during mount: struct dentry * mount_fs(struct file_system_type *type, int flags, const char *name, void *data) { (...) root = type-mount(type, flags, name, data); (...) error = security_sb_kern_mount(sb, flags, secdata); (...) } So what is important here is the order of operations. First is executed mount ops provided by selected file system. During this mount procedure functionfs executes new_inode(sb) to allocate inode for ep0 which should appear directly after mount. After returning from mount function we execute security_sb_kern_mount() where we *parse the mount options* and sets the value for lsm specific structures for example we store the label passed in smackfsdef. The problem here is order of calls because first we call mount for given fs where we create a file and after this we fill security structures with security mount options. While creating file in mount callback super block is filled only with default values for security so ep0 has _ label. This looks like a generic issue for all VFS which creates indoes before or in their mount procedure. I'm not sure if we can simply move security_sb_kern_mount() above mount for specific fs, do we? 2) Issues with ConfigFS ConfigFS is a generic VFS which allows to create and manage kobjects from userspace. Each module which would like to allow for userland driven configuration register as ConfigFS client called subsystem. Each subsystem has its own directory in ConfigFS root dir. We use libcomposite which appear in ConfigFS as usb_gadget directory. In this dir you can create directories called gadgets. Some example: # libcomposite and configfs compiled-in $ mount none -t configfs /sys/kernel/config $ ls /sys/kernel/config usb_gadget $ mkdir /sys/kernel/config/usb_gadget/g1 $ ls /sys/kernel/config/usb_gadget/g1 UDC bDeviceSubClass bcdUSB idProduct strings bDeviceClass bMaxPacketSize0 configsidVendor bDeviceProtocol bcdDevicefunctions os_desc Now let's try to use smack with ConfigFS. First of all we run to similar issue as with FunctionFS so after mounting configfs with smackfsdef option we still get _ label on subsystem directories because they are created in configfs_register_subsystem() which is called in libcomposite module init so really erly. So in my opinion this looks quite similar to issue described in functionfs section. Second issue related to Configfs is when we create the directory. Reproduction: $ mount none -t configfs -o smackfsdef=my_label /sys/kernel/config $ ls -Z /sys/kernel/config _ usb_gadget $ chmod 777 /sys/kernel/config/usb_gadget $ chsmack -a my_label /sys/kernel/config/usb_gadget $ echo my_label /proc/self/attr/current $ su my_user $ mkdir /sys/kernel/config/usb_gadget/g1 $ ls -Z /sys/kernel/config/usb_gadget/ _ g1 As you see our process had my_label label but created by him gadget has the _ label and the same with all files and subdirs created in g1. I have no idea why this happened but definetly something is wrong. Related to this is a policy of labeling subdirectories. Obvious thing is that g1 directory should have label different that _. But I'm not shure what label should have its children. 3) Generic question with multi mounts filesystems Some VFS (ConfigFS for example) can be mounted more than once. What should be the correct behavior of smackfsdef mount option if we pass different labels in each mount point? Looks like all for now. I hope you were able to go through this email without falling
[PATCH] usb: chipidea: replace udelay in loops with usleep_range
Both delays are at the lower end of where the use of usleep_range is recommended. However as both udelay's occur in loops I think it makes sense to replace them with sleeping equivalents to avoid longer busy-waits. Signed-off-by: Heiner Kallweit hkallwe...@gmail.com --- drivers/usb/chipidea/core.c | 2 +- drivers/usb/chipidea/udc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5b9825a..b9c645b 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -396,7 +396,7 @@ static int hw_controller_reset(struct ci_hdrc *ci) hw_write(ci, OP_USBCMD, USBCMD_RST, USBCMD_RST); while (hw_read(ci, OP_USBCMD, USBCMD_RST)) { - udelay(10); + usleep_range(10, 20); if (count++ 1000) return -ETIMEDOUT; } diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 4fe18ce..70ef2f2 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -326,7 +326,7 @@ static int hw_usb_reset(struct ci_hdrc *ci) /* wait until all bits cleared */ while (hw_read(ci, OP_ENDPTPRIME, ~0)) - udelay(10); /* not RTOS friendly */ + usleep_range(10, 20); /* reset all endpoints ? */ -- 2.1.3 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 3/5] usb: dwc2: Add generic PHY framework support for dwc2 usb controler platform driver.
From: Yunzhi Li [mailto:l...@rock-chips.com] Sent: Sunday, December 07, 2014 7:58 PM On 2014/12/6 3:04, Paul Zimmerman wrote: From: Yunzhi Li [mailto:l...@rock-chips.com] Sent: Friday, December 05, 2014 4:52 AM Get PHY parameters from devicetree and power off usb PHY during system suspend. Signed-off-by: Yunzhi Li l...@rock-chips.com --- drivers/usb/dwc2/gadget.c | 33 - drivers/usb/dwc2/platform.c | 34 ++ 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 200168e..2601c61 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c [...] /* - * Attempt to find a generic PHY, then look for an old style - * USB PHY, finally fall back to pdata + * If platform probe couldn't find a generic PHY or an old style + * USB PHY, fall back to pdata */ - phy = devm_phy_get(dev, usb2-phy); - if (IS_ERR(phy)) { - uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(uphy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(dev); - if (!plat) { - dev_err(dev, - no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } - hsotg-plat = plat; - } else - hsotg-uphy = uphy; - } else { - hsotg-phy = phy; + if (IS_ERR_OR_NULL(hsotg-phy) IS_ERR_OR_NULL(hsotg-uphy)) { + plat = dev_get_platdata(dev); + if (!plat) { + dev_err(dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } + hsotg-plat = plat; + } else if (hsotg-phy) { You have changed the behavior here. Previously, the driver would work even if there were no phys or pdata defined. Now it will return -EPROBE_DEFER instead. Are you sure that won't break any existing platforms? I don't really catch your meaning. Could you please point out where is the difference? Thanks . Yeah, sorry, I misread the patch. I think your new version is fine. -- Paul -- 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 3/5] usb: dwc2: add generic PHY framework support for dwc2 usb controler platform driver.
From: Yunzhi Li [mailto:l...@rock-chips.com] Sent: Monday, December 08, 2014 1:46 AM Get PHY parameters from devicetree and power off usb PHY during system suspend. Signed-off-by: Yunzhi Li l...@rock-chips.com --- Changes in v3: - Fix coding style: both branches of the if() which only one branch of the conditional statement is a single statement should have braces. - No need to test dwc2-phy for NULL before calling generic phy APIs. drivers/usb/dwc2/gadget.c | 33 - drivers/usb/dwc2/platform.c | 36 ++-- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 200168e..2601c61 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3410,8 +3410,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) { struct device *dev = hsotg-dev; struct s3c_hsotg_plat *plat = dev-platform_data; - struct phy *phy; - struct usb_phy *uphy; struct s3c_hsotg_ep *eps; int epnum; int ret; @@ -3421,30 +3419,23 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) hsotg-phyif = GUSBCFG_PHYIF16; /* - * Attempt to find a generic PHY, then look for an old style - * USB PHY, finally fall back to pdata + * If platform probe couldn't find a generic PHY or an old style + * USB PHY, fall back to pdata */ - phy = devm_phy_get(dev, usb2-phy); - if (IS_ERR(phy)) { - uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(uphy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(dev); - if (!plat) { - dev_err(dev, - no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } - hsotg-plat = plat; - } else - hsotg-uphy = uphy; - } else { - hsotg-phy = phy; + if (IS_ERR_OR_NULL(hsotg-phy) IS_ERR_OR_NULL(hsotg-uphy)) { + plat = dev_get_platdata(dev); + if (!plat) { + dev_err(dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } + hsotg-plat = plat; + } else if (hsotg-phy) { /* * If using the generic PHY framework, check if the PHY bus * width is 8-bit and set the phyif appropriately. */ - if (phy_get_bus_width(phy) == 8) + if (phy_get_bus_width(hsotg-phy) == 8) hsotg-phyif = GUSBCFG_PHYIF8; } diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 6a795aa..ae095f0 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -155,6 +155,8 @@ static int dwc2_driver_probe(struct platform_device *dev) struct dwc2_core_params defparams; struct dwc2_hsotg *hsotg; struct resource *res; + struct phy *phy; + struct usb_phy *uphy; int retval; int irq; @@ -212,6 +214,24 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg-dr_mode = of_usb_get_dr_mode(dev-dev.of_node); + /* + * Attempt to find a generic PHY, then look for an old style + * USB PHY + */ + phy = devm_phy_get(dev-dev, usb2-phy); + if (IS_ERR(phy)) { + hsotg-phy = NULL; + uphy = devm_usb_get_phy(dev-dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) + hsotg-uphy = NULL; + else + hsotg-uphy = uphy; + } else { + hsotg-phy = phy; + phy_power_on(hsotg-phy); + phy_init(hsotg-phy); + } + spin_lock_init(hsotg-lock); mutex_init(hsotg-init_mutex); retval = dwc2_gadget_init(hsotg, irq); @@ -231,8 +251,15 @@ static int __maybe_unused dwc2_suspend(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_suspend(dwc2); + } else { + if (dwc2-lx_state == DWC2_L0) + return 0; + phy_exit(dwc2-phy); + phy_power_off(dwc2-phy); + + } return ret; } @@ -241,8 +268,13 @@ static int __maybe_unused dwc2_resume(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_resume(dwc2); + } else { + phy_power_on(dwc2-phy); + phy_init(dwc2-phy); + + }
[PATCH] USB: serial: add nt124 usb to serial driver
This driver is for the NovaTech 124 4x serial expansion board for the NovaTech OrionLXm. Firmware source code can be found here: https://github.com/novatechweb/nt124 Signed-off-by: George McCollister george.mccollis...@gmail.com --- drivers/usb/serial/Kconfig | 9 + drivers/usb/serial/Makefile | 1 + drivers/usb/serial/nt124.c | 429 3 files changed, 439 insertions(+) create mode 100644 drivers/usb/serial/nt124.c diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index a69f7cd..6dfc340 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -509,6 +509,15 @@ config USB_SERIAL_NAVMAN To compile this driver as a module, choose M here: the module will be called navman. +config USB_SERIAL_NT124 + tristate USB nt124 serial device + help + Say Y here if you want to use the NovaTech 124 4x USB to serial + board. + + To compile this driver as a module, choose M here: the + module will be called nt124. + config USB_SERIAL_PL2303 tristate USB Prolific 2303 Single Port Serial Driver help diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 349d9df..f88eaab 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_USB_SERIAL_MOS7720) += mos7720.o obj-$(CONFIG_USB_SERIAL_MOS7840) += mos7840.o obj-$(CONFIG_USB_SERIAL_MXUPORT) += mxuport.o obj-$(CONFIG_USB_SERIAL_NAVMAN)+= navman.o +obj-$(CONFIG_USB_SERIAL_NT124) += nt124.o obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o obj-$(CONFIG_USB_SERIAL_OPTICON) += opticon.o obj-$(CONFIG_USB_SERIAL_OPTION)+= option.o diff --git a/drivers/usb/serial/nt124.c b/drivers/usb/serial/nt124.c new file mode 100644 index 000..d7557ff --- /dev/null +++ b/drivers/usb/serial/nt124.c @@ -0,0 +1,429 @@ +/* + * nt124.c + * + * Copyright (c) 2014 NovaTech LLC + * + * Driver for nt124 4x serial board based on STM32F103 + * + * Portions derived from the cdc-acm driver + * + * The original intention was to implement a cdc-acm compliant + * 4x USB to serial converter in the STM32F103 however several problems arose. + * The STM32F103 didn't have enough end points to implement 4 ports. + * CTS control was required by the application. + * Accurate notification of transmission completion was required. + * RTSCTS flow control support was required. + * + * The interrupt endpoint was eliminated and the control line information + * was moved to the first two bytes of the in endpoint message. CTS control + * and mechanisms to enable RTSCTS flow control and deliver TXEMPTY + * information were added. + * + * Firmware source code can be found here: + * https://github.com/novatechweb/nt124 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/kernel.h +#include linux/slab.h +#include linux/tty.h +#include linux/tty_driver.h +#include linux/tty_flip.h +#include linux/module.h +#include linux/usb.h +#include linux/usb/serial.h +#include asm/unaligned.h + +#define NT124_VID 0x2aeb +#define NT124_USB_PID 124 + +#define DRIVER_AUTHOR George McCollister george.mccollis...@gmail.com +#define DRIVER_DESC nt124 USB serial driver + +static const struct usb_device_id id_table[] = { + { USB_DEVICE(NT124_VID, NT124_USB_PID) }, + { }, +}; + +MODULE_DEVICE_TABLE(usb, id_table); + +/* + * Output control lines. + */ + +#define NT124_CTRL_DTR 0x01 +#define NT124_CTRL_RTS 0x02 + +/* + * Input control lines and line errors. + */ + +#define NT124_CTRL_DCD 0x01 +#define NT124_CTRL_DSR 0x02 +#define NT124_CTRL_BRK 0x04 +#define NT124_CTRL_RI 0x08 +#define NT124_CTRL_FRAMING 0x10 +#define NT124_CTRL_PARITY 0x20 +#define NT124_CTRL_OVERRUN 0x40 +#define NT124_CTRL_TXEMPTY 0x80 +#define NT124_CTRL_CTS 0x100 + +#define USB_NT124_REQ_SET_LINE_CODING 0x20 +#define USB_NT124_REQ_SET_CONTROL_LINE_STATE 0x22 +#define USB_NT124_REQ_SEND_BREAK 0x23 +#define USB_NT124_SET_FLOW_CONTROL 0x90 + +struct nt124_line_coding { + __le32 dwDTERate; + u8 bCharFormat; + u8 bParityType; + u8 bDataBits; +} __packed; + +struct nt124_private { + /* USB interface */ + u16 bInterfaceNumber; + /*
Re: [PATCH] USB: serial: add nt124 usb to serial driver
George, On Mon, Dec 08, 2014 at 05:24:17PM -0600, George McCollister wrote: This driver is for the NovaTech 124 4x serial expansion board for the NovaTech OrionLXm. Firmware source code can be found here: https://github.com/novatechweb/nt124 Signed-off-by: George McCollister george.mccollis...@gmail.com --- drivers/usb/serial/Kconfig | 9 + drivers/usb/serial/Makefile | 1 + drivers/usb/serial/nt124.c | 429 3 files changed, 439 insertions(+) create mode 100644 drivers/usb/serial/nt124.c diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig [...] It applies to next without any errors, there are no checkpatch issues other than recommending updating the MAINTAINERS file, and I can't find any other obvious problems. Looks good to me. Reviewed-by: Jeremiah Mahler jmmah...@gmail.com -- - Jeremiah Mahler -- 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: serial: add nt124 usb to serial driver
Thanks for the review. I didn't update the MAINTAINERS file because I looked in it and didn't see any other individual usb/serial drivers listed with maintainers. -George On Mon, Dec 8, 2014 at 6:29 PM, Jeremiah Mahler jmmah...@gmail.com wrote: George, On Mon, Dec 08, 2014 at 05:24:17PM -0600, George McCollister wrote: This driver is for the NovaTech 124 4x serial expansion board for the NovaTech OrionLXm. Firmware source code can be found here: https://github.com/novatechweb/nt124 Signed-off-by: George McCollister george.mccollis...@gmail.com --- drivers/usb/serial/Kconfig | 9 + drivers/usb/serial/Makefile | 1 + drivers/usb/serial/nt124.c | 429 3 files changed, 439 insertions(+) create mode 100644 drivers/usb/serial/nt124.c diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig [...] It applies to next without any errors, there are no checkpatch issues other than recommending updating the MAINTAINERS file, and I can't find any other obvious problems. Looks good to me. Reviewed-by: Jeremiah Mahler jmmah...@gmail.com -- - Jeremiah Mahler -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 0/5] Patches to add support for Rockchip usb PHYs.
Patches to add support for Rockchip usb phys.Add a new Rockchip usb phy driver and modify dwc2 controller driver to make dwc2 platform devices support a generic PHY framework driver. This patch set has been tested on my rk3288-evb and power off the usb phys would reduce about 60mW power budget in total during sustem suspend. Changes in v4: - Get number of PHYs from device tree. - Model each PHY as subnode of the phy provider node. - Updata description for phy device tree subnode. - Add phy subnodes. Changes in v3: - Use BIT macro instead of bit shift ops. - Rename the config entry to PHY_ROCKCHIP_USB. Yunzhi Li (5): phy: add a driver for the Rockchip SoC internal USB2.0 PHY Documentation: bindings: add doc for the Rockchip usb PHY usb: dwc2: add generic PHY framework support for dwc2 usb controler platform driver. ARM: dts: add rk3288 usb PHY ARM: dts: Enable usb PHY on rk3288-evb board .../devicetree/bindings/phy/rockchip-usb-phy.txt | 32 arch/arm/boot/dts/rk3288-evb.dtsi | 4 + arch/arm/boot/dts/rk3288.dtsi | 27 +++ drivers/phy/Kconfig| 7 + drivers/phy/Makefile | 1 + drivers/phy/phy-rockchip-usb.c | 211 + drivers/usb/dwc2/gadget.c | 33 ++-- drivers/usb/dwc2/platform.c| 36 +++- 8 files changed, 328 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt create mode 100644 drivers/phy/phy-rockchip-usb.c -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 3/5] usb: dwc2: add generic PHY framework support for dwc2 usb controler platform driver.
Get PHY parameters from devicetree and power off usb PHY during system suspend. Signed-off-by: Yunzhi Li l...@rock-chips.com Acked-by: Paul Zimmerman pa...@synopsys.com Changes in v3: - Fix coding style: both branches of the if() which only one branch of the conditional statement is a single statement should have braces. - No need to test dwc2-phy for NULL before calling generic phy APIs. --- Changes in v4: None Changes in v3: None drivers/usb/dwc2/gadget.c | 33 - drivers/usb/dwc2/platform.c | 36 ++-- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 200168e..2601c61 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3410,8 +3410,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) { struct device *dev = hsotg-dev; struct s3c_hsotg_plat *plat = dev-platform_data; - struct phy *phy; - struct usb_phy *uphy; struct s3c_hsotg_ep *eps; int epnum; int ret; @@ -3421,30 +3419,23 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) hsotg-phyif = GUSBCFG_PHYIF16; /* -* Attempt to find a generic PHY, then look for an old style -* USB PHY, finally fall back to pdata +* If platform probe couldn't find a generic PHY or an old style +* USB PHY, fall back to pdata */ - phy = devm_phy_get(dev, usb2-phy); - if (IS_ERR(phy)) { - uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(uphy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(dev); - if (!plat) { - dev_err(dev, - no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } - hsotg-plat = plat; - } else - hsotg-uphy = uphy; - } else { - hsotg-phy = phy; + if (IS_ERR_OR_NULL(hsotg-phy) IS_ERR_OR_NULL(hsotg-uphy)) { + plat = dev_get_platdata(dev); + if (!plat) { + dev_err(dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } + hsotg-plat = plat; + } else if (hsotg-phy) { /* * If using the generic PHY framework, check if the PHY bus * width is 8-bit and set the phyif appropriately. */ - if (phy_get_bus_width(phy) == 8) + if (phy_get_bus_width(hsotg-phy) == 8) hsotg-phyif = GUSBCFG_PHYIF8; } diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 6a795aa..ae095f0 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -155,6 +155,8 @@ static int dwc2_driver_probe(struct platform_device *dev) struct dwc2_core_params defparams; struct dwc2_hsotg *hsotg; struct resource *res; + struct phy *phy; + struct usb_phy *uphy; int retval; int irq; @@ -212,6 +214,24 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg-dr_mode = of_usb_get_dr_mode(dev-dev.of_node); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY +*/ + phy = devm_phy_get(dev-dev, usb2-phy); + if (IS_ERR(phy)) { + hsotg-phy = NULL; + uphy = devm_usb_get_phy(dev-dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) + hsotg-uphy = NULL; + else + hsotg-uphy = uphy; + } else { + hsotg-phy = phy; + phy_power_on(hsotg-phy); + phy_init(hsotg-phy); + } + spin_lock_init(hsotg-lock); mutex_init(hsotg-init_mutex); retval = dwc2_gadget_init(hsotg, irq); @@ -231,8 +251,15 @@ static int __maybe_unused dwc2_suspend(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_suspend(dwc2); + } else { + if (dwc2-lx_state == DWC2_L0) + return 0; + phy_exit(dwc2-phy); + phy_power_off(dwc2-phy); + + } return ret; } @@ -241,8 +268,13 @@ static int __maybe_unused dwc2_resume(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_resume(dwc2); + } else { + phy_power_on(dwc2-phy);
Re: [PATCH v4 3/5] usb: dwc2: add generic PHY framework support for dwc2 usb controler platform driver.
On Tue, Dec 09, 2014 at 10:50:27AM +0800, Yunzhi Li wrote: Get PHY parameters from devicetree and power off usb PHY during system suspend. Signed-off-by: Yunzhi Li l...@rock-chips.com Acked-by: Paul Zimmerman pa...@synopsys.com Changes in v3: - Fix coding style: both branches of the if() which only one branch of the conditional statement is a single statement should have braces. - No need to test dwc2-phy for NULL before calling generic phy APIs. please fix your commit log. Hint: try saving the patch from mailing list and applying it with git am to another branch. -- balbi signature.asc Description: Digital signature
ptp-gadget (by denx) on beaglebone black
dear usb experts---per request in the readme file, I am asking the question here. I am trying to get a ptp-gadget device-side implementation of the Picture Transfer Protocol to work on a beaglebone black (AM335x), running debian 7.7. the hosts to use my beaglebone-black device will only be desktop linux computers, so I won't have to worry about obsolete windows bugs. my USB mass storage and USB networking are running on the same gadget USB client port, so I know I have connection and no power issues. There is already a simple ptp implementation from denx that does what I need. I want my device to listen (and/or take over) my USB port, answer connections, allow file transfers, and allow disconnections. that's it. (If there is a more solid standard implementation, please let me know. I only need the minimum ptp functions, but I would like them to be as fast and robust as possible.) after downloading the ptp-gadget git, an autoconf complains that AM_MAINTAINER_MODE, AC_PROG_LIBTOOL and AM_INIT_AUTOMAKE are undefined. probably not surprisingly, the resulting ./configure script then does not work, complaining that it cannot find install-sh, install.sh, or shtool. this couldn't stop me. ;-). ptp.c is just one file, I just created my own Makefile. I had to -I/usr/include/grlib-2.0 and -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include in the first stage and -lglib-2.0 in the second stage. the source seems fairly clean, except for two warnings that could lead to a segfault, based on bad formats %llx on long unsigned int's (instead of long long unsigned int). starting the program, either with ptp or with ptp -v or with ptp -v /var/cache/ptp/ (which I created and made user rwx, as well as its thumb directory below it), tells me that I am running Linux PTP Gadget v1.1 (good) and then that it can't chdir to /dev/ptp (no such file or directory). this confuses me. what is supposed to have created /dev/ptp? I am guessing I need a device file for /etc/udev/rules.d, but I don't know how to do this right. if there is a document for me to read how to get the device files up, please let me know. help appreciated. /iaw -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Resend PATCH v4 3/5] usb: dwc2: add generic PHY
Get PHY parameters from devicetree and power off usb PHY during system suspend. Signed-off-by: Yunzhi Li l...@rock-chips.com Acked-by: Paul Zimmerman pa...@synopsys.com --- Hi Felipe, Sorry for my mistake, I have fixed the commit log. Changes in v4: None Changes in v3: - Fix coding style: both branches of the if() which only one branch of the conditional statement is a single statement should have braces. - No need to test dwc2-phy for NULL before calling generic phy APIs. drivers/usb/dwc2/gadget.c | 33 - drivers/usb/dwc2/platform.c | 36 ++-- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 200168e..2601c61 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3410,8 +3410,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) { struct device *dev = hsotg-dev; struct s3c_hsotg_plat *plat = dev-platform_data; - struct phy *phy; - struct usb_phy *uphy; struct s3c_hsotg_ep *eps; int epnum; int ret; @@ -3421,30 +3419,23 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) hsotg-phyif = GUSBCFG_PHYIF16; /* -* Attempt to find a generic PHY, then look for an old style -* USB PHY, finally fall back to pdata +* If platform probe couldn't find a generic PHY or an old style +* USB PHY, fall back to pdata */ - phy = devm_phy_get(dev, usb2-phy); - if (IS_ERR(phy)) { - uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(uphy)) { - /* Fallback for pdata */ - plat = dev_get_platdata(dev); - if (!plat) { - dev_err(dev, - no platform data or transceiver defined\n); - return -EPROBE_DEFER; - } - hsotg-plat = plat; - } else - hsotg-uphy = uphy; - } else { - hsotg-phy = phy; + if (IS_ERR_OR_NULL(hsotg-phy) IS_ERR_OR_NULL(hsotg-uphy)) { + plat = dev_get_platdata(dev); + if (!plat) { + dev_err(dev, + no platform data or transceiver defined\n); + return -EPROBE_DEFER; + } + hsotg-plat = plat; + } else if (hsotg-phy) { /* * If using the generic PHY framework, check if the PHY bus * width is 8-bit and set the phyif appropriately. */ - if (phy_get_bus_width(phy) == 8) + if (phy_get_bus_width(hsotg-phy) == 8) hsotg-phyif = GUSBCFG_PHYIF8; } diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 6a795aa..ae095f0 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -155,6 +155,8 @@ static int dwc2_driver_probe(struct platform_device *dev) struct dwc2_core_params defparams; struct dwc2_hsotg *hsotg; struct resource *res; + struct phy *phy; + struct usb_phy *uphy; int retval; int irq; @@ -212,6 +214,24 @@ static int dwc2_driver_probe(struct platform_device *dev) hsotg-dr_mode = of_usb_get_dr_mode(dev-dev.of_node); + /* +* Attempt to find a generic PHY, then look for an old style +* USB PHY +*/ + phy = devm_phy_get(dev-dev, usb2-phy); + if (IS_ERR(phy)) { + hsotg-phy = NULL; + uphy = devm_usb_get_phy(dev-dev, USB_PHY_TYPE_USB2); + if (IS_ERR(uphy)) + hsotg-uphy = NULL; + else + hsotg-uphy = uphy; + } else { + hsotg-phy = phy; + phy_power_on(hsotg-phy); + phy_init(hsotg-phy); + } + spin_lock_init(hsotg-lock); mutex_init(hsotg-init_mutex); retval = dwc2_gadget_init(hsotg, irq); @@ -231,8 +251,15 @@ static int __maybe_unused dwc2_suspend(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_suspend(dwc2); + } else { + if (dwc2-lx_state == DWC2_L0) + return 0; + phy_exit(dwc2-phy); + phy_power_off(dwc2-phy); + + } return ret; } @@ -241,8 +268,13 @@ static int __maybe_unused dwc2_resume(struct device *dev) struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); int ret = 0; - if (dwc2_is_device_mode(dwc2)) + if (dwc2_is_device_mode(dwc2)) { ret = s3c_hsotg_resume(dwc2); +