USB: OMAP: Tahvo USB support for 770
Subsystems (5)
Aaro Koskinen
maintainercover USB: OMAP: 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.10-rc4.
Aaro Koskinen (3):
ARM: OMAP1: nokia770: enable Tahvo
USB: OMAP: add omap-otg
USB: OMAP: Tahvo USB transceiver driver
arch/arm/mach-omap1/board-nokia770.c | 10 + drivers/usb/phy/Kconfig | 24 ++ drivers/usb/phy/Makefile | 2 + drivers/usb/phy/phy-omap-otg.c | 126 ++++++++++ drivers/usb/phy/phy-tahvo.c | 429 ++++++++++++++++++++++++++++++++++ include/linux/usb/omap-otg.h | 19 ++ 6 files changed, 610 insertions(+) create mode 100644 drivers/usb/phy/phy-omap-otg.c create mode 100644 drivers/usb/phy/phy-tahvo.c create mode 100644 include/linux/usb/omap-otg.h
Signature · 1 line
1.7.10.4
Aaro Koskinen
maintainerPATCH 1/3 ARM: OMAP1: nokia770: enable Tahvo
Add platform data for Tahvo.
--- arch/arm/mach-omap1/board-nokia770.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-omap1/board-nokia770.c +10 -0
@@ -234,16 +234,26 @@ static struct i2c_board_info nokia770_i2c_board_info_2[] __initdata = { {I2C_BOARD_INFO ("retu-mfd" ,0x01 ), }, + { + I2C_BOARD_INFO("tahvo-mfd", 0x02), + }, };static void __init nokia770_cbus_init (void ) {const int retu_irq_gpio =62 ; +const int tahvo_irq_gpio =40 ;if (gpio_request_one (retu_irq_gpio,GPIOF_IN ,"Retu IRQ" ))return ; +if (gpio_request_one (tahvo_irq_gpio,GPIOF_IN ,"Tahvo IRQ" )) { +gpio_free (retu_irq_gpio); +return ; + }irq_set_irq_type (gpio_to_irq (retu_irq_gpio),IRQ_TYPE_EDGE_RISING ); +irq_set_irq_type (gpio_to_irq (tahvo_irq_gpio),IRQ_TYPE_EDGE_RISING ); nokia770_i2c_board_info_2[0 ].irq =gpio_to_irq (retu_irq_gpio); + nokia770_i2c_board_info_2[1 ].irq =gpio_to_irq (tahvo_irq_gpio);i2c_register_board_info (2 , nokia770_i2c_board_info_2,ARRAY_SIZE (nokia770_i2c_board_info_2));platform_device_register (&nokia770_cbus_device);
Signature · 1 line
1.7.10.4
Aaro Koskinen
maintainerPATCH 2/3 USB: OMAP: add omap-otg
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 | 126 ++++++++++++++++++++++++++++++++++++++++ include/linux/usb/omap-otg.h | 19 ++++++ 4 files changed, 156 insertions(+) create mode 100644 drivers/usb/phy/phy-omap-otg.c create mode 100644 include/linux/usb/omap-otg.h
drivers/usb/phy/Kconfig +10 -0
@@ -135,6 +135,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 + 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_ISP1301_OMAP) += phy-isp1301-omap.o obj-$(CONFIG_MV_U3D_PHY) += phy-mv-u3d-usb.o obj-$(CONFIG_NOP_USB_XCEIV) += phy-nop.o obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.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 +126 -0
126 lines not on this page · raw message
include/linux/usb/omap-otg.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* OMAP OTG driver +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive for +* more details. +*/ +#ifndef __LINUX_OMAP_OTG_H +#define __LINUX_OMAP_OTG_H + +enum omap_otg_mode { +OMAP_OTG_MODE_DEVICE , +OMAP_OTG_MODE_HOST , +OMAP_OTG_MODE_DISCONNECT , +}; + +void omap_otg_set_mode (enum omap_otg_mode mode); + +#endif /* __LINUX_OMAP_OTG_H */
Signature · 1 line
1.7.10.4
PATCH 2/3 USB: OMAP: add omap-otg
Hi,
Quoted 22 lines · Aaro Koskinen
drivers/usb/phy/phy-omap-otg.c new file +22
-0+void omap_otg_set_mode (enum omap_otg_mode mode) +{ +if (!otg_dev) { +WARN (1 ,"%s: controller not present\n" , __func__); +return ; + } +mutex_lock (&otg_dev->serialize); +switch (mode) { +case OMAP_OTG_MODE_DEVICE : +/* +* Set B-session valid. +*/ +omap_otg_ctrl (OMAP_OTG_ID |OMAP_OTG_BSESSVLD ); +break ; +case OMAP_OTG_MODE_HOST : +/* +* Set A-session valid. +*/ +omap_otg_ctrl (OMAP_OTG_ASESSVLD ); +break ; +case OMAP_OTG_MODE_DISCONNECT : +/*
drivers/usb/phy/phy-omap-otg.c line 86
Quoted 10 lines
drivers/usb/phy/phy-omap-otg.c new file +10
-0+* Set B-session end to indicate no VBUS. +*/ +omap_otg_ctrl (OMAP_OTG_ID |OMAP_OTG_BSESSEND ); +break ; +default : +WARN (1 ,"%s: unknown mode: %d\n" , __func__, mode); + } +mutex_unlock (&otg_dev->serialize); +} +EXPORT_SYMBOL_GPL (omap_otg_set_mode);
looks like this should provide a extcon interface for its users.
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/20130612/0e3e9e91/attachment.sig>
Aaro Koskinen
maintainerPATCH 2/3 USB: OMAP: add omap-otg
Hi,
Quoted 27 lines · Felipe Balbi
Quoted 26 lines · Aaro Koskinen
drivers/usb/phy/phy-omap-otg.c new file +26
-0+void omap_otg_set_mode (enum omap_otg_mode mode) +{ +if (!otg_dev) { +WARN (1 ,"%s: controller not present\n" , __func__); +return ; + } +mutex_lock (&otg_dev->serialize); +switch (mode) { +case OMAP_OTG_MODE_DEVICE : +/* +* Set B-session valid. +*/ +omap_otg_ctrl (OMAP_OTG_ID |OMAP_OTG_BSESSVLD ); +break ; +case OMAP_OTG_MODE_HOST : +/* +* Set A-session valid. +*/ +omap_otg_ctrl (OMAP_OTG_ASESSVLD ); +break ; +case OMAP_OTG_MODE_DISCONNECT : +/* +* Set B-session end to indicate no VBUS. +*/ +omap_otg_ctrl (OMAP_OTG_ID |OMAP_OTG_BSESSEND ); +break ;
Quoted 8 lines
drivers/usb/phy/phy-omap-otg.c line 86
Quoted 6 lines
drivers/usb/phy/phy-omap-otg.c new file +6
-0+default : +WARN (1 ,"%s: unknown mode: %d\n" , __func__, mode); + } +mutex_unlock (&otg_dev->serialize); +} +EXPORT_SYMBOL_GPL (omap_otg_set_mode);looks like this should provide a extcon interface for its users.
Is there any examples available? Anyway, I'll look into this.
Thanks,
A.
PATCH 2/3 USB: OMAP: add omap-otg
Hi,
Quoted 39 lines · Aaro Koskinen
Hi,
Quoted 27 lines · Felipe Balbi
Quoted 26 lines · Aaro Koskinen
drivers/usb/phy/phy-omap-otg.c new file +26
-0+void omap_otg_set_mode (enum omap_otg_mode mode) +{ +if (!otg_dev) { +WARN (1 ,"%s: controller not present\n" , __func__); +return ; + } +mutex_lock (&otg_dev->serialize); +switch (mode) { +case OMAP_OTG_MODE_DEVICE : +/* +* Set B-session valid. +*/ +omap_otg_ctrl (OMAP_OTG_ID |OMAP_OTG_BSESSVLD ); +break ; +case OMAP_OTG_MODE_HOST : +/* +* Set A-session valid. +*/ +omap_otg_ctrl (OMAP_OTG_ASESSVLD ); +break ; +case OMAP_OTG_MODE_DISCONNECT : +/* +* Set B-session end to indicate no VBUS. +*/ +omap_otg_ctrl (OMAP_OTG_ID |OMAP_OTG_BSESSEND ); +break ;Quoted 8 lines
drivers/usb/phy/phy-omap-otg.c line 86
Quoted 6 lines
drivers/usb/phy/phy-omap-otg.c new file +6
-0+default : +WARN (1 ,"%s: unknown mode: %d\n" , __func__, mode); + } +mutex_unlock (&otg_dev->serialize); +} +EXPORT_SYMBOL_GPL (omap_otg_set_mode);looks like this should provide a extcon interface for its users.
Quoted 1 line
Is there any examples available? Anyway, I'll look into this.
In extcon tree there are some patches from Kishon adding that to dwc3-omap.c :-)
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/20130614/46d8465b/attachment.sig>
Aaro Koskinen
maintainerPATCH 3/3 USB: OMAP: 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.
--- drivers/usb/phy/Kconfig | 14 ++ drivers/usb/phy/Makefile | 1 + drivers/usb/phy/phy-tahvo.c | 429 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 444 insertions(+) create mode 100644 drivers/usb/phy/phy-tahvo.c
drivers/usb/phy/Kconfig +14 -0
@@ -145,6 +145,20 @@ 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 && OMAP_OTG + 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
@@ -13,6 +13,7 @@ phy-fsl-usb2-objs := phy-fsl-usb.o phy-fsm-usb.o 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_TAHVO_USB) += phy-tahvo.o obj-$(CONFIG_NOP_USB_XCEIV) += phy-nop.o obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o
drivers/usb/phy/phy-tahvo.c new file +429 -0
429 lines not on this page · raw message
Signature · 1 line
1.7.10.4