| .. | .. |
|---|
| 16 | 16 | * OHCI is the main "non-Intel/VIA" standard for USB 1.1 host controller |
|---|
| 17 | 17 | * interfaces (though some non-x86 Intel chips use it). It supports |
|---|
| 18 | 18 | * smarter hardware than UHCI. A download link for the spec available |
|---|
| 19 | | - * through the http://www.usb.org website. |
|---|
| 19 | + * through the https://www.usb.org website. |
|---|
| 20 | 20 | * |
|---|
| 21 | 21 | * This file is licenced under the GPL. |
|---|
| 22 | 22 | */ |
|---|
| .. | .. |
|---|
| 40 | 40 | #include <linux/dmapool.h> |
|---|
| 41 | 41 | #include <linux/workqueue.h> |
|---|
| 42 | 42 | #include <linux/debugfs.h> |
|---|
| 43 | +#include <linux/genalloc.h> |
|---|
| 43 | 44 | |
|---|
| 44 | 45 | #include <asm/io.h> |
|---|
| 45 | 46 | #include <asm/irq.h> |
|---|
| .. | .. |
|---|
| 384 | 385 | ed_free (ohci, ed); |
|---|
| 385 | 386 | break; |
|---|
| 386 | 387 | } |
|---|
| 387 | | - /* fall through */ |
|---|
| 388 | + fallthrough; |
|---|
| 388 | 389 | default: |
|---|
| 389 | 390 | /* caller was supposed to have unlinked any requests; |
|---|
| 390 | 391 | * that's not our job. can't recover; must leak ed. |
|---|
| .. | .. |
|---|
| 456 | 457 | struct usb_hcd *hcd = ohci_to_hcd(ohci); |
|---|
| 457 | 458 | |
|---|
| 458 | 459 | /* Accept arbitrarily long scatter-gather lists */ |
|---|
| 459 | | - if (!(hcd->driver->flags & HCD_LOCAL_MEM)) |
|---|
| 460 | + if (!hcd->localmem_pool) |
|---|
| 460 | 461 | hcd->self.sg_tablesize = ~0; |
|---|
| 461 | 462 | |
|---|
| 462 | 463 | if (distrust_firmware) |
|---|
| .. | .. |
|---|
| 514 | 515 | timer_setup(&ohci->io_watchdog, io_watchdog_func, 0); |
|---|
| 515 | 516 | ohci->prev_frame_no = IO_WATCHDOG_OFF; |
|---|
| 516 | 517 | |
|---|
| 517 | | - ohci->hcca = dma_alloc_coherent (hcd->self.controller, |
|---|
| 518 | | - sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL); |
|---|
| 518 | + if (hcd->localmem_pool) |
|---|
| 519 | + ohci->hcca = gen_pool_dma_alloc_align(hcd->localmem_pool, |
|---|
| 520 | + sizeof(*ohci->hcca), |
|---|
| 521 | + &ohci->hcca_dma, 256); |
|---|
| 522 | + else |
|---|
| 523 | + ohci->hcca = dma_alloc_coherent(hcd->self.controller, |
|---|
| 524 | + sizeof(*ohci->hcca), |
|---|
| 525 | + &ohci->hcca_dma, |
|---|
| 526 | + GFP_KERNEL); |
|---|
| 519 | 527 | if (!ohci->hcca) |
|---|
| 520 | 528 | return -ENOMEM; |
|---|
| 521 | 529 | |
|---|
| .. | .. |
|---|
| 1003 | 1011 | remove_debug_files (ohci); |
|---|
| 1004 | 1012 | ohci_mem_cleanup (ohci); |
|---|
| 1005 | 1013 | if (ohci->hcca) { |
|---|
| 1006 | | - dma_free_coherent (hcd->self.controller, |
|---|
| 1007 | | - sizeof *ohci->hcca, |
|---|
| 1008 | | - ohci->hcca, ohci->hcca_dma); |
|---|
| 1014 | + if (hcd->localmem_pool) |
|---|
| 1015 | + gen_pool_free(hcd->localmem_pool, |
|---|
| 1016 | + (unsigned long)ohci->hcca, |
|---|
| 1017 | + sizeof(*ohci->hcca)); |
|---|
| 1018 | + else |
|---|
| 1019 | + dma_free_coherent(hcd->self.controller, |
|---|
| 1020 | + sizeof(*ohci->hcca), |
|---|
| 1021 | + ohci->hcca, ohci->hcca_dma); |
|---|
| 1009 | 1022 | ohci->hcca = NULL; |
|---|
| 1010 | 1023 | ohci->hcca_dma = 0; |
|---|
| 1011 | 1024 | } |
|---|
| .. | .. |
|---|
| 1042 | 1055 | ed->ed_next = ohci->ed_rm_list; |
|---|
| 1043 | 1056 | ed->ed_prev = NULL; |
|---|
| 1044 | 1057 | ohci->ed_rm_list = ed; |
|---|
| 1045 | | - /* FALLTHROUGH */ |
|---|
| 1058 | + fallthrough; |
|---|
| 1046 | 1059 | case ED_UNLINK: |
|---|
| 1047 | 1060 | break; |
|---|
| 1048 | 1061 | default: |
|---|
| .. | .. |
|---|
| 1178 | 1191 | * generic hardware linkage |
|---|
| 1179 | 1192 | */ |
|---|
| 1180 | 1193 | .irq = ohci_irq, |
|---|
| 1181 | | - .flags = HCD_MEMORY | HCD_USB11, |
|---|
| 1194 | + .flags = HCD_MEMORY | HCD_DMA | HCD_USB11, |
|---|
| 1182 | 1195 | |
|---|
| 1183 | 1196 | /* |
|---|
| 1184 | 1197 | * basic lifecycle operations |
|---|