Skip to content

Commit 550a737

Browse files
Felipe Balbigregkh
authored andcommitted
USB: Add MUSB and TUSB support
This patch adds support for MUSB and TUSB controllers integrated into omap2430 and davinci. It also adds support for external tusb6010 controller. Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent f331e40 commit 550a737

30 files changed

+15764
-0
lines changed

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,6 +2928,12 @@ M: jirislaby@gmail.com
29282928
L: linux-kernel@vger.kernel.org
29292929
S: Maintained
29302930

2931+
MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
2932+
P: Felipe Balbi
2933+
M: felipe.balbi@nokia.com
2934+
L: linux-usb@vger.kernel.org
2935+
S: Maintained
2936+
29312937
MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
29322938
P: Andrew Gallatin
29332939
M: gallatin@myri.com

drivers/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/
5757
obj-$(CONFIG_PARIDE) += block/paride/
5858
obj-$(CONFIG_TC) += tc/
5959
obj-$(CONFIG_USB) += usb/
60+
obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/
6061
obj-$(CONFIG_PCI) += usb/
6162
obj-$(CONFIG_USB_GADGET) += usb/gadget/
6263
obj-$(CONFIG_SERIO) += input/serio/

drivers/usb/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ source "drivers/usb/mon/Kconfig"
9999

100100
source "drivers/usb/host/Kconfig"
101101

102+
source "drivers/usb/musb/Kconfig"
103+
102104
source "drivers/usb/class/Kconfig"
103105

104106
source "drivers/usb/storage/Kconfig"

drivers/usb/gadget/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,16 @@ config USB_LH7A40X
284284
default USB_GADGET
285285
select USB_GADGET_SELECTED
286286

287+
# built in ../musb along with host support
288+
config USB_GADGET_MUSB_HDRC
289+
boolean "Inventra HDRC USB Peripheral (TI, ...)"
290+
depends on USB_MUSB_HDRC && (USB_MUSB_PERIPHERAL || USB_MUSB_OTG)
291+
select USB_GADGET_DUALSPEED
292+
select USB_GADGET_SELECTED
293+
help
294+
This OTG-capable silicon IP is used in dual designs including
295+
the TI DaVinci, OMAP 243x, OMAP 343x, and TUSB 6010.
296+
287297
config USB_GADGET_OMAP
288298
boolean "OMAP USB Device Controller"
289299
depends on ARCH_OMAP

drivers/usb/musb/Kconfig

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#
2+
# USB Dual Role (OTG-ready) Controller Drivers
3+
# for silicon based on Mentor Graphics INVENTRA designs
4+
#
5+
6+
comment "Enable Host or Gadget support to see Inventra options"
7+
depends on !USB && USB_GADGET=n
8+
9+
# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller
10+
config USB_MUSB_HDRC
11+
depends on (USB || USB_GADGET) && HAVE_CLK
12+
select TWL4030_USB if MACH_OMAP_3430SDP
13+
tristate 'Inventra Highspeed Dual Role Controller (TI, ...)'
14+
help
15+
Say Y here if your system has a dual role high speed USB
16+
controller based on the Mentor Graphics silicon IP. Then
17+
configure options to match your silicon and the board
18+
it's being used with, including the USB peripheral role,
19+
or the USB host role, or both.
20+
21+
Texas Instruments parts using this IP include DaVinci 644x,
22+
OMAP 243x, OMAP 343x, and TUSB 6010.
23+
24+
If you do not know what this is, please say N.
25+
26+
To compile this driver as a module, choose M here; the
27+
module will be called "musb_hdrc".
28+
29+
config USB_MUSB_SOC
30+
boolean
31+
depends on USB_MUSB_HDRC
32+
default y if ARCH_DAVINCI
33+
default y if ARCH_OMAP2430
34+
default y if ARCH_OMAP34XX
35+
help
36+
Use a static <asm/arch/hdrc_cnf.h> file to describe how the
37+
controller is configured (endpoints, mechanisms, etc) on the
38+
current iteration of a given system-on-chip.
39+
40+
comment "DaVinci 644x USB support"
41+
depends on USB_MUSB_HDRC && ARCH_DAVINCI
42+
43+
comment "OMAP 243x high speed USB support"
44+
depends on USB_MUSB_HDRC && ARCH_OMAP2430
45+
46+
comment "OMAP 343x high speed USB support"
47+
depends on USB_MUSB_HDRC && ARCH_OMAP34XX
48+
49+
config USB_TUSB6010
50+
boolean "TUSB 6010 support"
51+
depends on USB_MUSB_HDRC && !USB_MUSB_SOC
52+
default y
53+
help
54+
The TUSB 6010 chip, from Texas Instruments, connects a discrete
55+
HDRC core using a 16-bit parallel bus (NOR flash style) or VLYNQ
56+
(a high speed serial link). It can use system-specific external
57+
DMA controllers.
58+
59+
choice
60+
prompt "Driver Mode"
61+
depends on USB_MUSB_HDRC
62+
help
63+
Dual-Role devices can support both host and peripheral roles,
64+
as well as a the special "OTG Device" role which can switch
65+
between both roles as needed.
66+
67+
# use USB_MUSB_HDRC_HCD not USB_MUSB_HOST to #ifdef host side support;
68+
# OTG needs both roles, not just USB_MUSB_HOST.
69+
config USB_MUSB_HOST
70+
depends on USB
71+
bool "USB Host"
72+
help
73+
Say Y here if your system supports the USB host role.
74+
If it has a USB "A" (rectangular), "Mini-A" (uncommon),
75+
or "Mini-AB" connector, it supports the host role.
76+
(With a "Mini-AB" connector, you should enable USB OTG.)
77+
78+
# use USB_GADGET_MUSB_HDRC not USB_MUSB_PERIPHERAL to #ifdef peripheral
79+
# side support ... OTG needs both roles
80+
config USB_MUSB_PERIPHERAL
81+
depends on USB_GADGET
82+
bool "USB Peripheral (gadget stack)"
83+
select USB_GADGET_MUSB_HDRC
84+
help
85+
Say Y here if your system supports the USB peripheral role.
86+
If it has a USB "B" (squarish), "Mini-B", or "Mini-AB"
87+
connector, it supports the peripheral role.
88+
(With a "Mini-AB" connector, you should enable USB OTG.)
89+
90+
config USB_MUSB_OTG
91+
depends on USB && USB_GADGET && PM && EXPERIMENTAL
92+
bool "Both host and peripheral: USB OTG (On The Go) Device"
93+
select USB_GADGET_MUSB_HDRC
94+
select USB_OTG
95+
help
96+
The most notable feature of USB OTG is support for a
97+
"Dual-Role" device, which can act as either a device
98+
or a host. The initial role choice can be changed
99+
later, when two dual-role devices talk to each other.
100+
101+
At this writing, the OTG support in this driver is incomplete,
102+
omitting the mandatory HNP or SRP protocols. However, some
103+
of the cable based role switching works. (That is, grounding
104+
the ID pin switches the controller to host mode, while leaving
105+
it floating leaves it in peripheral mode.)
106+
107+
Select this if your system has a Mini-AB connector, or
108+
to simplify certain kinds of configuration.
109+
110+
To implement your OTG Targeted Peripherals List (TPL), enable
111+
USB_OTG_WHITELIST and update "drivers/usb/core/otg_whitelist.h"
112+
to match your requirements.
113+
114+
endchoice
115+
116+
# enable peripheral support (including with OTG)
117+
config USB_GADGET_MUSB_HDRC
118+
bool
119+
depends on USB_MUSB_HDRC && (USB_MUSB_PERIPHERAL || USB_MUSB_OTG)
120+
# default y
121+
# select USB_GADGET_DUALSPEED
122+
# select USB_GADGET_SELECTED
123+
124+
# enables host support (including with OTG)
125+
config USB_MUSB_HDRC_HCD
126+
bool
127+
depends on USB_MUSB_HDRC && (USB_MUSB_HOST || USB_MUSB_OTG)
128+
select USB_OTG if USB_GADGET_MUSB_HDRC
129+
default y
130+
131+
132+
config MUSB_PIO_ONLY
133+
bool 'Disable DMA (always use PIO)'
134+
depends on USB_MUSB_HDRC
135+
default y if USB_TUSB6010
136+
help
137+
All data is copied between memory and FIFO by the CPU.
138+
DMA controllers are ignored.
139+
140+
Do not select 'n' here unless DMA support for your SOC or board
141+
is unavailable (or unstable). When DMA is enabled at compile time,
142+
you can still disable it at run time using the "use_dma=n" module
143+
parameter.
144+
145+
config USB_INVENTRA_DMA
146+
bool
147+
depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY
148+
default ARCH_OMAP2430 || ARCH_OMAP34XX
149+
help
150+
Enable DMA transfers using Mentor's engine.
151+
152+
config USB_TI_CPPI_DMA
153+
bool
154+
depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY
155+
default ARCH_DAVINCI
156+
help
157+
Enable DMA transfers when TI CPPI DMA is available.
158+
159+
config USB_TUSB_OMAP_DMA
160+
bool
161+
depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY
162+
depends on USB_TUSB6010
163+
depends on ARCH_OMAP
164+
default y
165+
help
166+
Enable DMA transfers on TUSB 6010 when OMAP DMA is available.
167+
168+
config USB_MUSB_LOGLEVEL
169+
depends on USB_MUSB_HDRC
170+
int 'Logging Level (0 - none / 3 - annoying / ... )'
171+
default 0
172+
help
173+
Set the logging level. 0 disables the debugging altogether,
174+
although when USB_DEBUG is set the value is at least 1.
175+
Starting at level 3, per-transfer (urb, usb_request, packet,
176+
or dma transfer) tracing may kick in.

drivers/usb/musb/Makefile

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#
2+
# for USB OTG silicon based on Mentor Graphics INVENTRA designs
3+
#
4+
5+
musb_hdrc-objs := musb_core.o
6+
7+
obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o
8+
9+
ifeq ($(CONFIG_ARCH_DAVINCI),y)
10+
musb_hdrc-objs += davinci.o
11+
endif
12+
13+
ifeq ($(CONFIG_USB_TUSB6010),y)
14+
musb_hdrc-objs += tusb6010.o
15+
endif
16+
17+
ifeq ($(CONFIG_ARCH_OMAP2430),y)
18+
musb_hdrc-objs += omap2430.o
19+
endif
20+
21+
ifeq ($(CONFIG_ARCH_OMAP3430),y)
22+
musb_hdrc-objs += omap2430.o
23+
endif
24+
25+
ifeq ($(CONFIG_USB_GADGET_MUSB_HDRC),y)
26+
musb_hdrc-objs += musb_gadget_ep0.o musb_gadget.o
27+
endif
28+
29+
ifeq ($(CONFIG_USB_MUSB_HDRC_HCD),y)
30+
musb_hdrc-objs += musb_virthub.o musb_host.o
31+
endif
32+
33+
# the kconfig must guarantee that only one of the
34+
# possible I/O schemes will be enabled at a time ...
35+
# PIO only, or DMA (several potential schemes).
36+
# though PIO is always there to back up DMA, and for ep0
37+
38+
ifneq ($(CONFIG_MUSB_PIO_ONLY),y)
39+
40+
ifeq ($(CONFIG_USB_INVENTRA_DMA),y)
41+
musb_hdrc-objs += musbhsdma.o
42+
43+
else
44+
ifeq ($(CONFIG_USB_TI_CPPI_DMA),y)
45+
musb_hdrc-objs += cppi_dma.o
46+
47+
else
48+
ifeq ($(CONFIG_USB_TUSB_OMAP_DMA),y)
49+
musb_hdrc-objs += tusb6010_omap.o
50+
51+
endif
52+
endif
53+
endif
54+
endif
55+
56+
57+
################################################################################
58+
59+
# FIXME remove all these extra "-DMUSB_* things, stick to CONFIG_*
60+
61+
ifeq ($(CONFIG_USB_INVENTRA_MUSB_HAS_AHB_ID),y)
62+
EXTRA_CFLAGS += -DMUSB_AHB_ID
63+
endif
64+
65+
# Debugging
66+
67+
MUSB_DEBUG:=$(CONFIG_USB_MUSB_LOGLEVEL)
68+
69+
ifeq ("$(strip $(MUSB_DEBUG))","")
70+
ifdef CONFIG_USB_DEBUG
71+
MUSB_DEBUG:=1
72+
else
73+
MUSB_DEBUG:=0
74+
endif
75+
endif
76+
77+
ifneq ($(MUSB_DEBUG),0)
78+
EXTRA_CFLAGS += -DDEBUG
79+
80+
ifeq ($(CONFIG_PROC_FS),y)
81+
musb_hdrc-objs += musb_procfs.o
82+
endif
83+
84+
endif
85+
86+
EXTRA_CFLAGS += -DMUSB_DEBUG=$(MUSB_DEBUG)

0 commit comments

Comments
 (0)