Skip to contentSkip to conversation

AM35X: Add musb support

PATCH New Ajay Kumar Gupta 4 participants 14 messages Jul 9, 2010 – Aug 9, 2010

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

v2 cover AM35X: Add musb support

Remy,

These patches add support for musb in AM35x.
Changes from v1:
- Moved SCM definitions to am35x specific file am35x_def.h

Patches have been created against uboot-ti/master tree (as on 9th July) but they also apply cleanly to both denx/master and uboot-usb/master as there is no interdependent changes.

Regards,
Ajay

Ajay Kumar Gupta (4):
AM35x: Adding SCM general register definitions
musb: MSC host support for AM35x
musb: am35x: Workaround for fifo read issue
AM3517EVM: musb: add usb config

 arch/arm/include/asm/arch-omap3/am35x_def.h |   52 +++++++++
 drivers/usb/musb/Makefile                   |    1 +
 drivers/usb/musb/am35x.c                    |  150 +++++++++++++++++++++++++++
 drivers/usb/musb/am35x.h                    |   94 +++++++++++++++++
 drivers/usb/musb/musb_core.c                |    6 +
 drivers/usb/musb/musb_udc.c                 |    2 +
 include/configs/am3517_evm.h                |   38 +++++++
 include/usb.h                               |    2 +-
 8 files changed, 344 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-omap3/am35x_def.h
 create mode 100644 drivers/usb/musb/am35x.c
 create mode 100644 drivers/usb/musb/am35x.h
#1 lore raw

PATCH v2 1/4 AM35x: Adding SCM general register definitions

Adding general register structure of system control module (SCM) of AM35x. This would be required to access devconf2 and ip_sw_reset register in musb module.

---
 arch/arm/include/asm/arch-omap3/am35x_def.h |   52 +++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-omap3/am35x_def.h
arch/arm/include/asm/arch-omap3/am35x_def.h new file +52 -0
new file mode 100644
index 0000000..81942a8
@@ -0,0 +1,52 @@
+/*
+ * am35x_def.h - TI's AM35x specific definitions.
+ *
+ * Based on arch/arm/include/asm/arch-omap3/cpu.h
+ *
+ * Author: Ajay Kumar Gupta <[email protected]>
+ *
+ * Copyright (c) 2010 Texas Instruments Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _AM35X_DEF_H_
+#define _AM35X_DEF_H_
+
+#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
+#include <asm/types.h>
+#endif /* !(__KERNEL_STRICT_NAMES || __ASSEMBLY__) */
+
+#ifndef __KERNEL_STRICT_NAMES
+#ifndef __ASSEMBLY__
+
+/* General register mappings of system control module */
+#define AM35X_SCM_GEN_BASE	0x48002270
+struct am35x_scm_general {
+	u32 res1[0xC4];		/* 0x000 - 0x30C */
+	u32 devconf2;		/* 0x310 */
+	u32 devconf3;		/* 0x314 */
+	u32 res2[0x2];		/* 0x318 - 0x31C */
+	u32 cba_priority;	/* 0x320 */
+	u32 lvl_intr_clr;	/* 0x324 */
+	u32 ip_sw_reset;	/* 0x328 */
+	u32 ipss_clk_ctrl;	/* 0x32C */
+};
+#define am35x_scm_general_regs ((struct am35x_scm_general *)AM35X_SCM_GEN_BASE)
+
+#endif /*__ASSEMBLY__ */
+#endif /* __KERNEL_STRICT_NAMES */
+
+#endif /* _AM35X_DEF_H_ */
Signature · 1 line
1.6.2.4
#2 lore raw

PATCH v2 2/4 musb: MSC host support for AM35x

Tested MSC Host on AM3517EVM.

---
 drivers/usb/musb/Makefile   |    1 +
 drivers/usb/musb/am35x.c    |  118 +++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/am35x.h    |   94 ++++++++++++++++++++++++++++++++++
 drivers/usb/musb/musb_udc.c |    2 +
 include/usb.h               |    2 +-
 5 files changed, 216 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/am35x.c
 create mode 100644 drivers/usb/musb/am35x.h
drivers/usb/musb/Makefile +1 -0
index 397f5fe..7d23e06 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_USB_BLACKFIN) += blackfin_usb.o
 COBJS-$(CONFIG_USB_DAVINCI) += davinci.o
 COBJS-$(CONFIG_USB_OMAP3) += omap3.o
 COBJS-$(CONFIG_USB_DA8XX) += da8xx.o
+COBJS-$(CONFIG_USB_AM35X) += am35x.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/usb/musb/am35x.c new file +118 -0

118 lines not on this page · raw message

drivers/usb/musb/am35x.h new file +94 -0

94 lines not on this page · raw message

drivers/usb/musb/musb_udc.c +2 -0
index fc43cf4..6f6ed61 100644
@@ -57,6 +57,8 @@
 #include "musb_core.h"
 #if defined(CONFIG_USB_OMAP3)
 #include "omap3.h"
+#elif defined(CONFIG_USB_AM35X)
+#include "am35x.h"
 #elif defined(CONFIG_USB_DAVINCI)
 #include "davinci.h"
 #endif
include/usb.h +1 -1
index bc4ccfe..afd65e3 100644
@@ -133,7 +133,7 @@ struct usb_device {
 	defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
 	defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
 	defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
-	defined(CONFIG_USB_BLACKFIN)
+	defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
 
 int usb_lowlevel_init(void);
 int usb_lowlevel_stop(void);
Signature · 1 line
1.6.2.4
#3 lore raw

PATCH v2 3/4 musb: am35x: Workaround for fifo read issue

AM35x supports only 32bit read operations so we need to have workaround for 8bit and 16bit read operations.

---
 drivers/usb/musb/am35x.c     |   32 ++++++++++++++++++++++++++++++++
 drivers/usb/musb/musb_core.c |    6 ++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
drivers/usb/musb/am35x.c +32 -0
index 2024940..1706c13 100644
@@ -116,3 +116,35 @@ void musb_platform_deinit(void)
 	/* Turn off the phy */
 	phy_off();
 }
+
+/*
+ * This function reads data from endpoint fifo for AM35x
+ * which supports only 32bit read operation.
+ *
+ * ep           - endpoint number
+ * length       - number of bytes to read from FIFO
+ * fifo_data    - pointer to data buffer into which data is read
+ */
+__attribute__((weak))
+void read_fifo(u8 ep, u32 length, void *fifo_data)
+{
+	u8  *data = (u8 *)fifo_data;
+	u32 val;
+	int i;
+
+	/* select the endpoint index */
+	writeb(ep, &musbr->index);
+
+	if (length > 4) {
+		for (i = 0; i < (length >> 2); i++) {
+			val = readl(&musbr->fifox[ep]);
+			memcpy(data, &val, 4);
+			data += 4;
+		}
+		length %= 4;
+	}
+	if (length > 0) {
+		val = readl(&musbr->fifox[ep]);
+		memcpy(data, &val, length);
+	}
+}
drivers/usb/musb/musb_core.c +6 -0
index dc740cf..6fe2c39 100644
@@ -142,6 +142,11 @@ void write_fifo(u8 ep, u32 length, void *fifo_data)
 }
 
 /*
+ * AM35x supports only 32bit read operations so
+ * use seperate read_fifo() function for it.
+ */
+#ifndef CONFIG_USB_AM35X
+/*
  * This function reads data from endpoint fifo
  *
  * ep           - endpoint number
@@ -160,3 +165,4 @@ void read_fifo(u8 ep, u32 length, void *fifo_data)
 	while (length--)
 		*data++ = readb(&musbr->fifox[ep]);
 }
+#endif /* CONFIG_USB_AM35X */
Signature · 1 line
1.6.2.4
#4 lore raw

PATCH v2 4/4 AM3517EVM: musb: add usb config

Enabling USB HOST in defconfig.

---
 include/configs/am3517_evm.h |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
include/configs/am3517_evm.h +38 -0
index 10af21b..a9045d8 100644
@@ -99,6 +99,44 @@
 #define CONFIG_OMAP3_MMC		1
 #define CONFIG_DOS_PARTITION		1
 
+/*
+ * USB configuration
+ * Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard
+ * Enable CONFIG_MUSB_UDC for Device functionalities.
+ */
+#define CONFIG_USB_AM35X		1
+#define CONFIG_MUSB_HCD			1
+
+#ifdef CONFIG_USB_AM35X
+
+#ifdef CONFIG_MUSB_HCD
+#define CONFIG_CMD_USB
+
+#define CONFIG_USB_STORAGE
+#define CONGIG_CMD_STORAGE
+#define CONFIG_CMD_FAT
+
+#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	"AM3517EVM"
+#endif /* CONFIG_MUSB_UDC */
+
+#endif /* CONFIG_USB_AM35X */
+
 /* commands to include */
 #include <config_cmd_default.h>
 
Signature · 1 line
1.6.2.4
#5 lore raw

PATCH v2 3/4 musb: am35x: Workaround for fifo read issue

In reply to Ajay Kumar Gupta

Hi,

2010/7/9 Ajay Kumar Gupta <[email protected]>:

Quoted 8 lines

AM35x supports only 32bit read operations so we need to have workaround for 8bit and 16bit read operations.

---
?drivers/usb/musb/am35x.c ? ? | ? 32 ++++++++++++++++++++++++++++++++ ?drivers/usb/musb/musb_core.c | ? ?6 ++++++
?2 files changed, 38 insertions(+), 0 deletions(-)

#6 lore raw

PATCH v2 2/4 musb: MSC host support for AM35x

In reply to Ajay Kumar Gupta

Hi,

2010/7/9 Ajay Kumar Gupta <[email protected]>:

Quoted 4 lines

Tested MSC Host on AM3517EVM.

---

Quoted 8 lines
?drivers/usb/musb/Makefile ? | ? ?1 +
?drivers/usb/musb/am35x.c ? ?| ?118 +++++++++++++++++++++++++++++++++++++++++++
?drivers/usb/musb/am35x.h ? ?| ? 94 ++++++++++++++++++++++++++++++++++
?drivers/usb/musb/musb_udc.c | ? ?2 +
?include/usb.h ? ? ? ? ? ? ? | ? ?2 +-

?5 files changed, 216 insertions(+), 1 deletions(-) ?create mode 100644 drivers/usb/musb/am35x.c ?create mode 100644 drivers/usb/musb/am35x.h

#7 lore raw

PATCH v2 2/4 musb: MSC host support for AM35x

Hi,

Quoted 8 lines

2010/7/9 Ajay Kumar Gupta <[email protected]>:

Quoted 6 lines

Tested MSC Host on AM3517EVM.

---
?drivers/usb/musb/Makefile ? | ? ?1 +
?drivers/usb/musb/am35x.c ? ?| ?118

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

Quoted 8 lines
Quoted 6 lines
?drivers/usb/musb/am35x.h ? ?| ? 94 ++++++++++++++++++++++++++++++++++
?drivers/usb/musb/musb_udc.c | ? ?2 +
?include/usb.h ? ? ? ? ? ? ? | ? ?2 +-

?5 files changed, 216 insertions(+), 1 deletions(-) ?create mode 100644 drivers/usb/musb/am35x.c ?create mode 100644 drivers/usb/musb/am35x.h

Remy,
Please merge the patch set supporting AM3517 musb in your
uboot-usb tree.

Regards,
Ajay

#8 lore raw

PATCH v2 2/4 musb: MSC host support for AM35x

In reply to Remy Bohmer

Dear Remy Bohmer,

Quoted 15 lines · In message <[email protected]> you…

2010/7/9 Ajay Kumar Gupta <[email protected]>:

Quoted 12 lines

Tested MSC Host on AM3517EVM.

---
 drivers/usb/musb/Makefile   |    1 +
 drivers/usb/musb/am35x.c    |  118 +++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/am35x.h    |   94 ++++++++++++++++++++++++++++++++++
 drivers/usb/musb/musb_udc.c |    2 +
 include/usb.h               |    2 +-
 5 files changed, 216 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/am35x.c
 create mode 100644 drivers/usb/musb/am35x.h
Quoted 1 line

You ACK these? I would expect they go in through the USB repository. What is your expectation - who should apply these patches?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When all is said and done, more is said than done.
#9 lore raw

PATCH v2 2/4 musb: MSC host support for AM35x

Hi Wolfgang,

2010/8/8 Wolfgang Denk <[email protected]>:

Quoted 18 lines

Dear Remy Bohmer,

Quoted 15 lines · In message <[email protected]> you…

2010/7/9 Ajay Kumar Gupta <[email protected]>:

Quoted 12 lines

Tested MSC Host on AM3517EVM.

---

?drivers/usb/musb/Makefile ? | ? ?1 +
?drivers/usb/musb/am35x.c ? ?| ?118 +++++++++++++++++++++++++++++++++++++++++++
?drivers/usb/musb/am35x.h ? ?| ? 94 ++++++++++++++++++++++++++++++++++
?drivers/usb/musb/musb_udc.c | ? ?2 +
?include/usb.h ? ? ? ? ? ? ? | ? ?2 +-

?5 files changed, 216 insertions(+), 1 deletions(-) ?create mode 100644 drivers/usb/musb/am35x.c ?create mode 100644 drivers/usb/musb/am35x.h

Quoted 4 lines
Quoted 1 line

You ACK these? I would expect they go in through the USB repository. What is your expectation - who should apply these patches?

I guess I was not fully awake when I sent that, I thought it was part of a bigger series that should go in the u-boot-ti tree... Anyway, I applied it to the u-boot-usb tree already a week ago...

Kind regards,

Remy

#10 lore raw

v2 cover AM35X: Add musb support

In reply to Ajay Kumar Gupta
Quoted 7 lines

These patches add support for musb in AM35x.
Changes from v1:
- Moved SCM definitions to am35x specific file am35x_def.h

Patches have been created against uboot-ti/master tree (as on 9th July) but they also apply cleanly to both denx/master and uboot-usb/master as there is no interdependent changes.

Remy,
Any comment on this patch set ?

Regards,
Ajay

Quoted 23 lines

Regards,
Ajay

Ajay Kumar Gupta (4):
AM35x: Adding SCM general register definitions
musb: MSC host support for AM35x
musb: am35x: Workaround for fifo read issue
AM3517EVM: musb: add usb config

 arch/arm/include/asm/arch-omap3/am35x_def.h |   52 +++++++++
 drivers/usb/musb/Makefile                   |    1 +
 drivers/usb/musb/am35x.c                    |  150
+++++++++++++++++++++++++++
 drivers/usb/musb/am35x.h                    |   94 +++++++++++++++++
 drivers/usb/musb/musb_core.c                |    6 +
 drivers/usb/musb/musb_udc.c                 |    2 +
 include/configs/am3517_evm.h                |   38 +++++++
 include/usb.h                               |    2 +-
 8 files changed, 344 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-omap3/am35x_def.h
 create mode 100644 drivers/usb/musb/am35x.c
 create mode 100644 drivers/usb/musb/am35x.h
#11 lore raw

v2 cover AM35X: Add musb support

Quoted 10 lines
Quoted 9 lines

These patches add support for musb in AM35x.
Changes from v1:
- Moved SCM definitions to am35x specific file am35x_def.h

Patches have been created against uboot-ti/master tree (as on 9th July) but they also apply cleanly to both denx/master and uboot-usb/master as there is no interdependent changes.

Quoted 5 lines

Remy,
Any comment on this patch set ?

Regards,
Ajay

He sent me an e-mail offline.
He is on vacation without Wifi and laptop.

Sandeep

#12 lore raw

v2 cover AM35X: Add musb support

Quoted 9 lines
Quoted 5 lines

Remy,
Any comment on this patch set ?

Regards,
Ajay

He sent me an e-mail offline.
He is on vacation without Wifi and laptop.

Thanks for updating on this.

Regards,
Ajay

Quoted 2 lines

Sandeep

#13 lore raw

v2 cover AM35X: Add musb support

In reply to Ajay Kumar Gupta

Hi,

2010/7/9 Ajay Kumar Gupta <[email protected]>:

Quoted 27 lines

Remy,

These patches add support for musb in AM35x.
Changes from v1:
? ? ? ?- Moved SCM definitions to am35x specific file am35x_def.h

Patches have been created against uboot-ti/master tree (as on 9th July) but they also apply cleanly to both denx/master and uboot-usb/master as there is no interdependent changes.

Regards,
Ajay

Ajay Kumar Gupta (4):
?AM35x: Adding SCM general register definitions
?musb: MSC host support for AM35x
?musb: am35x: Workaround for fifo read issue
?AM3517EVM: musb: add usb config

?arch/arm/include/asm/arch-omap3/am35x_def.h | ? 52 +++++++++
?drivers/usb/musb/Makefile ? ? ? ? ? ? ? ? ? | ? ?1 +
?drivers/usb/musb/am35x.c ? ? ? ? ? ? ? ? ? ?| ?150 +++++++++++++++++++++++++++
?drivers/usb/musb/am35x.h ? ? ? ? ? ? ? ? ? ?| ? 94 +++++++++++++++++
?drivers/usb/musb/musb_core.c ? ? ? ? ? ? ? ?| ? ?6 +
?drivers/usb/musb/musb_udc.c ? ? ? ? ? ? ? ? | ? ?2 +
?include/configs/am3517_evm.h ? ? ? ? ? ? ? ?| ? 38 +++++++
?include/usb.h ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
Quoted 4 lines

?8 files changed, 344 insertions(+), 1 deletions(-) ?create mode 100644 arch/arm/include/asm/arch-omap3/am35x_def.h ?create mode 100644 drivers/usb/musb/am35x.c
?create mode 100644 drivers/usb/musb/am35x.h

Applied to u-boot-usb master.

Thanks.

Remy