aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-hcd.c22
-rw-r--r--drivers/usb/host/ehci-ps3.c86
-rw-r--r--drivers/usb/host/ohci-hcd.c20
-rw-r--r--drivers/usb/host/ohci-ps3.c87
4 files changed, 162 insertions, 53 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a205a53c61ff..c4e15ed1405a 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -41,10 +41,6 @@
41#include <asm/irq.h> 41#include <asm/irq.h>
42#include <asm/system.h> 42#include <asm/system.h>
43#include <asm/unaligned.h> 43#include <asm/unaligned.h>
44#ifdef CONFIG_PPC_PS3
45#include <asm/firmware.h>
46#endif
47
48 44
49/*-------------------------------------------------------------------------*/ 45/*-------------------------------------------------------------------------*/
50 46
@@ -1012,7 +1008,7 @@ MODULE_LICENSE ("GPL");
1012 1008
1013#ifdef CONFIG_PPC_PS3 1009#ifdef CONFIG_PPC_PS3
1014#include "ehci-ps3.c" 1010#include "ehci-ps3.c"
1015#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_sb_driver 1011#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver
1016#endif 1012#endif
1017 1013
1018#ifdef CONFIG_440EPX 1014#ifdef CONFIG_440EPX
@@ -1051,18 +1047,15 @@ static int __init ehci_hcd_init(void)
1051#endif 1047#endif
1052 1048
1053#ifdef PS3_SYSTEM_BUS_DRIVER 1049#ifdef PS3_SYSTEM_BUS_DRIVER
1054 if (firmware_has_feature(FW_FEATURE_PS3_LV1)) { 1050 retval = ps3_ehci_driver_register(&PS3_SYSTEM_BUS_DRIVER);
1055 retval = ps3_system_bus_driver_register( 1051 if (retval < 0) {
1056 &PS3_SYSTEM_BUS_DRIVER);
1057 if (retval < 0) {
1058#ifdef PLATFORM_DRIVER 1052#ifdef PLATFORM_DRIVER
1059 platform_driver_unregister(&PLATFORM_DRIVER); 1053 platform_driver_unregister(&PLATFORM_DRIVER);
1060#endif 1054#endif
1061#ifdef PCI_DRIVER 1055#ifdef PCI_DRIVER
1062 pci_unregister_driver(&PCI_DRIVER); 1056 pci_unregister_driver(&PCI_DRIVER);
1063#endif 1057#endif
1064 return retval; 1058 return retval;
1065 }
1066 } 1059 }
1067#endif 1060#endif
1068 1061
@@ -1079,8 +1072,7 @@ static void __exit ehci_hcd_cleanup(void)
1079 pci_unregister_driver(&PCI_DRIVER); 1072 pci_unregister_driver(&PCI_DRIVER);
1080#endif 1073#endif
1081#ifdef PS3_SYSTEM_BUS_DRIVER 1074#ifdef PS3_SYSTEM_BUS_DRIVER
1082 if (firmware_has_feature(FW_FEATURE_PS3_LV1)) 1075 ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1083 ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1084#endif 1076#endif
1085} 1077}
1086module_exit(ehci_hcd_cleanup); 1078module_exit(ehci_hcd_cleanup);
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};
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 44717fab7435..2038125b7f8c 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -42,9 +42,6 @@
42#include <asm/system.h> 42#include <asm/system.h>
43#include <asm/unaligned.h> 43#include <asm/unaligned.h>
44#include <asm/byteorder.h> 44#include <asm/byteorder.h>
45#ifdef CONFIG_PPC_PS3
46#include <asm/firmware.h>
47#endif
48 45
49#include "../core/hcd.h" 46#include "../core/hcd.h"
50 47
@@ -927,7 +924,7 @@ MODULE_LICENSE ("GPL");
927 924
928#ifdef CONFIG_PPC_PS3 925#ifdef CONFIG_PPC_PS3
929#include "ohci-ps3.c" 926#include "ohci-ps3.c"
930#define PS3_SYSTEM_BUS_DRIVER ps3_ohci_sb_driver 927#define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
931#endif 928#endif
932 929
933#if !defined(PCI_DRIVER) && \ 930#if !defined(PCI_DRIVER) && \
@@ -950,12 +947,9 @@ static int __init ohci_hcd_mod_init(void)
950 sizeof (struct ed), sizeof (struct td)); 947 sizeof (struct ed), sizeof (struct td));
951 948
952#ifdef PS3_SYSTEM_BUS_DRIVER 949#ifdef PS3_SYSTEM_BUS_DRIVER
953 if (firmware_has_feature(FW_FEATURE_PS3_LV1)) { 950 retval = ps3_ohci_driver_register(&PS3_SYSTEM_BUS_DRIVER);
954 retval = ps3_system_bus_driver_register( 951 if (retval < 0)
955 &PS3_SYSTEM_BUS_DRIVER); 952 goto error_ps3;
956 if (retval < 0)
957 goto error_ps3;
958 }
959#endif 953#endif
960 954
961#ifdef PLATFORM_DRIVER 955#ifdef PLATFORM_DRIVER
@@ -1001,8 +995,7 @@ static int __init ohci_hcd_mod_init(void)
1001 error_platform: 995 error_platform:
1002#endif 996#endif
1003#ifdef PS3_SYSTEM_BUS_DRIVER 997#ifdef PS3_SYSTEM_BUS_DRIVER
1004 if (firmware_has_feature(FW_FEATURE_PS3_LV1)) 998 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1005 ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1006 error_ps3: 999 error_ps3:
1007#endif 1000#endif
1008 return retval; 1001 return retval;
@@ -1024,8 +1017,7 @@ static void __exit ohci_hcd_mod_exit(void)
1024 platform_driver_unregister(&PLATFORM_DRIVER); 1017 platform_driver_unregister(&PLATFORM_DRIVER);
1025#endif 1018#endif
1026#ifdef PS3_SYSTEM_BUS_DRIVER 1019#ifdef PS3_SYSTEM_BUS_DRIVER
1027 if (firmware_has_feature(FW_FEATURE_PS3_LV1)) 1020 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1028 ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1029#endif 1021#endif
1030} 1022}
1031module_exit(ohci_hcd_mod_exit); 1023module_exit(ohci_hcd_mod_exit);
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};