]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/cpc45/ide.c
3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
5 * (C) Copyright 2000-2011
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 * SPDX-License-Identifier: GPL-2.0+
16 #define EIEIO __asm__ volatile ("eieio")
17 #define SYNC __asm__ volatile ("sync")
19 void ide_input_swap_data(int dev
, ulong
*sect_buf
, int words
)
22 volatile uchar
*pbuf_even
=
23 (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_EVEN
);
24 volatile uchar
*pbuf_odd
=
25 (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_ODD
);
26 ushort
*dbuf
= (ushort
*) sect_buf
;
29 for (i
= 0; i
< 2; i
++) {
30 *(((uchar
*) (dbuf
)) + 1) = *pbuf_even
;
31 *(uchar
*) dbuf
= *pbuf_odd
;
37 void ide_input_data(int dev
, ulong
*sect_buf
, int words
)
40 volatile uchar
*pbuf_even
;
41 volatile uchar
*pbuf_odd
;
43 pbuf_even
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_EVEN
);
44 pbuf_odd
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_ODD
);
45 dbuf
= (uchar
*) sect_buf
;
62 void ide_input_data_shorts(int dev
, ushort
*sect_buf
, int shorts
)
65 volatile uchar
*pbuf_even
;
66 volatile uchar
*pbuf_odd
;
68 pbuf_even
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_EVEN
);
69 pbuf_odd
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_ODD
);
70 dbuf
= (uchar
*) sect_buf
;
79 void ide_output_data(int dev
, const ulong
*sect_buf
, int words
)
82 volatile uchar
*pbuf_even
;
83 volatile uchar
*pbuf_odd
;
85 pbuf_even
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_EVEN
);
86 pbuf_odd
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_ODD
);
87 dbuf
= (uchar
*) sect_buf
;
100 void ide_output_data_shorts(int dev
, ushort
*sect_buf
, int shorts
)
103 volatile uchar
*pbuf_even
;
104 volatile uchar
*pbuf_odd
;
106 pbuf_even
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_EVEN
);
107 pbuf_odd
= (uchar
*) (ATA_CURR_BASE(dev
) + ATA_DATA_ODD
);
108 dbuf
= (uchar
*) sect_buf
;
111 *pbuf_even
= *dbuf
++;
117 void ide_led(uchar led
, uchar status
)
120 /* We have one PCMCIA slot and use LED H4 for the IDE Interface */
121 val
= readb(BCSR_BASE
+ 0x04);
122 if (status
) /* led on */
127 writeb(val
, BCSR_BASE
+ 0x04);