diff options
Diffstat (limited to 'board/stamp')
-rw-r--r-- | board/stamp/config.mk | 1 | ||||
-rw-r--r-- | board/stamp/stamp.c | 233 | ||||
-rw-r--r-- | board/stamp/u-boot.lds | 1 |
3 files changed, 115 insertions, 120 deletions
diff --git a/board/stamp/config.mk b/board/stamp/config.mk index 4ec82cb..0d00730 100644 --- a/board/stamp/config.mk +++ b/board/stamp/config.mk @@ -23,4 +23,3 @@ TEXT_BASE = 0x07FC0000 PLATFORM_CPPFLAGS += -I$(TOPDIR) - diff --git a/board/stamp/stamp.c b/board/stamp/stamp.c index 8485f58..3fe0134 100644 --- a/board/stamp/stamp.c +++ b/board/stamp/stamp.c @@ -30,71 +30,71 @@ #include "stamp.h" #define STATUS_LED_OFF 0 -#define STATUS_LED_ON 1 +#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) +# define SHOW_BOOT_PROGRESS(arg) #endif -int checkboard(void) +int checkboard (void) { - printf("CPU: ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28); - printf("Board: ADI BF533 Stamp board\n"); - printf(" Support: http://blackfin.uclinux.org/\n"); - printf(" Richard Klingler <richard@uclinux.net>\n"); + printf ("CPU: ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28); + printf ("Board: ADI BF533 Stamp board\n"); + printf (" Support: http://blackfin.uclinux.org/\n"); + printf (" Richard Klingler <richard@uclinux.net>\n"); return 0; } -long int initdram(int board_type) +long int initdram (int board_type) { DECLARE_GLOBAL_DATA_PTR; #ifdef DEBUG - printf("SDRAM attributes:\n"); - printf(" tRCD:%d Cycles; tRP:%d Cycles; tRAS:%d Cycles; tWR:%d Cycles; " - "CAS Latency:%d cycles\n", (SDRAM_tRCD >> 15), (SDRAM_tRP >> 11), - (SDRAM_tRAS >> 6), ( SDRAM_tWR >> 19), (SDRAM_CL >> 2 )); - printf("SDRAM Begin: 0x%x\n", CFG_SDRAM_BASE); - printf("Bank size = %d MB\n", 128); + printf ("SDRAM attributes:\n"); + printf (" tRCD:%d Cycles; tRP:%d Cycles; tRAS:%d Cycles; tWR:%d Cycles; " + "CAS Latency:%d cycles\n", + (SDRAM_tRCD >> 15), + (SDRAM_tRP >> 11), + (SDRAM_tRAS >> 6), + (SDRAM_tWR >> 19), + (SDRAM_CL >> 2)); + printf ("SDRAM Begin: 0x%x\n", CFG_SDRAM_BASE); + printf ("Bank size = %d MB\n", 128); #endif gd->bd->bi_memstart = CFG_SDRAM_BASE; gd->bd->bi_memsize = CFG_MAX_RAM_SIZE; return (gd->bd->bi_memsize); } -void swap_to(int device_id) +void swap_to (int device_id) { - if (device_id == ETHERNET) - { + if (device_id == ETHERNET) { *pFIO_DIR = PF0; - asm("ssync;"); + asm ("ssync;"); *pFIO_FLAG_S = PF0; - asm("ssync;"); - } - else if (device_id == FLASH) - { + asm ("ssync;"); + } else if (device_id == FLASH) { *pFIO_DIR = (PF4 | PF3 | PF2 | PF1 | PF0); - *pFIO_FLAG_S = (PF4 | PF3 | PF2 ); + *pFIO_FLAG_S = (PF4 | PF3 | PF2); *pFIO_MASKA_D = (PF8 | PF6 | PF5); *pFIO_MASKB_D = (PF7); - *pFIO_POLAR = (PF8 | PF6 | PF5 ); + *pFIO_POLAR = (PF8 | PF6 | PF5); *pFIO_EDGE = (PF8 | PF7 | PF6 | PF5); *pFIO_INEN = (PF8 | PF7 | PF6 | PF5); - *pFIO_FLAG_D = (PF4 | PF3 | PF2 ); - asm("ssync;"); + *pFIO_FLAG_D = (PF4 | PF3 | PF2); + asm ("ssync;"); + } else { + printf ("Unknown bank to switch\n"); } - else { - printf("Unknown bank to switch\n"); - } - + return; } #if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */ -int misc_init_r(void) +int misc_init_r (void) { int i; int cf_stat = 0; @@ -102,40 +102,39 @@ int misc_init_r(void) /* 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) - { + for (i = 0; i < 0x300; i++) + asm ("nop;"); + + if ((*pFIO_FLAG_S) & CF_STAT_BITS) { cf_stat = 0; - } - else - { + } else { cf_stat = 1; } - *pFIO_EDGE = FIO_EDGE_BITS; + *pFIO_EDGE = FIO_EDGE_BITS; *pFIO_POLAR = FIO_POLAR_BITS; - - if (cf_stat) - { - printf ("Booting from COMPACT flash\n"); + + if (cf_stat) { + printf ("Booting from COMPACT flash\n"); /* Set cycle time for CF */ *(volatile unsigned long *) ambctl1 = CF_AMBCTL1VAL; - for (i=0; i < 0x1000 ; i++) asm("nop;"); - for (i=0; i < 0x1000 ; i++) asm("nop;"); - for (i=0; i < 0x1000 ; i++) asm("nop;"); + 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(); + serial_setbrg (); + ide_init (); setenv ("bootargs", ""); - setenv ("bootcmd", "fatload ide 0:1 0x1000000 uImage-stamp;bootm 0x1000000;bootm 0x20100000" ); - } - else - { + setenv ("bootcmd", + "fatload ide 0:1 0x1000000 uImage-stamp;bootm 0x1000000;bootm 0x20100000"); + } else { printf ("Booting from FLASH\n"); } @@ -145,134 +144,132 @@ int misc_init_r(void) #ifdef CONFIG_STAMP_CF -void cf_outb(unsigned char val, volatile unsigned char* addr) +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 + * to the expansion memory banks */ *pFIO_FLAG_S = CF_PF0; *pFIO_FLAG_C = CF_PF1; - asm("ssync;"); + asm ("ssync;"); *(addr) = val; - asm("ssync;"); + asm ("ssync;"); - /* Setback PF1 PF0 to 0 0 to address external + /* Setback PF1 PF0 to 0 0 to address external * memory banks */ *(volatile unsigned short *) pFIO_FLAG_C = CF_PF1_PF0; - asm("ssync;"); + asm ("ssync;"); } -unsigned char cf_inb(volatile unsigned char *addr) +unsigned char cf_inb (volatile unsigned char *addr) { volatile unsigned char c; *pFIO_FLAG_S = CF_PF0; *pFIO_FLAG_C = CF_PF1; - asm("ssync;"); + asm ("ssync;"); c = *(addr); - asm("ssync;"); + asm ("ssync;"); *pFIO_FLAG_C = CF_PF1_PF0; - asm("ssync;"); + asm ("ssync;"); return c; } -void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words) +void cf_insw (unsigned short *sect_buf, unsigned short *addr, int words) { int i; *pFIO_FLAG_S = CF_PF0; *pFIO_FLAG_C = CF_PF1; - asm("ssync;"); + asm ("ssync;"); - for (i = 0;i < words; i++) - { + for (i = 0; i < words; i++) { *(sect_buf + i) = *(addr); - asm("ssync;"); + asm ("ssync;"); } *pFIO_FLAG_C = CF_PF1_PF0; - asm("ssync;"); + asm ("ssync;"); } -void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words) +void cf_outsw (unsigned short *addr, unsigned short *sect_buf, int words) { int i; *pFIO_FLAG_S = CF_PF0; *pFIO_FLAG_C = CF_PF1; - asm("ssync;"); + asm ("ssync;"); - for (i = 0;i < words; i++) - { + for (i = 0; i < words; i++) { *(addr) = *(sect_buf + i); - asm("ssync;"); + asm ("ssync;"); } *pFIO_FLAG_C = CF_PF1_PF0; - asm("ssync;"); + asm ("ssync;"); } #endif -void stamp_led_set(int LED1, int LED2, int LED3) +void stamp_led_set (int LED1, int LED2, int LED3) { - *pFIO_INEN &= ~( PF2 | PF3 | PF4); - *pFIO_DIR |= ( PF2 | PF3 | PF4); - - if(LED1 == STATUS_LED_OFF) + *pFIO_INEN &= ~(PF2 | PF3 | PF4); + *pFIO_DIR |= (PF2 | PF3 | PF4); + + if (LED1 == STATUS_LED_OFF) *pFIO_FLAG_S = PF2; else *pFIO_FLAG_C = PF2; - if(LED2 == STATUS_LED_OFF) + if (LED2 == STATUS_LED_OFF) *pFIO_FLAG_S = PF3; else *pFIO_FLAG_C = PF3; - if(LED3 == STATUS_LED_OFF) + if (LED3 == STATUS_LED_OFF) *pFIO_FLAG_S = PF4; else *pFIO_FLAG_C = PF4; - asm("ssync;"); + asm ("ssync;"); } -void show_boot_progress(int status) +void show_boot_progress (int status) { - switch(status){ - case 1: - stamp_led_set(STATUS_LED_OFF,STATUS_LED_OFF,STATUS_LED_ON); - break; - case 2: - stamp_led_set(STATUS_LED_OFF,STATUS_LED_ON,STATUS_LED_OFF); - break; - case 3: - stamp_led_set(STATUS_LED_OFF,STATUS_LED_ON,STATUS_LED_ON); - break; - case 4: - stamp_led_set(STATUS_LED_ON,STATUS_LED_OFF,STATUS_LED_OFF); - break; - case 5: - case 6: - stamp_led_set(STATUS_LED_ON,STATUS_LED_OFF,STATUS_LED_ON); - break; - case 7: - case 8: - stamp_led_set(STATUS_LED_ON,STATUS_LED_ON,STATUS_LED_OFF); - break; - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - stamp_led_set(STATUS_LED_OFF,STATUS_LED_OFF,STATUS_LED_OFF); - break; - default: - stamp_led_set(STATUS_LED_ON,STATUS_LED_ON,STATUS_LED_ON); - break; + switch (status) { + case 1: + stamp_led_set (STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON); + break; + case 2: + stamp_led_set (STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF); + break; + case 3: + stamp_led_set (STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON); + break; + case 4: + stamp_led_set (STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF); + break; + case 5: + case 6: + stamp_led_set (STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON); + break; + case 7: + case 8: + stamp_led_set (STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF); + break; + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + stamp_led_set (STATUS_LED_OFF, STATUS_LED_OFF, + STATUS_LED_OFF); + break; + default: + stamp_led_set (STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON); + break; } } - diff --git a/board/stamp/u-boot.lds b/board/stamp/u-boot.lds index ad6886f..9a22e50 100644 --- a/board/stamp/u-boot.lds +++ b/board/stamp/u-boot.lds @@ -145,4 +145,3 @@ SECTIONS _end = . ; PROVIDE (end = .); } - |