]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
powerpc: keymile: Add a check for the PIGGY debug board
authorHeiko Schocher <hs@denx.de>
Fri, 21 Nov 2008 07:29:40 +0000 (08:29 +0100)
committerKim Phillips <kim.phillips@freescale.com>
Tue, 25 Nov 2008 00:41:34 +0000 (18:41 -0600)
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>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
board/keymile/common/common.c
board/keymile/common/common.h [new file with mode: 0644]
board/keymile/kmeter1/Makefile
board/keymile/kmeter1/kmeter1.c
board/keymile/mgcoge/mgcoge.c
board/keymile/mgsuvd/mgsuvd.c
include/configs/kmeter1.h
include/configs/mgcoge.h
include/configs/mgsuvd.h

index a4cf24cf72652e4d47043a095a30da099383726d..1338950814426e5dd2d5ca4350e996dbd3c0fa13 100644 (file)
  */
 
 #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 (file)
index 0000000..d3d6814
--- /dev/null
@@ -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 */
index 88b79f3f0fe93ee33bcf9b87b09de1ba5e72b789..12a1518ff1a3de733eb9211235fdd6e4af785be2 100644 (file)
 #
 
 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))
index f9a59a6443e43d3efea5862966193547d5bd60f3..f04a57a9cc16c145c5c6f99dd0a420ccfbe1b4e3 100644 (file)
@@ -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;
 }
 
index 3683417f5ce27dcb835dbabb47333968b5299733..5c50739644707650d23017f8dca6bad28910db25 100644 (file)
@@ -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;
 }
 
index 3726acf4a13f043a93c5e66ab9a9395242892a75..02baf622eed97411272683d85201762dcb2ad1ca 100644 (file)
  */
 #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);
 }
 
index e105c3bd2a9c52962bc7ed52d2f70e298fc520ba..7a63a4189f8110c9198fd8eb8115c9f6d079ed6c 100644 (file)
 #define CONFIG_LOADS_ECHO      1       /* echo on for serial download */
 #define CONFIG_SYS_LOADS_BAUD_CHANGE   1       /* allow baudrate change */
 
+/*
+ * How to get access to the slot ID.  Put this here to make it easy
+ * to modify in a centralized location.  This is used in the HDLC
+ * driver to set the MAC.
+*/
+#define CONFIG_SYS_SLOT_ID_BASE                CONFIG_SYS_PIGGY_BASE
+#define CONFIG_SYS_SLOT_ID_OFF         (0x07)  /* register offset */
+#define CONFIG_SYS_SLOT_ID_MASK                (0x3f)  /* mask for slot ID bits */
+
 /*
  * BOOTP options
  */
index dc9b311d43c235d0f9d753ab5ae7ba70e6c8c1e6..31428ea09f37613971f4b24924e3254d23a7cdb7 100644 (file)
 #define OF_TBCLK               (bd->bi_busfreq / 4)
 #define OF_STDOUT_PATH         "/soc/cpm/serial@11a90"
 
+/*
+ * How to get access to the slot ID.  Put this here to make it easy
+ * to modify in a centralized location.  This is used in the HDLC
+ * driver to set the MAC.
+*/
+#define CONFIG_SYS_SLOT_ID_BASE                CONFIG_SYS_PIGGY_BASE
+#define CONFIG_SYS_SLOT_ID_OFF         (0x07)  /* register offset */
+#define CONFIG_SYS_SLOT_ID_MASK                (0x3f)  /* mask for slot ID bits */
+
+
 #endif /* __CONFIG_H */
index fca2e5513479b6532a98248a370d3a1cf444b934..b862130ae68f248ab9ab1b9d706973305abfbd9d 100644 (file)
 #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET+CONFIG_ENV_SECT_SIZE)
 #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
 
+/*
+ * How to get access to the slot ID.  Put this here to make it easy
+ * to modify in a centralized location.  This is used in the HDLC
+ * driver to set the MAC.
+*/
+#define CONFIG_SYS_SLOT_ID_BASE                CONFIG_SYS_PIGGY_BASE
+#define CONFIG_SYS_SLOT_ID_OFF         (0x07)  /* register offset */
+#define CONFIG_SYS_SLOT_ID_MASK                (0x3f)  /* mask for slot ID bits */
+
 /*-----------------------------------------------------------------------
  * Cache Configuration
  */