aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-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/ohci-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/ohci-ps3.c')
-rw-r--r--drivers/usb/host/ohci-ps3.c87
1 files changed, 75 insertions, 12 deletions
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index d7cf07288b0b..01a0caeaa6bc 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-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_ohci_hc_reset(struct usb_hcd *hcd) 24static int ps3_ohci_hc_reset(struct usb_hcd *hcd)
@@ -75,7 +76,7 @@ static const struct hc_driver ps3_ohci_hc_driver = {
75#endif 76#endif
76}; 77};
77 78
78static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev) 79static int ps3_ohci_probe(struct ps3_system_bus_device *dev)
79{ 80{
80 int result; 81 int result;
81 struct usb_hcd *hcd; 82 struct usb_hcd *hcd;
@@ -87,13 +88,31 @@ static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev)
87 goto fail_start; 88 goto fail_start;
88 } 89 }
89 90
91 result = ps3_open_hv_device(dev);
92
93 if (result) {
94 dev_dbg(&dev->core, "%s:%d: ps3_open_hv_device failed: %s\n",
95 __func__, __LINE__, ps3_result(result));
96 result = -EPERM;
97 goto fail_open;
98 }
99
100 result = ps3_dma_region_create(dev->d_region);
101
102 if (result) {
103 dev_dbg(&dev->core, "%s:%d: ps3_dma_region_create failed: "
104 "(%d)\n", __func__, __LINE__, result);
105 BUG_ON("check region type");
106 goto fail_dma_region;
107 }
108
90 result = ps3_mmio_region_create(dev->m_region); 109 result = ps3_mmio_region_create(dev->m_region);
91 110
92 if (result) { 111 if (result) {
93 dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed\n", 112 dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed\n",
94 __func__, __LINE__); 113 __func__, __LINE__);
95 result = -EPERM; 114 result = -EPERM;
96 goto fail_mmio; 115 goto fail_mmio_region;
97 } 116 }
98 117
99 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__, 118 dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
@@ -122,6 +141,11 @@ static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev)
122 141
123 hcd->rsrc_start = dev->m_region->lpar_addr; 142 hcd->rsrc_start = dev->m_region->lpar_addr;
124 hcd->rsrc_len = dev->m_region->len; 143 hcd->rsrc_len = dev->m_region->len;
144
145 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name))
146 dev_dbg(&dev->core, "%s:%d: request_mem_region failed\n",
147 __func__, __LINE__);
148
125 hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len); 149 hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len);
126 150
127 if (!hcd->regs) { 151 if (!hcd->regs) {
@@ -155,34 +179,73 @@ static int ps3_ohci_sb_probe(struct ps3_system_bus_device *dev)
155fail_add_hcd: 179fail_add_hcd:
156 iounmap(hcd->regs); 180 iounmap(hcd->regs);
157fail_ioremap: 181fail_ioremap:
182 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
158 usb_put_hcd(hcd); 183 usb_put_hcd(hcd);
159fail_create_hcd: 184fail_create_hcd:
160 ps3_io_irq_destroy(virq); 185 ps3_io_irq_destroy(virq);
161fail_irq: 186fail_irq:
162 ps3_free_mmio_region(dev->m_region); 187 ps3_free_mmio_region(dev->m_region);
163fail_mmio: 188fail_mmio_region:
189 ps3_dma_region_free(dev->d_region);
190fail_dma_region:
191 ps3_close_hv_device(dev);
192fail_open:
164fail_start: 193fail_start:
165 return result; 194 return result;
166} 195}
167 196
168static int ps3_ohci_sb_remove (struct ps3_system_bus_device *dev) 197static int ps3_ohci_remove (struct ps3_system_bus_device *dev)
169{ 198{
199 unsigned int tmp;
170 struct usb_hcd *hcd = 200 struct usb_hcd *hcd =
171 (struct usb_hcd *)ps3_system_bus_get_driver_data(dev); 201 (struct usb_hcd *)ps3_system_bus_get_driver_data(dev);
172 202
173 usb_put_hcd(hcd); 203 BUG_ON(!hcd);
204
205 dev_dbg(&dev->core, "%s:%d: regs %p\n", __func__, __LINE__, hcd->regs);
206 dev_dbg(&dev->core, "%s:%d: irq %u\n", __func__, __LINE__, hcd->irq);
207
208 tmp = hcd->irq;
209
210 usb_remove_hcd(hcd);
211
174 ps3_system_bus_set_driver_data(dev, NULL); 212 ps3_system_bus_set_driver_data(dev, NULL);
175 213
214 BUG_ON(!hcd->regs);
215 iounmap(hcd->regs);
216
217 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
218 usb_put_hcd(hcd);
219
220 ps3_io_irq_destroy(tmp);
221 ps3_free_mmio_region(dev->m_region);
222
223 ps3_dma_region_free(dev->d_region);
224 ps3_close_hv_device(dev);
225
176 return 0; 226 return 0;
177} 227}
178 228
179MODULE_ALIAS("ps3-ohci"); 229static int ps3_ohci_driver_register(struct ps3_system_bus_driver *drv)
230{
231 return firmware_has_feature(FW_FEATURE_PS3_LV1)
232 ? ps3_system_bus_driver_register(drv)
233 : 0;
234}
235
236static void ps3_ohci_driver_unregister(struct ps3_system_bus_driver *drv)
237{
238 if (firmware_has_feature(FW_FEATURE_PS3_LV1))
239 ps3_system_bus_driver_unregister(drv);
240}
241
242MODULE_ALIAS(PS3_MODULE_ALIAS_OHCI);
180 243
181static struct ps3_system_bus_driver ps3_ohci_sb_driver = { 244static struct ps3_system_bus_driver ps3_ohci_driver = {
245 .core.name = "ps3-ohci-driver",
246 .core.owner = THIS_MODULE,
182 .match_id = PS3_MATCH_ID_OHCI, 247 .match_id = PS3_MATCH_ID_OHCI,
183 .core = { 248 .probe = ps3_ohci_probe,
184 .name = "ps3-ohci-driver", 249 .remove = ps3_ohci_remove,
185 }, 250 .shutdown = ps3_ohci_remove,
186 .probe = ps3_ohci_sb_probe,
187 .remove = ps3_ohci_sb_remove,
188}; 251};