linux/drivers/usb/phy
Arnd Bergmann 7e8ac87a44 usb: phy: qcom-8x16: fix regulator API abuse
gcc warns about the use of regulators in phy_8x16_probe:

    drivers/usb/phy/phy-qcom-8x16-usb.c: In function 'phy_8x16_probe':
    drivers/usb/phy/phy-qcom-8x16-usb.c:284:13: error: 'regs[0].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    drivers/usb/phy/phy-qcom-8x16-usb.c:285:13: error: 'regs[1].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    drivers/usb/phy/phy-qcom-8x16-usb.c:286:12: error: 'regs[2].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]

According to Mark Brown, this is the result of various abuses
of the PHY interfaces [1], so let's fix the driver instead.

This puts the regulator bulk data into the device structure so it
gets properly initialized and lets us call regulator_bulk_enable()
and regulator_bulk_disable() rather than open-coding them.

Setting the voltages the way the driver does is rather pointless
because for each regulator there is only one valid voltage
range, so that can just get set up in the DT. As there doesn't
seem to be any user of the newly added driver yet, we can simply
make sure the DTs are setting this up right when they get added.

I'm also fixing the handling of regulator_bulk_enable() failure.
Right now, the driver just ignores any failure, which doesn't make
sense, so I'm changing it to loudly complain (in case we actually
had a bug here) and error out.

Doing a fly-by review of the driver, I notice a couple of other
problems that I'm not addressing here:

- It really should not have been written as a USB PHY driver, but
  instead should use the PHY subsystem.

- The DT compatible string does not follow the usual conventions,
  and it should have a proper identifier in it rather than a wildcard.

- The example in the devicetree binding lists a register address
  that is the same as the actual EHCI host controller in the SoC
  as well as the otg-snps and the ci-hdrc device, which indicates
  that these are probably not even distinct devices (or all but
  one of them are wrong), and if more than one of them tries to
  request the resources correctly, they fail.

[1] https://lkml.org/lkml/2016/1/26/267

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-03-30 13:34:04 +03:00
..
Kconfig usb: phy: phy-am335x: bypass first VBUS sensing for host-only mode 2015-12-16 10:07:25 -06:00
Makefile usb: phy: Remove unused Renesas R-Car (Gen1) USB PHY driver 2015-12-15 09:12:41 -06:00
of.c
phy-ab8500-usb.c
phy-am335x-control.c usb: phy: phy-am335x: bypass first VBUS sensing for host-only mode 2015-12-16 10:07:25 -06:00
phy-am335x-control.h usb: phy: phy-am335x: bypass first VBUS sensing for host-only mode 2015-12-16 10:07:25 -06:00
phy-am335x.c usb: phy: phy-am335x: remove include of regulator/consumer.h 2016-03-04 15:14:31 +02:00
phy-fsl-usb.c
phy-fsl-usb.h
phy-generic.c usb: phy: generic: Handle late registration of gadget 2016-03-04 15:14:47 +02:00
phy-generic.h
phy-gpio-vbus-usb.c
phy-isp1301-omap.c usb: isp1301-omap: mark power_up as __maybe_unused 2016-03-04 15:14:30 +02:00
phy-isp1301.c
phy-keystone.c
phy-msm-usb.c usb: phy: msm: Trigger USB state detection work in DRD mode 2016-02-23 08:51:38 +02:00
phy-mv-usb.c
phy-mv-usb.h
phy-mxs-usb.c usb: phy: mxs: declare variable with initialized value 2016-02-03 19:57:41 +02:00
phy-omap-otg.c usb: phy: omap-otg: fix uninitialized pointer 2015-11-16 10:17:40 -06:00
phy-qcom-8x16-usb.c usb: phy: qcom-8x16: fix regulator API abuse 2016-03-30 13:34:04 +03:00
phy-tahvo.c
phy-tegra-usb.c
phy-twl6030-usb.c usb: musb: core: Fix handling of the phy notifications 2015-12-16 10:07:28 -06:00
phy-ulpi-viewport.c
phy-ulpi.c
phy.c