USB: OMAP1: Tahvo USB support for 770
Subsystems (5)
Aaro Koskinen
maintainerv4 cover USB: OMAP1: Tahvo USB support for 770
Hi,
These patches add support for Tahvo USB transceiver and allow using both host and peripheral modes on Nokia 770.
Tested (peripheral mode, host mode, vbus detection) with 3.12-rc7.
History:
v4: Register sysfs files with sysfs_create_group().
Rename "vbus_state" to "vbus".
Document the sysfs ABI.
Add missing clk disable to extcon registration error path. Add missing extcon unregistration to probe error paths. Move IRQ registration after PHY registration.
v3: http://marc.info/?l=linux-omap&m=137157527930908&w=2
Delete accidental #include <mach/usb.h> from patch 3. Drop board file changes, already queued to linux-omap.
v2: http://marc.info/?l=linux-omap&m=137138976406242&w=2
Use extcon framework to trigger OTG driver mode changes.
v1: http://marc.info/?l=linux-omap&m=137081763029385&w=2
Earlier RFC versions:
http://marc.info/?l=linux-omap&m=136553710000679&w=2 http://marc.info/?l=linux-omap&m=136266725827698&w=2
Aaro Koskinen (4):
ARM: OMAP1: USB: move omap_usb_config to platform data
USB: OMAP1: add extcon to platform data
USB: OMAP1: OTG controller driver
USB: OMAP1: Tahvo USB transceiver driver
Documentation/ABI/testing/sysfs-platform-tahvo-usb | 16 + arch/arm/mach-omap1/include/mach/usb.h | 38 +- drivers/usb/phy/Kconfig | 25 ++ drivers/usb/phy/Makefile | 2 + drivers/usb/phy/phy-omap-otg.c | 169 ++++++++ drivers/usb/phy/phy-tahvo.c | 461 +++++++++++++++++++++ include/linux/platform_data/usb-omap1.h | 53 +++ 7 files changed, 727 insertions(+), 37 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-platform-tahvo-usb create mode 100644 drivers/usb/phy/phy-omap-otg.c create mode 100644 drivers/usb/phy/phy-tahvo.c create mode 100644 include/linux/platform_data/usb-omap1.h
Signature · 1 line
1.8.4.4
Aaro Koskinen
maintainerPATCH v4 1/4 ARM: OMAP1: USB: move omap_usb_config to platform data
Move omap_usb_config to platform data, so that OTG driver can include it.
--- arch/arm/mach-omap1/include/mach/usb.h | 38 +----------------------- include/linux/platform_data/usb-omap1.h | 51 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 37 deletions(-) create mode 100644 include/linux/platform_data/usb-omap1.h
arch/arm/mach-omap1/include/mach/usb.h +1 -37
@@ -8,43 +8,7 @@#define is_usb0_device (config) 0#endif -struct omap_usb_config { -/* Configure drivers according to the connectors on your board: -* - "A" connector (rectagular) -* ... for host/OHCI use, set "register_host". -* - "B" connector (squarish) or "Mini-B" -* ... for device/gadget use, set "register_dev". -* - "Mini-AB" connector (very similar to Mini-B) -* ... for OTG use as device OR host, initialize "otg" -*/ -unsigned register_host:1 ; -unsigned register_dev:1 ; -u8 otg;/* port number, 1-based: usb1 == 2 */ - -u8 hmc_mode; - -/* implicitly true if otg: host supports remote wakeup? */ -u8 rwc; - -/* signaling pins used to talk to transceiver on usbN: -* 0 == usbN unused -* 2 == usb0-only, using internal transceiver -* 3 == 3 wire bidirectional -* 4 == 4 wire bidirectional -* 6 == 6 wire unidirectional (or TLL) -*/ -u8 pins[3 ]; - -struct platform_device *udc_device; -struct platform_device *ohci_device; -struct platform_device *otg_device; - -u32 (*usb0_init)(unsigned nwires,unsigned is_device); -u32 (*usb1_init)(unsigned nwires); -u32 (*usb2_init)(unsigned nwires,unsigned alt_pingroup); - -int (*ocpi_enable)(void ); -}; +#include <linux/platform_data/usb-omap1.h> void omap_otg_init (struct omap_usb_config *config);
include/linux/platform_data/usb-omap1.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
1.8.4.4
Aaro Koskinen
maintainerPATCH v4 2/4 USB: OMAP1: add extcon to platform data
In reply to Aaro KoskinenAdd extcon field to platform data.
--- include/linux/platform_data/usb-omap1.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/platform_data/usb-omap1.h +2 -0
@@ -23,6 +23,8 @@ struct omap_usb_config { unsigned register_dev:1;u8 otg;/* port number, 1-based: usb1 == 2 */ +const char *extcon;/* extcon device for OTG */ +u8 hmc_mode;/* implicitly true if otg: host supports remote wakeup? */
Signature · 1 line
1.8.4.4
Aaro Koskinen
maintainerPATCH v4 3/4 USB: OMAP1: OTG controller driver
In reply to Aaro KoskinenTransceivers need to manage OTG controller state on OMAP1 to enable switching between peripheral and host modes. Provide a driver for that.
--- drivers/usb/phy/Kconfig | 10 +++ drivers/usb/phy/Makefile | 1 + drivers/usb/phy/phy-omap-otg.c | 169 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 drivers/usb/phy/phy-omap-otg.c
drivers/usb/phy/Kconfig +10 -0
@@ -154,6 +154,16 @@ config USB_GPIO_VBUS optionally control of a D+ pullup GPIO as well as a VBUS current limit regulator. +config OMAP_OTG + tristate "OMAP USB OTG controller driver" + depends on ARCH_OMAP_OTG && EXTCON + help + Enable this to support some transceivers on OMAP1 platforms. OTG + controller is needed to switch between host and peripheral modes. + + This driver can also be built as a module. If so, the module + will be called omap-otg. + config USB_ISP1301 tristate "NXP ISP1301 USB transceiver support" depends on USB || USB_GADGET
drivers/usb/phy/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o +obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o obj-$(CONFIG_OMAP_USB3) += phy-omap-usb3.o obj-$(CONFIG_SAMSUNG_USBPHY) += phy-samsung-usb.o
drivers/usb/phy/phy-omap-otg.c new file +169 -0
169 lines not on this page · raw message
Signature · 1 line
1.8.4.4
Aaro Koskinen
maintainerPATCH v4 4/4 USB: OMAP1: Tahvo USB transceiver driver
In reply to Aaro KoskinenAdd Tahvo USB transceiver driver.
Based on old code from linux-omap tree. The original driver was written by Juha Yrj?l?, Tony Lindgren, and Timo Ter?s.
--- Documentation/ABI/testing/sysfs-platform-tahvo-usb | 16 + drivers/usb/phy/Kconfig | 15 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/phy-tahvo.c | 461 +++++++++++++++++++++ 4 files changed, 493 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-tahvo-usb create mode 100644 drivers/usb/phy/phy-tahvo.c
Documentation/ABI/testing/sysfs-platform-tahvo-usb new file +16 -0
@@ -0,0 +1,16 @@ +What: /sys/bus/platform/devices/tahvo-usb/otg_mode +Date: December 2013 +Contact: Aaro Koskinen <[email protected]> +Description: + Set or read the current OTG mode. Valid values are "host" and + "peripheral". + + Reading: returns the current mode. + +What: /sys/bus/platform/devices/tahvo-usb/vbus +Date: December 2013 +Contact: Aaro Koskinen <[email protected]> +Description: + Read the current VBUS state. + + Reading: returns "on" or "off".
drivers/usb/phy/Kconfig +15 -0
@@ -164,6 +164,21 @@ config OMAP_OTG This driver can also be built as a module. If so, the module will be called omap-otg. +config TAHVO_USB + tristate "Tahvo USB transceiver driver" + depends on MFD_RETU && EXTCON + select USB_PHY + help + Enable this to support USB transceiver on Tahvo. This is used + at least on Nokia 770. + +config TAHVO_USB_HOST_BY_DEFAULT + depends on TAHVO_USB + boolean "Device in USB host mode by default" + help + Say Y here, if you want the device to enter USB host mode + by default on bootup. + config USB_ISP1301 tristate "NXP ISP1301 USB transceiver support" depends on USB || USB_GADGET
drivers/usb/phy/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_FSL_USB2_OTG) += phy-fsl-usb2.o obj-$(CONFIG_ISP1301_OMAP) += phy-isp1301-omap.o obj-$(CONFIG_MV_U3D_PHY) += phy-mv-u3d-usb.o obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o +obj-$(CONFIG_TAHVO_USB) += phy-tahvo.o obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
drivers/usb/phy/phy-tahvo.c new file +461 -0
461 lines not on this page · raw message
Signature · 1 line
1.8.4.4
PATCH v4 4/4 USB: OMAP1: Tahvo USB transceiver driver
Quoted 6 lines · Aaro Koskinen
Add Tahvo USB transceiver driver.
Based on old code from linux-omap tree. The original driver was written by Juha Yrj?l?, Tony Lindgren, and Timo Ter?s.
Signed-off-by Aaro Koskinen <[email protected]>
compile error:
CC [M] drivers/usb/phy/phy-tahvo.odrivers/usb/phy/phy-tahvo.c: In function ?tahvo_usb_probe?:drivers/usb/phy/phy-tahvo.c:371:2: error: too many arguments to function ?extcon_dev_register?
ret = extcon_dev_register(&tu->extcon, &pdev->dev);
^
In file included from drivers/usb/phy/phy-tahvo.c:26:0:include/linux/extcon.h:186:12: note: declared here
extern int extcon_dev_register(struct extcon_dev *edev);
^make[1]: *** [drivers/usb/phy/phy-tahvo.o] Error 1
make: *** [drivers/usb/phy/] Error 2
fixed it up with:
drivers/usb/phy/phy-tahvo.c +3 -1
@@ -368,7 +368,9 @@ static int tahvo_usb_probe(struct platform_device *pdev) tu->extcon.name =DRIVER_NAME ; tu->extcon.supported_cable = tahvo_cable; - ret =extcon_dev_register (&tu->extcon, &pdev->dev); + tu->extcon.dev.parent = &pdev->dev; + + ret =extcon_dev_register (&tu->extcon);if (ret) {dev_err (&pdev->dev,"could not register extcon device: %d\n" , ret);
please make sure it still works with v3.13-rc2 + this patch.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131206/328d1b3e/attachment.sig>
Aaro Koskinen
maintainerPATCH v4 4/4 USB: OMAP1: Tahvo USB transceiver driver
Hi,
Quoted 9 lines · Felipe Balbi
Quoted 6 lines · Aaro Koskinen
Add Tahvo USB transceiver driver.
Based on old code from linux-omap tree. The original driver was written by Juha Yrj?l?, Tony Lindgren, and Timo Ter?s.
Signed-off-by Aaro Koskinen <[email protected]>compile error:
[...]
Quoted 18 lines
fixed it up with:
drivers/usb/phy/phy-tahvo.c +3
-1@@ -368,7 +368,9 @@ static int tahvo_usb_probe(struct platform_device *pdev) tu->extcon.name =DRIVER_NAME ; tu->extcon.supported_cable = tahvo_cable; - ret =extcon_dev_register (&tu->extcon, &pdev->dev); + tu->extcon.dev.parent = &pdev->dev; + + ret =extcon_dev_register (&tu->extcon);if (ret) {dev_err (&pdev->dev,"could not register extcon device: %d\n" , ret);
Quoted 1 line
please make sure it still works with v3.13-rc2 + this patch.
Yes, that works fine with 3.13-rc2. Sorry for this, I was accidentally testing & basing these patches on an old branch.
A.
PATCH v4 4/4 USB: OMAP1: Tahvo USB transceiver driver
Hi,
Quoted 18 lines · Aaro Koskinen
Quoted 18 lines
fixed it up with:
drivers/usb/phy/phy-tahvo.c +3
-1@@ -368,7 +368,9 @@ static int tahvo_usb_probe(struct platform_device *pdev) tu->extcon.name =DRIVER_NAME ; tu->extcon.supported_cable = tahvo_cable; - ret =extcon_dev_register (&tu->extcon, &pdev->dev); + tu->extcon.dev.parent = &pdev->dev; + + ret =extcon_dev_register (&tu->extcon);if (ret) {dev_err (&pdev->dev,"could not register extcon device: %d\n" , ret);
Quoted 3 lines
Quoted 1 line
please make sure it still works with v3.13-rc2 + this patch.
Yes, that works fine with 3.13-rc2. Sorry for this, I was accidentally
cool, thanks :-)
Quoted 1 line
testing & basing these patches on an old branch.
no problem, s**t happens to everybody :-)
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131207/5bd6d1f9/attachment.sig>