aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorYoshihiro Shimoda <shimoda.yoshihiro@renesas.com>2008-01-11 08:56:15 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 17:35:03 -0500
commit828d55c58cba6b652fd30e00c3d940cb7c523e3c (patch)
tree599fafc3e89281e12eeab5c1dbb39c85ec67c81e /drivers/usb
parent504b55cc8bca420856159833629da8f9f92d5adc (diff)
USB: add support for SuperH OHCI
add support for SuperH OHCI. supported CPU are: - SH7720 - SH7721 - SH7763 Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Acked-by: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig4
-rw-r--r--drivers/usb/host/ohci-hcd.c7
-rw-r--r--drivers/usb/host/ohci-sh.c143
3 files changed, 154 insertions, 0 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 8d48d973efcb..755823cdf62a 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -42,6 +42,10 @@ config USB_ARCH_HAS_OHCI
42 default y if PPC_MPC52xx 42 default y if PPC_MPC52xx
43 # MIPS: 43 # MIPS:
44 default y if SOC_AU1X00 44 default y if SOC_AU1X00
45 # SH:
46 default y if CPU_SUBTYPE_SH7720
47 default y if CPU_SUBTYPE_SH7721
48 default y if CPU_SUBTYPE_SH7763
45 # more: 49 # more:
46 default PCI 50 default PCI
47 51
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 8dd5d25f2f06..b8ed84d5406d 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1029,6 +1029,13 @@ MODULE_LICENSE ("GPL");
1029#define PLATFORM_DRIVER usb_hcd_pnx4008_driver 1029#define PLATFORM_DRIVER usb_hcd_pnx4008_driver
1030#endif 1030#endif
1031 1031
1032#if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
1033 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
1034 defined(CONFIG_CPU_SUBTYPE_SH7763)
1035#include "ohci-sh.c"
1036#define PLATFORM_DRIVER ohci_hcd_sh_driver
1037#endif
1038
1032 1039
1033#ifdef CONFIG_USB_OHCI_HCD_PPC_OF 1040#ifdef CONFIG_USB_OHCI_HCD_PPC_OF
1034#include "ohci-ppc-of.c" 1041#include "ohci-ppc-of.c"
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c
new file mode 100644
index 000000000000..5309ac039e15
--- /dev/null
+++ b/drivers/usb/host/ohci-sh.c
@@ -0,0 +1,143 @@
1/*
2 * OHCI HCD (Host Controller Driver) for USB.
3 *
4 * Copyright (C) 2008 Renesas Solutions Corp.
5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22
23#include <linux/platform_device.h>
24
25static int ohci_sh_start(struct usb_hcd *hcd)
26{
27 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
28
29 ohci_hcd_init(ohci);
30 ohci_init(ohci);
31 ohci_run(ohci);
32 hcd->state = HC_STATE_RUNNING;
33 return 0;
34}
35
36static const struct hc_driver ohci_sh_hc_driver = {
37 .description = hcd_name,
38 .product_desc = "SuperH OHCI",
39 .hcd_priv_size = sizeof(struct ohci_hcd),
40
41 /*
42 * generic hardware linkage
43 */
44 .irq = ohci_irq,
45 .flags = HCD_USB11 | HCD_MEMORY,
46
47 /*
48 * basic lifecycle operations
49 */
50 .start = ohci_sh_start,
51 .stop = ohci_stop,
52 .shutdown = ohci_shutdown,
53
54 /*
55 * managing i/o requests and associated device resources
56 */
57 .urb_enqueue = ohci_urb_enqueue,
58 .urb_dequeue = ohci_urb_dequeue,
59 .endpoint_disable = ohci_endpoint_disable,
60
61 /*
62 * scheduling support
63 */
64 .get_frame_number = ohci_get_frame,
65
66 /*
67 * root hub support
68 */
69 .hub_status_data = ohci_hub_status_data,
70 .hub_control = ohci_hub_control,
71 .hub_irq_enable = ohci_rhsc_enable,
72#ifdef CONFIG_PM
73 .bus_suspend = ohci_bus_suspend,
74 .bus_resume = ohci_bus_resume,
75#endif
76 .start_port_reset = ohci_start_port_reset,
77};
78
79/*-------------------------------------------------------------------------*/
80
81#define resource_len(r) (((r)->end - (r)->start) + 1)
82static int ohci_hcd_sh_probe(struct platform_device *pdev)
83{
84 struct resource *res = NULL;
85 struct usb_hcd *hcd = NULL;
86 int irq = -1;
87 int ret;
88
89 if (usb_disabled())
90 return -ENODEV;
91
92 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
93 if (!res) {
94 err("platform_get_resource error.");
95 return -ENODEV;
96 }
97
98 irq = platform_get_irq(pdev, 0);
99 if (irq < 0) {
100 err("platform_get_irq error.");
101 return -ENODEV;
102 }
103
104 /* initialize hcd */
105 hcd = usb_create_hcd(&ohci_sh_hc_driver, &pdev->dev, (char *)hcd_name);
106 if (!hcd) {
107 err("Failed to create hcd");
108 return -ENOMEM;
109 }
110
111 hcd->regs = (void __iomem *)res->start;
112 hcd->rsrc_start = res->start;
113 hcd->rsrc_len = resource_len(res);
114 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
115 if (ret != 0) {
116 err("Failed to add hcd");
117 usb_put_hcd(hcd);
118 return ret;
119 }
120
121 return ret;
122}
123
124static int ohci_hcd_sh_remove(struct platform_device *pdev)
125{
126 struct usb_hcd *hcd = platform_get_drvdata(pdev);
127
128 usb_remove_hcd(hcd);
129 usb_put_hcd(hcd);
130
131 return 0;
132}
133
134static struct platform_driver ohci_hcd_sh_driver = {
135 .probe = ohci_hcd_sh_probe,
136 .remove = ohci_hcd_sh_remove,
137 .shutdown = usb_hcd_platform_shutdown,
138 .driver = {
139 .name = "sh_ohci",
140 .owner = THIS_MODULE,
141 },
142};
143