mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
xes: Consolidate checkboard()
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>
This commit is contained in:
parent
96d6160324
commit
92af6549b8
11 changed files with 146 additions and 66 deletions
|
@ -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)
|
||||
|
|
64
board/xes/common/board.c
Normal file
64
board/xes/common/board.c
Normal file
|
@ -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;
|
||||
}
|
47
board/xes/common/fsl_8xxx_misc.c
Normal file
47
board/xes/common/fsl_8xxx_misc.c
Normal file
|
@ -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;
|
||||
}
|
||||
|
||||
|
28
board/xes/common/fsl_8xxx_misc.h
Normal file
28
board/xes/common/fsl_8xxx_misc.h
Normal file
|
@ -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__ */
|
|
@ -26,30 +26,12 @@
|
|||
#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.
|
||||
|
|
|
@ -36,33 +36,6 @@
|
|||
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue