19 #include <linux/types.h>
20 #include "../../../../drivers/pcmcia/m32r_cfc.h"
22 extern void pcc_ioread_byte(
int,
unsigned long,
void *,
size_t,
size_t,
int);
23 extern void pcc_ioread_word(
int,
unsigned long,
void *,
size_t,
size_t,
int);
24 extern void pcc_iowrite_byte(
int,
unsigned long,
void *,
size_t,
size_t,
int);
25 extern void pcc_iowrite_word(
int,
unsigned long,
void *,
size_t,
size_t,
int);
26 #define CFC_IOSTART CFC_IOPORT_BASE
27 #define CFC_IOEND (CFC_IOSTART + (M32R_PCC_MAPSIZE * M32R_MAX_PCC) - 1)
29 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
30 #define UART0_REGSTART 0x04c20000
31 #define UART1_REGSTART 0x04c20100
32 #define UART_IOMAP_SIZE 8
33 #define UART0_IOSTART 0x3f8
34 #define UART0_IOEND (UART0_IOSTART + UART_IOMAP_SIZE - 1)
35 #define UART1_IOSTART 0x2f8
36 #define UART1_IOEND (UART1_IOSTART + UART_IOMAP_SIZE - 1)
39 #define PORT2ADDR(port) _port2addr(port)
41 static inline void *_port2addr(
unsigned long port)
43 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
44 if (port >= UART0_IOSTART && port <= UART0_IOEND)
45 port = ((port - UART0_IOSTART) << 1) + UART0_REGSTART;
46 else if (port >= UART1_IOSTART && port <= UART1_IOEND)
47 port = ((port - UART1_IOSTART) << 1) + UART1_REGSTART;
52 static inline void delay(
void)
54 __asm__ __volatile__ (
"push r0; \n\t pop r0;" : : :
"memory");
64 return *(
volatile unsigned char *)
PORT2ADDR(port);
74 return *(
volatile unsigned short *)
PORT2ADDR(port);
84 return *(
volatile unsigned long *)
PORT2ADDR(port);
89 unsigned char v =
_inb(port);
96 unsigned short v =
_inw(port);
103 unsigned long v =
_inl(port);
113 *(
volatile unsigned char *)
PORT2ADDR(port) =
b;
121 *(
volatile unsigned short *)
PORT2ADDR(port) =
w;
129 *(
volatile unsigned long *)
PORT2ADDR(port) =
l;
158 *buf++ = *(
volatile unsigned char *)portp;
165 unsigned short *portp;
173 *buf++ = *(
volatile unsigned short *)portp;
180 unsigned long *portp;
184 *buf++ = *(
volatile unsigned long *)portp;
189 const unsigned char *
buf =
addr;
190 unsigned char *portp;
198 *(
volatile unsigned char *)portp = *buf++;
204 const unsigned short *
buf =
addr;
205 unsigned short *portp;
213 *(
volatile unsigned short *)portp = *buf++;
219 const unsigned long *
buf =
addr;
220 unsigned char *portp;
224 *(
volatile unsigned long *)portp = *buf++;