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 usb: phy: fixed comment typo 2015-03-11 10:19:36 -05:00
phy-ab8500-usb.c Merge 4.1-rc7 into usb-next 2015-06-08 10:57:51 -07:00
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 usb: phy: phy-fsl-usb: Remove some unused functions 2015-01-12 12:13:29 -06:00
phy-fsl-usb.h usb: phy: fsl: Fix build errors 2014-11-12 08:37:37 -06:00
phy-generic.c usb: phy: generic: Handle late registration of gadget 2016-03-04 15:14:47 +02:00
phy-generic.h usb: phy: generic: add vbus support 2015-01-12 12:13:29 -06:00
phy-gpio-vbus-usb.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
phy-isp1301-omap.c usb: isp1301-omap: mark power_up as __maybe_unused 2016-03-04 15:14:30 +02:00
phy-isp1301.c usb: phy: isp1301: Export I2C module alias information 2015-09-21 14:42:36 -05:00
phy-keystone.c usb: phy: phy-keystone: Simplify return statement 2015-08-04 11:02:05 -05:00
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 usb: phy: mv-usb: fix usb_phy build errors 2015-01-13 09:32:22 -06:00
phy-mv-usb.h usb: otg: mv_otg: remove unused clock 2013-04-02 11:42:45 +03:00
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 usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API 2015-07-29 09:59:18 -05:00
phy-tegra-usb.c usb: common: of_usb_get_dr_mode to usb_get_dr_mode 2015-09-27 10:54:31 -05:00
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 usb: Remove unnecessary semicolons 2013-10-11 16:26:46 -07:00
phy-ulpi.c usb: rename phy to usb_phy in OTG 2014-11-03 10:01:25 -06:00
phy.c usb: phy: Add interface to get phy give of device_node. 2015-05-26 10:42:28 -05:00