diff options
author | wdenk <wdenk> | 2004-01-04 22:51:12 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2004-01-04 22:51:12 +0000 |
commit | a522fa0e7cdddf8204ba43b335f68be6a42159a5 (patch) | |
tree | 3ddc0bffbaade1b79b1ff520ad6051b5a9766278 /common | |
parent | 180d3f74e4738ee107e269cbb949481075dd789a (diff) | |
download | u-boot-imx-a522fa0e7cdddf8204ba43b335f68be6a42159a5.zip u-boot-imx-a522fa0e7cdddf8204ba43b335f68be6a42159a5.tar.gz u-boot-imx-a522fa0e7cdddf8204ba43b335f68be6a42159a5.tar.bz2 |
* Make BMS2003 use a separate config file to avoid #ifdef mess;
add I2C support; add support for DS1337 RTC
* Add CompactFlash support for BMS2003 board
* Add support for status LED on BMS2003 board
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_ide.c | 85 | ||||
-rw-r--r-- | common/cmd_pcmcia.c | 68 |
2 files changed, 152 insertions, 1 deletions
diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 331041c..668d838 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -835,6 +835,7 @@ output_data_short(int dev, ulong *sect_buf, int words) static void input_swap_data(int dev, ulong *sect_buf, int words) { +#ifndef CONFIG_BMS2003 volatile ushort *pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG); ushort *dbuf = (ushort *)sect_buf; @@ -842,6 +843,20 @@ input_swap_data(int dev, ulong *sect_buf, int words) *dbuf++ = ld_le16(pbuf); *dbuf++ = ld_le16(pbuf); } +#else /* CONFIG_BMS2003 */ + uchar i; + volatile uchar *pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN); + volatile uchar *pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD); + ushort *dbuf = (ushort *)sect_buf; + + while (words--) { + for (i=0; i<2; i++) { + *(((uchar *)(dbuf)) + 1) = *pbuf_even; + *(uchar *)dbuf = *pbuf_odd; + dbuf+=1; + } + } +#endif /* CONFIG_BMS2003 */ } #endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */ @@ -850,6 +865,7 @@ input_swap_data(int dev, ulong *sect_buf, int words) static void output_data(int dev, ulong *sect_buf, int words) { +#ifndef CONFIG_BMS2003 ushort *dbuf; volatile ushort *pbuf; @@ -861,6 +877,25 @@ output_data(int dev, ulong *sect_buf, int words) __asm__ volatile ("eieio"); *pbuf = *dbuf++; } +#else /* CONFIG_BMS2003 */ + uchar *dbuf; + volatile uchar *pbuf_even; + volatile uchar *pbuf_odd; + + pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN); + pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD); + dbuf = (uchar *)sect_buf; + while (words--) { + __asm__ volatile ("eieio"); + *pbuf_even = *dbuf++; + __asm__ volatile ("eieio"); + *pbuf_odd = *dbuf++; + __asm__ volatile ("eieio"); + *pbuf_even = *dbuf++; + __asm__ volatile ("eieio"); + *pbuf_odd = *dbuf++; + } +#endif /* CONFIG_BMS2003 */ } #else /* ! __PPC__ */ static void @@ -874,6 +909,7 @@ output_data(int dev, ulong *sect_buf, int words) static void input_data(int dev, ulong *sect_buf, int words) { +#ifndef CONFIG_BMS2003 ushort *dbuf; volatile ushort *pbuf; @@ -885,6 +921,25 @@ input_data(int dev, ulong *sect_buf, int words) __asm__ volatile ("eieio"); *dbuf++ = *pbuf; } +#else /* CONFIG_BMS2003 */ + uchar *dbuf; + volatile uchar *pbuf_even; + volatile uchar *pbuf_odd; + + pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN); + pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD); + dbuf = (uchar *)sect_buf; + while (words--) { + __asm__ volatile ("eieio"); + *dbuf++ = *pbuf_even; + __asm__ volatile ("eieio"); + *dbuf++ = *pbuf_odd; + __asm__ volatile ("eieio"); + *dbuf++ = *pbuf_even; + __asm__ volatile ("eieio"); + *dbuf++ = *pbuf_odd; + } +#endif /* CONFIG_BMS2003 */ } #else /* ! __PPC__ */ static void @@ -1409,6 +1464,7 @@ static void ide_led (uchar led, uchar status) static void output_data_shorts(int dev, ushort *sect_buf, int shorts) { +#ifndef CONFIG_BMS2003 ushort *dbuf; volatile ushort *pbuf; @@ -1418,11 +1474,26 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts) __asm__ volatile ("eieio"); *pbuf = *dbuf++; } +#else /* CONFIG_BMS2003 */ + uchar *dbuf; + volatile uchar *pbuf_even; + volatile uchar *pbuf_odd; + + pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN); + pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD); + while (shorts--) { + __asm__ volatile ("eieio"); + *pbuf_even = *dbuf++; + __asm__ volatile ("eieio"); + *pbuf_odd = *dbuf++; + } +#endif /* CONFIG_BMS2003 */ } static void input_data_shorts(int dev, ushort *sect_buf, int shorts) { +#ifndef CONFIG_BMS2003 ushort *dbuf; volatile ushort *pbuf; @@ -1432,6 +1503,20 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts) __asm__ volatile ("eieio"); *dbuf++ = *pbuf; } +#else /* CONFIG_BMS2003 */ + uchar *dbuf; + volatile uchar *pbuf_even; + volatile uchar *pbuf_odd; + + pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN); + pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD); + while (shorts--) { + __asm__ volatile ("eieio"); + *dbuf++ = *pbuf_even; + __asm__ volatile ("eieio"); + *dbuf++ = *pbuf_odd; + } +#endif /* CONFIG_BMS2003 */ } #else /* ! __PPC__ */ diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c index 1bd4bc5..8c17859 100644 --- a/common/cmd_pcmcia.c +++ b/common/cmd_pcmcia.c @@ -229,7 +229,7 @@ int pcmcia_on (void) #endif /* CONFIG_IDE_8xx_PCCARD */ #ifdef CONFIG_BMS2003 case 3: { /* map I/O window for 4xUART data/ctrl */ - win->br += 0x140000; + win->br += 0x40000; win->or = ( PCMCIA_BSIZE_256K | PCMCIA_PPS_8 | PCMCIA_PRS_IO @@ -622,6 +622,7 @@ static int hardware_enable(int slot) PCMCIA_PGCRX(slot) = reg; udelay(500); +#ifndef CONFIG_BMS2003 #ifndef CONFIG_NSCU /* * Configure Port C pins for @@ -633,6 +634,16 @@ static int hardware_enable(int slot) immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004); #endif +#else /* CONFIG_BMS2003 */ + /* + * Configure Port B pins for + * 5 Volts Enable and 3 Volts enable + */ + immap->im_cpm.cp_pbpar &= ~(0x00000300); + + /* remove all power */ + immap->im_cpm.cp_pbdat |= 0x00000300; +#endif /* CONFIG_BMS2003 */ /* * Make sure there is a card in the slot, then configure the interface. @@ -641,7 +652,11 @@ static int hardware_enable(int slot) debug ("[%d] %s: PIPR(%p)=0x%x\n", __LINE__,__FUNCTION__, &(pcmp->pcmc_pipr),pcmp->pcmc_pipr); +#ifndef CONFIG_BMS2003 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) { +#else + if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) { +#endif /* CONFIG_BMS2003 */ printf (" No Card found\n"); return (1); } @@ -657,14 +672,26 @@ static int hardware_enable(int slot) (reg&PCMCIA_VS2(slot))?"n":"ff"); #ifndef CONFIG_NSCU if ((reg & mask) == mask) { +#ifndef CONFIG_BMS2003 immap->im_ioport.iop_pcdat |= 0x0004; +#else + immap->im_cpm.cp_pbdat &= ~(0x0000100); +#endif /* CONFIG_BMS2003 */ puts (" 5.0V card found: "); } else { +#ifndef CONFIG_BMS2003 immap->im_ioport.iop_pcdat |= 0x0002; +#else + immap->im_cpm.cp_pbdat &= ~(0x0000200); +#endif /* CONFIG_BMS2003 */ puts (" 3.3V card found: "); } +#ifndef CONFIG_BMS2003 immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004); #else + immap->im_cpm.cp_pbdir |= 0x00000300; +#endif /* CONFIG_BMS2003 */ +#else if ((reg & mask) == mask) { puts (" 5.0V card found: "); } else { @@ -708,10 +735,14 @@ static int hardware_disable(int slot) immap = (immap_t *)CFG_IMMR; pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia)); +#ifndef CONFIG_BMS2003 #ifndef CONFIG_NSCU /* remove all power */ immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004); #endif +#else /* CONFIG_BMS2003 */ + immap->im_cpm.cp_pbdat |= 0x00000300; +#endif /* CONFIG_BMS2003 */ debug ("Disable PCMCIA buffers and assert RESET\n"); reg = 0; @@ -761,6 +792,7 @@ static int voltage_set(int slot, int vcc, int vpp) PCMCIA_PGCRX(slot) = reg; udelay(500); +#ifndef CONFIG_BMS2003 /* * Configure Port C pins for * 5 Volts Enable and 3 Volts enable, @@ -778,6 +810,26 @@ static int voltage_set(int slot, int vcc, int vpp) case 50: reg |= 0x0004; break; default: goto done; } +#else /* CONFIG_BMS2003 */ + /* + * Configure Port B pins for + * 5 Volts Enable and 3 Volts enable, + * Turn off all power + */ + debug ("PCMCIA power OFF\n"); + immap->im_cpm.cp_pbpar &= ~(0x00000300); + /* remove all power */ + + immap->im_cpm.cp_pbdat |= 0x00000300; + + reg = 0; + switch(vcc) { + case 0: break; + case 33: reg |= 0x00000200; break; + case 50: reg |= 0x00000100; break; + default: goto done; +} +#endif /* CONFIG_BMS2003 */ /* Checking supported voltages */ @@ -785,11 +837,21 @@ static int voltage_set(int slot, int vcc, int vpp) pcmp->pcmc_pipr, (pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V"); +#ifndef CONFIG_BMS2003 immap->im_ioport.iop_pcdat |= reg; immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004); +#else + immap->im_cpm.cp_pbdat &= !reg; + immap->im_cpm.cp_pbdir |= 0x00000300; +#endif /* CONFIG_BMS2003 */ if (reg) { +#ifndef CONFIG_BMS2003 debug ("PCMCIA powered at %sV\n", (reg&0x0004) ? "5.0" : "3.3"); +#else + debug ("PCMCIA powered at %sV\n", + (reg&0x00000200) ? "5.0" : "3.3"); +#endif /* CONFIG_BMS2003 */ } else { debug ("PCMCIA powered down\n"); } @@ -1774,7 +1836,11 @@ static int hardware_enable (int slot) debug ("[%d] %s: PIPR(%p)=0x%x\n", __LINE__,__FUNCTION__, &(pcmp->pcmc_pipr),pcmp->pcmc_pipr); +#ifndef CONFIG_BMS2003 if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) { +#else + if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) { +#endif /* CONFIG_BMS2003 */ printf (" No Card found\n"); return (1); } |