3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
5 * (C) Copyright 2000-2011
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 #define EIEIO __asm__ volatile ("eieio")
33 #define SYNC __asm__ volatile ("sync")
35 void ide_input_swap_data(int dev, ulong *sect_buf, int words)
38 volatile uchar *pbuf_even =
39 (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
40 volatile uchar *pbuf_odd =
41 (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
42 ushort *dbuf = (ushort *) sect_buf;
45 for (i = 0; i < 2; i++) {
46 *(((uchar *) (dbuf)) + 1) = *pbuf_even;
47 *(uchar *) dbuf = *pbuf_odd;
53 void ide_input_data(int dev, ulong *sect_buf, int words)
56 volatile uchar *pbuf_even;
57 volatile uchar *pbuf_odd;
59 pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
60 pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
61 dbuf = (uchar *) sect_buf;
78 void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts)
81 volatile uchar *pbuf_even;
82 volatile uchar *pbuf_odd;
84 pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
85 pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
86 dbuf = (uchar *) sect_buf;
95 void ide_output_data(int dev, const ulong *sect_buf, int words)
98 volatile uchar *pbuf_even;
99 volatile uchar *pbuf_odd;
101 pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
102 pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
103 dbuf = (uchar *) sect_buf;
106 *pbuf_even = *dbuf++;
110 *pbuf_even = *dbuf++;
116 void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts)
119 volatile uchar *pbuf_even;
120 volatile uchar *pbuf_odd;
122 pbuf_even = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
123 pbuf_odd = (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
124 dbuf = (uchar *) sect_buf;
127 *pbuf_even = *dbuf++;
133 void ide_led(uchar led, uchar status)
136 /* We have one PCMCIA slot and use LED H4 for the IDE Interface */
137 val = readb(BCSR_BASE + 0x04);
138 if (status) /* led on */
143 writeb(val, BCSR_BASE + 0x04);