diff options
author | Jon Loeliger <jdl@freescale.com> | 2006-06-07 08:49:38 -0500 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2006-06-07 08:49:38 -0500 |
commit | 72ed528a948b151e7be5ce03ed3d2b88a229dd0a (patch) | |
tree | 0f90590c0faf6fcc85f26f92facc653112be53e0 /common | |
parent | 9f37dc8cabc94aed27aec8b4c69a390c8603fd28 (diff) | |
parent | e461a24113c66747510b07930a83b0d84171a559 (diff) | |
download | u-boot-imx-72ed528a948b151e7be5ce03ed3d2b88a229dd0a.zip u-boot-imx-72ed528a948b151e7be5ce03ed3d2b88a229dd0a.tar.gz u-boot-imx-72ed528a948b151e7be5ce03ed3d2b88a229dd0a.tar.bz2 |
Merge branch 'master' of http://www.denx.de/git/u-boot
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_pcmcia.c | 182 | ||||
-rw-r--r-- | common/soft_i2c.c | 3 | ||||
-rw-r--r-- | common/xyzModem.c | 15 |
3 files changed, 192 insertions, 8 deletions
diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c index 62446d4..8e3e84b 100644 --- a/common/cmd_pcmcia.c +++ b/common/cmd_pcmcia.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000-2004 + * (C) Copyright 2000-2006 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this @@ -718,7 +718,8 @@ static int hardware_disable(int slot) /* SC8xx Boards by SinoVee Microsystems */ /* -------------------------------------------------------------------- */ -#if defined(CONFIG_TQM8xxL) || defined(CONFIG_SVM_SC8xx) +#if (defined(CONFIG_TQM8xxL) || defined(CONFIG_SVM_SC8xx)) \ + && !defined(CONFIG_VIRTLAB2) #if defined(CONFIG_TQM8xxL) #define PCMCIA_BOARD_MSG "TQM8xxL" @@ -1021,6 +1022,183 @@ done: #endif /* TQM8xxL */ +/* -------------------------------------------------------------------- */ +/* Virtlab2 Board by TQ Components */ +/* -------------------------------------------------------------------- */ + +#if defined(CONFIG_VIRTLAB2) +#define PCMCIA_BOARD_MSG "Virtlab2" + +static int hardware_enable(int slot) +{ + volatile pcmconf8xx_t *pcmp = + (pcmconf8xx_t *)&(((immap_t *)CFG_IMMR)->im_pcmcia); + volatile unsigned char *powerctl = + (volatile unsigned char *)PCMCIA_CTRL; + volatile sysconf8xx_t *sysp = + (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf)); + unsigned int reg, mask; + + debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot); + + udelay(10000); + + /* + * Configure SIUMCR to enable PCMCIA port B + */ + 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, and PCMCIA buffers + * (isolate the interface) and assert RESET signal + */ + debug ("Disable PCMCIA buffers and assert RESET\n"); + reg = __MY_PCMCIA_GCRX_CXRESET; /* active high */ + reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */ + + PCMCIA_PGCRX(slot) = reg; + udelay(500); + + /* remove all power */ + *powerctl = 0; + + /* + * Make sure there is a card in the slot, then configure the interface. + */ + udelay(10000); + debug ("[%d] %s: PIPR(%p)=0x%x\n", __LINE__,__FUNCTION__, + &(pcmp->pcmc_pipr),pcmp->pcmc_pipr); + + if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) { + printf (" No Card found\n"); + return (1); + } + + /* + * Power On. + */ + mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot); + reg = pcmp->pcmc_pipr; + debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n", reg, + (reg&PCMCIA_VS1(slot))?"n":"ff", + (reg&PCMCIA_VS2(slot))?"n":"ff"); + + if ((reg & mask) == mask) { + *powerctl = 2; /* Enable 5V Vccout */ + puts (" 5.0V card found: "); + } else { + *powerctl = 1; /* Enable 3.3 V Vccout */ + puts (" 3.3V card found: "); + } + + udelay(1000); + 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 :-( */ + + debug ("# hardware_enable done\n"); + + return (0); +} + +#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) +static int hardware_disable(int slot) +{ + volatile unsigned char *powerctl = + (volatile unsigned char *)PCMCIA_CTRL; + unsigned long reg; + + debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot); + + /* remove all power */ + *powerctl = 0; + + debug ("Disable PCMCIA buffers and assert RESET\n"); + reg = __MY_PCMCIA_GCRX_CXRESET; /* active high */ + reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */ + + PCMCIA_PGCRX(slot) = reg; + + udelay(10000); + + return (0); +} +#endif + +static int voltage_set(int slot, int vcc, int vpp) +{ +#ifdef DEBUG + volatile pcmconf8xx_t *pcmp = + (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia)); +#endif + volatile unsigned char *powerctl = + (volatile unsigned char *)PCMCIA_CTRL; + unsigned long reg; + + 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); + + /* + * Disable PCMCIA buffers (isolate the interface) + * and assert RESET signal + */ + 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 pins for 5 Volts Enable and 3 Volts enable, + * Turn off all power. + */ + debug ("PCMCIA power OFF\n"); + reg = 0; + switch(vcc) { + case 0: break; + case 33: reg = 0x0001; break; + case 50: reg = 0x0002; break; + default: goto done; + } + + /* Checking supported voltages */ + + debug ("PIPR: 0x%x --> %s\n", pcmp->pcmc_pipr, + (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V"); + + *powerctl = reg; + + if (reg) { + debug ("PCMCIA powered at %sV\n", (reg&0x0004) ? "5.0" : "3.3"); + } else { + debug ("PCMCIA powered down\n"); + } + +done: + 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); + + debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n", slot+'A'); + return (0); +} +#endif /* CONFIG_VIRTLAB2 */ /* -------------------------------------------------------------------- */ /* LWMON Board */ diff --git a/common/soft_i2c.c b/common/soft_i2c.c index bffcd44..edad51b 100644 --- a/common/soft_i2c.c +++ b/common/soft_i2c.c @@ -33,6 +33,9 @@ #include <asm/io.h> #include <asm/arch/hardware.h> #endif +#ifdef CONFIG_IXP425 /* only valid for IXP425 */ +#include <asm/arch/ixp425.h> +#endif #include <i2c.h> #if defined(CONFIG_SOFT_I2C) diff --git a/common/xyzModem.c b/common/xyzModem.c index 4a137bf..9b455a3 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -379,13 +379,13 @@ xyzModem_get_hdr(void) } /* Header found, now read the data */ - res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, &xyz.blk); + res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, (char *)&xyz.blk); ZM_DEBUG(zm_save(xyz.blk)); if (!res) { ZM_DEBUG(zm_dump(__LINE__)); return xyzModem_timeout; } - res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, &xyz.cblk); + res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, (char *)&xyz.cblk); ZM_DEBUG(zm_save(xyz.cblk)); if (!res) { ZM_DEBUG(zm_dump(__LINE__)); @@ -403,14 +403,14 @@ xyzModem_get_hdr(void) return xyzModem_timeout; } } - res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, &xyz.crc1); + res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, (char *)&xyz.crc1); ZM_DEBUG(zm_save(xyz.crc1)); if (!res) { ZM_DEBUG(zm_dump(__LINE__)); return xyzModem_timeout; } if (xyz.crc_mode) { - res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, &xyz.crc2); + res = CYGACC_COMM_IF_GETC_TIMEOUT(*xyz.__chan, (char *)&xyz.crc2); ZM_DEBUG(zm_save(xyz.crc2)); if (!res) { ZM_DEBUG(zm_dump(__LINE__)); @@ -450,7 +450,10 @@ xyzModem_get_hdr(void) int xyzModem_stream_open(connection_info_t *info, int *err) { - int console_chan, stat=0; +#ifdef REDBOOT + int console_chan; +#endif + int stat = 0; int retries = xyzModem_MAX_RETRIES; int crc_retries = xyzModem_MAX_RETRIES_WITH_CRC; @@ -510,7 +513,7 @@ xyzModem_stream_open(connection_info_t *info, int *err) /* skip filename */ while (*xyz.bufp++); /* get the length */ - parse_num(xyz.bufp, &xyz.file_length, NULL, " "); + parse_num((char *)xyz.bufp, &xyz.file_length, NULL, " "); #endif /* The rest of the file name data block quietly discarded */ xyz.tx_ack = true; |