diff options
author | Hou Zhiqiang <Zhiqiang.Hou@nxp.com> | 2019-04-24 22:33:02 +0800 |
---|---|---|
committer | Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> | 2019-06-20 10:44:45 +0530 |
commit | b89e3d9250046c3e7c956fd5e7a14364747433a4 (patch) | |
tree | 138c21f44056a2a94d9216ae8a3e78a2e5393feb /drivers/pci/pcie_fsl_fixup.c | |
parent | 13c5e5bd6af70199f1d6092d49453ff77d5d41bb (diff) | |
download | u-boot-b89e3d9250046c3e7c956fd5e7a14364747433a4.tar.gz u-boot-b89e3d9250046c3e7c956fd5e7a14364747433a4.tar.xz u-boot-b89e3d9250046c3e7c956fd5e7a14364747433a4.zip |
dm: pci: add Freescale PowerPC PCIe driver
Add PCIe DM driver for Freescale PowerPC PCIe controllers.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Diffstat (limited to 'drivers/pci/pcie_fsl_fixup.c')
-rw-r--r-- | drivers/pci/pcie_fsl_fixup.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/pci/pcie_fsl_fixup.c b/drivers/pci/pcie_fsl_fixup.c new file mode 100644 index 0000000000..cbdc0ef291 --- /dev/null +++ b/drivers/pci/pcie_fsl_fixup.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * Copyright 2019 NXP + * + * PCIe Kernel DT fixup of DM U-Boot driver for Freescale PowerPC SoCs + * Author: Hou Zhiqiang <Zhiqiang.Hou@nxp.com> + */ + +#include <common.h> +#ifdef CONFIG_OF_BOARD_SETUP +#include <dm.h> +#include <fdt_support.h> +#include <asm/fsl_pci.h> +#include <linux/libfdt.h> +#include "pcie_fsl.h" + +static void ft_fsl_pcie_setup(void *blob, struct fsl_pcie *pcie) +{ + struct pci_controller *hose = dev_get_uclass_priv(pcie->bus); + fdt_addr_t regs_addr; + int off; + + regs_addr = dev_read_addr(pcie->bus); + off = fdt_node_offset_by_compat_reg(blob, FSL_PCIE_COMPAT, regs_addr); + if (off < 0) { + printf("%s: Fail to find PCIe node@0x%pa\n", + FSL_PCIE_COMPAT, ®s_addr); + return; + } + + if (!hose || !pcie->enabled) + fdt_del_node(blob, off); + else + fdt_pci_dma_ranges(blob, off, hose); +} + +/* Fixup Kernel DT for PCIe */ +void pci_of_setup(void *blob, bd_t *bd) +{ + struct fsl_pcie *pcie; + + list_for_each_entry(pcie, &fsl_pcie_list, list) + ft_fsl_pcie_setup(blob, pcie); +} + +#else +void pci_of_setup(void *blob, bd_t *bd) +{ +} +#endif |