Skip to contentSkip to conversation

musb: Add host support for DM365 EVM

PATCH Superseded Prathap Srinivas 3 participants 6 messages Jan 8, 2010 – Jan 25, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 musb: Add host support for DM365 EVM

Add support for musb host on DM365 EVM.

---
 drivers/usb/musb/davinci.c         |   18 +++++++++++++++-
 drivers/usb/musb/davinci.h         |    1 +
 include/configs/davinci_dm365evm.h |   40 ++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletions(-)
drivers/usb/musb/davinci.c +17 -1
index a7648fc..6a56d72 100644
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include "davinci.h"
+#include <asm/arch/hardware.h>
 
 /* MUSB platform configuration */
 struct musb_config musb_cfg = {
@@ -41,10 +42,24 @@ struct davinci_usb_regs *dregs;
 static u8 phy_on(void)
 {
 	u32 timeout;
+	u32 val;
 
 	/* Wait until the USB phy is turned on */
+#ifdef DAVINCI_DM365EVM
+	writel(USBPHY_PHY24MHZ | USBPHY_SESNDEN |
+			USBPHY_VBDTCTEN, USBPHY_CTL_PADDR);
+#else
 	writel(USBPHY_SESNDEN | USBPHY_VBDTCTEN, USBPHY_CTL_PADDR);
+#endif
 	timeout = musb_cfg.timeout;
+
+#ifdef DAVINCI_DM365EVM
+	/* Set the ownership of GIO33 to USB */
+	val = readl(PINMUX4);
+	val &= ~(PINMUX4_USBDRVBUS_BITCLEAR);
+	val |= PINMUX4_USBDRVBUS_BITSET;
+	writel(val, PINMUX4);
+#endif
 	while (timeout--)
 		if (readl(USBPHY_CTL_PADDR) & USBPHY_PHYCLKGD)
 			return 1;
@@ -70,8 +85,9 @@ int musb_platform_init(void)
 	u32  revision;
 
 	/* enable USB VBUS */
+#ifndef DAVINCI_DM365EVM
 	enable_vbus();
-
+#endif
 	/* start the on-chip USB phy and its pll */
 	if (!phy_on())
 		return -1;
drivers/usb/musb/davinci.h +1 -0
index f6751bf..e0829d6 100644
@@ -63,6 +63,7 @@ struct davinci_usb_regs {
 
 /* Integrated highspeed/otg PHY */
 #define USBPHY_CTL_PADDR	(DAVINCI_SYSTEM_MODULE_BASE + 0x34)
+#define USBPHY_PHY24MHZ 	(1 << 13)
 #define USBPHY_PHYCLKGD 	(1 << 8)
 #define USBPHY_SESNDEN		(1 << 7)	/* v(sess_end) comparator */
 #define USBPHY_VBDTCTEN 	(1 << 6)	/* v(bus) comparator */
include/configs/davinci_dm365evm.h +40 -0
index c01426b..e58de93 100644
@@ -86,6 +86,46 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE	1
 #define CONFIG_SYS_NAND_MAX_CHIPS	2
 
+#define PINMUX4_USBDRVBUS_BITCLEAR       0x3000
+#define PINMUX4_USBDRVBUS_BITSET         0x2000
+
+/* USB Configuration */
+#define CONFIG_USB_DAVINCI
+#define CONFIG_MUSB_HCD
+
+#ifdef CONFIG_USB_DAVINCI
+#define CONFIG_CMD_USB         /* include support for usb      */
+#define CONFIG_CMD_STORAGE     /* include support for usb      */
+#define CONFIG_CMD_FAT         /* include support for FAT/storage*/
+#define CONFIG_DOS_PARTITION   /* include support for FAT/storage*/
+#endif
+
+#ifdef CONFIG_MUSB_HCD         /* include support for usb host */
+#define CONFIG_CMD_USB         /* include support for usb cmd */
+#define CONFIG_USB_STORAGE     /* MSC class support */
+#define CONFIG_CMD_STORAGE     /* inclue support for usb-storage cmd */
+#define CONFIG_CMD_FAT         /* inclue support for FAT/storage */
+#define CONFIG_DOS_PARTITION   /* inclue support for FAT/storage */
+
+#ifdef CONFIG_USB_KEYBOARD     /* HID class support */
+#define CONFIG_SYS_USB_EVENT_POLL
+
+#define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+#define CONFIG_USB_DEVICE              1
+#define CONFIG_USB_TTY                 1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV   1
+#define CONFIG_USBD_VENDORID           0x0451
+#define CONFIG_USBD_PRODUCTID          0x5678
+#define CONFIG_USBD_MANUFACTURER       "Texas Instruments"
+#define CONFIG_USBD_PRODUCT_NAME       "DM365VM"
+#endif /* CONFIG_MUSB_UDC */
+
+
+
 /* U-Boot command configuration */
 #include <config_cmd_default.h>
 
Signature · 1 line
1.6.2.4
#1 lore raw

PATCH 1/1 musb: Add host support for DM365 EVM

Hi,

I have put some comments inline:

Review struct davinci_usb_regs *dregs; · line 45

Quoted 5 lines
(quoted diff) +1 -0
@@ -41,10 +42,24 @@ struct davinci_usb_regs *dregs;
 ?static u8 phy_on(void)
 ?{
 ? ? ? ?u32 timeout;
+ ? ? ? u32 val;

This variable is only used when DAVINCI_DM365EVM is set, so it will produce a warning if it is not set.

Quoted 80 lines

? ? ? ?/* Wait until the USB phy is turned on */

drivers/usb/musb/davinci.c +4 -0
+#ifdef DAVINCI_DM365EVM
+ ? ? ? writel(USBPHY_PHY24MHZ | USBPHY_SESNDEN |
+ ? ? ? ? ? ? ? ? ? ? ? USBPHY_VBDTCTEN, USBPHY_CTL_PADDR);
+#else

? ? ? ?writel(USBPHY_SESNDEN | USBPHY_VBDTCTEN, USBPHY_CTL_PADDR); +#endif
? ? ? ?timeout = musb_cfg.timeout;

(quoted diff) +8 -0
+
+#ifdef DAVINCI_DM365EVM
+ ? ? ? /* Set the ownership of GIO33 to USB */
+ ? ? ? val = readl(PINMUX4);
+ ? ? ? val &= ~(PINMUX4_USBDRVBUS_BITCLEAR);
+ ? ? ? val |= PINMUX4_USBDRVBUS_BITSET;
+ ? ? ? writel(val, PINMUX4);
+#endif

? ? ? ?while (timeout--)
? ? ? ? ? ? ? ?if (readl(USBPHY_CTL_PADDR) & USBPHY_PHYCLKGD) ? ? ? ? ? ? ? ? ? ? ? ?return 1;

(quoted diff) +0 -0
@@ -70,8 +85,9 @@ int musb_platform_init(void)
 ? ? ? ?u32 ?revision;
 

? ? ? ?/* enable USB VBUS */
+#ifndef DAVINCI_DM365EVM
? ? ? ?enable_vbus();

drivers/usb/musb/davinci.c +1 -1
-
+#endif

? ? ? ?/* start the on-chip USB phy and its pll */ ? ? ? ?if (!phy_on())
? ? ? ? ? ? ? ?return -1;

drivers/usb/musb/davinci.h +0 -0
index f6751bf..e0829d6 100644
@@ -63,6 +63,7 @@ struct davinci_usb_regs {
 

?/* Integrated highspeed/otg PHY */
?#define USBPHY_CTL_PADDR ? ? ? (DAVINCI_SYSTEM_MODULE_BASE + 0x34) +#define USBPHY_PHY24MHZ ? ? ? ?(1 << 13)
?#define USBPHY_PHYCLKGD ? ? ? ?(1 << 8)
?#define USBPHY_SESNDEN ? ? ? ? (1 << 7) ? ? ? ?/* v(sess_end) comparator */ ?#define USBPHY_VBDTCTEN ? ? ? ?(1 << 6) ? ? ? ?/* v(bus) comparator */

include/configs/davinci_dm365evm.h +0 -0
index c01426b..e58de93 100644
@@ -86,6 +86,46 @@

?#define CONFIG_SYS_MAX_NAND_DEVICE ? ? 1
?#define CONFIG_SYS_NAND_MAX_CHIPS ? ? ?2

include/configs/davinci_dm365evm.h +30 -0
+#define PINMUX4_USBDRVBUS_BITCLEAR ? ? ? 0x3000
+#define PINMUX4_USBDRVBUS_BITSET ? ? ? ? 0x2000
+
+/* USB Configuration */
+#define CONFIG_USB_DAVINCI
+#define CONFIG_MUSB_HCD
+
+#ifdef CONFIG_USB_DAVINCI
+#define CONFIG_CMD_USB ? ? ? ? /* include support for usb ? ? ?*/
+#define CONFIG_CMD_STORAGE ? ? /* include support for usb ? ? ?*/
+#define CONFIG_CMD_FAT ? ? ? ? /* include support for FAT/storage*/
+#define CONFIG_DOS_PARTITION ? /* include support for FAT/storage*/
+#endif
+
+#ifdef CONFIG_MUSB_HCD ? ? ? ? /* include support for usb host */
+#define CONFIG_CMD_USB ? ? ? ? /* include support for usb cmd */
+#define CONFIG_USB_STORAGE ? ? /* MSC class support */
+#define CONFIG_CMD_STORAGE ? ? /* inclue support for usb-storage cmd */
+#define CONFIG_CMD_FAT ? ? ? ? /* inclue support for FAT/storage */
+#define CONFIG_DOS_PARTITION ? /* inclue support for FAT/storage */
+
+#ifdef CONFIG_USB_KEYBOARD ? ? /* HID class support */
+#define CONFIG_SYS_USB_EVENT_POLL
+
+#define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+#define CONFIG_USB_DEVICE ? ? ? ? ? ? ?1

include/configs/davinci_dm365evm.h line 128

Quoted 10 lines
include/configs/davinci_dm365evm.h +10 -0
+#define CONFIG_USB_TTY ? ? ? ? ? ? ? ? 1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV ? 1
+#define CONFIG_USBD_VENDORID ? ? ? ? ? 0x0451
+#define CONFIG_USBD_PRODUCTID ? ? ? ? ?0x5678
+#define CONFIG_USBD_MANUFACTURER ? ? ? "Texas Instruments"
+#define CONFIG_USBD_PRODUCT_NAME ? ? ? "DM365VM"
+#endif /* CONFIG_MUSB_UDC */
+
+
+

Do not add multiple empty lines.

Quoted 7 lines

?/* U-Boot command configuration */
?#include <config_cmd_default.h>

--
1.6.2.4

Kind regards,

Remy

#2 lore raw

PATCH 1/1 musb: Add host support for DM365 EVM

Remy,
Thanks a lot for your comments.
Please find my response inline.

Thanks,
Prathap.

-----Original Message-----
From: [email protected] [mailto:l.pinguin at gmail.com] On Behalf Of Remy Bohmer
Sent: Saturday, January 09, 2010 2:50 PM
To: Srinivas, Prathap
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH] musb: Add host support for DM365 EVM

Hi,

I have put some comments inline:

Review struct davinci_usb_regs *dregs; · line 45

Quoted 5 lines
(quoted diff) +1 -0
@@ -41,10 +42,24 @@ struct davinci_usb_regs *dregs;
 ?static u8 phy_on(void)
 ?{
 ? ? ? ?u32 timeout;
+ ? ? ? u32 val;

This variable is only used when DAVINCI_DM365EVM is set, so it will produce a warning if it is not set.

<MSP> - We could either initialize the variable or guard its declaration with the DAVINCI_DM365EVM macro. Please let me know what is preferred so that I could update accordingly.

Quoted 80 lines

? ? ? ?/* Wait until the USB phy is turned on */

drivers/usb/musb/davinci.c +4 -0
+#ifdef DAVINCI_DM365EVM
+ ? ? ? writel(USBPHY_PHY24MHZ | USBPHY_SESNDEN |
+ ? ? ? ? ? ? ? ? ? ? ? USBPHY_VBDTCTEN, USBPHY_CTL_PADDR);
+#else

? ? ? ?writel(USBPHY_SESNDEN | USBPHY_VBDTCTEN, USBPHY_CTL_PADDR); +#endif
? ? ? ?timeout = musb_cfg.timeout;

(quoted diff) +8 -0
+
+#ifdef DAVINCI_DM365EVM
+ ? ? ? /* Set the ownership of GIO33 to USB */
+ ? ? ? val = readl(PINMUX4);
+ ? ? ? val &= ~(PINMUX4_USBDRVBUS_BITCLEAR);
+ ? ? ? val |= PINMUX4_USBDRVBUS_BITSET;
+ ? ? ? writel(val, PINMUX4);
+#endif

? ? ? ?while (timeout--)
? ? ? ? ? ? ? ?if (readl(USBPHY_CTL_PADDR) & USBPHY_PHYCLKGD) ? ? ? ? ? ? ? ? ? ? ? ?return 1;

(quoted diff) +0 -0
@@ -70,8 +85,9 @@ int musb_platform_init(void)
 ? ? ? ?u32 ?revision;
 

? ? ? ?/* enable USB VBUS */
+#ifndef DAVINCI_DM365EVM
? ? ? ?enable_vbus();

drivers/usb/musb/davinci.c +1 -1
-
+#endif

? ? ? ?/* start the on-chip USB phy and its pll */ ? ? ? ?if (!phy_on())
? ? ? ? ? ? ? ?return -1;

drivers/usb/musb/davinci.h +0 -0
index f6751bf..e0829d6 100644
@@ -63,6 +63,7 @@ struct davinci_usb_regs {
 

?/* Integrated highspeed/otg PHY */
?#define USBPHY_CTL_PADDR ? ? ? (DAVINCI_SYSTEM_MODULE_BASE + 0x34) +#define USBPHY_PHY24MHZ ? ? ? ?(1 << 13)
?#define USBPHY_PHYCLKGD ? ? ? ?(1 << 8)
?#define USBPHY_SESNDEN ? ? ? ? (1 << 7) ? ? ? ?/* v(sess_end) comparator */ ?#define USBPHY_VBDTCTEN ? ? ? ?(1 << 6) ? ? ? ?/* v(bus) comparator */

include/configs/davinci_dm365evm.h +0 -0
index c01426b..e58de93 100644
@@ -86,6 +86,46 @@

?#define CONFIG_SYS_MAX_NAND_DEVICE ? ? 1
?#define CONFIG_SYS_NAND_MAX_CHIPS ? ? ?2

include/configs/davinci_dm365evm.h +30 -0
+#define PINMUX4_USBDRVBUS_BITCLEAR ? ? ? 0x3000
+#define PINMUX4_USBDRVBUS_BITSET ? ? ? ? 0x2000
+
+/* USB Configuration */
+#define CONFIG_USB_DAVINCI
+#define CONFIG_MUSB_HCD
+
+#ifdef CONFIG_USB_DAVINCI
+#define CONFIG_CMD_USB ? ? ? ? /* include support for usb ? ? ?*/
+#define CONFIG_CMD_STORAGE ? ? /* include support for usb ? ? ?*/
+#define CONFIG_CMD_FAT ? ? ? ? /* include support for FAT/storage*/
+#define CONFIG_DOS_PARTITION ? /* include support for FAT/storage*/
+#endif
+
+#ifdef CONFIG_MUSB_HCD ? ? ? ? /* include support for usb host */
+#define CONFIG_CMD_USB ? ? ? ? /* include support for usb cmd */
+#define CONFIG_USB_STORAGE ? ? /* MSC class support */
+#define CONFIG_CMD_STORAGE ? ? /* inclue support for usb-storage cmd */
+#define CONFIG_CMD_FAT ? ? ? ? /* inclue support for FAT/storage */
+#define CONFIG_DOS_PARTITION ? /* inclue support for FAT/storage */
+
+#ifdef CONFIG_USB_KEYBOARD ? ? /* HID class support */
+#define CONFIG_SYS_USB_EVENT_POLL
+
+#define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+#define CONFIG_USB_DEVICE ? ? ? ? ? ? ?1

include/configs/davinci_dm365evm.h line 128

Quoted 10 lines
include/configs/davinci_dm365evm.h +10 -0
+#define CONFIG_USB_TTY ? ? ? ? ? ? ? ? 1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV ? 1
+#define CONFIG_USBD_VENDORID ? ? ? ? ? 0x0451
+#define CONFIG_USBD_PRODUCTID ? ? ? ? ?0x5678
+#define CONFIG_USBD_MANUFACTURER ? ? ? "Texas Instruments"
+#define CONFIG_USBD_PRODUCT_NAME ? ? ? "DM365VM"
+#endif /* CONFIG_MUSB_UDC */
+
+
+

Do not add multiple empty lines.
<MSP>I will take care to remove the empty lines.

Quoted 7 lines

?/* U-Boot command configuration */
?#include <config_cmd_default.h>

--
1.6.2.4

Kind regards,

Remy

#3 lore raw

PATCH 1/1 musb: Add host support for DM365 EVM

Hi,

Quoted 10 lines

Review struct davinci_usb_regs *dregs; · line 45

Quoted 5 lines
(quoted diff) +1 -0
@@ -41,10 +42,24 @@ struct davinci_usb_regs *dregs;
 ?static u8 phy_on(void)
 ?{
 ? ? ? ?u32 timeout;
+ ? ? ? u32 val;

This variable is only used when ?DAVINCI_DM365EVM is set, so it will produce a warning if it is not set.

<MSP> - We could either initialize the variable or guard its declaration with the DAVINCI_DM365EVM macro. Please let me know what is preferred so that I could update accordingly.

Initialise it will leave it unused as well, so I guess to use the macro.

Remy

#4 lore raw

PATCH 1/1 musb: Add host support for DM365 EVM

Remi,
I have fixed your comments and updated the patch. Please let me know if there are any further comments on this?

Thanks,
Prathap.

-----Original Message-----
From: [email protected] [mailto:l.pinguin at gmail.com] On Behalf Of Remy Bohmer
Sent: Monday, January 11, 2010 2:02 PM
To: Srinivas, Prathap
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH] musb: Add host support for DM365 EVM

Hi,

Quoted 10 lines

Review struct davinci_usb_regs *dregs; · line 45

Quoted 5 lines
(quoted diff) +1 -0
@@ -41,10 +42,24 @@ struct davinci_usb_regs *dregs;
 ?static u8 phy_on(void)
 ?{
 ? ? ? ?u32 timeout;
+ ? ? ? u32 val;

This variable is only used when ?DAVINCI_DM365EVM is set, so it will produce a warning if it is not set.

<MSP> - We could either initialize the variable or guard its declaration with the DAVINCI_DM365EVM macro. Please let me know what is preferred so that I could update accordingly.

Initialise it will leave it unused as well, so I guess to use the macro.

Remy

#5 lore raw

PATCH 1/1 musb: Add host support for DM365 EVM

Remy,
Please let me know if there are any further comments on this patch.

Thanks,
Prathap.

-----Original Message-----
From: [email protected] [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Srinivas, Prathap
Sent: Wednesday, January 20, 2010 10:35 AM
To: Remy Bohmer
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] musb: Add host support for DM365 EVM

Remi,
I have fixed your comments and updated the patch. Please let me know if there are any further comments on this?

Thanks,
Prathap.

-----Original Message-----
From: [email protected] [mailto:l.pinguin at gmail.com] On Behalf Of Remy Bohmer
Sent: Monday, January 11, 2010 2:02 PM
To: Srinivas, Prathap
Cc: u-boot at lists.denx.de
Subject: Re: [PATCH] musb: Add host support for DM365 EVM

Hi,

Quoted 10 lines

Review struct davinci_usb_regs *dregs; · line 45

Quoted 5 lines
(quoted diff) +1 -0
@@ -41,10 +42,24 @@ struct davinci_usb_regs *dregs;
 ?static u8 phy_on(void)
 ?{
 ? ? ? ?u32 timeout;
+ ? ? ? u32 val;

This variable is only used when ?DAVINCI_DM365EVM is set, so it will produce a warning if it is not set.

<MSP> - We could either initialize the variable or guard its declaration with the DAVINCI_DM365EVM macro. Please let me know what is preferred so that I could update accordingly.

Initialise it will leave it unused as well, so I guess to use the macro.

Remy
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot