Skip to contentSkip to conversation

usb: musb: Add support for ti81xx platform

PATCH Superseded Ajay Kumar Gupta 5 participants 12 messages Feb 8, 2012 – Feb 13, 2012 4 messages not in the archive

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

A message that is not in the archive (sent off-list or not yet received): 1328675212-29693-2-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#3 lore raw

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

Hi,

Quoted 39 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 +11 -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

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

Quoted 10 lines
arch/arm/mach-omap2/omap_phy_internal.c +3 -1
+					| 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;
 

Please remove all the cpu_is_xxxx calls from the *_phy_power functions. You should need those only in *_phy_init to set the right flags once, not every time you enable or disable the phy.

Regards,

Tony
--
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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

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

Hi,

Quoted 41 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 15 lines

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

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;
 

Please remove all the cpu_is_xxxx calls from the *_phy_power functions. You should need those only in *_phy_init to set the right flags once, not every time you enable or disable the phy.

Tony,

This is a common function used by ti814x, ti816x and am335x and they have mostly the same bit map but a few bits are different so we would need to have cpu_is_xxxx.

We use this *_phy_power(1) for phy on/init and *_phy_power(0) for phy off and don't have separate *_phy_init(). Even in that case we would require cpu_is_xxxx() as phy power down bit is different for ti816x and same for ti814x and am335x.

Please let me know how should we handle this.

Regards,
Ajay

Quoted 4 lines

Regards,

Tony

--
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

#6 lore raw

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

Hi,

Quoted 64 lines · Ajay Kumar

Hi,

Quoted 41 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 15 lines

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

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;
 

Please remove all the cpu_is_xxxx calls from the *_phy_power functions. You should need those only in *_phy_init to set the right flags once, not every time you enable or disable the phy.

Tony,

This is a common function used by ti814x, ti816x and am335x and they have mostly the same bit map but a few bits are different so we would need to have cpu_is_xxxx.

Quoted 6 lines

We use this *_phy_power(1) for phy on/init and *_phy_power(0) for phy off and don't have separate *_phy_init(). Even in that case we would require cpu_is_xxxx() as phy power down bit is different for ti816x and same for ti814x and am335x.

Please let me know how should we handle this.

use cpu_is_xxxx() to set a flag, and check on the flag.

Signature · 1 line
balbi
#7 lore raw

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

Hi,

Quoted 79 lines · Ajay Kumar
Quoted 7 lines

Hi,

Quoted 6 lines · Ajay Kumar Gupta
Quoted 5 lines

Switch on the phy for am335x.

---
 arch/arm/mach-omap2/omap_phy_internal.c |   21 ++++++++++++++----

---

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-

Quoted 4 lines
 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 7 lines

index 4c90477..7129408 100644

arch/arm/mach-omap2/omap_phy_internal.c +0 -0
@@ -266,7 +266,11 @@ void ti81xx_musb_phy_power(u8 on)
 	void __iomem *scm_base = NULL;
 	u32 usbphycfg;
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-omap2/omap_phy_internal.c +5 -1
-	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) {
Quoted 8 lines

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

Quoted 8 lines
arch/arm/mach-omap2/omap_phy_internal.c +0 -2
 		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

Quoted 2 lines
Quoted 2 lines

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

Quoted 2 lines
arch/arm/mach-omap2/omap_phy_internal.c +0 -2
-				| USBPHY_DPINPUT | USBPHY_DMINPUT);
-			usbphycfg |= (USBPHY_OTGVDET_EN |

USBPHY_OTGSESSEND_EN

Quoted 3 lines
Quoted 3 lines

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

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

USBPHY_OTG_PWRDN);

Quoted 1 line
Quoted 1 line

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

Quoted 1 line
arch/arm/mach-omap2/omap_phy_internal.c +1 -0
+			usbphycfg |= USBPHY_OTGVDET_EN |

USBPHY_OTGSESSEND_EN;

Quoted 13 lines
Quoted 13 lines

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

Quoted 2 lines
arch/arm/mach-omap2/omap_phy_internal.c +2 -0
+			if (cpu_is_ti814x()) {
+				usbphycfg &= ~(USBPHY_DPINPUT |

USBPHY_DMINPUT);

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

Quoted 10 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
Quoted 3 lines
Quoted 1 line

Please remove all the cpu_is_xxxx calls from the *_phy_power

functions.

Quoted 15 lines
Quoted 2 lines

You should need those only in *_phy_init to set the right flags once, not every time you enable or disable the phy.

Tony,

This is a common function used by ti814x, ti816x and am335x and they have mostly the same bit map but a few bits are different so we would need to have cpu_is_xxxx.

We use this *_phy_power(1) for phy on/init and *_phy_power(0) for phy off and don't have separate *_phy_init(). Even in that case we would require
cpu_is_xxxx() as phy power down bit is different for ti816x and same for ti814x and am335x.

Quoted 3 lines
Quoted 1 line

Please let me know how should we handle this.

use cpu_is_xxxx() to set a flag, and check on the flag.

Are you saying save the flags once in a local static flag and use the same later on?

Ajay

Quoted 3 lines

--
balbi

#8 lore raw

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

Quoted 80 lines · Ajay Kumar

Hi,

Quoted 79 lines · Ajay Kumar
Quoted 7 lines

Hi,

Quoted 6 lines · Ajay Kumar Gupta
Quoted 5 lines

Switch on the phy for am335x.

---
 arch/arm/mach-omap2/omap_phy_internal.c |   21 ++++++++++++++----

---

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-

Quoted 4 lines
 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 7 lines

index 4c90477..7129408 100644

arch/arm/mach-omap2/omap_phy_internal.c +0 -0
@@ -266,7 +266,11 @@ void ti81xx_musb_phy_power(u8 on)
 	void __iomem *scm_base = NULL;
 	u32 usbphycfg;
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-omap2/omap_phy_internal.c +5 -1
-	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) {
Quoted 8 lines

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

Quoted 8 lines
arch/arm/mach-omap2/omap_phy_internal.c +0 -2
 		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

Quoted 2 lines
Quoted 2 lines

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

Quoted 2 lines
arch/arm/mach-omap2/omap_phy_internal.c +0 -2
-				| USBPHY_DPINPUT | USBPHY_DMINPUT);
-			usbphycfg |= (USBPHY_OTGVDET_EN |

USBPHY_OTGSESSEND_EN

Quoted 3 lines
Quoted 3 lines

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

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

USBPHY_OTG_PWRDN);

Quoted 1 line
Quoted 1 line

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

Quoted 1 line
arch/arm/mach-omap2/omap_phy_internal.c +1 -0
+			usbphycfg |= USBPHY_OTGVDET_EN |

USBPHY_OTGSESSEND_EN;

Quoted 13 lines
Quoted 13 lines

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

Quoted 2 lines
arch/arm/mach-omap2/omap_phy_internal.c +2 -0
+			if (cpu_is_ti814x()) {
+				usbphycfg &= ~(USBPHY_DPINPUT |

USBPHY_DMINPUT);

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

Quoted 10 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
Quoted 3 lines
Quoted 1 line

Please remove all the cpu_is_xxxx calls from the *_phy_power

functions.

Quoted 15 lines
Quoted 2 lines

You should need those only in *_phy_init to set the right flags once, not every time you enable or disable the phy.

Tony,

This is a common function used by ti814x, ti816x and am335x and they have mostly the same bit map but a few bits are different so we would need to have cpu_is_xxxx.

We use this *_phy_power(1) for phy on/init and *_phy_power(0) for phy off and don't have separate *_phy_init(). Even in that case we would require
cpu_is_xxxx() as phy power down bit is different for ti816x and same for ti814x and am335x.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Please let me know how should we handle this.

use cpu_is_xxxx() to set a flag, and check on the flag.

Are you saying save the flags once in a local static flag and use the same later on?

that's correct.

Signature · 1 line
balbi
#9 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

A message that is not in the archive (sent off-list or not yet received): 1328675212-29693-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org

#11 lore raw
Quoted 16 lines · Ajay Kumar Gupta
drivers/usb/musb/musb_dsps.c new file +16 -0
+static int dsps_musb_init(struct musb *musb)
+{
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *plat = dev->platform_data;
+	struct platform_device *pdev = to_platform_device(dev->parent);
+	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	const struct dsps_musb_wrapper *wrp = glue->wrp;
+	struct omap_musb_board_data *data = plat->board_data;
+	void __iomem *reg_base = musb->ctrl_base;
+	u32 rev, val;
+	int status;
+
+	/* mentor core register starts at offset of 0x400 from musb base */
+	musb->mregs += wrp->musb_core_offset;
+
+	/* NOP driver needs change if supporting dual instance */

drivers/usb/musb/musb_dsps.c line 387

Quoted 10 lines
drivers/usb/musb/musb_dsps.c new file +10 -0
+	usb_nop_xceiv_register();
+	musb->xceiv = otg_get_transceiver();
+	if (!musb->xceiv)
+		return -ENODEV;
+
+	status = pm_runtime_get_sync(dev);
+	if (status < 0) {
+		dev_err(dev, "pm_runtime_get_sync FAILED");
+		goto err0;
+	}

So you are doing a get_sync at init and you cut the clocks at exit only. Any particular reason for that.

Quoted 1 line

+

--
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

#12 lore raw
Quoted 21 lines · Shubhrajyoti
Quoted 20 lines · Ajay Kumar Gupta
drivers/usb/musb/musb_dsps.c new file +20 -0
+static int dsps_musb_init(struct musb *musb)
+{
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *plat = dev->platform_data;
+	struct platform_device *pdev = to_platform_device(dev->parent);
+	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	const struct dsps_musb_wrapper *wrp = glue->wrp;
+	struct omap_musb_board_data *data = plat->board_data;
+	void __iomem *reg_base = musb->ctrl_base;
+	u32 rev, val;
+	int status;
+
+	/* mentor core register starts at offset of 0x400 from musb base */
+	musb->mregs += wrp->musb_core_offset;
+
+	/* NOP driver needs change if supporting dual instance */
+	usb_nop_xceiv_register();
+	musb->xceiv = otg_get_transceiver();
+	if (!musb->xceiv)
+		return -ENODEV;
Quoted 8 lines

drivers/usb/musb/musb_dsps.c line 387

Quoted 6 lines
drivers/usb/musb/musb_dsps.c new file +6 -0
+
+	status = pm_runtime_get_sync(dev);
+	if (status < 0) {
+		dev_err(dev, "pm_runtime_get_sync FAILED");
+		goto err0;
+	}

So you are doing a get_sync at init and you cut the clocks at exit only. Any particular reason for that.

that's a very good question. We're just adding a brand new file, which is clean and stuff... so we might as well start with good PM capabilities.

Signature · 1 line
balbi
#13 lore raw

Hi,

Quoted 29 lines · Shubhrajyoti
Quoted 5 lines · Ajay Kumar Gupta
Quoted 4 lines
drivers/usb/musb/musb_dsps.c new file +4 -0
+static int dsps_musb_init(struct musb *musb) {
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *plat = dev->platform_data;
+	struct platform_device *pdev = to_platform_device(dev->parent);
Quoted 8 lines

drivers/usb/musb/musb_dsps.c

Quoted 8 lines
drivers/usb/musb/musb_dsps.c new file +8 -0
+	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	const struct dsps_musb_wrapper *wrp = glue->wrp;
+	struct omap_musb_board_data *data = plat->board_data;
+	void __iomem *reg_base = musb->ctrl_base;
+	u32 rev, val;
+	int status;
+
+	/* mentor core register starts at offset of 0x400 from musb base

*/

Quoted 6 lines
Quoted 6 lines
drivers/usb/musb/musb_dsps.c new file +6 -0
+	musb->mregs += wrp->musb_core_offset;
+
+	/* NOP driver needs change if supporting dual instance */
+	usb_nop_xceiv_register();
+	musb->xceiv = otg_get_transceiver();
+	if (!musb->xceiv)
Quoted 8 lines

drivers/usb/musb/musb_dsps.c line 387

Quoted 7 lines
drivers/usb/musb/musb_dsps.c new file +7 -0
+		return -ENODEV;
+
+	status = pm_runtime_get_sync(dev);
+	if (status < 0) {
+		dev_err(dev, "pm_runtime_get_sync FAILED");
+		goto err0;
+	}

So you are doing a get_sync at init and you cut the clocks at exit

Quoted 2 lines

only.

Quoted 1 line

Any particular reason for that.

This is a platform glue layer and main io paths are in musb_core.c/musb_host.c and musb_gadget.c. Host controller driver's bus_suspend/resume are in musb_host.c.

What specific pm implementation are you looking for?

Ajay

Quoted 7 lines

that's a very good question. We're just adding a brand new file, which is clean and stuff... so we might as well start with good PM capabilities.

--
balbi

A message that is not in the archive (sent off-list or not yet received): 47CEF8C4B26E8C44B22B028A650E0EA9317F03C8-Er742YJ7I/eIQmiDNMet8wC/[email protected]

#15 lore raw

Hi,

Quoted 32 lines
Quoted 7 lines · Shubhrajyoti
Quoted 5 lines · Ajay Kumar Gupta

drivers/usb/musb/musb_dsps.c

Quoted 4 lines
drivers/usb/musb/musb_dsps.c new file +4 -0
+static int dsps_musb_init(struct musb *musb) {
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *plat = dev->platform_data;
+	struct platform_device *pdev = to_platform_device(dev-

parent);

Quoted 8 lines
Quoted 8 lines

drivers/usb/musb/musb_dsps.c

Quoted 8 lines
drivers/usb/musb/musb_dsps.c new file +8 -0
+	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	const struct dsps_musb_wrapper *wrp = glue->wrp;
+	struct omap_musb_board_data *data = plat->board_data;
+	void __iomem *reg_base = musb->ctrl_base;
+	u32 rev, val;
+	int status;
+
+	/* mentor core register starts at offset of 0x400 from musb

base

Quoted 16 lines

*/

Quoted 6 lines
Quoted 6 lines
drivers/usb/musb/musb_dsps.c new file +6 -0
+	musb->mregs += wrp->musb_core_offset;
+
+	/* NOP driver needs change if supporting dual instance */
+	usb_nop_xceiv_register();
+	musb->xceiv = otg_get_transceiver();
+	if (!musb->xceiv)
Quoted 8 lines

drivers/usb/musb/musb_dsps.c line 387

Quoted 7 lines
drivers/usb/musb/musb_dsps.c new file +7 -0
+		return -ENODEV;
+
+	status = pm_runtime_get_sync(dev);
+	if (status < 0) {
+		dev_err(dev, "pm_runtime_get_sync FAILED");
+		goto err0;
+	}

So you are doing a get_sync at init and you cut the clocks at exit

only.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Any particular reason for that.

This is a platform glue layer and main io paths are in musb_core.c/musb_host.c
and musb_gadget.c. Host controller driver's bus_suspend/resume are in musb_host.c.

What specific pm implementation are you looking for?

The current patch calls pm_runtime_get_sync() for musb "device" and that is anyway getting done in common core file musb_core.c.

Glue layer file need to call pm_runtime_get_sync() and x_put() for glue "device" during init and exit.

I will resubmit this patch with above change.

Ajay

Quoted 7 lines

Ajay

Quoted 5 lines

that's a very good question. We're just adding a brand new file, which is clean and stuff... so we might as well start with good PM capabilities.

Quoted 6 lines
Quoted 2 lines

--
balbi

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

--
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