1
2
3
4
5
6
7
8
9
10
11#include <common.h>
12#include <config.h>
13#include <command.h>
14#include <asm/blackfin.h>
15
16void cf_outb(unsigned char val, volatile unsigned char *addr)
17{
18 *(addr) = val;
19 SSYNC();
20}
21
22unsigned char cf_inb(volatile unsigned char *addr)
23{
24 volatile unsigned char c;
25
26 c = *(addr);
27 SSYNC();
28
29 return c;
30}
31
32void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
33{
34 int i;
35
36 for (i = 0; i < words; i++)
37 *(sect_buf + i) = *(addr);
38 SSYNC();
39}
40
41void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
42{
43 int i;
44
45 for (i = 0; i < words; i++)
46 *(addr) = *(sect_buf + i);
47 SSYNC();
48}
49
50void cf_ide_init(void)
51{
52#if defined(CONFIG_BFIN_TRUE_IDE)
53
54 printf("Using CF True IDE Mode\n");
55 cf_outb(0, (unsigned char *)CONFIG_CF_ATASEL_ENA);
56 udelay(1000);
57#elif defined(CONFIG_BFIN_CF_IDE)
58
59 printf("Using CF Common Memory Mode\n");
60 cf_outb(0, (unsigned char *)CONFIG_CF_ATASEL_DIS);
61 udelay(1000);
62#elif defined(CONFIG_BFIN_HDD_IDE)
63 printf("Using HDD IDE Mode\n");
64#endif
65 ide_init();
66}
67