From: wdenk Date: Sun, 11 Nov 2001 23:55:57 +0000 (+0000) Subject: * Add status LED support for ICU862 board X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5f336077eb3695c249e3231875c03dacebd67c7d;p=users%2Frw%2Fppcboot.git * Add status LED support for ICU862 board add PCMCIA / IDE support for ICU862 board * Fix endianess bug in bmp_logo Patch by Erik Theisen, 7 Nov 2001 * Add appropriate error message for unaligned flash writes (CU824) * Fix initialization sequence: must initialize PCI before "devices" on some boards --- diff --git a/CHANGELOG b/CHANGELOG index 1b21e08..5e4c1b0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -52,6 +52,21 @@ To do: * "last user address" is set even if bootp is used without parameters (and it uses default address). +====================================================================== +Modifications for 1.1.1: +====================================================================== + +* Add status LED support for ICU862 board + add PCMCIA / IDE support for ICU862 board + +* Fix endianess bug in bmp_logo + Patch by Erik Theisen, 7 Nov 2001 + +* Add appropriate error message for unaligned flash writes (CU824) + +* Fix initialization sequence: must initialize PCI before "devices" + on some boards + ====================================================================== Modifications for 1.1.0: ====================================================================== diff --git a/common/board.c b/common/board.c index f9a6b0f..c318b73 100644 --- a/common/board.c +++ b/common/board.c @@ -665,7 +665,14 @@ void board_init_r (bd_t *bd, ulong dest_addr) watchdog_reset (); #endif /* CONFIG_WATCHDOG */ -/** leave this here (after malloc() end environment are working) **/ +#ifdef CONFIG_PCI + /* + * Do pci configuration + */ + pci_init(bd); +#endif + +/** leave this here (after malloc(), environment and PCI are working) **/ /* Initialize devices */ devices_init (bd, reloc_off); @@ -761,14 +768,6 @@ void board_init_r (bd_t *bd, ulong dest_addr) watchdog_reset (); #endif /* CONFIG_WATCHDOG */ - /* Initialize other board modules */ -#ifdef CONFIG_PCI - /* - * Do pci configuration - */ - pci_init(bd); -#endif - #if (CONFIG_COMMANDS & CFG_CMD_IDE) # if defined(CONFIG_WATCHDOG) watchdog_reset (); diff --git a/common/cmd_ide.c b/common/cmd_ide.c index c04b809..1415ebf 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -533,6 +533,7 @@ void ide_init (bd_t *bd) #ifndef CONFIG_ATAPI /* ATAPI Devices do not set DRDY */ } else if ((c & ATA_STAT_READY) == 0) { puts ("not available "); + PRINTF ("Status = 0x%02X ", c); #endif } else { puts ("OK "); diff --git a/common/cmd_mem.c b/common/cmd_mem.c index b5d2062..c6ab662 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -312,6 +312,8 @@ int do_mem_cp (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) return 1; case 8: printf ("Outside available Flash\n"); return 1; + case 16:printf ("Size must be aligned (multiple of 8?)\n"); + return 1; default: printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc); return 1; diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c index 902d41b..e3be73b 100644 --- a/common/cmd_pcmcia.c +++ b/common/cmd_pcmcia.c @@ -1050,6 +1050,275 @@ static int hardware_disable(int slot) #endif /* CFG_CMD_PCMCIA */ #endif /* CONFIG_GTH */ +/* ---------------------------------------------------------------------------- */ +/* ICU862 Boards by Cambridge Broadband Ltd. */ +/* ---------------------------------------------------------------------------- */ + +#if defined(CONFIG_ICU862) + +#define PCMCIA_BOARD_MSG "ICU862" + +static void cfg_port_B (void); + +static int hardware_enable(int slot) +{ + volatile immap_t *immap; + volatile cpm8xx_t *cp; + volatile pcmconf8xx_t *pcmp; + volatile sysconf8xx_t *sysp; + uint reg, pipr, mask; + int i; + + PCMCIA_DEBUG ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot); + + udelay(10000); + + immap = (immap_t *)CFG_IMMR; + sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf)); + pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia)); + cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm)); + + /* Configure Port B for TPS2205 PC-Card Power-Interface Switch */ + cfg_port_B (); + + /* + * Configure SIUMCR to enable PCMCIA port B + * (VFLS[0:1] are not used for debugging, we connect FRZ# instead) + */ + sysp->sc_siumcr &= ~SIUMCR_DBGC11; /* set DBGC to 00 */ + + /* clear interrupt state, and disable interrupts */ + pcmp->pcmc_pscr = PCMCIA_MASK(_slot_); + pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_); + + /* disable interrupts & DMA */ + PCMCIA_PGCRX(_slot_) = 0; + + /* + * Disable PCMCIA buffers (isolate the interface) + * and assert RESET signal + */ + PCMCIA_DEBUG ("Disable PCMCIA buffers and assert RESET\n"); + reg = PCMCIA_PGCRX(_slot_); + reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */ + reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */ + PCMCIA_PGCRX(_slot_) = reg; + udelay(500); + + /* + * Make sure there is a card in the slot, then configure the interface. + */ + udelay(10000); + PCMCIA_DEBUG ("[%d] %s: PIPR(%p)=0x%x\n", + __LINE__,__FUNCTION__, + &(pcmp->pcmc_pipr),pcmp->pcmc_pipr); + if (pcmp->pcmc_pipr & 0x00001800) { + printf (" No Card found\n"); + return (1); + } + + /* + * Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z + */ + mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot); + pipr = pcmp->pcmc_pipr; + PCMCIA_DEBUG ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", + pipr, + (reg&PCMCIA_VS1(slot))?"n":"ff", + (reg&PCMCIA_VS2(slot))?"n":"ff"); + + reg = cp->cp_pbdat; + if ((pipr & mask) == mask) { + reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */ + TPS2205_VCC3); /* 3V off */ + reg &= ~(TPS2205_VCC5); /* 5V on */ + puts (" 5.0V card found: "); + } else { + reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */ + TPS2205_VCC5); /* 5V off */ + reg &= ~(TPS2205_VCC3); /* 3V on */ + puts (" 3.3V card found: "); + } + + PCMCIA_DEBUG ("\nPB DAT: %08x -> 3.3V %s 5.0V %s VPP_PGM %s VPP_VCC %s\n", + reg, + (reg & TPS2205_VCC3) ? "off" : "on", + (reg & TPS2205_VCC5) ? "off" : "on", + (reg & TPS2205_VPP_PGM) ? "off" : "on", + (reg & TPS2205_VPP_VCC) ? "off" : "on" ); + + cp->cp_pbdat = reg; + + /* Wait 500 ms; use this to check for over-current */ + for (i=0; i<5000; ++i) { + if ((cp->cp_pbdat & TPS2205_OC) == 0) { + printf (" *** Overcurrent - Safety shutdown ***\n"); + cp->cp_pbdat &= ~(TPS2205_SHDN); + return (1); + } + udelay (100); + } + + PCMCIA_DEBUG ("Enable PCMCIA buffers and stop RESET\n"); + reg = PCMCIA_PGCRX(_slot_); + reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */ + reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */ + PCMCIA_PGCRX(_slot_) = reg; + + udelay(250000); /* some cards need >150 ms to come up :-( */ + + PCMCIA_DEBUG ("# hardware_enable done\n"); + + return (0); +} + + + +#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) +static int hardware_disable(int slot) +{ + volatile immap_t *immap; + volatile cpm8xx_t *cp; + volatile pcmconf8xx_t *pcmp; + u_long reg; + + PCMCIA_DEBUG ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot); + + immap = (immap_t *)CFG_IMMR; + cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm)); + pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia)); + + /* Shut down */ + cp->cp_pbdat &= ~(TPS2205_SHDN); + + /* Configure PCMCIA General Control Register */ + PCMCIA_PGCRX(_slot_) = 0; + + PCMCIA_DEBUG ("Disable PCMCIA buffers and assert RESET\n"); + reg = PCMCIA_PGCRX(_slot_); + reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */ + reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */ + PCMCIA_PGCRX(_slot_) = reg; + + udelay(10000); + + return (0); +} +#endif /* CFG_CMD_PCMCIA */ + + + +static int voltage_set(int slot, int vcc, int vpp) +{ + volatile immap_t *immap; + volatile cpm8xx_t *cp; + volatile pcmconf8xx_t *pcmp; + u_long reg; + + PCMCIA_DEBUG ("voltage_set: " \ + PCMCIA_BOARD_MSG \ + " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n", + 'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10); + + immap = (immap_t *)CFG_IMMR; + cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm)); + pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia)); + /* + * Disable PCMCIA buffers (isolate the interface) + * and assert RESET signal + */ + PCMCIA_DEBUG ("Disable PCMCIA buffers and assert RESET\n"); + reg = PCMCIA_PGCRX(_slot_); + reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */ + reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */ + PCMCIA_PGCRX(_slot_) = reg; + udelay(500); + + /* + * Configure Port C pins for + * 5 Volts Enable and 3 Volts enable, + * Turn all power pins to Hi-Z + */ + PCMCIA_DEBUG ("PCMCIA power OFF\n"); + cfg_port_B (); /* Enables switch, but all in Hi-Z */ + + reg = cp->cp_pbdat; + + switch(vcc) { + case 0: break; /* Switch off */ + case 33: reg &= ~TPS2205_VCC3; break; /* Switch on 3.3V */ + case 50: reg &= ~TPS2205_VCC5; break; /* Switch on 5.0V */ + default: goto done; + } + + /* Checking supported voltages */ + + PCMCIA_DEBUG ("PIPR: 0x%x --> %s\n", + pcmp->pcmc_pipr, + (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V"); + + cp->cp_pbdat = reg; + +#ifdef DEBUG + { + char *s; + + if ((reg & TPS2205_VCC3) == 0) { + s = "at 3.3V"; + } else if ((reg & TPS2205_VCC5) == 0) { + s = "at 5.0V"; + } else { + s = "down"; + } + printf ("PCMCIA powered %s\n", s); + } +#endif + +done: + PCMCIA_DEBUG ("Enable PCMCIA buffers and stop RESET\n"); + reg = PCMCIA_PGCRX(_slot_); + reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */ + reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */ + PCMCIA_PGCRX(_slot_) = reg; + udelay(500); + + PCMCIA_DEBUG ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n", + slot+'A'); + return (0); +} + +static void cfg_port_B (void) +{ + volatile immap_t *immap; + volatile cpm8xx_t *cp; + uint reg; + + immap = (immap_t *)CFG_IMMR; + cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm)); + + /* + * Configure Port B for TPS2205 PC-Card Power-Interface Switch + * + * Switch off all voltages, assert shutdown + */ + reg = cp->cp_pbdat; + reg |= (TPS2205_VPP_PGM | TPS2205_VPP_VCC | /* VAVPP => Hi-Z */ + TPS2205_VCC3 | TPS2205_VCC5 | /* VAVCC => Hi-Z */ + TPS2205_SHDN); /* enable switch */ + cp->cp_pbdat = reg; + + cp->cp_pbpar &= ~(TPS2205_INPUTS | TPS2205_OUTPUTS); + + reg = cp->cp_pbdir & ~(TPS2205_INPUTS); + cp->cp_pbdir = reg | TPS2205_OUTPUTS; + + PCMCIA_DEBUG ("Set Port B: PAR: %08x DIR: %08x DAT: %08x\n", + cp->cp_pbpar, cp->cp_pbdir, cp->cp_pbdat); +} + +#endif /* ICU862 */ + + /* ---------------------------------------------------------------------------- */ /* End of Board Specific Stuff */ /* ---------------------------------------------------------------------------- */ diff --git a/common/flash.c b/common/flash.c index 6ff7305..d64356f 100644 --- a/common/flash.c +++ b/common/flash.c @@ -33,7 +33,8 @@ extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ /*----------------------------------------------------------------------- * Set protection status for monitor sectors * - * The monitor always occupies the _first_ part of the _first_ Flash bank. + * The monitor is always located in the _first_ Flash bank. + * If necessary you have to map the second bank at lower addresses. */ void flash_protect (int flag, ulong from, ulong to, flash_info_t *info) diff --git a/include/config_CU824.h b/include/config_CU824.h index 1e8d883..7f02619 100644 --- a/include/config_CU824.h +++ b/include/config_CU824.h @@ -72,7 +72,7 @@ */ #define CFG_PBSIZE (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16) -#define CFG_MAXARGS 8 /* Max number of command args */ +#define CFG_MAXARGS 16 /* max number of command args */ #define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ #define CFG_LOAD_ADDR 0x00100000 /* Default load address */ diff --git a/include/config_ICU862.h b/include/config_ICU862.h index 33ea5a3..2cd20b6 100644 --- a/include/config_ICU862.h +++ b/include/config_ICU862.h @@ -74,6 +74,8 @@ #undef CONFIG_WATCHDOG /* watchdog disabled */ +#define CONFIG_STATUS_LED 1 /* Status LED enabled */ + #define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE) #undef CONFIG_SCC1_ENET /* disable SCC1 ethernet */ @@ -84,6 +86,17 @@ #undef CFG_DISCOVER_PHY #endif +#define CONFIG_MAC_PARTITION +#define CONFIG_DOS_PARTITION + +#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */ + +#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \ + CFG_CMD_ASKENV | \ + CFG_CMD_DHCP | \ + CFG_CMD_IDE | \ + CFG_CMD_DATE ) + /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include @@ -243,6 +256,68 @@ /* +0x09C4 => DRQP = 10 (IDMA requests have lowest priority) */ #define CFG_RCCR 0x0020 +/*----------------------------------------------------------------------- + * PCMCIA stuff + *----------------------------------------------------------------------- + */ +#define CFG_PCMCIA_MEM_ADDR (0xE0000000) +#define CFG_PCMCIA_MEM_SIZE ( 64 << 20 ) +#define CFG_PCMCIA_DMA_ADDR (0xE4000000) +#define CFG_PCMCIA_DMA_SIZE ( 64 << 20 ) +#define CFG_PCMCIA_ATTRB_ADDR (0xE8000000) +#define CFG_PCMCIA_ATTRB_SIZE ( 64 << 20 ) +#define CFG_PCMCIA_IO_ADDR (0xEC000000) +#define CFG_PCMCIA_IO_SIZE ( 64 << 20 ) + +/*----------------------------------------------------------------------- + * PCMCIA Power Switch + * + * The ICU862 uses a TPS2205 PC-Card Power-Interface Switch to + * control the voltages on the PCMCIA slot which is connected to Port B + *----------------------------------------------------------------------- + */ + /* Output pins */ +#define TPS2205_VCC5 0x00008000 /* PB.16: 5V Voltage Control */ +#define TPS2205_VCC3 0x00004000 /* PB.17: 3V Voltage Control */ +#define TPS2205_VPP_PGM 0x00002000 /* PB.18: PGM Voltage Control */ +#define TPS2205_VPP_VCC 0x00001000 /* PB.19: VPP Voltage Control */ +#define TPS2205_SHDN 0x00000200 /* PB.22: Shutdown */ +#define TPS2205_OUTPUTS ( TPS2205_VCC5 | TPS2205_VCC3 | \ + TPS2205_VPP_PGM | TPS2205_VPP_VCC | \ + TPS2205_SHDN) + + /* Input pins */ +#define TPS2205_OC 0x00000100 /* PB.23: Over-Current */ +#define TPS2205_INPUTS ( TPS2205_OC ) + +/*----------------------------------------------------------------------- + * IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter) + *----------------------------------------------------------------------- + */ + +#define CONFIG_IDE_PCCARD 1 /* Use IDE with PC Card Adapter */ + +#undef CONFIG_IDE_PCMCIA /* Direct IDE not supported */ +#undef CONFIG_IDE_LED /* LED for ide not supported */ +#undef CONFIG_IDE_RESET /* reset for ide not supported */ + +#define CFG_IDE_MAXBUS 1 /* max. 1 IDE bus */ +#define CFG_IDE_MAXDEVICE 1 /* max. 1 drive per IDE bus */ + +#define CFG_ATA_IDE0_OFFSET 0x0000 + +#define CFG_ATA_BASE_ADDR CFG_PCMCIA_MEM_ADDR + +/* Offset for data I/O */ +#define CFG_ATA_DATA_OFFSET (CFG_PCMCIA_MEM_SIZE + 0x320) + +/* Offset for normal register accesses */ +#define CFG_ATA_REG_OFFSET (2 * CFG_PCMCIA_MEM_SIZE + 0x320) + +/* Offset for alternate registers */ +#define CFG_ATA_ALT_OFFSET 0x0100 + + /*----------------------------------------------------------------------- * *----------------------------------------------------------------------- diff --git a/include/pcmcia.h b/include/pcmcia.h index 7798567..719f769 100644 --- a/include/pcmcia.h +++ b/include/pcmcia.h @@ -57,6 +57,8 @@ # define CONFIG_PCMCIA_SLOT_A #elif defined(CONFIG_LWMON) /* The LWMON use SLOT_B */ # define CONFIG_PCMCIA_SLOT_B +#elif defined(CONFIG_ICU862) /* The ICU862 use SLOT_B */ +# define CONFIG_PCMCIA_SLOT_B #else # error "PCMCIA Slot not configured" #endif diff --git a/include/status_led.h b/include/status_led.h index f56507d..1211d0d 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -174,6 +174,25 @@ void status_led_set (int led, int state); # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */ +/***** ICU862 ********************************************************/ +#elif defined(CONFIG_ICU862) + +# define STATUS_LED_PAR im_ioport.iop_papar +# define STATUS_LED_DIR im_ioport.iop_padir +# define STATUS_LED_ODR im_ioport.iop_paodr +# define STATUS_LED_DAT im_ioport.iop_padat + +# define STATUS_LED_BIT 0x4000 /* LED 0 is on PA.1 */ +# define STATUS_LED_PERIOD (CFG_HZ / 2) +# define STATUS_LED_STATE STATUS_LED_BLINKING +# define STATUS_LED_BIT1 0x1000 /* LED 1 is on PA.3 */ +# define STATUS_LED_PERIOD1 (CFG_HZ) +# define STATUS_LED_STATE1 STATUS_LED_OFF + +# define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */ + +# define STATUS_LED_BOOT 0 /* LED 0 used for boot status */ + /************************************************************************/ #else # error Status LED configuration missing diff --git a/include/version.h b/include/version.h index 77b56a8..6b0f575 100644 --- a/include/version.h +++ b/include/version.h @@ -24,6 +24,6 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -#define PPCBOOT_VERSION "PPCBoot 1.1.0" +#define PPCBOOT_VERSION "PPCBoot 1.1.1" #endif /* __VERSION_H__ */ diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c index 9ded4b0..2039522 100755 --- a/tools/bmp_logo.c +++ b/tools/bmp_logo.c @@ -12,6 +12,20 @@ typedef struct bitmap_s { /* bitmap description */ #define DEFAULT_CMAP_SIZE 16 /* size of default color map */ +/* + * Neutralize little endians. + */ +ushort le_short(ushort x) +{ + ushort val; + uchar *p = (uchar *)(&x); + + val = (*p++ & 0xff) << 0; + val |= (*p & 0xff) << 8; + + return val; +} + void skip_bytes (FILE *fp, int n) { while (n-- > 0) @@ -53,6 +67,13 @@ int main (int argc, char *argv[]) fread (&n_colors, sizeof (ushort), 1, fp); skip_bytes (fp, 6); + /* + * Repair endianess. + */ + b->width = le_short(b->width); + b->height = le_short(b->height); + n_colors = le_short(n_colors); + /* assume we are working with an 8-bit file */ if ((n_colors == 0) || (n_colors > 256 - DEFAULT_CMAP_SIZE)) { /* reserve DEFAULT_CMAP_SIZE color map entries for default map */