Skip to content

Commit

Permalink
openrisc: Add pci bus support
Browse files Browse the repository at this point in the history
This patch adds required definitions to allow for PCI buses on OpenRISC.
This is being in the QEMU virt platform.

OpenRISC does not have IO ports so this defines PCI IO to be allowed in
any range.  Keeping PIO_RESERVED defined as 0 allows OpenRISC to use
MMIO for all IO.

Signed-off-by: Stafford Horne <shorne@gmail.com>
  • Loading branch information
stffrdhrn committed Jun 12, 2022
1 parent f2906aa commit a65c4dd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
7 changes: 4 additions & 3 deletions arch/openrisc/Kconfig
Expand Up @@ -21,7 +21,9 @@ config OPENRISC
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
select GENERIC_IOMAP
select GENERIC_PCI_IOMAP
select GENERIC_CPU_DEVICES
select HAVE_PCI
select HAVE_UID16
select GENERIC_ATOMIC64
select GENERIC_CLOCKEVENTS_BROADCAST
Expand All @@ -32,6 +34,8 @@ config OPENRISC
select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1
select ARCH_USE_QUEUED_RWLOCKS
select OMPIC if SMP
select PCI_DOMAINS_GENERIC if PCI
select PCI_MSI if PCI
select ARCH_WANT_FRAME_POINTERS
select GENERIC_IRQ_MULTI_HANDLER
select MMU_GATHER_NO_RANGE if MMU
Expand All @@ -46,9 +50,6 @@ config MMU
config GENERIC_HWEIGHT
def_bool y

config NO_IOPORT_MAP
def_bool y

# For now, use generic checksum functions
#These can be reimplemented in assembly later if so inclined
config GENERIC_CSUM
Expand Down
4 changes: 2 additions & 2 deletions arch/openrisc/include/asm/io.h
Expand Up @@ -17,9 +17,9 @@
#include <linux/types.h>

/*
* PCI: can we really do 0 here if we have no port IO?
* PCI: All address space can be used for IO
*/
#define IO_SPACE_LIMIT 0
#define IO_SPACE_LIMIT ~(0UL)

/* OpenRISC has no port IO */
#define HAVE_ARCH_PIO_SIZE 1
Expand Down
36 changes: 36 additions & 0 deletions arch/openrisc/include/asm/pci.h
@@ -0,0 +1,36 @@
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef __ASM_OPENRISC_PCI_H
#define __ASM_OPENRISC_PCI_H

#include <linux/types.h>
#include <linux/slab.h>
#include <linux/dma-mapping.h>

#include <asm/io.h>

#define PCIBIOS_MIN_IO 0
#define PCIBIOS_MIN_MEM 0

/* OpenRISC bootloaders do not initialize PCI bus */
#define pcibios_assign_all_busses() 1

#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1

extern int isa_dma_bridge_buggy;

#ifdef CONFIG_PCI
static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
{
/* no legacy IRQs on or1k */
return -ENODEV;
}

static inline int pci_proc_domain(struct pci_bus *bus)
{
/* always show the domain in /proc */
return 1;
}
#endif /* CONFIG_PCI */

#endif /* __ASM_OPENRISC_PCI_H */

0 comments on commit a65c4dd

Please sign in to comment.