mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-26 16:18:31 +00:00
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@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14752
This commit is contained in:
parent
17f651708e
commit
46db728392
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332019
@ -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_range *io_space,
|
||||
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_range *io_space,
|
||||
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_range *io_space,
|
||||
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:
|
||||
|
@ -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>;
|
||||
|
@ -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>;
|
||||
|
Loading…
Reference in New Issue
Block a user