aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-ps3.c
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2007-06-05 23:04:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 19:34:30 -0400
commit7a4eb7fd50d4df99fc1f623e6d90680d9fca3d82 (patch)
tree6f5332d581e600a72a03e761128bd892c2097d48 /drivers/usb/host/ehci-ps3.c
parent59c2afa072506aae10ef93126aab651142e0c908 (diff)
USB: PS3: USB system-bus rework
USB HCD glue updates to reflect the new PS3 unifed device support. - Fixed remove() routine. - Added shutdown() routine. - Added request_mem_region() call. - Fixed MODULE_ALIAS(). - Made a proper fix for the hack done to support muti-platform in commit 48fda45120a819ca40cadc50144b55bff1c4c78d. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-ps3.c')
-rw-r--r--drivers/usb/host/ehci-ps3.c86
1 files changed, 74 insertions, 12 deletions
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index 37b83ba09969..829fe649a981 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -18,6 +18,7 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#include <asm/firmware.h>
21#include <asm/ps3.h> 22#include <asm/ps3.h>
22 23
23static int ps3_ehci_hc_reset(struct usb_hcd *hcd) 24static int ps3_ehci_hc_reset(struct usb_hcd *hcd)
@@ -73,7 +74,7 @@ static const struct hc_driver ps3_ehci_hc_driver = {
73#endif 74#endif
74}; 75};
75 76
76static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev) 77static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
77{ 78{
78 int result; 79 int result;
79 struct usb_hcd *hcd; 80 struct usb_hcd *hcd;
@@ -85,13 +86,30 @@ static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev)
85 goto fail_start; 86 goto fail_start;
86 } 87 }
87 88
89 result = ps3_open_hv_device(dev);
90
91 if (result) {
92 dev_dbg(&dev->core, "%s:%d: ps3_open_hv_device failed\n",
93 __func__, __LINE__);
94 goto fail_open;
95 }
96
97 result = ps3_dma_region_create(dev->d_region);
98
99 if (result) {
100 dev_dbg(&dev->core, "%s:%d: ps3_dma_region_create failed: "
101 "(%d)\n", __func__, __LINE__, result);
102 BUG_ON("check region type");
103 goto fail_dma_region;
104 }
105
88 result = ps3_mmio_region_create(dev->m_region); 106 result = ps3_mmio_region_create(dev->m_region);
89 107
90 if (result) { 108 if (result) {
91 dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed\n", 109 dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed\n",
92 __func__, __LINE__); 110 __func__, __LINE__);
93 result = -EPERM; 111 result = -EPERM;
94 goto fail_mmio; 112 goto fail_mmio_region;
95 } 113 }
96 114
97 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__, 115 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
@@ -120,6 +138,11 @@ static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev)
120 138
121 hcd->rsrc_start = dev->m_region->lpar_addr; 139 hcd->rsrc_start = dev->m_region->lpar_addr;
122 hcd->rsrc_len = dev->m_region->len; 140 hcd->rsrc_len = dev->m_region->len;
141
142 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name))
143 dev_dbg(&dev->core, "%s:%d: request_mem_region failed\n",
144 __func__, __LINE__);
145
123 hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len); 146 hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len);
124 147
125 if (!hcd->regs) { 148 if (!hcd->regs) {
@@ -153,34 +176,73 @@ static int ps3_ehci_sb_probe(struct ps3_system_bus_device *dev)
153fail_add_hcd: 176fail_add_hcd:
154 iounmap(hcd->regs); 177 iounmap(hcd->regs);
155fail_ioremap: 178fail_ioremap:
179 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
156 usb_put_hcd(hcd); 180 usb_put_hcd(hcd);
157fail_create_hcd: 181fail_create_hcd:
158 ps3_io_irq_destroy(virq); 182 ps3_io_irq_destroy(virq);
159fail_irq: 183fail_irq:
160 ps3_free_mmio_region(dev->m_region); 184 ps3_free_mmio_region(dev->m_region);
161fail_mmio: 185fail_mmio_region:
186 ps3_dma_region_free(dev->d_region);
187fail_dma_region:
188 ps3_close_hv_device(dev);
189fail_open:
162fail_start: 190fail_start:
163 return result; 191 return result;
164} 192}
165 193
166static int ps3_ehci_sb_remove(struct ps3_system_bus_device *dev) 194static int ps3_ehci_remove(struct ps3_system_bus_device *dev)
167{ 195{
196 unsigned int tmp;
168 struct usb_hcd *hcd = 197 struct usb_hcd *hcd =
169 (struct usb_hcd *)ps3_system_bus_get_driver_data(dev); 198 (struct usb_hcd *)ps3_system_bus_get_driver_data(dev);
170 199
171 usb_put_hcd(hcd); 200 BUG_ON(!hcd);
201
202 dev_dbg(&dev->core, "%s:%d: regs %p\n", __func__, __LINE__, hcd->regs);
203 dev_dbg(&dev->core, "%s:%d: irq %u\n", __func__, __LINE__, hcd->irq);
204
205 tmp = hcd->irq;
206
207 usb_remove_hcd(hcd);
208
172 ps3_system_bus_set_driver_data(dev, NULL); 209 ps3_system_bus_set_driver_data(dev, NULL);
173 210
211 BUG_ON(!hcd->regs);
212 iounmap(hcd->regs);
213
214 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
215 usb_put_hcd(hcd);
216
217 ps3_io_irq_destroy(tmp);
218 ps3_free_mmio_region(dev->m_region);
219
220 ps3_dma_region_free(dev->d_region);
221 ps3_close_hv_device(dev);
222
174 return 0; 223 return 0;
175} 224}
176 225
177MODULE_ALIAS("ps3-ehci"); 226static int ps3_ehci_driver_register(struct ps3_system_bus_driver *drv)
227{
228 return firmware_has_feature(FW_FEATURE_PS3_LV1)
229 ? ps3_system_bus_driver_register(drv)
230 : 0;
231}
232
233static void ps3_ehci_driver_unregister(struct ps3_system_bus_driver *drv)
234{
235 if (firmware_has_feature(FW_FEATURE_PS3_LV1))
236 ps3_system_bus_driver_unregister(drv);
237}
238
239MODULE_ALIAS(PS3_MODULE_ALIAS_EHCI);
178 240
179static struct ps3_system_bus_driver ps3_ehci_sb_driver = { 241static struct ps3_system_bus_driver ps3_ehci_driver = {
242 .core.name = "ps3-ehci-driver",
243 .core.owner = THIS_MODULE,
180 .match_id = PS3_MATCH_ID_EHCI, 244 .match_id = PS3_MATCH_ID_EHCI,
181 .core = { 245 .probe = ps3_ehci_probe,
182 .name = "ps3-ehci-driver", 246 .remove = ps3_ehci_remove,
183 }, 247 .shutdown = ps3_ehci_remove,
184 .probe = ps3_ehci_sb_probe,
185 .remove = ps3_ehci_sb_remove,
186}; 248};