usb: musb: add driver for control module
Subsystems (8)
cover usb: musb: add driver for control module
Added a new driver for the usb part of control module. This has an API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was previously done in omap glue and in omap-usb2 phy is removed.
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH folders, so If it has to be split I'll do it.
This series was developed ongit://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv
Did basic enumeration testing in omap4 beagle, omap4 sdp and omap3 beagle.
Kishon Vijay Abraham I (7):
drivers: usb: phy: add a new driver for usb part of control module
ARM: OMAP: devices: create device for usb part of control module
ARM: OMAP2: MUSB: Specify omap4 has mailbox
drivers: usb: start using the control module driver
ARM: dts: omap: Add usb_otg and glue data
ARM: dts: omap: Add omap-usb2 dt data
ARM: dts: omap: Add omap control usb data
Documentation/devicetree/bindings/usb/omap-usb.txt | 25 ++- Documentation/devicetree/bindings/usb/usb-phy.txt | 7 +- arch/arm/boot/dts/omap3-beagle-xm.dts | 6 + arch/arm/boot/dts/omap3-evm.dts | 6 + arch/arm/boot/dts/omap3-overo.dtsi | 6 + arch/arm/boot/dts/omap3.dtsi | 11 ++ arch/arm/boot/dts/omap4-panda.dts | 6 + arch/arm/boot/dts/omap4-sdp.dts | 6 + arch/arm/boot/dts/omap4.dtsi | 24 +++ arch/arm/mach-omap2/devices.c | 50 +++++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 13 -- arch/arm/mach-omap2/usb-musb.c | 3 + drivers/usb/musb/Kconfig | 1 + drivers/usb/musb/omap2430.c | 64 +++--- drivers/usb/musb/omap2430.h | 9 - drivers/usb/phy/Kconfig | 10 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/omap-control-usb.c | 204 ++++++++++++++++++++ drivers/usb/phy/omap-usb2.c | 38 +--- include/linux/usb/musb.h | 2 + include/linux/usb/omap_control_usb.h | 73 +++++++ include/linux/usb/omap_usb.h | 4 +- 22 files changed, 469 insertions(+), 100 deletions(-) create mode 100644 drivers/usb/phy/omap-control-usb.c create mode 100644 include/linux/usb/omap_control_usb.h
Signature · 1 line
1.7.9.5
RFC PATCH 1/7 drivers: usb: phy: add a new driver for usb part of control module
Added a new driver for the usb part of control module. This has an API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was previously done in omap glue and in omap-usb2 phy will be removed.
--- Documentation/devicetree/bindings/usb/omap-usb.txt | 21 +- drivers/usb/phy/Kconfig | 9 + drivers/usb/phy/Makefile | 1 + drivers/usb/phy/omap-control-usb.c | 204 ++++++++++++++++++++ include/linux/usb/omap_control_usb.h | 73 +++++++ 5 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/phy/omap-control-usb.c create mode 100644 include/linux/usb/omap_control_usb.h
Documentation/devicetree/bindings/usb/omap-usb.txt +20 -1
@@ -1,4 +1,4 @@ -OMAP GLUE +OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS OMAP MUSB GLUE - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
@@ -31,3 +31,22 @@ Board specific device node entry mode = <3>; power = <50>; }; + +OMAP CONTROL USB + +Required properties: + - compatible: Should be "ti,omap-control-usb" + - reg : Address and length of the register set for the device. It contains + the address of "control_dev_conf" and "otghs_control". + - reg-names: The names of the register addresses corresponding to the registers + filled in "reg". + - ti,has_mailbox: This is used to specify if the platform uses mailbox in + control module. + +omap_control_usb at 4a002300 { + compatible = "ti,omap-control-usb"; + reg = <0x4a002300 0x4>, + <0x4a00233c 0x4>; + reg-names = "control_dev_conf", "otghs_control"; + ti,has_mailbox; +};
drivers/usb/phy/Kconfig +9 -0
@@ -14,6 +14,15 @@ config OMAP_USB2 The USB OTG controller communicates with the comparator using this driver. +config OMAP_CONTROL_USB + tristate "OMAP CONTROL USB Driver" + depends on ARCH_OMAP2PLUS + help + Enable this to add support for the USB part present in the control + module. This driver has API to power on the PHY and to write to the + mailbox. The mailbox is present only in omap4 and the register to + power on the PHY is present in omap4 and omap5. + config USB_ISP1301 tristate "NXP ISP1301 USB transceiver support" depends on USB || USB_GADGET
drivers/usb/phy/Makefile +1 -0
@@ -5,6 +5,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG obj-$(CONFIG_OMAP_USB2) += omap-usb2.o +obj-$(CONFIG_OMAP_CONTROL_USB) += omap-control-usb.o obj-$(CONFIG_USB_ISP1301) += isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o
drivers/usb/phy/omap-control-usb.c new file +204 -0
204 lines not on this page · raw message
include/linux/usb/omap_control_usb.h new file +73 -0
73 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [RFC PATCH 1/7] drivers: usb: phy: add a new driver for usb part of control module
Documentation/devicetree/bindings/usb/omap-usb.txt Board specific device node entry · line 44
Quoted 10 lines · Kishon Vijay Abraham I
Documentation/devicetree/bindings/usb/omap-usb.txt +10
-0+OMAP CONTROL USB + +Required properties: + - compatible: Should be "ti,omap-control-usb" + - reg : Address and length of the register set for the device. It contains + the address of "control_dev_conf" and "otghs_control". + - reg-names: The names of the register addresses corresponding to the registers + filled in "reg". + - ti,has_mailbox: This is used to specify if the platform uses mailbox in + control module.
I wonder whether we need to have a phandle here to connect the control device to the actual usb device. What happens if you have multiple instances of each?
Arnd
Re: [RFC PATCH 1/7] drivers: usb: phy: add a new driver for usb part of control module
Hi Arnd,
Quoted 15 lines · Arnd Bergmann
Documentation/devicetree/bindings/usb/omap-usb.txt Board specific device node entry · line 44
Quoted 10 lines · Kishon Vijay Abraham I
Documentation/devicetree/bindings/usb/omap-usb.txt +10
-0+OMAP CONTROL USB + +Required properties: + - compatible: Should be "ti,omap-control-usb" + - reg : Address and length of the register set for the device. It contains + the address of "control_dev_conf" and "otghs_control". + - reg-names: The names of the register addresses corresponding to the registers + filled in "reg". + - ti,has_mailbox: This is used to specify if the platform uses mailbox in + control module.I wonder whether we need to have a phandle here to connect the control device to the actual usb device. What happens if you have multiple instances of each?
Good point :-). Currently, none of the OMAP platforms have multiple control modules and it doesn't seem to be in the future (AFAIK). While it might be simpler to support multiple control devices with phandle, it might face the same complications as faced by the USB PHY framework for non-dt boot.
Thanks
Kishon
Re: [RFC PATCH 1/7] drivers: usb: phy: add a new driver for usb part of control module
Quoted 6 lines · kishon
Good point :-). Currently, none of the OMAP platforms have multiple control modules and it doesn't seem to be in the future (AFAIK). While it might be simpler to support multiple control devices with phandle, it might face the same complications as faced by the USB PHY framework for non-dt boot.
Maybe you can put the phandle into the binding then but don't use it until hardware actually requires it. If anything needs it, then we can always change the code later, but it's harder to change the binding.
Arnd
RFC PATCH 2/7 ARM: OMAP: devices: create device for usb part of control module
In reply to Kishon Vijay Abraham IA seperate driver has been added to handle the usb part of control module. A device for the above driver is created here, using the register address information to be used by the driver for powering on the PHY and for writing to the mailbox.
--- arch/arm/mach-omap2/devices.c | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
arch/arm/mach-omap2/devices.c +50 -0
@@ -20,6 +20,7 @@#include <linux/pinctrl/machine.h> #include <linux/platform_data/omap4-keypad.h> #include <linux/platform_data/omap_ocp2scp.h> +#include <linux/usb/omap_control_usb.h> #include <asm/mach-types.h> #include <asm/mach/map.h>
@@ -254,6 +255,54 @@ static inline void omap_init_camera(void)#endif } +#if (defined(CONFIG_OMAP_CONTROL_USB ) || \ + defined(CONFIG_OMAP_CONTROL_USB_MODULE )) + +static struct omap_control_usb_platform_data omap4_control_usb_pdata = { + .has_mailbox = true, +}; + +struct resource omap4_control_usb_res[] = { + { + .name ="control_dev_conf" , + .start =0x4a002300 , + .end =0x4a002303 , + .flags =IORESOURCE_MEM , + }, + { + .name ="otghs_control" , + .start =0x4a00233c , + .end =0x4a00233f , + .flags =IORESOURCE_MEM , + }, +}; + +static struct platform_device omap4_control_usb = { + .name ="omap-control-usb" , + .id =-1 , + .dev = { + .platform_data = &omap4_control_usb_pdata, + }, + .num_resources =2 , + .resource = omap4_control_usb_res, +}; + +static inline void __init omap_init_control_usb (void ) +{ +int ret =0 ; + +if (cpu_is_omap44xx ()) { + ret =platform_device_register (&omap4_control_usb); +if (ret) +pr_err ("Error registering omap_control_usb device: %d\n" + , ret); + } +} + +#else +static inline void omap_init_control_usb (void ) { } +#endif /* CONFIG_OMAP_CONTROL_USB */ +int __init omap4_keyboard_init (struct omap4_keypad_platform_data *sdp4430_keypad_data,struct omap_board_data *bdata) {
@@ -721,6 +770,7 @@ static int __init omap2_init_devices(void)omap_init_mbox ();/* If dtb is there, the devices will be created dynamically */ if (!of_have_populated_dt ()) { +omap_init_control_usb ();omap_init_dmic ();omap_init_mcpdm ();omap_init_mcspi ();
Signature · 1 line
1.7.9.5
Re: [RFC PATCH 2/7] ARM: OMAP: devices: create device for usb part of control module
Hello.
Quoted 14 lines · Kishon Vijay Abraham I
A seperate driver has been added to handle the usb part of control module. A device for the above driver is created here, using the register address information to be used by the driver for powering on the PHY and for writing to the mailbox.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/devices.c | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)arch/arm/mach-omap2/devices.c +0
-0
[...]
arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 259
Quoted 6 lines
arch/arm/mach-omap2/devices.c +2
-0@@ -254,6 +255,54 @@ static inline void omap_init_camera(void)#endif } +#if (defined(CONFIG_OMAP_CONTROL_USB ) || \ + defined(CONFIG_OMAP_CONTROL_USB_MODULE ))
() around || not needed, and you're indenting the second line too much.
arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 292
Quoted 3 lines
arch/arm/mach-omap2/devices.c +3
-0+static inline void __init omap_init_control_usb (void ) +{ +int ret =0 ;
Initializer not needed.
arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 298
Quoted 6 lines
arch/arm/mach-omap2/devices.c +6
-0+ +if (cpu_is_omap44xx ()) { + ret =platform_device_register (&omap4_control_usb); +if (ret) +pr_err ("Error registering omap_control_usb device: %d\n" + , ret);
Please leave the comma on the previous line.
WBR, Sergei
Re: [RFC PATCH 2/7] ARM: OMAP: devices: create device for usb part of control module
Quoted 36 lines · Sergei Shtylyov
Hello.
Quoted 16 lines · Kishon Vijay Abraham I
A seperate driver has been added to handle the usb part of control module. A device for the above driver is created here, using the register address information to be used by the driver for powering on the PHY and for writing to the mailbox.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/devices.c | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)arch/arm/mach-omap2/devices.c +0
-0[...]
arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 259
Quoted 6 lines
arch/arm/mach-omap2/devices.c +2
-0@@ -254,6 +255,54 @@ static inline void omap_init_camera(void)#endif } +#if (defined(CONFIG_OMAP_CONTROL_USB ) || \ + defined(CONFIG_OMAP_CONTROL_USB_MODULE ))() around || not needed, and you're indenting the second line too much.arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 292
Quoted 3 lines
arch/arm/mach-omap2/devices.c +3
-0+static inline void __init omap_init_control_usb (void ) +{ +int ret =0 ;Initializer not needed.
Quoted 8 lines
arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 298
Quoted 6 lines
arch/arm/mach-omap2/devices.c +6
-0+ +if (cpu_is_omap44xx ()) { + ret =platform_device_register (&omap4_control_usb); +if (ret) +pr_err ("Error registering omap_control_usb device: %d\n" + , ret);Please leave the comma on the previous line.
Sure. I'll fix it.
Thanks
Kishon
Re: [RFC PATCH 2/7] ARM: OMAP: devices: create device for usb part of control module
Hello.
Quoted 41 lines · kishon
Quoted 40 lines · Kishon Vijay Abraham I
Quoted 17 lines
A seperate driver has been added to handle the usb part of control module. A device for the above driver is created here, using the register address information to be used by the driver for powering on the PHY and for writing to the mailbox.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/devices.c | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)arch/arm/mach-omap2/devices.c +0
-0[...]
arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 259
Quoted 6 lines
arch/arm/mach-omap2/devices.c +2
-0@@ -254,6 +255,54 @@ static inline void omap_init_camera(void)#endif } +#if (defined(CONFIG_OMAP_CONTROL_USB ) || \ + defined(CONFIG_OMAP_CONTROL_USB_MODULE ))() around || not needed, and you're indenting the second line too much.arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 292
Quoted 3 lines
arch/arm/mach-omap2/devices.c +3
-0+static inline void __init omap_init_control_usb (void ) +{ +int ret =0 ;Initializer not needed.
Quoted 6 lines
arch/arm/mach-omap2/devices.c +6
-0+ +if (cpu_is_omap44xx ()) { + ret =platform_device_register (&omap4_control_usb); +if (ret) +pr_err ("Error registering omap_control_usb device: %d\n" + , ret);
Quoted 3 lines
Quoted 1 line
Please leave the comma on the previous line.
Sure. I'll fix it.
Actually, you can use #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) now instead of
your above constuct.
WBR, Sergei
RFC PATCH 3/7 ARM: OMAP2: MUSB: Specify omap4 has mailbox
In reply to Kishon Vijay Abraham IAdded has_mailbox to the musb platform data to specify that omap uses an external mailbox (in control module) to communicate with the musb core during device connect and disconnect.
--- arch/arm/mach-omap2/usb-musb.c | 3 +++ include/linux/usb/musb.h | 2 ++ 2 files changed, 5 insertions(+)
arch/arm/mach-omap2/usb-musb.c +3 -0
@@ -85,6 +85,9 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data) musb_plat.mode = board_data->mode; musb_plat.extvbus = board_data->extvbus; +if (cpu_is_omap44xx ()) + musb_plat.has_mailbox = true; +if (soc_is_am35xx ()) { oh_name ="am35x_otg_hs" ; name ="musb-am35x" ;
include/linux/usb/musb.h +2 -0
@@ -99,6 +99,8 @@ struct musb_hdrc_platform_data {/* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ u8 mode; + u8 has_mailbox:1; +/* for clk_get() */ const char *clock;
Signature · 1 line
1.7.9.5
RFC PATCH 4/7 drivers: usb: start using the control module driver
In reply to Kishon Vijay Abraham IStart using the control module driver for powering on the PHY and for writing to the mailbox instead of writing to the control module registers on their own.
--- Documentation/devicetree/bindings/usb/omap-usb.txt | 4 ++ Documentation/devicetree/bindings/usb/usb-phy.txt | 7 +-- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 13 ---- drivers/usb/musb/Kconfig | 1 + drivers/usb/musb/omap2430.c | 64 ++++++++------------ drivers/usb/musb/omap2430.h | 9 --- drivers/usb/phy/Kconfig | 1 + drivers/usb/phy/omap-usb2.c | 38 +++--------- include/linux/usb/omap_usb.h | 4 +- 9 files changed, 42 insertions(+), 99 deletions(-)
Documentation/devicetree/bindings/usb/omap-usb.txt +4 -0
@@ -3,6 +3,9 @@ OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS OMAP MUSB GLUE - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb" - ti,hwmods : must be "usb_otg_hs" + - ti,has_mailbox : to specify that omap uses an external mailbox + (in control module) to communicate with the musb core during device connect + and disconnect. - multipoint : Should be "1" indicating the musb controller supports multipoint. This is a MUSB configuration-specific setting. - num_eps : Specifies the number of endpoints. This is also a
@@ -20,6 +23,7 @@ SOC specific device node entry usb_otg_hs: usb_otg_hs at 4a0ab000 { compatible = "ti,omap4-musb"; ti,hwmods = "usb_otg_hs"; + ti,has_mailbox; multipoint = <1>; num_eps = <16>; ram_bits = <12>;
Documentation/devicetree/bindings/usb/usb-phy.txt +2 -5
@@ -4,14 +4,11 @@ OMAP USB2 PHY Required properties: - compatible: Should be "ti,omap-usb2" - - reg : Address and length of the register set for the device. Also -add the address of control module dev conf register until a driver for -control module is added + - reg : Address and length of the register set for the device. This is usually a subnode of ocp2scp to which it is connected. usb2phy at 4a0ad080 { compatible = "ti,omap-usb2"; - reg = <0x4a0ad080 0x58>, - <0x4a002300 0x4>; + reg = <0x4a0ad080 0x58>; };
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -13
@@ -2698,13 +2698,6 @@ static struct resource omap44xx_usb_phy_and_pll_addrs[] = { .end = 0x4a0ae000, .flags = IORESOURCE_MEM, }, - { -/* XXX: Remove this once control module driver is in place */ - .name = "ctrl_dev", - .start = 0x4a002300, - .end = 0x4a002303, - .flags = IORESOURCE_MEM, - }, { } };
@@ -6152,12 +6145,6 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = { .pa_end = 0x4a0ab7ff, .flags = ADDR_TYPE_RT }, - { -/* XXX: Remove this once control module driver is in place */ - .pa_start = 0x4a00233c, - .pa_end = 0x4a00233f, - .flags = ADDR_TYPE_RT - }, { } };
drivers/usb/musb/Kconfig +1 -0
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX) select TWL4030_USB if MACH_OMAP_3430SDP select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA + select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA select USB_OTG_UTILS help Say Y here if your system has a dual role high speed USB
drivers/usb/musb/omap2430.c +25 -39
151 lines not on this page · raw message
drivers/usb/musb/omap2430.h +0 -9
@@ -49,13 +49,4 @@#define OTG_FORCESTDBY 0x414# define ENABLEFORCE (1 << 0) -/* -* Control Module bit definitions -* XXX: Will be removed once we have a driver for control module. -*/ -#define AVALID BIT(0) -#define BVALID BIT(1) -#define VBUSVALID BIT(2) -#define SESSEND BIT(3) -#define IDDIG BIT(4)#endif /* __MUSB_OMAP243X_H__ */
drivers/usb/phy/Kconfig +1 -0
@@ -8,6 +8,7 @@ config OMAP_USB2 tristate "OMAP USB2 PHY Driver" depends on ARCH_OMAP2PLUS select USB_OTG_UTILS + select OMAP_CONTROL_USB help Enable this to support the transceiver that is part of SOC. This driver takes care of all the PHY functionality apart from comparator.
drivers/usb/phy/omap-usb2.c +8 -30
@@ -27,6 +27,7 @@#include <linux/err.h> #include <linux/pm_runtime.h> #include <linux/delay.h> +#include <linux/usb/omap_control_usb.h> /** * omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -52,29 +53,6 @@ int omap_usb2_set_comparator(struct phy_companion *comparator) }EXPORT_SYMBOL_GPL (omap_usb2_set_comparator); -/** -* omap_usb_phy_power - power on/off the phy using control module reg -* @phy: struct omap_usb * -* @on: 0 or 1, based on powering on or off the PHY -* -* XXX: Remove this function once control module driver gets merged -*/ -static void omap_usb_phy_power (struct omap_usb *phy,int on) -{ -u32 val; - -if (on) { - val =readl (phy->control_dev); -if (val &PHY_PD ) { -writel (~PHY_PD , phy->control_dev); -/* XXX: add proper documentation for this delay */ -mdelay (200 ); - } - }else { -writel (PHY_PD , phy->control_dev); - } -} -static int omap_usb_set_vbus (struct usb_otg *otg,bool enabled) {struct omap_usb *phy =phy_to_omapusb (otg->phy);
@@ -124,7 +102,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)struct omap_usb *phy =phy_to_omapusb (x);if (suspend && !phy->is_suspended) { -omap_usb_phy_power (phy,0 ); +omap_control_usb_phy_power (phy->control_dev,0 );pm_runtime_put_sync (phy->dev); phy->is_suspended =1 ; }else if (!suspend && phy->is_suspended) {
@@ -134,7 +112,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend) ret);return ret; } -omap_usb_phy_power (phy,1 ); +omap_control_usb_phy_power (phy->control_dev,1 ); phy->is_suspended =0 ; }
@@ -168,14 +146,14 @@ static int omap_usb2_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); - phy->control_dev =devm_request_and_ioremap (&pdev->dev, res); -if (phy->control_dev ==NULL ) { -dev_err (&pdev->dev,"Failed to obtain io memory\n" ); -return -ENXIO ; + phy->control_dev =get_omap_control_dev (); +if (IS_ERR (phy->control_dev)) { +dev_dbg (&pdev->dev,"Failed to get control device\n" ); +return -ENODEV ; } phy->is_suspended =1 ; -omap_usb_phy_power (phy,0 ); +omap_control_usb_phy_power (phy->control_dev,0 ); otg->set_host = omap_usb_set_host; otg->set_peripheral = omap_usb_set_peripheral;
include/linux/usb/omap_usb.h +1 -3
@@ -25,13 +25,11 @@ struct omap_usb {struct usb_phy phy;struct phy_companion *comparator;struct device *dev; -u32 __iomem *control_dev; +struct device *control_dev;struct clk *wkupclk; u8 is_suspended:1; }; -#define PHY_PD 0x1 -#define phy_to_omapusb (x) container_of((x), struct omap_usb, phy)#if defined(CONFIG_OMAP_USB2 ) || defined(CONFIG_OMAP_USB2_MODULE )
Signature · 1 line
1.7.9.5
RFC PATCH 5/7 ARM: dts: omap: Add usb_otg and glue data
In reply to Kishon Vijay Abraham IAdd usb otg data node in omap4/omap3 device tree file. Also update the node with board specific setting in omapx-<board>.dts file. The dt data specifies among others the interface type (ULPI or UTMI), mode which is mostly OTG, power that specifies the amount of power this can supply when in host mode.
--- arch/arm/boot/dts/omap3-beagle-xm.dts | 6 ++++++ arch/arm/boot/dts/omap3-evm.dts | 6 ++++++ arch/arm/boot/dts/omap3-overo.dtsi | 6 ++++++ arch/arm/boot/dts/omap3.dtsi | 11 +++++++++++ arch/arm/boot/dts/omap4-panda.dts | 6 ++++++ arch/arm/boot/dts/omap4-sdp.dts | 6 ++++++ arch/arm/boot/dts/omap4.dtsi | 12 ++++++++++++ 7 files changed, 53 insertions(+)
arch/arm/boot/dts/omap3-beagle-xm.dts +6 -0
@@ -107,3 +107,9 @@ */ ti,pulldowns = <0x03a1c4>; }; + +&usb_otg_hs { + interface_type = <0>; + mode = <3>; + power = <50>; +};
arch/arm/boot/dts/omap3-evm.dts +6 -0
@@ -59,3 +59,9 @@ &twl_gpio { ti,use-leds; }; + +&usb_otg_hs { + interface_type = <0>; + mode = <3>; + power = <50>; +};
arch/arm/boot/dts/omap3-overo.dtsi +6 -0
@@ -55,3 +55,9 @@ &twl_gpio { ti,use-leds; }; + +&usb_otg_hs { + interface_type = <0>; + mode = <3>; + power = <50>; +};
arch/arm/boot/dts/omap3.dtsi +11 -0
@@ -397,5 +397,16 @@ ti,timer-alwon; ti,timer-secure; }; + + usb_otg_hs: usb_otg_hs at 480ab000 { + compatible = "ti,omap3-musb"; + reg = <0x480ab000 0x1000>; + interrupts = <0 92 0x4>, <0 93 0x4>; + interrupt-names = "mc", "dma"; + ti,hwmods = "usb_otg_hs"; + multipoint = <1>; + num_eps = <16>; + ram_bits = <12>; + }; }; };
arch/arm/boot/dts/omap4-panda.dts +6 -0
@@ -206,3 +206,9 @@ &twl_usb_comparator { usb-supply = <&vusb>; }; + +&usb_otg_hs { + interface_type = <1>; + mode = <3>; + power = <50>; +};
arch/arm/boot/dts/omap4-sdp.dts +6 -0
@@ -428,3 +428,9 @@ &twl_usb_comparator { usb-supply = <&vusb>; }; + +&usb_otg_hs { + interface_type = <1>; + mode = <3>; + power = <50>; +};
arch/arm/boot/dts/omap4.dtsi +12 -0
@@ -529,5 +529,17 @@ ti,hwmods = "timer11"; ti,timer-pwm; }; + + usb_otg_hs: usb_otg_hs at 4a0ab000 { + compatible = "ti,omap4-musb"; + reg = <0x4a0ab000 0x7ff>; + interrupts = <0 92 0x4>, <0 93 0x4>; + interrupt-names = "mc", "dma"; + ti,hwmods = "usb_otg_hs"; + multipoint = <1>; + num_eps = <16>; + ram_bits = <12>; + ti,has_mailbox; + }; }; };
Signature · 1 line
1.7.9.5
RFC PATCH 6/7 ARM: dts: omap: Add omap-usb2 dt data
In reply to Kishon Vijay Abraham IAdd omap-usb2 data node in omap4 device tree file. Since omap-usb2 is connected to ocp2scp, omap-usb2 dt data is added as a child node of ocp2scp.
--- arch/arm/boot/dts/omap4.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/omap4.dtsi +4 -0
@@ -438,6 +438,10 @@ #size-cells = <1>; ranges; ti,hwmods = "ocp2scp_usb_phy"; + usb2phy at 4a0ad080 { + compatible = "ti,omap-usb2"; + reg = <0x4a0ad080 0x58>; + }; }; timer1: timer at 4a318000 {
Signature · 1 line
1.7.9.5
RFC PATCH 7/7 ARM: dts: omap: Add omap control usb data
In reply to Kishon Vijay Abraham IAdd omap control usb data in omap4 device tree file. This will have the register address of registers to power on the PHY and to write to mailbox.
--- arch/arm/boot/dts/omap4.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/omap4.dtsi +8 -0
@@ -545,5 +545,13 @@ ram_bits = <12>; ti,has_mailbox; }; + + omap_control_usb at 4a002300 { + compatible = "ti,omap-control-usb"; + reg = <0x4a002300 0x4>, + <0x4a00233c 0x4>; + reg-names = "control_dev_conf", "otghs_control"; + ti,has_mailbox; + }; }; };
Signature · 1 line
1.7.9.5
Quoted 11 lines · Kishon Vijay Abraham I
Added a new driver for the usb part of control module. This has an API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was previously done in omap glue and in omap-usb2 phy is removed.
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH folders, so If it has to be split I'll do it.
The series looks good to me, I just had a minor comment on one patch.
One a somewhat related topic, I wonder whether there are any plans on your side to change this driver to support multiple bus glues to be built for one kernel image. With a multiplatform kernel, we may need all of TUSB6010/OMAP2PLUS/DSPS/UX500 for instance.
Arnd
Hi Arnd,
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · Kishon Vijay Abraham I
Added a new driver for the usb part of control module. This has an API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was previously done in omap glue and in omap-usb2 phy is removed.
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH folders, so If it has to be split I'll do it.
Quoted 6 lines
The series looks good to me, I just had a minor comment on one patch.
One a somewhat related topic, I wonder whether there are any plans on your side to change this driver to support multiple bus glues to be built for one kernel image. With a multiplatform kernel, we may need all of TUSB6010/OMAP2PLUS/DSPS/UX500 for instance.
We don't have plans as of now. I actually don't expect any changes in the driver other than the Kconfig changes. Anyways the probe of glue's other than the platform it's running won't get called. right Felipe?
Thanks
Kishon
Hi,
Quoted 23 lines · kishon
Hi Arnd,
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · Kishon Vijay Abraham I
Added a new driver for the usb part of control module. This has an API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was previously done in omap glue and in omap-usb2 phy is removed.
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH folders, so If it has to be split I'll do it.
Quoted 6 lines
The series looks good to me, I just had a minor comment on one patch.
One a somewhat related topic, I wonder whether there are any plans on your side to change this driver to support multiple bus glues to be built for one kernel image. With a multiplatform kernel, we may need all of TUSB6010/OMAP2PLUS/DSPS/UX500 for instance.
Quoted 4 lines
We don't have plans as of now. I actually don't expect any changes in the driver other than the
Kconfigchanges. Anyways the probe of glue's other than the platform it's running won't get called. right Felipe?
AFAICT there's nothing preventing those from being built together as long as you don't use DMA (yeah, that's a touchy subject still with MUSB).
If there are any build breaks, please report them so bus glue owners can fix. I see that at least the davinci folks need to work a bit
$ git grep -e "mach\/" drivers/usb/musb/ drivers/usb/musb/da8xx.c:#include <mach/da8xx.h> drivers/usb/musb/davinci.c:#include <mach/cputype.h> drivers/usb/musb/davinci.c:#include <mach/hardware.h>
I'm adding Ravi B to the loop here for those.
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/20130115/b9e42659/attachment.sig>
Quoted 30 lines
Hi,
Quoted 5 lines · kishon
Hi Arnd,
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Kishon Vijay Abraham I
Added a new driver for the usb part of control module.
This has an
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in
device mode.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Writing to control module registers for doing the above
task which
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
was previously done in omap glue and in omap-usb2 phy is removed.
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH
folders, so If it
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
has to be split I'll do it.
The series looks good to me, I just had a minor comment on
one patch.
Quoted 2 lines
Quoted 2 lines
One a somewhat related topic, I wonder whether there are
any plans on
Quoted 1 line
Quoted 1 line
your side to change this driver to support multiple bus
glues to be
Quoted 9 lines
Quoted 1 line
Quoted 1 line
built for one kernel image. With a multiplatform kernel,
we may need
Quoted 3 lines
Quoted 1 line
all of TUSB6010/OMAP2PLUS/DSPS/UX500 for instance.
We don't have plans as of now. I actually don't expect any
changes in
Quoted 1 line
the driver other than the
Kconfigchanges. Anyways theprobe of glue's
Quoted 1 line
other than the platform it's running won't get called. right Felipe?
If understand correctly the control module driver used to configure the respective usb phy of SoC to respective usb modes using the common set of control module APIs. What if, if control module interface (register defintions) varies b/w different revision or spin of same type of SoCs, if usbphy type is changed. In this case whether the single instance of control module driver is good enough to cater of all cpu types of same SoC series ? Whether cpu_is_xxx() can be used to differentiate b/w different cpu types in CM driver?
Quoted 19 lines
AFAICT there's nothing preventing those from being built together as long as you don't use DMA (yeah, that's a touchy subject still with MUSB).
If there are any build breaks, please report them so bus glue owners can fix. I see that at least the davinci folks need to work a bit
$ git grep -e "mach\/" drivers/usb/musb/ drivers/usb/musb/da8xx.c:#include <mach/da8xx.h> drivers/usb/musb/davinci.c:#include <mach/cputype.h> drivers/usb/musb/davinci.c:#include <mach/hardware.h>I'm adding Ravi B to the loop here for those.
--
balbi
Hi Ravi,
Quoted 34 lines · Ravi
Quoted 34 lines
Hi,
Quoted 5 lines · kishon
Hi Arnd,
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Kishon Vijay Abraham I
Added a new driver for the usb part of control module.
This has an
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in
device mode.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Writing to control module registers for doing the above
task which
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
was previously done in omap glue and in omap-usb2 phy is removed.
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH
folders, so If it
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
has to be split I'll do it.
The series looks good to me, I just had a minor comment on
one patch.
Quoted 2 lines
Quoted 2 lines
One a somewhat related topic, I wonder whether there are
any plans on
Quoted 1 line
Quoted 1 line
your side to change this driver to support multiple bus
glues to be
Quoted 1 line
Quoted 1 line
built for one kernel image. With a multiplatform kernel,
we may need
Quoted 2 lines
Quoted 1 line
all of TUSB6010/OMAP2PLUS/DSPS/UX500 for instance.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
We don't have plans as of now. I actually don't expect any
changes in
Quoted 1 line
the driver other than the
Kconfigchanges. Anyways theprobe of glue's
Quoted 1 line
other than the platform it's running won't get called. right Felipe?
If understand correctly the control module driver used to configure the respective usb phy of SoC to respective usb modes using the common set of control module APIs.
What if, if control module interface (register defintions) varies b/w different revision or spin of same type of SoCs, if usbphy type is changed. Well in that case, we can write to the registers based on the IP revision check (I think thats the common practice to do).
In this case whether the single instance of control module driver is good enough to cater of all cpu types of same SoC series ? Of course. I don't see why we can't have the same driver to handle different versions of the same IP.
The only reason where we might need multiple instance is if the SoC have multiple control module which Arnd already pointed out.
Quoted 1 line
Whether
cpu_is_xxx()can be used to differentiate b/w different cpu types in CM driver?
Not needed at all IMHO. We can use revision register to differentiate.
Btw I think Felipe looped you for a different reason ;-)
Thanks
Kishon
Quoted 57 lines · kishon
Hi Ravi,
Quoted 34 lines · Ravi
Quoted 34 lines
Hi,
Quoted 5 lines · kishon
Hi Arnd,
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Kishon Vijay Abraham I
Added a new driver for the usb part of control module.
This has an
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in
device mode.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Writing to control module registers for doing the above
task which
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
was previously done in omap glue and in omap-usb2 phy is removed.
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH
folders, so If it
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
has to be split I'll do it.
The series looks good to me, I just had a minor comment on
one patch.
Quoted 2 lines
Quoted 2 lines
One a somewhat related topic, I wonder whether there are
any plans on
Quoted 1 line
Quoted 1 line
your side to change this driver to support multiple bus
glues to be
Quoted 1 line
Quoted 1 line
built for one kernel image. With a multiplatform kernel,
we may need
Quoted 2 lines
Quoted 1 line
all of TUSB6010/OMAP2PLUS/DSPS/UX500 for instance.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
We don't have plans as of now. I actually don't expect any
changes in
Quoted 1 line
the driver other than the
Kconfigchanges. Anyways theprobe of glue's
Quoted 1 line
other than the platform it's running won't get called. right Felipe?
If understand correctly the control module driver used to configure the respective usb phy of SoC to respective usb modes using the common set of control module APIs.
What if, if control module interface (register defintions) varies b/w different revision or spin of same type of SoCs, if usbphy type is changed.
Well in that case, we can write to the registers based on the IP revision check (I think thats the common practice to do).In this case whether the single instance of control module driver is good enough to cater of all cpu types of same SoC series ? Of course. I don't see why we can't have the same driver to handle different versions of the same IP.
The only reason where we might need multiple instance is if the SoC have multiple control module which Arnd already pointed out.
Quoted 4 lines
Quoted 1 line
Whether
cpu_is_xxx()can be used to differentiate b/w different cpu types in CM driver?Not needed at all IMHO. We can use revision register to differentiate.
Btw I think Felipe looped you for a different reason ;-)
right, it was to look at removing <mach/*> inclusion from all davinci-link glue layers (they should be combined, btw).
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/20130116/6cf028ad/attachment.sig>
Hi,
Quoted 7 lines · Kishon Vijay Abraham I
Added a new driver for the usb part of control module. This has an API to power on the USB2 phy and an API to write to the mailbox depending on whether MUSB has to act in host mode or in device mode.
Writing to control module registers for doing the above task which was previously done in omap glue and in omap-usb2 phy is removed.
Quoted 8 lines
Also added the dt data to get MUSB working in OMAP platforms. This series has patches for both drivers and ARCH folders, so If it has to be split I'll do it.
This series was developed on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.gitxceivDid basic enumeration testing in omap4 beagle, omap4 sdp and omap3 beagle.
can you resend without RFC tag so I can apply ?
Thank you
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/20130118/353d7494/attachment-0001.sig>