aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/au1000/common/cputable.c2
-rw-r--r--arch/mips/au1000/common/platform.c2
-rw-r--r--drivers/usb/Kconfig9
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/ehci-au1xxx.c297
-rw-r--r--drivers/usb/host/ehci-hcd.c11
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h4
7 files changed, 319 insertions, 8 deletions
diff --git a/arch/mips/au1000/common/cputable.c b/arch/mips/au1000/common/cputable.c
index 4dbde82c8215..d8df5fdb045f 100644
--- a/arch/mips/au1000/common/cputable.c
+++ b/arch/mips/au1000/common/cputable.c
@@ -38,7 +38,7 @@ struct cpu_spec cpu_specs[] = {
38 { 0xffffffff, 0x02030204, "Au1100 BE", 0, 1 }, 38 { 0xffffffff, 0x02030204, "Au1100 BE", 0, 1 },
39 { 0xffffffff, 0x03030200, "Au1550 AA", 0, 1 }, 39 { 0xffffffff, 0x03030200, "Au1550 AA", 0, 1 },
40 { 0xffffffff, 0x04030200, "Au1200 AB", 0, 0 }, 40 { 0xffffffff, 0x04030200, "Au1200 AB", 0, 0 },
41 { 0xffffffff, 0x04030201, "Au1200 AC", 0, 1 }, 41 { 0xffffffff, 0x04030201, "Au1200 AC", 1, 0 },
42 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0 }, 42 { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0 },
43}; 43};
44 44
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
index 48d3f54f88f8..1fb3dbdb93be 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -278,9 +278,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
278 &au1100_lcd_device, 278 &au1100_lcd_device,
279#endif 279#endif
280#ifdef CONFIG_SOC_AU1200 280#ifdef CONFIG_SOC_AU1200
281#if 0 /* fixme */
282 &au1xxx_usb_ehci_device, 281 &au1xxx_usb_ehci_device,
283#endif
284 &au1xxx_usb_gdt_device, 282 &au1xxx_usb_gdt_device,
285 &au1xxx_usb_otg_device, 283 &au1xxx_usb_otg_device,
286 &au1200_lcd_device, 284 &au1200_lcd_device,
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 7772e28a303f..0e865975899f 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -10,8 +10,8 @@ menu "USB support"
10config USB_ARCH_HAS_HCD 10config USB_ARCH_HAS_HCD
11 boolean 11 boolean
12 default y if USB_ARCH_HAS_OHCI 12 default y if USB_ARCH_HAS_OHCI
13 default y if USB_ARCH_HAS_EHCI
13 default y if ARM # SL-811 14 default y if ARM # SL-811
14 default y if PPC_83xx
15 default PCI 15 default PCI
16 16
17# many non-PCI SOC chips embed OHCI 17# many non-PCI SOC chips embed OHCI
@@ -31,6 +31,13 @@ config USB_ARCH_HAS_OHCI
31 # more: 31 # more:
32 default PCI 32 default PCI
33 33
34# some non-PCI hcds implement EHCI
35config USB_ARCH_HAS_EHCI
36 boolean
37 default y if PPC_83xx
38 default y if SOC_AU1200
39 default PCI
40
34# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. 41# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
35config USB 42config USB
36 tristate "Support for Host-side USB" 43 tristate "Support for Host-side USB"
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index a45293673906..e27b79a3c05f 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -6,7 +6,7 @@ comment "USB Host Controller Drivers"
6 6
7config USB_EHCI_HCD 7config USB_EHCI_HCD
8 tristate "EHCI HCD (USB 2.0) support" 8 tristate "EHCI HCD (USB 2.0) support"
9 depends on USB && (PCI || PPC_83xx) 9 depends on USB && USB_ARCH_HAS_EHCI
10 ---help--- 10 ---help---
11 The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0 11 The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
12 "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware. 12 "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
new file mode 100644
index 000000000000..63eadeec1324
--- /dev/null
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -0,0 +1,297 @@
1/*
2 * EHCI HCD (Host Controller Driver) for USB.
3 *
4 * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
5 *
6 * Bus Glue for AMD Alchemy Au1xxx
7 *
8 * Based on "ohci-au1xxx.c" by Matt Porter <mporter@kernel.crashing.org>
9 *
10 * Modified for AMD Alchemy Au1200 EHC
11 * by K.Boge <karsten.boge@amd.com>
12 *
13 * This file is licenced under the GPL.
14 */
15
16#include <linux/platform_device.h>
17#include <asm/mach-au1x00/au1000.h>
18
19#ifndef CONFIG_SOC_AU1200
20#error "this Alchemy chip doesn't have EHCI"
21#else /* Au1200 */
22
23#define USB_HOST_CONFIG (USB_MSR_BASE + USB_MSR_MCFG)
24#define USB_MCFG_PFEN (1<<31)
25#define USB_MCFG_RDCOMB (1<<30)
26#define USB_MCFG_SSDEN (1<<23)
27#define USB_MCFG_PHYPLLEN (1<<19)
28#define USB_MCFG_EHCCLKEN (1<<17)
29#define USB_MCFG_UCAM (1<<7)
30#define USB_MCFG_EBMEN (1<<3)
31#define USB_MCFG_EMEMEN (1<<2)
32
33#define USBH_ENABLE_CE (USB_MCFG_PHYPLLEN | USB_MCFG_EHCCLKEN)
34
35#ifdef CONFIG_DMA_COHERENT
36#define USBH_ENABLE_INIT (USBH_ENABLE_CE \
37 | USB_MCFG_PFEN | USB_MCFG_RDCOMB \
38 | USB_MCFG_SSDEN | USB_MCFG_UCAM \
39 | USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
40#else
41#define USBH_ENABLE_INIT (USBH_ENABLE_CE \
42 | USB_MCFG_PFEN | USB_MCFG_RDCOMB \
43 | USB_MCFG_SSDEN \
44 | USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
45#endif
46#define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN)
47
48#endif /* Au1200 */
49
50extern int usb_disabled(void);
51
52/*-------------------------------------------------------------------------*/
53
54static void au1xxx_start_ehc(struct platform_device *dev)
55{
56 pr_debug(__FILE__ ": starting Au1xxx EHCI USB Controller\n");
57
58 /* write HW defaults again in case Yamon cleared them */
59 if (au_readl(USB_HOST_CONFIG) == 0) {
60 au_writel(0x00d02000, USB_HOST_CONFIG);
61 au_readl(USB_HOST_CONFIG);
62 udelay(1000);
63 }
64 /* enable host controller */
65 au_writel(USBH_ENABLE_CE | au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG);
66 au_readl(USB_HOST_CONFIG);
67 udelay(1000);
68 au_writel(USBH_ENABLE_INIT | au_readl(USB_HOST_CONFIG),
69 USB_HOST_CONFIG);
70 au_readl(USB_HOST_CONFIG);
71 udelay(1000);
72
73 pr_debug(__FILE__ ": Clock to USB host has been enabled\n");
74}
75
76static void au1xxx_stop_ehc(struct platform_device *dev)
77{
78 pr_debug(__FILE__ ": stopping Au1xxx EHCI USB Controller\n");
79
80 /* Disable mem */
81 au_writel(~USBH_DISABLE & au_readl(USB_HOST_CONFIG), USB_HOST_CONFIG);
82 udelay(1000);
83 /* Disable clock */
84 au_writel(~USB_MCFG_EHCCLKEN & au_readl(USB_HOST_CONFIG),
85 USB_HOST_CONFIG);
86 au_readl(USB_HOST_CONFIG);
87}
88
89/*-------------------------------------------------------------------------*/
90
91/* configure so an HC device and id are always provided */
92/* always called with process context; sleeping is OK */
93
94/**
95 * usb_ehci_au1xxx_probe - initialize Au1xxx-based HCDs
96 * Context: !in_interrupt()
97 *
98 * Allocates basic resources for this USB host controller, and
99 * then invokes the start() method for the HCD associated with it
100 * through the hotplug entry's driver_data.
101 *
102 */
103int usb_ehci_au1xxx_probe(const struct hc_driver *driver,
104 struct usb_hcd **hcd_out, struct platform_device *dev)
105{
106 int retval;
107 struct usb_hcd *hcd;
108 struct ehci_hcd *ehci;
109
110#if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT)
111
112 /* Au1200 AB USB does not support coherent memory */
113 if (!(read_c0_prid() & 0xff)) {
114 pr_info("%s: this is chip revision AB!\n", dev->dev.name);
115 pr_info("%s: update your board or re-configure the kernel\n",
116 dev->dev.name);
117 return -ENODEV;
118 }
119#endif
120
121 au1xxx_start_ehc(dev);
122
123 if (dev->resource[1].flags != IORESOURCE_IRQ) {
124 pr_debug("resource[1] is not IORESOURCE_IRQ");
125 retval = -ENOMEM;
126 }
127 hcd = usb_create_hcd(driver, &dev->dev, "Au1xxx");
128 if (!hcd)
129 return -ENOMEM;
130 hcd->rsrc_start = dev->resource[0].start;
131 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
132
133 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
134 pr_debug("request_mem_region failed");
135 retval = -EBUSY;
136 goto err1;
137 }
138
139 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
140 if (!hcd->regs) {
141 pr_debug("ioremap failed");
142 retval = -ENOMEM;
143 goto err2;
144 }
145
146 ehci = hcd_to_ehci(hcd);
147 ehci->caps = hcd->regs;
148 ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase));
149 /* cache this readonly data; minimize chip reads */
150 ehci->hcs_params = readl(&ehci->caps->hcs_params);
151
152 /* ehci_hcd_init(hcd_to_ehci(hcd)); */
153
154 retval =
155 usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT | SA_SHIRQ);
156 if (retval == 0)
157 return retval;
158
159 au1xxx_stop_ehc(dev);
160 iounmap(hcd->regs);
161err2:
162 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
163err1:
164 usb_put_hcd(hcd);
165 return retval;
166}
167
168/* may be called without controller electrically present */
169/* may be called with controller, bus, and devices active */
170
171/**
172 * usb_ehci_hcd_au1xxx_remove - shutdown processing for Au1xxx-based HCDs
173 * @dev: USB Host Controller being removed
174 * Context: !in_interrupt()
175 *
176 * Reverses the effect of usb_ehci_hcd_au1xxx_probe(), first invoking
177 * the HCD's stop() method. It is always called from a thread
178 * context, normally "rmmod", "apmd", or something similar.
179 *
180 */
181void usb_ehci_au1xxx_remove(struct usb_hcd *hcd, struct platform_device *dev)
182{
183 usb_remove_hcd(hcd);
184 iounmap(hcd->regs);
185 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
186 usb_put_hcd(hcd);
187 au1xxx_stop_ehc(dev);
188}
189
190/*-------------------------------------------------------------------------*/
191
192static const struct hc_driver ehci_au1xxx_hc_driver = {
193 .description = hcd_name,
194 .product_desc = "Au1xxx EHCI",
195 .hcd_priv_size = sizeof(struct ehci_hcd),
196
197 /*
198 * generic hardware linkage
199 */
200 .irq = ehci_irq,
201 .flags = HCD_MEMORY | HCD_USB2,
202
203 /*
204 * basic lifecycle operations
205 */
206 .reset = ehci_init,
207 .start = ehci_run,
208 .stop = ehci_stop,
209
210 /*
211 * managing i/o requests and associated device resources
212 */
213 .urb_enqueue = ehci_urb_enqueue,
214 .urb_dequeue = ehci_urb_dequeue,
215 .endpoint_disable = ehci_endpoint_disable,
216
217 /*
218 * scheduling support
219 */
220 .get_frame_number = ehci_get_frame,
221
222 /*
223 * root hub support
224 */
225 .hub_status_data = ehci_hub_status_data,
226 .hub_control = ehci_hub_control,
227#ifdef CONFIG_PM
228 .hub_suspend = ehci_hub_suspend,
229 .hub_resume = ehci_hub_resume,
230#endif
231};
232
233/*-------------------------------------------------------------------------*/
234
235static int ehci_hcd_au1xxx_drv_probe(struct device *dev)
236{
237 struct platform_device *pdev = to_platform_device(dev);
238 struct usb_hcd *hcd = NULL;
239 int ret;
240
241 pr_debug("In ehci_hcd_au1xxx_drv_probe\n");
242
243 if (usb_disabled())
244 return -ENODEV;
245
246 ret = usb_ehci_au1xxx_probe(&ehci_au1xxx_hc_driver, &hcd, pdev);
247 return ret;
248}
249
250static int ehci_hcd_au1xxx_drv_remove(struct device *dev)
251{
252 struct platform_device *pdev = to_platform_device(dev);
253 struct usb_hcd *hcd = dev_get_drvdata(dev);
254
255 usb_ehci_au1xxx_remove(hcd, pdev);
256 return 0;
257}
258
259 /*TBD*/
260/*static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
261{
262 struct platform_device *pdev = to_platform_device(dev);
263 struct usb_hcd *hcd = dev_get_drvdata(dev);
264
265 return 0;
266}
267static int ehci_hcd_au1xxx_drv_resume(struct device *dev)
268{
269 struct platform_device *pdev = to_platform_device(dev);
270 struct usb_hcd *hcd = dev_get_drvdata(dev);
271
272 return 0;
273}
274*/
275static struct device_driver ehci_hcd_au1xxx_driver = {
276 .name = "au1xxx-ehci",
277 .bus = &platform_bus_type,
278 .probe = ehci_hcd_au1xxx_drv_probe,
279 .remove = ehci_hcd_au1xxx_drv_remove,
280 /*.suspend = ehci_hcd_au1xxx_drv_suspend, */
281 /*.resume = ehci_hcd_au1xxx_drv_resume, */
282};
283
284static int __init ehci_hcd_au1xxx_init(void)
285{
286 pr_debug(DRIVER_INFO " (Au1xxx)\n");
287
288 return driver_register(&ehci_hcd_au1xxx_driver);
289}
290
291static void __exit ehci_hcd_au1xxx_cleanup(void)
292{
293 driver_unregister(&ehci_hcd_au1xxx_driver);
294}
295
296module_init(ehci_hcd_au1xxx_init);
297module_exit(ehci_hcd_au1xxx_cleanup);
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 8730babb5771..79f2d8b9bfb6 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -889,14 +889,19 @@ MODULE_LICENSE ("GPL");
889 889
890#ifdef CONFIG_PCI 890#ifdef CONFIG_PCI
891#include "ehci-pci.c" 891#include "ehci-pci.c"
892#define EHCI_BUS_GLUED
892#endif 893#endif
893 894
894#ifdef CONFIG_PPC_83xx 895#ifdef CONFIG_PPC_83xx
895#include "ehci-fsl.c" 896#include "ehci-fsl.c"
897#define EHCI_BUS_GLUED
896#endif 898#endif
897 899
898#if !(defined(CONFIG_PCI) || \ 900#ifdef CONFIG_SOC_AU1X00
899 defined(CONFIG_PPC_83xx) \ 901#include "ehci-au1xxx.c"
900 ) 902#define EHCI_BUS_GLUED
903#endif
904
905#ifndef EHCI_BUS_GLUED
901#error "missing bus glue for ehci-hcd" 906#error "missing bus glue for ehci-hcd"
902#endif 907#endif
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
index 9f92aed17754..e06af6c86f86 100644
--- a/include/asm-mips/mach-mips/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -29,7 +29,11 @@
29/* #define cpu_has_prefetch ? */ 29/* #define cpu_has_prefetch ? */
30#define cpu_has_mcheck 1 30#define cpu_has_mcheck 1
31/* #define cpu_has_ejtag ? */ 31/* #define cpu_has_ejtag ? */
32#ifdef CONFIG_CPU_HAS_LLSC
32#define cpu_has_llsc 1 33#define cpu_has_llsc 1
34#else
35#define cpu_has_llsc 0
36#endif
33/* #define cpu_has_vtag_icache ? */ 37/* #define cpu_has_vtag_icache ? */
34/* #define cpu_has_dc_aliases ? */ 38/* #define cpu_has_dc_aliases ? */
35/* #define cpu_has_ic_fills_f_dc ? */ 39/* #define cpu_has_ic_fills_f_dc ? */