[RFC linus/master 0/4] rpi: support regulator and usbphy

Alexander Aring alex.aring at gmail.com
Sat Oct 24 05:20:40 PDT 2015


Hi,

this patch series supports regulator and a "dummy?" usb phy for the raspberry
pi. My use-case is to have a mainline solution for power the usb without
booting via u-boot at first. This patch series should support this use-case.

I tested it with the bootloader "barebox" [0].

There was already some solution for doing this via PM domains directly inside
the firmware driver of raspberrypi. This patches are still not mainline and
there was some issues why not.

I hope this patch series by doing it via a regulator driver (which can also
used for other driver to power them) and adding a usb phy (which is used by
the dwc2 driver to power the usb) is a more acceptable solution or I did it
even more complex than it is.

Notes about the new features:

- USB phy:
I was also trying to use the "usb-nop-xceiv" phy driver which was made to
assign a regulator only for powering. Well, I didn't get it working with
the dwc2 driver. I saw that the phy is then not inside the "phy_provider_list".
Then I looked up how others dwc2 boards deals with usbphys and saw the
"phy-bcm-kona-usb2" driver, which enables the dwc2 over iomem.

I grab the code from it and replaced the iomem thing with regulator. I am not
sure if "usb-nop-xceiv" is still the right solution here and why I didn't
get it working.

- USB dwc2 "-EPROBE_DEFER":
The raspberry pi has a complex huge dependency chain to power the usb. Requires
regulator and firmware loading, etc. Without this patch it doesn't work.
I think it's some bug right now, because I don't know how the
"phy-bcm-kona-usb2" can be working with that. This boardsetup should have the
same race condition for probing or I didn't get how it can be working then.

- Regulator driver:
It supports right now to enable/disable the power for mmc/usb/i2c/spi...
I didn't setup some voltage setting, I don't know if the firmware supports such
feature. Also the voltage will printout as zero voltage, maybe we can add some
values which can be changed and these values should be the power consumtion of
the specific device.

This patch series is current based on linus/master and send as RFC to see if
this solution goes to the right direction to support the use-case mainline.

- Alex

[0] http://www.barebox.org/

Cc: Eric Anholt <eric at anholt.net>
Cc: John Youn <johnyoun at synopsys.com>

Alexander Aring (4):
  regulator: add raspberry pi driver
  phy: add raspberry pi driver
  dwc2: wait for usb phy while probing
  rpi: update device tree

 .../devicetree/bindings/phy/raspberrypi-phy.txt    |  15 ++
 .../devicetree/bindings/regulator/raspberrypi.txt  |  59 +++++++
 arch/arm/boot/dts/bcm2835-rpi.dtsi                 |  56 +++++++
 arch/arm/boot/dts/bcm2835.dtsi                     |   2 +-
 drivers/phy/Kconfig                                |   9 ++
 drivers/phy/Makefile                               |   1 +
 drivers/phy/phy-raspberrypi-usb.c                  |  96 ++++++++++++
 drivers/regulator/Kconfig                          |  11 ++
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/raspberrypi-regulator.c          | 172 +++++++++++++++++++++
 drivers/usb/dwc2/platform.c                        |   3 +
 11 files changed, 424 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/phy/raspberrypi-phy.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/raspberrypi.txt
 create mode 100644 drivers/phy/phy-raspberrypi-usb.c
 create mode 100644 drivers/regulator/raspberrypi-regulator.c

-- 
2.6.1




More information about the linux-rpi-kernel mailing list