1 /* SPDX-License-Identifier: GPL-2.0
2  *
3  * include/asm-sh/snapgear.h
4  *
5  * Modified version of io_se.h for the snapgear-specific functions.
6  *
7  * IO functions for a SnapGear
8  */
9 
10 #ifndef _ASM_SH_IO_SNAPGEAR_H
11 #define _ASM_SH_IO_SNAPGEAR_H
12 
13 #define __IO_PREFIX	snapgear
14 #include <asm/io_generic.h>
15 
16 /*
17  * We need to remember what was written to the ioport as some bits
18  * are shared with other functions and you cannot read back what was
19  * written :-|
20  *
21  * Bit        Read                   Write
22  * -----------------------------------------------
23  * D0         DCD on ttySC1          power
24  * D1         Reset Switch           heatbeat
25  * D2         ttySC0 CTS (7100)      LAN
26  * D3         -                      WAN
27  * D4         ttySC0 DCD (7100)      CONSOLE
28  * D5         -                      ONLINE
29  * D6         -                      VPN
30  * D7         -                      DTR on ttySC1
31  * D8         -                      ttySC0 RTS (7100)
32  * D9         -                      ttySC0 DTR (7100)
33  * D10        -                      RTC SCLK
34  * D11        RTC DATA               RTC DATA
35  * D12        -                      RTS RESET
36  */
37 
38 #define SECUREEDGE_IOPORT_ADDR ((volatile short *) 0xb0000000)
39 extern unsigned short secureedge5410_ioport;
40 
41 #define SECUREEDGE_WRITE_IOPORT(val, mask) (*SECUREEDGE_IOPORT_ADDR = \
42 	 (secureedge5410_ioport = \
43 			((secureedge5410_ioport & ~(mask)) | ((val) & (mask)))))
44 #define SECUREEDGE_READ_IOPORT() \
45 	 ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817))
46 
47 #endif /* _ASM_SH_IO_SNAPGEAR_H */
48