ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-m68knommu / nap.h
1 /****************************************************************************/
2
3 /*
4  *      nap.h -- Marconi/NAP support.
5  *
6  *      (C) Copyright 2001, SnapGear (www.snapgear.com) 
7  */
8
9 /****************************************************************************/
10 #ifndef nap_h
11 #define nap_h
12 /****************************************************************************/
13
14 #include <linux/config.h>
15
16 /****************************************************************************/
17 #ifdef CONFIG_MARCONINAP
18 /****************************************************************************/
19
20 #ifdef CONFIG_COLDFIRE
21 #include <asm/coldfire.h>
22 #include <asm/mcfsim.h>
23 #endif
24
25 /*
26  *      Command to support selecting RS232 or RS422 mode on the
27  *      second COM port.
28  */
29 #define TIOCSET422      0x4d01          /* Set port mode 232 or 422 */
30 #define TIOCGET422      0x4d02          /* Get current port mode */
31
32 /*
33  *      Low level control of the RS232/422 enable.
34  */
35 #define MCFPP_PA11      0x0800
36
37 #ifndef __ASSEMBLY__
38 /*
39  *      RS232/422 control is via the single PA11 line. Low is the RS422
40  *      enable, high is RS232 mode.
41  */
42 static __inline__ unsigned int mcf_getpa(void)
43 {
44         volatile unsigned short *pp;
45         pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PADAT);
46         return((unsigned int) *pp);
47 }
48
49 static __inline__ void mcf_setpa(unsigned int mask, unsigned int bits)
50 {
51         volatile unsigned short *pp;
52         unsigned long           flags;
53
54         pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PADAT);
55         save_flags(flags); cli();
56         *pp = (*pp & ~mask) | bits;
57         restore_flags(flags);
58 }
59 #endif /* __ASSEMBLY__ */
60
61 /****************************************************************************/
62
63 #if defined(CONFIG_M5272)
64 /*
65  *      Marconi/NAP based hardware. DTR/DCD lines are wired to GPB lines.
66  */
67 #define MCFPP_DCD0      0x0080
68 #define MCFPP_DCD1      0x0020
69 #define MCFPP_DTR0      0x0040
70 #define MCFPP_DTR1      0x0010
71
72 #ifndef __ASSEMBLY__
73 /*
74  *      These functions defined to give quasi generic access to the
75  *      PPIO bits used for DTR/DCD.
76  */
77 static __inline__ unsigned int mcf_getppdata(void)
78 {
79         volatile unsigned short *pp;
80         pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PBDAT);
81         return((unsigned int) *pp);
82 }
83
84 static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits)
85 {
86         volatile unsigned short *pp;
87         pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PBDAT);
88         *pp = (*pp & ~mask) | bits;
89 }
90 #endif /* __ASSEMBLY__ */
91 #endif /* CONFIG_M5272 */
92
93 /****************************************************************************/
94 #endif /* CONFIG_MARCONINAP */
95 /****************************************************************************/
96 #endif  /* nap_h */