km82xx, km83xx: move ethernet_present() from common to cpu specific
authorKarlheinz Jerg <karlheinz.jerg@keymile.com>
Mon, 21 Jan 2013 03:55:16 +0000 (03:55 +0000)
committerKim Phillips <kim.phillips@freescale.com>
Fri, 15 Feb 2013 23:47:19 +0000 (17:47 -0600)
For kmvect1 we need a special solution and for km_arm boards we already
have. So move the common code to the architectur specific file.

Signed-off-by: Karlheinz Jerg <karlheinz.jerg@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
board/keymile/common/common.c
board/keymile/km82xx/km82xx.c
board/keymile/km83xx/km83xx.c

index 468c755d67c6cb6c3694e0701899bf3e1a35920d..ef93ed3f66e5414bd97124f3649a067c188ea407 100644 (file)
@@ -183,17 +183,6 @@ void i2c_init_board(void)
 }
 #endif
 
-
-#if !defined(MACH_TYPE_KM_KIRKWOOD)
-int ethernet_present(void)
-{
-       struct km_bec_fpga *base =
-               (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE;
-
-       return in_8(&base->bprth) & PIGGY_PRESENT;
-}
-#endif
-
 int board_eth_init(bd_t *bis)
 {
        if (ethernet_present())
index 67b69f6cb34712d807bb7bace1a930c518a690c7..defc885db70adaa06e5d5b470079f859308254f8 100644 (file)
@@ -385,6 +385,14 @@ void handle_mgcoge3un_reset(void)
 }
 #endif
 
+int ethernet_present(void)
+{
+       struct km_bec_fpga *base =
+               (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE;
+
+       return in_8(&base->bprth) & PIGGY_PRESENT;
+}
+
 /*
  * Early board initalization.
  */
index 83a8753e5a0f0b1924b5b903c6a3f41a4f5c51b3..b027173725e5deeb2d5b05b735de9a04db99ab33 100644 (file)
@@ -133,6 +133,28 @@ const uint upma_table[] = {
 };
 #endif
 
+static int piggy_present(void)
+{
+       struct km_bec_fpga __iomem *base =
+               (struct km_bec_fpga __iomem *)CONFIG_SYS_KMBEC_FPGA_BASE;
+
+       return in_8(&base->bprth) & PIGGY_PRESENT;
+}
+
+#if defined(CONFIG_KMVECT1)
+int ethernet_present(void)
+{
+       /* ethernet port connected to simple switch without piggy */
+       return 1;
+}
+#else
+int ethernet_present(void)
+{
+       return piggy_present();
+}
+#endif
+
+
 int board_early_init_r(void)
 {
        struct km_bec_fpga *base =
@@ -280,7 +302,7 @@ int checkboard(void)
 {
        puts("Board: Keymile " CONFIG_KM_BOARD_NAME);
 
-       if (ethernet_present())
+       if (piggy_present())
                puts(" with PIGGY.");
        puts("\n");
        return 0;