Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2c37d90 authored by Alistair Popple's avatar Alistair Popple Committed by Benjamin Herrenschmidt
Browse files

powerpc: Added PCI MSI support using the HSTA module



The PPC476GTR SoC supports message signalled interrupts (MSI) by writing
to special addresses within the High Speed Transfer Assist (HSTA) module.

This patch adds support for PCI MSI with a new system device. The DMA
window is also updated to allow access to the entire 42-bit address range
to allow PCI devices write access to the HSTA module.

Signed-off-by: default avatarAlistair Popple <alistair@popple.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 2a2c74b2
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line

ppc476gtr High Speed Serial Assist (HSTA) node
==============================================

The 476gtr SoC contains a high speed serial assist module attached
between the plb4 and plb6 system buses to provide high speed data
transfer between memory and system peripherals as well as support for
PCI message signalled interrupts.

Currently only the MSI support is used by Linux using the following
device tree entries:

Require properties:
- compatible		: "ibm,476gtr-hsta-msi", "ibm,hsta-msi"
- reg			: register mapping for the HSTA MSI space
- interrupt-parent	: parent controller for mapping interrupts
- interrupts		: ordered interrupt mapping for each MSI in the register
			  space. The first interrupt should be associated with a
			  register offset of 0x00, the second to 0x10, etc.
+38 −8
Original line number Diff line number Diff line
@@ -82,6 +82,28 @@
		ranges;
		clock-frequency = <200000000>; // 200Mhz

		HSTA0: hsta@310000e0000 {
			compatible = "ibm,476gtr-hsta-msi", "ibm,hsta-msi";
			reg = <0x310 0x000e0000 0x0 0xf0>;
			interrupt-parent = <&MPIC>;
			interrupts = <108 0
				      109 0
				      110 0
				      111 0
				      112 0
				      113 0
				      114 0
				      115 0
				      116 0
				      117 0
				      118 0
				      119 0
				      120 0
				      121 0
				      122 0
				      123 0>;
		};

		MAL0: mcmal {
			compatible = "ibm,mcmal-476gtr", "ibm,mcmal2";
			dcr-reg = <0xc0000000 0x062>;
@@ -242,8 +264,10 @@
			ranges = <0x02000000 0x00000000 0x80000000 0x00000110 0x80000000 0x0 0x80000000
			          0x01000000 0x0        0x0        0x00000140 0x0        0x0 0x00010000>;

			/* Inbound starting at 0 to memsize filled in by zImage */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x0>;
			/* Inbound starting at 0x0 to 0x40000000000. In order to use MSI
			 * PCI devices must be able to write to the HSTA module.
			 */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x400 0x0>;

			/* This drives busses 0 to 0xf */
			bus-range = <0x0 0xf>;
@@ -280,8 +304,10 @@
			ranges = <0x02000000 0x00000000 0x80000000 0x00000210 0x80000000 0x0 0x80000000
			          0x01000000 0x0        0x0        0x00000240 0x0        0x0 0x00010000>;

			/* Inbound starting at 0 to memsize filled in by zImage */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x0>;
			/* Inbound starting at 0x0 to 0x40000000000. In order to use MSI
			 * PCI devices must be able to write to the HSTA module.
			 */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x400 0x0>;

			/* This drives busses 0 to 0xf */
			bus-range = <0x0 0xf>;
@@ -318,8 +344,10 @@
			ranges = <0x02000000 0x00000000 0x80000000 0x00000190 0x80000000 0x0 0x80000000
			          0x01000000 0x0        0x0        0x000001c0 0x0        0x0 0x00010000>;

			/* Inbound starting at 0 to memsize filled in by zImage */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x0>;
			/* Inbound starting at 0x0 to 0x40000000000. In order to use MSI
			 * PCI devices must be able to write to the HSTA module.
			 */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x400 0x0>;

			/* This drives busses 0 to 0xf */
			bus-range = <0x0 0xf>;
@@ -356,8 +384,10 @@
			ranges = <0x02000000 0x00000000 0x80000000 0x00000290 0x80000000 0x0 0x80000000
			          0x01000000 0x0        0x0        0x000002c0 0x0        0x0 0x00010000>;

			/* Inbound starting at 0 to memsize filled in by zImage */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x0>;
			/* Inbound starting at 0x0 to 0x40000000000. In order to use MSI
			 * PCI devices must be able to write to the HSTA module.
			 */
			dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x400 0x0>;

			/* This drives busses 0 to 0xf */
			bus-range = <0x0 0xf>;
+0 −15
Original line number Diff line number Diff line
@@ -75,24 +75,9 @@ static void ibm_akebono_fixups(void)
{
	void *emac;
	u32 reg;
	void *devp = finddevice("/");
	u32 dma_ranges[7];

	dt_fixup_memory(0x0ULL,  ibm_akebono_memsize);

	while ((devp = find_node_by_devtype(devp, "pci"))) {
		if (getprop(devp, "dma-ranges", dma_ranges,
			    sizeof(dma_ranges)) < 0) {
			printf("%s: Failed to get dma-ranges\r\n", __func__);
			continue;
		}

		dma_ranges[5] = ibm_akebono_memsize >> 32;
		dma_ranges[6] = ibm_akebono_memsize & 0xffffffffUL;

		setprop(devp, "dma-ranges", dma_ranges, sizeof(dma_ranges));
	}

	/* Fixup the SD timeout frequency */
	mtdcrx(CCTL0_MCO4, 0x1);

+2 −0
Original line number Diff line number Diff line
@@ -206,6 +206,8 @@ config AKEBONO
	select SWIOTLB
	select 476FPE
	select PPC4xx_PCI_EXPRESS
	select PCI_MSI
	select PPC4xx_HSTA_MSI
	select I2C
	select I2C_IBM_IIC
	select NETDEVICES
+6 −0
Original line number Diff line number Diff line
@@ -7,6 +7,12 @@ config PPC4xx_PCI_EXPRESS
	depends on PCI && 4xx
	default n

config PPC4xx_HSTA_MSI
	bool
	depends on PCI_MSI
	depends on PCI && 4xx
	default n

config PPC4xx_MSI
	bool
	depends on PCI_MSI
Loading