]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
xes: Consolidate checkboard()
authorJohn Schmoller <jschmoller@xes-inc.com>
Fri, 22 Oct 2010 05:20:24 +0000 (00:20 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Fri, 22 Oct 2010 07:17:16 +0000 (02:17 -0500)
Create a common checkboard() function to support all X-ES's Freescale
boards.

Also, add a get_board_derivative() function which reads hardware
strapping resistors to determine what model a board is.  This allows one
U-Boot image to support multiple boards.

Signed-off-by: John Schmoller <jschmoller@xes-inc.com>
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
board/xes/common/Makefile
board/xes/common/board.c [new file with mode: 0644]
board/xes/common/fsl_8xxx_misc.c [new file with mode: 0644]
board/xes/common/fsl_8xxx_misc.h [new file with mode: 0644]
board/xes/xpedite5170/xpedite5170.c
board/xes/xpedite5200/xpedite5200.c
board/xes/xpedite5370/xpedite5370.c
include/configs/XPEDITE1000.h
include/configs/XPEDITE5170.h
include/configs/XPEDITE5200.h
include/configs/XPEDITE5370.h

index d022831830a2de6020b7a80ead8e69e58b65c41f..bfade319b9cae5f8e184ed852d3db82e05e2ada2 100644 (file)
@@ -33,6 +33,8 @@ COBJS-$(CONFIG_FSL_PCI_INIT)  += fsl_8xxx_pci.o
 COBJS-$(CONFIG_MPC8572)                += fsl_8xxx_clk.o
 COBJS-$(CONFIG_MPC86xx)                += fsl_8xxx_clk.o
 COBJS-$(CONFIG_FSL_DDR2)       += fsl_8xxx_ddr.o
+COBJS-$(CONFIG_MPC85xx)                += fsl_8xxx_misc.o board.o
+COBJS-$(CONFIG_MPC86xx)                += fsl_8xxx_misc.o board.o
 COBJS-$(CONFIG_NAND_ACTL)      += actl_nand.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
diff --git a/board/xes/common/board.c b/board/xes/common/board.c
new file mode 100644 (file)
index 0000000..738f0a6
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2009 Extreme Engineering Solutions, Inc.
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include "fsl_8xxx_misc.h"
+
+int checkboard(void)
+{
+       char name[] = CONFIG_SYS_BOARD_NAME;
+       char *s;
+
+#ifdef CONFIG_SYS_FORM_CUSTOM
+       s = "Custom";
+#elif CONFIG_SYS_FORM_6U_CPCI
+       s = "6U CompactPCI";
+#elif CONFIG_SYS_FORM_ATCA_PMC
+       s = "ATCA w/PMC";
+#elif CONFIG_SYS_FORM_ATCA_AMC
+       s = "ATCA w/AMC";
+#elif CONFIG_SYS_FORM_VME
+       s = "VME";
+#elif CONFIG_SYS_FORM_6U_VPX
+       s = "6U VPX";
+#elif CONFIG_SYS_FORM_PMC
+       s = "PMC";
+#elif CONFIG_SYS_FORM_PCI
+       s = "PCI";
+#elif CONFIG_SYS_FORM_3U_CPCI
+       s = "3U CompactPCI";
+#elif CONFIG_SYS_FORM_AMC
+       s = "AdvancedMC";
+#elif CONFIG_SYS_FORM_XMC
+       s = "XMC";
+#elif CONFIG_SYS_FORM_PMC_XMC
+       s = "PMC/XMC";
+#elif CONFIG_SYS_FORM_PCI_EXPRESS
+       s = "PCI Express";
+#elif CONFIG_SYS_FORM_3U_VPX
+       s = "3U VPX";
+#else
+#error "Form factor not defined"
+#endif
+
+       name[strlen(name) - 1] += get_board_derivative();
+       printf("Board: X-ES %s %s SBC\n", name, s);
+
+       /* Display board specific information */
+       puts("       ");
+       if ((s = getenv("board_rev")))
+               printf("Rev %s, ", s);
+       if ((s = getenv("serial#")))
+               printf("Serial# %s, ", s);
+       if ((s = getenv("board_cfg")))
+               printf("Cfg %s", s);
+       puts("\n");
+
+       return 0;
+}
diff --git a/board/xes/common/fsl_8xxx_misc.c b/board/xes/common/fsl_8xxx_misc.c
new file mode 100644 (file)
index 0000000..e37a3c1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 Extreme Engineering Solutions, Inc.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/mmu.h>
+
+/*
+ * Return a board's derivative model number.  For example:
+ * return 2 for the XPedite5372 and return 1 for the XPedite5201.
+ */
+uint get_board_derivative(void)
+{
+#if defined(CONFIG_MPC85xx)
+       volatile ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+#elif defined(CONFIG_MPC86xx)
+       volatile immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR;
+       volatile ccsr_gur_t *gur = &immap->im_gur;
+#endif
+
+       /*
+        * The top 4 lines of the local bus address are pulled low/high and
+        * can be read to determine the least significant digit of a board's
+        * model number.
+        */
+       return gur->gpporcr >> 28;
+}
+
+
diff --git a/board/xes/common/fsl_8xxx_misc.h b/board/xes/common/fsl_8xxx_misc.h
new file mode 100644 (file)
index 0000000..ecc70da
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2008 Extreme Engineering Solutions, Inc.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __FSL_8XXX_MISC_H___
+#define __FSL_8XXX_MISC_H___
+
+uint get_board_derivative(void);
+
+#endif /* __FSL_8XXX_MISC_H__ */
index 58229418f36a5a4348c5f5b1f7ddcc5034c6897e..0f7fa6c43abe3767bb2dcb8bcc04bdc2b6590632 100644 (file)
 #include <asm/io.h>
 #include <fdt_support.h>
 #include <pca953x.h>
+#include "../common/fsl_8xxx_misc.h"
 
 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_PCI)
 extern void ft_board_pci_setup(void *blob, bd_t *bd);
 #endif
 
-int checkboard(void)
-{
-       char *s;
-
-       printf("Board: X-ES %s 3U VPX SBC\n", CONFIG_SYS_BOARD_NAME);
-       printf("       ");
-       s = getenv("board_rev");
-       if (s)
-               printf("Rev %s, ", s);
-       s = getenv("serial#");
-       if (s)
-               printf("Serial# %s, ", s);
-       s = getenv("board_cfg");
-       if (s)
-               printf("Cfg %s", s);
-       printf("\n");
-
-       return 0;
-}
 /*
  * Print out which flash was booted from and if booting from the 2nd flash,
  * swap flash chip selects to maintain consistent flash numbering/addresses.
index a2627f8673604c1b89c2dd625cd0bf3365781981..dc5c96511423ea08714f549f198e1c904968e98e 100644 (file)
 
 extern void ft_board_pci_setup(void *blob, bd_t *bd);
 
-int checkboard(void)
-{
-       volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
-       volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
-       char *s;
-
-       printf("Board: X-ES %s PMC\n", CONFIG_SYS_BOARD_NAME);
-       printf("       ");
-       s = getenv("board_rev");
-       if (s)
-               printf("Rev %s, ", s);
-       s = getenv("serial#");
-       if (s)
-               printf("Serial# %s, ", s);
-       s = getenv("board_cfg");
-       if (s)
-               printf("Cfg %s", s);
-       printf("\n");
-
-       out_be32(&lbc->ltesr, 0xffffffff);      /* Clear LBC error IRQs */
-       out_be32(&lbc->lteir, 0xffffffff);      /* Enable LBC error IRQs */
-       out_be32(&ecm->eedr, 0xffffffff);       /* Clear ecm errors */
-       out_be32(&ecm->eeer, 0xffffffff);       /* Enable ecm errors */
-
-       return 0;
-}
-
 static void flash_cs_fixup(void)
 {
        int flash_sel;
index 2a060c246251864193d714a32ad26303d535bcd4..89fa6c78b3034babba4e44b399ca39025f4c3942 100644 (file)
@@ -36,26 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 extern void ft_board_pci_setup(void *blob, bd_t *bd);
 
-int checkboard(void)
-{
-       char *s;
-
-       printf("Board: X-ES %s 3U VPX SBC\n", CONFIG_SYS_BOARD_NAME);
-       printf("       ");
-       s = getenv("board_rev");
-       if (s)
-               printf("Rev %s, ", s);
-       s = getenv("serial#");
-       if (s)
-               printf("Serial# %s, ", s);
-       s = getenv("board_cfg");
-       if (s)
-               printf("Cfg %s", s);
-       printf("\n");
-
-       return 0;
-}
-
 static void flash_cs_fixup(void)
 {
        int flash_sel;
index 560584977423371681d67128b98dc8b180acc310..64030dd218c34e2cdf5550c34dde3142232583de 100644 (file)
@@ -33,6 +33,7 @@
 /* High Level Configuration Options */
 #define CONFIG_XPEDITE1000     1
 #define CONFIG_SYS_BOARD_NAME  "XPedite1000"
+#define CONFIG_SYS_FORM_PMC    1
 #define CONFIG_4xx             1               /* ... PPC4xx family */
 #define CONFIG_440             1
 #define CONFIG_440GX           1               /* 440 GX */
index ab6d4b4ecb372cd43cbc6665ddd377317c6021dd..eeae5f0ff620445fbd40682e99730351ab421eb8 100644 (file)
@@ -34,6 +34,7 @@
 #define CONFIG_MPC8641         1       /* MPC8641 specific */
 #define CONFIG_XPEDITE5140     1       /* MPC8641HPCN board specific */
 #define CONFIG_SYS_BOARD_NAME  "XPedite5170"
+#define CONFIG_SYS_FORM_3U_VPX 1
 #define CONFIG_LINUX_RESET_VEC 0x100   /* Reset vector used by Linux */
 #define CONFIG_BOARD_EARLY_INIT_R      /* Call board_pre_init */
 #define CONFIG_BAT_RW          1       /* Use common BAT rw code */
index 00cd51628125437accb0adcf9fde4e24c7e49629..4221829cb09f500a82fc9b1db33fc4621a0c7ad6 100644 (file)
@@ -36,6 +36,7 @@
 #define CONFIG_MPC8548         1
 #define CONFIG_XPEDITE5200     1
 #define CONFIG_SYS_BOARD_NAME  "XPedite5200"
+#define CONFIG_SYS_FORM_PMC_XMC        1
 #define CONFIG_BOARD_EARLY_INIT_R      /* Call board_pre_init */
 
 #ifndef CONFIG_SYS_TEXT_BASE
index 73e3d52e8350d21d82c3c634b4353b8525acbe18..9b0ac4b404599de4f9b9adb9a923527e96827841 100644 (file)
@@ -36,6 +36,7 @@
 #define CONFIG_MPC8572         1
 #define CONFIG_XPEDITE5370     1
 #define CONFIG_SYS_BOARD_NAME  "XPedite5370"
+#define CONFIG_SYS_FORM_3U_VPX 1
 #define CONFIG_BOARD_EARLY_INIT_R      /* Call board_pre_init */
 
 #ifndef CONFIG_SYS_TEXT_BASE