]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/Marvell/openrd/openrd.c
Merge git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / board / Marvell / openrd / openrd.c
index e53fa16a249ec748e7c78de3a6d4a5521b5bbf0b..a005a2f79dd07618e89267bc32906f9a946e6e11 100644 (file)
@@ -8,27 +8,12 @@
  * Marvell Semiconductor <www.marvell.com>
  * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <miiphy.h>
+#include <asm/arch/cpu.h>
 #include <asm/arch/kirkwood.h>
 #include <asm/arch/mpp.h>
 #include "openrd.h"
@@ -47,7 +32,7 @@ int board_early_init_f(void)
                        OPENRD_OE_LOW, OPENRD_OE_HIGH);
 
        /* Multi-Purpose Pins Functionality configuration */
-       u32 kwmpp_config[] = {
+       static const u32 kwmpp_config[] = {
                MPP0_NF_IO2,
                MPP1_NF_IO3,
                MPP2_NF_IO4,
@@ -101,7 +86,7 @@ int board_early_init_f(void)
                0
        };
 
-       kirkwood_mpp_conf(kwmpp_config);
+       kirkwood_mpp_conf(kwmpp_config, NULL);
        return 0;
 }
 
@@ -110,7 +95,13 @@ int board_init(void)
        /*
         * arch number of board
         */
+#if defined(CONFIG_BOARD_IS_OPENRD_BASE)
        gd->bd->bi_arch_number = MACH_TYPE_OPENRD_BASE;
+#elif defined(CONFIG_BOARD_IS_OPENRD_CLIENT)
+       gd->bd->bi_arch_number = MACH_TYPE_OPENRD_CLIENT;
+#elif defined(CONFIG_BOARD_IS_OPENRD_ULTIMATE)
+       gd->bd->bi_arch_number = MACH_TYPE_OPENRD_ULTIMATE;
+#endif
 
        /* adress of boot parameters */
        gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
@@ -118,12 +109,11 @@ int board_init(void)
 }
 
 #ifdef CONFIG_RESET_PHY_R
-/* Configure and enable MV88E1116 PHY */
-void reset_phy(void)
+/* Configure and enable MV88E1116/88E1121 PHY */
+void mv_phy_init(char *name)
 {
        u16 reg;
        u16 devadr;
-       char *name = "egiga0";
 
        if (miiphy_set_current_dev(name))
                return;
@@ -148,6 +138,24 @@ void reset_phy(void)
        /* reset the phy */
        miiphy_reset(name, devadr);
 
-       printf("88E1116 Initialized on %s\n", name);
+       printf(PHY_NO" Initialized on %s\n", name);
+}
+
+void reset_phy(void)
+{
+       mv_phy_init("egiga0");
+
+#ifdef CONFIG_BOARD_IS_OPENRD_CLIENT
+       /* Kirkwood ethernet driver is written with the assumption that in case
+        * of multiple PHYs, their addresses are consecutive. But unfortunately
+        * in case of OpenRD-Client, PHY addresses are not consecutive.*/
+       miiphy_write("egiga1", 0xEE, 0xEE, 24);
+#endif
+
+#if defined(CONFIG_BOARD_IS_OPENRD_CLIENT) || \
+       defined(CONFIG_BOARD_IS_OPENRD_ULTIMATE)
+       /* configure and initialize both PHY's */
+       mv_phy_init("egiga1");
+#endif
 }
 #endif /* CONFIG_RESET_PHY_R */