Merge branch 'master' of git://git.denx.de/u-boot-marvell
[platform/kernel/u-boot.git] / arch / powerpc / cpu / mpc8xxx / fdt.c
index c9956b6..54e60bb 100644 (file)
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <asm/mp.h>
+#include <asm/fsl_enet.h>
 
-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx))
 static int ft_del_cpuhandle(void *blob, int cpuhandle)
 {
        int off, ret = -FDT_ERR_NOTFOUND;
@@ -57,7 +59,7 @@ void ft_fixup_num_cores(void *blob) {
        while (off != -FDT_ERR_NOTFOUND) {
                u32 *reg = (u32 *)fdt_getprop(blob, off, "reg", 0);
 
-               if (*reg > num_cores-1) {
+               if ((*reg > num_cores-1) || (is_core_disabled(*reg))) {
                        int ph = fdt_get_phandle(blob, off);
 
                        /* Delete the cpu node once there are no cpu handles */
@@ -214,3 +216,26 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
                fdt_del_node_and_alias(blob, "crypto");
 }
 #endif
+
+int fdt_fixup_phy_connection(void *blob, int offset, enum fsl_phy_enet_if phyc)
+{
+       static const char *fsl_phy_enet_if_str[] = {
+               [MII]           = "mii",
+               [RMII]          = "rmii",
+               [GMII]          = "gmii",
+               [RGMII]         = "rgmii",
+               [RGMII_ID]      = "rgmii-id",
+               [RGMII_RXID]    = "rgmii-rxid",
+               [SGMII]         = "sgmii",
+               [TBI]           = "tbi",
+               [RTBI]          = "rtbi",
+               [XAUI]          = "xgmii",
+               [FSL_ETH_IF_NONE] = "",
+       };
+
+       if (phyc > ARRAY_SIZE(fsl_phy_enet_if_str))
+               return fdt_setprop_string(blob, offset, "phy-connection-type", "");
+
+       return fdt_setprop_string(blob, offset, "phy-connection-type",
+                                        fsl_phy_enet_if_str[phyc]);
+}