2 * Copyright 2004 Freescale Semiconductor.
4 * SPDX-License-Identifier: GPL-2.0+
9 #include <fdt_support.h>
12 #if defined(CONFIG_OF_BOARD_SETUP)
13 static void cds_pci_fixup(void *blob
)
18 u32
*map
= NULL
, *piccells
= NULL
;
21 node
= fdt_path_offset(blob
, "/aliases");
23 path
= fdt_getprop(blob
, node
, "pci0", NULL
);
25 node
= fdt_path_offset(blob
, path
);
27 map
= fdt_getprop_w(blob
, node
, "interrupt-map", &len
);
29 /* Each item in "interrupt-map" property is translated with
31 * PCI #address-cells, PCI #interrupt-cells,
32 * PIC address, PIC #address-cells, PIC #interrupt-cells.
34 cells
= fdt_getprop_u32_default(blob
, path
, "#address-cells", 1);
35 cells
+= fdt_getprop_u32_default(blob
, path
, "#interrupt-cells", 1);
36 off
= fdt_node_offset_by_phandle(blob
, fdt32_to_cpu(*(map
+cells
)));
40 piccells
= (u32
*)fdt_getprop(blob
, off
, "#address-cells", NULL
);
44 piccells
= (u32
*)fdt_getprop(blob
, off
, "#interrupt-cells", NULL
);
54 slot
= get_pci_slot();
56 for (i
=0;i
<len
;i
+=cells
) {
57 /* We rotate the interrupt pins so that the mapping
58 * changes depending on the slot the carrier card is in.
60 map
[3] = ((map
[3] + slot
- 2) % 4) + 1;
67 ft_board_setup(void *blob
, bd_t
*bd
)
69 ft_cpu_setup(blob
, bd
);
71 ft_pci_setup(blob
, bd
);