162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *	FILE    	SA-1100.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *	Version 	1.2
662306a36Sopenharmony_ci *	Author  	Copyright (c) Marc A. Viredaz, 1998
762306a36Sopenharmony_ci *	        	DEC Western Research Laboratory, Palo Alto, CA
862306a36Sopenharmony_ci *	Date    	January 1998 (April 1997)
962306a36Sopenharmony_ci *	System  	StrongARM SA-1100
1062306a36Sopenharmony_ci *	Language	C or ARM Assembly
1162306a36Sopenharmony_ci *	Purpose 	Definition of constants related to the StrongARM
1262306a36Sopenharmony_ci *	        	SA-1100 microprocessor (Advanced RISC Machine (ARM)
1362306a36Sopenharmony_ci *	        	architecture version 4). This file is based on the
1462306a36Sopenharmony_ci *	        	StrongARM SA-1100 data sheet version 2.2.
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* Be sure that virtual mapping is defined right */
2062306a36Sopenharmony_ci#ifndef __ASM_ARCH_HARDWARE_H
2162306a36Sopenharmony_ci#error You must include hardware.h not SA-1100.h
2262306a36Sopenharmony_ci#endif
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#include "bitfield.h"
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/*
2762306a36Sopenharmony_ci * SA1100 CS line to physical address
2862306a36Sopenharmony_ci */
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define SA1100_CS0_PHYS	0x00000000
3162306a36Sopenharmony_ci#define SA1100_CS1_PHYS	0x08000000
3262306a36Sopenharmony_ci#define SA1100_CS2_PHYS	0x10000000
3362306a36Sopenharmony_ci#define SA1100_CS3_PHYS	0x18000000
3462306a36Sopenharmony_ci#define SA1100_CS4_PHYS	0x40000000
3562306a36Sopenharmony_ci#define SA1100_CS5_PHYS	0x48000000
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/*
3862306a36Sopenharmony_ci * Personal Computer Memory Card International Association (PCMCIA) sockets
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#define PCMCIAPrtSp	0x04000000	/* PCMCIA Partition Space [byte]   */
4262306a36Sopenharmony_ci#define PCMCIASp	(4*PCMCIAPrtSp)	/* PCMCIA Space [byte]             */
4362306a36Sopenharmony_ci#define PCMCIAIOSp	PCMCIAPrtSp	/* PCMCIA I/O Space [byte]         */
4462306a36Sopenharmony_ci#define PCMCIAAttrSp	PCMCIAPrtSp	/* PCMCIA Attribute Space [byte]   */
4562306a36Sopenharmony_ci#define PCMCIAMemSp	PCMCIAPrtSp	/* PCMCIA Memory Space [byte]      */
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define PCMCIA0Sp	PCMCIASp	/* PCMCIA 0 Space [byte]           */
4862306a36Sopenharmony_ci#define PCMCIA0IOSp	PCMCIAIOSp	/* PCMCIA 0 I/O Space [byte]       */
4962306a36Sopenharmony_ci#define PCMCIA0AttrSp	PCMCIAAttrSp	/* PCMCIA 0 Attribute Space [byte] */
5062306a36Sopenharmony_ci#define PCMCIA0MemSp	PCMCIAMemSp	/* PCMCIA 0 Memory Space [byte]    */
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define PCMCIA1Sp	PCMCIASp	/* PCMCIA 1 Space [byte]           */
5362306a36Sopenharmony_ci#define PCMCIA1IOSp	PCMCIAIOSp	/* PCMCIA 1 I/O Space [byte]       */
5462306a36Sopenharmony_ci#define PCMCIA1AttrSp	PCMCIAAttrSp	/* PCMCIA 1 Attribute Space [byte] */
5562306a36Sopenharmony_ci#define PCMCIA1MemSp	PCMCIAMemSp	/* PCMCIA 1 Memory Space [byte]    */
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define _PCMCIA(Nb)	        	/* PCMCIA [0..1]                   */ \
5862306a36Sopenharmony_ci                	(0x20000000 + (Nb)*PCMCIASp)
5962306a36Sopenharmony_ci#define _PCMCIAIO(Nb)	_PCMCIA (Nb)	/* PCMCIA I/O [0..1]               */
6062306a36Sopenharmony_ci#define _PCMCIAAttr(Nb)	        	/* PCMCIA Attribute [0..1]         */ \
6162306a36Sopenharmony_ci                	(_PCMCIA (Nb) + 2*PCMCIAPrtSp)
6262306a36Sopenharmony_ci#define _PCMCIAMem(Nb)	        	/* PCMCIA Memory [0..1]            */ \
6362306a36Sopenharmony_ci                	(_PCMCIA (Nb) + 3*PCMCIAPrtSp)
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define _PCMCIA0	_PCMCIA (0)	/* PCMCIA 0                        */
6662306a36Sopenharmony_ci#define _PCMCIA0IO	_PCMCIAIO (0)	/* PCMCIA 0 I/O                    */
6762306a36Sopenharmony_ci#define _PCMCIA0Attr	_PCMCIAAttr (0)	/* PCMCIA 0 Attribute              */
6862306a36Sopenharmony_ci#define _PCMCIA0Mem	_PCMCIAMem (0)	/* PCMCIA 0 Memory                 */
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define _PCMCIA1	_PCMCIA (1)	/* PCMCIA 1                        */
7162306a36Sopenharmony_ci#define _PCMCIA1IO	_PCMCIAIO (1)	/* PCMCIA 1 I/O                    */
7262306a36Sopenharmony_ci#define _PCMCIA1Attr	_PCMCIAAttr (1)	/* PCMCIA 1 Attribute              */
7362306a36Sopenharmony_ci#define _PCMCIA1Mem	_PCMCIAMem (1)	/* PCMCIA 1 Memory                 */
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci/*
7762306a36Sopenharmony_ci * Universal Serial Bus (USB) Device Controller (UDC) control registers
7862306a36Sopenharmony_ci *
7962306a36Sopenharmony_ci * Registers
8062306a36Sopenharmony_ci *    Ser0UDCCR 	Serial port 0 Universal Serial Bus (USB) Device
8162306a36Sopenharmony_ci *              	Controller (UDC) Control Register (read/write).
8262306a36Sopenharmony_ci *    Ser0UDCAR 	Serial port 0 Universal Serial Bus (USB) Device
8362306a36Sopenharmony_ci *              	Controller (UDC) Address Register (read/write).
8462306a36Sopenharmony_ci *    Ser0UDCOMP	Serial port 0 Universal Serial Bus (USB) Device
8562306a36Sopenharmony_ci *              	Controller (UDC) Output Maximum Packet size register
8662306a36Sopenharmony_ci *              	(read/write).
8762306a36Sopenharmony_ci *    Ser0UDCIMP	Serial port 0 Universal Serial Bus (USB) Device
8862306a36Sopenharmony_ci *              	Controller (UDC) Input Maximum Packet size register
8962306a36Sopenharmony_ci *              	(read/write).
9062306a36Sopenharmony_ci *    Ser0UDCCS0	Serial port 0 Universal Serial Bus (USB) Device
9162306a36Sopenharmony_ci *              	Controller (UDC) Control/Status register end-point 0
9262306a36Sopenharmony_ci *              	(read/write).
9362306a36Sopenharmony_ci *    Ser0UDCCS1	Serial port 0 Universal Serial Bus (USB) Device
9462306a36Sopenharmony_ci *              	Controller (UDC) Control/Status register end-point 1
9562306a36Sopenharmony_ci *              	(output, read/write).
9662306a36Sopenharmony_ci *    Ser0UDCCS2	Serial port 0 Universal Serial Bus (USB) Device
9762306a36Sopenharmony_ci *              	Controller (UDC) Control/Status register end-point 2
9862306a36Sopenharmony_ci *              	(input, read/write).
9962306a36Sopenharmony_ci *    Ser0UDCD0 	Serial port 0 Universal Serial Bus (USB) Device
10062306a36Sopenharmony_ci *              	Controller (UDC) Data register end-point 0
10162306a36Sopenharmony_ci *              	(read/write).
10262306a36Sopenharmony_ci *    Ser0UDCWC 	Serial port 0 Universal Serial Bus (USB) Device
10362306a36Sopenharmony_ci *              	Controller (UDC) Write Count register end-point 0
10462306a36Sopenharmony_ci *              	(read).
10562306a36Sopenharmony_ci *    Ser0UDCDR 	Serial port 0 Universal Serial Bus (USB) Device
10662306a36Sopenharmony_ci *              	Controller (UDC) Data Register (read/write).
10762306a36Sopenharmony_ci *    Ser0UDCSR 	Serial port 0 Universal Serial Bus (USB) Device
10862306a36Sopenharmony_ci *              	Controller (UDC) Status Register (read/write).
10962306a36Sopenharmony_ci */
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#define Ser0UDCCR	__REG(0x80000000)  /* Ser. port 0 UDC Control Reg. */
11262306a36Sopenharmony_ci#define Ser0UDCAR	__REG(0x80000004)  /* Ser. port 0 UDC Address Reg. */
11362306a36Sopenharmony_ci#define Ser0UDCOMP	__REG(0x80000008)  /* Ser. port 0 UDC Output Maximum Packet size reg. */
11462306a36Sopenharmony_ci#define Ser0UDCIMP	__REG(0x8000000C)  /* Ser. port 0 UDC Input Maximum Packet size reg. */
11562306a36Sopenharmony_ci#define Ser0UDCCS0	__REG(0x80000010)  /* Ser. port 0 UDC Control/Status reg. end-point 0 */
11662306a36Sopenharmony_ci#define Ser0UDCCS1	__REG(0x80000014)  /* Ser. port 0 UDC Control/Status reg. end-point 1 (output) */
11762306a36Sopenharmony_ci#define Ser0UDCCS2	__REG(0x80000018)  /* Ser. port 0 UDC Control/Status reg. end-point 2 (input) */
11862306a36Sopenharmony_ci#define Ser0UDCD0	__REG(0x8000001C)  /* Ser. port 0 UDC Data reg. end-point 0 */
11962306a36Sopenharmony_ci#define Ser0UDCWC	__REG(0x80000020)  /* Ser. port 0 UDC Write Count reg. end-point 0 */
12062306a36Sopenharmony_ci#define Ser0UDCDR	__REG(0x80000028)  /* Ser. port 0 UDC Data Reg. */
12162306a36Sopenharmony_ci#define Ser0UDCSR	__REG(0x80000030)  /* Ser. port 0 UDC Status Reg. */
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define UDCCR_UDD	0x00000001	/* UDC Disable                     */
12462306a36Sopenharmony_ci#define UDCCR_UDA	0x00000002	/* UDC Active (read)               */
12562306a36Sopenharmony_ci#define UDCCR_RESIM	0x00000004	/* Resume Interrupt Mask, per errata */
12662306a36Sopenharmony_ci#define UDCCR_EIM	0x00000008	/* End-point 0 Interrupt Mask      */
12762306a36Sopenharmony_ci                	        	/* (disable)                       */
12862306a36Sopenharmony_ci#define UDCCR_RIM	0x00000010	/* Receive Interrupt Mask          */
12962306a36Sopenharmony_ci                	        	/* (disable)                       */
13062306a36Sopenharmony_ci#define UDCCR_TIM	0x00000020	/* Transmit Interrupt Mask         */
13162306a36Sopenharmony_ci                	        	/* (disable)                       */
13262306a36Sopenharmony_ci#define UDCCR_SRM	0x00000040	/* Suspend/Resume interrupt Mask   */
13362306a36Sopenharmony_ci                	        	/* (disable)                       */
13462306a36Sopenharmony_ci#define UDCCR_SUSIM	UDCCR_SRM	/* Per errata, SRM just masks suspend */
13562306a36Sopenharmony_ci#define UDCCR_REM	0x00000080	/* REset interrupt Mask (disable)  */
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci#define UDCAR_ADD	Fld (7, 0)	/* function ADDress                */
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci#define UDCOMP_OUTMAXP	Fld (8, 0)	/* OUTput MAXimum Packet size - 1  */
14062306a36Sopenharmony_ci                	        	/* [byte]                          */
14162306a36Sopenharmony_ci#define UDCOMP_OutMaxPkt(Size)  	/* Output Maximum Packet size      */ \
14262306a36Sopenharmony_ci                	        	/* [1..256 byte]                   */ \
14362306a36Sopenharmony_ci                	(((Size) - 1) << FShft (UDCOMP_OUTMAXP))
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define UDCIMP_INMAXP	Fld (8, 0)	/* INput MAXimum Packet size - 1   */
14662306a36Sopenharmony_ci                	        	/* [byte]                          */
14762306a36Sopenharmony_ci#define UDCIMP_InMaxPkt(Size)   	/* Input Maximum Packet size       */ \
14862306a36Sopenharmony_ci                	        	/* [1..256 byte]                   */ \
14962306a36Sopenharmony_ci                	(((Size) - 1) << FShft (UDCIMP_INMAXP))
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci#define UDCCS0_OPR	0x00000001	/* Output Packet Ready (read)      */
15262306a36Sopenharmony_ci#define UDCCS0_IPR	0x00000002	/* Input Packet Ready              */
15362306a36Sopenharmony_ci#define UDCCS0_SST	0x00000004	/* Sent STall                      */
15462306a36Sopenharmony_ci#define UDCCS0_FST	0x00000008	/* Force STall                     */
15562306a36Sopenharmony_ci#define UDCCS0_DE	0x00000010	/* Data End                        */
15662306a36Sopenharmony_ci#define UDCCS0_SE	0x00000020	/* Setup End (read)                */
15762306a36Sopenharmony_ci#define UDCCS0_SO	0x00000040	/* Serviced Output packet ready    */
15862306a36Sopenharmony_ci                	        	/* (write)                         */
15962306a36Sopenharmony_ci#define UDCCS0_SSE	0x00000080	/* Serviced Setup End (write)      */
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci#define UDCCS1_RFS	0x00000001	/* Receive FIFO 12-bytes or more   */
16262306a36Sopenharmony_ci                	        	/* Service request (read)          */
16362306a36Sopenharmony_ci#define UDCCS1_RPC	0x00000002	/* Receive Packet Complete         */
16462306a36Sopenharmony_ci#define UDCCS1_RPE	0x00000004	/* Receive Packet Error (read)     */
16562306a36Sopenharmony_ci#define UDCCS1_SST	0x00000008	/* Sent STall                      */
16662306a36Sopenharmony_ci#define UDCCS1_FST	0x00000010	/* Force STall                     */
16762306a36Sopenharmony_ci#define UDCCS1_RNE	0x00000020	/* Receive FIFO Not Empty (read)   */
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci#define UDCCS2_TFS	0x00000001	/* Transmit FIFO 8-bytes or less   */
17062306a36Sopenharmony_ci                	        	/* Service request (read)          */
17162306a36Sopenharmony_ci#define UDCCS2_TPC	0x00000002	/* Transmit Packet Complete        */
17262306a36Sopenharmony_ci#define UDCCS2_TPE	0x00000004	/* Transmit Packet Error (read)    */
17362306a36Sopenharmony_ci#define UDCCS2_TUR	0x00000008	/* Transmit FIFO Under-Run         */
17462306a36Sopenharmony_ci#define UDCCS2_SST	0x00000010	/* Sent STall                      */
17562306a36Sopenharmony_ci#define UDCCS2_FST	0x00000020	/* Force STall                     */
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci#define UDCD0_DATA	Fld (8, 0)	/* receive/transmit DATA FIFOs     */
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci#define UDCWC_WC	Fld (4, 0)	/* Write Count                     */
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci#define UDCDR_DATA	Fld (8, 0)	/* receive/transmit DATA FIFOs     */
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci#define UDCSR_EIR	0x00000001	/* End-point 0 Interrupt Request   */
18462306a36Sopenharmony_ci#define UDCSR_RIR	0x00000002	/* Receive Interrupt Request       */
18562306a36Sopenharmony_ci#define UDCSR_TIR	0x00000004	/* Transmit Interrupt Request      */
18662306a36Sopenharmony_ci#define UDCSR_SUSIR	0x00000008	/* SUSpend Interrupt Request       */
18762306a36Sopenharmony_ci#define UDCSR_RESIR	0x00000010	/* RESume Interrupt Request        */
18862306a36Sopenharmony_ci#define UDCSR_RSTIR	0x00000020	/* ReSeT Interrupt Request         */
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci/*
19262306a36Sopenharmony_ci * Universal Asynchronous Receiver/Transmitter (UART) control registers
19362306a36Sopenharmony_ci *
19462306a36Sopenharmony_ci * Registers
19562306a36Sopenharmony_ci *    Ser1UTCR0 	Serial port 1 Universal Asynchronous
19662306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 0
19762306a36Sopenharmony_ci *              	(read/write).
19862306a36Sopenharmony_ci *    Ser1UTCR1 	Serial port 1 Universal Asynchronous
19962306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 1
20062306a36Sopenharmony_ci *              	(read/write).
20162306a36Sopenharmony_ci *    Ser1UTCR2 	Serial port 1 Universal Asynchronous
20262306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 2
20362306a36Sopenharmony_ci *              	(read/write).
20462306a36Sopenharmony_ci *    Ser1UTCR3 	Serial port 1 Universal Asynchronous
20562306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 3
20662306a36Sopenharmony_ci *              	(read/write).
20762306a36Sopenharmony_ci *    Ser1UTDR  	Serial port 1 Universal Asynchronous
20862306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Data Register
20962306a36Sopenharmony_ci *              	(read/write).
21062306a36Sopenharmony_ci *    Ser1UTSR0 	Serial port 1 Universal Asynchronous
21162306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Status Register 0
21262306a36Sopenharmony_ci *              	(read/write).
21362306a36Sopenharmony_ci *    Ser1UTSR1 	Serial port 1 Universal Asynchronous
21462306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Status Register 1 (read).
21562306a36Sopenharmony_ci *
21662306a36Sopenharmony_ci *    Ser2UTCR0 	Serial port 2 Universal Asynchronous
21762306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 0
21862306a36Sopenharmony_ci *              	(read/write).
21962306a36Sopenharmony_ci *    Ser2UTCR1 	Serial port 2 Universal Asynchronous
22062306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 1
22162306a36Sopenharmony_ci *              	(read/write).
22262306a36Sopenharmony_ci *    Ser2UTCR2 	Serial port 2 Universal Asynchronous
22362306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 2
22462306a36Sopenharmony_ci *              	(read/write).
22562306a36Sopenharmony_ci *    Ser2UTCR3 	Serial port 2 Universal Asynchronous
22662306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 3
22762306a36Sopenharmony_ci *              	(read/write).
22862306a36Sopenharmony_ci *    Ser2UTCR4 	Serial port 2 Universal Asynchronous
22962306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 4
23062306a36Sopenharmony_ci *              	(read/write).
23162306a36Sopenharmony_ci *    Ser2UTDR  	Serial port 2 Universal Asynchronous
23262306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Data Register
23362306a36Sopenharmony_ci *              	(read/write).
23462306a36Sopenharmony_ci *    Ser2UTSR0 	Serial port 2 Universal Asynchronous
23562306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Status Register 0
23662306a36Sopenharmony_ci *              	(read/write).
23762306a36Sopenharmony_ci *    Ser2UTSR1 	Serial port 2 Universal Asynchronous
23862306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Status Register 1 (read).
23962306a36Sopenharmony_ci *
24062306a36Sopenharmony_ci *    Ser3UTCR0 	Serial port 3 Universal Asynchronous
24162306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 0
24262306a36Sopenharmony_ci *              	(read/write).
24362306a36Sopenharmony_ci *    Ser3UTCR1 	Serial port 3 Universal Asynchronous
24462306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 1
24562306a36Sopenharmony_ci *              	(read/write).
24662306a36Sopenharmony_ci *    Ser3UTCR2 	Serial port 3 Universal Asynchronous
24762306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 2
24862306a36Sopenharmony_ci *              	(read/write).
24962306a36Sopenharmony_ci *    Ser3UTCR3 	Serial port 3 Universal Asynchronous
25062306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Control Register 3
25162306a36Sopenharmony_ci *              	(read/write).
25262306a36Sopenharmony_ci *    Ser3UTDR  	Serial port 3 Universal Asynchronous
25362306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Data Register
25462306a36Sopenharmony_ci *              	(read/write).
25562306a36Sopenharmony_ci *    Ser3UTSR0 	Serial port 3 Universal Asynchronous
25662306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Status Register 0
25762306a36Sopenharmony_ci *              	(read/write).
25862306a36Sopenharmony_ci *    Ser3UTSR1 	Serial port 3 Universal Asynchronous
25962306a36Sopenharmony_ci *              	Receiver/Transmitter (UART) Status Register 1 (read).
26062306a36Sopenharmony_ci *
26162306a36Sopenharmony_ci * Clocks
26262306a36Sopenharmony_ci *    fxtl, Txtl	Frequency, period of the system crystal (3.6864 MHz
26362306a36Sopenharmony_ci *              	or 3.5795 MHz).
26462306a36Sopenharmony_ci *    fua, Tua  	Frequency, period of the UART communication.
26562306a36Sopenharmony_ci */
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci#define _UTCR0(Nb)	__REG(0x80010000 + ((Nb) - 1)*0x00020000)  /* UART Control Reg. 0 [1..3] */
26862306a36Sopenharmony_ci#define _UTCR1(Nb)	__REG(0x80010004 + ((Nb) - 1)*0x00020000)  /* UART Control Reg. 1 [1..3] */
26962306a36Sopenharmony_ci#define _UTCR2(Nb)	__REG(0x80010008 + ((Nb) - 1)*0x00020000)  /* UART Control Reg. 2 [1..3] */
27062306a36Sopenharmony_ci#define _UTCR3(Nb)	__REG(0x8001000C + ((Nb) - 1)*0x00020000)  /* UART Control Reg. 3 [1..3] */
27162306a36Sopenharmony_ci#define _UTCR4(Nb)	__REG(0x80010010 + ((Nb) - 1)*0x00020000)  /* UART Control Reg. 4 [2] */
27262306a36Sopenharmony_ci#define _UTDR(Nb)	__REG(0x80010014 + ((Nb) - 1)*0x00020000)  /* UART Data Reg. [1..3] */
27362306a36Sopenharmony_ci#define _UTSR0(Nb)	__REG(0x8001001C + ((Nb) - 1)*0x00020000)  /* UART Status Reg. 0 [1..3] */
27462306a36Sopenharmony_ci#define _UTSR1(Nb)	__REG(0x80010020 + ((Nb) - 1)*0x00020000)  /* UART Status Reg. 1 [1..3] */
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci#define Ser1UTCR0	_UTCR0 (1)	/* Ser. port 1 UART Control Reg. 0 */
27762306a36Sopenharmony_ci#define Ser1UTCR1	_UTCR1 (1)	/* Ser. port 1 UART Control Reg. 1 */
27862306a36Sopenharmony_ci#define Ser1UTCR2	_UTCR2 (1)	/* Ser. port 1 UART Control Reg. 2 */
27962306a36Sopenharmony_ci#define Ser1UTCR3	_UTCR3 (1)	/* Ser. port 1 UART Control Reg. 3 */
28062306a36Sopenharmony_ci#define Ser1UTDR	_UTDR (1)	/* Ser. port 1 UART Data Reg.      */
28162306a36Sopenharmony_ci#define Ser1UTSR0	_UTSR0 (1)	/* Ser. port 1 UART Status Reg. 0  */
28262306a36Sopenharmony_ci#define Ser1UTSR1	_UTSR1 (1)	/* Ser. port 1 UART Status Reg. 1  */
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci#define Ser2UTCR0	_UTCR0 (2)	/* Ser. port 2 UART Control Reg. 0 */
28562306a36Sopenharmony_ci#define Ser2UTCR1	_UTCR1 (2)	/* Ser. port 2 UART Control Reg. 1 */
28662306a36Sopenharmony_ci#define Ser2UTCR2	_UTCR2 (2)	/* Ser. port 2 UART Control Reg. 2 */
28762306a36Sopenharmony_ci#define Ser2UTCR3	_UTCR3 (2)	/* Ser. port 2 UART Control Reg. 3 */
28862306a36Sopenharmony_ci#define Ser2UTCR4	_UTCR4 (2)	/* Ser. port 2 UART Control Reg. 4 */
28962306a36Sopenharmony_ci#define Ser2UTDR	_UTDR (2)	/* Ser. port 2 UART Data Reg.      */
29062306a36Sopenharmony_ci#define Ser2UTSR0	_UTSR0 (2)	/* Ser. port 2 UART Status Reg. 0  */
29162306a36Sopenharmony_ci#define Ser2UTSR1	_UTSR1 (2)	/* Ser. port 2 UART Status Reg. 1  */
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci#define Ser3UTCR0	_UTCR0 (3)	/* Ser. port 3 UART Control Reg. 0 */
29462306a36Sopenharmony_ci#define Ser3UTCR1	_UTCR1 (3)	/* Ser. port 3 UART Control Reg. 1 */
29562306a36Sopenharmony_ci#define Ser3UTCR2	_UTCR2 (3)	/* Ser. port 3 UART Control Reg. 2 */
29662306a36Sopenharmony_ci#define Ser3UTCR3	_UTCR3 (3)	/* Ser. port 3 UART Control Reg. 3 */
29762306a36Sopenharmony_ci#define Ser3UTDR	_UTDR (3)	/* Ser. port 3 UART Data Reg.      */
29862306a36Sopenharmony_ci#define Ser3UTSR0	_UTSR0 (3)	/* Ser. port 3 UART Status Reg. 0  */
29962306a36Sopenharmony_ci#define Ser3UTSR1	_UTSR1 (3)	/* Ser. port 3 UART Status Reg. 1  */
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci/* Those are still used in some places */
30262306a36Sopenharmony_ci#define _Ser1UTCR0	__PREG(Ser1UTCR0)
30362306a36Sopenharmony_ci#define _Ser2UTCR0	__PREG(Ser2UTCR0)
30462306a36Sopenharmony_ci#define _Ser3UTCR0	__PREG(Ser3UTCR0)
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ci/* Register offsets */
30762306a36Sopenharmony_ci#define UTCR0		0x00
30862306a36Sopenharmony_ci#define UTCR1		0x04
30962306a36Sopenharmony_ci#define UTCR2		0x08
31062306a36Sopenharmony_ci#define UTCR3		0x0c
31162306a36Sopenharmony_ci#define UTDR		0x14
31262306a36Sopenharmony_ci#define UTSR0		0x1c
31362306a36Sopenharmony_ci#define UTSR1		0x20
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci#define UTCR0_PE	0x00000001	/* Parity Enable                   */
31662306a36Sopenharmony_ci#define UTCR0_OES	0x00000002	/* Odd/Even parity Select          */
31762306a36Sopenharmony_ci#define UTCR0_OddPar	(UTCR0_OES*0)	/*  Odd Parity                     */
31862306a36Sopenharmony_ci#define UTCR0_EvenPar	(UTCR0_OES*1)	/*  Even Parity                    */
31962306a36Sopenharmony_ci#define UTCR0_SBS	0x00000004	/* Stop Bit Select                 */
32062306a36Sopenharmony_ci#define UTCR0_1StpBit	(UTCR0_SBS*0)	/*  1 Stop Bit per frame           */
32162306a36Sopenharmony_ci#define UTCR0_2StpBit	(UTCR0_SBS*1)	/*  2 Stop Bits per frame          */
32262306a36Sopenharmony_ci#define UTCR0_DSS	0x00000008	/* Data Size Select                */
32362306a36Sopenharmony_ci#define UTCR0_7BitData	(UTCR0_DSS*0)	/*  7-Bit Data                     */
32462306a36Sopenharmony_ci#define UTCR0_8BitData	(UTCR0_DSS*1)	/*  8-Bit Data                     */
32562306a36Sopenharmony_ci#define UTCR0_SCE	0x00000010	/* Sample Clock Enable             */
32662306a36Sopenharmony_ci                	        	/* (ser. port 1: GPIO [18],        */
32762306a36Sopenharmony_ci                	        	/* ser. port 3: GPIO [20])         */
32862306a36Sopenharmony_ci#define UTCR0_RCE	0x00000020	/* Receive Clock Edge select       */
32962306a36Sopenharmony_ci#define UTCR0_RcRsEdg	(UTCR0_RCE*0)	/*  Receive clock Rising-Edge      */
33062306a36Sopenharmony_ci#define UTCR0_RcFlEdg	(UTCR0_RCE*1)	/*  Receive clock Falling-Edge     */
33162306a36Sopenharmony_ci#define UTCR0_TCE	0x00000040	/* Transmit Clock Edge select      */
33262306a36Sopenharmony_ci#define UTCR0_TrRsEdg	(UTCR0_TCE*0)	/*  Transmit clock Rising-Edge     */
33362306a36Sopenharmony_ci#define UTCR0_TrFlEdg	(UTCR0_TCE*1)	/*  Transmit clock Falling-Edge    */
33462306a36Sopenharmony_ci#define UTCR0_Ser2IrDA	        	/* Ser. port 2 IrDA settings       */ \
33562306a36Sopenharmony_ci                	(UTCR0_1StpBit + UTCR0_8BitData)
33662306a36Sopenharmony_ci
33762306a36Sopenharmony_ci#define UTCR1_BRD	Fld (4, 0)	/* Baud Rate Divisor/16 - 1 [11:8] */
33862306a36Sopenharmony_ci#define UTCR2_BRD	Fld (8, 0)	/* Baud Rate Divisor/16 - 1  [7:0] */
33962306a36Sopenharmony_ci                	        	/* fua = fxtl/(16*(BRD[11:0] + 1)) */
34062306a36Sopenharmony_ci                	        	/* Tua = 16*(BRD [11:0] + 1)*Txtl  */
34162306a36Sopenharmony_ci#define UTCR1_BdRtDiv(Div)      	/*  Baud Rate Divisor [16..65536]  */ \
34262306a36Sopenharmony_ci                	(((Div) - 16)/16 >> FSize (UTCR2_BRD) << \
34362306a36Sopenharmony_ci                	 FShft (UTCR1_BRD))
34462306a36Sopenharmony_ci#define UTCR2_BdRtDiv(Div)      	/*  Baud Rate Divisor [16..65536]  */ \
34562306a36Sopenharmony_ci                	(((Div) - 16)/16 & FAlnMsk (UTCR2_BRD) << \
34662306a36Sopenharmony_ci                	 FShft (UTCR2_BRD))
34762306a36Sopenharmony_ci                	        	/*  fua = fxtl/(16*Floor (Div/16)) */
34862306a36Sopenharmony_ci                	        	/*  Tua = 16*Floor (Div/16)*Txtl   */
34962306a36Sopenharmony_ci#define UTCR1_CeilBdRtDiv(Div)  	/*  Ceil. of BdRtDiv [16..65536]   */ \
35062306a36Sopenharmony_ci                	(((Div) - 1)/16 >> FSize (UTCR2_BRD) << \
35162306a36Sopenharmony_ci                	 FShft (UTCR1_BRD))
35262306a36Sopenharmony_ci#define UTCR2_CeilBdRtDiv(Div)  	/*  Ceil. of BdRtDiv [16..65536]   */ \
35362306a36Sopenharmony_ci                	(((Div) - 1)/16 & FAlnMsk (UTCR2_BRD) << \
35462306a36Sopenharmony_ci                	 FShft (UTCR2_BRD))
35562306a36Sopenharmony_ci                	        	/*  fua = fxtl/(16*Ceil (Div/16))  */
35662306a36Sopenharmony_ci                	        	/*  Tua = 16*Ceil (Div/16)*Txtl    */
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ci#define UTCR3_RXE	0x00000001	/* Receive Enable                  */
35962306a36Sopenharmony_ci#define UTCR3_TXE	0x00000002	/* Transmit Enable                 */
36062306a36Sopenharmony_ci#define UTCR3_BRK	0x00000004	/* BReaK mode                      */
36162306a36Sopenharmony_ci#define UTCR3_RIE	0x00000008	/* Receive FIFO 1/3-to-2/3-full or */
36262306a36Sopenharmony_ci                	        	/* more Interrupt Enable           */
36362306a36Sopenharmony_ci#define UTCR3_TIE	0x00000010	/* Transmit FIFO 1/2-full or less  */
36462306a36Sopenharmony_ci                	        	/* Interrupt Enable                */
36562306a36Sopenharmony_ci#define UTCR3_LBM	0x00000020	/* Look-Back Mode                  */
36662306a36Sopenharmony_ci#define UTCR3_Ser2IrDA	        	/* Ser. port 2 IrDA settings (RIE, */ \
36762306a36Sopenharmony_ci                	        	/* TIE, LBM can be set or cleared) */ \
36862306a36Sopenharmony_ci                	(UTCR3_RXE + UTCR3_TXE)
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci#define UTCR4_HSE	0x00000001	/* Hewlett-Packard Serial InfraRed */
37162306a36Sopenharmony_ci                	        	/* (HP-SIR) modulation Enable      */
37262306a36Sopenharmony_ci#define UTCR4_NRZ	(UTCR4_HSE*0)	/*  Non-Return to Zero modulation  */
37362306a36Sopenharmony_ci#define UTCR4_HPSIR	(UTCR4_HSE*1)	/*  HP-SIR modulation              */
37462306a36Sopenharmony_ci#define UTCR4_LPM	0x00000002	/* Low-Power Mode                  */
37562306a36Sopenharmony_ci#define UTCR4_Z3_16Bit	(UTCR4_LPM*0)	/*  Zero pulse = 3/16 Bit time     */
37662306a36Sopenharmony_ci#define UTCR4_Z1_6us	(UTCR4_LPM*1)	/*  Zero pulse = 1.6 us            */
37762306a36Sopenharmony_ci
37862306a36Sopenharmony_ci#define UTDR_DATA	Fld (8, 0)	/* receive/transmit DATA FIFOs     */
37962306a36Sopenharmony_ci#if 0           	        	/* Hidden receive FIFO bits        */
38062306a36Sopenharmony_ci#define UTDR_PRE	0x00000100	/*  receive PaRity Error (read)    */
38162306a36Sopenharmony_ci#define UTDR_FRE	0x00000200	/*  receive FRaming Error (read)   */
38262306a36Sopenharmony_ci#define UTDR_ROR	0x00000400	/*  Receive FIFO Over-Run (read)   */
38362306a36Sopenharmony_ci#endif /* 0 */
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci#define UTSR0_TFS	0x00000001	/* Transmit FIFO 1/2-full or less  */
38662306a36Sopenharmony_ci                	        	/* Service request (read)          */
38762306a36Sopenharmony_ci#define UTSR0_RFS	0x00000002	/* Receive FIFO 1/3-to-2/3-full or */
38862306a36Sopenharmony_ci                	        	/* more Service request (read)     */
38962306a36Sopenharmony_ci#define UTSR0_RID	0x00000004	/* Receiver IDle                   */
39062306a36Sopenharmony_ci#define UTSR0_RBB	0x00000008	/* Receive Beginning of Break      */
39162306a36Sopenharmony_ci#define UTSR0_REB	0x00000010	/* Receive End of Break            */
39262306a36Sopenharmony_ci#define UTSR0_EIF	0x00000020	/* Error In FIFO (read)            */
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ci#define UTSR1_TBY	0x00000001	/* Transmitter BusY (read)         */
39562306a36Sopenharmony_ci#define UTSR1_RNE	0x00000002	/* Receive FIFO Not Empty (read)   */
39662306a36Sopenharmony_ci#define UTSR1_TNF	0x00000004	/* Transmit FIFO Not Full (read)   */
39762306a36Sopenharmony_ci#define UTSR1_PRE	0x00000008	/* receive PaRity Error (read)     */
39862306a36Sopenharmony_ci#define UTSR1_FRE	0x00000010	/* receive FRaming Error (read)    */
39962306a36Sopenharmony_ci#define UTSR1_ROR	0x00000020	/* Receive FIFO Over-Run (read)    */
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci/*
40362306a36Sopenharmony_ci * Synchronous Data Link Controller (SDLC) control registers
40462306a36Sopenharmony_ci *
40562306a36Sopenharmony_ci * Registers
40662306a36Sopenharmony_ci *    Ser1SDCR0 	Serial port 1 Synchronous Data Link Controller (SDLC)
40762306a36Sopenharmony_ci *              	Control Register 0 (read/write).
40862306a36Sopenharmony_ci *    Ser1SDCR1 	Serial port 1 Synchronous Data Link Controller (SDLC)
40962306a36Sopenharmony_ci *              	Control Register 1 (read/write).
41062306a36Sopenharmony_ci *    Ser1SDCR2 	Serial port 1 Synchronous Data Link Controller (SDLC)
41162306a36Sopenharmony_ci *              	Control Register 2 (read/write).
41262306a36Sopenharmony_ci *    Ser1SDCR3 	Serial port 1 Synchronous Data Link Controller (SDLC)
41362306a36Sopenharmony_ci *              	Control Register 3 (read/write).
41462306a36Sopenharmony_ci *    Ser1SDCR4 	Serial port 1 Synchronous Data Link Controller (SDLC)
41562306a36Sopenharmony_ci *              	Control Register 4 (read/write).
41662306a36Sopenharmony_ci *    Ser1SDDR  	Serial port 1 Synchronous Data Link Controller (SDLC)
41762306a36Sopenharmony_ci *              	Data Register (read/write).
41862306a36Sopenharmony_ci *    Ser1SDSR0 	Serial port 1 Synchronous Data Link Controller (SDLC)
41962306a36Sopenharmony_ci *              	Status Register 0 (read/write).
42062306a36Sopenharmony_ci *    Ser1SDSR1 	Serial port 1 Synchronous Data Link Controller (SDLC)
42162306a36Sopenharmony_ci *              	Status Register 1 (read/write).
42262306a36Sopenharmony_ci *
42362306a36Sopenharmony_ci * Clocks
42462306a36Sopenharmony_ci *    fxtl, Txtl	Frequency, period of the system crystal (3.6864 MHz
42562306a36Sopenharmony_ci *              	or 3.5795 MHz).
42662306a36Sopenharmony_ci *    fsd, Tsd  	Frequency, period of the SDLC communication.
42762306a36Sopenharmony_ci */
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci#define Ser1SDCR0	__REG(0x80020060)  /* Ser. port 1 SDLC Control Reg. 0 */
43062306a36Sopenharmony_ci#define Ser1SDCR1	__REG(0x80020064)  /* Ser. port 1 SDLC Control Reg. 1 */
43162306a36Sopenharmony_ci#define Ser1SDCR2	__REG(0x80020068)  /* Ser. port 1 SDLC Control Reg. 2 */
43262306a36Sopenharmony_ci#define Ser1SDCR3	__REG(0x8002006C)  /* Ser. port 1 SDLC Control Reg. 3 */
43362306a36Sopenharmony_ci#define Ser1SDCR4	__REG(0x80020070)  /* Ser. port 1 SDLC Control Reg. 4 */
43462306a36Sopenharmony_ci#define Ser1SDDR	__REG(0x80020078)  /* Ser. port 1 SDLC Data Reg.      */
43562306a36Sopenharmony_ci#define Ser1SDSR0	__REG(0x80020080)  /* Ser. port 1 SDLC Status Reg. 0  */
43662306a36Sopenharmony_ci#define Ser1SDSR1	__REG(0x80020084)  /* Ser. port 1 SDLC Status Reg. 1  */
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci#define SDCR0_SUS	0x00000001	/* SDLC/UART Select                */
43962306a36Sopenharmony_ci#define SDCR0_SDLC	(SDCR0_SUS*0)	/*  SDLC mode (TXD1 & RXD1)        */
44062306a36Sopenharmony_ci#define SDCR0_UART	(SDCR0_SUS*1)	/*  UART mode (TXD1 & RXD1)        */
44162306a36Sopenharmony_ci#define SDCR0_SDF	0x00000002	/* Single/Double start Flag select */
44262306a36Sopenharmony_ci#define SDCR0_SglFlg	(SDCR0_SDF*0)	/*  Single start Flag              */
44362306a36Sopenharmony_ci#define SDCR0_DblFlg	(SDCR0_SDF*1)	/*  Double start Flag              */
44462306a36Sopenharmony_ci#define SDCR0_LBM	0x00000004	/* Look-Back Mode                  */
44562306a36Sopenharmony_ci#define SDCR0_BMS	0x00000008	/* Bit Modulation Select           */
44662306a36Sopenharmony_ci#define SDCR0_FM0	(SDCR0_BMS*0)	/*  Freq. Modulation zero (0)      */
44762306a36Sopenharmony_ci#define SDCR0_NRZ	(SDCR0_BMS*1)	/*  Non-Return to Zero modulation  */
44862306a36Sopenharmony_ci#define SDCR0_SCE	0x00000010	/* Sample Clock Enable (GPIO [16]) */
44962306a36Sopenharmony_ci#define SDCR0_SCD	0x00000020	/* Sample Clock Direction select   */
45062306a36Sopenharmony_ci                	        	/* (GPIO [16])                     */
45162306a36Sopenharmony_ci#define SDCR0_SClkIn	(SDCR0_SCD*0)	/*  Sample Clock Input             */
45262306a36Sopenharmony_ci#define SDCR0_SClkOut	(SDCR0_SCD*1)	/*  Sample Clock Output            */
45362306a36Sopenharmony_ci#define SDCR0_RCE	0x00000040	/* Receive Clock Edge select       */
45462306a36Sopenharmony_ci#define SDCR0_RcRsEdg	(SDCR0_RCE*0)	/*  Receive clock Rising-Edge      */
45562306a36Sopenharmony_ci#define SDCR0_RcFlEdg	(SDCR0_RCE*1)	/*  Receive clock Falling-Edge     */
45662306a36Sopenharmony_ci#define SDCR0_TCE	0x00000080	/* Transmit Clock Edge select      */
45762306a36Sopenharmony_ci#define SDCR0_TrRsEdg	(SDCR0_TCE*0)	/*  Transmit clock Rising-Edge     */
45862306a36Sopenharmony_ci#define SDCR0_TrFlEdg	(SDCR0_TCE*1)	/*  Transmit clock Falling-Edge    */
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci#define SDCR1_AAF	0x00000001	/* Abort After Frame enable        */
46162306a36Sopenharmony_ci                	        	/* (GPIO [17])                     */
46262306a36Sopenharmony_ci#define SDCR1_TXE	0x00000002	/* Transmit Enable                 */
46362306a36Sopenharmony_ci#define SDCR1_RXE	0x00000004	/* Receive Enable                  */
46462306a36Sopenharmony_ci#define SDCR1_RIE	0x00000008	/* Receive FIFO 1/3-to-2/3-full or */
46562306a36Sopenharmony_ci                	        	/* more Interrupt Enable           */
46662306a36Sopenharmony_ci#define SDCR1_TIE	0x00000010	/* Transmit FIFO 1/2-full or less  */
46762306a36Sopenharmony_ci                	        	/* Interrupt Enable                */
46862306a36Sopenharmony_ci#define SDCR1_AME	0x00000020	/* Address Match Enable            */
46962306a36Sopenharmony_ci#define SDCR1_TUS	0x00000040	/* Transmit FIFO Under-run Select  */
47062306a36Sopenharmony_ci#define SDCR1_EFrmURn	(SDCR1_TUS*0)	/*  End Frame on Under-Run         */
47162306a36Sopenharmony_ci#define SDCR1_AbortURn	(SDCR1_TUS*1)	/*  Abort on Under-Run             */
47262306a36Sopenharmony_ci#define SDCR1_RAE	0x00000080	/* Receive Abort interrupt Enable  */
47362306a36Sopenharmony_ci
47462306a36Sopenharmony_ci#define SDCR2_AMV	Fld (8, 0)	/* Address Match Value             */
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci#define SDCR3_BRD	Fld (4, 0)	/* Baud Rate Divisor/16 - 1 [11:8] */
47762306a36Sopenharmony_ci#define SDCR4_BRD	Fld (8, 0)	/* Baud Rate Divisor/16 - 1  [7:0] */
47862306a36Sopenharmony_ci                	        	/* fsd = fxtl/(16*(BRD[11:0] + 1)) */
47962306a36Sopenharmony_ci                	        	/* Tsd = 16*(BRD[11:0] + 1)*Txtl   */
48062306a36Sopenharmony_ci#define SDCR3_BdRtDiv(Div)      	/*  Baud Rate Divisor [16..65536]  */ \
48162306a36Sopenharmony_ci                	(((Div) - 16)/16 >> FSize (SDCR4_BRD) << \
48262306a36Sopenharmony_ci                	 FShft (SDCR3_BRD))
48362306a36Sopenharmony_ci#define SDCR4_BdRtDiv(Div)      	/*  Baud Rate Divisor [16..65536]  */ \
48462306a36Sopenharmony_ci                	(((Div) - 16)/16 & FAlnMsk (SDCR4_BRD) << \
48562306a36Sopenharmony_ci                	 FShft (SDCR4_BRD))
48662306a36Sopenharmony_ci                	        	/*  fsd = fxtl/(16*Floor (Div/16)) */
48762306a36Sopenharmony_ci                	        	/*  Tsd = 16*Floor (Div/16)*Txtl   */
48862306a36Sopenharmony_ci#define SDCR3_CeilBdRtDiv(Div)  	/*  Ceil. of BdRtDiv [16..65536]   */ \
48962306a36Sopenharmony_ci                	(((Div) - 1)/16 >> FSize (SDCR4_BRD) << \
49062306a36Sopenharmony_ci                	 FShft (SDCR3_BRD))
49162306a36Sopenharmony_ci#define SDCR4_CeilBdRtDiv(Div)  	/*  Ceil. of BdRtDiv [16..65536]   */ \
49262306a36Sopenharmony_ci                	(((Div) - 1)/16 & FAlnMsk (SDCR4_BRD) << \
49362306a36Sopenharmony_ci                	 FShft (SDCR4_BRD))
49462306a36Sopenharmony_ci                	        	/*  fsd = fxtl/(16*Ceil (Div/16))  */
49562306a36Sopenharmony_ci                	        	/*  Tsd = 16*Ceil (Div/16)*Txtl    */
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci#define SDDR_DATA	Fld (8, 0)	/* receive/transmit DATA FIFOs     */
49862306a36Sopenharmony_ci#if 0           	        	/* Hidden receive FIFO bits        */
49962306a36Sopenharmony_ci#define SDDR_EOF	0x00000100	/*  receive End-Of-Frame (read)    */
50062306a36Sopenharmony_ci#define SDDR_CRE	0x00000200	/*  receive CRC Error (read)       */
50162306a36Sopenharmony_ci#define SDDR_ROR	0x00000400	/*  Receive FIFO Over-Run (read)   */
50262306a36Sopenharmony_ci#endif /* 0 */
50362306a36Sopenharmony_ci
50462306a36Sopenharmony_ci#define SDSR0_EIF	0x00000001	/* Error In FIFO (read)            */
50562306a36Sopenharmony_ci#define SDSR0_TUR	0x00000002	/* Transmit FIFO Under-Run         */
50662306a36Sopenharmony_ci#define SDSR0_RAB	0x00000004	/* Receive ABort                   */
50762306a36Sopenharmony_ci#define SDSR0_TFS	0x00000008	/* Transmit FIFO 1/2-full or less  */
50862306a36Sopenharmony_ci                	        	/* Service request (read)          */
50962306a36Sopenharmony_ci#define SDSR0_RFS	0x00000010	/* Receive FIFO 1/3-to-2/3-full or */
51062306a36Sopenharmony_ci                	        	/* more Service request (read)     */
51162306a36Sopenharmony_ci
51262306a36Sopenharmony_ci#define SDSR1_RSY	0x00000001	/* Receiver SYnchronized (read)    */
51362306a36Sopenharmony_ci#define SDSR1_TBY	0x00000002	/* Transmitter BusY (read)         */
51462306a36Sopenharmony_ci#define SDSR1_RNE	0x00000004	/* Receive FIFO Not Empty (read)   */
51562306a36Sopenharmony_ci#define SDSR1_TNF	0x00000008	/* Transmit FIFO Not Full (read)   */
51662306a36Sopenharmony_ci#define SDSR1_RTD	0x00000010	/* Receive Transition Detected     */
51762306a36Sopenharmony_ci#define SDSR1_EOF	0x00000020	/* receive End-Of-Frame (read)     */
51862306a36Sopenharmony_ci#define SDSR1_CRE	0x00000040	/* receive CRC Error (read)        */
51962306a36Sopenharmony_ci#define SDSR1_ROR	0x00000080	/* Receive FIFO Over-Run (read)    */
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_ci
52262306a36Sopenharmony_ci/*
52362306a36Sopenharmony_ci * High-Speed Serial to Parallel controller (HSSP) control registers
52462306a36Sopenharmony_ci *
52562306a36Sopenharmony_ci * Registers
52662306a36Sopenharmony_ci *    Ser2HSCR0 	Serial port 2 High-Speed Serial to Parallel
52762306a36Sopenharmony_ci *              	controller (HSSP) Control Register 0 (read/write).
52862306a36Sopenharmony_ci *    Ser2HSCR1 	Serial port 2 High-Speed Serial to Parallel
52962306a36Sopenharmony_ci *              	controller (HSSP) Control Register 1 (read/write).
53062306a36Sopenharmony_ci *    Ser2HSDR  	Serial port 2 High-Speed Serial to Parallel
53162306a36Sopenharmony_ci *              	controller (HSSP) Data Register (read/write).
53262306a36Sopenharmony_ci *    Ser2HSSR0 	Serial port 2 High-Speed Serial to Parallel
53362306a36Sopenharmony_ci *              	controller (HSSP) Status Register 0 (read/write).
53462306a36Sopenharmony_ci *    Ser2HSSR1 	Serial port 2 High-Speed Serial to Parallel
53562306a36Sopenharmony_ci *              	controller (HSSP) Status Register 1 (read).
53662306a36Sopenharmony_ci *    Ser2HSCR2 	Serial port 2 High-Speed Serial to Parallel
53762306a36Sopenharmony_ci *              	controller (HSSP) Control Register 2 (read/write).
53862306a36Sopenharmony_ci *              	[The HSCR2 register is only implemented in
53962306a36Sopenharmony_ci *              	versions 2.0 (rev. = 8) and higher of the StrongARM
54062306a36Sopenharmony_ci *              	SA-1100.]
54162306a36Sopenharmony_ci */
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci#define Ser2HSCR0	__REG(0x80040060)  /* Ser. port 2 HSSP Control Reg. 0 */
54462306a36Sopenharmony_ci#define Ser2HSCR1	__REG(0x80040064)  /* Ser. port 2 HSSP Control Reg. 1 */
54562306a36Sopenharmony_ci#define Ser2HSDR	__REG(0x8004006C)  /* Ser. port 2 HSSP Data Reg.      */
54662306a36Sopenharmony_ci#define Ser2HSSR0	__REG(0x80040074)  /* Ser. port 2 HSSP Status Reg. 0  */
54762306a36Sopenharmony_ci#define Ser2HSSR1	__REG(0x80040078)  /* Ser. port 2 HSSP Status Reg. 1  */
54862306a36Sopenharmony_ci#define Ser2HSCR2	__REG(0x90060028)  /* Ser. port 2 HSSP Control Reg. 2 */
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ci#define HSCR0_ITR	0x00000001	/* IrDA Transmission Rate          */
55162306a36Sopenharmony_ci#define HSCR0_UART	(HSCR0_ITR*0)	/*  UART mode (115.2 kb/s if IrDA) */
55262306a36Sopenharmony_ci#define HSCR0_HSSP	(HSCR0_ITR*1)	/*  HSSP mode (4 Mb/s)             */
55362306a36Sopenharmony_ci#define HSCR0_LBM	0x00000002	/* Look-Back Mode                  */
55462306a36Sopenharmony_ci#define HSCR0_TUS	0x00000004	/* Transmit FIFO Under-run Select  */
55562306a36Sopenharmony_ci#define HSCR0_EFrmURn	(HSCR0_TUS*0)	/*  End Frame on Under-Run         */
55662306a36Sopenharmony_ci#define HSCR0_AbortURn	(HSCR0_TUS*1)	/*  Abort on Under-Run             */
55762306a36Sopenharmony_ci#define HSCR0_TXE	0x00000008	/* Transmit Enable                 */
55862306a36Sopenharmony_ci#define HSCR0_RXE	0x00000010	/* Receive Enable                  */
55962306a36Sopenharmony_ci#define HSCR0_RIE	0x00000020	/* Receive FIFO 2/5-to-3/5-full or */
56062306a36Sopenharmony_ci                	        	/* more Interrupt Enable           */
56162306a36Sopenharmony_ci#define HSCR0_TIE	0x00000040	/* Transmit FIFO 1/2-full or less  */
56262306a36Sopenharmony_ci                	        	/* Interrupt Enable                */
56362306a36Sopenharmony_ci#define HSCR0_AME	0x00000080	/* Address Match Enable            */
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_ci#define HSCR1_AMV	Fld (8, 0)	/* Address Match Value             */
56662306a36Sopenharmony_ci
56762306a36Sopenharmony_ci#define HSDR_DATA	Fld (8, 0)	/* receive/transmit DATA FIFOs     */
56862306a36Sopenharmony_ci#if 0           	        	/* Hidden receive FIFO bits        */
56962306a36Sopenharmony_ci#define HSDR_EOF	0x00000100	/*  receive End-Of-Frame (read)    */
57062306a36Sopenharmony_ci#define HSDR_CRE	0x00000200	/*  receive CRC Error (read)       */
57162306a36Sopenharmony_ci#define HSDR_ROR	0x00000400	/*  Receive FIFO Over-Run (read)   */
57262306a36Sopenharmony_ci#endif /* 0 */
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ci#define HSSR0_EIF	0x00000001	/* Error In FIFO (read)            */
57562306a36Sopenharmony_ci#define HSSR0_TUR	0x00000002	/* Transmit FIFO Under-Run         */
57662306a36Sopenharmony_ci#define HSSR0_RAB	0x00000004	/* Receive ABort                   */
57762306a36Sopenharmony_ci#define HSSR0_TFS	0x00000008	/* Transmit FIFO 1/2-full or less  */
57862306a36Sopenharmony_ci                	        	/* Service request (read)          */
57962306a36Sopenharmony_ci#define HSSR0_RFS	0x00000010	/* Receive FIFO 2/5-to-3/5-full or */
58062306a36Sopenharmony_ci                	        	/* more Service request (read)     */
58162306a36Sopenharmony_ci#define HSSR0_FRE	0x00000020	/* receive FRaming Error           */
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci#define HSSR1_RSY	0x00000001	/* Receiver SYnchronized (read)    */
58462306a36Sopenharmony_ci#define HSSR1_TBY	0x00000002	/* Transmitter BusY (read)         */
58562306a36Sopenharmony_ci#define HSSR1_RNE	0x00000004	/* Receive FIFO Not Empty (read)   */
58662306a36Sopenharmony_ci#define HSSR1_TNF	0x00000008	/* Transmit FIFO Not Full (read)   */
58762306a36Sopenharmony_ci#define HSSR1_EOF	0x00000010	/* receive End-Of-Frame (read)     */
58862306a36Sopenharmony_ci#define HSSR1_CRE	0x00000020	/* receive CRC Error (read)        */
58962306a36Sopenharmony_ci#define HSSR1_ROR	0x00000040	/* Receive FIFO Over-Run (read)    */
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci#define HSCR2_TXP	0x00040000	/* Transmit data Polarity (TXD_2)  */
59262306a36Sopenharmony_ci#define HSCR2_TrDataL	(HSCR2_TXP*0)	/*  Transmit Data active Low       */
59362306a36Sopenharmony_ci                	        	/*  (inverted)                     */
59462306a36Sopenharmony_ci#define HSCR2_TrDataH	(HSCR2_TXP*1)	/*  Transmit Data active High      */
59562306a36Sopenharmony_ci                	        	/*  (non-inverted)                 */
59662306a36Sopenharmony_ci#define HSCR2_RXP	0x00080000	/* Receive data Polarity (RXD_2)   */
59762306a36Sopenharmony_ci#define HSCR2_RcDataL	(HSCR2_RXP*0)	/*  Receive Data active Low        */
59862306a36Sopenharmony_ci                	        	/*  (inverted)                     */
59962306a36Sopenharmony_ci#define HSCR2_RcDataH	(HSCR2_RXP*1)	/*  Receive Data active High       */
60062306a36Sopenharmony_ci                	        	/*  (non-inverted)                 */
60162306a36Sopenharmony_ci
60262306a36Sopenharmony_ci
60362306a36Sopenharmony_ci/*
60462306a36Sopenharmony_ci * Multi-media Communications Port (MCP) control registers
60562306a36Sopenharmony_ci *
60662306a36Sopenharmony_ci * Registers
60762306a36Sopenharmony_ci *    Ser4MCCR0 	Serial port 4 Multi-media Communications Port (MCP)
60862306a36Sopenharmony_ci *              	Control Register 0 (read/write).
60962306a36Sopenharmony_ci *    Ser4MCDR0 	Serial port 4 Multi-media Communications Port (MCP)
61062306a36Sopenharmony_ci *              	Data Register 0 (audio, read/write).
61162306a36Sopenharmony_ci *    Ser4MCDR1 	Serial port 4 Multi-media Communications Port (MCP)
61262306a36Sopenharmony_ci *              	Data Register 1 (telecom, read/write).
61362306a36Sopenharmony_ci *    Ser4MCDR2 	Serial port 4 Multi-media Communications Port (MCP)
61462306a36Sopenharmony_ci *              	Data Register 2 (CODEC registers, read/write).
61562306a36Sopenharmony_ci *    Ser4MCSR  	Serial port 4 Multi-media Communications Port (MCP)
61662306a36Sopenharmony_ci *              	Status Register (read/write).
61762306a36Sopenharmony_ci *    Ser4MCCR1 	Serial port 4 Multi-media Communications Port (MCP)
61862306a36Sopenharmony_ci *              	Control Register 1 (read/write).
61962306a36Sopenharmony_ci *              	[The MCCR1 register is only implemented in
62062306a36Sopenharmony_ci *              	versions 2.0 (rev. = 8) and higher of the StrongARM
62162306a36Sopenharmony_ci *              	SA-1100.]
62262306a36Sopenharmony_ci *
62362306a36Sopenharmony_ci * Clocks
62462306a36Sopenharmony_ci *    fmc, Tmc  	Frequency, period of the MCP communication (10 MHz,
62562306a36Sopenharmony_ci *              	12 MHz, or GPIO [21]).
62662306a36Sopenharmony_ci *    faud, Taud	Frequency, period of the audio sampling.
62762306a36Sopenharmony_ci *    ftcm, Ttcm	Frequency, period of the telecom sampling.
62862306a36Sopenharmony_ci */
62962306a36Sopenharmony_ci
63062306a36Sopenharmony_ci#define Ser4MCCR0	__REG(0x80060000)  /* Ser. port 4 MCP Control Reg. 0 */
63162306a36Sopenharmony_ci#define Ser4MCDR0	__REG(0x80060008)  /* Ser. port 4 MCP Data Reg. 0 (audio) */
63262306a36Sopenharmony_ci#define Ser4MCDR1	__REG(0x8006000C)  /* Ser. port 4 MCP Data Reg. 1 (telecom) */
63362306a36Sopenharmony_ci#define Ser4MCDR2	__REG(0x80060010)  /* Ser. port 4 MCP Data Reg. 2 (CODEC reg.) */
63462306a36Sopenharmony_ci#define Ser4MCSR	__REG(0x80060018)  /* Ser. port 4 MCP Status Reg. */
63562306a36Sopenharmony_ci#define Ser4MCCR1	__REG(0x90060030)  /* Ser. port 4 MCP Control Reg. 1 */
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_ci#define MCCR0_ASD	Fld (7, 0)	/* Audio Sampling rate Divisor/32  */
63862306a36Sopenharmony_ci                	        	/* [6..127]                        */
63962306a36Sopenharmony_ci                	        	/* faud = fmc/(32*ASD)             */
64062306a36Sopenharmony_ci                	        	/* Taud = 32*ASD*Tmc               */
64162306a36Sopenharmony_ci#define MCCR0_AudSmpDiv(Div)    	/*  Audio Sampling rate Divisor    */ \
64262306a36Sopenharmony_ci                	        	/*  [192..4064]                    */ \
64362306a36Sopenharmony_ci                	((Div)/32 << FShft (MCCR0_ASD))
64462306a36Sopenharmony_ci                	        	/*  faud = fmc/(32*Floor (Div/32)) */
64562306a36Sopenharmony_ci                	        	/*  Taud = 32*Floor (Div/32)*Tmc   */
64662306a36Sopenharmony_ci#define MCCR0_CeilAudSmpDiv(Div)	/*  Ceil. of AudSmpDiv [192..4064] */ \
64762306a36Sopenharmony_ci                	(((Div) + 31)/32 << FShft (MCCR0_ASD))
64862306a36Sopenharmony_ci                	        	/*  faud = fmc/(32*Ceil (Div/32))  */
64962306a36Sopenharmony_ci                	        	/*  Taud = 32*Ceil (Div/32)*Tmc    */
65062306a36Sopenharmony_ci#define MCCR0_TSD	Fld (7, 8)	/* Telecom Sampling rate           */
65162306a36Sopenharmony_ci                	        	/* Divisor/32 [16..127]            */
65262306a36Sopenharmony_ci                	        	/* ftcm = fmc/(32*TSD)             */
65362306a36Sopenharmony_ci                	        	/* Ttcm = 32*TSD*Tmc               */
65462306a36Sopenharmony_ci#define MCCR0_TcmSmpDiv(Div)    	/*  Telecom Sampling rate Divisor  */ \
65562306a36Sopenharmony_ci                	        	/*  [512..4064]                    */ \
65662306a36Sopenharmony_ci                	((Div)/32 << FShft (MCCR0_TSD))
65762306a36Sopenharmony_ci                	        	/*  ftcm = fmc/(32*Floor (Div/32)) */
65862306a36Sopenharmony_ci                	        	/*  Ttcm = 32*Floor (Div/32)*Tmc   */
65962306a36Sopenharmony_ci#define MCCR0_CeilTcmSmpDiv(Div)	/*  Ceil. of TcmSmpDiv [512..4064] */ \
66062306a36Sopenharmony_ci                	(((Div) + 31)/32 << FShft (MCCR0_TSD))
66162306a36Sopenharmony_ci                	        	/*  ftcm = fmc/(32*Ceil (Div/32))  */
66262306a36Sopenharmony_ci                	        	/*  Ttcm = 32*Ceil (Div/32)*Tmc    */
66362306a36Sopenharmony_ci#define MCCR0_MCE	0x00010000	/* MCP Enable                      */
66462306a36Sopenharmony_ci#define MCCR0_ECS	0x00020000	/* External Clock Select           */
66562306a36Sopenharmony_ci#define MCCR0_IntClk	(MCCR0_ECS*0)	/*  Internal Clock (10 or 12 MHz)  */
66662306a36Sopenharmony_ci#define MCCR0_ExtClk	(MCCR0_ECS*1)	/*  External Clock (GPIO [21])     */
66762306a36Sopenharmony_ci#define MCCR0_ADM	0x00040000	/* A/D (audio/telecom) data        */
66862306a36Sopenharmony_ci                	        	/* sampling/storing Mode           */
66962306a36Sopenharmony_ci#define MCCR0_VldBit	(MCCR0_ADM*0)	/*  Valid Bit storing mode         */
67062306a36Sopenharmony_ci#define MCCR0_SmpCnt	(MCCR0_ADM*1)	/*  Sampling Counter storing mode  */
67162306a36Sopenharmony_ci#define MCCR0_TTE	0x00080000	/* Telecom Transmit FIFO 1/2-full  */
67262306a36Sopenharmony_ci                	        	/* or less interrupt Enable        */
67362306a36Sopenharmony_ci#define MCCR0_TRE	0x00100000	/* Telecom Receive FIFO 1/2-full   */
67462306a36Sopenharmony_ci                	        	/* or more interrupt Enable        */
67562306a36Sopenharmony_ci#define MCCR0_ATE	0x00200000	/* Audio Transmit FIFO 1/2-full    */
67662306a36Sopenharmony_ci                	        	/* or less interrupt Enable        */
67762306a36Sopenharmony_ci#define MCCR0_ARE	0x00400000	/* Audio Receive FIFO 1/2-full or  */
67862306a36Sopenharmony_ci                	        	/* more interrupt Enable           */
67962306a36Sopenharmony_ci#define MCCR0_LBM	0x00800000	/* Look-Back Mode                  */
68062306a36Sopenharmony_ci#define MCCR0_ECP	Fld (2, 24)	/* External Clock Prescaler - 1    */
68162306a36Sopenharmony_ci#define MCCR0_ExtClkDiv(Div)    	/*  External Clock Divisor [1..4]  */ \
68262306a36Sopenharmony_ci                	(((Div) - 1) << FShft (MCCR0_ECP))
68362306a36Sopenharmony_ci
68462306a36Sopenharmony_ci#define MCDR0_DATA	Fld (12, 4)	/* receive/transmit audio DATA     */
68562306a36Sopenharmony_ci                	        	/* FIFOs                           */
68662306a36Sopenharmony_ci
68762306a36Sopenharmony_ci#define MCDR1_DATA	Fld (14, 2)	/* receive/transmit telecom DATA   */
68862306a36Sopenharmony_ci                	        	/* FIFOs                           */
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci                	        	/* receive/transmit CODEC reg.     */
69162306a36Sopenharmony_ci                	        	/* FIFOs:                          */
69262306a36Sopenharmony_ci#define MCDR2_DATA	Fld (16, 0)	/*  reg. DATA                      */
69362306a36Sopenharmony_ci#define MCDR2_RW	0x00010000	/*  reg. Read/Write (transmit)     */
69462306a36Sopenharmony_ci#define MCDR2_Rd	(MCDR2_RW*0)	/*   reg. Read                     */
69562306a36Sopenharmony_ci#define MCDR2_Wr	(MCDR2_RW*1)	/*   reg. Write                    */
69662306a36Sopenharmony_ci#define MCDR2_ADD	Fld (4, 17)	/*  reg. ADDress                   */
69762306a36Sopenharmony_ci
69862306a36Sopenharmony_ci#define MCSR_ATS	0x00000001	/* Audio Transmit FIFO 1/2-full    */
69962306a36Sopenharmony_ci                	        	/* or less Service request (read)  */
70062306a36Sopenharmony_ci#define MCSR_ARS	0x00000002	/* Audio Receive FIFO 1/2-full or  */
70162306a36Sopenharmony_ci                	        	/* more Service request (read)     */
70262306a36Sopenharmony_ci#define MCSR_TTS	0x00000004	/* Telecom Transmit FIFO 1/2-full  */
70362306a36Sopenharmony_ci                	        	/* or less Service request (read)  */
70462306a36Sopenharmony_ci#define MCSR_TRS	0x00000008	/* Telecom Receive FIFO 1/2-full   */
70562306a36Sopenharmony_ci                	        	/* or more Service request (read)  */
70662306a36Sopenharmony_ci#define MCSR_ATU	0x00000010	/* Audio Transmit FIFO Under-run   */
70762306a36Sopenharmony_ci#define MCSR_ARO	0x00000020	/* Audio Receive FIFO Over-run     */
70862306a36Sopenharmony_ci#define MCSR_TTU	0x00000040	/* Telecom Transmit FIFO Under-run */
70962306a36Sopenharmony_ci#define MCSR_TRO	0x00000080	/* Telecom Receive FIFO Over-run   */
71062306a36Sopenharmony_ci#define MCSR_ANF	0x00000100	/* Audio transmit FIFO Not Full    */
71162306a36Sopenharmony_ci                	        	/* (read)                          */
71262306a36Sopenharmony_ci#define MCSR_ANE	0x00000200	/* Audio receive FIFO Not Empty    */
71362306a36Sopenharmony_ci                	        	/* (read)                          */
71462306a36Sopenharmony_ci#define MCSR_TNF	0x00000400	/* Telecom transmit FIFO Not Full  */
71562306a36Sopenharmony_ci                	        	/* (read)                          */
71662306a36Sopenharmony_ci#define MCSR_TNE	0x00000800	/* Telecom receive FIFO Not Empty  */
71762306a36Sopenharmony_ci                	        	/* (read)                          */
71862306a36Sopenharmony_ci#define MCSR_CWC	0x00001000	/* CODEC register Write Completed  */
71962306a36Sopenharmony_ci                	        	/* (read)                          */
72062306a36Sopenharmony_ci#define MCSR_CRC	0x00002000	/* CODEC register Read Completed   */
72162306a36Sopenharmony_ci                	        	/* (read)                          */
72262306a36Sopenharmony_ci#define MCSR_ACE	0x00004000	/* Audio CODEC Enabled (read)      */
72362306a36Sopenharmony_ci#define MCSR_TCE	0x00008000	/* Telecom CODEC Enabled (read)    */
72462306a36Sopenharmony_ci
72562306a36Sopenharmony_ci#define MCCR1_CFS	0x00100000	/* Clock Freq. Select              */
72662306a36Sopenharmony_ci#define MCCR1_F12MHz	(MCCR1_CFS*0)	/*  Freq. (fmc) = ~ 12 MHz         */
72762306a36Sopenharmony_ci                	        	/*  (11.981 MHz)                   */
72862306a36Sopenharmony_ci#define MCCR1_F10MHz	(MCCR1_CFS*1)	/*  Freq. (fmc) = ~ 10 MHz         */
72962306a36Sopenharmony_ci                	        	/*  (9.585 MHz)                    */
73062306a36Sopenharmony_ci
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci/*
73362306a36Sopenharmony_ci * Synchronous Serial Port (SSP) control registers
73462306a36Sopenharmony_ci *
73562306a36Sopenharmony_ci * Registers
73662306a36Sopenharmony_ci *    Ser4SSCR0 	Serial port 4 Synchronous Serial Port (SSP) Control
73762306a36Sopenharmony_ci *              	Register 0 (read/write).
73862306a36Sopenharmony_ci *    Ser4SSCR1 	Serial port 4 Synchronous Serial Port (SSP) Control
73962306a36Sopenharmony_ci *              	Register 1 (read/write).
74062306a36Sopenharmony_ci *              	[Bits SPO and SP are only implemented in versions 2.0
74162306a36Sopenharmony_ci *              	(rev. = 8) and higher of the StrongARM SA-1100.]
74262306a36Sopenharmony_ci *    Ser4SSDR  	Serial port 4 Synchronous Serial Port (SSP) Data
74362306a36Sopenharmony_ci *              	Register (read/write).
74462306a36Sopenharmony_ci *    Ser4SSSR  	Serial port 4 Synchronous Serial Port (SSP) Status
74562306a36Sopenharmony_ci *              	Register (read/write).
74662306a36Sopenharmony_ci *
74762306a36Sopenharmony_ci * Clocks
74862306a36Sopenharmony_ci *    fxtl, Txtl	Frequency, period of the system crystal (3.6864 MHz
74962306a36Sopenharmony_ci *              	or 3.5795 MHz).
75062306a36Sopenharmony_ci *    fss, Tss  	Frequency, period of the SSP communication.
75162306a36Sopenharmony_ci */
75262306a36Sopenharmony_ci
75362306a36Sopenharmony_ci#define Ser4SSCR0	__REG(0x80070060)  /* Ser. port 4 SSP Control Reg. 0 */
75462306a36Sopenharmony_ci#define Ser4SSCR1	__REG(0x80070064)  /* Ser. port 4 SSP Control Reg. 1 */
75562306a36Sopenharmony_ci#define Ser4SSDR	__REG(0x8007006C)  /* Ser. port 4 SSP Data Reg. */
75662306a36Sopenharmony_ci#define Ser4SSSR	__REG(0x80070074)  /* Ser. port 4 SSP Status Reg. */
75762306a36Sopenharmony_ci
75862306a36Sopenharmony_ci#define SSCR0_DSS	Fld (4, 0)	/* Data Size - 1 Select [3..15]    */
75962306a36Sopenharmony_ci#define SSCR0_DataSize(Size)    	/*  Data Size Select [4..16]       */ \
76062306a36Sopenharmony_ci                	(((Size) - 1) << FShft (SSCR0_DSS))
76162306a36Sopenharmony_ci#define SSCR0_FRF	Fld (2, 4)	/* FRame Format                    */
76262306a36Sopenharmony_ci#define SSCR0_Motorola	        	/*  Motorola Serial Peripheral     */ \
76362306a36Sopenharmony_ci                	        	/*  Interface (SPI) format         */ \
76462306a36Sopenharmony_ci                	(0 << FShft (SSCR0_FRF))
76562306a36Sopenharmony_ci#define SSCR0_TI	        	/*  Texas Instruments Synchronous  */ \
76662306a36Sopenharmony_ci                	        	/*  Serial format                  */ \
76762306a36Sopenharmony_ci                	(1 << FShft (SSCR0_FRF))
76862306a36Sopenharmony_ci#define SSCR0_National	        	/*  National Microwire format      */ \
76962306a36Sopenharmony_ci                	(2 << FShft (SSCR0_FRF))
77062306a36Sopenharmony_ci#define SSCR0_SSE	0x00000080	/* SSP Enable                      */
77162306a36Sopenharmony_ci#define SSCR0_SCR	Fld (8, 8)	/* Serial Clock Rate divisor/2 - 1 */
77262306a36Sopenharmony_ci                	        	/* fss = fxtl/(2*(SCR + 1))        */
77362306a36Sopenharmony_ci                	        	/* Tss = 2*(SCR + 1)*Txtl          */
77462306a36Sopenharmony_ci#define SSCR0_SerClkDiv(Div)    	/*  Serial Clock Divisor [2..512]  */ \
77562306a36Sopenharmony_ci                	(((Div) - 2)/2 << FShft (SSCR0_SCR))
77662306a36Sopenharmony_ci                	        	/*  fss = fxtl/(2*Floor (Div/2))   */
77762306a36Sopenharmony_ci                	        	/*  Tss = 2*Floor (Div/2)*Txtl     */
77862306a36Sopenharmony_ci#define SSCR0_CeilSerClkDiv(Div)	/*  Ceil. of SerClkDiv [2..512]    */ \
77962306a36Sopenharmony_ci                	(((Div) - 1)/2 << FShft (SSCR0_SCR))
78062306a36Sopenharmony_ci                	        	/*  fss = fxtl/(2*Ceil (Div/2))    */
78162306a36Sopenharmony_ci                	        	/*  Tss = 2*Ceil (Div/2)*Txtl      */
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ci#define SSCR1_RIE	0x00000001	/* Receive FIFO 1/2-full or more   */
78462306a36Sopenharmony_ci                	        	/* Interrupt Enable                */
78562306a36Sopenharmony_ci#define SSCR1_TIE	0x00000002	/* Transmit FIFO 1/2-full or less  */
78662306a36Sopenharmony_ci                	        	/* Interrupt Enable                */
78762306a36Sopenharmony_ci#define SSCR1_LBM	0x00000004	/* Look-Back Mode                  */
78862306a36Sopenharmony_ci#define SSCR1_SPO	0x00000008	/* Sample clock (SCLK) POlarity    */
78962306a36Sopenharmony_ci#define SSCR1_SClkIactL	(SSCR1_SPO*0)	/*  Sample Clock Inactive Low      */
79062306a36Sopenharmony_ci#define SSCR1_SClkIactH	(SSCR1_SPO*1)	/*  Sample Clock Inactive High     */
79162306a36Sopenharmony_ci#define SSCR1_SP	0x00000010	/* Sample clock (SCLK) Phase       */
79262306a36Sopenharmony_ci#define SSCR1_SClk1P	(SSCR1_SP*0)	/*  Sample Clock active 1 Period   */
79362306a36Sopenharmony_ci                	        	/*  after frame (SFRM, 1st edge)   */
79462306a36Sopenharmony_ci#define SSCR1_SClk1_2P	(SSCR1_SP*1)	/*  Sample Clock active 1/2 Period */
79562306a36Sopenharmony_ci                	        	/*  after frame (SFRM, 1st edge)   */
79662306a36Sopenharmony_ci#define SSCR1_ECS	0x00000020	/* External Clock Select           */
79762306a36Sopenharmony_ci#define SSCR1_IntClk	(SSCR1_ECS*0)	/*  Internal Clock                 */
79862306a36Sopenharmony_ci#define SSCR1_ExtClk	(SSCR1_ECS*1)	/*  External Clock (GPIO [19])     */
79962306a36Sopenharmony_ci
80062306a36Sopenharmony_ci#define SSDR_DATA	Fld (16, 0)	/* receive/transmit DATA FIFOs     */
80162306a36Sopenharmony_ci
80262306a36Sopenharmony_ci#define SSSR_TNF	0x00000002	/* Transmit FIFO Not Full (read)   */
80362306a36Sopenharmony_ci#define SSSR_RNE	0x00000004	/* Receive FIFO Not Empty (read)   */
80462306a36Sopenharmony_ci#define SSSR_BSY	0x00000008	/* SSP BuSY (read)                 */
80562306a36Sopenharmony_ci#define SSSR_TFS	0x00000010	/* Transmit FIFO 1/2-full or less  */
80662306a36Sopenharmony_ci                	        	/* Service request (read)          */
80762306a36Sopenharmony_ci#define SSSR_RFS	0x00000020	/* Receive FIFO 1/2-full or more   */
80862306a36Sopenharmony_ci                	        	/* Service request (read)          */
80962306a36Sopenharmony_ci#define SSSR_ROR	0x00000040	/* Receive FIFO Over-Run           */
81062306a36Sopenharmony_ci
81162306a36Sopenharmony_ci
81262306a36Sopenharmony_ci/*
81362306a36Sopenharmony_ci * Operating System (OS) timer control registers
81462306a36Sopenharmony_ci *
81562306a36Sopenharmony_ci * Registers
81662306a36Sopenharmony_ci *    OSMR0     	Operating System (OS) timer Match Register 0
81762306a36Sopenharmony_ci *              	(read/write).
81862306a36Sopenharmony_ci *    OSMR1     	Operating System (OS) timer Match Register 1
81962306a36Sopenharmony_ci *              	(read/write).
82062306a36Sopenharmony_ci *    OSMR2     	Operating System (OS) timer Match Register 2
82162306a36Sopenharmony_ci *              	(read/write).
82262306a36Sopenharmony_ci *    OSMR3     	Operating System (OS) timer Match Register 3
82362306a36Sopenharmony_ci *              	(read/write).
82462306a36Sopenharmony_ci *    OSCR      	Operating System (OS) timer Counter Register
82562306a36Sopenharmony_ci *              	(read/write).
82662306a36Sopenharmony_ci *    OSSR      	Operating System (OS) timer Status Register
82762306a36Sopenharmony_ci *              	(read/write).
82862306a36Sopenharmony_ci *    OWER      	Operating System (OS) timer Watch-dog Enable Register
82962306a36Sopenharmony_ci *              	(read/write).
83062306a36Sopenharmony_ci *    OIER      	Operating System (OS) timer Interrupt Enable Register
83162306a36Sopenharmony_ci *              	(read/write).
83262306a36Sopenharmony_ci */
83362306a36Sopenharmony_ci
83462306a36Sopenharmony_ci#define OSMR0  		io_p2v(0x90000000)  /* OS timer Match Reg. 0 */
83562306a36Sopenharmony_ci#define OSMR1  		io_p2v(0x90000004)  /* OS timer Match Reg. 1 */
83662306a36Sopenharmony_ci#define OSMR2  		io_p2v(0x90000008)  /* OS timer Match Reg. 2 */
83762306a36Sopenharmony_ci#define OSMR3  		io_p2v(0x9000000c)  /* OS timer Match Reg. 3 */
83862306a36Sopenharmony_ci#define OSCR   		io_p2v(0x90000010)  /* OS timer Counter Reg. */
83962306a36Sopenharmony_ci#define OSSR   		io_p2v(0x90000014)  /* OS timer Status Reg. */
84062306a36Sopenharmony_ci#define OWER   		io_p2v(0x90000018)  /* OS timer Watch-dog Enable Reg. */
84162306a36Sopenharmony_ci#define OIER  	 	io_p2v(0x9000001C)  /* OS timer Interrupt Enable Reg. */
84262306a36Sopenharmony_ci
84362306a36Sopenharmony_ci#define OSSR_M(Nb)	        	/* Match detected [0..3]           */ \
84462306a36Sopenharmony_ci                	(0x00000001 << (Nb))
84562306a36Sopenharmony_ci#define OSSR_M0 	OSSR_M (0)	/* Match detected 0                */
84662306a36Sopenharmony_ci#define OSSR_M1 	OSSR_M (1)	/* Match detected 1                */
84762306a36Sopenharmony_ci#define OSSR_M2 	OSSR_M (2)	/* Match detected 2                */
84862306a36Sopenharmony_ci#define OSSR_M3 	OSSR_M (3)	/* Match detected 3                */
84962306a36Sopenharmony_ci
85062306a36Sopenharmony_ci#define OWER_WME	0x00000001	/* Watch-dog Match Enable          */
85162306a36Sopenharmony_ci                	        	/* (set only)                      */
85262306a36Sopenharmony_ci
85362306a36Sopenharmony_ci#define OIER_E(Nb)	        	/* match interrupt Enable [0..3]   */ \
85462306a36Sopenharmony_ci                	(0x00000001 << (Nb))
85562306a36Sopenharmony_ci#define OIER_E0 	OIER_E (0)	/* match interrupt Enable 0        */
85662306a36Sopenharmony_ci#define OIER_E1 	OIER_E (1)	/* match interrupt Enable 1        */
85762306a36Sopenharmony_ci#define OIER_E2 	OIER_E (2)	/* match interrupt Enable 2        */
85862306a36Sopenharmony_ci#define OIER_E3 	OIER_E (3)	/* match interrupt Enable 3        */
85962306a36Sopenharmony_ci
86062306a36Sopenharmony_ci
86162306a36Sopenharmony_ci/*
86262306a36Sopenharmony_ci * Power Manager (PM) control registers
86362306a36Sopenharmony_ci *
86462306a36Sopenharmony_ci * Registers
86562306a36Sopenharmony_ci *    PMCR      	Power Manager (PM) Control Register (read/write).
86662306a36Sopenharmony_ci *    PSSR      	Power Manager (PM) Sleep Status Register (read/write).
86762306a36Sopenharmony_ci *    PSPR      	Power Manager (PM) Scratch-Pad Register (read/write).
86862306a36Sopenharmony_ci *    PWER      	Power Manager (PM) Wake-up Enable Register
86962306a36Sopenharmony_ci *              	(read/write).
87062306a36Sopenharmony_ci *    PCFR      	Power Manager (PM) general ConFiguration Register
87162306a36Sopenharmony_ci *              	(read/write).
87262306a36Sopenharmony_ci *    PPCR      	Power Manager (PM) Phase-Locked Loop (PLL)
87362306a36Sopenharmony_ci *              	Configuration Register (read/write).
87462306a36Sopenharmony_ci *    PGSR      	Power Manager (PM) General-Purpose Input/Output (GPIO)
87562306a36Sopenharmony_ci *              	Sleep state Register (read/write, see GPIO pins).
87662306a36Sopenharmony_ci *    POSR      	Power Manager (PM) Oscillator Status Register (read).
87762306a36Sopenharmony_ci *
87862306a36Sopenharmony_ci * Clocks
87962306a36Sopenharmony_ci *    fxtl, Txtl	Frequency, period of the system crystal (3.6864 MHz
88062306a36Sopenharmony_ci *              	or 3.5795 MHz).
88162306a36Sopenharmony_ci *    fcpu, Tcpu	Frequency, period of the CPU core clock (CCLK).
88262306a36Sopenharmony_ci */
88362306a36Sopenharmony_ci
88462306a36Sopenharmony_ci#define PMCR		__REG(0x90020000)  /* PM Control Reg. */
88562306a36Sopenharmony_ci#define PSSR		__REG(0x90020004)  /* PM Sleep Status Reg. */
88662306a36Sopenharmony_ci#define PSPR		__REG(0x90020008)  /* PM Scratch-Pad Reg. */
88762306a36Sopenharmony_ci#define PWER		__REG(0x9002000C)  /* PM Wake-up Enable Reg. */
88862306a36Sopenharmony_ci#define PCFR		__REG(0x90020010)  /* PM general ConFiguration Reg. */
88962306a36Sopenharmony_ci#define PPCR		__REG(0x90020014)  /* PM PLL Configuration Reg. */
89062306a36Sopenharmony_ci#define PGSR		__REG(0x90020018)  /* PM GPIO Sleep state Reg. */
89162306a36Sopenharmony_ci#define POSR		__REG(0x9002001C)  /* PM Oscillator Status Reg. */
89262306a36Sopenharmony_ci
89362306a36Sopenharmony_ci#define PMCR_SF 	0x00000001	/* Sleep Force (set only)          */
89462306a36Sopenharmony_ci
89562306a36Sopenharmony_ci#define PSSR_SS 	0x00000001	/* Software Sleep                  */
89662306a36Sopenharmony_ci#define PSSR_BFS	0x00000002	/* Battery Fault Status            */
89762306a36Sopenharmony_ci                	        	/* (BATT_FAULT)                    */
89862306a36Sopenharmony_ci#define PSSR_VFS	0x00000004	/* Vdd Fault Status (VDD_FAULT)    */
89962306a36Sopenharmony_ci#define PSSR_DH 	0x00000008	/* DRAM control Hold               */
90062306a36Sopenharmony_ci#define PSSR_PH 	0x00000010	/* Peripheral control Hold         */
90162306a36Sopenharmony_ci
90262306a36Sopenharmony_ci#define PWER_GPIO(Nb)	GPIO_GPIO (Nb)	/* GPIO [0..27] wake-up enable     */
90362306a36Sopenharmony_ci#define PWER_GPIO0	PWER_GPIO (0)	/* GPIO  [0] wake-up enable        */
90462306a36Sopenharmony_ci#define PWER_GPIO1	PWER_GPIO (1)	/* GPIO  [1] wake-up enable        */
90562306a36Sopenharmony_ci#define PWER_GPIO2	PWER_GPIO (2)	/* GPIO  [2] wake-up enable        */
90662306a36Sopenharmony_ci#define PWER_GPIO3	PWER_GPIO (3)	/* GPIO  [3] wake-up enable        */
90762306a36Sopenharmony_ci#define PWER_GPIO4	PWER_GPIO (4)	/* GPIO  [4] wake-up enable        */
90862306a36Sopenharmony_ci#define PWER_GPIO5	PWER_GPIO (5)	/* GPIO  [5] wake-up enable        */
90962306a36Sopenharmony_ci#define PWER_GPIO6	PWER_GPIO (6)	/* GPIO  [6] wake-up enable        */
91062306a36Sopenharmony_ci#define PWER_GPIO7	PWER_GPIO (7)	/* GPIO  [7] wake-up enable        */
91162306a36Sopenharmony_ci#define PWER_GPIO8	PWER_GPIO (8)	/* GPIO  [8] wake-up enable        */
91262306a36Sopenharmony_ci#define PWER_GPIO9	PWER_GPIO (9)	/* GPIO  [9] wake-up enable        */
91362306a36Sopenharmony_ci#define PWER_GPIO10	PWER_GPIO (10)	/* GPIO [10] wake-up enable        */
91462306a36Sopenharmony_ci#define PWER_GPIO11	PWER_GPIO (11)	/* GPIO [11] wake-up enable        */
91562306a36Sopenharmony_ci#define PWER_GPIO12	PWER_GPIO (12)	/* GPIO [12] wake-up enable        */
91662306a36Sopenharmony_ci#define PWER_GPIO13	PWER_GPIO (13)	/* GPIO [13] wake-up enable        */
91762306a36Sopenharmony_ci#define PWER_GPIO14	PWER_GPIO (14)	/* GPIO [14] wake-up enable        */
91862306a36Sopenharmony_ci#define PWER_GPIO15	PWER_GPIO (15)	/* GPIO [15] wake-up enable        */
91962306a36Sopenharmony_ci#define PWER_GPIO16	PWER_GPIO (16)	/* GPIO [16] wake-up enable        */
92062306a36Sopenharmony_ci#define PWER_GPIO17	PWER_GPIO (17)	/* GPIO [17] wake-up enable        */
92162306a36Sopenharmony_ci#define PWER_GPIO18	PWER_GPIO (18)	/* GPIO [18] wake-up enable        */
92262306a36Sopenharmony_ci#define PWER_GPIO19	PWER_GPIO (19)	/* GPIO [19] wake-up enable        */
92362306a36Sopenharmony_ci#define PWER_GPIO20	PWER_GPIO (20)	/* GPIO [20] wake-up enable        */
92462306a36Sopenharmony_ci#define PWER_GPIO21	PWER_GPIO (21)	/* GPIO [21] wake-up enable        */
92562306a36Sopenharmony_ci#define PWER_GPIO22	PWER_GPIO (22)	/* GPIO [22] wake-up enable        */
92662306a36Sopenharmony_ci#define PWER_GPIO23	PWER_GPIO (23)	/* GPIO [23] wake-up enable        */
92762306a36Sopenharmony_ci#define PWER_GPIO24	PWER_GPIO (24)	/* GPIO [24] wake-up enable        */
92862306a36Sopenharmony_ci#define PWER_GPIO25	PWER_GPIO (25)	/* GPIO [25] wake-up enable        */
92962306a36Sopenharmony_ci#define PWER_GPIO26	PWER_GPIO (26)	/* GPIO [26] wake-up enable        */
93062306a36Sopenharmony_ci#define PWER_GPIO27	PWER_GPIO (27)	/* GPIO [27] wake-up enable        */
93162306a36Sopenharmony_ci#define PWER_RTC	0x80000000	/* RTC alarm wake-up enable        */
93262306a36Sopenharmony_ci
93362306a36Sopenharmony_ci#define PCFR_OPDE	0x00000001	/* Oscillator Power-Down Enable    */
93462306a36Sopenharmony_ci#define PCFR_ClkRun	(PCFR_OPDE*0)	/*  Clock Running in sleep mode    */
93562306a36Sopenharmony_ci#define PCFR_ClkStp	(PCFR_OPDE*1)	/*  Clock Stopped in sleep mode    */
93662306a36Sopenharmony_ci#define PCFR_FP 	0x00000002	/* Float PCMCIA pins               */
93762306a36Sopenharmony_ci#define PCFR_PCMCIANeg	(PCFR_FP*0)	/*  PCMCIA pins Negated (1)        */
93862306a36Sopenharmony_ci#define PCFR_PCMCIAFlt	(PCFR_FP*1)	/*  PCMCIA pins Floating           */
93962306a36Sopenharmony_ci#define PCFR_FS 	0x00000004	/* Float Static memory pins        */
94062306a36Sopenharmony_ci#define PCFR_StMemNeg	(PCFR_FS*0)	/*  Static Memory pins Negated (1) */
94162306a36Sopenharmony_ci#define PCFR_StMemFlt	(PCFR_FS*1)	/*  Static Memory pins Floating    */
94262306a36Sopenharmony_ci#define PCFR_FO 	0x00000008	/* Force RTC oscillator            */
94362306a36Sopenharmony_ci                	        	/* (32.768 kHz) enable On          */
94462306a36Sopenharmony_ci
94562306a36Sopenharmony_ci#define PPCR_CCF	Fld (5, 0)	/* CPU core Clock (CCLK) Freq.     */
94662306a36Sopenharmony_ci#define PPCR_Fx16	        	/*  Freq. x 16 (fcpu = 16*fxtl)    */ \
94762306a36Sopenharmony_ci                	(0x00 << FShft (PPCR_CCF))
94862306a36Sopenharmony_ci#define PPCR_Fx20	        	/*  Freq. x 20 (fcpu = 20*fxtl)    */ \
94962306a36Sopenharmony_ci                	(0x01 << FShft (PPCR_CCF))
95062306a36Sopenharmony_ci#define PPCR_Fx24	        	/*  Freq. x 24 (fcpu = 24*fxtl)    */ \
95162306a36Sopenharmony_ci                	(0x02 << FShft (PPCR_CCF))
95262306a36Sopenharmony_ci#define PPCR_Fx28	        	/*  Freq. x 28 (fcpu = 28*fxtl)    */ \
95362306a36Sopenharmony_ci                	(0x03 << FShft (PPCR_CCF))
95462306a36Sopenharmony_ci#define PPCR_Fx32	        	/*  Freq. x 32 (fcpu = 32*fxtl)    */ \
95562306a36Sopenharmony_ci                	(0x04 << FShft (PPCR_CCF))
95662306a36Sopenharmony_ci#define PPCR_Fx36	        	/*  Freq. x 36 (fcpu = 36*fxtl)    */ \
95762306a36Sopenharmony_ci                	(0x05 << FShft (PPCR_CCF))
95862306a36Sopenharmony_ci#define PPCR_Fx40	        	/*  Freq. x 40 (fcpu = 40*fxtl)    */ \
95962306a36Sopenharmony_ci                	(0x06 << FShft (PPCR_CCF))
96062306a36Sopenharmony_ci#define PPCR_Fx44	        	/*  Freq. x 44 (fcpu = 44*fxtl)    */ \
96162306a36Sopenharmony_ci                	(0x07 << FShft (PPCR_CCF))
96262306a36Sopenharmony_ci#define PPCR_Fx48	        	/*  Freq. x 48 (fcpu = 48*fxtl)    */ \
96362306a36Sopenharmony_ci                	(0x08 << FShft (PPCR_CCF))
96462306a36Sopenharmony_ci#define PPCR_Fx52	        	/*  Freq. x 52 (fcpu = 52*fxtl)    */ \
96562306a36Sopenharmony_ci                	(0x09 << FShft (PPCR_CCF))
96662306a36Sopenharmony_ci#define PPCR_Fx56	        	/*  Freq. x 56 (fcpu = 56*fxtl)    */ \
96762306a36Sopenharmony_ci                	(0x0A << FShft (PPCR_CCF))
96862306a36Sopenharmony_ci#define PPCR_Fx60	        	/*  Freq. x 60 (fcpu = 60*fxtl)    */ \
96962306a36Sopenharmony_ci                	(0x0B << FShft (PPCR_CCF))
97062306a36Sopenharmony_ci#define PPCR_Fx64	        	/*  Freq. x 64 (fcpu = 64*fxtl)    */ \
97162306a36Sopenharmony_ci                	(0x0C << FShft (PPCR_CCF))
97262306a36Sopenharmony_ci#define PPCR_Fx68	        	/*  Freq. x 68 (fcpu = 68*fxtl)    */ \
97362306a36Sopenharmony_ci                	(0x0D << FShft (PPCR_CCF))
97462306a36Sopenharmony_ci#define PPCR_Fx72	        	/*  Freq. x 72 (fcpu = 72*fxtl)    */ \
97562306a36Sopenharmony_ci                	(0x0E << FShft (PPCR_CCF))
97662306a36Sopenharmony_ci#define PPCR_Fx76	        	/*  Freq. x 76 (fcpu = 76*fxtl)    */ \
97762306a36Sopenharmony_ci                	(0x0F << FShft (PPCR_CCF))
97862306a36Sopenharmony_ci                	        	/*  3.6864 MHz crystal (fxtl):     */
97962306a36Sopenharmony_ci#define PPCR_F59_0MHz	PPCR_Fx16	/*   Freq. (fcpu) =  59.0 MHz      */
98062306a36Sopenharmony_ci#define PPCR_F73_7MHz	PPCR_Fx20	/*   Freq. (fcpu) =  73.7 MHz      */
98162306a36Sopenharmony_ci#define PPCR_F88_5MHz	PPCR_Fx24	/*   Freq. (fcpu) =  88.5 MHz      */
98262306a36Sopenharmony_ci#define PPCR_F103_2MHz	PPCR_Fx28	/*   Freq. (fcpu) = 103.2 MHz      */
98362306a36Sopenharmony_ci#define PPCR_F118_0MHz	PPCR_Fx32	/*   Freq. (fcpu) = 118.0 MHz      */
98462306a36Sopenharmony_ci#define PPCR_F132_7MHz	PPCR_Fx36	/*   Freq. (fcpu) = 132.7 MHz      */
98562306a36Sopenharmony_ci#define PPCR_F147_5MHz	PPCR_Fx40	/*   Freq. (fcpu) = 147.5 MHz      */
98662306a36Sopenharmony_ci#define PPCR_F162_2MHz	PPCR_Fx44	/*   Freq. (fcpu) = 162.2 MHz      */
98762306a36Sopenharmony_ci#define PPCR_F176_9MHz	PPCR_Fx48	/*   Freq. (fcpu) = 176.9 MHz      */
98862306a36Sopenharmony_ci#define PPCR_F191_7MHz	PPCR_Fx52	/*   Freq. (fcpu) = 191.7 MHz      */
98962306a36Sopenharmony_ci#define PPCR_F206_4MHz	PPCR_Fx56	/*   Freq. (fcpu) = 206.4 MHz      */
99062306a36Sopenharmony_ci#define PPCR_F221_2MHz	PPCR_Fx60	/*   Freq. (fcpu) = 221.2 MHz      */
99162306a36Sopenharmony_ci#define PPCR_F239_6MHz	PPCR_Fx64	/*   Freq. (fcpu) = 239.6 MHz      */
99262306a36Sopenharmony_ci#define PPCR_F250_7MHz	PPCR_Fx68	/*   Freq. (fcpu) = 250.7 MHz      */
99362306a36Sopenharmony_ci#define PPCR_F265_4MHz	PPCR_Fx72	/*   Freq. (fcpu) = 265.4 MHz      */
99462306a36Sopenharmony_ci#define PPCR_F280_2MHz	PPCR_Fx76	/*   Freq. (fcpu) = 280.2 MHz      */
99562306a36Sopenharmony_ci                	        	/*  3.5795 MHz crystal (fxtl):     */
99662306a36Sopenharmony_ci#define PPCR_F57_3MHz	PPCR_Fx16	/*   Freq. (fcpu) =  57.3 MHz      */
99762306a36Sopenharmony_ci#define PPCR_F71_6MHz	PPCR_Fx20	/*   Freq. (fcpu) =  71.6 MHz      */
99862306a36Sopenharmony_ci#define PPCR_F85_9MHz	PPCR_Fx24	/*   Freq. (fcpu) =  85.9 MHz      */
99962306a36Sopenharmony_ci#define PPCR_F100_2MHz	PPCR_Fx28	/*   Freq. (fcpu) = 100.2 MHz      */
100062306a36Sopenharmony_ci#define PPCR_F114_5MHz	PPCR_Fx32	/*   Freq. (fcpu) = 114.5 MHz      */
100162306a36Sopenharmony_ci#define PPCR_F128_9MHz	PPCR_Fx36	/*   Freq. (fcpu) = 128.9 MHz      */
100262306a36Sopenharmony_ci#define PPCR_F143_2MHz	PPCR_Fx40	/*   Freq. (fcpu) = 143.2 MHz      */
100362306a36Sopenharmony_ci#define PPCR_F157_5MHz	PPCR_Fx44	/*   Freq. (fcpu) = 157.5 MHz      */
100462306a36Sopenharmony_ci#define PPCR_F171_8MHz	PPCR_Fx48	/*   Freq. (fcpu) = 171.8 MHz      */
100562306a36Sopenharmony_ci#define PPCR_F186_1MHz	PPCR_Fx52	/*   Freq. (fcpu) = 186.1 MHz      */
100662306a36Sopenharmony_ci#define PPCR_F200_5MHz	PPCR_Fx56	/*   Freq. (fcpu) = 200.5 MHz      */
100762306a36Sopenharmony_ci#define PPCR_F214_8MHz	PPCR_Fx60	/*   Freq. (fcpu) = 214.8 MHz      */
100862306a36Sopenharmony_ci#define PPCR_F229_1MHz	PPCR_Fx64	/*   Freq. (fcpu) = 229.1 MHz      */
100962306a36Sopenharmony_ci#define PPCR_F243_4MHz	PPCR_Fx68	/*   Freq. (fcpu) = 243.4 MHz      */
101062306a36Sopenharmony_ci#define PPCR_F257_7MHz	PPCR_Fx72	/*   Freq. (fcpu) = 257.7 MHz      */
101162306a36Sopenharmony_ci#define PPCR_F272_0MHz	PPCR_Fx76	/*   Freq. (fcpu) = 272.0 MHz      */
101262306a36Sopenharmony_ci
101362306a36Sopenharmony_ci#define POSR_OOK	0x00000001	/* RTC Oscillator (32.768 kHz) OK  */
101462306a36Sopenharmony_ci
101562306a36Sopenharmony_ci
101662306a36Sopenharmony_ci/*
101762306a36Sopenharmony_ci * Reset Controller (RC) control registers
101862306a36Sopenharmony_ci *
101962306a36Sopenharmony_ci * Registers
102062306a36Sopenharmony_ci *    RSRR      	Reset Controller (RC) Software Reset Register
102162306a36Sopenharmony_ci *              	(read/write).
102262306a36Sopenharmony_ci *    RCSR      	Reset Controller (RC) Status Register (read/write).
102362306a36Sopenharmony_ci */
102462306a36Sopenharmony_ci
102562306a36Sopenharmony_ci#define RSRR		__REG(0x90030000)  /* RC Software Reset Reg. */
102662306a36Sopenharmony_ci#define RCSR		__REG(0x90030004)  /* RC Status Reg. */
102762306a36Sopenharmony_ci
102862306a36Sopenharmony_ci#define RSRR_SWR	0x00000001	/* SoftWare Reset (set only)       */
102962306a36Sopenharmony_ci
103062306a36Sopenharmony_ci#define RCSR_HWR	0x00000001	/* HardWare Reset                  */
103162306a36Sopenharmony_ci#define RCSR_SWR	0x00000002	/* SoftWare Reset                  */
103262306a36Sopenharmony_ci#define RCSR_WDR	0x00000004	/* Watch-Dog Reset                 */
103362306a36Sopenharmony_ci#define RCSR_SMR	0x00000008	/* Sleep-Mode Reset                */
103462306a36Sopenharmony_ci
103562306a36Sopenharmony_ci
103662306a36Sopenharmony_ci/*
103762306a36Sopenharmony_ci * Test unit control registers
103862306a36Sopenharmony_ci *
103962306a36Sopenharmony_ci * Registers
104062306a36Sopenharmony_ci *    TUCR      	Test Unit Control Register (read/write).
104162306a36Sopenharmony_ci */
104262306a36Sopenharmony_ci
104362306a36Sopenharmony_ci#define TUCR		__REG(0x90030008)  /* Test Unit Control Reg. */
104462306a36Sopenharmony_ci
104562306a36Sopenharmony_ci#define TUCR_TIC	0x00000040	/* TIC mode                        */
104662306a36Sopenharmony_ci#define TUCR_TTST	0x00000080	/* Trim TeST mode                  */
104762306a36Sopenharmony_ci#define TUCR_RCRC	0x00000100	/* Richard's Cyclic Redundancy     */
104862306a36Sopenharmony_ci                	        	/* Check                           */
104962306a36Sopenharmony_ci#define TUCR_PMD	0x00000200	/* Power Management Disable        */
105062306a36Sopenharmony_ci#define TUCR_MR 	0x00000400	/* Memory Request mode             */
105162306a36Sopenharmony_ci#define TUCR_NoMB	(TUCR_MR*0)	/*  No Memory Bus request & grant  */
105262306a36Sopenharmony_ci#define TUCR_MBGPIO	(TUCR_MR*1)	/*  Memory Bus request (MBREQ) &   */
105362306a36Sopenharmony_ci                	        	/*  grant (MBGNT) on GPIO [22:21]  */
105462306a36Sopenharmony_ci#define TUCR_CTB	Fld (3, 20)	/* Clock Test Bits                 */
105562306a36Sopenharmony_ci#define TUCR_FDC	0x00800000	/* RTC Force Delete Count          */
105662306a36Sopenharmony_ci#define TUCR_FMC	0x01000000	/* Force Michelle's Control mode   */
105762306a36Sopenharmony_ci#define TUCR_TMC	0x02000000	/* RTC Trimmer Multiplexer Control */
105862306a36Sopenharmony_ci#define TUCR_DPS	0x04000000	/* Disallow Pad Sleep              */
105962306a36Sopenharmony_ci#define TUCR_TSEL	Fld (3, 29)	/* clock Test SELect on GPIO [27]  */
106062306a36Sopenharmony_ci#define TUCR_32_768kHz	        	/*  32.768 kHz osc. on GPIO [27]   */ \
106162306a36Sopenharmony_ci                	(0 << FShft (TUCR_TSEL))
106262306a36Sopenharmony_ci#define TUCR_3_6864MHz	        	/*  3.6864 MHz osc. on GPIO [27]   */ \
106362306a36Sopenharmony_ci                	(1 << FShft (TUCR_TSEL))
106462306a36Sopenharmony_ci#define TUCR_VDD	        	/*  VDD ring osc./16 on GPIO [27]  */ \
106562306a36Sopenharmony_ci                	(2 << FShft (TUCR_TSEL))
106662306a36Sopenharmony_ci#define TUCR_96MHzPLL	        	/*  96 MHz PLL/4 on GPIO [27]      */ \
106762306a36Sopenharmony_ci                	(3 << FShft (TUCR_TSEL))
106862306a36Sopenharmony_ci#define TUCR_Clock	        	/*  internal (fcpu/2) & 32.768 kHz */ \
106962306a36Sopenharmony_ci                	        	/*  Clocks on GPIO [26:27]         */ \
107062306a36Sopenharmony_ci                	(4 << FShft (TUCR_TSEL))
107162306a36Sopenharmony_ci#define TUCR_3_6864MHzA	        	/*  3.6864 MHz osc. on GPIO [27]   */ \
107262306a36Sopenharmony_ci                	        	/*  (Alternative)                  */ \
107362306a36Sopenharmony_ci                	(5 << FShft (TUCR_TSEL))
107462306a36Sopenharmony_ci#define TUCR_MainPLL	        	/*  Main PLL/16 on GPIO [27]       */ \
107562306a36Sopenharmony_ci                	(6 << FShft (TUCR_TSEL))
107662306a36Sopenharmony_ci#define TUCR_VDDL	        	/*  VDDL ring osc./4 on GPIO [27]  */ \
107762306a36Sopenharmony_ci                	(7 << FShft (TUCR_TSEL))
107862306a36Sopenharmony_ci
107962306a36Sopenharmony_ci
108062306a36Sopenharmony_ci/*
108162306a36Sopenharmony_ci * General-Purpose Input/Output (GPIO) control registers
108262306a36Sopenharmony_ci *
108362306a36Sopenharmony_ci * Registers
108462306a36Sopenharmony_ci *    GPLR      	General-Purpose Input/Output (GPIO) Pin Level
108562306a36Sopenharmony_ci *              	Register (read).
108662306a36Sopenharmony_ci *    GPDR      	General-Purpose Input/Output (GPIO) Pin Direction
108762306a36Sopenharmony_ci *              	Register (read/write).
108862306a36Sopenharmony_ci *    GPSR      	General-Purpose Input/Output (GPIO) Pin output Set
108962306a36Sopenharmony_ci *              	Register (write).
109062306a36Sopenharmony_ci *    GPCR      	General-Purpose Input/Output (GPIO) Pin output Clear
109162306a36Sopenharmony_ci *              	Register (write).
109262306a36Sopenharmony_ci *    GRER      	General-Purpose Input/Output (GPIO) Rising-Edge
109362306a36Sopenharmony_ci *              	detect Register (read/write).
109462306a36Sopenharmony_ci *    GFER      	General-Purpose Input/Output (GPIO) Falling-Edge
109562306a36Sopenharmony_ci *              	detect Register (read/write).
109662306a36Sopenharmony_ci *    GEDR      	General-Purpose Input/Output (GPIO) Edge Detect
109762306a36Sopenharmony_ci *              	status Register (read/write).
109862306a36Sopenharmony_ci *    GAFR      	General-Purpose Input/Output (GPIO) Alternate
109962306a36Sopenharmony_ci *              	Function Register (read/write).
110062306a36Sopenharmony_ci *
110162306a36Sopenharmony_ci * Clock
110262306a36Sopenharmony_ci *    fcpu, Tcpu	Frequency, period of the CPU core clock (CCLK).
110362306a36Sopenharmony_ci */
110462306a36Sopenharmony_ci
110562306a36Sopenharmony_ci#define GPLR		__REG(0x90040000)  /* GPIO Pin Level Reg.             */
110662306a36Sopenharmony_ci#define GPDR		__REG(0x90040004)  /* GPIO Pin Direction Reg.         */
110762306a36Sopenharmony_ci#define GPSR		__REG(0x90040008)  /* GPIO Pin output Set Reg.        */
110862306a36Sopenharmony_ci#define GPCR		__REG(0x9004000C)  /* GPIO Pin output Clear Reg.      */
110962306a36Sopenharmony_ci#define GRER		__REG(0x90040010)  /* GPIO Rising-Edge detect Reg.    */
111062306a36Sopenharmony_ci#define GFER		__REG(0x90040014)  /* GPIO Falling-Edge detect Reg.   */
111162306a36Sopenharmony_ci#define GEDR		__REG(0x90040018)  /* GPIO Edge Detect status Reg.    */
111262306a36Sopenharmony_ci#define GAFR		__REG(0x9004001C)  /* GPIO Alternate Function Reg.    */
111362306a36Sopenharmony_ci
111462306a36Sopenharmony_ci#define GPIO_MIN	(0)
111562306a36Sopenharmony_ci#define GPIO_MAX	(27)
111662306a36Sopenharmony_ci
111762306a36Sopenharmony_ci#define GPIO_GPIO(Nb)	        	/* GPIO [0..27]                    */ \
111862306a36Sopenharmony_ci                	(0x00000001 << (Nb))
111962306a36Sopenharmony_ci#define GPIO_GPIO0	GPIO_GPIO (0)	/* GPIO  [0]                       */
112062306a36Sopenharmony_ci#define GPIO_GPIO1	GPIO_GPIO (1)	/* GPIO  [1]                       */
112162306a36Sopenharmony_ci#define GPIO_GPIO2	GPIO_GPIO (2)	/* GPIO  [2]                       */
112262306a36Sopenharmony_ci#define GPIO_GPIO3	GPIO_GPIO (3)	/* GPIO  [3]                       */
112362306a36Sopenharmony_ci#define GPIO_GPIO4	GPIO_GPIO (4)	/* GPIO  [4]                       */
112462306a36Sopenharmony_ci#define GPIO_GPIO5	GPIO_GPIO (5)	/* GPIO  [5]                       */
112562306a36Sopenharmony_ci#define GPIO_GPIO6	GPIO_GPIO (6)	/* GPIO  [6]                       */
112662306a36Sopenharmony_ci#define GPIO_GPIO7	GPIO_GPIO (7)	/* GPIO  [7]                       */
112762306a36Sopenharmony_ci#define GPIO_GPIO8	GPIO_GPIO (8)	/* GPIO  [8]                       */
112862306a36Sopenharmony_ci#define GPIO_GPIO9	GPIO_GPIO (9)	/* GPIO  [9]                       */
112962306a36Sopenharmony_ci#define GPIO_GPIO10	GPIO_GPIO (10)	/* GPIO [10]                       */
113062306a36Sopenharmony_ci#define GPIO_GPIO11	GPIO_GPIO (11)	/* GPIO [11]                       */
113162306a36Sopenharmony_ci#define GPIO_GPIO12	GPIO_GPIO (12)	/* GPIO [12]                       */
113262306a36Sopenharmony_ci#define GPIO_GPIO13	GPIO_GPIO (13)	/* GPIO [13]                       */
113362306a36Sopenharmony_ci#define GPIO_GPIO14	GPIO_GPIO (14)	/* GPIO [14]                       */
113462306a36Sopenharmony_ci#define GPIO_GPIO15	GPIO_GPIO (15)	/* GPIO [15]                       */
113562306a36Sopenharmony_ci#define GPIO_GPIO16	GPIO_GPIO (16)	/* GPIO [16]                       */
113662306a36Sopenharmony_ci#define GPIO_GPIO17	GPIO_GPIO (17)	/* GPIO [17]                       */
113762306a36Sopenharmony_ci#define GPIO_GPIO18	GPIO_GPIO (18)	/* GPIO [18]                       */
113862306a36Sopenharmony_ci#define GPIO_GPIO19	GPIO_GPIO (19)	/* GPIO [19]                       */
113962306a36Sopenharmony_ci#define GPIO_GPIO20	GPIO_GPIO (20)	/* GPIO [20]                       */
114062306a36Sopenharmony_ci#define GPIO_GPIO21	GPIO_GPIO (21)	/* GPIO [21]                       */
114162306a36Sopenharmony_ci#define GPIO_GPIO22	GPIO_GPIO (22)	/* GPIO [22]                       */
114262306a36Sopenharmony_ci#define GPIO_GPIO23	GPIO_GPIO (23)	/* GPIO [23]                       */
114362306a36Sopenharmony_ci#define GPIO_GPIO24	GPIO_GPIO (24)	/* GPIO [24]                       */
114462306a36Sopenharmony_ci#define GPIO_GPIO25	GPIO_GPIO (25)	/* GPIO [25]                       */
114562306a36Sopenharmony_ci#define GPIO_GPIO26	GPIO_GPIO (26)	/* GPIO [26]                       */
114662306a36Sopenharmony_ci#define GPIO_GPIO27	GPIO_GPIO (27)	/* GPIO [27]                       */
114762306a36Sopenharmony_ci
114862306a36Sopenharmony_ci#define GPIO_LDD(Nb)	        	/* LCD Data [8..15] (O)            */ \
114962306a36Sopenharmony_ci                	GPIO_GPIO ((Nb) - 6)
115062306a36Sopenharmony_ci#define GPIO_LDD8	GPIO_LDD (8)	/* LCD Data  [8] (O)               */
115162306a36Sopenharmony_ci#define GPIO_LDD9	GPIO_LDD (9)	/* LCD Data  [9] (O)               */
115262306a36Sopenharmony_ci#define GPIO_LDD10	GPIO_LDD (10)	/* LCD Data [10] (O)               */
115362306a36Sopenharmony_ci#define GPIO_LDD11	GPIO_LDD (11)	/* LCD Data [11] (O)               */
115462306a36Sopenharmony_ci#define GPIO_LDD12	GPIO_LDD (12)	/* LCD Data [12] (O)               */
115562306a36Sopenharmony_ci#define GPIO_LDD13	GPIO_LDD (13)	/* LCD Data [13] (O)               */
115662306a36Sopenharmony_ci#define GPIO_LDD14	GPIO_LDD (14)	/* LCD Data [14] (O)               */
115762306a36Sopenharmony_ci#define GPIO_LDD15	GPIO_LDD (15)	/* LCD Data [15] (O)               */
115862306a36Sopenharmony_ci                	        	/* ser. port 4:                    */
115962306a36Sopenharmony_ci#define GPIO_SSP_TXD	GPIO_GPIO (10)	/*  SSP Transmit Data (O)          */
116062306a36Sopenharmony_ci#define GPIO_SSP_RXD	GPIO_GPIO (11)	/*  SSP Receive Data (I)           */
116162306a36Sopenharmony_ci#define GPIO_SSP_SCLK	GPIO_GPIO (12)	/*  SSP Sample CLocK (O)           */
116262306a36Sopenharmony_ci#define GPIO_SSP_SFRM	GPIO_GPIO (13)	/*  SSP Sample FRaMe (O)           */
116362306a36Sopenharmony_ci                	        	/* ser. port 1:                    */
116462306a36Sopenharmony_ci#define GPIO_UART_TXD	GPIO_GPIO (14)	/*  UART Transmit Data (O)         */
116562306a36Sopenharmony_ci#define GPIO_UART_RXD	GPIO_GPIO (15)	/*  UART Receive Data (I)          */
116662306a36Sopenharmony_ci#define GPIO_SDLC_SCLK	GPIO_GPIO (16)	/*  SDLC Sample CLocK (I/O)        */
116762306a36Sopenharmony_ci#define GPIO_SDLC_AAF	GPIO_GPIO (17)	/*  SDLC Abort After Frame (O)     */
116862306a36Sopenharmony_ci#define GPIO_UART_SCLK1	GPIO_GPIO (18)	/*  UART Sample CLocK 1 (I)        */
116962306a36Sopenharmony_ci                	        	/* ser. port 4:                    */
117062306a36Sopenharmony_ci#define GPIO_SSP_CLK	GPIO_GPIO (19)	/*  SSP external CLocK (I)         */
117162306a36Sopenharmony_ci                	        	/* ser. port 3:                    */
117262306a36Sopenharmony_ci#define GPIO_UART_SCLK3	GPIO_GPIO (20)	/*  UART Sample CLocK 3 (I)        */
117362306a36Sopenharmony_ci                	        	/* ser. port 4:                    */
117462306a36Sopenharmony_ci#define GPIO_MCP_CLK	GPIO_GPIO (21)	/*  MCP CLocK (I)                  */
117562306a36Sopenharmony_ci                	        	/* test controller:                */
117662306a36Sopenharmony_ci#define GPIO_TIC_ACK	GPIO_GPIO (21)	/*  TIC ACKnowledge (O)            */
117762306a36Sopenharmony_ci#define GPIO_MBGNT	GPIO_GPIO (21)	/*  Memory Bus GraNT (O)           */
117862306a36Sopenharmony_ci#define GPIO_TREQA	GPIO_GPIO (22)	/*  TIC REQuest A (I)              */
117962306a36Sopenharmony_ci#define GPIO_MBREQ	GPIO_GPIO (22)	/*  Memory Bus REQuest (I)         */
118062306a36Sopenharmony_ci#define GPIO_TREQB	GPIO_GPIO (23)	/*  TIC REQuest B (I)              */
118162306a36Sopenharmony_ci#define GPIO_1Hz	GPIO_GPIO (25)	/* 1 Hz clock (O)                  */
118262306a36Sopenharmony_ci#define GPIO_RCLK	GPIO_GPIO (26)	/* internal (R) CLocK (O, fcpu/2)  */
118362306a36Sopenharmony_ci#define GPIO_32_768kHz	GPIO_GPIO (27)	/* 32.768 kHz clock (O, RTC)       */
118462306a36Sopenharmony_ci
118562306a36Sopenharmony_ci#define GPDR_In 	0       	/* Input                           */
118662306a36Sopenharmony_ci#define GPDR_Out	1       	/* Output                          */
118762306a36Sopenharmony_ci
118862306a36Sopenharmony_ci
118962306a36Sopenharmony_ci/*
119062306a36Sopenharmony_ci * Interrupt Controller (IC) control registers
119162306a36Sopenharmony_ci *
119262306a36Sopenharmony_ci * Registers
119362306a36Sopenharmony_ci *    ICIP      	Interrupt Controller (IC) Interrupt ReQuest (IRQ)
119462306a36Sopenharmony_ci *              	Pending register (read).
119562306a36Sopenharmony_ci *    ICMR      	Interrupt Controller (IC) Mask Register (read/write).
119662306a36Sopenharmony_ci *    ICLR      	Interrupt Controller (IC) Level Register (read/write).
119762306a36Sopenharmony_ci *    ICCR      	Interrupt Controller (IC) Control Register
119862306a36Sopenharmony_ci *              	(read/write).
119962306a36Sopenharmony_ci *              	[The ICCR register is only implemented in versions 2.0
120062306a36Sopenharmony_ci *              	(rev. = 8) and higher of the StrongARM SA-1100.]
120162306a36Sopenharmony_ci *    ICFP      	Interrupt Controller (IC) Fast Interrupt reQuest
120262306a36Sopenharmony_ci *              	(FIQ) Pending register (read).
120362306a36Sopenharmony_ci *    ICPR      	Interrupt Controller (IC) Pending Register (read).
120462306a36Sopenharmony_ci *              	[The ICPR register is active low (inverted) in
120562306a36Sopenharmony_ci *              	versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
120662306a36Sopenharmony_ci *              	StrongARM SA-1100, it is active high (non-inverted) in
120762306a36Sopenharmony_ci *              	versions 2.0 (rev. = 8) and higher.]
120862306a36Sopenharmony_ci */
120962306a36Sopenharmony_ci
121062306a36Sopenharmony_ci#define ICIP		__REG(0x90050000)  /* IC IRQ Pending reg.             */
121162306a36Sopenharmony_ci#define ICMR		__REG(0x90050004)  /* IC Mask Reg.                    */
121262306a36Sopenharmony_ci#define ICLR		__REG(0x90050008)  /* IC Level Reg.                   */
121362306a36Sopenharmony_ci#define ICCR		__REG(0x9005000C)  /* IC Control Reg.                 */
121462306a36Sopenharmony_ci#define ICFP		__REG(0x90050010)  /* IC FIQ Pending reg.             */
121562306a36Sopenharmony_ci#define ICPR		__REG(0x90050020)  /* IC Pending Reg.                 */
121662306a36Sopenharmony_ci
121762306a36Sopenharmony_ci#define IC_GPIO(Nb)	        	/* GPIO [0..10]                    */ \
121862306a36Sopenharmony_ci                	(0x00000001 << (Nb))
121962306a36Sopenharmony_ci#define IC_GPIO0	IC_GPIO (0)	/* GPIO  [0]                       */
122062306a36Sopenharmony_ci#define IC_GPIO1	IC_GPIO (1)	/* GPIO  [1]                       */
122162306a36Sopenharmony_ci#define IC_GPIO2	IC_GPIO (2)	/* GPIO  [2]                       */
122262306a36Sopenharmony_ci#define IC_GPIO3	IC_GPIO (3)	/* GPIO  [3]                       */
122362306a36Sopenharmony_ci#define IC_GPIO4	IC_GPIO (4)	/* GPIO  [4]                       */
122462306a36Sopenharmony_ci#define IC_GPIO5	IC_GPIO (5)	/* GPIO  [5]                       */
122562306a36Sopenharmony_ci#define IC_GPIO6	IC_GPIO (6)	/* GPIO  [6]                       */
122662306a36Sopenharmony_ci#define IC_GPIO7	IC_GPIO (7)	/* GPIO  [7]                       */
122762306a36Sopenharmony_ci#define IC_GPIO8	IC_GPIO (8)	/* GPIO  [8]                       */
122862306a36Sopenharmony_ci#define IC_GPIO9	IC_GPIO (9)	/* GPIO  [9]                       */
122962306a36Sopenharmony_ci#define IC_GPIO10	IC_GPIO (10)	/* GPIO [10]                       */
123062306a36Sopenharmony_ci#define IC_GPIO11_27	0x00000800	/* GPIO [11:27] (ORed)             */
123162306a36Sopenharmony_ci#define IC_LCD  	0x00001000	/* LCD controller                  */
123262306a36Sopenharmony_ci#define IC_Ser0UDC	0x00002000	/* Ser. port 0 UDC                 */
123362306a36Sopenharmony_ci#define IC_Ser1SDLC	0x00004000	/* Ser. port 1 SDLC                */
123462306a36Sopenharmony_ci#define IC_Ser1UART	0x00008000	/* Ser. port 1 UART                */
123562306a36Sopenharmony_ci#define IC_Ser2ICP	0x00010000	/* Ser. port 2 ICP                 */
123662306a36Sopenharmony_ci#define IC_Ser3UART	0x00020000	/* Ser. port 3 UART                */
123762306a36Sopenharmony_ci#define IC_Ser4MCP	0x00040000	/* Ser. port 4 MCP                 */
123862306a36Sopenharmony_ci#define IC_Ser4SSP	0x00080000	/* Ser. port 4 SSP                 */
123962306a36Sopenharmony_ci#define IC_DMA(Nb)	        	/* DMA controller channel [0..5]   */ \
124062306a36Sopenharmony_ci                	(0x00100000 << (Nb))
124162306a36Sopenharmony_ci#define IC_DMA0 	IC_DMA (0)	/* DMA controller channel 0        */
124262306a36Sopenharmony_ci#define IC_DMA1 	IC_DMA (1)	/* DMA controller channel 1        */
124362306a36Sopenharmony_ci#define IC_DMA2 	IC_DMA (2)	/* DMA controller channel 2        */
124462306a36Sopenharmony_ci#define IC_DMA3 	IC_DMA (3)	/* DMA controller channel 3        */
124562306a36Sopenharmony_ci#define IC_DMA4 	IC_DMA (4)	/* DMA controller channel 4        */
124662306a36Sopenharmony_ci#define IC_DMA5 	IC_DMA (5)	/* DMA controller channel 5        */
124762306a36Sopenharmony_ci#define IC_OST(Nb)	        	/* OS Timer match [0..3]           */ \
124862306a36Sopenharmony_ci                	(0x04000000 << (Nb))
124962306a36Sopenharmony_ci#define IC_OST0 	IC_OST (0)	/* OS Timer match 0                */
125062306a36Sopenharmony_ci#define IC_OST1 	IC_OST (1)	/* OS Timer match 1                */
125162306a36Sopenharmony_ci#define IC_OST2 	IC_OST (2)	/* OS Timer match 2                */
125262306a36Sopenharmony_ci#define IC_OST3 	IC_OST (3)	/* OS Timer match 3                */
125362306a36Sopenharmony_ci#define IC_RTC1Hz	0x40000000	/* RTC 1 Hz clock                  */
125462306a36Sopenharmony_ci#define IC_RTCAlrm	0x80000000	/* RTC Alarm                       */
125562306a36Sopenharmony_ci
125662306a36Sopenharmony_ci#define ICLR_IRQ	0       	/* Interrupt ReQuest               */
125762306a36Sopenharmony_ci#define ICLR_FIQ	1       	/* Fast Interrupt reQuest          */
125862306a36Sopenharmony_ci
125962306a36Sopenharmony_ci#define ICCR_DIM	0x00000001	/* Disable Idle-mode interrupt     */
126062306a36Sopenharmony_ci                	        	/* Mask                            */
126162306a36Sopenharmony_ci#define ICCR_IdleAllInt	(ICCR_DIM*0)	/*  Idle-mode All Interrupt enable */
126262306a36Sopenharmony_ci                	        	/*  (ICMR ignored)                 */
126362306a36Sopenharmony_ci#define ICCR_IdleMskInt	(ICCR_DIM*1)	/*  Idle-mode non-Masked Interrupt */
126462306a36Sopenharmony_ci                	        	/*  enable (ICMR used)             */
126562306a36Sopenharmony_ci
126662306a36Sopenharmony_ci
126762306a36Sopenharmony_ci/*
126862306a36Sopenharmony_ci * Peripheral Pin Controller (PPC) control registers
126962306a36Sopenharmony_ci *
127062306a36Sopenharmony_ci * Registers
127162306a36Sopenharmony_ci *    PPDR      	Peripheral Pin Controller (PPC) Pin Direction
127262306a36Sopenharmony_ci *              	Register (read/write).
127362306a36Sopenharmony_ci *    PPSR      	Peripheral Pin Controller (PPC) Pin State Register
127462306a36Sopenharmony_ci *              	(read/write).
127562306a36Sopenharmony_ci *    PPAR      	Peripheral Pin Controller (PPC) Pin Assignment
127662306a36Sopenharmony_ci *              	Register (read/write).
127762306a36Sopenharmony_ci *    PSDR      	Peripheral Pin Controller (PPC) Sleep-mode pin
127862306a36Sopenharmony_ci *              	Direction Register (read/write).
127962306a36Sopenharmony_ci *    PPFR      	Peripheral Pin Controller (PPC) Pin Flag Register
128062306a36Sopenharmony_ci *              	(read).
128162306a36Sopenharmony_ci */
128262306a36Sopenharmony_ci
128362306a36Sopenharmony_ci#define PPDR		__REG(0x90060000)  /* PPC Pin Direction Reg.          */
128462306a36Sopenharmony_ci#define PPSR		__REG(0x90060004)  /* PPC Pin State Reg.              */
128562306a36Sopenharmony_ci#define PPAR		__REG(0x90060008)  /* PPC Pin Assignment Reg.         */
128662306a36Sopenharmony_ci#define PSDR		__REG(0x9006000C)  /* PPC Sleep-mode pin Direction Reg. */
128762306a36Sopenharmony_ci#define PPFR		__REG(0x90060010)  /* PPC Pin Flag Reg.               */
128862306a36Sopenharmony_ci
128962306a36Sopenharmony_ci#define PPC_LDD(Nb)	        	/* LCD Data [0..7]                 */ \
129062306a36Sopenharmony_ci                	(0x00000001 << (Nb))
129162306a36Sopenharmony_ci#define PPC_LDD0	PPC_LDD (0)	/* LCD Data [0]                    */
129262306a36Sopenharmony_ci#define PPC_LDD1	PPC_LDD (1)	/* LCD Data [1]                    */
129362306a36Sopenharmony_ci#define PPC_LDD2	PPC_LDD (2)	/* LCD Data [2]                    */
129462306a36Sopenharmony_ci#define PPC_LDD3	PPC_LDD (3)	/* LCD Data [3]                    */
129562306a36Sopenharmony_ci#define PPC_LDD4	PPC_LDD (4)	/* LCD Data [4]                    */
129662306a36Sopenharmony_ci#define PPC_LDD5	PPC_LDD (5)	/* LCD Data [5]                    */
129762306a36Sopenharmony_ci#define PPC_LDD6	PPC_LDD (6)	/* LCD Data [6]                    */
129862306a36Sopenharmony_ci#define PPC_LDD7	PPC_LDD (7)	/* LCD Data [7]                    */
129962306a36Sopenharmony_ci#define PPC_L_PCLK	0x00000100	/* LCD Pixel CLocK                 */
130062306a36Sopenharmony_ci#define PPC_L_LCLK	0x00000200	/* LCD Line CLocK                  */
130162306a36Sopenharmony_ci#define PPC_L_FCLK	0x00000400	/* LCD Frame CLocK                 */
130262306a36Sopenharmony_ci#define PPC_L_BIAS	0x00000800	/* LCD AC BIAS                     */
130362306a36Sopenharmony_ci                	        	/* ser. port 1:                    */
130462306a36Sopenharmony_ci#define PPC_TXD1	0x00001000	/*  SDLC/UART Transmit Data 1      */
130562306a36Sopenharmony_ci#define PPC_RXD1	0x00002000	/*  SDLC/UART Receive Data 1       */
130662306a36Sopenharmony_ci                	        	/* ser. port 2:                    */
130762306a36Sopenharmony_ci#define PPC_TXD2	0x00004000	/*  IPC Transmit Data 2            */
130862306a36Sopenharmony_ci#define PPC_RXD2	0x00008000	/*  IPC Receive Data 2             */
130962306a36Sopenharmony_ci                	        	/* ser. port 3:                    */
131062306a36Sopenharmony_ci#define PPC_TXD3	0x00010000	/*  UART Transmit Data 3           */
131162306a36Sopenharmony_ci#define PPC_RXD3	0x00020000	/*  UART Receive Data 3            */
131262306a36Sopenharmony_ci                	        	/* ser. port 4:                    */
131362306a36Sopenharmony_ci#define PPC_TXD4	0x00040000	/*  MCP/SSP Transmit Data 4        */
131462306a36Sopenharmony_ci#define PPC_RXD4	0x00080000	/*  MCP/SSP Receive Data 4         */
131562306a36Sopenharmony_ci#define PPC_SCLK	0x00100000	/*  MCP/SSP Sample CLocK           */
131662306a36Sopenharmony_ci#define PPC_SFRM	0x00200000	/*  MCP/SSP Sample FRaMe           */
131762306a36Sopenharmony_ci
131862306a36Sopenharmony_ci#define PPDR_In 	0       	/* Input                           */
131962306a36Sopenharmony_ci#define PPDR_Out	1       	/* Output                          */
132062306a36Sopenharmony_ci
132162306a36Sopenharmony_ci                	        	/* ser. port 1:                    */
132262306a36Sopenharmony_ci#define PPAR_UPR	0x00001000	/*  UART Pin Reassignment          */
132362306a36Sopenharmony_ci#define PPAR_UARTTR	(PPAR_UPR*0)	/*   UART on TXD_1 & RXD_1         */
132462306a36Sopenharmony_ci#define PPAR_UARTGPIO	(PPAR_UPR*1)	/*   UART on GPIO [14:15]          */
132562306a36Sopenharmony_ci                	        	/* ser. port 4:                    */
132662306a36Sopenharmony_ci#define PPAR_SPR	0x00040000	/*  SSP Pin Reassignment           */
132762306a36Sopenharmony_ci#define PPAR_SSPTRSS	(PPAR_SPR*0)	/*   SSP on TXD_C, RXD_C, SCLK_C,  */
132862306a36Sopenharmony_ci                	        	/*   & SFRM_C                      */
132962306a36Sopenharmony_ci#define PPAR_SSPGPIO	(PPAR_SPR*1)	/*   SSP on GPIO [10:13]           */
133062306a36Sopenharmony_ci
133162306a36Sopenharmony_ci#define PSDR_OutL	0       	/* Output Low in sleep mode        */
133262306a36Sopenharmony_ci#define PSDR_Flt	1       	/* Floating (input) in sleep mode  */
133362306a36Sopenharmony_ci
133462306a36Sopenharmony_ci#define PPFR_LCD	0x00000001	/* LCD controller                  */
133562306a36Sopenharmony_ci#define PPFR_SP1TX	0x00001000	/* Ser. Port 1 SDLC/UART Transmit  */
133662306a36Sopenharmony_ci#define PPFR_SP1RX	0x00002000	/* Ser. Port 1 SDLC/UART Receive   */
133762306a36Sopenharmony_ci#define PPFR_SP2TX	0x00004000	/* Ser. Port 2 ICP Transmit        */
133862306a36Sopenharmony_ci#define PPFR_SP2RX	0x00008000	/* Ser. Port 2 ICP Receive         */
133962306a36Sopenharmony_ci#define PPFR_SP3TX	0x00010000	/* Ser. Port 3 UART Transmit       */
134062306a36Sopenharmony_ci#define PPFR_SP3RX	0x00020000	/* Ser. Port 3 UART Receive        */
134162306a36Sopenharmony_ci#define PPFR_SP4	0x00040000	/* Ser. Port 4 MCP/SSP             */
134262306a36Sopenharmony_ci#define PPFR_PerEn	0       	/* Peripheral Enabled              */
134362306a36Sopenharmony_ci#define PPFR_PPCEn	1       	/* PPC Enabled                     */
134462306a36Sopenharmony_ci
134562306a36Sopenharmony_ci
134662306a36Sopenharmony_ci/*
134762306a36Sopenharmony_ci * Dynamic Random-Access Memory (DRAM) control registers
134862306a36Sopenharmony_ci *
134962306a36Sopenharmony_ci * Registers
135062306a36Sopenharmony_ci *    MDCNFG    	Memory system: Dynamic Random-Access Memory (DRAM)
135162306a36Sopenharmony_ci *              	CoNFiGuration register (read/write).
135262306a36Sopenharmony_ci *    MDCAS0    	Memory system: Dynamic Random-Access Memory (DRAM)
135362306a36Sopenharmony_ci *              	Column Address Strobe (CAS) shift register 0
135462306a36Sopenharmony_ci *              	(read/write).
135562306a36Sopenharmony_ci *    MDCAS1    	Memory system: Dynamic Random-Access Memory (DRAM)
135662306a36Sopenharmony_ci *              	Column Address Strobe (CAS) shift register 1
135762306a36Sopenharmony_ci *              	(read/write).
135862306a36Sopenharmony_ci *    MDCAS2    	Memory system: Dynamic Random-Access Memory (DRAM)
135962306a36Sopenharmony_ci *              	Column Address Strobe (CAS) shift register 2
136062306a36Sopenharmony_ci *              	(read/write).
136162306a36Sopenharmony_ci *
136262306a36Sopenharmony_ci * Clocks
136362306a36Sopenharmony_ci *    fcpu, Tcpu	Frequency, period of the CPU core clock (CCLK).
136462306a36Sopenharmony_ci *    fmem, Tmem	Frequency, period of the memory clock (fmem = fcpu/2).
136562306a36Sopenharmony_ci *    fcas, Tcas	Frequency, period of the DRAM CAS shift registers.
136662306a36Sopenharmony_ci */
136762306a36Sopenharmony_ci
136862306a36Sopenharmony_ci#define MDCNFG		__REG(0xA0000000)  /*  DRAM CoNFiGuration reg. */
136962306a36Sopenharmony_ci#define MDCAS0		__REG(0xA0000004)  /* DRAM CAS shift reg. 0 */
137062306a36Sopenharmony_ci#define MDCAS1		__REG(0xA0000008)  /* DRAM CAS shift reg. 1 */
137162306a36Sopenharmony_ci#define MDCAS2		__REG(0xA000000c)  /* DRAM CAS shift reg. 2 */
137262306a36Sopenharmony_ci
137362306a36Sopenharmony_ci/* SA1100 MDCNFG values */
137462306a36Sopenharmony_ci#define MDCNFG_DE(Nb)	        	/* DRAM Enable bank [0..3]         */ \
137562306a36Sopenharmony_ci                	(0x00000001 << (Nb))
137662306a36Sopenharmony_ci#define MDCNFG_DE0	MDCNFG_DE (0)	/* DRAM Enable bank 0              */
137762306a36Sopenharmony_ci#define MDCNFG_DE1	MDCNFG_DE (1)	/* DRAM Enable bank 1              */
137862306a36Sopenharmony_ci#define MDCNFG_DE2	MDCNFG_DE (2)	/* DRAM Enable bank 2              */
137962306a36Sopenharmony_ci#define MDCNFG_DE3	MDCNFG_DE (3)	/* DRAM Enable bank 3              */
138062306a36Sopenharmony_ci#define MDCNFG_DRAC	Fld (2, 4)	/* DRAM Row Address Count - 9      */
138162306a36Sopenharmony_ci#define MDCNFG_RowAdd(Add)      	/*  Row Address count [9..12]      */ \
138262306a36Sopenharmony_ci                	(((Add) - 9) << FShft (MDCNFG_DRAC))
138362306a36Sopenharmony_ci#define MDCNFG_CDB2	0x00000040	/* shift reg. Clock Divide By 2    */
138462306a36Sopenharmony_ci                	        	/* (fcas = fcpu/2)                 */
138562306a36Sopenharmony_ci#define MDCNFG_TRP	Fld (4, 7)	/* Time RAS Pre-charge - 1 [Tmem]  */
138662306a36Sopenharmony_ci#define MDCNFG_PrChrg(Tcpu)     	/*  Pre-Charge time [2..32 Tcpu]   */ \
138762306a36Sopenharmony_ci                	(((Tcpu) - 2)/2 << FShft (MDCNFG_TRP))
138862306a36Sopenharmony_ci#define MDCNFG_CeilPrChrg(Tcpu) 	/*  Ceil. of PrChrg [2..32 Tcpu]   */ \
138962306a36Sopenharmony_ci                	(((Tcpu) - 1)/2 << FShft (MDCNFG_TRP))
139062306a36Sopenharmony_ci#define MDCNFG_TRASR	Fld (4, 11)	/* Time RAS Refresh - 1 [Tmem]     */
139162306a36Sopenharmony_ci#define MDCNFG_Ref(Tcpu)        	/*  Refresh time [2..32 Tcpu]      */ \
139262306a36Sopenharmony_ci                	(((Tcpu) - 2)/2 << FShft (MDCNFG_TRASR))
139362306a36Sopenharmony_ci#define MDCNFG_CeilRef(Tcpu)    	/*  Ceil. of Ref [2..32 Tcpu]      */ \
139462306a36Sopenharmony_ci                	(((Tcpu) - 1)/2 << FShft (MDCNFG_TRASR))
139562306a36Sopenharmony_ci#define MDCNFG_TDL	Fld (2, 15)	/* Time Data Latch [Tcpu]          */
139662306a36Sopenharmony_ci#define MDCNFG_DataLtch(Tcpu)   	/*  Data Latch delay [0..3 Tcpu]   */ \
139762306a36Sopenharmony_ci                	((Tcpu) << FShft (MDCNFG_TDL))
139862306a36Sopenharmony_ci#define MDCNFG_DRI	Fld (15, 17)	/* min. DRAM Refresh Interval/4    */
139962306a36Sopenharmony_ci                	        	/* [Tmem]                          */
140062306a36Sopenharmony_ci#define MDCNFG_RefInt(Tcpu)     	/*  min. Refresh Interval          */ \
140162306a36Sopenharmony_ci                	        	/*  [0..262136 Tcpu]               */ \
140262306a36Sopenharmony_ci                	((Tcpu)/8 << FShft (MDCNFG_DRI))
140362306a36Sopenharmony_ci
140462306a36Sopenharmony_ci/* SA1110 MDCNFG values */
140562306a36Sopenharmony_ci#define MDCNFG_SA1110_DE0	0x00000001	/* DRAM Enable bank 0        */
140662306a36Sopenharmony_ci#define MDCNFG_SA1110_DE1	0x00000002 	/* DRAM Enable bank 1        */
140762306a36Sopenharmony_ci#define MDCNFG_SA1110_DTIM0	0x00000004	/* DRAM timing type 0/1      */
140862306a36Sopenharmony_ci#define MDCNFG_SA1110_DWID0	0x00000008	/* DRAM bus width 0/1        */
140962306a36Sopenharmony_ci#define MDCNFG_SA1110_DRAC0	Fld(3, 4)	/* DRAM row addr bit count   */
141062306a36Sopenharmony_ci                	        		/* bank 0/1                  */
141162306a36Sopenharmony_ci#define MDCNFG_SA1110_CDB20	0x00000080	/* Mem Clock divide by 2 0/1 */
141262306a36Sopenharmony_ci#define MDCNFG_SA1110_TRP0	Fld(3, 8)	/* RAS precharge 0/1         */
141362306a36Sopenharmony_ci#define MDCNFG_SA1110_TDL0	Fld(2, 12)	/* Data input latch after CAS*/
141462306a36Sopenharmony_ci                	        		/* deassertion 0/1           */
141562306a36Sopenharmony_ci#define MDCNFG_SA1110_TWR0	Fld(2, 14)	/* SDRAM write recovery 0/1  */
141662306a36Sopenharmony_ci#define MDCNFG_SA1110_DE2	0x00010000	/* DRAM Enable bank 0        */
141762306a36Sopenharmony_ci#define MDCNFG_SA1110_DE3	0x00020000 	/* DRAM Enable bank 1        */
141862306a36Sopenharmony_ci#define MDCNFG_SA1110_DTIM2	0x00040000	/* DRAM timing type 0/1      */
141962306a36Sopenharmony_ci#define MDCNFG_SA1110_DWID2	0x00080000	/* DRAM bus width 0/1        */
142062306a36Sopenharmony_ci#define MDCNFG_SA1110_DRAC2	Fld(3, 20)	/* DRAM row addr bit count   */
142162306a36Sopenharmony_ci                	        		/* bank 0/1                  */
142262306a36Sopenharmony_ci#define MDCNFG_SA1110_CDB22	0x00800000	/* Mem Clock divide by 2 0/1 */
142362306a36Sopenharmony_ci#define MDCNFG_SA1110_TRP2	Fld(3, 24)	/* RAS precharge 0/1         */
142462306a36Sopenharmony_ci#define MDCNFG_SA1110_TDL2	Fld(2, 28)	/* Data input latch after CAS*/
142562306a36Sopenharmony_ci                	        		/* deassertion 0/1           */
142662306a36Sopenharmony_ci#define MDCNFG_SA1110_TWR2	Fld(2, 30)	/* SDRAM write recovery 0/1  */
142762306a36Sopenharmony_ci
142862306a36Sopenharmony_ci
142962306a36Sopenharmony_ci/*
143062306a36Sopenharmony_ci * Static memory control registers
143162306a36Sopenharmony_ci *
143262306a36Sopenharmony_ci * Registers
143362306a36Sopenharmony_ci *    MSC0      	Memory system: Static memory Control register 0
143462306a36Sopenharmony_ci *              	(read/write).
143562306a36Sopenharmony_ci *    MSC1      	Memory system: Static memory Control register 1
143662306a36Sopenharmony_ci *              	(read/write).
143762306a36Sopenharmony_ci *
143862306a36Sopenharmony_ci * Clocks
143962306a36Sopenharmony_ci *    fcpu, Tcpu	Frequency, period of the CPU core clock (CCLK).
144062306a36Sopenharmony_ci *    fmem, Tmem	Frequency, period of the memory clock (fmem = fcpu/2).
144162306a36Sopenharmony_ci */
144262306a36Sopenharmony_ci
144362306a36Sopenharmony_ci#define MSC0		__REG(0xa0000010)  /* Static memory Control reg. 0 */
144462306a36Sopenharmony_ci#define MSC1		__REG(0xa0000014)  /* Static memory Control reg. 1 */
144562306a36Sopenharmony_ci#define MSC2		__REG(0xa000002c)  /* Static memory Control reg. 2, not contiguous   */
144662306a36Sopenharmony_ci
144762306a36Sopenharmony_ci#define MSC_Bnk(Nb)	        	/* static memory Bank [0..3]       */ \
144862306a36Sopenharmony_ci                	Fld (16, ((Nb) Modulo 2)*16)
144962306a36Sopenharmony_ci#define MSC0_Bnk0	MSC_Bnk (0)	/* static memory Bank 0            */
145062306a36Sopenharmony_ci#define MSC0_Bnk1	MSC_Bnk (1)	/* static memory Bank 1            */
145162306a36Sopenharmony_ci#define MSC1_Bnk2	MSC_Bnk (2)	/* static memory Bank 2            */
145262306a36Sopenharmony_ci#define MSC1_Bnk3	MSC_Bnk (3)	/* static memory Bank 3            */
145362306a36Sopenharmony_ci
145462306a36Sopenharmony_ci#define MSC_RT  	Fld (2, 0)	/* ROM/static memory Type          */
145562306a36Sopenharmony_ci#define MSC_NonBrst	        	/*  Non-Burst static memory        */ \
145662306a36Sopenharmony_ci                	(0 << FShft (MSC_RT))
145762306a36Sopenharmony_ci#define MSC_SRAM	        	/*  32-bit byte-writable SRAM      */ \
145862306a36Sopenharmony_ci                	(1 << FShft (MSC_RT))
145962306a36Sopenharmony_ci#define MSC_Brst4	        	/*  Burst-of-4 static memory       */ \
146062306a36Sopenharmony_ci                	(2 << FShft (MSC_RT))
146162306a36Sopenharmony_ci#define MSC_Brst8	        	/*  Burst-of-8 static memory       */ \
146262306a36Sopenharmony_ci                	(3 << FShft (MSC_RT))
146362306a36Sopenharmony_ci#define MSC_RBW 	0x0004  	/* ROM/static memory Bus Width     */
146462306a36Sopenharmony_ci#define MSC_32BitStMem	(MSC_RBW*0)	/*  32-Bit Static Memory           */
146562306a36Sopenharmony_ci#define MSC_16BitStMem	(MSC_RBW*1)	/*  16-Bit Static Memory           */
146662306a36Sopenharmony_ci#define MSC_RDF 	Fld (5, 3)	/* ROM/static memory read Delay    */
146762306a36Sopenharmony_ci                	        	/* First access - 1(.5) [Tmem]     */
146862306a36Sopenharmony_ci#define MSC_1stRdAcc(Tcpu)      	/*  1st Read Access time (burst    */ \
146962306a36Sopenharmony_ci                	        	/*  static memory) [3..65 Tcpu]    */ \
147062306a36Sopenharmony_ci                	((((Tcpu) - 3)/2) << FShft (MSC_RDF))
147162306a36Sopenharmony_ci#define MSC_Ceil1stRdAcc(Tcpu)  	/*  Ceil. of 1stRdAcc [3..65 Tcpu] */ \
147262306a36Sopenharmony_ci                	((((Tcpu) - 2)/2) << FShft (MSC_RDF))
147362306a36Sopenharmony_ci#define MSC_RdAcc(Tcpu)	        	/*  Read Access time (non-burst    */ \
147462306a36Sopenharmony_ci                	        	/*  static memory) [2..64 Tcpu]    */ \
147562306a36Sopenharmony_ci                	((((Tcpu) - 2)/2) << FShft (MSC_RDF))
147662306a36Sopenharmony_ci#define MSC_CeilRdAcc(Tcpu)     	/*  Ceil. of RdAcc [2..64 Tcpu]    */ \
147762306a36Sopenharmony_ci                	((((Tcpu) - 1)/2) << FShft (MSC_RDF))
147862306a36Sopenharmony_ci#define MSC_RDN 	Fld (5, 8)	/* ROM/static memory read Delay    */
147962306a36Sopenharmony_ci                	        	/* Next access - 1 [Tmem]          */
148062306a36Sopenharmony_ci#define MSC_NxtRdAcc(Tcpu)      	/*  Next Read Access time (burst   */ \
148162306a36Sopenharmony_ci                	        	/*  static memory) [2..64 Tcpu]    */ \
148262306a36Sopenharmony_ci                	((((Tcpu) - 2)/2) << FShft (MSC_RDN))
148362306a36Sopenharmony_ci#define MSC_CeilNxtRdAcc(Tcpu)  	/*  Ceil. of NxtRdAcc [2..64 Tcpu] */ \
148462306a36Sopenharmony_ci                	((((Tcpu) - 1)/2) << FShft (MSC_RDN))
148562306a36Sopenharmony_ci#define MSC_WrAcc(Tcpu)	        	/*  Write Access time (non-burst   */ \
148662306a36Sopenharmony_ci                	        	/*  static memory) [2..64 Tcpu]    */ \
148762306a36Sopenharmony_ci                	((((Tcpu) - 2)/2) << FShft (MSC_RDN))
148862306a36Sopenharmony_ci#define MSC_CeilWrAcc(Tcpu)     	/*  Ceil. of WrAcc [2..64 Tcpu]    */ \
148962306a36Sopenharmony_ci                	((((Tcpu) - 1)/2) << FShft (MSC_RDN))
149062306a36Sopenharmony_ci#define MSC_RRR 	Fld (3, 13)	/* ROM/static memory RecoveRy      */
149162306a36Sopenharmony_ci                	        	/* time/2 [Tmem]                   */
149262306a36Sopenharmony_ci#define MSC_Rec(Tcpu)	        	/*  Recovery time [0..28 Tcpu]     */ \
149362306a36Sopenharmony_ci                	(((Tcpu)/4) << FShft (MSC_RRR))
149462306a36Sopenharmony_ci#define MSC_CeilRec(Tcpu)       	/*  Ceil. of Rec [0..28 Tcpu]      */ \
149562306a36Sopenharmony_ci                	((((Tcpu) + 3)/4) << FShft (MSC_RRR))
149662306a36Sopenharmony_ci
149762306a36Sopenharmony_ci
149862306a36Sopenharmony_ci/*
149962306a36Sopenharmony_ci * Personal Computer Memory Card International Association (PCMCIA) control
150062306a36Sopenharmony_ci * register
150162306a36Sopenharmony_ci *
150262306a36Sopenharmony_ci * Register
150362306a36Sopenharmony_ci *    MECR      	Memory system: Expansion memory bus (PCMCIA)
150462306a36Sopenharmony_ci *              	Configuration Register (read/write).
150562306a36Sopenharmony_ci *
150662306a36Sopenharmony_ci * Clocks
150762306a36Sopenharmony_ci *    fcpu, Tcpu	Frequency, period of the CPU core clock (CCLK).
150862306a36Sopenharmony_ci *    fmem, Tmem	Frequency, period of the memory clock (fmem = fcpu/2).
150962306a36Sopenharmony_ci *    fbclk, Tbclk	Frequency, period of the PCMCIA clock (BCLK).
151062306a36Sopenharmony_ci */
151162306a36Sopenharmony_ci
151262306a36Sopenharmony_ci                	        	/* Memory system:                  */
151362306a36Sopenharmony_ci#define MECR		__REG(0xA0000018)  /*  Expansion memory bus (PCMCIA) Configuration Reg.             */
151462306a36Sopenharmony_ci
151562306a36Sopenharmony_ci#define MECR_PCMCIA(Nb)	        	/* PCMCIA [0..1]                   */ \
151662306a36Sopenharmony_ci                	Fld (15, (Nb)*16)
151762306a36Sopenharmony_ci#define MECR_PCMCIA0	MECR_PCMCIA (0)	/* PCMCIA 0                        */
151862306a36Sopenharmony_ci#define MECR_PCMCIA1	MECR_PCMCIA (1)	/* PCMCIA 1                        */
151962306a36Sopenharmony_ci
152062306a36Sopenharmony_ci#define MECR_BSIO	Fld (5, 0)	/* BCLK Select I/O - 1 [Tmem]      */
152162306a36Sopenharmony_ci#define MECR_IOClk(Tcpu)        	/*  I/O Clock [2..64 Tcpu]         */ \
152262306a36Sopenharmony_ci                	((((Tcpu) - 2)/2) << FShft (MECR_BSIO))
152362306a36Sopenharmony_ci#define MECR_CeilIOClk(Tcpu)    	/*  Ceil. of IOClk [2..64 Tcpu]    */ \
152462306a36Sopenharmony_ci                	((((Tcpu) - 1)/2) << FShft (MECR_BSIO))
152562306a36Sopenharmony_ci#define MECR_BSA	Fld (5, 5)	/* BCLK Select Attribute - 1       */
152662306a36Sopenharmony_ci                	        	/* [Tmem]                          */
152762306a36Sopenharmony_ci#define MECR_AttrClk(Tcpu)      	/*  Attribute Clock [2..64 Tcpu]   */ \
152862306a36Sopenharmony_ci                	((((Tcpu) - 2)/2) << FShft (MECR_BSA))
152962306a36Sopenharmony_ci#define MECR_CeilAttrClk(Tcpu)  	/*  Ceil. of AttrClk [2..64 Tcpu]  */ \
153062306a36Sopenharmony_ci                	((((Tcpu) - 1)/2) << FShft (MECR_BSA))
153162306a36Sopenharmony_ci#define MECR_BSM	Fld (5, 10)	/* BCLK Select Memory - 1 [Tmem]   */
153262306a36Sopenharmony_ci#define MECR_MemClk(Tcpu)       	/*  Memory Clock [2..64 Tcpu]      */ \
153362306a36Sopenharmony_ci                	((((Tcpu) - 2)/2) << FShft (MECR_BSM))
153462306a36Sopenharmony_ci#define MECR_CeilMemClk(Tcpu)   	/*  Ceil. of MemClk [2..64 Tcpu]   */ \
153562306a36Sopenharmony_ci                	((((Tcpu) - 1)/2) << FShft (MECR_BSM))
153662306a36Sopenharmony_ci
153762306a36Sopenharmony_ci/*
153862306a36Sopenharmony_ci * On SA1110 only
153962306a36Sopenharmony_ci */
154062306a36Sopenharmony_ci
154162306a36Sopenharmony_ci#define MDREFR		__REG(0xA000001C)
154262306a36Sopenharmony_ci
154362306a36Sopenharmony_ci#define MDREFR_TRASR		Fld (4, 0)
154462306a36Sopenharmony_ci#define MDREFR_DRI		Fld (12, 4)
154562306a36Sopenharmony_ci#define MDREFR_E0PIN		(1 << 16)
154662306a36Sopenharmony_ci#define MDREFR_K0RUN		(1 << 17)
154762306a36Sopenharmony_ci#define MDREFR_K0DB2		(1 << 18)
154862306a36Sopenharmony_ci#define MDREFR_E1PIN		(1 << 20)
154962306a36Sopenharmony_ci#define MDREFR_K1RUN		(1 << 21)
155062306a36Sopenharmony_ci#define MDREFR_K1DB2		(1 << 22)
155162306a36Sopenharmony_ci#define MDREFR_K2RUN		(1 << 25)
155262306a36Sopenharmony_ci#define MDREFR_K2DB2		(1 << 26)
155362306a36Sopenharmony_ci#define MDREFR_EAPD		(1 << 28)
155462306a36Sopenharmony_ci#define MDREFR_KAPD		(1 << 29)
155562306a36Sopenharmony_ci#define MDREFR_SLFRSH		(1 << 31)
155662306a36Sopenharmony_ci
155762306a36Sopenharmony_ci
155862306a36Sopenharmony_ci/*
155962306a36Sopenharmony_ci * Direct Memory Access (DMA) control registers
156062306a36Sopenharmony_ci */
156162306a36Sopenharmony_ci#define DMA_SIZE	(6 * 0x20)
156262306a36Sopenharmony_ci#define DMA_PHYS	0xb0000000
156362306a36Sopenharmony_ci
156462306a36Sopenharmony_ci
156562306a36Sopenharmony_ci/*
156662306a36Sopenharmony_ci * Liquid Crystal Display (LCD) control registers
156762306a36Sopenharmony_ci *
156862306a36Sopenharmony_ci * Registers
156962306a36Sopenharmony_ci *    LCCR0     	Liquid Crystal Display (LCD) Control Register 0
157062306a36Sopenharmony_ci *              	(read/write).
157162306a36Sopenharmony_ci *              	[Bits LDM, BAM, and ERM are only implemented in
157262306a36Sopenharmony_ci *              	versions 2.0 (rev. = 8) and higher of the StrongARM
157362306a36Sopenharmony_ci *              	SA-1100.]
157462306a36Sopenharmony_ci *    LCSR      	Liquid Crystal Display (LCD) Status Register
157562306a36Sopenharmony_ci *              	(read/write).
157662306a36Sopenharmony_ci *              	[Bit LDD can be only read in versions 1.0 (rev. = 1)
157762306a36Sopenharmony_ci *              	and 1.1 (rev. = 2) of the StrongARM SA-1100, it can be
157862306a36Sopenharmony_ci *              	read and written (cleared) in versions 2.0 (rev. = 8)
157962306a36Sopenharmony_ci *              	and higher.]
158062306a36Sopenharmony_ci *    DBAR1     	Liquid Crystal Display (LCD) Direct Memory Access
158162306a36Sopenharmony_ci *              	(DMA) Base Address Register channel 1 (read/write).
158262306a36Sopenharmony_ci *    DCAR1     	Liquid Crystal Display (LCD) Direct Memory Access
158362306a36Sopenharmony_ci *              	(DMA) Current Address Register channel 1 (read).
158462306a36Sopenharmony_ci *    DBAR2     	Liquid Crystal Display (LCD) Direct Memory Access
158562306a36Sopenharmony_ci *              	(DMA) Base Address Register channel 2 (read/write).
158662306a36Sopenharmony_ci *    DCAR2     	Liquid Crystal Display (LCD) Direct Memory Access
158762306a36Sopenharmony_ci *              	(DMA) Current Address Register channel 2 (read).
158862306a36Sopenharmony_ci *    LCCR1     	Liquid Crystal Display (LCD) Control Register 1
158962306a36Sopenharmony_ci *              	(read/write).
159062306a36Sopenharmony_ci *              	[The LCCR1 register can be only written in
159162306a36Sopenharmony_ci *              	versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
159262306a36Sopenharmony_ci *              	StrongARM SA-1100, it can be written and read in
159362306a36Sopenharmony_ci *              	versions 2.0 (rev. = 8) and higher.]
159462306a36Sopenharmony_ci *    LCCR2     	Liquid Crystal Display (LCD) Control Register 2
159562306a36Sopenharmony_ci *              	(read/write).
159662306a36Sopenharmony_ci *              	[The LCCR1 register can be only written in
159762306a36Sopenharmony_ci *              	versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
159862306a36Sopenharmony_ci *              	StrongARM SA-1100, it can be written and read in
159962306a36Sopenharmony_ci *              	versions 2.0 (rev. = 8) and higher.]
160062306a36Sopenharmony_ci *    LCCR3     	Liquid Crystal Display (LCD) Control Register 3
160162306a36Sopenharmony_ci *              	(read/write).
160262306a36Sopenharmony_ci *              	[The LCCR1 register can be only written in
160362306a36Sopenharmony_ci *              	versions 1.0 (rev. = 1) and 1.1 (rev. = 2) of the
160462306a36Sopenharmony_ci *              	StrongARM SA-1100, it can be written and read in
160562306a36Sopenharmony_ci *              	versions 2.0 (rev. = 8) and higher. Bit PCP is only
160662306a36Sopenharmony_ci *              	implemented in versions 2.0 (rev. = 8) and higher of
160762306a36Sopenharmony_ci *              	the StrongARM SA-1100.]
160862306a36Sopenharmony_ci *
160962306a36Sopenharmony_ci * Clocks
161062306a36Sopenharmony_ci *    fcpu, Tcpu	Frequency, period of the CPU core clock (CCLK).
161162306a36Sopenharmony_ci *    fmem, Tmem	Frequency, period of the memory clock (fmem = fcpu/2).
161262306a36Sopenharmony_ci *    fpix, Tpix	Frequency, period of the pixel clock.
161362306a36Sopenharmony_ci *    fln, Tln  	Frequency, period of the line clock.
161462306a36Sopenharmony_ci *    fac, Tac  	Frequency, period of the AC bias clock.
161562306a36Sopenharmony_ci */
161662306a36Sopenharmony_ci
161762306a36Sopenharmony_ci#define LCD_PEntrySp	2       	/* LCD Palette Entry Space [byte]  */
161862306a36Sopenharmony_ci#define LCD_4BitPSp	        	/* LCD 4-Bit pixel Palette Space   */ \
161962306a36Sopenharmony_ci                	        	/* [byte]                          */ \
162062306a36Sopenharmony_ci                	(16*LCD_PEntrySp)
162162306a36Sopenharmony_ci#define LCD_8BitPSp	        	/* LCD 8-Bit pixel Palette Space   */ \
162262306a36Sopenharmony_ci                	        	/* [byte]                          */ \
162362306a36Sopenharmony_ci                	(256*LCD_PEntrySp)
162462306a36Sopenharmony_ci#define LCD_12_16BitPSp	        	/* LCD 12/16-Bit pixel             */ \
162562306a36Sopenharmony_ci                	        	/* dummy-Palette Space [byte]      */ \
162662306a36Sopenharmony_ci                	(16*LCD_PEntrySp)
162762306a36Sopenharmony_ci
162862306a36Sopenharmony_ci#define LCD_PGrey	Fld (4, 0)	/* LCD Palette entry Grey value    */
162962306a36Sopenharmony_ci#define LCD_PBlue	Fld (4, 0)	/* LCD Palette entry Blue value    */
163062306a36Sopenharmony_ci#define LCD_PGreen	Fld (4, 4)	/* LCD Palette entry Green value   */
163162306a36Sopenharmony_ci#define LCD_PRed	Fld (4, 8)	/* LCD Palette entry Red value     */
163262306a36Sopenharmony_ci#define LCD_PBS 	Fld (2, 12)	/* LCD Pixel Bit Size              */
163362306a36Sopenharmony_ci#define LCD_4Bit	        	/*  LCD 4-Bit pixel mode           */ \
163462306a36Sopenharmony_ci                	(0 << FShft (LCD_PBS))
163562306a36Sopenharmony_ci#define LCD_8Bit	        	/*  LCD 8-Bit pixel mode           */ \
163662306a36Sopenharmony_ci                	(1 << FShft (LCD_PBS))
163762306a36Sopenharmony_ci#define LCD_12_16Bit	        	/*  LCD 12/16-Bit pixel mode       */ \
163862306a36Sopenharmony_ci                	(2 << FShft (LCD_PBS))
163962306a36Sopenharmony_ci
164062306a36Sopenharmony_ci#define LCD_Int0_0	0x0     	/* LCD Intensity =   0.0% =  0     */
164162306a36Sopenharmony_ci#define LCD_Int11_1	0x1     	/* LCD Intensity =  11.1% =  1/9   */
164262306a36Sopenharmony_ci#define LCD_Int20_0	0x2     	/* LCD Intensity =  20.0% =  1/5   */
164362306a36Sopenharmony_ci#define LCD_Int26_7	0x3     	/* LCD Intensity =  26.7% =  4/15  */
164462306a36Sopenharmony_ci#define LCD_Int33_3	0x4     	/* LCD Intensity =  33.3% =  3/9   */
164562306a36Sopenharmony_ci#define LCD_Int40_0	0x5     	/* LCD Intensity =  40.0% =  2/5   */
164662306a36Sopenharmony_ci#define LCD_Int44_4	0x6     	/* LCD Intensity =  44.4% =  4/9   */
164762306a36Sopenharmony_ci#define LCD_Int50_0	0x7     	/* LCD Intensity =  50.0% =  1/2   */
164862306a36Sopenharmony_ci#define LCD_Int55_6	0x8     	/* LCD Intensity =  55.6% =  5/9   */
164962306a36Sopenharmony_ci#define LCD_Int60_0	0x9     	/* LCD Intensity =  60.0% =  3/5   */
165062306a36Sopenharmony_ci#define LCD_Int66_7	0xA     	/* LCD Intensity =  66.7% =  6/9   */
165162306a36Sopenharmony_ci#define LCD_Int73_3	0xB     	/* LCD Intensity =  73.3% = 11/15  */
165262306a36Sopenharmony_ci#define LCD_Int80_0	0xC     	/* LCD Intensity =  80.0% =  4/5   */
165362306a36Sopenharmony_ci#define LCD_Int88_9	0xD     	/* LCD Intensity =  88.9% =  8/9   */
165462306a36Sopenharmony_ci#define LCD_Int100_0	0xE     	/* LCD Intensity = 100.0% =  1     */
165562306a36Sopenharmony_ci#define LCD_Int100_0A	0xF     	/* LCD Intensity = 100.0% =  1     */
165662306a36Sopenharmony_ci                	        	/* (Alternative)                   */
165762306a36Sopenharmony_ci
165862306a36Sopenharmony_ci#define LCCR0_LEN	0x00000001	/* LCD ENable                      */
165962306a36Sopenharmony_ci#define LCCR0_CMS	0x00000002	/* Color/Monochrome display Select */
166062306a36Sopenharmony_ci#define LCCR0_Color	(LCCR0_CMS*0)	/*  Color display                  */
166162306a36Sopenharmony_ci#define LCCR0_Mono	(LCCR0_CMS*1)	/*  Monochrome display             */
166262306a36Sopenharmony_ci#define LCCR0_SDS	0x00000004	/* Single/Dual panel display       */
166362306a36Sopenharmony_ci                	        	/* Select                          */
166462306a36Sopenharmony_ci#define LCCR0_Sngl	(LCCR0_SDS*0)	/*  Single panel display           */
166562306a36Sopenharmony_ci#define LCCR0_Dual	(LCCR0_SDS*1)	/*  Dual panel display             */
166662306a36Sopenharmony_ci#define LCCR0_LDM	0x00000008	/* LCD Disable done (LDD)          */
166762306a36Sopenharmony_ci                	        	/* interrupt Mask (disable)        */
166862306a36Sopenharmony_ci#define LCCR0_BAM	0x00000010	/* Base Address update (BAU)       */
166962306a36Sopenharmony_ci                	        	/* interrupt Mask (disable)        */
167062306a36Sopenharmony_ci#define LCCR0_ERM	0x00000020	/* LCD ERror (BER, IOL, IUL, IOU,  */
167162306a36Sopenharmony_ci                	        	/* IUU, OOL, OUL, OOU, and OUU)    */
167262306a36Sopenharmony_ci                	        	/* interrupt Mask (disable)        */
167362306a36Sopenharmony_ci#define LCCR0_PAS	0x00000080	/* Passive/Active display Select   */
167462306a36Sopenharmony_ci#define LCCR0_Pas	(LCCR0_PAS*0)	/*  Passive display (STN)          */
167562306a36Sopenharmony_ci#define LCCR0_Act	(LCCR0_PAS*1)	/*  Active display (TFT)           */
167662306a36Sopenharmony_ci#define LCCR0_BLE	0x00000100	/* Big/Little Endian select        */
167762306a36Sopenharmony_ci#define LCCR0_LtlEnd	(LCCR0_BLE*0)	/*  Little Endian frame buffer     */
167862306a36Sopenharmony_ci#define LCCR0_BigEnd	(LCCR0_BLE*1)	/*  Big Endian frame buffer        */
167962306a36Sopenharmony_ci#define LCCR0_DPD	0x00000200	/* Double Pixel Data (monochrome   */
168062306a36Sopenharmony_ci                	        	/* display mode)                   */
168162306a36Sopenharmony_ci#define LCCR0_4PixMono	(LCCR0_DPD*0)	/*  4-Pixel/clock Monochrome       */
168262306a36Sopenharmony_ci                	        	/*  display                        */
168362306a36Sopenharmony_ci#define LCCR0_8PixMono	(LCCR0_DPD*1)	/*  8-Pixel/clock Monochrome       */
168462306a36Sopenharmony_ci                	        	/*  display                        */
168562306a36Sopenharmony_ci#define LCCR0_PDD	Fld (8, 12)	/* Palette DMA request Delay       */
168662306a36Sopenharmony_ci                	        	/* [Tmem]                          */
168762306a36Sopenharmony_ci#define LCCR0_DMADel(Tcpu)      	/*  palette DMA request Delay      */ \
168862306a36Sopenharmony_ci                	        	/*  [0..510 Tcpu]                  */ \
168962306a36Sopenharmony_ci                	((Tcpu)/2 << FShft (LCCR0_PDD))
169062306a36Sopenharmony_ci
169162306a36Sopenharmony_ci#define LCSR_LDD	0x00000001	/* LCD Disable Done                */
169262306a36Sopenharmony_ci#define LCSR_BAU	0x00000002	/* Base Address Update (read)      */
169362306a36Sopenharmony_ci#define LCSR_BER	0x00000004	/* Bus ERror                       */
169462306a36Sopenharmony_ci#define LCSR_ABC	0x00000008	/* AC Bias clock Count             */
169562306a36Sopenharmony_ci#define LCSR_IOL	0x00000010	/* Input FIFO Over-run Lower       */
169662306a36Sopenharmony_ci                	        	/* panel                           */
169762306a36Sopenharmony_ci#define LCSR_IUL	0x00000020	/* Input FIFO Under-run Lower      */
169862306a36Sopenharmony_ci                	        	/* panel                           */
169962306a36Sopenharmony_ci#define LCSR_IOU	0x00000040	/* Input FIFO Over-run Upper       */
170062306a36Sopenharmony_ci                	        	/* panel                           */
170162306a36Sopenharmony_ci#define LCSR_IUU	0x00000080	/* Input FIFO Under-run Upper      */
170262306a36Sopenharmony_ci                	        	/* panel                           */
170362306a36Sopenharmony_ci#define LCSR_OOL	0x00000100	/* Output FIFO Over-run Lower      */
170462306a36Sopenharmony_ci                	        	/* panel                           */
170562306a36Sopenharmony_ci#define LCSR_OUL	0x00000200	/* Output FIFO Under-run Lower     */
170662306a36Sopenharmony_ci                	        	/* panel                           */
170762306a36Sopenharmony_ci#define LCSR_OOU	0x00000400	/* Output FIFO Over-run Upper      */
170862306a36Sopenharmony_ci                	        	/* panel                           */
170962306a36Sopenharmony_ci#define LCSR_OUU	0x00000800	/* Output FIFO Under-run Upper     */
171062306a36Sopenharmony_ci                	        	/* panel                           */
171162306a36Sopenharmony_ci
171262306a36Sopenharmony_ci#define LCCR1_PPL	Fld (6, 4)	/* Pixels Per Line/16 - 1          */
171362306a36Sopenharmony_ci#define LCCR1_DisWdth(Pixel)    	/*  Display Width [16..1024 pix.]  */ \
171462306a36Sopenharmony_ci                	(((Pixel) - 16)/16 << FShft (LCCR1_PPL))
171562306a36Sopenharmony_ci#define LCCR1_HSW	Fld (6, 10)	/* Horizontal Synchronization      */
171662306a36Sopenharmony_ci                	        	/* pulse Width - 1 [Tpix] (L_LCLK) */
171762306a36Sopenharmony_ci#define LCCR1_HorSnchWdth(Tpix) 	/*  Horizontal Synchronization     */ \
171862306a36Sopenharmony_ci                	        	/*  pulse Width [1..64 Tpix]       */ \
171962306a36Sopenharmony_ci                	(((Tpix) - 1) << FShft (LCCR1_HSW))
172062306a36Sopenharmony_ci#define LCCR1_ELW	Fld (8, 16)	/* End-of-Line pixel clock Wait    */
172162306a36Sopenharmony_ci                	        	/* count - 1 [Tpix]                */
172262306a36Sopenharmony_ci#define LCCR1_EndLnDel(Tpix)    	/*  End-of-Line Delay              */ \
172362306a36Sopenharmony_ci                	        	/*  [1..256 Tpix]                  */ \
172462306a36Sopenharmony_ci                	(((Tpix) - 1) << FShft (LCCR1_ELW))
172562306a36Sopenharmony_ci#define LCCR1_BLW	Fld (8, 24)	/* Beginning-of-Line pixel clock   */
172662306a36Sopenharmony_ci                	        	/* Wait count - 1 [Tpix]           */
172762306a36Sopenharmony_ci#define LCCR1_BegLnDel(Tpix)    	/*  Beginning-of-Line Delay        */ \
172862306a36Sopenharmony_ci                	        	/*  [1..256 Tpix]                  */ \
172962306a36Sopenharmony_ci                	(((Tpix) - 1) << FShft (LCCR1_BLW))
173062306a36Sopenharmony_ci
173162306a36Sopenharmony_ci#define LCCR2_LPP	Fld (10, 0)	/* Line Per Panel - 1              */
173262306a36Sopenharmony_ci#define LCCR2_DisHght(Line)     	/*  Display Height [1..1024 lines] */ \
173362306a36Sopenharmony_ci                	(((Line) - 1) << FShft (LCCR2_LPP))
173462306a36Sopenharmony_ci#define LCCR2_VSW	Fld (6, 10)	/* Vertical Synchronization pulse  */
173562306a36Sopenharmony_ci                	        	/* Width - 1 [Tln] (L_FCLK)        */
173662306a36Sopenharmony_ci#define LCCR2_VrtSnchWdth(Tln)  	/*  Vertical Synchronization pulse */ \
173762306a36Sopenharmony_ci                	        	/*  Width [1..64 Tln]              */ \
173862306a36Sopenharmony_ci                	(((Tln) - 1) << FShft (LCCR2_VSW))
173962306a36Sopenharmony_ci#define LCCR2_EFW	Fld (8, 16)	/* End-of-Frame line clock Wait    */
174062306a36Sopenharmony_ci                	        	/* count [Tln]                     */
174162306a36Sopenharmony_ci#define LCCR2_EndFrmDel(Tln)    	/*  End-of-Frame Delay             */ \
174262306a36Sopenharmony_ci                	        	/*  [0..255 Tln]                   */ \
174362306a36Sopenharmony_ci                	((Tln) << FShft (LCCR2_EFW))
174462306a36Sopenharmony_ci#define LCCR2_BFW	Fld (8, 24)	/* Beginning-of-Frame line clock   */
174562306a36Sopenharmony_ci                	        	/* Wait count [Tln]                */
174662306a36Sopenharmony_ci#define LCCR2_BegFrmDel(Tln)    	/*  Beginning-of-Frame Delay       */ \
174762306a36Sopenharmony_ci                	        	/*  [0..255 Tln]                   */ \
174862306a36Sopenharmony_ci                	((Tln) << FShft (LCCR2_BFW))
174962306a36Sopenharmony_ci
175062306a36Sopenharmony_ci#define LCCR3_PCD	Fld (8, 0)	/* Pixel Clock Divisor/2 - 2       */
175162306a36Sopenharmony_ci                	        	/* [1..255] (L_PCLK)               */
175262306a36Sopenharmony_ci                	        	/* fpix = fcpu/(2*(PCD + 2))       */
175362306a36Sopenharmony_ci                	        	/* Tpix = 2*(PCD + 2)*Tcpu         */
175462306a36Sopenharmony_ci#define LCCR3_PixClkDiv(Div)    	/*  Pixel Clock Divisor [6..514]   */ \
175562306a36Sopenharmony_ci                	(((Div) - 4)/2 << FShft (LCCR3_PCD))
175662306a36Sopenharmony_ci                	        	/*  fpix = fcpu/(2*Floor (Div/2))  */
175762306a36Sopenharmony_ci                	        	/*  Tpix = 2*Floor (Div/2)*Tcpu    */
175862306a36Sopenharmony_ci#define LCCR3_CeilPixClkDiv(Div)	/*  Ceil. of PixClkDiv [6..514]    */ \
175962306a36Sopenharmony_ci                	(((Div) - 3)/2 << FShft (LCCR3_PCD))
176062306a36Sopenharmony_ci                	        	/*  fpix = fcpu/(2*Ceil (Div/2))   */
176162306a36Sopenharmony_ci                	        	/*  Tpix = 2*Ceil (Div/2)*Tcpu     */
176262306a36Sopenharmony_ci#define LCCR3_ACB	Fld (8, 8)	/* AC Bias clock half period - 1   */
176362306a36Sopenharmony_ci                	        	/* [Tln] (L_BIAS)                  */
176462306a36Sopenharmony_ci#define LCCR3_ACBsDiv(Div)      	/*  AC Bias clock Divisor [2..512] */ \
176562306a36Sopenharmony_ci                	(((Div) - 2)/2 << FShft (LCCR3_ACB))
176662306a36Sopenharmony_ci                	        	/*  fac = fln/(2*Floor (Div/2))    */
176762306a36Sopenharmony_ci                	        	/*  Tac = 2*Floor (Div/2)*Tln      */
176862306a36Sopenharmony_ci#define LCCR3_CeilACBsDiv(Div)  	/*  Ceil. of ACBsDiv [2..512]      */ \
176962306a36Sopenharmony_ci                	(((Div) - 1)/2 << FShft (LCCR3_ACB))
177062306a36Sopenharmony_ci                	        	/*  fac = fln/(2*Ceil (Div/2))     */
177162306a36Sopenharmony_ci                	        	/*  Tac = 2*Ceil (Div/2)*Tln       */
177262306a36Sopenharmony_ci#define LCCR3_API	Fld (4, 16)	/* AC bias Pin transitions per     */
177362306a36Sopenharmony_ci                	        	/* Interrupt                       */
177462306a36Sopenharmony_ci#define LCCR3_ACBsCntOff        	/*  AC Bias clock transition Count */ \
177562306a36Sopenharmony_ci                	        	/*  Off                            */ \
177662306a36Sopenharmony_ci                	(0 << FShft (LCCR3_API))
177762306a36Sopenharmony_ci#define LCCR3_ACBsCnt(Trans)    	/*  AC Bias clock transition Count */ \
177862306a36Sopenharmony_ci                	        	/*  [1..15]                        */ \
177962306a36Sopenharmony_ci                	((Trans) << FShft (LCCR3_API))
178062306a36Sopenharmony_ci#define LCCR3_VSP	0x00100000	/* Vertical Synchronization pulse  */
178162306a36Sopenharmony_ci                	        	/* Polarity (L_FCLK)               */
178262306a36Sopenharmony_ci#define LCCR3_VrtSnchH	(LCCR3_VSP*0)	/*  Vertical Synchronization pulse */
178362306a36Sopenharmony_ci                	        	/*  active High                    */
178462306a36Sopenharmony_ci#define LCCR3_VrtSnchL	(LCCR3_VSP*1)	/*  Vertical Synchronization pulse */
178562306a36Sopenharmony_ci                	        	/*  active Low                     */
178662306a36Sopenharmony_ci#define LCCR3_HSP	0x00200000	/* Horizontal Synchronization      */
178762306a36Sopenharmony_ci                	        	/* pulse Polarity (L_LCLK)         */
178862306a36Sopenharmony_ci#define LCCR3_HorSnchH	(LCCR3_HSP*0)	/*  Horizontal Synchronization     */
178962306a36Sopenharmony_ci                	        	/*  pulse active High              */
179062306a36Sopenharmony_ci#define LCCR3_HorSnchL	(LCCR3_HSP*1)	/*  Horizontal Synchronization     */
179162306a36Sopenharmony_ci                	        	/*  pulse active Low               */
179262306a36Sopenharmony_ci#define LCCR3_PCP	0x00400000	/* Pixel Clock Polarity (L_PCLK)   */
179362306a36Sopenharmony_ci#define LCCR3_PixRsEdg	(LCCR3_PCP*0)	/*  Pixel clock Rising-Edge        */
179462306a36Sopenharmony_ci#define LCCR3_PixFlEdg	(LCCR3_PCP*1)	/*  Pixel clock Falling-Edge       */
179562306a36Sopenharmony_ci#define LCCR3_OEP	0x00800000	/* Output Enable Polarity (L_BIAS, */
179662306a36Sopenharmony_ci                	        	/* active display mode)            */
179762306a36Sopenharmony_ci#define LCCR3_OutEnH	(LCCR3_OEP*0)	/*  Output Enable active High      */
179862306a36Sopenharmony_ci#define LCCR3_OutEnL	(LCCR3_OEP*1)	/*  Output Enable active Low       */
1799