Lines Matching +full:generic +full:- +full:ohci

1 // SPDX-License-Identifier: GPL-2.0
3 * OHCI HCD(Host Controller Driver) for USB.
6 *(C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
7 *(C) Copyright 2002 Hewlett-Packard Company
9 * Bus glue for Toshiba Mobile IO(TMIO) Controller's OHCI core
10 * (C) Copyright 2005 Chris Humbert <mahadri-usb@drigon.com>
16 * The TMIO's OHCI core DMAs through a small internal buffer that
21 * usb-ohci-tc6393.c(C) Copyright 2004 Lineo Solutions, Inc.
32 #include <linux/dma-mapping.h>
34 /*-------------------------------------------------------------------------*/
62 /*-------------------------------------------------------------------------*/
71 /*-------------------------------------------------------------------------*/
80 spin_lock_irqsave(&tmio->lock, flags); in tmio_write_pm()
85 tmio_iowrite16(pm, tmio->ccr + CCR_PM); in tmio_write_pm()
86 spin_unlock_irqrestore(&tmio->lock, flags); in tmio_write_pm()
92 struct ohci_hcd *ohci = hcd_to_ohci(hcd); in tmio_stop_hc() local
97 switch (ohci->num_ports) { in tmio_stop_hc()
99 dev_err(&dev->dev, "Unsupported amount of ports: %d\n", ohci->num_ports); in tmio_stop_hc()
110 tmio_iowrite8(0, tmio->ccr + CCR_INTC); in tmio_stop_hc()
111 tmio_iowrite8(0, tmio->ccr + CCR_ILME); in tmio_stop_hc()
112 tmio_iowrite16(0, tmio->ccr + CCR_BASE); in tmio_stop_hc()
113 tmio_iowrite16(0, tmio->ccr + CCR_BASE + 2); in tmio_stop_hc()
114 tmio_iowrite16(pm, tmio->ccr + CCR_PM); in tmio_stop_hc()
121 unsigned long base = hcd->rsrc_start; in tmio_start_hc()
124 tmio_iowrite16(base, tmio->ccr + CCR_BASE); in tmio_start_hc()
125 tmio_iowrite16(base >> 16, tmio->ccr + CCR_BASE + 2); in tmio_start_hc()
126 tmio_iowrite8(1, tmio->ccr + CCR_ILME); in tmio_start_hc()
127 tmio_iowrite8(2, tmio->ccr + CCR_INTC); in tmio_start_hc()
129 dev_info(&dev->dev, "revision %d @ 0x%08llx, irq %d\n", in tmio_start_hc()
130 tmio_ioread8(tmio->ccr + CCR_REVID), in tmio_start_hc()
131 (u64) hcd->rsrc_start, hcd->irq); in tmio_start_hc()
136 struct ohci_hcd *ohci = hcd_to_ohci(hcd); in ohci_tmio_start() local
139 if ((ret = ohci_init(ohci)) < 0) in ohci_tmio_start()
142 if ((ret = ohci_run(ohci)) < 0) { in ohci_tmio_start()
143 dev_err(hcd->self.controller, "can't start %s\n", in ohci_tmio_start()
144 hcd->self.bus_name); in ohci_tmio_start()
154 .product_desc = "TMIO OHCI USB Host Controller",
157 /* generic hardware linkage */
184 /*-------------------------------------------------------------------------*/
195 struct ohci_hcd *ohci; in ohci_hcd_tmio_drv_probe() local
200 return -ENODEV; in ohci_hcd_tmio_drv_probe()
203 return -EINVAL; in ohci_hcd_tmio_drv_probe()
208 hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev)); in ohci_hcd_tmio_drv_probe()
210 ret = -ENOMEM; in ohci_hcd_tmio_drv_probe()
214 hcd->rsrc_start = regs->start; in ohci_hcd_tmio_drv_probe()
215 hcd->rsrc_len = resource_size(regs); in ohci_hcd_tmio_drv_probe()
219 spin_lock_init(&tmio->lock); in ohci_hcd_tmio_drv_probe()
221 tmio->ccr = ioremap(config->start, resource_size(config)); in ohci_hcd_tmio_drv_probe()
222 if (!tmio->ccr) { in ohci_hcd_tmio_drv_probe()
223 ret = -ENOMEM; in ohci_hcd_tmio_drv_probe()
227 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); in ohci_hcd_tmio_drv_probe()
228 if (!hcd->regs) { in ohci_hcd_tmio_drv_probe()
229 ret = -ENOMEM; in ohci_hcd_tmio_drv_probe()
233 if (cell->enable) { in ohci_hcd_tmio_drv_probe()
234 ret = cell->enable(dev); in ohci_hcd_tmio_drv_probe()
240 ohci = hcd_to_ohci(hcd); in ohci_hcd_tmio_drv_probe()
241 ohci_hcd_init(ohci); in ohci_hcd_tmio_drv_probe()
243 ret = usb_hcd_setup_local_mem(hcd, sram->start, sram->start, in ohci_hcd_tmio_drv_probe()
252 device_wakeup_enable(hcd->self.controller); in ohci_hcd_tmio_drv_probe()
260 if (cell->disable) in ohci_hcd_tmio_drv_probe()
261 cell->disable(dev); in ohci_hcd_tmio_drv_probe()
263 iounmap(hcd->regs); in ohci_hcd_tmio_drv_probe()
265 iounmap(tmio->ccr); in ohci_hcd_tmio_drv_probe()
281 if (cell->disable) in ohci_hcd_tmio_drv_remove()
282 cell->disable(dev); in ohci_hcd_tmio_drv_remove()
283 iounmap(hcd->regs); in ohci_hcd_tmio_drv_remove()
284 iounmap(tmio->ccr); in ohci_hcd_tmio_drv_remove()
295 struct ohci_hcd *ohci = hcd_to_ohci(hcd); in ohci_hcd_tmio_drv_suspend() local
301 if (time_before(jiffies, ohci->next_statechange)) in ohci_hcd_tmio_drv_suspend()
303 ohci->next_statechange = jiffies; in ohci_hcd_tmio_drv_suspend()
305 spin_lock_irqsave(&tmio->lock, flags); in ohci_hcd_tmio_drv_suspend()
307 misc = tmio_ioread8(tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_suspend()
309 tmio_iowrite8(misc, tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_suspend()
311 spin_unlock_irqrestore(&tmio->lock, flags); in ohci_hcd_tmio_drv_suspend()
313 if (cell->suspend) { in ohci_hcd_tmio_drv_suspend()
314 ret = cell->suspend(dev); in ohci_hcd_tmio_drv_suspend()
325 struct ohci_hcd *ohci = hcd_to_ohci(hcd); in ohci_hcd_tmio_drv_resume() local
331 if (time_before(jiffies, ohci->next_statechange)) in ohci_hcd_tmio_drv_resume()
333 ohci->next_statechange = jiffies; in ohci_hcd_tmio_drv_resume()
335 if (cell->resume) { in ohci_hcd_tmio_drv_resume()
336 ret = cell->resume(dev); in ohci_hcd_tmio_drv_resume()
343 spin_lock_irqsave(&tmio->lock, flags); in ohci_hcd_tmio_drv_resume()
345 misc = tmio_ioread8(tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_resume()
347 tmio_iowrite8(misc, tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_resume()
349 spin_unlock_irqrestore(&tmio->lock, flags); in ohci_hcd_tmio_drv_resume()
367 .name = "tmio-ohci",