diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-11-30 13:08:39 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-01-17 09:17:27 -0500 |
commit | 5f79644d2665763d522ef2db53c026c5f4865b02 (patch) | |
tree | 4c26214ed50a4c9d98faaf18671d3a83cd2e5c0b /board/bf533-stamp/bf533-stamp.c | |
parent | e54c8209913a3f26ae28819e3515df53ec2b4548 (diff) |
Blackfin: bf533-stamp: split and cleanup CF/IDE code
Give the CF/IDE code its own file to keep things cleanly separated. While
we're here, clean up the code to use common functions.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'board/bf533-stamp/bf533-stamp.c')
-rw-r--r-- | board/bf533-stamp/bf533-stamp.c | 113 |
1 files changed, 3 insertions, 110 deletions
diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c index 7a63c527ed0..4abad08cd9d 100644 --- a/board/bf533-stamp/bf533-stamp.c +++ b/board/bf533-stamp/bf533-stamp.c @@ -62,118 +62,11 @@ 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"); - } - - return 0; -} -#endif - #ifdef CONFIG_STAMP_CF + cf_ide_init(); +#endif -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(); - } - - *pFIO_FLAG_C = CF_PF1_PF0; - SSYNC(); + return 0; } #endif |