ehci-ps3.c revision 7071a3ce0ca058ad2a9e3e8c33f30fb0bce62005
1ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand/*
2ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  PS3 EHCI Host Controller driver
3ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *
4ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  Copyright (C) 2006 Sony Computer Entertainment Inc.
5ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  Copyright 2006 Sony Corp.
6ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *
7ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  This program is free software; you can redistribute it and/or modify
8ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  it under the terms of the GNU General Public License as published by
9ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  the Free Software Foundation; version 2 of the License.
10ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *
11ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  This program is distributed in the hope that it will be useful,
12ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  GNU General Public License for more details.
15ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *
16ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  You should have received a copy of the GNU General Public License
17ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  along with this program; if not, write to the Free Software
18ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand */
20ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
217a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand#include <asm/firmware.h>
22ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand#include <asm/ps3.h>
23ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
24ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandstatic int ps3_ehci_hc_reset(struct usb_hcd *hcd)
25ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand{
26ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	int result;
27ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
28ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
29ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	ehci->big_endian_mmio = 1;
30ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
31ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	ehci->caps = hcd->regs;
32ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	ehci->regs = hcd->regs + HC_LENGTH(ehci_readl(ehci,
33ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		&ehci->caps->hc_capbase));
34ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
35ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dbg_hcs_params(ehci, "reset");
36ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dbg_hcc_params(ehci, "reset");
37ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
38ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
39ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
40ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	result = ehci_halt(ehci);
41ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
42ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (result)
43ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		return result;
44ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
45ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	result = ehci_init(hcd);
46ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
47ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (result)
48ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		return result;
49ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
50af1c51fcb2aea23ec2dfe73b7d66515d1622e689Marcelo Tosatti	ehci_reset(ehci);
51ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
52ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	return result;
53ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand}
54ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
55ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandstatic const struct hc_driver ps3_ehci_hc_driver = {
56ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.description		= hcd_name,
57ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.product_desc		= "PS3 EHCI Host Controller",
58ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.hcd_priv_size		= sizeof(struct ehci_hcd),
59ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.irq			= ehci_irq,
60ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.flags			= HCD_MEMORY | HCD_USB2,
61ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.reset			= ps3_ehci_hc_reset,
62ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.start			= ehci_run,
63ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.stop			= ehci_stop,
64ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.shutdown		= ehci_shutdown,
65ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.urb_enqueue		= ehci_urb_enqueue,
66ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.urb_dequeue		= ehci_urb_dequeue,
67ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.endpoint_disable	= ehci_endpoint_disable,
68ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.get_frame_number	= ehci_get_frame,
69ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.hub_status_data	= ehci_hub_status_data,
70ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.hub_control		= ehci_hub_control,
71ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand#if defined(CONFIG_PM)
72ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.bus_suspend		= ehci_bus_suspend,
73ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.bus_resume		= ehci_bus_resume,
74ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand#endif
7590da096ee46b682011b7d549e52b81cf9742e60bBalaji Rao	.relinquish_port	= ehci_relinquish_port,
763a31155cfff0935e4b178f3dca733d2d60d2eb8dAlan Stern	.port_handed_over	= ehci_port_handed_over,
77ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand};
78ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
797a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic int ps3_ehci_probe(struct ps3_system_bus_device *dev)
80ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand{
81ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	int result;
82ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	struct usb_hcd *hcd;
83ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	unsigned int virq;
84ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	static u64 dummy_mask = DMA_32BIT_MASK;
85ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
86ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (usb_disabled()) {
87ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		result = -ENODEV;
88ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		goto fail_start;
89ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	}
90ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
917a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	result = ps3_open_hv_device(dev);
927a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
937a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	if (result) {
947a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		dev_dbg(&dev->core, "%s:%d: ps3_open_hv_device failed\n",
957a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand			__func__, __LINE__);
967a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		goto fail_open;
977a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	}
987a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
997a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	result = ps3_dma_region_create(dev->d_region);
1007a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
1017a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	if (result) {
1027a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		dev_dbg(&dev->core, "%s:%d: ps3_dma_region_create failed: "
1037a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand			"(%d)\n", __func__, __LINE__, result);
1047a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		BUG_ON("check region type");
1057a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		goto fail_dma_region;
1067a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	}
1077a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
108ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	result = ps3_mmio_region_create(dev->m_region);
109ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
110ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (result) {
111ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed\n",
112ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand			__func__, __LINE__);
113ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		result = -EPERM;
1147a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		goto fail_mmio_region;
115ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	}
116ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
117ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
118ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		__LINE__, dev->m_region->lpar_addr);
119ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
120dc4f60c25ae71e8278dcf909486e4aa34de7eecbGeoff Levand	result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq);
121ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
122ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (result) {
123ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n",
124ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand			__func__, __LINE__, virq);
125ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		result = -EPERM;
126ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		goto fail_irq;
127ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	}
128ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
129ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
130ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
1317071a3ce0ca058ad2a9e3e8c33f30fb0bce62005Kay Sievers	hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev_name(&dev->core));
132ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
133ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (!hcd) {
134ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__,
135ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand			__LINE__);
136ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		result = -ENOMEM;
137ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		goto fail_create_hcd;
138ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	}
139ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
140ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	hcd->rsrc_start = dev->m_region->lpar_addr;
141ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	hcd->rsrc_len = dev->m_region->len;
1427a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
1437a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name))
1447a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		dev_dbg(&dev->core, "%s:%d: request_mem_region failed\n",
1457a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand			__func__, __LINE__);
1467a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
147ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len);
148ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
149ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (!hcd->regs) {
150ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		dev_dbg(&dev->core, "%s:%d: ioremap failed\n", __func__,
151ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand			__LINE__);
152ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		result = -EPERM;
153ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		goto fail_ioremap;
154ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	}
155ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
156ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dev_dbg(&dev->core, "%s:%d: hcd->rsrc_start %lxh\n", __func__, __LINE__,
157ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		(unsigned long)hcd->rsrc_start);
158ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dev_dbg(&dev->core, "%s:%d: hcd->rsrc_len   %lxh\n", __func__, __LINE__,
159ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		(unsigned long)hcd->rsrc_len);
160ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dev_dbg(&dev->core, "%s:%d: hcd->regs       %lxh\n", __func__, __LINE__,
161ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		(unsigned long)hcd->regs);
162ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	dev_dbg(&dev->core, "%s:%d: virq            %lu\n", __func__, __LINE__,
163ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		(unsigned long)virq);
164ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
165ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	ps3_system_bus_set_driver_data(dev, hcd);
166ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
167ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	result = usb_add_hcd(hcd, virq, IRQF_DISABLED);
168ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
169ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	if (result) {
170ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		dev_dbg(&dev->core, "%s:%d: usb_add_hcd failed (%d)\n",
171ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand			__func__, __LINE__, result);
172ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		goto fail_add_hcd;
173ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	}
174ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
175ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	return result;
176ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
177ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_add_hcd:
178ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	iounmap(hcd->regs);
179ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_ioremap:
1807a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
181ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	usb_put_hcd(hcd);
182ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_create_hcd:
183dc4f60c25ae71e8278dcf909486e4aa34de7eecbGeoff Levand	ps3_io_irq_destroy(virq);
184ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_irq:
185ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	ps3_free_mmio_region(dev->m_region);
1867a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandfail_mmio_region:
1877a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	ps3_dma_region_free(dev->d_region);
1887a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandfail_dma_region:
1897a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	ps3_close_hv_device(dev);
1907a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandfail_open:
191ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_start:
192ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	return result;
193ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand}
194ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
1957a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic int ps3_ehci_remove(struct ps3_system_bus_device *dev)
196ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand{
1977a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	unsigned int tmp;
198ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	struct usb_hcd *hcd =
199ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand		(struct usb_hcd *)ps3_system_bus_get_driver_data(dev);
200ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
2017a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	BUG_ON(!hcd);
2027a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2037a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	dev_dbg(&dev->core, "%s:%d: regs %p\n", __func__, __LINE__, hcd->regs);
2047a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	dev_dbg(&dev->core, "%s:%d: irq %u\n", __func__, __LINE__, hcd->irq);
2057a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2067a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	tmp = hcd->irq;
2077a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2087a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	usb_remove_hcd(hcd);
2097a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
210ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	ps3_system_bus_set_driver_data(dev, NULL);
211ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
2127a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	BUG_ON(!hcd->regs);
2137a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	iounmap(hcd->regs);
2147a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2157a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
2167a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	usb_put_hcd(hcd);
2177a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2187a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	ps3_io_irq_destroy(tmp);
2197a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	ps3_free_mmio_region(dev->m_region);
2207a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2217a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	ps3_dma_region_free(dev->d_region);
2227a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	ps3_close_hv_device(dev);
2237a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
224ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	return 0;
225ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand}
226ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
2277a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic int ps3_ehci_driver_register(struct ps3_system_bus_driver *drv)
2287a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand{
2297a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	return firmware_has_feature(FW_FEATURE_PS3_LV1)
2307a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		? ps3_system_bus_driver_register(drv)
2317a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		: 0;
2327a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand}
2337a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2347a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic void ps3_ehci_driver_unregister(struct ps3_system_bus_driver *drv)
2357a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand{
2367a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	if (firmware_has_feature(FW_FEATURE_PS3_LV1))
2377a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand		ps3_system_bus_driver_unregister(drv);
2387a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand}
2397a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand
2407a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff LevandMODULE_ALIAS(PS3_MODULE_ALIAS_EHCI);
241ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand
2427a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic struct ps3_system_bus_driver ps3_ehci_driver = {
2437a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	.core.name = "ps3-ehci-driver",
2447a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	.core.owner = THIS_MODULE,
245ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand	.match_id = PS3_MATCH_ID_EHCI,
2467a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	.probe = ps3_ehci_probe,
2477a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	.remove = ps3_ehci_remove,
2487a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand	.shutdown = ps3_ehci_remove,
249ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand};
250