X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=board%2Fbf533-stamp%2Fbf533-stamp.c;h=4abad08cd9d9db8751859c742ec1740e40606332;hb=1117cbf2adac59050af1751af6c6a524afa5c3ef;hp=44ebc931946a041feabd64c59a47eac28c092b2e;hpb=6c6e042ab3bbfb5428e4cdeb38fa27728c63afdd;p=u-boot diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c index 44ebc93194..4abad08cd9 100644 --- a/board/bf533-stamp/bf533-stamp.c +++ b/board/bf533-stamp/bf533-stamp.c @@ -1,7 +1,7 @@ /* - * U-boot - stamp.c STAMP board specific routines + * U-boot - main board file * - * Copyright (c) 2005-2007 Analog Devices Inc. + * Copyright (c) 2005-2008 Analog Devices Inc. * * (C) Copyright 2000-2004 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. @@ -26,20 +26,12 @@ */ #include +#include #include #include "bf533-stamp.h" DECLARE_GLOBAL_DATA_PTR; -#define STATUS_LED_OFF 0 -#define STATUS_LED_ON 1 - -#ifdef CONFIG_SHOW_BOOT_PROGRESS -# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg) -#else -# define SHOW_BOOT_PROGRESS(arg) -#endif - int checkboard(void) { printf("Board: ADI BF533 Stamp board\n"); @@ -47,13 +39,6 @@ int checkboard(void) return 0; } -phys_size_t initdram(int board_type) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; - return gd->bd->bi_memsize; -} - /* PF0 and PF1 are used to switch between the ethernet and flash: * PF0 PF1 * flash: 0 0 @@ -77,125 +62,23 @@ void swap_to(int device_id) /* miscellaneous platform dependent initialisations */ int misc_init_r(void) { - int i; - int cf_stat = 0; - - /* Check whether CF card is inserted */ - *pFIO_EDGE = FIO_EDGE_CF_BITS; - *pFIO_POLAR = FIO_POLAR_CF_BITS; - for (i = 0; i < 0x300; i++) - asm("nop;"); - - if ((*pFIO_FLAG_S) & CF_STAT_BITS) { - cf_stat = 0; - } else { - cf_stat = 1; - } - - *pFIO_EDGE = FIO_EDGE_BITS; - *pFIO_POLAR = FIO_POLAR_BITS; - - if (cf_stat) { - printf("Booting from COMPACT flash\n"); - - for (i = 0; i < 0x1000; i++) - asm("nop;"); - for (i = 0; i < 0x1000; i++) - asm("nop;"); - for (i = 0; i < 0x1000; i++) - asm("nop;"); - - serial_setbrg(); - ide_init(); - - setenv("bootargs", ""); - setenv("bootcmd", - "fatload ide 0:1 0x1000000 uImage-stamp;bootm 0x1000000;bootm 0x20100000"); - } else { - printf("Booting from FLASH\n"); - } +#ifdef CONFIG_STAMP_CF + cf_ide_init(); +#endif return 0; } #endif -#ifdef CONFIG_STAMP_CF - -void cf_outb(unsigned char val, volatile unsigned char *addr) -{ - /* - * Set PF1 PF0 respectively to 0 1 to divert address - * to the expansion memory banks - */ - *pFIO_FLAG_S = CF_PF0; - *pFIO_FLAG_C = CF_PF1; - SSYNC(); - - *(addr) = val; - SSYNC(); - - /* Setback PF1 PF0 to 0 0 to address external - * memory banks */ - *(volatile unsigned short *)pFIO_FLAG_C = CF_PF1_PF0; - SSYNC(); -} - -unsigned char cf_inb(volatile unsigned char *addr) -{ - volatile unsigned char c; - - *pFIO_FLAG_S = CF_PF0; - *pFIO_FLAG_C = CF_PF1; - SSYNC(); - - c = *(addr); - SSYNC(); - - *pFIO_FLAG_C = CF_PF1_PF0; - SSYNC(); - - return c; -} - -void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words) -{ - int i; - - *pFIO_FLAG_S = CF_PF0; - *pFIO_FLAG_C = CF_PF1; - SSYNC(); - - for (i = 0; i < words; i++) { - *(sect_buf + i) = *(addr); - SSYNC(); - } - - *pFIO_FLAG_C = CF_PF1_PF0; - SSYNC(); -} - -void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words) -{ - int i; - - *pFIO_FLAG_S = CF_PF0; - *pFIO_FLAG_C = CF_PF1; - SSYNC(); - - for (i = 0; i < words; i++) { - *(addr) = *(sect_buf + i); - SSYNC(); - } +#ifdef CONFIG_SHOW_BOOT_PROGRESS - *pFIO_FLAG_C = CF_PF1_PF0; - SSYNC(); -} -#endif +#define STATUS_LED_OFF 0 +#define STATUS_LED_ON 1 -void stamp_led_set(int LED1, int LED2, int LED3) +static void stamp_led_set(int LED1, int LED2, int LED3) { - *pFIO_INEN &= ~(PF2 | PF3 | PF4); - *pFIO_DIR |= (PF2 | PF3 | PF4); + bfin_write_FIO_INEN(bfin_read_FIO_INEN() & ~(PF2 | PF3 | PF4)); + bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4)); if (LED1 == STATUS_LED_OFF) *pFIO_FLAG_S = PF2; @@ -249,3 +132,48 @@ void show_boot_progress(int status) break; } } +#endif + +#ifdef CONFIG_STATUS_LED +#include + +static void set_led(int pf, int state) +{ + switch (state) { + case STATUS_LED_OFF: bfin_write_FIO_FLAG_S(pf); break; + case STATUS_LED_BLINKING: bfin_write_FIO_FLAG_T(pf); break; + case STATUS_LED_ON: bfin_write_FIO_FLAG_C(pf); break; + } +} + +static void set_leds(led_id_t mask, int state) +{ + if (mask & 0x1) set_led(PF2, state); + if (mask & 0x2) set_led(PF3, state); + if (mask & 0x4) set_led(PF4, state); +} + +void __led_init(led_id_t mask, int state) +{ + bfin_write_FIO_INEN(bfin_read_FIO_INEN() & ~(PF2 | PF3 | PF4)); + bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4)); +} + +void __led_set(led_id_t mask, int state) +{ + set_leds(mask, state); +} + +void __led_toggle(led_id_t mask) +{ + set_leds(mask, STATUS_LED_BLINKING); +} + +#endif + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif