Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Merge branch 'pci/host-generic' into next
Browse files Browse the repository at this point in the history
* pci/host-generic:
  MAINTAINERS: Add generic PCI host controller driver
  PCI: generic: Add generic PCI host controller driver

Conflicts:
	drivers/pci/host/Kconfig
	drivers/pci/host/Makefile
  • Loading branch information
bjorn-helgaas committed May 30, 2014
2 parents fdaf36b + cf28855 commit d785260
Show file tree
Hide file tree
Showing 5 changed files with 504 additions and 0 deletions.
100 changes: 100 additions & 0 deletions Documentation/devicetree/bindings/pci/host-generic-pci.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
* Generic PCI host controller

Firmware-initialised PCI host controllers and PCI emulations, such as the
virtio-pci implementations found in kvmtool and other para-virtualised
systems, do not require driver support for complexities such as regulator
and clock management. In fact, the controller may not even require the
configuration of a control interface by the operating system, instead
presenting a set of fixed windows describing a subset of IO, Memory and
Configuration Spaces.

Such a controller can be described purely in terms of the standardized device
tree bindings communicated in pci.txt:


Properties of the host controller node:

- compatible : Must be "pci-host-cam-generic" or "pci-host-ecam-generic"
depending on the layout of configuration space (CAM vs
ECAM respectively).

- device_type : Must be "pci".

- ranges : As described in IEEE Std 1275-1994, but must provide
at least a definition of non-prefetchable memory. One
or both of prefetchable Memory and IO Space may also
be provided.

- bus-range : Optional property (also described in IEEE Std 1275-1994)
to indicate the range of bus numbers for this controller.
If absent, defaults to <0 255> (i.e. all buses).

- #address-cells : Must be 3.

- #size-cells : Must be 2.

- reg : The Configuration Space base address and size, as accessed
from the parent bus.


Properties of the /chosen node:

- linux,pci-probe-only
: Optional property which takes a single-cell argument.
If '0', then Linux will assign devices in its usual manner,
otherwise it will not try to assign devices and instead use
them as they are configured already.

Configuration Space is assumed to be memory-mapped (as opposed to being
accessed via an ioport) and laid out with a direct correspondence to the
geography of a PCI bus address by concatenating the various components to
form an offset.

For CAM, this 24-bit offset is:

cfg_offset(bus, device, function, register) =
bus << 16 | device << 11 | function << 8 | register

Whilst ECAM extends this by 4 bits to accomodate 4k of function space:

cfg_offset(bus, device, function, register) =
bus << 20 | device << 15 | function << 12 | register

Interrupt mapping is exactly as described in `Open Firmware Recommended
Practice: Interrupt Mapping' and requires the following properties:

- #interrupt-cells : Must be 1

- interrupt-map : <see aforementioned specification>

- interrupt-map-mask : <see aforementioned specification>


Example:

pci {
compatible = "pci-host-cam-generic"
device_type = "pci";
#address-cells = <3>;
#size-cells = <2>;
bus-range = <0x0 0x1>;

// CPU_PHYSICAL(2) SIZE(2)
reg = <0x0 0x40000000 0x0 0x1000000>;

// BUS_ADDRESS(3) CPU_PHYSICAL(2) SIZE(2)
ranges = <0x01000000 0x0 0x01000000 0x0 0x01000000 0x0 0x00010000>,
<0x02000000 0x0 0x41000000 0x0 0x41000000 0x0 0x3f000000>;


#interrupt-cells = <0x1>;

// PCI_DEVICE(3) INT#(1) CONTROLLER(PHANDLE) CONTROLLER_DATA(3)
interrupt-map = < 0x0 0x0 0x0 0x1 &gic 0x0 0x4 0x1
0x800 0x0 0x0 0x1 &gic 0x0 0x5 0x1
0x1000 0x0 0x0 0x1 &gic 0x0 0x6 0x1
0x1800 0x0 0x0 0x1 &gic 0x0 0x7 0x1>;

// PCI_DEVICE(3) INT#(1)
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
}
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6741,6 +6741,14 @@ L: linux-pci@vger.kernel.org
S: Maintained
F: drivers/pci/host/*designware*

PCI DRIVER FOR GENERIC OF HOSTS
M: Will Deacon <will.deacon@arm.com>
L: linux-pci@vger.kernel.org
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Maintained
F: Documentation/devicetree/bindings/pci/host-generic-pci.txt
F: drivers/pci/host/pci-host-generic.c

PCMCIA SUBSYSTEM
P: Linux PCMCIA Team
L: linux-pcmcia@lists.infradead.org
Expand Down
7 changes: 7 additions & 0 deletions drivers/pci/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@ config PCI_RCAR_GEN2_PCIE
help
Say Y here if you want PCIe controller support on R-Car Gen2 SoCs.

config PCI_HOST_GENERIC
bool "Generic PCI host controller"
depends on ARM && OF
help
Say Y here if you want to support a simple generic PCI host
controller, such as the one emulated by kvmtool.

endmenu
1 change: 1 addition & 0 deletions drivers/pci/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o
obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
obj-$(CONFIG_PCI_RCAR_GEN2_PCIE) += pcie-rcar.o
obj-$(CONFIG_PCI_HOST_GENERIC) += pci-host-generic.o
Loading

0 comments on commit d785260

Please sign in to comment.