Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-sam440 / ata / lowlevel_sam440.c
blobd1ee7f9a1ac0262c9d26f09d5d40e9a145e9c3ca
1 #include <exec/types.h>
2 #include <asm/io.h>
3 #include <asm/amcc440.h>
5 VOID ata_insw(APTR address, UWORD port, ULONG count)
7 UWORD *addr = address;
8 UWORD *p = (UWORD*)(port + PCIC0_IO);
10 while(count)
12 *addr++ = inw(p);
13 count -= 2;
17 VOID ata_insl(APTR address, UWORD port, ULONG count)
19 if (count & 2)
20 ata_insw(address, port, count);
21 else
23 ULONG *addr = address;
24 ULONG *p = (ULONG*)(port + PCIC0_IO);
26 while(count)
28 *addr++ = inl(p);
29 count -= 4;
34 VOID ata_outsw(APTR address, UWORD port, ULONG count)
36 UWORD *addr = address;
37 UWORD *p = (UWORD*)(port + PCIC0_IO);
39 while(count)
41 outw(*addr++, p);
42 count -= 2;
46 VOID ata_outsl(APTR address, UWORD port, ULONG count)
48 if (count & 2)
49 ata_outsw(address, port, count);
50 else
52 ULONG *addr = address;
53 ULONG *p = (ULONG*)(port + PCIC0_IO);
55 while(count)
57 outl(*addr++, p);
58 count -= 4;
63 void ata_400ns(ULONG port)
65 register ULONG tick_old, tick;
67 asm volatile("mftbl %0":"=r"(tick_old));
69 do {
70 asm volatile("mftbl %0":"=r"(tick));
71 } while(tick < (tick_old + 60));