-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64: Add architectural support for PCI
Use the generic PCI domain and OF functions to provide support for PCI on arm64. [bhelgaas: Change comments to use generic PCI, not just PCIe. Nothing at this level is PCIe-specific.] Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
- Loading branch information
Liviu Dudau
authored and
Bjorn Helgaas
committed
Sep 30, 2014
1 parent
8b921ac
commit d1e6dc9
Showing
7 changed files
with
134 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef __ASM_PCI_H | ||
#define __ASM_PCI_H | ||
#ifdef __KERNEL__ | ||
|
||
#include <linux/types.h> | ||
#include <linux/slab.h> | ||
#include <linux/dma-mapping.h> | ||
|
||
#include <asm/io.h> | ||
#include <asm-generic/pci-bridge.h> | ||
#include <asm-generic/pci-dma-compat.h> | ||
|
||
#define PCIBIOS_MIN_IO 0x1000 | ||
#define PCIBIOS_MIN_MEM 0 | ||
|
||
/* | ||
* Set to 1 if the kernel should re-assign all PCI bus numbers | ||
*/ | ||
#define pcibios_assign_all_busses() \ | ||
(pci_has_flag(PCI_REASSIGN_ALL_BUS)) | ||
|
||
/* | ||
* PCI address space differs from physical memory address space | ||
*/ | ||
#define PCI_DMA_BUS_IS_PHYS (0) | ||
|
||
extern int isa_dma_bridge_buggy; | ||
|
||
#ifdef CONFIG_PCI | ||
static inline int pci_proc_domain(struct pci_bus *bus) | ||
{ | ||
return 1; | ||
} | ||
#endif /* CONFIG_PCI */ | ||
|
||
#endif /* __KERNEL__ */ | ||
#endif /* __ASM_PCI_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Code borrowed from powerpc/kernel/pci-common.c | ||
* | ||
* Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM | ||
* Copyright (C) 2014 ARM Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
* | ||
*/ | ||
|
||
#include <linux/init.h> | ||
#include <linux/io.h> | ||
#include <linux/kernel.h> | ||
#include <linux/mm.h> | ||
#include <linux/of_pci.h> | ||
#include <linux/of_platform.h> | ||
#include <linux/slab.h> | ||
|
||
#include <asm/pci-bridge.h> | ||
|
||
/* | ||
* Called after each bus is probed, but before its children are examined | ||
*/ | ||
void pcibios_fixup_bus(struct pci_bus *bus) | ||
{ | ||
/* nothing to do, expected to be removed in the future */ | ||
} | ||
|
||
/* | ||
* We don't have to worry about legacy ISA devices, so nothing to do here | ||
*/ | ||
resource_size_t pcibios_align_resource(void *data, const struct resource *res, | ||
resource_size_t size, resource_size_t align) | ||
{ | ||
return res->start; | ||
} | ||
|
||
/* | ||
* Try to assign the IRQ number from DT when adding a new device | ||
*/ | ||
int pcibios_add_device(struct pci_dev *dev) | ||
{ | ||
dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); | ||
|
||
return 0; | ||
} | ||
|
||
|
||
#ifdef CONFIG_PCI_DOMAINS_GENERIC | ||
static bool dt_domain_found = false; | ||
|
||
void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) | ||
{ | ||
int domain = of_get_pci_domain_nr(parent->of_node); | ||
|
||
if (domain >= 0) { | ||
dt_domain_found = true; | ||
} else if (dt_domain_found == true) { | ||
dev_err(parent, "Node %s is missing \"linux,pci-domain\" property in DT\n", | ||
parent->of_node->full_name); | ||
return; | ||
} else { | ||
domain = pci_get_new_domain_nr(); | ||
} | ||
|
||
bus->domain_nr = domain; | ||
} | ||
#endif |