ehci-ps3.c revision 914b701280a76f96890ad63eb0fa99bf204b961c
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, 68b18ffd49e86102a9ed0a1cc83fdafe3891e844e5Alan Stern .endpoint_reset = ehci_endpoint_reset, 69ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand .get_frame_number = ehci_get_frame, 70ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand .hub_status_data = ehci_hub_status_data, 71ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand .hub_control = ehci_hub_control, 72ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand#if defined(CONFIG_PM) 73ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand .bus_suspend = ehci_bus_suspend, 74ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand .bus_resume = ehci_bus_resume, 75ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand#endif 7690da096ee46b682011b7d549e52b81cf9742e60bBalaji Rao .relinquish_port = ehci_relinquish_port, 773a31155cfff0935e4b178f3dca733d2d60d2eb8dAlan Stern .port_handed_over = ehci_port_handed_over, 78914b701280a76f96890ad63eb0fa99bf204b961cAlan Stern 79914b701280a76f96890ad63eb0fa99bf204b961cAlan Stern .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, 80ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand}; 81ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 82313485175da221c388f6a8ecf4c30062ba9bea17Geert Uytterhoevenstatic int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev) 83ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand{ 84ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand int result; 85ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand struct usb_hcd *hcd; 86ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand unsigned int virq; 87284901a90a9e0b812ca3f5f852cbbfb60d10249dYang Hongyang static u64 dummy_mask = DMA_BIT_MASK(32); 88ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 89ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand if (usb_disabled()) { 90ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand result = -ENODEV; 91ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand goto fail_start; 92ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand } 93ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 947a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand result = ps3_open_hv_device(dev); 957a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 967a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand if (result) { 977a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand dev_dbg(&dev->core, "%s:%d: ps3_open_hv_device failed\n", 987a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand __func__, __LINE__); 997a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand goto fail_open; 1007a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand } 1017a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 1027a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand result = ps3_dma_region_create(dev->d_region); 1037a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 1047a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand if (result) { 1057a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand dev_dbg(&dev->core, "%s:%d: ps3_dma_region_create failed: " 1067a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand "(%d)\n", __func__, __LINE__, result); 1077a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand BUG_ON("check region type"); 1087a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand goto fail_dma_region; 1097a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand } 1107a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 111ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand result = ps3_mmio_region_create(dev->m_region); 112ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 113ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand if (result) { 114ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed\n", 115ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand __func__, __LINE__); 116ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand result = -EPERM; 1177a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand goto fail_mmio_region; 118ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand } 119ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 120ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__, 121ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand __LINE__, dev->m_region->lpar_addr); 122ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 123dc4f60c25ae71e8278dcf909486e4aa34de7eecbGeoff Levand result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq); 124ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 125ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand if (result) { 126ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n", 127ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand __func__, __LINE__, virq); 128ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand result = -EPERM; 129ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand goto fail_irq; 130ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand } 131ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 132ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ 133ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 1347071a3ce0ca058ad2a9e3e8c33f30fb0bce62005Kay Sievers hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev_name(&dev->core)); 135ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 136ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand if (!hcd) { 137ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__, 138ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand __LINE__); 139ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand result = -ENOMEM; 140ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand goto fail_create_hcd; 141ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand } 142ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 143ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand hcd->rsrc_start = dev->m_region->lpar_addr; 144ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand hcd->rsrc_len = dev->m_region->len; 1457a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 1467a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) 1477a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand dev_dbg(&dev->core, "%s:%d: request_mem_region failed\n", 1487a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand __func__, __LINE__); 1497a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 150ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len); 151ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 152ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand if (!hcd->regs) { 153ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: ioremap failed\n", __func__, 154ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand __LINE__); 155ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand result = -EPERM; 156ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand goto fail_ioremap; 157ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand } 158ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 159ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: hcd->rsrc_start %lxh\n", __func__, __LINE__, 160ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand (unsigned long)hcd->rsrc_start); 161ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: hcd->rsrc_len %lxh\n", __func__, __LINE__, 162ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand (unsigned long)hcd->rsrc_len); 163ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: hcd->regs %lxh\n", __func__, __LINE__, 164ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand (unsigned long)hcd->regs); 165ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: virq %lu\n", __func__, __LINE__, 166ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand (unsigned long)virq); 167ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 16803fa68c245cccbcb99035cbabaa13b408ba91ab5Geert Uytterhoeven ps3_system_bus_set_drvdata(dev, hcd); 169ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 170ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand result = usb_add_hcd(hcd, virq, IRQF_DISABLED); 171ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 172ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand if (result) { 173ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand dev_dbg(&dev->core, "%s:%d: usb_add_hcd failed (%d)\n", 174ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand __func__, __LINE__, result); 175ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand goto fail_add_hcd; 176ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand } 177ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 178ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand return result; 179ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 180ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_add_hcd: 181ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand iounmap(hcd->regs); 182ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_ioremap: 1837a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 184ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand usb_put_hcd(hcd); 185ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_create_hcd: 186dc4f60c25ae71e8278dcf909486e4aa34de7eecbGeoff Levand ps3_io_irq_destroy(virq); 187ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_irq: 188ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand ps3_free_mmio_region(dev->m_region); 1897a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandfail_mmio_region: 1907a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ps3_dma_region_free(dev->d_region); 1917a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandfail_dma_region: 1927a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ps3_close_hv_device(dev); 1937a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandfail_open: 194ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levandfail_start: 195ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand return result; 196ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand} 197ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 1987a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic int ps3_ehci_remove(struct ps3_system_bus_device *dev) 199ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand{ 2007a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand unsigned int tmp; 20103fa68c245cccbcb99035cbabaa13b408ba91ab5Geert Uytterhoeven struct usb_hcd *hcd = ps3_system_bus_get_drvdata(dev); 202ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 2037a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand BUG_ON(!hcd); 2047a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 2057a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand dev_dbg(&dev->core, "%s:%d: regs %p\n", __func__, __LINE__, hcd->regs); 2067a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand dev_dbg(&dev->core, "%s:%d: irq %u\n", __func__, __LINE__, hcd->irq); 2077a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 2087a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand tmp = hcd->irq; 2097a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 210ddcb01ff9bf49c4dbbb058423559f7bc90b89374Geoff Levand ehci_shutdown(hcd); 2117a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand usb_remove_hcd(hcd); 2127a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 21303fa68c245cccbcb99035cbabaa13b408ba91ab5Geert Uytterhoeven ps3_system_bus_set_drvdata(dev, NULL); 214ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 2157a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand BUG_ON(!hcd->regs); 2167a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand iounmap(hcd->regs); 2177a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 2187a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 2197a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand usb_put_hcd(hcd); 2207a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 2217a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ps3_io_irq_destroy(tmp); 2227a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ps3_free_mmio_region(dev->m_region); 2237a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 2247a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ps3_dma_region_free(dev->d_region); 2257a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ps3_close_hv_device(dev); 2267a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 227ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand return 0; 228ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand} 229ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 230313485175da221c388f6a8ecf4c30062ba9bea17Geert Uytterhoevenstatic int __init ps3_ehci_driver_register(struct ps3_system_bus_driver *drv) 2317a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand{ 2327a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand return firmware_has_feature(FW_FEATURE_PS3_LV1) 2337a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ? ps3_system_bus_driver_register(drv) 2347a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand : 0; 2357a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand} 2367a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 2377a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic void ps3_ehci_driver_unregister(struct ps3_system_bus_driver *drv) 2387a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand{ 2397a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand if (firmware_has_feature(FW_FEATURE_PS3_LV1)) 2407a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand ps3_system_bus_driver_unregister(drv); 2417a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand} 2427a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand 2437a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff LevandMODULE_ALIAS(PS3_MODULE_ALIAS_EHCI); 244ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand 2457a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levandstatic struct ps3_system_bus_driver ps3_ehci_driver = { 2467a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand .core.name = "ps3-ehci-driver", 2477a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand .core.owner = THIS_MODULE, 248ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand .match_id = PS3_MATCH_ID_EHCI, 2497a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand .probe = ps3_ehci_probe, 2507a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand .remove = ps3_ehci_remove, 2517a4eb7fd50d4df99fc1f623e6d90680d9fca3d82Geoff Levand .shutdown = ps3_ehci_remove, 252ad75a41085d80c8ce5e885962c15779935f8267eGeoff Levand}; 253