Skip to contentSkip to conversation

usb: musb: Add support for ti81xx platform

PATCH New Ajay Kumar Gupta 3 participants 5 messages Feb 8, 2012 – Mar 12, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/3 usb: musb: Add support for ti81xx platform

TI81XX platform has two musb interfaces and uses CPPI4.1 DMA engine. It has builtin USB PHYs as AM35x. The current set of patches adds support for one instance and only in PIO mode.

---
These three patches are refreshed version of patches submitted at [1]
[1] http://marc.info/?l=linux-usb&m=131833237711364&w=2

Among 8 patches at [1] three got already merged [1/8,2/8,3/8] and two of them have been dropped [4/8 and 6/8].

I am resubmitting the rest three patches [5/8, 7/8, 8/8] after refreshing them against today's linus's tree with below monor change in 5/8.

Changes fron v4:
- Added DT match device as Felipe suggested.

 drivers/usb/musb/Kconfig     |    8 +-
 drivers/usb/musb/Makefile    |    1 +
 drivers/usb/musb/musb_core.c |    4 +-
 drivers/usb/musb/musb_dsps.c |  707 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 718 insertions(+), 2 deletions(-)
 create mode 100644 drivers/usb/musb/musb_dsps.c
drivers/usb/musb/Kconfig +7 -1
index f70cab3..126c220 100644
@@ -8,6 +8,7 @@ config USB_MUSB_HDRC
 	tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
 	depends on USB && USB_GADGET
 	select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
+	select NOP_USB_XCEIV if SOC_OMAPTI81XX
 	select TWL4030_USB if MACH_OMAP_3430SDP
 	select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
 	select USB_OTG_UTILS
@@ -54,6 +55,10 @@ config USB_MUSB_AM35X
 	tristate "AM35x"
 	depends on ARCH_OMAP
 
+config USB_MUSB_DSPS
+	tristate "TI DSPS platforms"
+	depends on SOC_OMAPTI81XX
+
 config USB_MUSB_BLACKFIN
 	tristate "Blackfin"
 	depends on (BF54x && !BF544) || (BF52x && ! BF522 && !BF523)
@@ -70,7 +75,8 @@ choice
 	default USB_INVENTRA_DMA if USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN
 	default USB_TI_CPPI_DMA if USB_MUSB_DAVINCI
 	default USB_TUSB_OMAP_DMA if USB_MUSB_TUSB6010
-	default MUSB_PIO_ONLY if USB_MUSB_TUSB6010 || USB_MUSB_DA8XX || USB_MUSB_AM35X
+	default MUSB_PIO_ONLY if USB_MUSB_TUSB6010 || USB_MUSB_DA8XX || USB_MUSB_AM35X \
+				|| USB_MUSB_DSPS
 	help
 	  Unfortunately, only one option can be enabled here. Ideally one
 	  should be able to build all these drivers into one kernel to
drivers/usb/musb/Makefile +1 -0
index 88bfb9d..3b85871 100644
@@ -13,6 +13,7 @@ musb_hdrc-$(CONFIG_DEBUG_FS)			+= musb_debugfs.o
 # Hardware Glue Layer
 obj-$(CONFIG_USB_MUSB_OMAP2PLUS)		+= omap2430.o
 obj-$(CONFIG_USB_MUSB_AM35X)			+= am35x.o
+obj-$(CONFIG_USB_MUSB_DSPS)			+= musb_dsps.o
 obj-$(CONFIG_USB_MUSB_TUSB6010)			+= tusb6010.o
 obj-$(CONFIG_USB_MUSB_DAVINCI)			+= davinci.o
 obj-$(CONFIG_USB_MUSB_DA8XX)			+= da8xx.o
drivers/usb/musb/musb_core.c +3 -1
index 3d11cf6..fd733bf 100644
@@ -1016,7 +1016,9 @@ static void musb_shutdown(struct platform_device *pdev)
 	|| defined(CONFIG_USB_MUSB_OMAP2PLUS)		\
 	|| defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)	\
 	|| defined(CONFIG_USB_MUSB_AM35X)		\
-	|| defined(CONFIG_USB_MUSB_AM35X_MODULE)
+	|| defined(CONFIG_USB_MUSB_AM35X_MODULE)	\
+	|| defined(CONFIG_USB_MUSB_DSPS)		\
+	|| defined(CONFIG_USB_MUSB_DSPS_MODULE)
 static ushort __initdata fifo_mode = 4;
 #elif defined(CONFIG_USB_MUSB_UX500)			\
 	|| defined(CONFIG_USB_MUSB_UX500_MODULE)
drivers/usb/musb/musb_dsps.c new file +707 -0

707 lines not on this page · raw message

Signature · 6 lines
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH v5 2/3 arm: omap: am335x: enable phy controls

Switch on the phy for am335x.

---
 arch/arm/mach-omap2/omap_phy_internal.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/omap_phy_internal.c +14 -7
index 4c90477..7129408 100644
@@ -266,7 +266,11 @@ void ti81xx_musb_phy_power(u8 on)
 	void __iomem *scm_base = NULL;
 	u32 usbphycfg;
 
-	scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
+	if (cpu_is_ti81xx())
+		scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
+	else if (cpu_is_am33xx())
+		scm_base = ioremap(AM33XX_SCM_BASE, SZ_2K);
+
 	if (!scm_base) {
 		pr_err("system control module ioremap failed\n");
 		return;
@@ -278,16 +282,19 @@ void ti81xx_musb_phy_power(u8 on)
 		if (cpu_is_ti816x()) {
 			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
 			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
-		} else if (cpu_is_ti814x()) {
-			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-				| USBPHY_DPINPUT | USBPHY_DMINPUT);
-			usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-				| USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
+		} else if (cpu_is_ti814x() || cpu_is_am33xx()) {
+			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
+			usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+			if (cpu_is_ti814x()) {
+				usbphycfg &= ~(USBPHY_DPINPUT | USBPHY_DMINPUT);
+				usbphycfg |= USBPHY_DPOPBUFCTL
+					| USBPHY_DMOPBUFCTL;
+			}
 		}
 	} else {
 		if (cpu_is_ti816x())
 			usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
-		else if (cpu_is_ti814x())
+		else if (cpu_is_ti814x() || cpu_is_am33xx())
 			usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
 
 	}
Signature · 1 line
1.7.0.4
maintainer
#2 lore raw

Re: [PATCH 2/3 v5] arm: omap: am335x: enable phy controls

Quoted 40 lines · Ajay Kumar Gupta

Switch on the phy for am335x.

---
 arch/arm/mach-omap2/omap_phy_internal.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/omap_phy_internal.c +12 -6
index 4c90477..7129408 100644
@@ -266,7 +266,11 @@ void ti81xx_musb_phy_power(u8 on)
 	void __iomem *scm_base = NULL;
 	u32 usbphycfg;
 
-	scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
+	if (cpu_is_ti81xx())
+		scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
+	else if (cpu_is_am33xx())
+		scm_base = ioremap(AM33XX_SCM_BASE, SZ_2K);
+
 	if (!scm_base) {
 		pr_err("system control module ioremap failed\n");
 		return;
@@ -278,16 +282,19 @@ void ti81xx_musb_phy_power(u8 on)
 		if (cpu_is_ti816x()) {
 			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
 			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
-		} else if (cpu_is_ti814x()) {
-			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-				| USBPHY_DPINPUT | USBPHY_DMINPUT);
-			usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-				| USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
+		} else if (cpu_is_ti814x() || cpu_is_am33xx()) {
+			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
+			usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+			if (cpu_is_ti814x()) {
+				usbphycfg &= ~(USBPHY_DPINPUT | USBPHY_DMINPUT);
+				usbphycfg |= USBPHY_DPOPBUFCTL
+					| USBPHY_DMOPBUFCTL;

arch/arm/mach-omap2/omap_phy_internal.c void ti81xx_musb_phy_power(u8 on) · line 300

Quoted 10 lines
arch/arm/mach-omap2/omap_phy_internal.c +2 -1
+			}
 		}
 	} else {
 		if (cpu_is_ti816x())
 			usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
-		else if (cpu_is_ti814x())
+		else if (cpu_is_ti814x() || cpu_is_am33xx())
 			usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
 
 	}

Hmm I think I might have commented on this earlier.. But anyways, please change the code so cpu_is_xxxx tests are done only once during the init, not every time phy_power gets called.

So initialize something in phy_init so things get set for the board that's booted.

Regards,

Tony

#3 lore raw

RE: [PATCH 2/3 v5] arm: omap: am335x: enable phy controls

Hi Tony,

Quoted 52 lines · Ajay Kumar Gupta

arch/arm/mach-

Quoted 8 lines

Switch on the phy for am335x.

---
 arch/arm/mach-omap2/omap_phy_internal.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_phy_internal.c +0 -0

omap2/omap_phy_internal.c

Quoted 20 lines

index 4c90477..7129408 100644

arch/arm/mach-omap2/omap_phy_internal.c +5 -1
@@ -266,7 +266,11 @@ void ti81xx_musb_phy_power(u8 on)
 	void __iomem *scm_base = NULL;
 	u32 usbphycfg;
 
-	scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
+	if (cpu_is_ti81xx())
+		scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
+	else if (cpu_is_am33xx())
+		scm_base = ioremap(AM33XX_SCM_BASE, SZ_2K);
+
 	if (!scm_base) {
 		pr_err("system control module ioremap failed\n");
 		return;
@@ -278,16 +282,19 @@ void ti81xx_musb_phy_power(u8 on)
 		if (cpu_is_ti816x()) {
 			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
 			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;

arch/arm/mach-omap2/omap_phy_internal.c void ti81xx_musb_phy_power(u8 on) · line 289

Quoted 10 lines
arch/arm/mach-omap2/omap_phy_internal.c +5 -5
-		} else if (cpu_is_ti814x()) {
-			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-				| USBPHY_DPINPUT | USBPHY_DMINPUT);
-			usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-				| USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
+		} else if (cpu_is_ti814x() || cpu_is_am33xx()) {
+			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
+			usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+			if (cpu_is_ti814x()) {
+				usbphycfg &= ~(USBPHY_DPINPUT |

USBPHY_DMINPUT);

Quoted 11 lines
arch/arm/mach-omap2/omap_phy_internal.c +4 -1
+				usbphycfg |= USBPHY_DPOPBUFCTL
+					| USBPHY_DMOPBUFCTL;
+			}
 		}
 	} else {
 		if (cpu_is_ti816x())
 			usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
-		else if (cpu_is_ti814x())
+		else if (cpu_is_ti814x() || cpu_is_am33xx())
 			usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
 
Quoted 3 lines

arch/arm/mach-omap2/omap_phy_internal.c void ti81xx_musb_phy_power(u8 on) · line 300

Quoted 1 line
arch/arm/mach-omap2/omap_phy_internal.c +0 -0
 	}

Hmm I think I might have commented on this earlier..

Yes, you have already provided this comment and I need to post the updated patches.

Quoted 6 lines

But anyways,
please change the code so cpu_is_xxxx tests are done only once during the init, not every time phy_power gets called.

So initialize something in phy_init so things get set for the board that's booted.

I will send the updated patches soon.

Thanks,
Ajay

Quoted 4 lines

Regards,

Tony

#4 lore raw

PATCH v5 3/3 usb: musb: enable support for am335x

In reply to Ajay Kumar Gupta

Enabled the flag so that musb_dsps glue file can be used for am335x

---
 drivers/usb/musb/Kconfig |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb/Kconfig +2 -2
index 126c220..ef0c3f9 100644
@@ -8,7 +8,7 @@ config USB_MUSB_HDRC
 	tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
 	depends on USB && USB_GADGET
 	select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
-	select NOP_USB_XCEIV if SOC_OMAPTI81XX
+	select NOP_USB_XCEIV if (SOC_OMAPTI81XX || SOC_OMAPAM33XX)
 	select TWL4030_USB if MACH_OMAP_3430SDP
 	select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
 	select USB_OTG_UTILS
@@ -57,7 +57,7 @@ config USB_MUSB_AM35X
 
 config USB_MUSB_DSPS
 	tristate "TI DSPS platforms"
-	depends on SOC_OMAPTI81XX
+	depends on SOC_OMAPTI81XX || SOC_OMAPAM33XX
 
 config USB_MUSB_BLACKFIN
 	tristate "Blackfin"
Signature · 1 line
1.7.0.4