From e2ffd59b4d93c9149de1caaa087371b0cfc512c9 Mon Sep 17 00:00:00 2001 From: wdenk Date: Fri, 31 Dec 2004 09:32:47 +0000 Subject: * Code cleanup, mostly for GCC-3.3.x * Cleanup confusing use of CONFIG_ETH*ADDR - ust his only to pre-define a MAC address; use CONFIG_HAS_ETH* to enable support for additional ethernet addresses. * Cleanup drivers/i82365.c - avoid duplication of code * Fix bogus "cannot span across banks" flash error message * Add support for CompactFlash for the CPC45 Board. --- common/cmd_bdinfo.c | 6 +++--- common/cmd_flash.c | 4 ++++ common/cmd_ide.c | 17 ++++++++--------- common/cmd_pcmcia.c | 13 ++++++++++++- common/cmd_universe.c | 50 +++++++++++++++++++------------------------------- common/environment.c | 3 +++ 6 files changed, 49 insertions(+), 44 deletions(-) (limited to 'common') diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index 4c5540f..ca83473 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -92,21 +92,21 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]); } -#if defined(CONFIG_ETH1ADDR) +#if defined(CONFIG_HAS_ETH1) puts ("\neth1addr ="); for (i=0; i<6; ++i) { printf ("%c%02X", i ? ':' : ' ', bd->bi_enet1addr[i]); } #endif -#if defined(CONFIG_ETH2ADDR) +#if defined(CONFIG_HAS_ETH2) puts ("\neth2addr ="); for (i=0; i<6; ++i) { printf ("%c%02X", i ? ':' : ' ', bd->bi_enet2addr[i]); } #endif -#if defined(CONFIG_ETH3ADDR) +#if defined(CONFIG_HAS_ETH3) puts ("\neth3addr ="); for (i=0; i<6; ++i) { printf ("%c%02X", i ? ':' : ' ', bd->bi_enet3addr[i]); diff --git a/common/cmd_flash.c b/common/cmd_flash.c index 5ecf888..b2728ab 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -164,6 +164,10 @@ flash_fill_sect_ranges (ulong addr_first, ulong addr_last, sect = s_last[bank]; addr_first = (sect == s_end) ? b_end + 1: info->start[sect + 1]; (*s_count) += s_last[bank] - s_first[bank] + 1; + } else if (addr_first >= info->start[0] && addr_first < b_end) { + puts ("Error: start address not on sector boundary\n"); + rcode = 1; + break; } else if (s_last[bank] >= 0) { puts ("Error: cannot span across banks when they are" " mapped in reverse order\n"); diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 77a0494..851ba52 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000-2002 + * (C) Copyright 2000-2004 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this @@ -144,7 +144,7 @@ block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE]; /* ------------------------------------------------------------------------- */ #ifdef CONFIG_IDE_LED -#if !defined(CONFIG_KUP4K) && !defined(CONFIG_KUP4X) &&!defined(CONFIG_BMS2003) +#if !defined(CONFIG_KUP4K) && !defined(CONFIG_KUP4X) &&!defined(CONFIG_BMS2003) &&!defined(CONFIG_CPC45) static void ide_led (uchar led, uchar status); #else extern void ide_led (uchar led, uchar status); @@ -1548,11 +1548,12 @@ static void ide_reset (void) /* ------------------------------------------------------------------------- */ -#if defined(CONFIG_IDE_LED) && \ - !defined(CONFIG_AMIGAONEG3SE) && \ - !defined(CONFIG_KUP4K) && \ - !defined(CONFIG_KUP4X) && \ - !defined(CONFIG_HMI10) +#if defined(CONFIG_IDE_LED) && \ + !defined(CONFIG_AMIGAONEG3SE)&& \ + !defined(CONFIG_CPC45) && \ + !defined(CONFIG_HMI10) && \ + !defined(CONFIG_KUP4K) && \ + !defined(CONFIG_KUP4X) static uchar led_buffer = 0; /* Buffer for current LED status */ @@ -1578,7 +1579,6 @@ static void ide_led (uchar led, uchar status) * ATAPI Support */ - #undef ATAPI_DEBUG #ifdef ATAPI_DEBUG @@ -1661,7 +1661,6 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts) outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, shorts); } - static void input_data_shorts(int dev, ushort *sect_buf, int shorts) { diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c index 1387e89..31f2ba2 100644 --- a/common/cmd_pcmcia.c +++ b/common/cmd_pcmcia.c @@ -67,6 +67,8 @@ #include #endif +#include + #if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) || \ ((CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)) @@ -540,9 +542,18 @@ static int check_ide_device (int slot) ide_devices_found |= (1 << slot); +#if CONFIG_CPC45 +#else /* set I/O area in config reg -> only valid for ARGOSY D5!!! */ *((uchar *)(addr + config_base)) = 1; - +#endif +#if 0 + printf("\n## Config_base = %04x ###\n", config_base); + printf("Configuration Option Register: %02x @ %x\n", readb(addr + config_base), addr + config_base); + printf("Card Configuration and Status Register: %02x\n", readb(addr + config_base + 2)); + printf("Pin Replacement Register Register: %02x\n", readb(addr + config_base + 4)); + printf("Socket and Copy Register: %02x\n", readb(addr + config_base + 6)); +#endif return (0); } #endif /* CONFIG_IDE_8xx_PCCARD */ diff --git a/common/cmd_universe.c b/common/cmd_universe.c index 6388546..a8febff 100644 --- a/common/cmd_universe.c +++ b/common/cmd_universe.c @@ -28,20 +28,8 @@ #include - #if (CONFIG_COMMANDS & CFG_CMD_UNIVERSE) -#undef DBG - -#ifdef DBG -# define UNI_DBG(fmt) printf fmt -#else -# define UNI_DBG(fmt) -#endif - -#define UNI_PRINT(fmt) printf fmt - - #define PCI_VENDOR PCI_VENDOR_ID_TUNDRA #define PCI_DEVICE PCI_DEVICE_ID_TUNDRA_CA91C042 @@ -87,18 +75,18 @@ int universe_init(void) val &= ~0xf; dev->uregs = (UNIVERSE *)val; - UNI_DBG(("UNIVERSE-Base : %p\n", dev->uregs)); + debug ("UNIVERSE-Base : %p\n", dev->uregs); /* check mapping */ - UNI_DBG((" Read via mapping, PCI_ID = %08X\n", readl(&dev->uregs->pci_id))); + debug (" Read via mapping, PCI_ID = %08X\n", readl(&dev->uregs->pci_id)); if (((PCI_DEVICE <<16) | PCI_VENDOR) != readl(&dev->uregs->pci_id)) { - UNI_PRINT(("UNIVERSE: Cannot read PCI-ID via Mapping: %08x\n", - readl(&dev->uregs->pci_id))); + printf ("UNIVERSE: Cannot read PCI-ID via Mapping: %08x\n", + readl(&dev->uregs->pci_id)); result = -1; goto break_30; } - UNI_DBG(("PCI_BS = %08X\n", readl(&dev->uregs->pci_bs))); + debug ("PCI_BS = %08X\n", readl(&dev->uregs->pci_bs)); dev->pci_bs = readl(&dev->uregs->pci_bs); @@ -154,12 +142,12 @@ int universe_pci_slave_window(unsigned int pciAddr, unsigned int vmeAddr, int si } if (i == 4) { - UNI_PRINT(("universe: No Image available\n")); + printf ("universe: No Image available\n"); result = -1; goto exit_10; } - UNI_DBG(("universe: Using image %d\n", i)); + debug ("universe: Using image %d\n", i); writel(pciAddr , &dev->uregs->lsi[i].bs); writel((pciAddr + size), &dev->uregs->lsi[i].bd); @@ -219,11 +207,11 @@ int universe_pci_slave_window(unsigned int pciAddr, unsigned int vmeAddr, int si writel(ctl, &dev->uregs->lsi[i].ctl); - UNI_DBG(("universe: window-addr=%p\n", &dev->uregs->lsi[i].ctl)); - UNI_DBG(("universe: pci slave window[%d] ctl=%08x\n", i, readl(&dev->uregs->lsi[i].ctl))); - UNI_DBG(("universe: pci slave window[%d] bs=%08x\n", i, readl(&dev->uregs->lsi[i].bs))); - UNI_DBG(("universe: pci slave window[%d] bd=%08x\n", i, readl(&dev->uregs->lsi[i].bd))); - UNI_DBG(("universe: pci slave window[%d] to=%08x\n", i, readl(&dev->uregs->lsi[i].to))); + debug ("universe: window-addr=%p\n", &dev->uregs->lsi[i].ctl); + debug ("universe: pci slave window[%d] ctl=%08x\n", i, readl(&dev->uregs->lsi[i].ctl)); + debug ("universe: pci slave window[%d] bs=%08x\n", i, readl(&dev->uregs->lsi[i].bs)); + debug ("universe: pci slave window[%d] bd=%08x\n", i, readl(&dev->uregs->lsi[i].bd)); + debug ("universe: pci slave window[%d] to=%08x\n", i, readl(&dev->uregs->lsi[i].to)); return 0; @@ -251,12 +239,12 @@ int universe_vme_slave_window(unsigned int vmeAddr, unsigned int pciAddr, int si } if (i == 4) { - UNI_PRINT(("universe: No Image available\n")); + printf ("universe: No Image available\n"); result = -1; goto exit_10; } - UNI_DBG(("universe: Using image %d\n", i)); + debug ("universe: Using image %d\n", i); writel(vmeAddr , &dev->uregs->vsi[i].bs); writel((vmeAddr + size), &dev->uregs->vsi[i].bd); @@ -304,11 +292,11 @@ int universe_vme_slave_window(unsigned int vmeAddr, unsigned int pciAddr, int si writel(ctl, &dev->uregs->vsi[i].ctl); - UNI_DBG(("universe: window-addr=%p\n", &dev->uregs->vsi[i].ctl)); - UNI_DBG(("universe: vme slave window[%d] ctl=%08x\n", i, readl(&dev->uregs->vsi[i].ctl))); - UNI_DBG(("universe: vme slave window[%d] bs=%08x\n", i, readl(&dev->uregs->vsi[i].bs))); - UNI_DBG(("universe: vme slave window[%d] bd=%08x\n", i, readl(&dev->uregs->vsi[i].bd))); - UNI_DBG(("universe: vme slave window[%d] to=%08x\n", i, readl(&dev->uregs->vsi[i].to))); + debug ("universe: window-addr=%p\n", &dev->uregs->vsi[i].ctl); + debug ("universe: vme slave window[%d] ctl=%08x\n", i, readl(&dev->uregs->vsi[i].ctl)); + debug ("universe: vme slave window[%d] bs=%08x\n", i, readl(&dev->uregs->vsi[i].bs)); + debug ("universe: vme slave window[%d] bd=%08x\n", i, readl(&dev->uregs->vsi[i].bd)); + debug ("universe: vme slave window[%d] to=%08x\n", i, readl(&dev->uregs->vsi[i].to)); return 0; diff --git a/common/environment.c b/common/environment.c index 3d8493a..61a8d24 100644 --- a/common/environment.c +++ b/common/environment.c @@ -130,6 +130,9 @@ env_t environment __PPCENV__ = { #ifdef CONFIG_ETH2ADDR "eth2addr=" MK_STR(CONFIG_ETH2ADDR) "\0" #endif +#ifdef CONFIG_ETH3ADDR + "eth3addr=" MK_STR(CONFIG_ETH3ADDR) "\0" +#endif #ifdef CONFIG_ETHPRIME "ethprime=" CONFIG_ETHPRIME "\0" #endif -- cgit v1.1