svn commit: r332019 - in head/sys: arm/mv dts/arm
Marcin Wojtas
mw at FreeBSD.org
Wed Apr 4 13:01:16 UTC 2018
Author: mw
Date: Wed Apr 4 13:01:14 2018
New Revision: 332019
URL: https://svnweb.freebsd.org/changeset/base/332019
Log:
Match Marvell Armada38X PCIE ranges in dts with Linux
If driver cannot determine ranges based on fdt, it will calculate
them based on number and type of current port.
Submitted by: Rafal Kozik <rk at semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14752
Modified:
head/sys/arm/mv/mv_pci.c
head/sys/dts/arm/armada-380.dtsi
head/sys/dts/arm/armada-385.dtsi
Modified: head/sys/arm/mv/mv_pci.c
==============================================================================
--- head/sys/arm/mv/mv_pci.c Wed Apr 4 12:55:31 2018 (r332018)
+++ head/sys/arm/mv/mv_pci.c Wed Apr 4 13:01:14 2018 (r332019)
@@ -100,6 +100,7 @@ struct mv_pci_range {
};
#define FDT_RANGES_CELLS ((3 + 3 + 2) * 2)
+#define PCI_SPACE_LEN 0x00100000
static void
mv_pci_range_dump(struct mv_pci_range *range)
@@ -122,6 +123,7 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_ran
pcell_t *rangesptr;
pcell_t cell0, cell1, cell2;
int tuple_size, tuples, i, rv, offset_cells, len;
+ int portid, is_io_space;
/*
* Retrieve 'ranges' property.
@@ -163,11 +165,14 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_ran
rangesptr++;
cell2 = fdt_data_get((void *)rangesptr, 1);
rangesptr++;
+ portid = fdt_data_get((void *)(rangesptr+1), 1);
if (cell0 & 0x02000000) {
pci_space = mem_space;
+ is_io_space = 0;
} else if (cell0 & 0x01000000) {
pci_space = io_space;
+ is_io_space = 1;
} else {
rv = ERANGE;
goto out;
@@ -198,6 +203,12 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_ran
rangesptr += size_cells;
pci_space->base_pci = cell2;
+
+ if (pci_space->len == 0) {
+ pci_space->len = PCI_SPACE_LEN;
+ pci_space->base_parent = fdt_immr_va +
+ PCI_SPACE_LEN * ( 2 * portid + is_io_space);
+ }
}
rv = 0;
out:
Modified: head/sys/dts/arm/armada-380.dtsi
==============================================================================
--- head/sys/dts/arm/armada-380.dtsi Wed Apr 4 12:55:31 2018 (r332018)
+++ head/sys/dts/arm/armada-380.dtsi Wed Apr 4 13:01:14 2018 (r332019)
@@ -103,8 +103,8 @@
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
- ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1200000 0x0 0x00100000
- 0x81000000 0x0 0x0 0x81000000 0x0 0xf1300000 0x0 0x00100000>;
+ ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
+ 0x81000000 0 0 0x81000000 0x1 0 1 0>;
interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&gic>;
@@ -122,8 +122,8 @@
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
- ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1400000 0x0 0x00100000
- 0x81000000 0x0 0x0 0x81000000 0x0 0xf1500000 0x0 0x00100000>;
+ ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0
+ 0x81000000 0 0 0x81000000 0x2 0 1 0>;
interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&gic>;
@@ -141,8 +141,8 @@
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
- ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1600000 0x0 0x00100000
- 0x81000000 0x0 0x0 0x81000000 0x0 0xf1700000 0x0 0x00100000>;
+ ranges = <0x82000000 0 0 0x82000000 0x3 0 1 0
+ 0x81000000 0 0 0x81000000 0x3 0 1 0>;
interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&gic>;
Modified: head/sys/dts/arm/armada-385.dtsi
==============================================================================
--- head/sys/dts/arm/armada-385.dtsi Wed Apr 4 12:55:31 2018 (r332018)
+++ head/sys/dts/arm/armada-385.dtsi Wed Apr 4 13:01:14 2018 (r332019)
@@ -115,8 +115,8 @@
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
- ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1200000 0x0 0x00100000
- 0x81000000 0x0 0x0 0x81000000 0x0 0xf1300000 0x0 0x00100000>;
+ ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
+ 0x81000000 0 0 0x81000000 0x1 0 1 0>;
interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
marvell,pcie-port = <0>;
@@ -133,8 +133,8 @@
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
- ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1400000 0x0 0x00100000
- 0x81000000 0x0 0x0 0x81000000 0x0 0xf1500000 0x0 0x00100000>;
+ ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0
+ 0x81000000 0 0 0x81000000 0x2 0 1 0>;
interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
marvell,pcie-port = <1>;
@@ -151,8 +151,8 @@
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
- ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1600000 0x0 0x00100000
- 0x81000000 0x0 0x0 0x81000000 0x0 0xf1700000 0x0 0x00100000>;
+ ranges = <0x82000000 0 0 0x82000000 0x3 0 1 0
+ 0x81000000 0 0 0x81000000 0x3 0 1 0>;
interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
marvell,pcie-port = <2>;
@@ -172,8 +172,8 @@
#address-cells = <3>;
#size-cells = <2>;
#interrupt-cells = <1>;
- ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1800000 0x0 0x00100000
- 0x81000000 0x0 0x0 0x81000000 0x0 0xf1900000 0x0 0x00100000>;
+ ranges = <0x82000000 0 0 0x82000000 0x4 0 1 0
+ 0x81000000 0 0 0x81000000 0x4 0 1 0>;
interrupt-map-mask = <0 0 0 0>;
interrupt-map = <0 0 0 0 &gic GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
marvell,pcie-port = <3>;
More information about the svn-src-head
mailing list