2 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
3 * Based largely on io_se.c.
5 * I/O routine for Hitachi 7751 SolutionEngine.
7 * Initial version only to support LAN access; some
8 * placeholder code from io_se.c left in with the
9 * expectation of later SuperIO and PCMCIA access.
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/pci.h>
15 #include <mach-se/mach/se7751.h>
16 #include <asm/addrspace.h>
18 static inline volatile u16 *port2adr(unsigned int port)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 maybebadio((unsigned long)port);
23 return (volatile __u16*)port;
27 * General outline: remap really low stuff [eventually] to SuperIO,
28 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
29 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
30 * should be way beyond the window, and is used w/o translation for
33 unsigned char sh7751se_inb(unsigned long port)
36 return *(volatile unsigned char *)port;
38 return (*port2adr(port)) & 0xff;
41 unsigned char sh7751se_inb_p(unsigned long port)
46 v = *(volatile unsigned char *)port;
48 v = (*port2adr(port)) & 0xff;
53 unsigned short sh7751se_inw(unsigned long port)
56 return *(volatile unsigned short *)port;
57 else if (port >= 0x2000)
58 return *port2adr(port);
64 unsigned int sh7751se_inl(unsigned long port)
67 return *(volatile unsigned long *)port;
68 else if (port >= 0x2000)
69 return *port2adr(port);
75 void sh7751se_outb(unsigned char value, unsigned long port)
79 *(volatile unsigned char *)port = value;
81 *(port2adr(port)) = value;
84 void sh7751se_outb_p(unsigned char value, unsigned long port)
87 *(volatile unsigned char *)port = value;
89 *(port2adr(port)) = value;
93 void sh7751se_outw(unsigned short value, unsigned long port)
96 *(volatile unsigned short *)port = value;
97 else if (port >= 0x2000)
98 *port2adr(port) = value;
103 void sh7751se_outl(unsigned int value, unsigned long port)
106 *(volatile unsigned long *)port = value;
111 void sh7751se_insl(unsigned long port, void *addr, unsigned long count)
116 void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count)