Re: [PATCH 00/21] Support qcom's HSIC USB and rewrite USB2 HS phy support

2016-07-05 Thread John Stultz
On Tue, Jul 5, 2016 at 12:22 PM, Stephen Boyd  wrote:
> Quoting John Stultz (2016-07-01 23:03:38)
>> On Tue, Jun 28, 2016 at 1:34 AM, Stephen Boyd  
>> wrote:
>> > Quoting John Stultz (2016-06-27 20:09:30)
>> >>
>> >> I haven't yet been able to test with this, as I need some other fixes
>> >> it seems too to deal with some of the iommu changes in my flo-WIP tree
>> >> (it can't find of_dma_configure), but will let you know how things
>> >> work once I have all that sorted.
>> >
>> > Cool, thanks for testing.
>>
>> So after working out some merge issues w/ my flo-WIP branch for the
>> nexus7, I was still having trouble, so I backed out to just your
>> (updated) branch.
>>
>> But even there, I'm not able to get the usb gadget up. I see:
>
> I can get the gadget working on the ifc6410 device I have. I'm using
> this script to test things:
>
> modprobe libcomposite
> mkdir config
> mount none config -t configfs
> mkdir config/usb_gadget/g1
> mkdir config/usb_gadget/g1/strings/0x409
> echo 012345678 > config/usb_gadget/g1/strings/0x409/serialnumber
> echo "manufacturer" > config/usb_gadget/g1/strings/0x409/manufacturer
> echo "db8074" > config/usb_gadget/g1/strings/0x409/product
> echo 0x1d6b > config/usb_gadget/g1/idVendor
> echo 0x0104 > config/usb_gadget/g1/idProduct
> mkdir config/usb_gadget/g1/functions/acm.GS0
> mkdir config/usb_gadget/g1/functions/acm.GS1
> mkdir config/usb_gadget/g1/functions/ecm.usb0
> mkdir config/usb_gadget/g1/configs/c.1
> mkdir config/usb_gadget/g1/configs/c.1/strings/0x409/
> echo "CDC 2xACM+ECM" >
> config/usb_gadget/g1/configs/c.1/strings/0x409/configuration
> ln -s config/usb_gadget/g1/functions/acm.GS0
> config/usb_gadget/g1/configs/c.1
> ln -s config/usb_gadget/g1/functions/acm.GS1
> config/usb_gadget/g1/configs/c.1
> ln -s config/usb_gadget/g1/functions/ecm.usb0
> config/usb_gadget/g1/configs/c.1
> echo $(ls /sys/class/udc/) > config/usb_gadget/g1/UDC
>
>>
>> [1.869717] msm_hsusb 1250.usb: failed to get phandle in
>> /soc/usb@1250 node
>
> This is sort of ok (I've seen it before with the HSIC controller on
> 8074). The extcon is optional and so the error message should be
> silenced. I sent a patch to move it to debug level.
>
> I don't see an extcon in mainline for apq8064, but I think it may be
> needed. At the least, I see that we're using a PMIC interrupt in the
> msm-3.4 kernel for the ID pin and the charger is notifying of vbus
> events similar to how smbb is doing it for apq8074.
>
>> [1.882347] 1250.usb supply vbus not found, using dummy regulator
>
> This is not great. We don't have a regulator specified on apq8064 so we
> can't turn on vbus and really support host mode. This seems to already
> be the case on mainline though, so it's not like we're any worse here.
> To properly support this we need a regulator driver. I suppose if the
> RPM supports it we can just use that, but if it doesn't support this
> regulator then we need to port over the SSBI regulator driver to do
> native regulator control. So far I haven't been able to test host mode
> on apq8064 because of this.
>
>>
>> So I'm not sure if the dts changes were quite right. I've got all the
>> ULPI configs enabled. Any ideas?
>>
>
> The phy and controller are both probing? If they're not failing to probe
> then it's probably the phy that isn't working properly. Does gadget work
> without my patches on nexus7?

Without your patch, I need one dts tweak on nexus7 (which I sent out
on friday[1]) to get the default direction set to OTG or gadget. But
yea, it works with that against mainline.

I'll dig in some more on your suggestions above and let you know if I
figure it out.

thanks
-john

[1]: http://www.spinics.net/lists/devicetree/msg134274.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 00/21] Support qcom's HSIC USB and rewrite USB2 HS phy support

2016-07-02 Thread John Stultz
On Tue, Jun 28, 2016 at 1:34 AM, Stephen Boyd  wrote:
> Quoting John Stultz (2016-06-27 20:09:30)
>>
>> I haven't yet been able to test with this, as I need some other fixes
>> it seems too to deal with some of the iommu changes in my flo-WIP tree
>> (it can't find of_dma_configure), but will let you know how things
>> work once I have all that sorted.
>
> Cool, thanks for testing.

So after working out some merge issues w/ my flo-WIP branch for the
nexus7, I was still having trouble, so I backed out to just your
(updated) branch.

But even there, I'm not able to get the usb gadget up. I see:

[1.869717] msm_hsusb 1250.usb: failed to get phandle in
/soc/usb@1250 node
[1.882347] 1250.usb supply vbus not found, using dummy regulator

So I'm not sure if the dts changes were quite right. I've got all the
ULPI configs enabled. Any ideas?

thanks
-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: [PATCH 00/21] Support qcom's HSIC USB and rewrite USB2 HS phy support

2016-06-27 Thread John Stultz
On Sun, Jun 26, 2016 at 12:28 AM, Stephen Boyd  wrote:
> The state of USB ChipIdea support on Qualcomm's platforms is not great.
> The DT description of these devices requires up to three different nodes
> for what amounts to be the same hardware block, when there should really
> only be one. Furthermore, the "phy" driver that is in mainline (phy-msm-usb.c)
> duplicates the OTG state machine and touches the ci controller wrapper
> registers when it should really be focused on the phy and the ULPI accesses
> needed to get the phy working. There's also a slimmed down phy driver for
> the msm8916 platform, but really the phy hardware is the same as other MSMs,
> so we have two drivers doing pretty much the same thing. This leads to a
> situtaion where we have the chipidea core driver, the "phy" driver, and
> sometimes the ehci-msm.c driver operating the same device all at the same
> time with very little coordination. This just isn't very safe and is
> confusing from a driver perspective when trying to figure out who does what.
> Finally, there isn't any HSIC support on platforms like apq8074 so we
> should add that.
>
> This patch series updates the ChipIdea driver and the MSM wrapper
> (ci_hdrc_msm.c) to properly handle the PHY and wrapper bits at the right
> times in the right places. To get there, we update the ChipIdea core to
> have support for the ULPI phy bus introduced by Heikki. Along the way
> we fix bugs with the extcon handling for peripheral and OTG mode controllers
> and move the parts of phy-usb-msm.c that are touching the CI controller
> wrapper into the wrapper driver (ci_hdrc_msm.c). Finally we add support
> for the HSIC phy based on the ULPI bus and rewrite the HS phy driver
> (phy-usb-msm.c) as a standard ULPI phy driver.
>
> Once this series is accepted, we should be able to delete the phy-usb-msm.c
> phy-qcom-8x16-usb.c, and ehci-msm.c drivers from the tree and use the ULPI
> based phy driver (which also lives in drivers/phy/ instead of 
> drivers/usb/phy/)
> and the chipidea host core instead.
>
> I've also sent seperate patches for other minor pieces to make this
> all work. The full tree can be found here[3], hacks and all to get
> things working. I've tested this on the db410c, apq8074 dragonboard,
> and ifc6410 with configfs gadgets and otg cables.
...
> [3] 
> https://git.linaro.org/people/stephen.boyd/linux.git/shortlog/refs/heads/usb-hsic-8074

Very excited to see this moving upstream!

Just a heads up, trying to build with this branch gives me:

drivers/usb/Kconfig:39:error: recursive dependency detected!
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/usb/Kconfig:39: symbol USB is selected by MOUSE_APPLETOUCH
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/input/mouse/Kconfig:187:symbol MOUSE_APPLETOUCH depends on INPUT
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/input/Kconfig:8:symbol INPUT is selected by VT
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/tty/Kconfig:12: symbol VT is selected by FB_STI
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:674:symbol FB_STI depends on FB
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:42: symbol DRM_KMS_FB_HELPER is selected
by DRM_KMS_CMA_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:98: symbol DRM_KMS_CMA_HELPER is selected by DRM_IMX
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/imx/Kconfig:1:  symbol DRM_IMX depends on IMX_IPUV3_CORE
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/ipu-v3/Kconfig:1:   symbol IMX_IPUV3_CORE depends on
RESET_CONTROLLER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/reset/Kconfig:4:symbol RESET_CONTROLLER is selected by
USB_CHIPIDEA
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/usb/chipidea/Kconfig:1: symbol USB_CHIPIDEA depends on USB_EHCI_HCD
For a resolution refer to 

[PATCH 00/21] Support qcom's HSIC USB and rewrite USB2 HS phy support

2016-06-26 Thread Stephen Boyd
The state of USB ChipIdea support on Qualcomm's platforms is not great.
The DT description of these devices requires up to three different nodes
for what amounts to be the same hardware block, when there should really
only be one. Furthermore, the "phy" driver that is in mainline (phy-msm-usb.c)
duplicates the OTG state machine and touches the ci controller wrapper
registers when it should really be focused on the phy and the ULPI accesses
needed to get the phy working. There's also a slimmed down phy driver for
the msm8916 platform, but really the phy hardware is the same as other MSMs,
so we have two drivers doing pretty much the same thing. This leads to a
situtaion where we have the chipidea core driver, the "phy" driver, and
sometimes the ehci-msm.c driver operating the same device all at the same
time with very little coordination. This just isn't very safe and is
confusing from a driver perspective when trying to figure out who does what.
Finally, there isn't any HSIC support on platforms like apq8074 so we
should add that.

This patch series updates the ChipIdea driver and the MSM wrapper
(ci_hdrc_msm.c) to properly handle the PHY and wrapper bits at the right
times in the right places. To get there, we update the ChipIdea core to
have support for the ULPI phy bus introduced by Heikki. Along the way
we fix bugs with the extcon handling for peripheral and OTG mode controllers
and move the parts of phy-usb-msm.c that are touching the CI controller
wrapper into the wrapper driver (ci_hdrc_msm.c). Finally we add support
for the HSIC phy based on the ULPI bus and rewrite the HS phy driver
(phy-usb-msm.c) as a standard ULPI phy driver.

Once this series is accepted, we should be able to delete the phy-usb-msm.c
phy-qcom-8x16-usb.c, and ehci-msm.c drivers from the tree and use the ULPI
based phy driver (which also lives in drivers/phy/ instead of drivers/usb/phy/)
and the chipidea host core instead.

I've also sent seperate patches for other minor pieces to make this
all work. The full tree can be found here[3], hacks and all to get
things working. I've tested this on the db410c, apq8074 dragonboard,
and ifc6410 with configfs gadgets and otg cables.

TODO:
 * DMA fails on arm64 so we need something like [1] to make it work.

 * The HSIC phy on the apq8074 dragonboard is connected to a usb4604
   device which requires the i2c driver to probe and send an i2c
   sequence before the HSIC controller enumerates or HSIC doesn't work.
   Right now I have a hack to force the controller to probe defer
   once so that usb4604 probes first. This needs a more proper solution
   like having the DT describe a linkage between the controller and
   the usb device so we can enforce probe ordering.
 
 * OTG support requires a working VBUS supply on apq8074 dragonboard
   and that requires changes to the smbb_charger driver to support
   the OTG OVP switch as a regulator[2]. This series needs revival.

 * Sleeping while atomic problems exist when trying to do phy operations
   underneath some spinlocks in the ci core. I have a patch to remove a
   spinlock, but that needs more thought if it's correct. At the least
   it's necessary though because of how we need to initialize the HSIC
   phy after the reset bit is toggled in USBCMD.

[1] https://lkml.org/lkml/2016/2/22/7
[2] 
http://lkml.kernel.org/g/1449621618-11900-1-git-send-email-tim.b...@sonymobile.com
[3] 
https://git.linaro.org/people/stephen.boyd/linux.git/shortlog/refs/heads/usb-hsic-8074

Stephen Boyd (21):
  of: device: Support loading a module with OF based modalias
  usb: ulpi: Support device discovery via DT
  usb: ulpi: Avoid reading/writing in device creation with OF devices
  usb: chipidea: Only read/write OTGSC from one place
  usb: chipidea: Handle extcon events properly
  usb: chipidea: Initialize and reinitialize phy later
  usb: chipidea: Notify of reset when switching into host mode
  usb: chipidea: Kick OTG state machine for AVVIS with vbus extcon
  usb: chipidea: Add support for ULPI PHY bus
  usb: chipidea: msm: Rely on core to override AHBBURST
  usb: chipidea: msm: Use hw_write_id_reg() instead of writel directly
  usb: chipidea: msm: Keep device runtime enabled
  usb: chipidea: msm: Allow core to get usb phy
  usb: chipidea: msm: Add proper clk and reset support
  usb: chipidea: msm: Mux over secondary phy at the right time
  usb: chipidea: msm: Restore wrapper settings after reset
  usb: chipidea: msm: Make platform data driver local instead of global
  usb: chipidea: msm: Add reset controller for PHY POR bit
  usb: chipidea: msm: Be silent on probe defer errors
  phy: Add support for Qualcomm's USB HSIC phy
  phy: Add support for Qualcomm's USB HS phy

 .../devicetree/bindings/phy/qcom,usb-hs-phy.txt|  71 ++
 .../devicetree/bindings/phy/qcom,usb-hsic-phy.txt  |  60 +
 Documentation/devicetree/bindings/usb/ulpi.txt |  20 ++
 drivers/of/device.c|  50 
 drivers/phy/Kconfig