diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2012-05-09 13:58:14 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2012-07-18 16:40:29 -0400 |
commit | 47fc28bff82a4dd5f6b41c97e335d10fc78a8e9a (patch) | |
tree | 829b845956f9f5f6b2997424fa1d6d72244b0d1b /arch/tile/kernel | |
parent | d1cc1732cc62034542b042a4506d7c5043bc5e5e (diff) |
usb: add host support for the tilegx architecture
This change adds OHCI and EHCI support for the tilegx's on-chip
USB hardware.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r-- | arch/tile/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/tile/kernel/usb.c | 69 |
2 files changed, 70 insertions, 0 deletions
diff --git a/arch/tile/kernel/Makefile b/arch/tile/kernel/Makefile index 49d4ce3cd7f4..5334be8e2538 100644 --- a/arch/tile/kernel/Makefile +++ b/arch/tile/kernel/Makefile | |||
@@ -19,3 +19,4 @@ obj-$(CONFIG_PCI) += pci_gx.o | |||
19 | else | 19 | else |
20 | obj-$(CONFIG_PCI) += pci.o | 20 | obj-$(CONFIG_PCI) += pci.o |
21 | endif | 21 | endif |
22 | obj-$(CONFIG_TILE_USB) += usb.o | ||
diff --git a/arch/tile/kernel/usb.c b/arch/tile/kernel/usb.c new file mode 100644 index 000000000000..5af8debc6a71 --- /dev/null +++ b/arch/tile/kernel/usb.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * Register the Tile-Gx USB interfaces as platform devices. | ||
15 | * | ||
16 | * The actual USB driver is just some glue (in | ||
17 | * drivers/usb/host/[eo]hci-tilegx.c) which makes the registers available | ||
18 | * to the standard kernel EHCI and OHCI drivers. | ||
19 | */ | ||
20 | |||
21 | #include <linux/dma-mapping.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/usb/tilegx.h> | ||
24 | #include <linux/types.h> | ||
25 | |||
26 | static u64 ehci_dmamask = DMA_BIT_MASK(32); | ||
27 | |||
28 | #define USB_HOST_DEF(unit, type, dmamask) \ | ||
29 | static struct \ | ||
30 | tilegx_usb_platform_data tilegx_usb_platform_data_ ## type ## \ | ||
31 | hci ## unit = { \ | ||
32 | .dev_index = unit, \ | ||
33 | }; \ | ||
34 | \ | ||
35 | static struct platform_device tilegx_usb_ ## type ## hci ## unit = { \ | ||
36 | .name = "tilegx-" #type "hci", \ | ||
37 | .id = unit, \ | ||
38 | .dev = { \ | ||
39 | .dma_mask = dmamask, \ | ||
40 | .coherent_dma_mask = DMA_BIT_MASK(32), \ | ||
41 | .platform_data = \ | ||
42 | &tilegx_usb_platform_data_ ## type ## hci ## \ | ||
43 | unit, \ | ||
44 | }, \ | ||
45 | }; | ||
46 | |||
47 | USB_HOST_DEF(0, e, &ehci_dmamask) | ||
48 | USB_HOST_DEF(0, o, NULL) | ||
49 | USB_HOST_DEF(1, e, &ehci_dmamask) | ||
50 | USB_HOST_DEF(1, o, NULL) | ||
51 | |||
52 | #undef USB_HOST_DEF | ||
53 | |||
54 | static struct platform_device *tilegx_usb_devices[] __initdata = { | ||
55 | &tilegx_usb_ehci0, | ||
56 | &tilegx_usb_ehci1, | ||
57 | &tilegx_usb_ohci0, | ||
58 | &tilegx_usb_ohci1, | ||
59 | }; | ||
60 | |||
61 | /** Add our set of possible USB devices. */ | ||
62 | static int __init tilegx_usb_init(void) | ||
63 | { | ||
64 | platform_add_devices(tilegx_usb_devices, | ||
65 | ARRAY_SIZE(tilegx_usb_devices)); | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | arch_initcall(tilegx_usb_init); | ||