summaryrefslogtreecommitdiff
path: root/board/keymile
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
parentde0443614af4d16675ab436665aeb11ddc9f7214 (diff)
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')
-rw-r--r--board/keymile/common/common.c23
-rw-r--r--board/keymile/common/common.h20
-rw-r--r--board/keymile/kmeter1/Makefile6
-rw-r--r--board/keymile/kmeter1/kmeter1.c7
-rw-r--r--board/keymile/mgcoge/mgcoge.c10
-rw-r--r--board/keymile/mgsuvd/mgsuvd.c8
6 files changed, 64 insertions, 10 deletions
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index a4cf24cf7..133895081 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;
+}
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
new file mode 100644
index 000000000..d3d681424
--- /dev/null
+++ b/board/keymile/common/common.h
@@ -0,0 +1,20 @@
+/*
+ * (C) Copyright 2008
+ * Heiko Schocher, DENX Software Engineering, hs@denx.de.
+ *
+ * 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.
+ */
+
+#ifndef __KEYMILE_COMMON_H
+#define __KEYMILE_COMMON_H
+
+int ethernet_present (void);
+int ivm_read_eeprom (void);
+
+#ifdef CONFIG_KEYMILE_HDLC_ENET
+int keymile_hdlc_enet_initialize (bd_t *bis);
+#endif
+#endif /* __KEYMILE_COMMON_H */
diff --git a/board/keymile/kmeter1/Makefile b/board/keymile/kmeter1/Makefile
index 88b79f3f0..12a1518ff 100644
--- a/board/keymile/kmeter1/Makefile
+++ b/board/keymile/kmeter1/Makefile
@@ -22,12 +22,14 @@
#
include $(TOPDIR)/config.mk
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../common)
+endif
LIB = $(obj)lib$(BOARD).a
-COBJS-y += $(BOARD).o
+COBJS += $(BOARD).o ../common/common.o
-COBJS := $(COBJS-y)
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
SOBJS := $(addprefix $(obj),$(SOBJS))
diff --git a/board/keymile/kmeter1/kmeter1.c b/board/keymile/kmeter1/kmeter1.c
index f9a59a644..f04a57a9c 100644
--- a/board/keymile/kmeter1/kmeter1.c
+++ b/board/keymile/kmeter1/kmeter1.c
@@ -27,6 +27,8 @@
#include <pci.h>
#include <libfdt.h>
+#include "../common/common.h"
+
const qe_iop_conf_t qe_iop_conf_tab[] = {
/* port pin dir open_drain assign */
@@ -141,7 +143,10 @@ phys_size_t initdram (int board_type)
int checkboard (void)
{
- puts ("Board: Keymile kmeter1\n");
+ puts ("Board: Keymile kmeter1");
+ if (ethernet_present ())
+ puts (" with PIGGY.");
+ puts ("\n");
return 0;
}
diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c
index 3683417f5..5c5073964 100644
--- a/board/keymile/mgcoge/mgcoge.c
+++ b/board/keymile/mgcoge/mgcoge.c
@@ -25,6 +25,7 @@
#include <mpc8260.h>
#include <ioports.h>
#include <malloc.h>
+#include <net.h>
#include <asm/io.h>
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
@@ -35,7 +36,8 @@
#include <i2c.h>
#endif
-extern int ivm_read_eeprom (void);
+#include "../common/common.h"
+
/*
* I/O Port configuration table
*
@@ -285,8 +287,10 @@ phys_size_t initdram (int board_type)
int checkboard(void)
{
- puts ("Board: mgcoge\n");
-
+ puts ("Board: Keymile mgcoge");
+ if (ethernet_present ())
+ puts (" with PIGGY.");
+ puts ("\n");
return 0;
}
diff --git a/board/keymile/mgsuvd/mgsuvd.c b/board/keymile/mgsuvd/mgsuvd.c
index 3726acf4a..02baf622e 100644
--- a/board/keymile/mgsuvd/mgsuvd.c
+++ b/board/keymile/mgsuvd/mgsuvd.c
@@ -22,13 +22,14 @@
*/
#include <common.h>
#include <mpc8xx.h>
+#include <net.h>
#include <asm/io.h>
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
#endif
-extern int ivm_read_eeprom (void);
+#include "../common/common.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -60,7 +61,10 @@ const uint sdram_table[] =
int checkboard (void)
{
- puts ("Board: Keymile mgsuvd\n");
+ puts ("Board: Keymile mgsuvd");
+ if (ethernet_present ())
+ puts (" with PIGGY.");
+ puts ("\n");
return (0);
}