All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus
@ 2010-06-08  9:05 Ajay Kumar Gupta
  2010-06-08  9:05 ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Ajay Kumar Gupta
  2010-06-08 19:15 ` [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus Mike Frysinger
  0 siblings, 2 replies; 6+ messages in thread
From: Ajay Kumar Gupta @ 2010-06-08  9:05 UTC (permalink / raw)
  To: u-boot

MUSB PHY on OMAP3EVM Rev >= E uses external Vbus supply to support
500mA of power.We need to program MUSB PHY to use external Vbus
for this purpose.

Adding 'extvbus' member in musb_config structure which should be set
by all the boards where MUSB interface is using external Vbus supply.
Default value of 'extvbus' is being set to '0'.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
---
 drivers/usb/musb/davinci.c   |    1 +
 drivers/usb/musb/musb_core.c |    7 +++++++
 drivers/usb/musb/musb_core.h |   10 +++++++++-
 drivers/usb/musb/omap3.c     |    1 +
 4 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 8fbadc9..8c09bb3 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -30,6 +30,7 @@
 struct musb_config musb_cfg = {
 	(struct	musb_regs *)MENTOR_USB0_BASE,
 	DAVINCI_USB_TIMEOUT,
+	0,
 	0
 };
 
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 7766069..67f80a8 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -34,6 +34,7 @@ void musb_start(void)
 {
 #if defined(CONFIG_MUSB_HCD)
 	u8 devctl;
+	u8 busctl;
 #endif
 
 	/* disable all interrupts */
@@ -45,6 +46,12 @@ void musb_start(void)
 	/* put into basic highspeed mode and start session */
 	writeb(MUSB_POWER_HSENAB, &musbr->power);
 #if defined(CONFIG_MUSB_HCD)
+	/* Program PHY to use EXT VBUS if required */
+	if (musb_cfg.extvbus == 1) {
+		busctl = readb(&musbr->ulpi_busctl);
+		writeb(busctl | ULPI_USE_EXTVBUS, &musbr->ulpi_busctl);
+	}
+
 	devctl = readb(&musbr->devctl);
 	writeb(devctl | MUSB_DEVCTL_SESSION, &musbr->devctl);
 #endif
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 9a1fb4f..87c0d5a 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -112,7 +112,10 @@ struct musb_regs {
 	u16	rxfifoadd;
 	u32	vcontrol;
 	u16	hwvers;
-	u16	reserved2[5];
+	u16	reserved2a[1];
+	u8	ulpi_busctl;
+	u8	reserved2b[1];
+	u16	reserved2[3];
 	u8	epinfo;
 	u8	raminfo;
 	u8	linkinfo;
@@ -181,6 +184,10 @@ struct musb_regs {
 #define MUSB_DEVCTL_HR		0x02
 #define MUSB_DEVCTL_SESSION	0x01
 
+/* ULPI VBUSCONTROL */
+#define ULPI_USE_EXTVBUS	0x01
+#define ULPI_USE_EXTVBUSIND	0x02
+
 /* TESTMODE */
 #define MUSB_TEST_FORCE_HOST	0x80
 #define MUSB_TEST_FIFO_ACCESS	0x40
@@ -341,6 +348,7 @@ struct musb_config {
 	struct	musb_regs	*regs;
 	u32			timeout;
 	u8			musb_speed;
+	u8			extvbus;
 };
 
 /* externally defined data */
diff --git a/drivers/usb/musb/omap3.c b/drivers/usb/musb/omap3.c
index 3bfd0a0..4191d2e 100644
--- a/drivers/usb/musb/omap3.c
+++ b/drivers/usb/musb/omap3.c
@@ -38,6 +38,7 @@ static int platform_needs_initialization = 1;
 struct musb_config musb_cfg = {
 	(struct	musb_regs *)MENTOR_USB0_BASE,
 	OMAP3_USB_TIMEOUT,
+	0,
 	0
 };
 
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/3] omap3evm: Add board revision function
  2010-06-08  9:05 [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus Ajay Kumar Gupta
@ 2010-06-08  9:05 ` Ajay Kumar Gupta
  2010-06-08  9:05   ` [U-Boot] [PATCH 3/3] musb: Program extvbus for OMAP3EVM Rev >= E Ajay Kumar Gupta
                     ` (2 more replies)
  2010-06-08 19:15 ` [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus Mike Frysinger
  1 sibling, 3 replies; 6+ messages in thread
From: Ajay Kumar Gupta @ 2010-06-08  9:05 UTC (permalink / raw)
  To: u-boot

Added function to differentiate between the OMAP3EVM revisions. The
chip-id of the ethernet PHY is being used for this purpose.

Rev A to D : 0x01150000
Rev >= E   : 0x92200000

Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Sanjeev Premi <premi@ti.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
---
 board/ti/evm/evm.c |   30 ++++++++++++++++++++++++++++++
 board/ti/evm/evm.h |   14 ++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 0718a08..fcc1803 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -37,6 +37,33 @@
 #include <asm/mach-types.h>
 #include "evm.h"
 
+static u8 omap3_evm_version;
+
+u8 get_omap3_evm_rev(void)
+{
+	return omap3_evm_version;
+}
+
+static void omap3_evm_get_revision(void)
+{
+	unsigned int smsc_id;
+
+	/* Ethernet PHY ID is stored at ID_REV register */
+	smsc_id = readl(CONFIG_SMC911X_BASE + 0x50) & 0xFFFF0000;
+	printf("Read back SMSC id 0x%x\n", smsc_id);
+
+	switch (smsc_id) {
+	/* SMSC9115 chipset */
+	case 0x01150000:
+		omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
+		break;
+	/* SMSC 9220 chipset */
+	case 0x92200000:
+	default:
+		omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
+       }
+}
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -121,6 +148,9 @@ static void setup_net_chip(void)
 	writel(GPIO0, &gpio3_base->cleardataout);
 	udelay(1);
 	writel(GPIO0, &gpio3_base->setdataout);
+
+	/* determine omap3evm revision */
+	omap3_evm_get_revision();
 }
 
 int board_eth_init(bd_t *bis)
diff --git a/board/ti/evm/evm.h b/board/ti/evm/evm.h
index 37da29d..e2581f6 100644
--- a/board/ti/evm/evm.h
+++ b/board/ti/evm/evm.h
@@ -33,6 +33,20 @@ const omap3_sysinfo sysinfo = {
 #endif
 };
 
+/*
+ * OMAP35x EVM revision
+ * Run time detection of EVM revision is done by reading Ethernet
+ * PHY ID -
+ *      GEN_1   = 0x01150000
+ *      GEN_2   = 0x92200000
+ */
+enum {
+	OMAP3EVM_BOARD_GEN_1 = 0,	/* EVM Rev between  A - D */
+	OMAP3EVM_BOARD_GEN_2,		/* EVM Rev >= Rev E */
+};
+
+u8 get_omap3_evm_rev(void);
+
 static void setup_net_chip(void);
 
 /*
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 3/3] musb: Program extvbus for OMAP3EVM Rev >= E
  2010-06-08  9:05 ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Ajay Kumar Gupta
@ 2010-06-08  9:05   ` Ajay Kumar Gupta
  2010-06-08 18:13   ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Paulraj, Sandeep
  2010-06-08 19:09   ` Mike Frysinger
  2 siblings, 0 replies; 6+ messages in thread
From: Ajay Kumar Gupta @ 2010-06-08  9:05 UTC (permalink / raw)
  To: u-boot

OMAP3EVM Rev >=E uses external Vbus supply so setting 'extvbus'
to '1' for OMAP3EVM Rev >=E runtime based on EVM revision.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
---
 board/ti/evm/evm.c       |   13 +++++++++++++
 drivers/usb/musb/omap3.c |    3 +++
 drivers/usb/musb/omap3.h |    4 ++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index fcc1803..9948b9c 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -65,6 +65,19 @@ static void omap3_evm_get_revision(void)
 }
 
 /*
+ * MUSB port on OMAP3EVM Rev >= E requires extvbus programming.
+ */
+u8 omap3_evm_need_extvbus(void)
+{
+	u8 retval = 0;
+
+	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
+		retval = 1;
+
+	return retval;
+}
+
+/*
  * Routine: board_init
  * Description: Early hardware init.
  */
diff --git a/drivers/usb/musb/omap3.c b/drivers/usb/musb/omap3.c
index 4191d2e..4d1bdef 100644
--- a/drivers/usb/musb/omap3.c
+++ b/drivers/usb/musb/omap3.c
@@ -120,6 +120,9 @@ int musb_platform_init(void)
 		stdby &= ~OMAP3_OTG_FORCESTDBY_STANDBY;
 		writel(stdby, &otg->forcestdby);
 
+#ifdef CONFIG_OMAP3_EVM
+		musb_cfg.extvbus = omap3_evm_need_extvbus();
+#endif
 		platform_needs_initialization = 0;
 	}
 
diff --git a/drivers/usb/musb/omap3.h b/drivers/usb/musb/omap3.h
index b591862..c934e0c 100644
--- a/drivers/usb/musb/omap3.h
+++ b/drivers/usb/musb/omap3.h
@@ -44,4 +44,8 @@
 
 int musb_platform_init(void);
 
+#ifdef CONFIG_OMAP3_EVM
+extern u8 omap3_evm_use_extvbus(void);
+#endif
+
 #endif /* _MUSB_OMAP3_H */
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/3] omap3evm: Add board revision function
  2010-06-08  9:05 ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Ajay Kumar Gupta
  2010-06-08  9:05   ` [U-Boot] [PATCH 3/3] musb: Program extvbus for OMAP3EVM Rev >= E Ajay Kumar Gupta
@ 2010-06-08 18:13   ` Paulraj, Sandeep
  2010-06-08 19:09   ` Mike Frysinger
  2 siblings, 0 replies; 6+ messages in thread
From: Paulraj, Sandeep @ 2010-06-08 18:13 UTC (permalink / raw)
  To: u-boot



> Subject: [U-Boot] [PATCH 2/3] omap3evm: Add board revision function
> 
> Added function to differentiate between the OMAP3EVM revisions. The
> chip-id of the ethernet PHY is being used for this purpose.
> 
> Rev A to D : 0x01150000
> Rev >= E   : 0x92200000
> 
> Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
> Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>

Duplicate signoff.
Please cc the u-boot-usb custodian.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/3] omap3evm: Add board revision function
  2010-06-08  9:05 ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Ajay Kumar Gupta
  2010-06-08  9:05   ` [U-Boot] [PATCH 3/3] musb: Program extvbus for OMAP3EVM Rev >= E Ajay Kumar Gupta
  2010-06-08 18:13   ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Paulraj, Sandeep
@ 2010-06-08 19:09   ` Mike Frysinger
  2 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2010-06-08 19:09 UTC (permalink / raw)
  To: u-boot

On Tuesday, June 08, 2010 05:05:55 Ajay Kumar Gupta wrote:
> Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>

this are all invalid e-mails that need fixing
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100608/6e42ccd6/attachment.pgp 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus
  2010-06-08  9:05 [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus Ajay Kumar Gupta
  2010-06-08  9:05 ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Ajay Kumar Gupta
@ 2010-06-08 19:15 ` Mike Frysinger
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2010-06-08 19:15 UTC (permalink / raw)
  To: u-boot

On Tuesday, June 08, 2010 05:05:54 Ajay Kumar Gupta wrote:
> MUSB PHY on OMAP3EVM Rev >= E uses external Vbus supply to support
> 500mA of power.We need to program MUSB PHY to use external Vbus
> for this purpose.
> 
> Adding 'extvbus' member in musb_config structure which should be set
> by all the boards where MUSB interface is using external Vbus supply.
> Default value of 'extvbus' is being set to '0'.

*sigh* it looks like we're going to start hit the cross-platform build 
warnings/failures in u-boot that we're already hitting under Linux

> --- a/drivers/usb/musb/davinci.c
> +++ b/drivers/usb/musb/davinci.c
> @@ -30,6 +30,7 @@
>  struct musb_config musb_cfg = {
>  	(struct	musb_regs *)MENTOR_USB0_BASE,
>  	DAVINCI_USB_TIMEOUT,
> +	0,
>  	0
>  };

we should probably update the musb_cfg assignment style to used named members 
so that adding new fields doesnt screw up (as much) existing ports.  by using 
unamed initializers, a new field in the struct requires all assignments to be 
updated.  but if we used names here, than new fields are automatically 
assigned a value of 0.

> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -34,6 +34,7 @@ void musb_start(void)
>  {
>  #if defined(CONFIG_MUSB_HCD)
>  	u8 devctl;
> +	u8 busctl;
>  #endif
> 
>  	/* disable all interrupts */
> @@ -45,6 +46,12 @@ void musb_start(void)
>  	/* put into basic highspeed mode and start session */
>  	writeb(MUSB_POWER_HSENAB, &musbr->power);
>  #if defined(CONFIG_MUSB_HCD)
> +	/* Program PHY to use EXT VBUS if required */
> +	if (musb_cfg.extvbus == 1) {
> +		busctl = readb(&musbr->ulpi_busctl);
> +		writeb(busctl | ULPI_USE_EXTVBUS, &musbr->ulpi_busctl);
> +	}

not all MUSB users have ulpi support, so this needs to be abstracted out

> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -112,7 +112,10 @@ struct musb_regs {
>  	u16	rxfifoadd;
>  	u32	vcontrol;
>  	u16	hwvers;
> -	u16	reserved2[5];
> +	u16	reserved2a[1];
> +	u8	ulpi_busctl;
> +	u8	reserved2b[1];
> +	u16	reserved2[3];
>  	u8	epinfo;
>  	u8	raminfo;
>  	u8	linkinfo;

if you look just above the musb_regs struct, you'll see there is a hook for 
people to declare their own layout.  so the ulpi abstraction should be inside 
of this #ifdef.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100608/286a485f/attachment.pgp 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-06-08 19:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-08  9:05 [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus Ajay Kumar Gupta
2010-06-08  9:05 ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Ajay Kumar Gupta
2010-06-08  9:05   ` [U-Boot] [PATCH 3/3] musb: Program extvbus for OMAP3EVM Rev >= E Ajay Kumar Gupta
2010-06-08 18:13   ` [U-Boot] [PATCH 2/3] omap3evm: Add board revision function Paulraj, Sandeep
2010-06-08 19:09   ` Mike Frysinger
2010-06-08 19:15 ` [U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus Mike Frysinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.