2 * CF IDE addon card code
4 * Enter bugs at http://blackfin.uclinux.org/
6 * Copyright (c) 2005-2009 Analog Devices Inc.
8 * Licensed under the GPL-2 or later.
13 #include <asm/blackfin.h>
15 void cf_outb(unsigned char val, volatile unsigned char *addr)
17 /* "ETHERNET" means the expansion memory banks */
26 unsigned char cf_inb(volatile unsigned char *addr)
40 void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
46 for (i = 0; i < words; i++) {
47 *(sect_buf + i) = *addr;
54 void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
60 for (i = 0; i < words; i++) {
61 *addr = *(sect_buf + i);
68 /* Definitions used in Compact Flash Boot support */
69 #define FIO_EDGE_CF_BITS 0x0000
70 #define FIO_POLAR_CF_BITS 0x0000
71 #define FIO_EDGE_BITS 0x1E0
72 #define FIO_POLAR_BITS 0x160
74 /* Compact flash status bits in status register */
75 #define CF_STAT_BITS 0x00000060
77 void cf_ide_init(void)
81 /* Check whether CF card is inserted */
82 bfin_write_FIO_EDGE(FIO_EDGE_CF_BITS);
83 bfin_write_FIO_POLAR(FIO_POLAR_CF_BITS);
84 for (i = 0; i < 0x300; i++)
87 cf_stat = bfin_read_FIO_FLAG_S() & CF_STAT_BITS;
89 bfin_write_FIO_EDGE(FIO_EDGE_BITS);
90 bfin_write_FIO_POLAR(FIO_POLAR_BITS);
93 for (i = 0; i < 0x3000; i++)