Commit graph

85 commits

Author SHA1 Message Date
Wolfram Sang 9c5fdd3827 drivers/usb/phy: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-05-18 11:58:00 +02:00
Linus Torvalds 5647ac0ad4 Removal of GENERIC_GPIO for v3.10
GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any valid
 cases for enableing GENERIC_GPIO without GPIOLIB, even though it is
 possible to do so which has been causing confusion and breakage. This
 branch does the work to completely eliminate GENERIC_GPIO.
 
 However, it is not trivial to just create a branch to remove it. Over
 the course of the v3.9 cycle more code referencing GENERIC_GPIO has been
 added to linux-next that conflicts with this branch. The following must
 be done to resolve the conflicts when merging this branch into mainline:
 
 * "git grep CONFIG_GENERIC_GPIO" should return 0 hits. Matches should be
   replaced with CONFIG_GPIOLIB
 * "git grep '\bGENERIC_GPIO\b'" should return 1 hit in the Chinese
   documentation.
 * Selectors of GENERIC_GPIO should be turned into selectors of GPIOLIB
 * definitions of the option in architecture Kconfig code should be deleted.
 
 Stephen has 3 merge fixup patches[1] that do the above. They are currently
 applicable on mainline as of May 2nd.
 
 [1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg428056.html
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRifUnAAoJEEFnBt12D9kBs2YP/0U6+ia+xYvkVaJc28PDVIzn
 OReZNcJOYU8D5voxz0voaRD0EdcPwjbMu9Kp9aXMHlk4VxevF+8jCc/us0bIjtO1
 VcB5VmSCIhMhxdnBlum11Mk7Vr5MCweyl9NBsypnPt8cl4obMBZHf2yzoodFktNb
 wtyYlOb6FALtc6iDbOO6dG3w9F7FAOLvskUFzdv89m8mupTsBu9jw9NqFDbJHOex
 rxq0Sdd+kWF/nkJVcV5Y6jIdletRlhpipefMJ9diexreHvwqh+c4kJEYZaXgB5+m
 ha95cPbReK1d+RqzM3A8d4irzSVSmq4k7ijI6QkFOr48+AH7XsgKv5so885LKzMN
 IIXg2Phm9i0H8+ecEvhcc4oIYBHJiEKK54Y0qUD9dqbFoDGPTCSqMHdSSMbpAY+J
 bIIXlVzj1En3PPNUJLPt8q8Qz6WxCT9mDST3QSGYnD4o90HT+1R9j92RxGL6McOq
 rUOyJDwmzFvpBvKK4raGdOU435M+ps2NPKKNIRaIGQPPY9rM1kN4YqvhXukEsC9L
 3a3+3cQLh7iKxBHncxeQsJfethP1CPkJnzvF9r+ZZLf2rcPH4pbQIE2uO0XnX/nd
 5/DKi0nGgAJ//GMMzdo3RiOA5zGFjIZ/KMvfhQldpP6qFJRhqdGi6FPlAcwr1z1n
 YnCByPwwlvfC4LTXFOGL
 =xodc
 -----END PGP SIGNATURE-----

Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux

Pull removal of GENERIC_GPIO from Grant Likely:
 "GENERIC_GPIO now synonymous with GPIOLIB.  There are no longer any
  valid cases for enableing GENERIC_GPIO without GPIOLIB, even though it
  is possible to do so which has been causing confusion and breakage.
  This branch does the work to completely eliminate GENERIC_GPIO."

* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux:
  gpio: update gpio Chinese documentation
  Remove GENERIC_GPIO config option
  Convert selectors of GENERIC_GPIO to GPIOLIB
  blackfin: force use of gpiolib
  m68k: coldfire: use gpiolib
  mips: pnx833x: remove requirement for GENERIC_GPIO
  openrisc: default GENERIC_GPIO to false
  avr32: default GENERIC_GPIO to false
  xtensa: remove explicit selection of GENERIC_GPIO
  sh: replace CONFIG_GENERIC_GPIO by CONFIG_GPIOLIB
  powerpc: remove redundant GENERIC_GPIO selection
  unicore32: default GENERIC_GPIO to false
  unicore32: remove unneeded select GENERIC_GPIO
  arm: plat-orion: use GPIO driver on CONFIG_GPIOLIB
  arm: remove redundant GENERIC_GPIO selection
  mips: alchemy: require gpiolib
  mips: txx9: change GENERIC_GPIO to GPIOLIB
  mips: loongson: use GPIO driver on CONFIG_GPIOLIB
  mips: remove redundant GENERIC_GPIO select
2013-05-09 09:59:16 -07:00
Arnd Bergmann c3c683ead3 USB: OMAP: ISP1301 needs USB_PHY
The Kconfig entry for USB_OMAP unconditionally selects USB_ISP1301,
which is now only visible when USB_PHY is also enabled.

This adds an appropriate dependency and enables USB_PHY in the omap1
defconfig, avoiding these build warnings:

warning: (USB_OHCI_HCD && USB_OMAP) selects ISP1301_OMAP which has unmet direct dependencies (USB_SUPPORT && USB_PHY && I2C && ARCH_OMAP_OTG)

Also fix a Makefile typo while we're at it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-25 10:58:00 -07:00
Arnd Bergmann ee5d5499ed usb: phy: tegra: don't call into tegra-ehci directly
Both phy-tegra-usb.c and ehci-tegra.c export symbols used by the other one,
which does not work if one of them or both are loadable modules, resulting
in an error like:

drivers/built-in.o: In function `utmi_phy_clk_disable':
drivers/usb/phy/phy-tegra-usb.c:302: undefined reference to `tegra_ehci_set_phcd'
drivers/built-in.o: In function `utmi_phy_clk_enable':
drivers/usb/phy/phy-tegra-usb.c:324: undefined reference to `tegra_ehci_set_phcd'
drivers/built-in.o: In function `utmi_phy_power_on':
drivers/usb/phy/phy-tegra-usb.c:447: undefined reference to `tegra_ehci_set_pts'

This turns the interface into a one-way dependency by letting the tegra ehci
driver pass two function pointers for callbacks that need to be called by
the phy driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-23 12:50:38 -07:00
Arnd Bergmann 4623245c76 usb: phy: phy core cannot yet be a module
A lot of platform code calls into the usb phy core at the moment, which
does not work if it is built as a loadable module. This will hopefully
change when those platforms are all converted to DT based probing,
but for now, the easiest solution is to change it from "tristate"
to "bool".

This solves at least these ARM allmodconfig build errors:

arch/arm/mach-imx/built-in.o: In function `imx_otg_ulpi_create':
arch/arm/mach-imx/ulpi.c:117: undefined reference to `otg_ulpi_create'
arch/arm/mach-omap2/built-in.o: In function `usbhs_init_phys':
arch/arm/mach-omap2/usb-host.c:652: undefined reference to `usb_bind_phy'
arch/arm/mach-omap2/built-in.o: In function `omap_2430sdp_init':
arch/arm/mach-omap2/board-2430sdp.c:236: undefined reference to `usb_bind_phy'
arch/arm/mach-omap2/built-in.o: In function `omap3_beagle_init':
arch/arm/mach-omap2/board-omap3beagle.c:554: undefined reference to `usb_bind_phy'
arch/arm/mach-omap2/built-in.o: In function `devkit8000_init':
arch/arm/mach-omap2/board-devkit8000.c:596: undefined reference to `usb_bind_phy'
arch/arm/mach-omap2/built-in.o: In function `omap_ldp_init':
arch/arm/mach-omap2/board-ldp.c:379: undefined reference to `usb_bind_phy'
drivers/built-in.o: In function `ab8500_charger_probe':
drivers/power/ab8500_charger.c:3629: undefined reference to `usb_get_phy'
drivers/power/ab8500_charger.c:3706: undefined reference to `usb_put_phy'
drivers/built-in.o: In function `ab8500_charger_remove':
drivers/power/ab8500_charger.c:3411: undefined reference to `usb_put_phy'

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-23 10:10:29 -07:00
Greg Kroah-Hartman 0b9b6df9ee usb: urgent fixes for v3.10 merge window
Here are some late urgent fixes for v3.10 merge window.
 
 All of these errors were introduced by recent commits
 which are in linux-next.
 
 f_obex, multi and cdc2 gadget drivers have learned to
 return a proper error code when something goes wrong.
 
 usb_bind_phy() was mistakenly placed into .init.text
 section which caused Section mismatch warnings and undefined
 reference compile errors.
 
 f_source_sink had a copy-paste error which is now corrected.
 
 g_zero got a memory leak plugged.
 
 Two defconfigs got fixed to enable the newly introduced
 CONFIG_USB_PHY.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRdnDhAAoJEIaOsuA1yqRE2UoP/RakEoDFlC58D1FtiKYtedT+
 /dyq6BA0riqLcOXbLKtvgG58G7KZGKzMWxCvsGALrbUSWRjRptN7Z7okx0onJgPr
 Wfc6tgJwEQdBaH25FYWDJSZ+zoB7l+LYuEO5XstFE6A26Fa4xKudEf6OFr5/odgm
 DRxwV0dOSsNzw9zjrDoTnEfLJe8aolGkQNOf/1FUCpLNGFRBt9qg1uMOs5P7bKdp
 M544LVQSXjwWlqW1oyysUXBbjQtCK2QvELqa+3EK8yMCQQZ27lJzdgHml02NbyfE
 ktoNB8w9hv4xxUIICgWcWQGPpx/1keE4K0xIycRpCTfQobNOcLv1gzxlZBmaXKQE
 uBUnXqZ52DgSRMEBmqOOuZqvy5fYOX2e5WRlZNlXAYtnHWMTVf86SwHSr1EWhP7M
 JLv2dvukagfkg6vlim4pkLEesLEqdzDK3aUMHCYZTQSTATUrV81CAeXZp1ZGVqCw
 y8jF+UPGTCfnar9V9sGBWmye8Aj5Y1XMacWxsrUNiWXgI4kUTyFK3wwGKbeCihyI
 z8uZnkTSTUck95S67UBol2dnAyJaEi5N+ttEW8TTyWmCkXmbCORT7wj8CQ6RAMnF
 3cLRhU1BKqENaRaBYvVPH28kNSmjNxHQFoxesfDVmzzqUoEvVnzRP+NqLi8y3aSl
 5HO3rg8pSc2j056sLLg9
 =UKZz
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v3.10-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: urgent fixes for v3.10 merge window

Here are some late urgent fixes for v3.10 merge window.

All of these errors were introduced by recent commits
which are in linux-next.

f_obex, multi and cdc2 gadget drivers have learned to
return a proper error code when something goes wrong.

usb_bind_phy() was mistakenly placed into .init.text
section which caused Section mismatch warnings and undefined
reference compile errors.

f_source_sink had a copy-paste error which is now corrected.

g_zero got a memory leak plugged.

Two defconfigs got fixed to enable the newly introduced
CONFIG_USB_PHY.
2013-04-23 09:14:09 -07:00
Denis Efremov 19d8ceddda usb: phy: remove exported function from __init section
The symbol usb_bind_phy is exported and annotated __init.
It looks like section mismatch. Fix by removing the
__init annotation of usb_bind_phy.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov <yefremov.denis@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-23 14:13:48 +03:00
Greg Kroah-Hartman 64dc9e2e73 usb: patches for v3.10 merge window
Here is the big Gadget & PHY pull request. Many of us have
 been really busy lately getting multiple drivers to a better
 position.
 
 Since this pull request is so large, I will divide it in sections
 so it's easier to grasp what's included.
 
 - cleanups:
 	. UDC drivers no longer touch gadget->dev, that's now udc-core
 		responsibility
 	. Many more UDC drivers converted to usb_gadget_map/unmap_request()
 	. UDC drivers no longer initialize DMA-related fields from gadget's
 		device structure
 	. UDC drivers don't touch gadget.dev.driver directly
 	. UDC drivers don't assign gadget.dev.release directly
 	. Removal of some unused DMA_ADDR_INVALID
 	. Introduction of CONFIG_USB_PHY
 	. All phy drivers have been moved to drivers/usb/phy and renamed to
 		a common naming scheme
 	. Fix PHY layer so it never returns a NULL pointer, also fix all
 		callers to avoid using IS_ERR_OR_NULL()
 	. Sparse fixes all over the place
 	. drivers/usb/otg/ has been deleted
 	. Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock
 		usage
 
 - new features:
 	. UDC core now provides a generic way for tracking and reporting
 		UDC's state (not attached, resuming, suspended, addressed,
 		default, etc)
 	. twl4030-usb learned that it shouldn't be enabled during init
 	. Full DT support for DWC3 has been implemented
 	. ab8500-usb learned about pinctrl framework
 	. nop PHY learned about DeviceTree and regulators
 	. DWC3 learned about suspend/resume
 	. DWC3 can now be compiled in host-only and gadget-only (as well as
 		DRD) configurations
 	. UVC now enables streaming endpoint based on negotiated speed
 	. isp1301 now implements the PHY API properly
 	. configfs-based interface for gadget drivers which will lead to
 		the removal of all code which just combines functions together
 		to build functional gadget drivers.
 	. f_serial and f_obex were converted to new configfs interface while
 		maintaining old interface around.
 
 - non-critical fixes:
 	. UVC gadget driver got fixes for Endpoint usage and stream calculation
 	. ab8500-usb fixed unbalanced clock and regulator API usage
 	. twl4030-usb got a fix for when OMAP3 is booted with cable connected
 	. fusb300_udc got a fix for DMA usage
 	. UVC got fixes for two assertions of the USB Video Class Compliance
 		specification revision 1.1
 	. build warning issues caused by recent addition of __must_check to
 		regulator API
 
 These are all changes which deserve a mention, all other changes are related
 to these one or minor spelling fixes and other similar tasks.
 
 Signed-of-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRXG8GAAoJEIaOsuA1yqREJzYQAKMLW3J/TKTWS1DDuf7qMtMz
 Ug6qChKZXgT1/QrNjsq2tx4jYIkNdSMtRKiUx0BnIptlUx6gM22gcsN8mXX/UJjC
 FYAiWl+tYe85e9uayqqt+qVCZjTZCc7St4wQalugDHefvA7yCbiZpSaJRGlJMK+x
 mePJ7MfrulDsYBXr0u+m2LOJ0qxMDi40k3/UN3aUu5yzrmBiRpVq1mySruvLwGFp
 Pr6vBnprEc6bW5sRdUR4SICKLvLk5sHwHpvpkzDLYBIb/jXQwbfQri/HKeh4VMk8
 trbsvHZyB7H8uuFsCHiBc6VtjcbZ4mxPUK+1PCq8hG077avdkm3ox0BERk9aRTeC
 jg4mdpyWjgovwi882woPEQXNZoaAXpVDyI8tBRx92a+rGJjXSHhLQI+4Ffi4ZvzV
 d+q1ZzrHxuzwa/BwcPETY76umXQqXWXg+ap1bHDY0RZFoPLdXMpl583NXGSn3gOD
 dUlD0UlgYwb75333tRIPNQn3qOx0HVd6MlYPMNzl9t9c9qqfX78AYRny6ZucupRg
 t9VZ6FO3D2yre9W7u3U3q2c9H7uSAKr/8xaNfvdsIWPncgvvYVIyE8MnR7AiHoPv
 ZYESs/Gs6w9vUsHa9K4J16Ape7D3AMcGpXUoPUxTBHrwBexzt4j27VWtcL4ns/9r
 0kcltUJ4Zq+PIjc7xgxe
 =aF4r
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v3.10 merge window

Here is the big Gadget & PHY pull request. Many of us have
been really busy lately getting multiple drivers to a better
position.

Since this pull request is so large, I will divide it in sections
so it's easier to grasp what's included.

- cleanups:
	. UDC drivers no longer touch gadget->dev, that's now udc-core
		responsibility
	. Many more UDC drivers converted to usb_gadget_map/unmap_request()
	. UDC drivers no longer initialize DMA-related fields from gadget's
		device structure
	. UDC drivers don't touch gadget.dev.driver directly
	. UDC drivers don't assign gadget.dev.release directly
	. Removal of some unused DMA_ADDR_INVALID
	. Introduction of CONFIG_USB_PHY
	. All phy drivers have been moved to drivers/usb/phy and renamed to
		a common naming scheme
	. Fix PHY layer so it never returns a NULL pointer, also fix all
		callers to avoid using IS_ERR_OR_NULL()
	. Sparse fixes all over the place
	. drivers/usb/otg/ has been deleted
	. Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock
		usage

- new features:
	. UDC core now provides a generic way for tracking and reporting
		UDC's state (not attached, resuming, suspended, addressed,
		default, etc)
	. twl4030-usb learned that it shouldn't be enabled during init
	. Full DT support for DWC3 has been implemented
	. ab8500-usb learned about pinctrl framework
	. nop PHY learned about DeviceTree and regulators
	. DWC3 learned about suspend/resume
	. DWC3 can now be compiled in host-only and gadget-only (as well as
		DRD) configurations
	. UVC now enables streaming endpoint based on negotiated speed
	. isp1301 now implements the PHY API properly
	. configfs-based interface for gadget drivers which will lead to
		the removal of all code which just combines functions together
		to build functional gadget drivers.
	. f_serial and f_obex were converted to new configfs interface while
		maintaining old interface around.

- non-critical fixes:
	. UVC gadget driver got fixes for Endpoint usage and stream calculation
	. ab8500-usb fixed unbalanced clock and regulator API usage
	. twl4030-usb got a fix for when OMAP3 is booted with cable connected
	. fusb300_udc got a fix for DMA usage
	. UVC got fixes for two assertions of the USB Video Class Compliance
		specification revision 1.1
	. build warning issues caused by recent addition of __must_check to
		regulator API

These are all changes which deserve a mention, all other changes are related
to these one or minor spelling fixes and other similar tasks.

Signed-of-by: Felipe Balbi <balbi@ti.com>
2013-04-05 15:18:00 -07:00
Fabio Baltieri bb54542cfa usb: phy: twl6030-usb: check regulator_enable return value
Since regulator_enable() is going to be marked as __must_check in the
next merge window, always check regulator_enable() return value and
print a warning if it fails.

Cc: Hema HK <hemahk@ti.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 18:44:49 +03:00
Fabio Baltieri 9ec602ecb1 usb: phy: twl4030-usb: check regulator_enable return value
Since regulator_enable() is going to be marked as __must_check in the
next merge window, always check regulator_enable() return value and
print a warning if it fails.

Reviewed-by: Kalle Jokiniemi <kalle.jokiniemi@jollamobile.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 18:44:38 +03:00
Fabio Baltieri 88b1c78db3 usb: phy: ab8500-usb: check regulator_enable return value
Since regulator_enable() is going to be marked as __must_check in the
next merge window, always check regulator_enable() return value and
print a warning if it fails.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 17:15:18 +03:00
Sakethram Bommisetti 5882337338 usb: phy: ab8500-usb: call phy_dis_work only when necessary
Modify ab8500_usb_set_peripheral() and ab8500_usb_set_host() code to
schedule phy_dis_work only when necessary in order to prevent regulator
count mismatch during reboot/shutdown.

Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:03:07 +03:00
Sakethram Bommisetti 8db12231bc usb: phy: ab8500-usb: drop link status delayed work
ab8500_usb_delayed_work was implemented as a workaroud for the internal
only and now unsupported v1.0 version of AB850.  This patch removes the
delayed work and just leave a link status update call at probe time.

Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:02:58 +03:00
Patrice Chotard 899f0f561b usb: phy: ab8500-usb: adopt pinctrl support
Amend the ab8500-usb driver to optionally take a pin control handle and
set the state of the pins to "default" on ab8500_usb_phy_enable and to
"sleep" on ab8500_usb_phy_disable.

The pinctrl handle is released on ab8500_usb_phy_disable because USB
pins are shared with ab8505_micro_usb_iddet driver.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:02:49 +03:00
Fabio Baltieri 77f4396ecb usb: phy: ab8500-usb: fix last notifier arguments
Fix last ab->phy.notifier call to use vbus_draw as notifier argument, as
that's used in ab8500_charger to control charging current.

Also drop a related TODO comment, and the additional
ux500_musb_set_vbus(musb, 0), as with this patch it was causing an
erratic behaviour of gadget ep0 state machine.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:02:21 +03:00
Mian Yousaf Kaukab f5ef7b4282 usb: phy: ab8500-usb: fix unbalanced clock and regulator disable warnings
To prevent clock and regulator frameworks from complaining, only disable
the host or peripheral phy if they were enabled.

Reported-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:02:05 +03:00
Fabio Baltieri 54dfbb0805 usb: phy: ab8500-usb: enable/disable regulator on phy events
Add ab8500_usb_regulator_{enable,disable} functions to control USB phy
regulators on corresponding ab8500_usb_phy_{enable,disable} events.

This contains some workaround and optimization for specific AB8500
versions.

Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Signed-off-by: Praveena Nadahally <praveen.nadahally@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:01:56 +03:00
Fabio Baltieri c0ea70646a usb: phy: ab8500-usb: split ab8500_usb_phy_ctrl
Split ab8500_usb_phy_ctrl into separate enable/disable functions to make
the code more linear and readable.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:01:45 +03:00
Fabio Baltieri e65b36c026 usb: phy: ab8500-usb: add regulator support
Add initial regulator support to ab8500-usb by introducing necessary
devm_regulator_get().

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:00:44 +03:00
Sakethram Bommisetti c2a0ab6bd5 usb: phy: ab8500-usb: fix eye diagram for ab8500 v2.0
AB8500 v2.0 has eye diagram issues when drawing more than 100mA from
VBUS.  Force charging current to 100mA in case of standard host.

Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 12:00:25 +03:00
Sakethram Bommisetti 7124631aa8 usb: phy: ab8500-usb: set phy tuning values
Set phy tuning values proposed by the hardware teams for AB8500 and
AB8505 to improve USB eye diagram performances.

Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 11:59:42 +03:00
Fabio Baltieri 81ef672430 usb: phy: ab8500-usb: convert to devm_kzalloc
Convert local data allocation to devm_kzalloc and drop unnecessary fail
path code.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 11:55:48 +03:00
Sachin Kamat f4362b1dd7 usb: phy: samsung: convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 10:56:27 +03:00
Chao Xie df18fedae5 usb: otg: mv_otg: remove unused clock
The origianl understanding of clock is wrong. The OTG controller
only have one clock input.
Passing clock name by pdata is wrong. The clock is defined by device
iteself.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-02 11:42:45 +03:00
Grazvydas Ignotas f65f4f40fb usb: phy: twl4030-usb: check if vbus is driven by twl itself
At least on pandora, STS_VBUS gets set even when VBUS is driven by twl
itself. Reporting VBUS in this case confuses OMAP musb glue and charger
driver, so check if OTG VBUS charge pump is on before reporting VBUS
event to avoid this problem.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-02 11:42:41 +03:00
Greg Kroah-Hartman 02d5f0857b Merge branch 'usb-linus' into usb-next
This lets us fix the build error that happens when these two trees are merged
together.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28 11:00:55 -07:00
Roland Stigge c8fa48d372 usb: Fix compile error by selecting USB_OTG_UTILS
The current lpc32xx_defconfig breaks like this, caused by recent phy
restructuring:

  LD      init/built-in.o
drivers/built-in.o: In function `usb_hcd_nxp_probe':
drivers/usb/host/ohci-nxp.c:224: undefined reference to `isp1301_get_client'
drivers/built-in.o: In function `lpc32xx_udc_probe':
drivers/usb/gadget/lpc32xx_udc.c:3104: undefined reference to
`isp1301_get_client' distcc[27867] ERROR: compile (null) on localhost failed
make: *** [vmlinux] Error 1

Caused by 1c2088812f (usb: Makefile: fix
drivers/usb/phy/ Makefile entry)

This patch fixes this by selecting USB_OTG_UTILS in Kconfig which
causes the phy driver to be built again.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-27 08:49:20 -07:00
Felipe Balbi 60630c2eab usb: gadget: mv_u3d: drop ARCH dependency
this driver compiles fine everywhere which
means we can use linux-next to compile it
for us frequently.

By dropping the arch dependency, we also
ensure driver writers don't add virtual
arch-depdencies to the driver by e.g. using
the wrong headers.

While at that, fix Marvell's USB3 PHY dependency,
that's the driver which depends on CPU_MM3, not
mv_u3d_core.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-27 13:18:20 +02:00
Grazvydas Ignotas 249751f223 usb: phy: twl4030-usb: poll for ID disconnect
On pandora, STS_USB interrupt doesn't arrive on USB host cable disconnect
for some reason while VBUS is driven by twl itself, but STS_HW_CONDITIONS
is updated correctly. It does work fine when PHY is powered down though.
To work around that we have to poll.

This patch also moves twl->linkstat update code to callers so that
changes can be handled in thread safe way (as polling work can trigger
at the same time as real irq now).

TI PSP kernels have similar workarounds, so (many?) more boards are likely
affected.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-21 14:20:30 +02:00
Grazvydas Ignotas 15460de7f3 usb: phy: twl4030-usb: don't switch the phy on/off needlessly
With runtime_pm in place there is no longer need to turn the phy
on/off in OTG layer on cable connect/disconnect, OMAP glue does
this through otg.set_suspend() callback after it's called through
omap_musb_mailbox() on VBUS/ID interrupt. Not doing this will save
power when cable is connected but no gadget driver is loaded.

This will also have side effect of automatic USB charging no longer
working without twl4030_charger driver, because a regulator needed
for charging will no longer be enabled, so be sure to enable charger
driver if charging is needed.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-21 14:20:29 +02:00
Grazvydas Ignotas ca4f70ce78 usb: phy: twl4030-usb: ignore duplicate events
In some rare cases we may get multiple interrupts that will generate
duplicate omap_musb_mailbox() calls. This is a problem because each
VBUS/ID event generates runtime_pm call in OMAP glue code, causing
unbalanced gets or puts and breaking PM.

The same goes for initial state, glue already defaults to "no cable"
state, so only bother it if we have VBUS or ID.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-21 14:20:29 +02:00
Grazvydas Ignotas 44a50d088a usb: phy: twl4030-usb: don't enable PHY during init
There is no need to do it, otg.set_suspend(false) (which itself
comes from runtime_pm OMAP glue calls) will enable it later anyway.
This used to be the place where things were enabled if booted with
cable connected before runtime_pm conversion, but now can be dropped.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-21 14:20:28 +02:00
Greg Kroah-Hartman cf2d9500a5 Merge branch 'usb-linus' into usb-next
This is to pick up the fixes in that branch, and let Alan fix the merge
error in drivers/usb/host/ehci-timer.c better than I just did (as I know
I messed it up...)

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-20 16:21:47 -07:00
Felipe Balbi e8d891fb7b usb: phy: gpio-vbus: don't ignore regulator APIs return value
Due to recent changes to regulator API, all
users which don't check regulator_{en,dis}able()'s
return value will generate compile warnings.

Add such checks to gpio-vbus.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-20 08:01:53 +02:00
Felipe Balbi b64a15930c usb: phy: samsung: fix sparse warning
Fix the following sparse warning:

drivers/usb/phy/phy-samsung-usb2.c:50:26: sparse: incorrect type in argument 1 (different address spaces)
drivers/usb/phy/phy-samsung-usb2.c:50:26:    expected void const volatile [noderef] <asn:2>*addr
drivers/usb/phy/phy-samsung-usb2.c:50:26:    got void *

Cc: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-19 10:14:35 +02:00
Fabio Baltieri af6882be36 usb: phy: ab8500-usb: update irq handling code
Update irq handling code to notify all possible link status changes of
AB8500 and AB8505 to the ux500-musb glue driver.  The additional event
codes will be used for pm-runtime implementation, and are defined in a
separate ux500-specific header.

This also modify the irq registration code to use devm_* helpers and
drop all non necessary fail path code.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 14:41:33 +02:00
Fabio Baltieri 73f226cbd7 usb: otg: ab8500-usb: drop support for ab8500 pre v2.0
AB8500 versions preceding 2.0 were only used internally by ST-Ericsson
and are not supported anymore.  This patch drops all v1.0 and v1.1
support code.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 14:41:33 +02:00
Kishon Vijay Abraham I 817e5f33d0 usb: phy: twl4030: fix cold plug on OMAP3
Having twl4030_usb_phy_init() (detects if a cable is connected before
twl4030 is probed) in twl4030 probe makes cable connect events to be
missed by musb glue, since it gets loaded after twl4030. Having
twl4030_usb_phy_init as a usb_phy ops lets twl4030_usb_phy_init to be
called when glue is ready.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:27 +02:00
Kishon Vijay Abraham I 9166902c43 usb: phy: twl4030: use devres API for regulator get and request irq
Used devres APIs devm_request_threaded_irq and devm_regulator_get for
requesting irq and for getting regulator respectively.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:27 +02:00
Vivek Gautam b527675817 usb: phy: samsung: Add PHY support for USB 3.0 controller
Adding PHY driver support for USB 3.0 controller for Samsung's
SoCs.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:15 +02:00
Vivek Gautam dc2377d0b0 usb: phy: samsung: Common out the generic stuff
Moving register and structure definitions to header file,
and keeping the generic functions to be used across
multiple PHYs in common phy helper driver under SAMSUNG_USBPHY,
and moving USB 2.0 PHY driver under SAMSUNG_USB2PHY.

Also allowing samsung PHY drivers be built as modules.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:15 +02:00
Felipe Balbi c38a4f3f50 usb: phy: isp1301: implement PHY API
this patch implements ->init() and ->set_vbus()
methods for isp1301 transceiver driver.

Later patches can now come in order to remove
the hackery from ohci-nxp and lpc32xx udc drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:10 +02:00
Felipe Balbi 790d3a5ab6 usb: phy: isp1301: give it a context structure
this patch is a small preparation to fix
isp1301 driver so that other platforms can
use it.

We're defining our private data structure
to represent this device and adding the
PHY to the PHY list.

Later patches will come implementing proper
PHY API and removing bogus code from ohci_nxp
and lpc32xx_udc drivers.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:09 +02:00
Felipe Balbi 94ae98433a usb: phy: rename all phy drivers to phy-$name-usb.c
this will make sure that we have sensible names
for all phy drivers. Current situation was already
quite bad with too generic names being used.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:08 +02:00
Felipe Balbi fd89149875 usb: phy: remove CONFIG_USB_OTG_UTILS
there are no more users of CONFIG_USB_OTG_UTILS
left in tree, we can remove it just fine.

[ kishon@ti.com : fixed a linking error due
	to original patch forgetting to change
	drivers/usb/Makefile ]

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:08 +02:00
Felipe Balbi edc7cb2e95 usb: phy: make it a menuconfig
We already have a considerable amount of USB
PHY drivers, making it a menuconfig just
prevents us from adding too much churn to
USB's menuconfig.

While at that, also select USB_OTG_UTILS from
this new menuconfig just to keep backwards
compatibility until we manage to remove
that symbol.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:05 +02:00
Felipe Balbi a0e631235a usb: phy: move all PHY drivers to drivers/usb/phy/
that's a much more reasonable location for
those drivers. It helps us saving drivers/usb/otg/
for when we actually start adding generic OTG
code.

Also completely delete drivers/usb/otg/ as there's
nothing left there.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:04 +02:00
Felipe Balbi 110ff6d041 usb: phy: convert EXPORT_SYMBOL to EXPORT_SYMBOL_GPL
we only want GPL users for our generic functions,
so let's switch over to EXPORT_SYMBOL_GPL.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:04 +02:00
Sascha Hauer cedf860237 usb: phy: move bulk of otg/otg.c to phy/phy.c
Most of otg/otg.c is not otg specific, but phy specific, so move it
to the phy directory.

Tested-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Reported-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:17:58 +02:00
Dmitry Torokhov 39d35681d5 USB: remove incorrect __exit markups
Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-15 11:45:16 -07:00