Commit 4532cb69 authored by wdenk's avatar wdenk
Browse files

* LWMON extensions:

  - Splashscreen support
  - modem support
  - sysmon support
  - temperature dependend enabling of LCD

* Allow booting from old "PPCBoot" disk partitions

* Add support for TQM8255 Board / MPC8255 CPU
parent 02c9bed4
======================================================================
Changes since U-Boot 0.3.1:
======================================================================
* LWMON extensions:
- Splashscreen support
- modem support
- sysmon support
- temperature dependend enabling of LCD
* Allow booting from old "PPCBoot" disk partitions
* Add support for TQM8255 Board / MPC8255 CPU
======================================================================
Changes for U-Boot 0.3.1:
======================================================================
......
......@@ -577,6 +577,7 @@ SCM_config: unconfig
TQM8260_config \
TQM8260_L2_config \
TQM8255_266MHz_config \
TQM8260_266MHz_config \
TQM8260_L2_266MHz_config \
TQM8260_300MHz_config: unconfig
......@@ -596,7 +597,9 @@ TQM8260_300MHz_config: unconfig
{ echo "#define CONFIG_300MHz" >>include/config.h ; \
echo "... with 300MHz system clock" ; \
}
@./mkconfig -a $(call xtract_82xx,$@) ppc mpc8260 tqm8260
@[ -z "$(findstring TQM8255_,$@)" ] || \
{ echo "#define CONFIG_MPC8255" >>include/config.h ; }
@./mkconfig -a TQM8260 ppc mpc8260 tqm8260
#########################################################################
## 74xx/7xx Systems
......
......@@ -47,11 +47,18 @@ V* Verification: dzu@denx.de
/*------------------------ Local prototypes ---------------------------*/
static long int dram_size (long int, long int *, long int);
static void kbd_init (void);
static int compare_magic (uchar *kbd_data, uchar *str);
/*--------------------- Local macros and constants --------------------*/
#define _NOT_USED_ 0xFFFFFFFF
#ifdef CONFIG_MODEM_SUPPORT
static int key_pressed(void);
extern void disable_putc(void);
#endif /* CONFIG_MODEM_SUPPORT */
/*
* 66 MHz SDRAM access using UPM A
*/
......@@ -396,6 +403,7 @@ int board_pre_init (void)
immr->im_cpm.cp_pbodr &= ~PB_ENET_TENA;
immr->im_cpm.cp_pbdat &= ~PB_ENET_TENA; /* set to 0 = disabled */
immr->im_cpm.cp_pbdir |= PB_ENET_TENA;
return (0);
}
......@@ -466,38 +474,45 @@ static uchar *key_match (uchar *);
#define KEYBD_SET_DEBUGMODE '#' /* Magic key to enable debug output */
/***********************************************************************
F* Function: int misc_init_r (void) P*A*Z*
F* Function: int board_postclk_init (void) P*A*Z*
*
P* Parameters: none
P*
P* Returnvalue: int
P* - 0 is always returned, even in the case of a keyboard
P* error.
P* - 0 is always returned.
*
Z* Intention: This function is the misc_init_r() method implementation
Z* Intention: This function is the board_postclk_init() method implementation
Z* for the lwmon board.
Z* The keyboard controller is initialized and the result
Z* of a read copied to the environment variable "keybd".
Z* If KEYBD_SET_DEBUGMODE is defined, a check is made for
Z* this key, and if found display to the LCD will be enabled.
Z* The keys in "keybd" are checked against the magic
Z* keycommands defined in the environment.
Z* See also key_match().
*
D* Design: wd@denx.de
C* Coding: wd@denx.de
V* Verification: dzu@denx.de
***********************************************************************/
int misc_init_r (void)
int board_postclk_init (void)
{
DECLARE_GLOBAL_DATA_PTR;
kbd_init();
#ifdef CONFIG_MODEM_SUPPORT
if (key_pressed()) {
disable_putc(); /* modem doesn't understand banner etc */
gd->do_mdm_init = 1;
}
#endif
return (0);
}
static void kbd_init (void)
{
DECLARE_GLOBAL_DATA_PTR;
uchar kbd_data[KEYBD_DATALEN];
uchar tmp_data[KEYBD_DATALEN];
uchar keybd_env[2 * KEYBD_DATALEN + 1];
uchar val, errcd;
uchar *str;
int i;
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
gd->kbd_status = 0;
/* Read initial keyboard error code */
val = KEYBD_CMD_READ_STATUS;
......@@ -508,7 +523,7 @@ int misc_init_r (void)
/* clear "irrelevant" bits. Recommended by Martin Rajek, LWN */
errcd &= ~(KEYBD_STATUS_H_RESET|KEYBD_STATUS_BROWNOUT);
if (errcd) {
printf ("KEYBD: Error %02X\n", errcd);
gd->kbd_status |= errcd << 8;
}
/* Reset error code and verify */
val = KEYBD_CMD_RESET_ERRORS;
......@@ -521,28 +536,10 @@ int misc_init_r (void)
val &= KEYBD_STATUS_MASK; /* clear unused bits */
if (val) { /* permanent error, report it */
printf ("*** Keyboard error code %02X ***\n", val);
sprintf (keybd_env, "%02X", val);
setenv ("keybd", keybd_env);
return 0;
}
/*
* Now we know that we have a working keyboard, so disable
* all output to the LCD except when a key press is detected.
*/
if ((console_assign (stdout, "serial") < 0) ||
(console_assign (stderr, "serial") < 0)) {
printf ("Can't assign serial port as output device\n");
gd->kbd_status |= val;
return;
}
/* Read Version */
val = KEYBD_CMD_READ_VERSION;
i2c_write (kbd_addr, 0, 0, &val, 1);
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_VERSIONLEN);
printf ("KEYBD: Version %d.%d\n", kbd_data[0], kbd_data[1]);
/*
* Read current keyboard state.
*
......@@ -569,6 +566,73 @@ int misc_init_r (void)
memcpy (tmp_data, kbd_data, KEYBD_DATALEN);
udelay (5000);
}
}
/***********************************************************************
F* Function: int misc_init_r (void) P*A*Z*
*
P* Parameters: none
P*
P* Returnvalue: int
P* - 0 is always returned, even in the case of a keyboard
P* error.
*
Z* Intention: This function is the misc_init_r() method implementation
Z* for the lwmon board.
Z* The keyboard controller is initialized and the result
Z* of a read copied to the environment variable "keybd".
Z* If KEYBD_SET_DEBUGMODE is defined, a check is made for
Z* this key, and if found display to the LCD will be enabled.
Z* The keys in "keybd" are checked against the magic
Z* keycommands defined in the environment.
Z* See also key_match().
*
D* Design: wd@denx.de
C* Coding: wd@denx.de
V* Verification: dzu@denx.de
***********************************************************************/
int misc_init_r (void)
{
DECLARE_GLOBAL_DATA_PTR;
uchar kbd_data[KEYBD_DATALEN];
uchar keybd_env[2 * KEYBD_DATALEN + 1];
uchar kbd_init_status = gd->kbd_status >> 8;
uchar kbd_status = gd->kbd_status;
uchar val;
uchar *str;
int i;
if (kbd_init_status) {
printf ("KEYBD: Error %02X\n", kbd_init_status);
}
if (kbd_status) { /* permanent error, report it */
printf ("*** Keyboard error code %02X ***\n", kbd_status);
sprintf (keybd_env, "%02X", kbd_status);
setenv ("keybd", keybd_env);
return 0;
}
/*
* Now we know that we have a working keyboard, so disable
* all output to the LCD except when a key press is detected.
*/
if ((console_assign (stdout, "serial") < 0) ||
(console_assign (stderr, "serial") < 0)) {
printf ("Can't assign serial port as output device\n");
}
/* Read Version */
val = KEYBD_CMD_READ_VERSION;
i2c_write (kbd_addr, 0, 0, &val, 1);
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_VERSIONLEN);
printf ("KEYBD: Version %d.%d\n", kbd_data[0], kbd_data[1]);
/* Read current keyboard state */
val = KEYBD_CMD_READ_KEYS;
i2c_write (kbd_addr, 0, 0, &val, 1);
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
for (i = 0; i < KEYBD_DATALEN; ++i) {
sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
......@@ -598,6 +662,56 @@ int misc_init_r (void)
static uchar kbd_magic_prefix[] = "key_magic";
static uchar kbd_command_prefix[] = "key_cmd";
static int compare_magic (uchar *kbd_data, uchar *str)
{
uchar compare[KEYBD_DATALEN-1];
uchar *nxt;
int i;
/* Don't include modifier byte */
memcpy (compare, kbd_data+1, KEYBD_DATALEN-1);
for (; str != NULL; str = (*nxt) ? nxt+1 : nxt) {
uchar c;
int k;
c = (uchar) simple_strtoul (str, (char **) (&nxt), 16);
if (str == nxt) { /* invalid character */
break;
}
/*
* Check if this key matches the input.
* Set matches to zero, so they match only once
* and we can find duplicates or extra keys
*/
for (k = 0; k < sizeof(compare); ++k) {
if (compare[k] == '\0') /* only non-zero entries */
continue;
if (c == compare[k]) { /* found matching key */
compare[k] = '\0';
break;
}
}
if (k == sizeof(compare)) {
return -1; /* unmatched key */
}
}
/*
* A full match leaves no keys in the `compare' array,
*/
for (i = 0; i < sizeof(compare); ++i) {
if (compare[i])
{
return -1;
}
}
return 0;
}
/***********************************************************************
F* Function: static uchar *key_match (uchar *kbd_data) P*A*Z*
*
......@@ -627,12 +741,9 @@ V* Verification: dzu@denx.de
***********************************************************************/
static uchar *key_match (uchar *kbd_data)
{
uchar compare[KEYBD_DATALEN-1];
uchar magic[sizeof (kbd_magic_prefix) + 1];
uchar extra;
uchar *str, *nxt, *suffix;
uchar *suffix;
uchar *kbd_magic_keys;
int i;
/*
* The following string defines the characters that can pe appended
......@@ -653,50 +764,7 @@ static uchar *key_match (uchar *kbd_data)
#if 0
printf ("### Check magic \"%s\"\n", magic);
#endif
/* Don't include modifier byte */
memcpy (compare, kbd_data+1, KEYBD_DATALEN-1);
extra = 0;
for (str= getenv(magic); str != NULL; str = (*nxt) ? nxt+1 : nxt) {
uchar c;
int k;
c = (uchar) simple_strtoul (str, (char **) (&nxt), 16);
if (str == nxt) { /* invalid character */
break;
}
/*
* Check if this key matches the input.
* Set matches to zero, so they match only once
* and we can find duplicates or extra keys
*/
for (k = 0; k < sizeof(compare); ++k) {
if (compare[k] == '\0') /* only non-zero entries */
continue;
if (c == compare[k]) { /* found matching key */
compare[k] = '\0';
break;
}
}
if (k == sizeof(compare)) {
extra = 1; /* unmatched key */
}
}
/*
* A full match leaves no keys in the `compare' array,
* and has no extra keys
*/
for (i = 0; i < sizeof(compare); ++i) {
if (compare[i])
break;
}
if ((i == sizeof(compare)) && (extra == 0)) {
if (compare_magic(kbd_data, getenv(magic)) == 0) {
uchar cmd_name[sizeof (kbd_command_prefix) + 1];
char *cmd;
......@@ -815,7 +883,9 @@ int do_kbd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
uchar val;
int i;
#if 0 /* Done in kbd_init */
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
#endif
/* Read keys */
val = KEYBD_CMD_READ_KEYS;
......@@ -964,3 +1034,18 @@ void board_poweroff (void)
while (1);
}
#ifdef CONFIG_MODEM_SUPPORT
static int key_pressed(void)
{
uchar kbd_data[KEYBD_DATALEN];
uchar val;
/* Read keys */
val = KEYBD_CMD_READ_KEYS;
i2c_write (kbd_addr, 0, 0, &val, 1);
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
return (compare_magic(kbd_data, CONFIG_MODEM_KEY_MAGIC) == 0);
}
#endif /* CONFIG_MODEM_SUPPORT */
......@@ -200,7 +200,7 @@ int checkboard (void)
puts ("Board: ");
if (!i || strncmp (str, "TQM8260", 7)) {
if (!i || strncmp (str, "TQM82", 5)) {
puts ("### No HW ID - assuming TQM8260\n");
return (0);
}
......
......@@ -404,7 +404,8 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
SHOW_BOOT_PROGRESS (-1);
return 1;
}
if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
(strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
......
......@@ -262,7 +262,8 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf("error reading partinfo\n");
return 1;
}
if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
(strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
......
......@@ -376,7 +376,8 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
info.size=2880;
printf("error reading partinfo...try to boot raw\n");
}
if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
(strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
" (expect \"" BOOT_PART_TYPE "\")\n",
info.type);
......
/*
* (C) Copyright 2000
* (C) Copyright 2000-2003
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
......@@ -22,12 +22,12 @@
*/
/*
* CPU specific code for the MPC8260
* CPU specific code for the MPC8255 / MPC8260 CPUs
*
* written or collected and sometimes rewritten by
* Magnus Damm <damm@bitsmart.com>
*
* minor modifications by
* modified by
* Wolfgang Denk <wd@denx.de>
*
* modified for 8260 by
......@@ -64,7 +64,7 @@ int checkcpu (void)
if ((immr & IMMR_ISB_MSK) != CFG_IMMR)
return -1; /* whoops! someone moved the IMMR */
printf ("MPC8260 (Rev %02x, Mask ", rev);
printf (CPU_ID_STR " (Rev %02x, Mask ", rev);
/*
* the bottom 16 bits of the immr are the Part Number and Mask Number
......@@ -101,6 +101,9 @@ int checkcpu (void)
case 0x0060:
printf ("A.0(A) 2K25A");
break;
case 0x0062:
printf ("B.1 4K25A");
break;
default:
printf ("unknown [immr=0x%04x,k=0x%04x]", m, k);
break;
......
......@@ -250,7 +250,7 @@ int prt_8260_rsr (void)
int i;
char *sep;
puts ("MPC8260 Reset Status:");
puts (CPU_ID_STR " Reset Status:");
sep = " ";
for (i = 0; i < n; i++)
......
......@@ -171,7 +171,7 @@ int prt_8260_clks (void)
cp = &corecnf_tab[corecnf];
printf ("MPC8260 Clock Configuration\n - Bus-to-Core Mult ");
printf (CPU_ID_STR " Clock Configuration\n - Bus-to-Core Mult ");
switch (cp->b2c_mult) {
case _byp:
......
......@@ -32,6 +32,9 @@
#include <lcdvideo.h>
#include <linux/types.h>
#include <devices.h>
#if defined(CONFIG_POST)
#include <post.h>
#endif
#ifdef CONFIG_LCD
......@@ -982,7 +985,11 @@ static void lcd_enable (void)
#if defined(CONFIG_LWMON)
{ uchar c = pic_read (0x60);
#if defined(CONFIG_LCD) && defined(CONFIG_LWMON) && (CONFIG_POST & CFG_POST_SYSMON)
c |= 0x04; /* Chip Enable LCD */
#else
c |= 0x07; /* Power on CCFL, Enable CCFL, Chip Enable LCD */
#endif
pic_write (0x60, c);
}
#endif /* CONFIG_LWMON */
......
......@@ -246,6 +246,20 @@ serial_setbrg (void)
(((gd->cpu_clk / 16 / gd->baudrate)-1) << 1) | CPM_BRG_EN;
}
#ifdef CONFIG_MODEM_SUPPORT
void disable_putc(void)
{
DECLARE_GLOBAL_DATA_PTR;
gd->be_quiet = 1;
}
void enable_putc(void)
{
DECLARE_GLOBAL_DATA_PTR;
gd->be_quiet = 0;
}
#endif
void
serial_putc(const char c)
{
......@@ -255,6 +269,13 @@ serial_putc(const char c)
volatile immap_t *im = (immap_t *)CFG_IMMR;
volatile cpm8xx_t *cpmp = &(im->im_cpm);
#ifdef CONFIG_MODEM_SUPPORT
DECLARE_GLOBAL_DATA_PTR;
if (gd->be_quiet)
return;
#endif
if (c == '\n')
serial_putc ('\r');
......
......@@ -70,10 +70,18 @@ typedef struct global_data {
#endif
#ifdef CONFIG_POST
unsigned long post_log_word; /* Record POST activities */
unsigned long post_init_f_time; /* When post_init_f started */
#endif
#ifdef CONFIG_BOARD_TYPES
unsigned long board_type;
#endif
#ifdef CONFIG_MODEM_SUPPORT
unsigned long do_mdm_init;
unsigned long be_quiet;
#endif
#ifdef CONFIG_LWMON
unsigned long kbd_status;
#endif
} gd_t;
/*
......
......@@ -32,7 +32,7 @@
#define CMD_TBL_BMP MK_CMD_TBL_ENTRY( \
"bmp", 3, 3, 1, do_bmp, \
"bmp - manipulate BMP image data\n", \
"\nbmp info <imageAddr> - display image info\n" \
"info <imageAddr> - display image info\n" \
"bmp display <imageAddr> - display image\n" \
),
int do_bmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
......
......@@ -31,9 +31,10 @@
#include <command.h>
/*
* Type string for PPC bootable partitions
* Type string for U-Boot bootable partitions
*/
#define BOOT_PART_TYPE "U-Boot"
#define BOOT_PART_TYPE "U-Boot" /* primary boot partition type */
#define BOOT_PART_COMP "PPCBoot" /* PPCBoot compatibility type */
#if 0
......
......@@ -33,6 +33,7 @@
* CONFIG_L2_CACHE
* CONFIG_266MHz
* CONFIG_300MHz
* CONFIG_MPC8255
*/
/*
......@@ -312,10 +313,10 @@
*/
#if defined(CONFIG_266MHz)
#define CFG_HRCW_MASTER (HRCW_CIP | HRCW_ISB111 | HRCW_BMS | \
HRCW_MODCK_H0111)
HRCW_MODCK_H0111)
#elif defined(CONFIG_300MHz)
#define CFG_HRCW_MASTER (HRCW_CIP | HRCW_ISB111 | HRCW_BMS | \
HRCW_MODCK_H0110)
HRCW_MODCK_H0110)
#else
#define CFG_HRCW_MASTER (HRCW_CIP | HRCW_ISB111 | HRCW_BMS)
#endif
......
......@@ -40,10 +40,13 @@
#define CONFIG_LWMON 1 /* ...on a LWMON board */
#define CONFIG_BOARD_PRE_INIT 1 /* Call board_pre_init */
#define CONFIG_BOARD_POSTCLK_INIT 1 /* Call board_postclk_init */
#define CONFIG_LCD 1 /* use LCD controller ... */
#define CONFIG_HLD1045 1 /* ... with a HLD1045 display */
#define CONFIG_SPLASH_SCREEN /* ... with splashscreen support*/
#if 1
#define CONFIG_8xx_CONS_SMC2 1 /* Console is on SMC2 */
#else
......@@ -72,7 +75,8 @@
CFG_POST_I2C | \