^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * PS3 EHCI Host Controller driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2006 Sony Computer Entertainment Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright 2006 Sony Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <asm/firmware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/ps3.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) static void ps3_ehci_setup_insnreg(struct ehci_hcd *ehci)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* PS3 HC internal setup register offsets. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) enum ps3_ehci_hc_insnreg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ps3_ehci_hc_insnreg01 = 0x084,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) ps3_ehci_hc_insnreg02 = 0x088,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ps3_ehci_hc_insnreg03 = 0x08c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* PS3 EHCI HC errata fix 316 - The PS3 EHCI HC will reset its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * internal INSNREGXX setup regs back to the chip default values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * on Host Controller Reset (CMD_RESET) or Light Host Controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * Reset (CMD_LRESET). The work-around for this is for the HC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * driver to re-initialise these regs when ever the HC is reset.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* Set burst transfer counts to 256 out, 32 in. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) writel_be(0x01000020, (void __iomem *)ehci->regs +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ps3_ehci_hc_insnreg01);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Enable burst transfer counts. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) writel_be(0x00000001, (void __iomem *)ehci->regs +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ps3_ehci_hc_insnreg03);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static int ps3_ehci_hc_reset(struct usb_hcd *hcd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct ehci_hcd *ehci = hcd_to_ehci(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ehci->big_endian_mmio = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ehci->caps = hcd->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) result = ehci_setup(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ps3_ehci_setup_insnreg(ehci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static const struct hc_driver ps3_ehci_hc_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .description = hcd_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .product_desc = "PS3 EHCI Host Controller",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .hcd_priv_size = sizeof(struct ehci_hcd),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .irq = ehci_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) .flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) .reset = ps3_ehci_hc_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .start = ehci_run,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) .stop = ehci_stop,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) .shutdown = ehci_shutdown,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) .urb_enqueue = ehci_urb_enqueue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) .urb_dequeue = ehci_urb_dequeue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) .endpoint_disable = ehci_endpoint_disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) .endpoint_reset = ehci_endpoint_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) .get_frame_number = ehci_get_frame,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .hub_status_data = ehci_hub_status_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .hub_control = ehci_hub_control,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #if defined(CONFIG_PM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .bus_suspend = ehci_bus_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) .bus_resume = ehci_bus_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) .relinquish_port = ehci_relinquish_port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) .port_handed_over = ehci_port_handed_over,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct usb_hcd *hcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) unsigned int virq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) static u64 dummy_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) if (usb_disabled()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) result = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) goto fail_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) result = ps3_open_hv_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) dev_dbg(&dev->core, "%s:%d: ps3_open_hv_device failed\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) __func__, __LINE__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) goto fail_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) result = ps3_dma_region_create(dev->d_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) dev_dbg(&dev->core, "%s:%d: ps3_dma_region_create failed: "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) "(%d)\n", __func__, __LINE__, result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) BUG_ON("check region type");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) goto fail_dma_region;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) result = ps3_mmio_region_create(dev->m_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) dev_dbg(&dev->core, "%s:%d: ps3_map_mmio_region failed\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) __func__, __LINE__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) result = -EPERM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) goto fail_mmio_region;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) dev_dbg(&dev->core, "%s:%d: mmio mapped_addr %lxh\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) __LINE__, dev->m_region->lpar_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) result = ps3_io_irq_setup(PS3_BINDING_CPU_ANY, dev->interrupt_id, &virq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) dev_dbg(&dev->core, "%s:%d: ps3_construct_io_irq(%d) failed.\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) __func__, __LINE__, virq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) result = -EPERM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) goto fail_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) dummy_mask = DMA_BIT_MASK(32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) dev->core.dma_mask = &dummy_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) dma_set_coherent_mask(&dev->core, dummy_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev_name(&dev->core));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) if (!hcd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) dev_dbg(&dev->core, "%s:%d: usb_create_hcd failed\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) __LINE__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) result = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) goto fail_create_hcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) hcd->rsrc_start = dev->m_region->lpar_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) hcd->rsrc_len = dev->m_region->len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) dev_dbg(&dev->core, "%s:%d: request_mem_region failed\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) __func__, __LINE__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) hcd->regs = ioremap(dev->m_region->lpar_addr, dev->m_region->len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) if (!hcd->regs) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) dev_dbg(&dev->core, "%s:%d: ioremap failed\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) __LINE__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) result = -EPERM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) goto fail_ioremap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) dev_dbg(&dev->core, "%s:%d: hcd->rsrc_start %lxh\n", __func__, __LINE__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) (unsigned long)hcd->rsrc_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) dev_dbg(&dev->core, "%s:%d: hcd->rsrc_len %lxh\n", __func__, __LINE__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) (unsigned long)hcd->rsrc_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) dev_dbg(&dev->core, "%s:%d: hcd->regs %lxh\n", __func__, __LINE__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) (unsigned long)hcd->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) dev_dbg(&dev->core, "%s:%d: virq %lu\n", __func__, __LINE__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) (unsigned long)virq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) ps3_system_bus_set_drvdata(dev, hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) result = usb_add_hcd(hcd, virq, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) dev_dbg(&dev->core, "%s:%d: usb_add_hcd failed (%d)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) __func__, __LINE__, result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) goto fail_add_hcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) device_wakeup_enable(hcd->self.controller);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) fail_add_hcd:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) iounmap(hcd->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) fail_ioremap:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) usb_put_hcd(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) fail_create_hcd:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) ps3_io_irq_destroy(virq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) fail_irq:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ps3_free_mmio_region(dev->m_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) fail_mmio_region:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) ps3_dma_region_free(dev->d_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) fail_dma_region:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) ps3_close_hv_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) fail_open:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) fail_start:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static int ps3_ehci_remove(struct ps3_system_bus_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) unsigned int tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) struct usb_hcd *hcd = ps3_system_bus_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) BUG_ON(!hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) dev_dbg(&dev->core, "%s:%d: regs %p\n", __func__, __LINE__, hcd->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) dev_dbg(&dev->core, "%s:%d: irq %u\n", __func__, __LINE__, hcd->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) tmp = hcd->irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) usb_remove_hcd(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) ps3_system_bus_set_drvdata(dev, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) BUG_ON(!hcd->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) iounmap(hcd->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) usb_put_hcd(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ps3_io_irq_destroy(tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) ps3_free_mmio_region(dev->m_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) ps3_dma_region_free(dev->d_region);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) ps3_close_hv_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static int __init ps3_ehci_driver_register(struct ps3_system_bus_driver *drv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) return firmware_has_feature(FW_FEATURE_PS3_LV1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) ? ps3_system_bus_driver_register(drv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static void ps3_ehci_driver_unregister(struct ps3_system_bus_driver *drv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) if (firmware_has_feature(FW_FEATURE_PS3_LV1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) ps3_system_bus_driver_unregister(drv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) MODULE_ALIAS(PS3_MODULE_ALIAS_EHCI);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) static struct ps3_system_bus_driver ps3_ehci_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) .core.name = "ps3-ehci-driver",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) .core.owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .match_id = PS3_MATCH_ID_EHCI,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .probe = ps3_ehci_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .remove = ps3_ehci_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) .shutdown = ps3_ehci_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) };