1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) Freescale Semiconductor, Inc. 2007
5 * Author: Scott Wood <scottwood@freescale.com>,
6 * with some bits from older board-specific PCI initialization.
12 #include <asm/bitops.h>
13 #include <asm/global_data.h>
14 #include <linux/delay.h>
16 #if defined(CONFIG_OF_LIBFDT)
17 #include <linux/libfdt.h>
18 #include <fdt_support.h>
21 #include <asm/mpc8349_pci.h>
25 DECLARE_GLOBAL_DATA_PTR;
27 static struct pci_controller pci_hose[MAX_BUSES];
28 static int pci_num_buses;
30 #if defined(CONFIG_OF_LIBFDT)
31 void ft_pci_setup(void *blob, struct bd_info *bd)
37 if (pci_num_buses < 1)
40 nodeoffset = fdt_path_offset(blob, "/aliases");
41 if (nodeoffset >= 0) {
42 path = fdt_getprop(blob, nodeoffset, "pci0", NULL);
44 tmp[0] = cpu_to_be32(pci_hose[0].first_busno);
45 tmp[1] = cpu_to_be32(pci_hose[0].last_busno);
46 do_fixup_by_path(blob, path, "bus-range",
47 &tmp, sizeof(tmp), 1);
49 tmp[0] = cpu_to_be32(gd->pci_clk);
50 do_fixup_by_path(blob, path, "clock-frequency",
51 &tmp, sizeof(tmp[0]), 1);
54 if (pci_num_buses < 2)
57 path = fdt_getprop(blob, nodeoffset, "pci1", NULL);
59 tmp[0] = cpu_to_be32(pci_hose[1].first_busno);
60 tmp[1] = cpu_to_be32(pci_hose[1].last_busno);
61 do_fixup_by_path(blob, path, "bus-range",
62 &tmp, sizeof(tmp), 1);
64 tmp[0] = cpu_to_be32(gd->pci_clk);
65 do_fixup_by_path(blob, path, "clock-frequency",
66 &tmp, sizeof(tmp[0]), 1);
70 #endif /* CONFIG_OF_LIBFDT */