]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
drivers: net: fsl-mc: Link MC boot to PHY_RESET_R
authorBogdan Purcareata <bogdan.purcareata@nxp.com>
Wed, 24 May 2017 16:40:21 +0000 (16:40 +0000)
committerYork Sun <york.sun@nxp.com>
Fri, 2 Jun 2017 02:55:50 +0000 (19:55 -0700)
DPAA2 platforms boot the Management Complex based on the u-boot env
variable "mcinitcmd". Instead of doing this step on each platform
individually, define a single mc_env_boot function in the MC driver,
since it's semantically tied to it.

Call the function in a per-board reset_phy hook, as it gets called at a
later moment, when all board PHY devices have been initialized.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Signed-off-by: Heinz Wrobel <heinz.wrobel@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
board/freescale/ls2080a/ls2080a.c
board/freescale/ls2080aqds/eth.c
board/freescale/ls2080ardb/eth_ls2080rdb.c
drivers/net/fsl-mc/mc.c
include/configs/ls2080a_common.h
include/fsl-mc/fsl_mc.h

index 9e7701d81ff517edddacf08e046b204e62393bbe..ecf4bd67ed3db08c2ede7ca23e34a22a072714b4 100644 (file)
@@ -135,3 +135,9 @@ int ft_board_setup(void *blob, bd_t *bd)
        return 0;
 }
 #endif
+
+#if defined(CONFIG_RESET_PHY_R)
+void reset_phy(void)
+{
+}
+#endif
index 59361e9111f5382b528911a97319a712c8b65bed..8c44aacdba36228baf94626a98c660776732e7cf 100644 (file)
@@ -14,6 +14,7 @@
 #include <fm_eth.h>
 #include <i2c.h>
 #include <miiphy.h>
+#include <fsl-mc/fsl_mc.h>
 #include <fsl-mc/ldpaa_wriop.h>
 
 #include "../common/qixis.h"
@@ -834,7 +835,6 @@ void ls2080a_handle_phy_interface_xsgmii(int i)
 int board_eth_init(bd_t *bis)
 {
        int error;
-       char *mc_boot_env_var;
 #ifdef CONFIG_FSL_MC_ENET
        struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
        int serdes1_prtcl = (in_le32(&gur->rcwsr[28]) &
@@ -902,9 +902,6 @@ int board_eth_init(bd_t *bis)
                }
        }
 
-       mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
-       if (mc_boot_env_var)
-               run_command_list(mc_boot_env_var, -1, 0);
        error = cpu_eth_init(bis);
 
        if (hwconfig_f("xqsgmii", env_hwconfig)) {
@@ -919,6 +916,9 @@ int board_eth_init(bd_t *bis)
        return error;
 }
 
-#ifdef CONFIG_FSL_MC_ENET
-
-#endif
+#if defined(CONFIG_RESET_PHY_R)
+void reset_phy(void)
+{
+       mc_env_boot();
+}
+#endif /* CONFIG_RESET_PHY_R */
index ba584c8a76874684ad9a9db1ce73af4f2f382631..32677f7ae1b466f4d6e3f65b615d3f3e6c51c235 100644 (file)
 #include <asm/io.h>
 #include <exports.h>
 #include <asm/arch/fsl_serdes.h>
+#include <fsl-mc/fsl_mc.h>
 #include <fsl-mc/ldpaa_wriop.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define MC_BOOT_ENV_VAR "mcinitcmd"
 int board_eth_init(bd_t *bis)
 {
 #if defined(CONFIG_FSL_MC_ENET)
-       char *mc_boot_env_var;
        int i, interface;
        struct memac_mdio_info mdio_info;
        struct mii_dev *dev;
@@ -98,11 +97,8 @@ int board_eth_init(bd_t *bis)
                }
        }
 
-       mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
-       if (mc_boot_env_var)
-               run_command_list(mc_boot_env_var, -1, 0);
        cpu_eth_init(bis);
-#endif /* CONFIG_FMAN_ENET */
+#endif /* CONFIG_FSL_MC_ENET */
 
 #ifdef CONFIG_PHY_AQUANTIA
        /*
@@ -118,3 +114,10 @@ int board_eth_init(bd_t *bis)
 #endif
        return pci_eth_init(bis);
 }
+
+#if defined(CONFIG_RESET_PHY_R)
+void reset_phy(void)
+{
+       mc_env_boot();
+}
+#endif /* CONFIG_RESET_PHY_R */
index 0a74e3e42e49f1110a0d53df7155d651484fac2f..8da04281e9cf71123c2aace95a5980fab5c42577 100644 (file)
@@ -27,6 +27,7 @@
 
 #define MC_MEM_SIZE_ENV_VAR    "mcmemsize"
 #define MC_BOOT_TIMEOUT_ENV_VAR        "mcboottimeout"
+#define MC_BOOT_ENV_VAR                "mcinitcmd"
 
 DECLARE_GLOBAL_DATA_PTR;
 static int mc_boot_status = -1;
@@ -1368,3 +1369,18 @@ U_BOOT_CMD(
        "fsl_mc lazyapply DPL [DPL_addr] - Apply DPL file on exit\n"
        "fsl_mc start aiop [FW_addr] - Start AIOP\n"
 );
+
+void mc_env_boot(void)
+{
+#if defined(CONFIG_FSL_MC_ENET)
+       char *mc_boot_env_var;
+       /* The MC may only be initialized in the reset PHY function
+        * because otherwise U-Boot has not yet set up all the MAC
+        * address info properly. Without MAC addresses, the MC code
+        * can not properly initialize the DPC.
+        */
+       mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
+       if (mc_boot_env_var)
+               run_command_list(mc_boot_env_var, -1, 0);
+#endif /* CONFIG_FSL_MC_ENET */
+}
index b044768883f01b76929f51d001632c1de59b3e90..3706b1a4c46c639af70656ba1820f1b1041cf6f8 100644 (file)
@@ -156,6 +156,11 @@ unsigned long long get_qixis_addr(void);
 #define CONFIG_SYS_LS_MC_AIOP_IMG_MAX_LENGTH   0x200000
 #define CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET  0x07000000
 
+/* Define phy_reset function to boot the MC based on mcinitcmd.
+ * This happens late enough to properly fixup u-boot env MAC addresses.
+ */
+#define CONFIG_RESET_PHY_R
+
 /*
  * Carve out a DDR region which will not be used by u-boot/Linux
  *
index ffe6da54b76a996a21f8a5ad00c3bdafc452c196..60088ecf8326196de83f9a3721a9e438f4ba1483 100644 (file)
@@ -61,4 +61,5 @@ u64 mc_get_dram_addr(void);
 unsigned long mc_get_dram_block_size(void);
 int fsl_mc_ldpaa_init(bd_t *bis);
 int fsl_mc_ldpaa_exit(bd_t *bd);
+void mc_env_boot(void);
 #endif