summaryrefslogtreecommitdiff
path: root/board/keymile/common/common.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2008-11-21 08:29:40 +0100
committerWolfgang Denk <wd@denx.de>2009-01-24 00:39:06 +0100
commit210c8c00aad3328145204adab434bb7d70b06b75 (patch)
treee54366427b6e170c4c1a77bc5a24f3bef03a1354 /board/keymile/common/common.c
parentde0443614af4d16675ab436665aeb11ddc9f7214 (diff)
downloadu-boot-imx-210c8c00aad3328145204adab434bb7d70b06b75.zip
u-boot-imx-210c8c00aad3328145204adab434bb7d70b06b75.tar.gz
u-boot-imx-210c8c00aad3328145204adab434bb7d70b06b75.tar.bz2
powerpc: keymile: Add a check for the PIGGY debug board
Check the presence of the PIGGY on the keymile boards mgcoge, mgsuvd and kmeter1. If the PIGGY is not present, dont register this Ethernet device. Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'board/keymile/common/common.c')
-rw-r--r--board/keymile/common/common.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index a4cf24c..1338950 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -22,10 +22,14 @@
*/
#include <common.h>
+#if defined(CONFIG_MGCOGE)
#include <mpc8260.h>
+#endif
#include <ioports.h>
#include <malloc.h>
#include <hush.h>
+#include <net.h>
+#include <asm/io.h>
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
@@ -33,8 +37,6 @@
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
#include <i2c.h>
-#endif
-#include <asm/io.h>
extern int i2c_soft_read_pin (void);
@@ -495,6 +497,7 @@ void i2c_init_board(void)
#endif
}
#endif
+#endif
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
int fdt_set_node_and_value (void *blob,
@@ -521,3 +524,19 @@ int fdt_set_node_and_value (void *blob,
return ret;
}
#endif
+
+int ethernet_present (void)
+{
+ return (in_8((u8 *)CONFIG_SYS_PIGGY_BASE + CONFIG_SYS_SLOT_ID_OFF) & 0x80);
+}
+
+int board_eth_init (bd_t *bis)
+{
+#ifdef CONFIG_KEYMILE_HDLC_ENET
+ (void)keymile_hdlc_enet_initialize (bis);
+#endif
+ if (ethernet_present ()) {
+ return -1;
+ }
+ return 0;
+}