Skip to contentSkip to conversation

DA830: Add pinmux for USB0_DRVVBUS

PATCH Superseded Ajay Kumar Gupta 4 participants 12 messages Nov 12, 2009 – Nov 13, 2009

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 DA830: Add pinmux for USB0_DRVVBUS

USB0_DRVVBUS pinmux configuration is required for USB functinality in uboot.

---
This patch set is created against Nick Thompson's latest patch set (v5) on DA8xx support and another patch from him on Davinci pinmux. [Davinci: add a pin multiplexer configuration API]

 board/davinci/da830evm/da830evm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
board/davinci/da830evm/da830evm.c +8 -0
index bb8cc3c..7cf6013 100644
@@ -65,6 +65,11 @@ const struct pinmux_config i2c_pins[] = {
 	{ pinmux[9], 2, 4 }
 };
 
+/* USB0_DRVVBUS pin muxer settings */
+const struct pinmux_config usb_pins[] = {
+	{ pinmux[9], 1, 1 }
+};
+
 int board_init(void)
 {
 #ifndef CONFIG_USE_IRQ
@@ -118,6 +123,9 @@ int board_init(void)
 	if (davinci_configure_pin_mux(i2c_pins, ARRAY_SIZE(i2c_pins)) != 0)
 		return 1;
 
+	if (davinci_configure_pin_mux(usb_pins, ARRAY_SIZE(usb_pins)) != 0)
+		return 1;
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
Signature · 1 line
1.6.2.4
#1 lore raw

PATCH 2/3 DA8xx: Add MUSB host support

Tested USB host functionality on DA830 EVM.

---
 drivers/usb/musb/Makefile |    1 +
 drivers/usb/musb/da8xx.c  |  143 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/da8xx.h  |   83 ++++++++++++++++++++++++++
 include/usb.h             |    3 +-
 4 files changed, 229 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/da8xx.c
 create mode 100644 drivers/usb/musb/da8xx.h
drivers/usb/musb/Makefile +1 -0
index 09e0a5f..eb4d8fd 100644
@@ -27,6 +27,7 @@ LIB	:= $(obj)libusb_musb.a
 
 COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
 COBJS-$(CONFIG_USB_DAVINCI) += davinci.o
+COBJS-$(CONFIG_USB_DA8XX) += da8xx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/usb/musb/da8xx.c new file +143 -0

143 lines not on this page · raw message

drivers/usb/musb/da8xx.h new file +83 -0

83 lines not on this page · raw message

include/usb.h +2 -1
index 7c47098..7c56ace 100644
@@ -183,7 +183,8 @@ struct usb_device {
 #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
 	defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
 	defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
-	defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI)
+	defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
+	defined(CONFIG_USB_DA8XX)
 
 int usb_lowlevel_init(void);
 int usb_lowlevel_stop(void);
Signature · 1 line
1.6.2.4
#2 lore raw

PATCH 3/3 DA830: Add usb config

---
 include/configs/da830evm.h |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
include/configs/da830evm.h +35 -0
index 38e2ce1..52e6473 100644
@@ -149,6 +149,11 @@
 #define CONFIG_SYS_ENV_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
 #endif
 
+/*==============================*/
+/* USB  configuration           */
+/*==============================*/
+#define CONFIG_USB_DA8XX	/* Platform hookup to MUSB controller */
+#define CONFIG_MUSB_HCD
 
 /*
  * U-Boot general configuration
@@ -240,4 +245,34 @@
 #define CONFIG_DOS_PARTITION	/* include support for FAT/storage*/
 #endif
 
+#ifdef CONFIG_USB_DA8XX
+
+#ifdef CONFIG_MUSB_HCD
+#define CONFIG_CMD_USB		/* inclue support for usb       */
+
+#define CONFIG_USB_STORAGE	/* MSC class support */
+#define CONFIG_CMD_STORAGE	/* inclue support for usb       */
+#define CONFIG_CMD_FAT		/* inclue support for FAT/storage*/
+#define CONFIG_DOS_PARTITION	/* inclue support for FAT/storage*/
+
+#ifdef CONFIG_USB_KEYBOARD
+#define CONFIG_SYS_USB_EVENT_POLL
+#define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+/* USB device configuration */
+#define CONFIG_USB_DEVICE		1
+#define CONFIG_USB_TTY			1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV	1
+/* Change these to suit your needs */
+#define CONFIG_USBD_VENDORID		0x0451
+#define CONFIG_USBD_PRODUCTID		0x5678
+#define CONFIG_USBD_MANUFACTURER	"Texas Instruments"
+#define CONFIG_USBD_PRODUCT_NAME	"DA830EVM"
+#endif /* CONFIG_MUSB_UDC */
+
+#endif /* CONFIG_USB_DA8XX */
 #endif /* __CONFIG_H */
Signature · 1 line
1.6.2.4
#3 lore raw

PATCH 3/3 DA830: Add usb config

Quoted 11 lines · Ajay Kumar Gupta
---
 include/configs/da830evm.h |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
include/configs/da830evm.h +0 -0
index 38e2ce1..52e6473 100644

include/configs/da830evm.h line 154

Quoted 6 lines
include/configs/da830evm.h +3 -0
@@ -149,6 +149,11 @@
 #define CONFIG_SYS_ENV_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
 #endif
 
+/*==============================*/
+/* USB  configuration           */
+/*==============================*/

Block comments should be in this format:

/*
* USB configuration
*/

Thanks,
Nick.

#4 lore raw

PATCH 3/3 DA830: Add usb config

Quoted 28 lines

-----Original Message-----
From: Nick Thompson [mailto:nick.thompson at gefanuc.com]
Sent: Thursday, November 12, 2009 10:25 PM
To: Gupta, Ajay Kumar
Cc: u-boot at lists.denx.de; Subbrathnam, Swaminathan
Subject: Re: [PATCH 3/3] DA830: Add usb config

Quoted 11 lines · Ajay Kumar Gupta
---
 include/configs/da830evm.h |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
include/configs/da830evm.h +0 -0
index 38e2ce1..52e6473 100644

include/configs/da830evm.h line 154

Quoted 6 lines
include/configs/da830evm.h +3 -0
@@ -149,6 +149,11 @@
 #define CONFIG_SYS_ENV_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
 #endif
 
+/*==============================*/
+/* USB  configuration           */
+/*==============================*/

Block comments should be in this format:

Quoted 3 lines

/*
* USB configuration
*/

Thanks, I will update and post v2.

Regards,
Ajay

Quoted 3 lines

Thanks,
Nick.

#5 lore raw

PATCH 2/3 DA8xx: Add MUSB host support

In reply to Ajay Kumar Gupta
Quoted 13 lines · Ajay Kumar Gupta

Tested USB host functionality on DA830 EVM.

---
 drivers/usb/musb/Makefile |    1 +
 drivers/usb/musb/da8xx.c  |  143 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/da8xx.h  |   83 ++++++++++++++++++++++++++
 include/usb.h             |    3 +-
 4 files changed, 229 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/da8xx.c
 create mode 100644 drivers/usb/musb/da8xx.h

drivers/usb/musb/da8xx.c line 42

Quoted 8 lines
drivers/usb/musb/da8xx.c new file +8 -0
+static void enable_vbus(void)
+{
+	u32 value;
+
+	/* configure GPIO bank4 pin 15 in output direction */
+	value = readl(DAVINCI_GPIO_BASE + BANK4_REG_DIR_ADDR);
+	writel((value & (~USB_VBUS_GPIO)),
+			(DAVINCI_GPIO_BASE + BANK4_REG_DIR_ADDR));

In general you should be using C structure pointers for all readl/writel accessors in new code. #defines are no longer considered acceptable, but occur through this patch. In case there is a compatibility issue with existing code, I think the legacy form is acceptable.

Indentation is also wrong here (and elsewhere) I believe. Using underscores to illustrate spaces, this should be:

	writel((value | USB_VBUS_GPIO),
	_______(DAVINCI_GPIO_BASE + BANK4_REG_SET_ADDR));

This is a mix of tabs (8) and spaces (<= 7). Indentation should use tabs only, alignment uses spaces as required.

drivers/usb/musb/da8xx.c line 59

Quoted 6 lines
drivers/usb/musb/da8xx.c new file +6 -0
+static u8 phy_on(void)
+{
+	u32 timeout;
+	u32 cfgchip2;
+
+	cfgchip2 = readl(DAVINCI_BOOTCFG_BASE + CFGCHIP2);

C structures again, but in this case the initial da8xx patches provide the C structure and pointer already, so you can already replace this with:

	cfgchip2 = readl(&davinci_syscfg_regs->cfgchip2);

Please take a look at hardware.h after the initial da8xx patches are in.

Thanks,
Nick.

#6 lore raw

PATCH 2/3 DA8xx: Add MUSB host support

Quoted 17 lines · Ajay Kumar Gupta
Quoted 7 lines

Tested USB host functionality on DA830 EVM.

---
 drivers/usb/musb/Makefile |    1 +
 drivers/usb/musb/da8xx.c  |  143

+++++++++++++++++++++++++++++++++++++++++++++

Quoted 5 lines
 drivers/usb/musb/da8xx.h  |   83 ++++++++++++++++++++++++++
 include/usb.h             |    3 +-
 4 files changed, 229 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/da8xx.c
 create mode 100644 drivers/usb/musb/da8xx.h
Quoted 8 lines

drivers/usb/musb/da8xx.c line 42

Quoted 8 lines
drivers/usb/musb/da8xx.c new file +8 -0
+static void enable_vbus(void)
+{
+	u32 value;
+
+	/* configure GPIO bank4 pin 15 in output direction */
+	value = readl(DAVINCI_GPIO_BASE + BANK4_REG_DIR_ADDR);
+	writel((value & (~USB_VBUS_GPIO)),
+			(DAVINCI_GPIO_BASE + BANK4_REG_DIR_ADDR));

And there is now a gpio_defs.h in /include/asm-arm/arch-davinci

So please use that.

Ideally a GPIO driver would be nice but it is not yet part of u-boot.

Quoted 40 lines

In general you should be using C structure pointers for all readl/writel accessors in new code. #defines are no longer considered acceptable, but occur
through this patch. In case there is a compatibility issue with existing code,
I think the legacy form is acceptable.

Indentation is also wrong here (and elsewhere) I believe. Using underscores to
illustrate spaces, this should be:

	writel((value | USB_VBUS_GPIO),
	_______(DAVINCI_GPIO_BASE + BANK4_REG_SET_ADDR));

This is a mix of tabs (8) and spaces (<= 7). Indentation should use tabs only,
alignment uses spaces as required.

drivers/usb/musb/da8xx.c line 59

Quoted 6 lines
drivers/usb/musb/da8xx.c new file +6 -0
+static u8 phy_on(void)
+{
+	u32 timeout;
+	u32 cfgchip2;
+
+	cfgchip2 = readl(DAVINCI_BOOTCFG_BASE + CFGCHIP2);

C structures again, but in this case the initial da8xx patches provide the C
structure and pointer already, so you can already replace this with:

	cfgchip2 = readl(&davinci_syscfg_regs->cfgchip2);

Please take a look at hardware.h after the initial da8xx patches are in.

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

#7 lore raw

PATCH 1/3 DA830: Add pinmux for USB0_DRVVBUS

In reply to Ajay Kumar Gupta
Quoted 9 lines · Ajay Kumar Gupta

USB0_DRVVBUS pinmux configuration is required for USB functinality in uboot.

---
This patch set is created against Nick Thompson's latest patch set (v5) on DA8xx support and another patch from him on Davinci pinmux. [Davinci: add a pin multiplexer configuration API]

It is difficult to review code that is dependent on other outstanding patches.

The base DA8xx support will be in arm-ti branch shortly. Please rebase these patches when this happens and resubmit.

Tom

Quoted 30 lines
 board/davinci/da830evm/da830evm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
board/davinci/da830evm/da830evm.c +8 -0
index bb8cc3c..7cf6013 100644
@@ -65,6 +65,11 @@ const struct pinmux_config i2c_pins[] = {
 	{ pinmux[9], 2, 4 }
 };
 
+/* USB0_DRVVBUS pin muxer settings */
+const struct pinmux_config usb_pins[] = {
+	{ pinmux[9], 1, 1 }
+};
+
 int board_init(void)
 {
 #ifndef CONFIG_USE_IRQ
@@ -118,6 +123,9 @@ int board_init(void)
 	if (davinci_configure_pin_mux(i2c_pins, ARRAY_SIZE(i2c_pins)) != 0)
 		return 1;
 
+	if (davinci_configure_pin_mux(usb_pins, ARRAY_SIZE(usb_pins)) != 0)
+		return 1;
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
#8 lore raw

PATCH 1/3 DA830: Add pinmux for USB0_DRVVBUS

Quoted 13 lines
Quoted 9 lines · Ajay Kumar Gupta

USB0_DRVVBUS pinmux configuration is required for USB functinality in uboot.

---
This patch set is created against Nick Thompson's latest patch set (v5) on DA8xx support and another patch from him on Davinci pinmux. [Davinci: add a pin multiplexer configuration API]

Quoted 7 lines

It is difficult to review code that is dependent on other outstanding patches.

The base DA8xx support will be in arm-ti branch shortly. Please rebase these patches when this happens and resubmit.

Tom

I think he might have added it locally and then made his patches. So he might not have to rebase.

Without Nick's patches da830evm.c would not even exist :-)

Quoted 38 lines

Review

Quoted 6 lines

 board/davinci/da830evm/da830evm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/board/davinci/da830evm/da830evm.c

Quoted 16 lines

index bb8cc3c..7cf6013 100644

board/davinci/da830evm/da830evm.c +5 -0
@@ -65,6 +65,11 @@ const struct pinmux_config i2c_pins[] = {
 	{ pinmux[9], 2, 4 }
 };
 
+/* USB0_DRVVBUS pin muxer settings */
+const struct pinmux_config usb_pins[] = {
+	{ pinmux[9], 1, 1 }
+};
+
 int board_init(void)
 {
 #ifndef CONFIG_USE_IRQ

board/davinci/da830evm/da830evm.c int board_init(void) · line 130

Quoted 8 lines
board/davinci/da830evm/da830evm.c +3 -0
@@ -118,6 +123,9 @@ int board_init(void)
 	if (davinci_configure_pin_mux(i2c_pins, ARRAY_SIZE(i2c_pins)) != 0)
 		return 1;
 
+	if (davinci_configure_pin_mux(usb_pins, ARRAY_SIZE(usb_pins)) != 0)
+		return 1;
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE |

DAVINCI_UART_PWREMU_MGMT_URRST |

board/davinci/da830evm/da830evm.c int board_init(void) · line 131

Quoted 1 line
board/davinci/da830evm/da830evm.c +0 -0
 		DAVINCI_UART_PWREMU_MGMT_UTRST),

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

#9 lore raw

PATCH 1/3 DA830: Add pinmux for USB0_DRVVBUS

Quoted 17 lines · Sandeep
Quoted 17 lines
Quoted 9 lines · Ajay Kumar Gupta

USB0_DRVVBUS pinmux configuration is required for USB functinality in uboot.

---
This patch set is created against Nick Thompson's latest patch set (v5) on DA8xx support and another patch from him on Davinci pinmux. [Davinci: add a pin multiplexer configuration API]

It is difficult to review code that is dependent on other outstanding patches.

The base DA8xx support will be in arm-ti branch shortly. Please rebase these patches when this happens and resubmit.

Quoted 8 lines
Quoted 1 line

Tom

I think he might have added it locally and then made his patches. So he might not have to rebase.

Without Nick's patches da830evm.c would not even exist :-)

My issue is not with how development continues, it is with how patches are reviewed. To really review this patchset someone would need to apply the pin mux patch, the the 8xx patch set, then this set. Reviewing patches against outstanding patches does not scale and should be avoided.

Tom

#10 lore raw

PATCH 1/3 DA830: Add pinmux for USB0_DRVVBUS

Quoted 30 lines
Quoted 17 lines · Sandeep
Quoted 17 lines
Quoted 9 lines · Ajay Kumar Gupta

USB0_DRVVBUS pinmux configuration is required for USB functinality in uboot.

---
This patch set is created against Nick Thompson's latest patch set (v5) on DA8xx support and another patch from him on Davinci pinmux. [Davinci: add a pin multiplexer configuration API]

It is difficult to review code that is dependent on other outstanding patches.

The base DA8xx support will be in arm-ti branch shortly. Please rebase these patches when this happens and resubmit.

Quoted 8 lines
Quoted 1 line

Tom

I think he might have added it locally and then made his patches. So he might not have to rebase.

Without Nick's patches da830evm.c would not even exist :-)

Quoted 7 lines

My issue is not with how development continues, it is with how patches are reviewed. To really review this patchset someone would need to apply the pin mux patch, the the 8xx patch set, then this set. Reviewing patches against outstanding patches does not scale and should be avoided.

Tom

Not any more :-)

Take a look at http://git.denx.de/?p=u-boot/u-boot-ti.git;a=shortlog;h=refs/heads/master

I have tested some other DaVincs SOCs as well after adding these patches and they seem to be working fine as of now.

Lets continue the review process for the USB support.

Thanks,
Sandeep

#11 lore raw

PATCH 1/3 DA830: Add pinmux for USB0_DRVVBUS

Quoted 50 lines

-----Original Message-----
From: Paulraj, Sandeep
Sent: Thursday, November 12, 2009 10:00 PM
To: Tom; Nick Thompson
Cc: Gupta, Ajay Kumar; u-boot at lists.denx.de; Subbrathnam, Swaminathan
Subject: RE: [U-Boot] [PATCH 1/3] DA830: Add pinmux for USB0_DRVVBUS

Quoted 24 lines
Quoted 22 lines · Sandeep
Quoted 11 lines
Quoted 9 lines · Ajay Kumar Gupta

USB0_DRVVBUS pinmux configuration is required for USB functinality in uboot.

---
This patch set is created against Nick Thompson's latest patch set (v5) on DA8xx support and another patch from him on Davinci pinmux. [Davinci: add a pin multiplexer configuration API]

Quoted 7 lines

It is difficult to review code that is dependent on other outstanding patches.

The base DA8xx support will be in arm-ti branch shortly. Please rebase these patches when this happens and resubmit.

Tom

I think he might have added it locally and then made his patches. So he might not have to rebase.

Quoted 8 lines
Quoted 3 lines

Without Nick's patches da830evm.c would not even exist :-)

My issue is not with how development continues, it is with how patches are reviewed. To really review this patchset someone would need to apply the pin mux patch, the the 8xx patch set, then this set. Reviewing patches against outstanding patches does not scale and should

be

Quoted 3 lines

avoided.

Tom

Not any more :-)

Quoted 7 lines

Take a look at http://git.denx.de/?p=u-boot/u-boot-
ti.git;a=shortlog;h=refs/heads/master

I have tested some other DaVincs SOCs as well after adding these patches and they seem to be working fine as of now.

Lets continue the review process for the USB support.

I had actually applied all dependent patches and then created the USB patches and tested. So it removes the rebase issue.

Regards,
Ajay

Quoted 3 lines

Thanks,
Sandeep