imx: imx8qm/qxp: check whether m4 partition booted
[oweals/u-boot.git] / drivers / pci / fsl_pci_init.c
index af20cf0f3e7db183f2333a894e9f082443a1c4c2..ab5e49941f30e8ac471a5efc318f79180c8ffb41 100644 (file)
@@ -1,10 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2007-2012 Freescale Semiconductor, Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <env.h>
 #include <malloc.h>
 #include <asm/fsl_serdes.h>
 
@@ -322,6 +322,12 @@ void fsl_pci_init(struct pci_controller *hose, struct fsl_pci_info *pci_info)
 
        pci_setup_indirect(hose, cfg_addr, cfg_data);
 
+#ifdef PEX_CCB_DIV
+       /* Configure the PCIE controller core clock ratio */
+       pci_hose_write_config_dword(hose, dev, 0x440,
+                                   ((gd->bus_clk / 1000000) *
+                                    (16 / PEX_CCB_DIV)) / 333);
+#endif
        block_rev = in_be32(&pci->block_rev1);
        if (PEX_IP_BLK_REV_2_2 <= block_rev) {
                pi = &pci->pit[2];      /* 0xDC0 */
@@ -390,7 +396,7 @@ void fsl_pci_init(struct pci_controller *hose, struct fsl_pci_info *pci_info)
 
 #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
        /* boot from PCIE --master */
-       char *s = getenv("bootmaster");
+       char *s = env_get("bootmaster");
        char pcie[6];
        sprintf(pcie, "PCIE%d", pci_info->pci_num);
 
@@ -673,7 +679,7 @@ int fsl_pci_init_port(struct fsl_pci_info *pci_info,
 #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
        } else {
                /* boot from PCIE --master releases slave's core 0 */
-               char *s = getenv("bootmaster");
+               char *s = env_get("bootmaster");
                char pcie[6];
                sprintf(pcie, "PCIE%d", pci_info->pci_num);
 
@@ -886,7 +892,7 @@ int fsl_pcie_init_board(int busno)
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
-#include <libfdt.h>
+#include <linux/libfdt.h>
 #include <fdt_support.h>
 
 void ft_fsl_pci_setup(void *blob, const char *pci_compat,