summaryrefslogtreecommitdiff
path: root/board/tqm5200
diff options
context:
space:
mode:
Diffstat (limited to 'board/tqm5200')
-rw-r--r--board/tqm5200/Makefile2
-rwxr-xr-xboard/tqm5200/cmd_stk52xx.c31
-rw-r--r--board/tqm5200/cmd_tb5200.c104
-rw-r--r--board/tqm5200/config.mk5
-rw-r--r--board/tqm5200/tqm5200.c130
5 files changed, 254 insertions, 18 deletions
diff --git a/board/tqm5200/Makefile b/board/tqm5200/Makefile
index ab0ff1a..9a1ea48 100644
--- a/board/tqm5200/Makefile
+++ b/board/tqm5200/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
LIB = lib$(BOARD).a
-OBJS := $(BOARD).o cmd_stk52xx.o
+OBJS := $(BOARD).o cmd_stk52xx.o cmd_tb5200.o
$(LIB): $(OBJS) $(SOBJS)
$(AR) crv $@ $(OBJS)
diff --git a/board/tqm5200/cmd_stk52xx.c b/board/tqm5200/cmd_stk52xx.c
index 8b9057f..7af69f2 100755
--- a/board/tqm5200/cmd_stk52xx.c
+++ b/board/tqm5200/cmd_stk52xx.c
@@ -22,7 +22,7 @@
*/
/*
- * SKT52XX specific functions
+ * STK52XX specific functions
*/
/*#define DEBUG*/
@@ -31,6 +31,7 @@
#if (CONFIG_COMMANDS & CFG_CMD_BSP)
+#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
#define DEFAULT_VOL 45
#define DEFAULT_FREQ 500
#define DEFAULT_DURATION 200
@@ -60,7 +61,6 @@ static int spi_transmit(unsigned char data);
static void pcm1772_write_reg(unsigned char addr, unsigned char data);
static void set_attenuation(unsigned char attenuation);
-#ifdef CONFIG_STK52XX
static void spi_init(void)
{
struct mpc5xxx_spi *spi = (struct mpc5xxx_spi*)MPC5XXX_SPI;
@@ -537,7 +537,9 @@ static int cmd_beep(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return rcode;
}
+#endif
+#if defined(CONFIG_STK52XX)
void led_init(void)
{
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
@@ -736,7 +738,9 @@ int do_led(char *argv[])
return 0;
}
+#endif
+#if defined(CONFIG_STK52XX) || defined(CONFIG_FO300)
/*
* return 1 on CAN initialization failure
* return 0 if no failure
@@ -1106,6 +1110,7 @@ int do_rs232(char *argv[])
return error_status;
}
+#ifndef CONFIG_FO300
static void sm501_backlight (unsigned int state)
{
if (state == BL_ON) {
@@ -1115,6 +1120,7 @@ static void sm501_backlight (unsigned int state)
*(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
~((1 << 26) | (1 << 27));
}
+#endif
int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -1124,7 +1130,9 @@ int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("Revision 100 of STK52XX not supported!\n");
return 1;
#endif
+#if defined(CONFIG_STK52XX)
led_init();
+#endif
can_init();
switch (argc) {
@@ -1152,6 +1160,7 @@ int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
else
printf ("Error\n");
return rcode;
+#ifndef CONFIG_FO300
} else if (strncmp (argv[1], "backlight", 4) == 0) {
if (strncmp (argv[2], "on", 2) == 0) {
sm501_backlight (BL_ON);
@@ -1161,14 +1170,17 @@ int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
sm501_backlight (BL_OFF);
return 0;
}
+#endif
}
break;
+#if defined(CONFIG_STK52XX)
case 4:
if (strcmp (argv[1], "led") == 0) {
return (do_led (argv));
}
break;
+#endif
default:
break;
@@ -1204,12 +1216,14 @@ U_BOOT_CMD(
"[channel]\n"
" - play short beep on \"l\"eft or \"r\"ight channel\n"
);
+#endif /* CONFIG_STK52XX || CONFIG_FO300 */
+#if defined(CONFIG_STK52XX)
U_BOOT_CMD(
fkt , 4, 1, cmd_fkt,
"fkt - Function test routines\n",
"led number on/off\n"
- " - 'number's like printed on SKT52XX board\n"
+ " - 'number's like printed on STK52XX board\n"
"fkt can\n"
" - loopback plug for X83 required\n"
"fkt rs232 number\n"
@@ -1217,5 +1231,14 @@ U_BOOT_CMD(
"fkt backlight on/off\n"
" - switch backlight on or off\n"
);
-#endif /* CONFIG_STK52XX */
+#elif defined(CONFIG_FO300)
+U_BOOT_CMD(
+ fkt , 3, 1, cmd_fkt,
+ "fkt - Function test routines\n",
+ "fkt can\n"
+ " - loopback plug for X16/X29 required\n"
+ "fkt rs232 number\n"
+ " - loopback plug(s) for X21/X22 required\n"
+);
+#endif
#endif /* CFG_CMD_BSP */
diff --git a/board/tqm5200/cmd_tb5200.c b/board/tqm5200/cmd_tb5200.c
new file mode 100644
index 0000000..8784b1f
--- /dev/null
+++ b/board/tqm5200/cmd_tb5200.c
@@ -0,0 +1,104 @@
+/*
+ * (C) Copyright 2005 - 2006
+ * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de.
+ *
+ * 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
+ */
+
+/*
+ * TB5200 specific functions
+ */
+/*#define DEBUG*/
+
+#include <common.h>
+#include <command.h>
+
+#if (CONFIG_COMMANDS & CFG_CMD_BSP)
+#if defined (CONFIG_TB5200)
+
+#define SM501_PANEL_DISPLAY_CONTROL 0x00080000UL
+
+static void led_init(void)
+{
+ struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
+
+ /* configure timer 4 for simple GPIO output */
+ gpt->gpt4.emsr |= 0x00000024;
+}
+
+int cmd_led(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
+
+ led_init();
+
+ if (strcmp (argv[1], "on") == 0) {
+ debug ("switch status LED on\n");
+ gpt->gpt4.emsr |= (1 << 4);
+ } else if (strcmp (argv[1], "off") == 0) {
+ debug ("switch status LED off\n");
+ gpt->gpt4.emsr &= ~(1 << 4);
+ } else {
+ printf ("Usage:\nled on/off\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+static void sm501_backlight (unsigned int state)
+{
+ if (state == 1) {
+ *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) |=
+ (1 << 26) | (1 << 27);
+ } else if (state == 0)
+ *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
+ ~((1 << 26) | (1 << 27));
+}
+
+int cmd_backlight(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ if (strcmp (argv[1], "on") == 0) {
+ debug ("switch backlight on\n");
+ sm501_backlight (1);
+ } else if (strcmp (argv[1], "off") == 0) {
+ debug ("switch backlight off\n");
+ sm501_backlight (0);
+ } else {
+ printf ("Usage:\nbacklight on/off\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ led , 2, 1, cmd_led,
+ "led - switch status LED on or off\n",
+ "on/off\n"
+);
+
+U_BOOT_CMD(
+ backlight , 2, 1, cmd_backlight,
+ "backlight - switch backlight on or off\n",
+ "on/off\n"
+ );
+
+#endif /* CONFIG_STK52XX */
+#endif /* CFG_CMD_BSP */
diff --git a/board/tqm5200/config.mk b/board/tqm5200/config.mk
index 585a99a..84ddee8 100644
--- a/board/tqm5200/config.mk
+++ b/board/tqm5200/config.mk
@@ -28,12 +28,17 @@
#
# 0xFC000000 boot low (standard configuration with room for max 64 MByte
# Flash ROM)
+# 0xFFF00000 boot high (for a backup copy of U-Boot)
# 0x00100000 boot from RAM (for testing only)
#
+sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
+
ifndef TEXT_BASE
## Standard: boot low
TEXT_BASE = 0xFC000000
+## For a backup copy of U-Boot at the end of flash: boot high
+# TEXT_BASE = 0xFFF00000
## For testing: boot from RAM
# TEXT_BASE = 0x00100000
endif
diff --git a/board/tqm5200/tqm5200.c b/board/tqm5200/tqm5200.c
index 310abd2..c8350ab 100644
--- a/board/tqm5200/tqm5200.c
+++ b/board/tqm5200/tqm5200.c
@@ -1,11 +1,11 @@
/*
- * (C) Copyright 2003-2004
+ * (C) Copyright 2003-2006
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2004
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
*
- * (C) Copyright 2004-2005
+ * (C) Copyright 2004-2006
* Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
*
* See file CREDITS for list of people who contributed to this
@@ -30,6 +30,7 @@
#include <common.h>
#include <mpc5xxx.h>
#include <pci.h>
+#include <asm/processor.h>
#ifdef CONFIG_VIDEO_SM501
#include <sm501.h>
@@ -101,6 +102,8 @@ long int initdram (int board_type)
{
ulong dramsize = 0;
ulong dramsize2 = 0;
+ uint svr, pvr;
+
#ifndef CFG_RAMBOOT
ulong test1, test2;
@@ -190,11 +193,31 @@ long int initdram (int board_type)
} else {
dramsize2 = 0;
}
-
#endif /* CFG_RAMBOOT */
-/* return dramsize + dramsize2; */
+ /*
+ * On MPC5200B we need to set the special configuration delay in the
+ * DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
+ * Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
+ *
+ * "The SDelay should be written to a value of 0x00000004. It is
+ * required to account for changes caused by normal wafer processing
+ * parameters."
+ */
+ svr = get_svr();
+ pvr = get_pvr();
+ if ((SVR_MJREV(svr) >= 2) &&
+ (PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
+
+ *(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04;
+ __asm__ volatile ("sync");
+ }
+
+#if defined(CONFIG_TQM5200_B)
+ return dramsize + dramsize2;
+#else
return dramsize;
+#endif /* CONFIG_TQM5200_B */
}
#elif defined(CONFIG_MGT5100)
@@ -250,20 +273,38 @@ long int initdram (int board_type)
int checkboard (void)
{
-#if defined (CONFIG_AEVFIFO)
+#if defined(CONFIG_AEVFIFO)
puts ("Board: AEVFIFO\n");
return 0;
#endif
-#if defined (CONFIG_TQM5200)
- puts ("Board: TQM5200 (TQ-Components GmbH)\n");
+
+#if defined(CONFIG_TQM5200S)
+# define MODULE_NAME "TQM5200S"
+#else
+# define MODULE_NAME "TQM5200"
#endif
-#if defined (CONFIG_STK52XX)
- puts (" on a STK52XX baseboard\n");
+
+#if defined(CONFIG_STK52XX)
+# define CARRIER_NAME "STK52xx"
+#elif defined(CONFIG_TB5200)
+# define CARRIER_NAME "TB5200"
+#elif defined(CONFIG_CAM5200)
+# define CARRIER_NAME "Cam5200"
+#elif defined(CONFIG_FO300)
+# define CARRIER_NAME "FO300"
+#else
+# error "UNKNOWN"
#endif
+ puts ( "Board: " MODULE_NAME " (TQ-Components GmbH)\n"
+ " on a " CARRIER_NAME " carrier board\n");
+
return 0;
}
+#undef MODULE_NAME
+#undef CARRIER_NAME
+
void flash_preinit(void)
{
/*
@@ -405,7 +446,6 @@ int board_early_init_r (void)
#endif
#endif /* CONFIG_PS2MULT */
-#if defined(CONFIG_CS_AUTOCONF)
int last_stage_init (void)
{
/*
@@ -500,11 +540,14 @@ int last_stage_init (void)
return 0;
}
-#endif /* CONFIG_CS_AUTOCONF */
#ifdef CONFIG_VIDEO_SM501
+#ifdef CONFIG_FO300
+#define DISPLAY_WIDTH 800
+#else
#define DISPLAY_WIDTH 640
+#endif
#define DISPLAY_HEIGHT 480
#ifdef CONFIG_VIDEO_SM501_8BPP
@@ -534,6 +577,28 @@ static const SMI_REGS init_regs [] =
{0x80218, 0x000201e9},
{0x80200, 0x00013306},
#else /* panel + CRT */
+#ifdef CONFIG_FO300
+ {0x00004, 0x0},
+ {0x00048, 0x00021807},
+ {0x0004C, 0x301a0a01},
+ {0x00054, 0x1},
+ {0x00040, 0x00021807},
+ {0x00044, 0x091a0a01},
+ {0x00054, 0x0},
+ {0x80000, 0x0f013106},
+ {0x80004, 0xc428bb17},
+ {0x8000C, 0x00000000},
+ {0x80010, 0x0C800C80},
+ {0x80014, 0x03200000},
+ {0x80018, 0x01e00000},
+ {0x8001C, 0x00000000},
+ {0x80020, 0x01e00320},
+ {0x80024, 0x042a031f},
+ {0x80028, 0x0086034a},
+ {0x8002C, 0x020c01df},
+ {0x80030, 0x000201ea},
+ {0x80200, 0x00010000},
+#else
{0x00004, 0x0},
{0x00048, 0x00021807},
{0x0004C, 0x091a0a01},
@@ -554,6 +619,7 @@ static const SMI_REGS init_regs [] =
{0x8002C, 0x020c01df},
{0x80030, 0x000201e9},
{0x80200, 0x00010000},
+#endif /* #ifdef CONFIG_FO300 */
#endif
{0, 0}
};
@@ -567,9 +633,17 @@ void video_get_info_str (int line_number, char *info)
{
if (line_number == 1) {
strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
-#if defined (CONFIG_STK52XX)
+#if defined (CONFIG_STK52XX) || defined (CONFIG_TB5200) || defined(CONFIG_FO300)
} else if (line_number == 2) {
- strcpy (info, " on a STK52XX baseboard");
+#if defined (CONFIG_STK52XX)
+ strcpy (info, " on a STK52xx carrier board");
+#endif
+#if defined (CONFIG_TB5200)
+ strcpy (info, " on a TB5200 carrier board");
+#endif
+#if defined (CONFIG_FO300)
+ strcpy (info, " on a FO300 carrier board");
+#endif
#endif
}
else {
@@ -655,3 +729,33 @@ int board_get_height (void)
}
#endif /* CONFIG_VIDEO_SM501 */
+
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+#ifdef CONFIG_FO300
+int board_early_init_f (void)
+{
+ vu_long timer3_status;
+ DECLARE_GLOBAL_DATA_PTR;
+
+ /* Configure GPT3 as GPIO input */
+ *(vu_long *)MPC5XXX_GPT3_ENABLE = 0x00000004;
+
+ /* Read in TIMER_3 pin status */
+ timer3_status = *(vu_long *)MPC5XXX_GPT3_STATUS;
+
+#ifdef FO300_SILENT_CONSOLE_WHEN_S1_CLOSED
+ /* Force silent console mode if S1 switch
+ * is in closed position (TIMER_3 pin status is LOW). */
+ if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 0)
+#else
+ /* Force silent console mode if S1 switch
+ * is in open position (TIMER_3 pin status is HIGH). */
+ if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 1)
+#endif
+ gd->flags |= GD_FLG_SILENT;
+
+ return 0;
+}
+#endif
+#endif