2956bd9898e5b07bc34bd40cfb39ff993194a111
[openwrt.git] / target / linux / imx6 / patches-3.10 / 0001-usb-chipidea-improve-kconfig.patch
1 From 20a677fd63c57edd5b0c463baa44f133b2f2d4a0 Mon Sep 17 00:00:00 2001
2 From: Peter Chen <peter.chen@freescale.com>
3 Date: Thu, 13 Jun 2013 17:59:52 +0300
4 Subject: [PATCH] usb: chipidea: improve kconfig
5
6 Randy Dunlap <rdunlap@infradead.org> reported this problem
7 on i386:
8
9 > drivers/built-in.o: In function `ci_hdrc_host_init':
10 > (.text+0x2ce75c): undefined reference to `ehci_init_driver'
11 >
12 > When USB_EHCI_HCD=m and USB_CHIPIDEA=y.
13
14 In fact, this problem is existed on all platforms which are using
15 chipidea driver. The root cause of this problem is the chipidea host
16 uses symbol exported from ehci-hcd, but chipidea core
17 does not depends on USB_EHCI_HCD. So, chipidea driver
18 will not be compiled as module if USB_EHCI_HCD=m.
19
20 It is very hard to give a perfect solution since chipidea core
21 depends on USB || USB_GADGET, and chipdiea host depends on
22 both USB_EHCI_HCD and USB_CHIPIDEA, the same problem exists for
23 gadget.
24
25 To fix this problem, we had to have below assumptions:
26
27 - If USB_EHCI_HCD=y && USB_GADGET=y, USB_CHIPIDEA can be 'y'.
28
29 - If USB_EHCI_HCD=m && USB_GADGET=y, USB_CHIPIDEA=m
30 or USB_CHIPIDEA_HOST can't be seen if USB_CHIPIDEA=y.
31 It will cause compile error due to no glue layer for ehci:
32
33 > error: #error "missing bus glue for ehci-hcd"
34
35 So, we had to compile USB_CHIPIDEA=m if USB_EHCI_HCD=m,
36 current ehci hcd core guarantee it.
37
38 - If USB_EHCI_HCD=y && USB_GADGET=m, USB_CHIPIDEA=m
39 or USB_CHIPIDEA_UDC can't be seen if USB_CHIPIDEA=y.
40 Of cos, the gadget will out of working at this situation,
41 so the user had to compile USB_CHIPIDEA=m.
42
43 - USB_EHCI_HCD=m && USB_GADGET=m, we can't see
44 USB_CHIPIDEA_HOST and USB_CHIPIDEA_UDC unless
45 USB_CHIPIDEA=m.
46
47 The reason why it has above assumptions:
48 - If both ehci core and gadget core build as module,
49 the chipidea has to build as module.
50 - If one of ehci core or gadget core is built in, another
51 is built as module, we can only enable the function which
52 is built in, or enable both roles as modules (USB_CHIPIDEA=m),
53 since chipidea core driver takes care of both host and device roles.
54
55 Signed-off-by: Peter Chen <peter.chen@freescale.com>
56 Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
57 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
58 ---
59  drivers/usb/chipidea/Kconfig | 6 +++---
60  1 file changed, 3 insertions(+), 3 deletions(-)
61
62 diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
63 index b2df442..eb2aa2e 100644
64 --- a/drivers/usb/chipidea/Kconfig
65 +++ b/drivers/usb/chipidea/Kconfig
66 @@ -12,15 +12,15 @@ if USB_CHIPIDEA
67  
68  config USB_CHIPIDEA_UDC
69         bool "ChipIdea device controller"
70 -       depends on USB_GADGET=y || USB_GADGET=USB_CHIPIDEA
71 +       depends on USB_GADGET=y || USB_CHIPIDEA=m
72         help
73           Say Y here to enable device controller functionality of the
74           ChipIdea driver.
75  
76  config USB_CHIPIDEA_HOST
77         bool "ChipIdea host controller"
78 -       depends on USB=y || USB=USB_CHIPIDEA
79 -       depends on USB_EHCI_HCD=y
80 +       depends on USB=y
81 +       depends on USB_EHCI_HCD=y || USB_CHIPIDEA=m
82         select USB_EHCI_ROOT_HUB_TT
83         help
84           Say Y here to enable host controller functionality of the
85 -- 
86 1.8.3.3
87