.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Low-Level PCI Express Support for the SH7786 |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2009 - 2011 Paul Mundt |
---|
5 | | - * |
---|
6 | | - * This file is subject to the terms and conditions of the GNU General Public |
---|
7 | | - * License. See the file "COPYING" in the main directory of this archive |
---|
8 | | - * for more details. |
---|
9 | 6 | */ |
---|
10 | 7 | #define pr_fmt(fmt) "PCI: " fmt |
---|
11 | 8 | |
---|
.. | .. |
---|
15 | 12 | #include <linux/io.h> |
---|
16 | 13 | #include <linux/async.h> |
---|
17 | 14 | #include <linux/delay.h> |
---|
| 15 | +#include <linux/dma-mapping.h> |
---|
18 | 16 | #include <linux/slab.h> |
---|
19 | 17 | #include <linux/clk.h> |
---|
20 | 18 | #include <linux/sh_clk.h> |
---|
21 | 19 | #include <linux/sh_intc.h> |
---|
22 | 20 | #include <cpu/sh7786.h> |
---|
23 | 21 | #include "pcie-sh7786.h" |
---|
24 | | -#include <asm/sizes.h> |
---|
| 22 | +#include <linux/sizes.h> |
---|
25 | 23 | |
---|
26 | 24 | struct sh7786_pcie_port { |
---|
27 | 25 | struct pci_channel *hose; |
---|
.. | .. |
---|
34 | 32 | static struct sh7786_pcie_port *sh7786_pcie_ports; |
---|
35 | 33 | static unsigned int nr_ports; |
---|
36 | 34 | static unsigned long dma_pfn_offset; |
---|
| 35 | +size_t memsize; |
---|
| 36 | +u64 memstart; |
---|
37 | 37 | |
---|
38 | 38 | static struct sh7786_pcie_hwops { |
---|
39 | 39 | int (*core_init)(void); |
---|
.. | .. |
---|
304 | 304 | struct pci_channel *chan = port->hose; |
---|
305 | 305 | unsigned int data; |
---|
306 | 306 | phys_addr_t memstart, memend; |
---|
307 | | - size_t memsize; |
---|
308 | 307 | int ret, i, win; |
---|
309 | 308 | |
---|
310 | 309 | /* Begin initialization */ |
---|
.. | .. |
---|
370 | 369 | */ |
---|
371 | 370 | memstart = ALIGN_DOWN(memstart, memsize); |
---|
372 | 371 | memsize = roundup_pow_of_two(memend - memstart); |
---|
373 | | - |
---|
374 | | - dma_pfn_offset = memstart >> PAGE_SHIFT; |
---|
375 | 372 | |
---|
376 | 373 | /* |
---|
377 | 374 | * If there's more than 512MB of memory, we need to roll over to |
---|
.. | .. |
---|
490 | 487 | |
---|
491 | 488 | void pcibios_bus_add_device(struct pci_dev *pdev) |
---|
492 | 489 | { |
---|
493 | | - pdev->dev.dma_pfn_offset = dma_pfn_offset; |
---|
| 490 | + dma_direct_set_offset(&pdev->dev, __pa(memory_start), |
---|
| 491 | + __pa(memory_start) - memstart, memsize); |
---|
494 | 492 | } |
---|
495 | 493 | |
---|
496 | 494 | static int __init sh7786_pcie_core_init(void) |
---|