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()
205 hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev)); in ohci_hcd_tmio_drv_probe()
207 ret = -ENOMEM; in ohci_hcd_tmio_drv_probe()
211 hcd->rsrc_start = regs->start; in ohci_hcd_tmio_drv_probe()
212 hcd->rsrc_len = resource_size(regs); in ohci_hcd_tmio_drv_probe()
216 spin_lock_init(&tmio->lock); in ohci_hcd_tmio_drv_probe()
218 tmio->ccr = ioremap(config->start, resource_size(config)); in ohci_hcd_tmio_drv_probe()
219 if (!tmio->ccr) { in ohci_hcd_tmio_drv_probe()
220 ret = -ENOMEM; in ohci_hcd_tmio_drv_probe()
224 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); in ohci_hcd_tmio_drv_probe()
225 if (!hcd->regs) { in ohci_hcd_tmio_drv_probe()
226 ret = -ENOMEM; in ohci_hcd_tmio_drv_probe()
230 if (cell->enable) { in ohci_hcd_tmio_drv_probe()
231 ret = cell->enable(dev); in ohci_hcd_tmio_drv_probe()
237 ohci = hcd_to_ohci(hcd); in ohci_hcd_tmio_drv_probe()
238 ohci_hcd_init(ohci); in ohci_hcd_tmio_drv_probe()
240 ret = usb_hcd_setup_local_mem(hcd, sram->start, sram->start, in ohci_hcd_tmio_drv_probe()
249 device_wakeup_enable(hcd->self.controller); in ohci_hcd_tmio_drv_probe()
257 if (cell->disable) in ohci_hcd_tmio_drv_probe()
258 cell->disable(dev); in ohci_hcd_tmio_drv_probe()
260 iounmap(hcd->regs); in ohci_hcd_tmio_drv_probe()
262 iounmap(tmio->ccr); in ohci_hcd_tmio_drv_probe()
278 if (cell->disable) in ohci_hcd_tmio_drv_remove()
279 cell->disable(dev); in ohci_hcd_tmio_drv_remove()
280 iounmap(hcd->regs); in ohci_hcd_tmio_drv_remove()
281 iounmap(tmio->ccr); in ohci_hcd_tmio_drv_remove()
292 struct ohci_hcd *ohci = hcd_to_ohci(hcd); in ohci_hcd_tmio_drv_suspend() local
298 if (time_before(jiffies, ohci->next_statechange)) in ohci_hcd_tmio_drv_suspend()
300 ohci->next_statechange = jiffies; in ohci_hcd_tmio_drv_suspend()
302 spin_lock_irqsave(&tmio->lock, flags); in ohci_hcd_tmio_drv_suspend()
304 misc = tmio_ioread8(tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_suspend()
306 tmio_iowrite8(misc, tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_suspend()
308 spin_unlock_irqrestore(&tmio->lock, flags); in ohci_hcd_tmio_drv_suspend()
310 if (cell->suspend) { in ohci_hcd_tmio_drv_suspend()
311 ret = cell->suspend(dev); in ohci_hcd_tmio_drv_suspend()
322 struct ohci_hcd *ohci = hcd_to_ohci(hcd); in ohci_hcd_tmio_drv_resume() local
328 if (time_before(jiffies, ohci->next_statechange)) in ohci_hcd_tmio_drv_resume()
330 ohci->next_statechange = jiffies; in ohci_hcd_tmio_drv_resume()
332 if (cell->resume) { in ohci_hcd_tmio_drv_resume()
333 ret = cell->resume(dev); in ohci_hcd_tmio_drv_resume()
340 spin_lock_irqsave(&tmio->lock, flags); in ohci_hcd_tmio_drv_resume()
342 misc = tmio_ioread8(tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_resume()
344 tmio_iowrite8(misc, tmio->ccr + CCR_MISC); in ohci_hcd_tmio_drv_resume()
346 spin_unlock_irqrestore(&tmio->lock, flags); in ohci_hcd_tmio_drv_resume()
364 .name = "tmio-ohci",