18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci/* include/asm-m68knommu/MC68EZ328.h: 'EZ328 control registers
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1999  Vladimir Gurevich <vgurevic@cisco.com>
68c2ecf20Sopenharmony_ci *                     Bear & Hare Software, Inc.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Based on include/asm-m68knommu/MC68332.h
98c2ecf20Sopenharmony_ci * Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>,
108c2ecf20Sopenharmony_ci *                     The Silver Hammer Group, Ltd.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci#include <linux/compiler.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifndef _MC68EZ328_H_
168c2ecf20Sopenharmony_ci#define _MC68EZ328_H_
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define BYTE_REF(addr) (*((volatile unsigned char*)addr))
198c2ecf20Sopenharmony_ci#define WORD_REF(addr) (*((volatile unsigned short*)addr))
208c2ecf20Sopenharmony_ci#define LONG_REF(addr) (*((volatile unsigned long*)addr))
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define PUT_FIELD(field, val) (((val) << field##_SHIFT) & field##_MASK)
238c2ecf20Sopenharmony_ci#define GET_FIELD(reg, field) (((reg) & field##_MASK) >> field##_SHIFT)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/**********
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci * 0xFFFFF0xx -- System Control
288c2ecf20Sopenharmony_ci *
298c2ecf20Sopenharmony_ci **********/
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/*
328c2ecf20Sopenharmony_ci * System Control Register (SCR)
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define SCR_ADDR	0xfffff000
358c2ecf20Sopenharmony_ci#define SCR		BYTE_REF(SCR_ADDR)
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define SCR_WDTH8	0x01	/* 8-Bit Width Select */
388c2ecf20Sopenharmony_ci#define SCR_DMAP	0x04	/* Double Map */
398c2ecf20Sopenharmony_ci#define SCR_SO		0x08	/* Supervisor Only */
408c2ecf20Sopenharmony_ci#define SCR_BETEN	0x10	/* Bus-Error Time-Out Enable */
418c2ecf20Sopenharmony_ci#define SCR_PRV		0x20	/* Privilege Violation */
428c2ecf20Sopenharmony_ci#define SCR_WPV		0x40	/* Write Protect Violation */
438c2ecf20Sopenharmony_ci#define SCR_BETO	0x80	/* Bus-Error TimeOut */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/*
468c2ecf20Sopenharmony_ci * Silicon ID Register (Mask Revision Register (MRR) for '328 Compatibility)
478c2ecf20Sopenharmony_ci */
488c2ecf20Sopenharmony_ci#define MRR_ADDR 0xfffff004
498c2ecf20Sopenharmony_ci#define MRR	 LONG_REF(MRR_ADDR)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/**********
528c2ecf20Sopenharmony_ci *
538c2ecf20Sopenharmony_ci * 0xFFFFF1xx -- Chip-Select logic
548c2ecf20Sopenharmony_ci *
558c2ecf20Sopenharmony_ci **********/
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/*
588c2ecf20Sopenharmony_ci * Chip Select Group Base Registers
598c2ecf20Sopenharmony_ci */
608c2ecf20Sopenharmony_ci#define CSGBA_ADDR	0xfffff100
618c2ecf20Sopenharmony_ci#define CSGBB_ADDR	0xfffff102
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define CSGBC_ADDR	0xfffff104
648c2ecf20Sopenharmony_ci#define CSGBD_ADDR	0xfffff106
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define CSGBA		WORD_REF(CSGBA_ADDR)
678c2ecf20Sopenharmony_ci#define CSGBB		WORD_REF(CSGBB_ADDR)
688c2ecf20Sopenharmony_ci#define CSGBC		WORD_REF(CSGBC_ADDR)
698c2ecf20Sopenharmony_ci#define CSGBD		WORD_REF(CSGBD_ADDR)
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/*
728c2ecf20Sopenharmony_ci * Chip Select Registers
738c2ecf20Sopenharmony_ci */
748c2ecf20Sopenharmony_ci#define CSA_ADDR	0xfffff110
758c2ecf20Sopenharmony_ci#define CSB_ADDR	0xfffff112
768c2ecf20Sopenharmony_ci#define CSC_ADDR	0xfffff114
778c2ecf20Sopenharmony_ci#define CSD_ADDR	0xfffff116
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define CSA		WORD_REF(CSA_ADDR)
808c2ecf20Sopenharmony_ci#define CSB		WORD_REF(CSB_ADDR)
818c2ecf20Sopenharmony_ci#define CSC		WORD_REF(CSC_ADDR)
828c2ecf20Sopenharmony_ci#define CSD		WORD_REF(CSD_ADDR)
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define CSA_EN		0x0001		/* Chip-Select Enable */
858c2ecf20Sopenharmony_ci#define CSA_SIZ_MASK	0x000e		/* Chip-Select Size */
868c2ecf20Sopenharmony_ci#define CSA_SIZ_SHIFT   1
878c2ecf20Sopenharmony_ci#define CSA_WS_MASK	0x0070		/* Wait State */
888c2ecf20Sopenharmony_ci#define CSA_WS_SHIFT    4
898c2ecf20Sopenharmony_ci#define CSA_BSW		0x0080		/* Data Bus Width */
908c2ecf20Sopenharmony_ci#define CSA_FLASH	0x0100		/* FLASH Memory Support */
918c2ecf20Sopenharmony_ci#define CSA_RO		0x8000		/* Read-Only */
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define CSB_EN		0x0001		/* Chip-Select Enable */
948c2ecf20Sopenharmony_ci#define CSB_SIZ_MASK	0x000e		/* Chip-Select Size */
958c2ecf20Sopenharmony_ci#define CSB_SIZ_SHIFT   1
968c2ecf20Sopenharmony_ci#define CSB_WS_MASK	0x0070		/* Wait State */
978c2ecf20Sopenharmony_ci#define CSB_WS_SHIFT    4
988c2ecf20Sopenharmony_ci#define CSB_BSW		0x0080		/* Data Bus Width */
998c2ecf20Sopenharmony_ci#define CSB_FLASH	0x0100		/* FLASH Memory Support */
1008c2ecf20Sopenharmony_ci#define CSB_UPSIZ_MASK	0x1800		/* Unprotected memory block size */
1018c2ecf20Sopenharmony_ci#define CSB_UPSIZ_SHIFT 11
1028c2ecf20Sopenharmony_ci#define CSB_ROP		0x2000		/* Readonly if protected */
1038c2ecf20Sopenharmony_ci#define CSB_SOP		0x4000		/* Supervisor only if protected */
1048c2ecf20Sopenharmony_ci#define CSB_RO		0x8000		/* Read-Only */
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define CSC_EN		0x0001		/* Chip-Select Enable */
1078c2ecf20Sopenharmony_ci#define CSC_SIZ_MASK	0x000e		/* Chip-Select Size */
1088c2ecf20Sopenharmony_ci#define CSC_SIZ_SHIFT   1
1098c2ecf20Sopenharmony_ci#define CSC_WS_MASK	0x0070		/* Wait State */
1108c2ecf20Sopenharmony_ci#define CSC_WS_SHIFT    4
1118c2ecf20Sopenharmony_ci#define CSC_BSW		0x0080		/* Data Bus Width */
1128c2ecf20Sopenharmony_ci#define CSC_FLASH	0x0100		/* FLASH Memory Support */
1138c2ecf20Sopenharmony_ci#define CSC_UPSIZ_MASK	0x1800		/* Unprotected memory block size */
1148c2ecf20Sopenharmony_ci#define CSC_UPSIZ_SHIFT 11
1158c2ecf20Sopenharmony_ci#define CSC_ROP		0x2000		/* Readonly if protected */
1168c2ecf20Sopenharmony_ci#define CSC_SOP		0x4000		/* Supervisor only if protected */
1178c2ecf20Sopenharmony_ci#define CSC_RO		0x8000		/* Read-Only */
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define CSD_EN		0x0001		/* Chip-Select Enable */
1208c2ecf20Sopenharmony_ci#define CSD_SIZ_MASK	0x000e		/* Chip-Select Size */
1218c2ecf20Sopenharmony_ci#define CSD_SIZ_SHIFT   1
1228c2ecf20Sopenharmony_ci#define CSD_WS_MASK	0x0070		/* Wait State */
1238c2ecf20Sopenharmony_ci#define CSD_WS_SHIFT    4
1248c2ecf20Sopenharmony_ci#define CSD_BSW		0x0080		/* Data Bus Width */
1258c2ecf20Sopenharmony_ci#define CSD_FLASH	0x0100		/* FLASH Memory Support */
1268c2ecf20Sopenharmony_ci#define CSD_DRAM	0x0200		/* Dram Selection */
1278c2ecf20Sopenharmony_ci#define	CSD_COMB	0x0400		/* Combining */
1288c2ecf20Sopenharmony_ci#define CSD_UPSIZ_MASK	0x1800		/* Unprotected memory block size */
1298c2ecf20Sopenharmony_ci#define CSD_UPSIZ_SHIFT 11
1308c2ecf20Sopenharmony_ci#define CSD_ROP		0x2000		/* Readonly if protected */
1318c2ecf20Sopenharmony_ci#define CSD_SOP		0x4000		/* Supervisor only if protected */
1328c2ecf20Sopenharmony_ci#define CSD_RO		0x8000		/* Read-Only */
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/*
1358c2ecf20Sopenharmony_ci * Emulation Chip-Select Register
1368c2ecf20Sopenharmony_ci */
1378c2ecf20Sopenharmony_ci#define EMUCS_ADDR	0xfffff118
1388c2ecf20Sopenharmony_ci#define EMUCS		WORD_REF(EMUCS_ADDR)
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define EMUCS_WS_MASK	0x0070
1418c2ecf20Sopenharmony_ci#define EMUCS_WS_SHIFT	4
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci/**********
1448c2ecf20Sopenharmony_ci *
1458c2ecf20Sopenharmony_ci * 0xFFFFF2xx -- Phase Locked Loop (PLL) & Power Control
1468c2ecf20Sopenharmony_ci *
1478c2ecf20Sopenharmony_ci **********/
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/*
1508c2ecf20Sopenharmony_ci * PLL Control Register
1518c2ecf20Sopenharmony_ci */
1528c2ecf20Sopenharmony_ci#define PLLCR_ADDR	0xfffff200
1538c2ecf20Sopenharmony_ci#define PLLCR		WORD_REF(PLLCR_ADDR)
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#define PLLCR_DISPLL	       0x0008	/* Disable PLL */
1568c2ecf20Sopenharmony_ci#define PLLCR_CLKEN	       0x0010	/* Clock (CLKO pin) enable */
1578c2ecf20Sopenharmony_ci#define PLLCR_PRESC	       0x0020	/* VCO prescaler */
1588c2ecf20Sopenharmony_ci#define PLLCR_SYSCLK_SEL_MASK  0x0700	/* System Clock Selection */
1598c2ecf20Sopenharmony_ci#define PLLCR_SYSCLK_SEL_SHIFT 8
1608c2ecf20Sopenharmony_ci#define PLLCR_LCDCLK_SEL_MASK  0x3800	/* LCD Clock Selection */
1618c2ecf20Sopenharmony_ci#define PLLCR_LCDCLK_SEL_SHIFT 11
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/* '328-compatible definitions */
1648c2ecf20Sopenharmony_ci#define PLLCR_PIXCLK_SEL_MASK	PLLCR_LCDCLK_SEL_MASK
1658c2ecf20Sopenharmony_ci#define PLLCR_PIXCLK_SEL_SHIFT	PLLCR_LCDCLK_SEL_SHIFT
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/*
1688c2ecf20Sopenharmony_ci * PLL Frequency Select Register
1698c2ecf20Sopenharmony_ci */
1708c2ecf20Sopenharmony_ci#define PLLFSR_ADDR	0xfffff202
1718c2ecf20Sopenharmony_ci#define PLLFSR		WORD_REF(PLLFSR_ADDR)
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci#define PLLFSR_PC_MASK	0x00ff		/* P Count */
1748c2ecf20Sopenharmony_ci#define PLLFSR_PC_SHIFT 0
1758c2ecf20Sopenharmony_ci#define PLLFSR_QC_MASK	0x0f00		/* Q Count */
1768c2ecf20Sopenharmony_ci#define PLLFSR_QC_SHIFT 8
1778c2ecf20Sopenharmony_ci#define PLLFSR_PROT	0x4000		/* Protect P & Q */
1788c2ecf20Sopenharmony_ci#define PLLFSR_CLK32	0x8000		/* Clock 32 (kHz) */
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/*
1818c2ecf20Sopenharmony_ci * Power Control Register
1828c2ecf20Sopenharmony_ci */
1838c2ecf20Sopenharmony_ci#define PCTRL_ADDR	0xfffff207
1848c2ecf20Sopenharmony_ci#define PCTRL		BYTE_REF(PCTRL_ADDR)
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci#define PCTRL_WIDTH_MASK	0x1f	/* CPU Clock bursts width */
1878c2ecf20Sopenharmony_ci#define PCTRL_WIDTH_SHIFT	0
1888c2ecf20Sopenharmony_ci#define PCTRL_PCEN		0x80	/* Power Control Enable */
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci/**********
1918c2ecf20Sopenharmony_ci *
1928c2ecf20Sopenharmony_ci * 0xFFFFF3xx -- Interrupt Controller
1938c2ecf20Sopenharmony_ci *
1948c2ecf20Sopenharmony_ci **********/
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci/*
1978c2ecf20Sopenharmony_ci * Interrupt Vector Register
1988c2ecf20Sopenharmony_ci */
1998c2ecf20Sopenharmony_ci#define IVR_ADDR	0xfffff300
2008c2ecf20Sopenharmony_ci#define IVR		BYTE_REF(IVR_ADDR)
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci#define IVR_VECTOR_MASK 0xF8
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/*
2058c2ecf20Sopenharmony_ci * Interrupt control Register
2068c2ecf20Sopenharmony_ci */
2078c2ecf20Sopenharmony_ci#define ICR_ADDR	0xfffff302
2088c2ecf20Sopenharmony_ci#define ICR		WORD_REF(ICR_ADDR)
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci#define ICR_POL5	0x0080	/* Polarity Control for IRQ5 */
2118c2ecf20Sopenharmony_ci#define ICR_ET6		0x0100	/* Edge Trigger Select for IRQ6 */
2128c2ecf20Sopenharmony_ci#define ICR_ET3		0x0200	/* Edge Trigger Select for IRQ3 */
2138c2ecf20Sopenharmony_ci#define ICR_ET2		0x0400	/* Edge Trigger Select for IRQ2 */
2148c2ecf20Sopenharmony_ci#define ICR_ET1		0x0800	/* Edge Trigger Select for IRQ1 */
2158c2ecf20Sopenharmony_ci#define ICR_POL6	0x1000	/* Polarity Control for IRQ6 */
2168c2ecf20Sopenharmony_ci#define ICR_POL3	0x2000	/* Polarity Control for IRQ3 */
2178c2ecf20Sopenharmony_ci#define ICR_POL2	0x4000	/* Polarity Control for IRQ2 */
2188c2ecf20Sopenharmony_ci#define ICR_POL1	0x8000	/* Polarity Control for IRQ1 */
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci/*
2218c2ecf20Sopenharmony_ci * Interrupt Mask Register
2228c2ecf20Sopenharmony_ci */
2238c2ecf20Sopenharmony_ci#define IMR_ADDR	0xfffff304
2248c2ecf20Sopenharmony_ci#define IMR		LONG_REF(IMR_ADDR)
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/*
2278c2ecf20Sopenharmony_ci * Define the names for bit positions first. This is useful for
2288c2ecf20Sopenharmony_ci * request_irq
2298c2ecf20Sopenharmony_ci */
2308c2ecf20Sopenharmony_ci#define SPI_IRQ_NUM	0	/* SPI interrupt */
2318c2ecf20Sopenharmony_ci#define TMR_IRQ_NUM	1	/* Timer interrupt */
2328c2ecf20Sopenharmony_ci#define UART_IRQ_NUM	2	/* UART interrupt */
2338c2ecf20Sopenharmony_ci#define	WDT_IRQ_NUM	3	/* Watchdog Timer interrupt */
2348c2ecf20Sopenharmony_ci#define RTC_IRQ_NUM	4	/* RTC interrupt */
2358c2ecf20Sopenharmony_ci#define	KB_IRQ_NUM	6	/* Keyboard Interrupt */
2368c2ecf20Sopenharmony_ci#define PWM_IRQ_NUM	7	/* Pulse-Width Modulator int. */
2378c2ecf20Sopenharmony_ci#define	INT0_IRQ_NUM	8	/* External INT0 */
2388c2ecf20Sopenharmony_ci#define	INT1_IRQ_NUM	9	/* External INT1 */
2398c2ecf20Sopenharmony_ci#define	INT2_IRQ_NUM	10	/* External INT2 */
2408c2ecf20Sopenharmony_ci#define	INT3_IRQ_NUM	11	/* External INT3 */
2418c2ecf20Sopenharmony_ci#define IRQ1_IRQ_NUM	16	/* IRQ1 */
2428c2ecf20Sopenharmony_ci#define IRQ2_IRQ_NUM	17	/* IRQ2 */
2438c2ecf20Sopenharmony_ci#define IRQ3_IRQ_NUM	18	/* IRQ3 */
2448c2ecf20Sopenharmony_ci#define IRQ6_IRQ_NUM	19	/* IRQ6 */
2458c2ecf20Sopenharmony_ci#define IRQ5_IRQ_NUM	20	/* IRQ5 */
2468c2ecf20Sopenharmony_ci#define SAM_IRQ_NUM	22	/* Sampling Timer for RTC */
2478c2ecf20Sopenharmony_ci#define EMIQ_IRQ_NUM	23	/* Emulator Interrupt */
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci/* '328-compatible definitions */
2508c2ecf20Sopenharmony_ci#define SPIM_IRQ_NUM	SPI_IRQ_NUM
2518c2ecf20Sopenharmony_ci#define TMR1_IRQ_NUM	TMR_IRQ_NUM
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/*
2548c2ecf20Sopenharmony_ci * Here go the bitmasks themselves
2558c2ecf20Sopenharmony_ci */
2568c2ecf20Sopenharmony_ci#define IMR_MSPI 	(1 << SPI_IRQ_NUM)	/* Mask SPI interrupt */
2578c2ecf20Sopenharmony_ci#define	IMR_MTMR	(1 << TMR_IRQ_NUM)	/* Mask Timer interrupt */
2588c2ecf20Sopenharmony_ci#define IMR_MUART	(1 << UART_IRQ_NUM)	/* Mask UART interrupt */
2598c2ecf20Sopenharmony_ci#define	IMR_MWDT	(1 << WDT_IRQ_NUM)	/* Mask Watchdog Timer interrupt */
2608c2ecf20Sopenharmony_ci#define IMR_MRTC	(1 << RTC_IRQ_NUM)	/* Mask RTC interrupt */
2618c2ecf20Sopenharmony_ci#define	IMR_MKB		(1 << KB_IRQ_NUM)	/* Mask Keyboard Interrupt */
2628c2ecf20Sopenharmony_ci#define IMR_MPWM	(1 << PWM_IRQ_NUM)	/* Mask Pulse-Width Modulator int. */
2638c2ecf20Sopenharmony_ci#define	IMR_MINT0	(1 << INT0_IRQ_NUM)	/* Mask External INT0 */
2648c2ecf20Sopenharmony_ci#define	IMR_MINT1	(1 << INT1_IRQ_NUM)	/* Mask External INT1 */
2658c2ecf20Sopenharmony_ci#define	IMR_MINT2	(1 << INT2_IRQ_NUM)	/* Mask External INT2 */
2668c2ecf20Sopenharmony_ci#define	IMR_MINT3	(1 << INT3_IRQ_NUM)	/* Mask External INT3 */
2678c2ecf20Sopenharmony_ci#define IMR_MIRQ1	(1 << IRQ1_IRQ_NUM)	/* Mask IRQ1 */
2688c2ecf20Sopenharmony_ci#define IMR_MIRQ2	(1 << IRQ2_IRQ_NUM)	/* Mask IRQ2 */
2698c2ecf20Sopenharmony_ci#define IMR_MIRQ3	(1 << IRQ3_IRQ_NUM)	/* Mask IRQ3 */
2708c2ecf20Sopenharmony_ci#define IMR_MIRQ6	(1 << IRQ6_IRQ_NUM)	/* Mask IRQ6 */
2718c2ecf20Sopenharmony_ci#define IMR_MIRQ5	(1 << IRQ5_IRQ_NUM)	/* Mask IRQ5 */
2728c2ecf20Sopenharmony_ci#define IMR_MSAM	(1 << SAM_IRQ_NUM)	/* Mask Sampling Timer for RTC */
2738c2ecf20Sopenharmony_ci#define IMR_MEMIQ	(1 << EMIQ_IRQ_NUM)	/* Mask Emulator Interrupt */
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/* '328-compatible definitions */
2768c2ecf20Sopenharmony_ci#define IMR_MSPIM	IMR_MSPI
2778c2ecf20Sopenharmony_ci#define IMR_MTMR1	IMR_MTMR
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci/*
2808c2ecf20Sopenharmony_ci * Interrupt Status Register
2818c2ecf20Sopenharmony_ci */
2828c2ecf20Sopenharmony_ci#define ISR_ADDR	0xfffff30c
2838c2ecf20Sopenharmony_ci#define ISR		LONG_REF(ISR_ADDR)
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci#define ISR_SPI 	(1 << SPI_IRQ_NUM)	/* SPI interrupt */
2868c2ecf20Sopenharmony_ci#define	ISR_TMR		(1 << TMR_IRQ_NUM)	/* Timer interrupt */
2878c2ecf20Sopenharmony_ci#define ISR_UART	(1 << UART_IRQ_NUM)	/* UART interrupt */
2888c2ecf20Sopenharmony_ci#define	ISR_WDT		(1 << WDT_IRQ_NUM)	/* Watchdog Timer interrupt */
2898c2ecf20Sopenharmony_ci#define ISR_RTC		(1 << RTC_IRQ_NUM)	/* RTC interrupt */
2908c2ecf20Sopenharmony_ci#define	ISR_KB		(1 << KB_IRQ_NUM)	/* Keyboard Interrupt */
2918c2ecf20Sopenharmony_ci#define ISR_PWM		(1 << PWM_IRQ_NUM)	/* Pulse-Width Modulator interrupt */
2928c2ecf20Sopenharmony_ci#define	ISR_INT0	(1 << INT0_IRQ_NUM)	/* External INT0 */
2938c2ecf20Sopenharmony_ci#define	ISR_INT1	(1 << INT1_IRQ_NUM)	/* External INT1 */
2948c2ecf20Sopenharmony_ci#define	ISR_INT2	(1 << INT2_IRQ_NUM)	/* External INT2 */
2958c2ecf20Sopenharmony_ci#define	ISR_INT3	(1 << INT3_IRQ_NUM)	/* External INT3 */
2968c2ecf20Sopenharmony_ci#define ISR_IRQ1	(1 << IRQ1_IRQ_NUM)	/* IRQ1 */
2978c2ecf20Sopenharmony_ci#define ISR_IRQ2	(1 << IRQ2_IRQ_NUM)	/* IRQ2 */
2988c2ecf20Sopenharmony_ci#define ISR_IRQ3	(1 << IRQ3_IRQ_NUM)	/* IRQ3 */
2998c2ecf20Sopenharmony_ci#define ISR_IRQ6	(1 << IRQ6_IRQ_NUM)	/* IRQ6 */
3008c2ecf20Sopenharmony_ci#define ISR_IRQ5	(1 << IRQ5_IRQ_NUM)	/* IRQ5 */
3018c2ecf20Sopenharmony_ci#define ISR_SAM		(1 << SAM_IRQ_NUM)	/* Sampling Timer for RTC */
3028c2ecf20Sopenharmony_ci#define ISR_EMIQ	(1 << EMIQ_IRQ_NUM)	/* Emulator Interrupt */
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/* '328-compatible definitions */
3058c2ecf20Sopenharmony_ci#define ISR_SPIM	ISR_SPI
3068c2ecf20Sopenharmony_ci#define ISR_TMR1	ISR_TMR
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci/*
3098c2ecf20Sopenharmony_ci * Interrupt Pending Register
3108c2ecf20Sopenharmony_ci */
3118c2ecf20Sopenharmony_ci#define IPR_ADDR	0xfffff30c
3128c2ecf20Sopenharmony_ci#define IPR		LONG_REF(IPR_ADDR)
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci#define IPR_SPI 	(1 << SPI_IRQ_NUM)	/* SPI interrupt */
3158c2ecf20Sopenharmony_ci#define	IPR_TMR		(1 << TMR_IRQ_NUM)	/* Timer interrupt */
3168c2ecf20Sopenharmony_ci#define IPR_UART	(1 << UART_IRQ_NUM)	/* UART interrupt */
3178c2ecf20Sopenharmony_ci#define	IPR_WDT		(1 << WDT_IRQ_NUM)	/* Watchdog Timer interrupt */
3188c2ecf20Sopenharmony_ci#define IPR_RTC		(1 << RTC_IRQ_NUM)	/* RTC interrupt */
3198c2ecf20Sopenharmony_ci#define	IPR_KB		(1 << KB_IRQ_NUM)	/* Keyboard Interrupt */
3208c2ecf20Sopenharmony_ci#define IPR_PWM		(1 << PWM_IRQ_NUM)	/* Pulse-Width Modulator interrupt */
3218c2ecf20Sopenharmony_ci#define	IPR_INT0	(1 << INT0_IRQ_NUM)	/* External INT0 */
3228c2ecf20Sopenharmony_ci#define	IPR_INT1	(1 << INT1_IRQ_NUM)	/* External INT1 */
3238c2ecf20Sopenharmony_ci#define	IPR_INT2	(1 << INT2_IRQ_NUM)	/* External INT2 */
3248c2ecf20Sopenharmony_ci#define	IPR_INT3	(1 << INT3_IRQ_NUM)	/* External INT3 */
3258c2ecf20Sopenharmony_ci#define IPR_IRQ1	(1 << IRQ1_IRQ_NUM)	/* IRQ1 */
3268c2ecf20Sopenharmony_ci#define IPR_IRQ2	(1 << IRQ2_IRQ_NUM)	/* IRQ2 */
3278c2ecf20Sopenharmony_ci#define IPR_IRQ3	(1 << IRQ3_IRQ_NUM)	/* IRQ3 */
3288c2ecf20Sopenharmony_ci#define IPR_IRQ6	(1 << IRQ6_IRQ_NUM)	/* IRQ6 */
3298c2ecf20Sopenharmony_ci#define IPR_IRQ5	(1 << IRQ5_IRQ_NUM)	/* IRQ5 */
3308c2ecf20Sopenharmony_ci#define IPR_SAM		(1 << SAM_IRQ_NUM)	/* Sampling Timer for RTC */
3318c2ecf20Sopenharmony_ci#define IPR_EMIQ	(1 << EMIQ_IRQ_NUM)	/* Emulator Interrupt */
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci/* '328-compatible definitions */
3348c2ecf20Sopenharmony_ci#define IPR_SPIM	IPR_SPI
3358c2ecf20Sopenharmony_ci#define IPR_TMR1	IPR_TMR
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci/**********
3388c2ecf20Sopenharmony_ci *
3398c2ecf20Sopenharmony_ci * 0xFFFFF4xx -- Parallel Ports
3408c2ecf20Sopenharmony_ci *
3418c2ecf20Sopenharmony_ci **********/
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci/*
3448c2ecf20Sopenharmony_ci * Port A
3458c2ecf20Sopenharmony_ci */
3468c2ecf20Sopenharmony_ci#define PADIR_ADDR	0xfffff400		/* Port A direction reg */
3478c2ecf20Sopenharmony_ci#define PADATA_ADDR	0xfffff401		/* Port A data register */
3488c2ecf20Sopenharmony_ci#define PAPUEN_ADDR	0xfffff402		/* Port A Pull-Up enable reg */
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci#define PADIR		BYTE_REF(PADIR_ADDR)
3518c2ecf20Sopenharmony_ci#define PADATA		BYTE_REF(PADATA_ADDR)
3528c2ecf20Sopenharmony_ci#define PAPUEN		BYTE_REF(PAPUEN_ADDR)
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci#define PA(x)		(1 << (x))
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci/*
3578c2ecf20Sopenharmony_ci * Port B
3588c2ecf20Sopenharmony_ci */
3598c2ecf20Sopenharmony_ci#define PBDIR_ADDR	0xfffff408		/* Port B direction reg */
3608c2ecf20Sopenharmony_ci#define PBDATA_ADDR	0xfffff409		/* Port B data register */
3618c2ecf20Sopenharmony_ci#define PBPUEN_ADDR	0xfffff40a		/* Port B Pull-Up enable reg */
3628c2ecf20Sopenharmony_ci#define PBSEL_ADDR	0xfffff40b		/* Port B Select Register */
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci#define PBDIR		BYTE_REF(PBDIR_ADDR)
3658c2ecf20Sopenharmony_ci#define PBDATA		BYTE_REF(PBDATA_ADDR)
3668c2ecf20Sopenharmony_ci#define PBPUEN		BYTE_REF(PBPUEN_ADDR)
3678c2ecf20Sopenharmony_ci#define PBSEL		BYTE_REF(PBSEL_ADDR)
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci#define PB(x)		(1 << (x))
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci#define PB_CSB0		0x01	/* Use CSB0      as PB[0] */
3728c2ecf20Sopenharmony_ci#define PB_CSB1		0x02	/* Use CSB1      as PB[1] */
3738c2ecf20Sopenharmony_ci#define PB_CSC0_RAS0	0x04    /* Use CSC0/RAS0 as PB[2] */
3748c2ecf20Sopenharmony_ci#define PB_CSC1_RAS1	0x08    /* Use CSC1/RAS1 as PB[3] */
3758c2ecf20Sopenharmony_ci#define PB_CSD0_CAS0	0x10    /* Use CSD0/CAS0 as PB[4] */
3768c2ecf20Sopenharmony_ci#define PB_CSD1_CAS1	0x20    /* Use CSD1/CAS1 as PB[5] */
3778c2ecf20Sopenharmony_ci#define PB_TIN_TOUT	0x40	/* Use TIN/TOUT  as PB[6] */
3788c2ecf20Sopenharmony_ci#define PB_PWMO		0x80	/* Use PWMO      as PB[7] */
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci/*
3818c2ecf20Sopenharmony_ci * Port C
3828c2ecf20Sopenharmony_ci */
3838c2ecf20Sopenharmony_ci#define PCDIR_ADDR	0xfffff410		/* Port C direction reg */
3848c2ecf20Sopenharmony_ci#define PCDATA_ADDR	0xfffff411		/* Port C data register */
3858c2ecf20Sopenharmony_ci#define PCPDEN_ADDR	0xfffff412		/* Port C Pull-Down enb. reg */
3868c2ecf20Sopenharmony_ci#define PCSEL_ADDR	0xfffff413		/* Port C Select Register */
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci#define PCDIR		BYTE_REF(PCDIR_ADDR)
3898c2ecf20Sopenharmony_ci#define PCDATA		BYTE_REF(PCDATA_ADDR)
3908c2ecf20Sopenharmony_ci#define PCPDEN		BYTE_REF(PCPDEN_ADDR)
3918c2ecf20Sopenharmony_ci#define PCSEL		BYTE_REF(PCSEL_ADDR)
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci#define PC(x)		(1 << (x))
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci#define PC_LD0		0x01	/* Use LD0  as PC[0] */
3968c2ecf20Sopenharmony_ci#define PC_LD1		0x02	/* Use LD1  as PC[1] */
3978c2ecf20Sopenharmony_ci#define PC_LD2		0x04	/* Use LD2  as PC[2] */
3988c2ecf20Sopenharmony_ci#define PC_LD3		0x08	/* Use LD3  as PC[3] */
3998c2ecf20Sopenharmony_ci#define PC_LFLM		0x10	/* Use LFLM as PC[4] */
4008c2ecf20Sopenharmony_ci#define PC_LLP 		0x20	/* Use LLP  as PC[5] */
4018c2ecf20Sopenharmony_ci#define PC_LCLK		0x40	/* Use LCLK as PC[6] */
4028c2ecf20Sopenharmony_ci#define PC_LACD		0x80	/* Use LACD as PC[7] */
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci/*
4058c2ecf20Sopenharmony_ci * Port D
4068c2ecf20Sopenharmony_ci */
4078c2ecf20Sopenharmony_ci#define PDDIR_ADDR	0xfffff418		/* Port D direction reg */
4088c2ecf20Sopenharmony_ci#define PDDATA_ADDR	0xfffff419		/* Port D data register */
4098c2ecf20Sopenharmony_ci#define PDPUEN_ADDR	0xfffff41a		/* Port D Pull-Up enable reg */
4108c2ecf20Sopenharmony_ci#define PDSEL_ADDR	0xfffff41b		/* Port D Select Register */
4118c2ecf20Sopenharmony_ci#define PDPOL_ADDR	0xfffff41c		/* Port D Polarity Register */
4128c2ecf20Sopenharmony_ci#define PDIRQEN_ADDR	0xfffff41d		/* Port D IRQ enable register */
4138c2ecf20Sopenharmony_ci#define PDKBEN_ADDR	0xfffff41e		/* Port D Keyboard Enable reg */
4148c2ecf20Sopenharmony_ci#define	PDIQEG_ADDR	0xfffff41f		/* Port D IRQ Edge Register */
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci#define PDDIR		BYTE_REF(PDDIR_ADDR)
4178c2ecf20Sopenharmony_ci#define PDDATA		BYTE_REF(PDDATA_ADDR)
4188c2ecf20Sopenharmony_ci#define PDPUEN		BYTE_REF(PDPUEN_ADDR)
4198c2ecf20Sopenharmony_ci#define PDSEL		BYTE_REF(PDSEL_ADDR)
4208c2ecf20Sopenharmony_ci#define	PDPOL		BYTE_REF(PDPOL_ADDR)
4218c2ecf20Sopenharmony_ci#define PDIRQEN		BYTE_REF(PDIRQEN_ADDR)
4228c2ecf20Sopenharmony_ci#define PDKBEN		BYTE_REF(PDKBEN_ADDR)
4238c2ecf20Sopenharmony_ci#define PDIQEG		BYTE_REF(PDIQEG_ADDR)
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ci#define PD(x)		(1 << (x))
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci#define PD_INT0		0x01	/* Use INT0 as PD[0] */
4288c2ecf20Sopenharmony_ci#define PD_INT1		0x02	/* Use INT1 as PD[1] */
4298c2ecf20Sopenharmony_ci#define PD_INT2		0x04	/* Use INT2 as PD[2] */
4308c2ecf20Sopenharmony_ci#define PD_INT3		0x08	/* Use INT3 as PD[3] */
4318c2ecf20Sopenharmony_ci#define PD_IRQ1		0x10	/* Use IRQ1 as PD[4] */
4328c2ecf20Sopenharmony_ci#define PD_IRQ2		0x20	/* Use IRQ2 as PD[5] */
4338c2ecf20Sopenharmony_ci#define PD_IRQ3		0x40	/* Use IRQ3 as PD[6] */
4348c2ecf20Sopenharmony_ci#define PD_IRQ6		0x80	/* Use IRQ6 as PD[7] */
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci/*
4378c2ecf20Sopenharmony_ci * Port E
4388c2ecf20Sopenharmony_ci */
4398c2ecf20Sopenharmony_ci#define PEDIR_ADDR	0xfffff420		/* Port E direction reg */
4408c2ecf20Sopenharmony_ci#define PEDATA_ADDR	0xfffff421		/* Port E data register */
4418c2ecf20Sopenharmony_ci#define PEPUEN_ADDR	0xfffff422		/* Port E Pull-Up enable reg */
4428c2ecf20Sopenharmony_ci#define PESEL_ADDR	0xfffff423		/* Port E Select Register */
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci#define PEDIR		BYTE_REF(PEDIR_ADDR)
4458c2ecf20Sopenharmony_ci#define PEDATA		BYTE_REF(PEDATA_ADDR)
4468c2ecf20Sopenharmony_ci#define PEPUEN		BYTE_REF(PEPUEN_ADDR)
4478c2ecf20Sopenharmony_ci#define PESEL		BYTE_REF(PESEL_ADDR)
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci#define PE(x)		(1 << (x))
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci#define PE_SPMTXD	0x01	/* Use SPMTXD as PE[0] */
4528c2ecf20Sopenharmony_ci#define PE_SPMRXD	0x02	/* Use SPMRXD as PE[1] */
4538c2ecf20Sopenharmony_ci#define PE_SPMCLK	0x04	/* Use SPMCLK as PE[2] */
4548c2ecf20Sopenharmony_ci#define PE_DWE		0x08	/* Use DWE    as PE[3] */
4558c2ecf20Sopenharmony_ci#define PE_RXD		0x10	/* Use RXD    as PE[4] */
4568c2ecf20Sopenharmony_ci#define PE_TXD		0x20	/* Use TXD    as PE[5] */
4578c2ecf20Sopenharmony_ci#define PE_RTS		0x40	/* Use RTS    as PE[6] */
4588c2ecf20Sopenharmony_ci#define PE_CTS		0x80	/* Use CTS    as PE[7] */
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci/*
4618c2ecf20Sopenharmony_ci * Port F
4628c2ecf20Sopenharmony_ci */
4638c2ecf20Sopenharmony_ci#define PFDIR_ADDR	0xfffff428		/* Port F direction reg */
4648c2ecf20Sopenharmony_ci#define PFDATA_ADDR	0xfffff429		/* Port F data register */
4658c2ecf20Sopenharmony_ci#define PFPUEN_ADDR	0xfffff42a		/* Port F Pull-Up enable reg */
4668c2ecf20Sopenharmony_ci#define PFSEL_ADDR	0xfffff42b		/* Port F Select Register */
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci#define PFDIR		BYTE_REF(PFDIR_ADDR)
4698c2ecf20Sopenharmony_ci#define PFDATA		BYTE_REF(PFDATA_ADDR)
4708c2ecf20Sopenharmony_ci#define PFPUEN		BYTE_REF(PFPUEN_ADDR)
4718c2ecf20Sopenharmony_ci#define PFSEL		BYTE_REF(PFSEL_ADDR)
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci#define PF(x)		(1 << (x))
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci#define PF_LCONTRAST	0x01	/* Use LCONTRAST as PF[0] */
4768c2ecf20Sopenharmony_ci#define PF_IRQ5         0x02    /* Use IRQ5      as PF[1] */
4778c2ecf20Sopenharmony_ci#define PF_CLKO         0x04    /* Use CLKO      as PF[2] */
4788c2ecf20Sopenharmony_ci#define PF_A20          0x08    /* Use A20       as PF[3] */
4798c2ecf20Sopenharmony_ci#define PF_A21          0x10    /* Use A21       as PF[4] */
4808c2ecf20Sopenharmony_ci#define PF_A22          0x20    /* Use A22       as PF[5] */
4818c2ecf20Sopenharmony_ci#define PF_A23          0x40    /* Use A23       as PF[6] */
4828c2ecf20Sopenharmony_ci#define PF_CSA1		0x80    /* Use CSA1      as PF[7] */
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci/*
4858c2ecf20Sopenharmony_ci * Port G
4868c2ecf20Sopenharmony_ci */
4878c2ecf20Sopenharmony_ci#define PGDIR_ADDR	0xfffff430		/* Port G direction reg */
4888c2ecf20Sopenharmony_ci#define PGDATA_ADDR	0xfffff431		/* Port G data register */
4898c2ecf20Sopenharmony_ci#define PGPUEN_ADDR	0xfffff432		/* Port G Pull-Up enable reg */
4908c2ecf20Sopenharmony_ci#define PGSEL_ADDR	0xfffff433		/* Port G Select Register */
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci#define PGDIR		BYTE_REF(PGDIR_ADDR)
4938c2ecf20Sopenharmony_ci#define PGDATA		BYTE_REF(PGDATA_ADDR)
4948c2ecf20Sopenharmony_ci#define PGPUEN		BYTE_REF(PGPUEN_ADDR)
4958c2ecf20Sopenharmony_ci#define PGSEL		BYTE_REF(PGSEL_ADDR)
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci#define PG(x)		(1 << (x))
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci#define PG_BUSW_DTACK	0x01	/* Use BUSW/DTACK as PG[0] */
5008c2ecf20Sopenharmony_ci#define PG_A0		0x02	/* Use A0         as PG[1] */
5018c2ecf20Sopenharmony_ci#define PG_EMUIRQ	0x04	/* Use EMUIRQ     as PG[2] */
5028c2ecf20Sopenharmony_ci#define PG_HIZ_P_D	0x08	/* Use HIZ/P/D    as PG[3] */
5038c2ecf20Sopenharmony_ci#define PG_EMUCS        0x10	/* Use EMUCS      as PG[4] */
5048c2ecf20Sopenharmony_ci#define PG_EMUBRK	0x20	/* Use EMUBRK     as PG[5] */
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci/**********
5078c2ecf20Sopenharmony_ci *
5088c2ecf20Sopenharmony_ci * 0xFFFFF5xx -- Pulse-Width Modulator (PWM)
5098c2ecf20Sopenharmony_ci *
5108c2ecf20Sopenharmony_ci **********/
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci/*
5138c2ecf20Sopenharmony_ci * PWM Control Register
5148c2ecf20Sopenharmony_ci */
5158c2ecf20Sopenharmony_ci#define PWMC_ADDR	0xfffff500
5168c2ecf20Sopenharmony_ci#define PWMC		WORD_REF(PWMC_ADDR)
5178c2ecf20Sopenharmony_ci
5188c2ecf20Sopenharmony_ci#define PWMC_CLKSEL_MASK	0x0003	/* Clock Selection */
5198c2ecf20Sopenharmony_ci#define PWMC_CLKSEL_SHIFT	0
5208c2ecf20Sopenharmony_ci#define PWMC_REPEAT_MASK	0x000c	/* Sample Repeats */
5218c2ecf20Sopenharmony_ci#define PWMC_REPEAT_SHIFT	2
5228c2ecf20Sopenharmony_ci#define PWMC_EN			0x0010	/* Enable PWM */
5238c2ecf20Sopenharmony_ci#define PMNC_FIFOAV		0x0020	/* FIFO Available */
5248c2ecf20Sopenharmony_ci#define PWMC_IRQEN		0x0040	/* Interrupt Request Enable */
5258c2ecf20Sopenharmony_ci#define PWMC_IRQ		0x0080	/* Interrupt Request (FIFO empty) */
5268c2ecf20Sopenharmony_ci#define PWMC_PRESCALER_MASK	0x7f00	/* Incoming Clock prescaler */
5278c2ecf20Sopenharmony_ci#define PWMC_PRESCALER_SHIFT	8
5288c2ecf20Sopenharmony_ci#define PWMC_CLKSRC		0x8000	/* Clock Source Select */
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_ci/* '328-compatible definitions */
5318c2ecf20Sopenharmony_ci#define PWMC_PWMEN	PWMC_EN
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_ci/*
5348c2ecf20Sopenharmony_ci * PWM Sample Register
5358c2ecf20Sopenharmony_ci */
5368c2ecf20Sopenharmony_ci#define PWMS_ADDR	0xfffff502
5378c2ecf20Sopenharmony_ci#define PWMS		WORD_REF(PWMS_ADDR)
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci/*
5408c2ecf20Sopenharmony_ci * PWM Period Register
5418c2ecf20Sopenharmony_ci */
5428c2ecf20Sopenharmony_ci#define PWMP_ADDR	0xfffff504
5438c2ecf20Sopenharmony_ci#define PWMP		BYTE_REF(PWMP_ADDR)
5448c2ecf20Sopenharmony_ci
5458c2ecf20Sopenharmony_ci/*
5468c2ecf20Sopenharmony_ci * PWM Counter Register
5478c2ecf20Sopenharmony_ci */
5488c2ecf20Sopenharmony_ci#define PWMCNT_ADDR	0xfffff505
5498c2ecf20Sopenharmony_ci#define PWMCNT		BYTE_REF(PWMCNT_ADDR)
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ci/**********
5528c2ecf20Sopenharmony_ci *
5538c2ecf20Sopenharmony_ci * 0xFFFFF6xx -- General-Purpose Timer
5548c2ecf20Sopenharmony_ci *
5558c2ecf20Sopenharmony_ci **********/
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci/*
5588c2ecf20Sopenharmony_ci * Timer Control register
5598c2ecf20Sopenharmony_ci */
5608c2ecf20Sopenharmony_ci#define TCTL_ADDR	0xfffff600
5618c2ecf20Sopenharmony_ci#define TCTL		WORD_REF(TCTL_ADDR)
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci#define	TCTL_TEN		0x0001	/* Timer Enable  */
5648c2ecf20Sopenharmony_ci#define TCTL_CLKSOURCE_MASK 	0x000e	/* Clock Source: */
5658c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_STOP	   0x0000	/* Stop count (disabled)    */
5668c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_SYSCLK	   0x0002	/* SYSCLK to prescaler      */
5678c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_SYSCLK_16 0x0004	/* SYSCLK/16 to prescaler   */
5688c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_TIN	   0x0006	/* TIN to prescaler         */
5698c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_32KHZ	   0x0008	/* 32kHz clock to prescaler */
5708c2ecf20Sopenharmony_ci#define TCTL_IRQEN		0x0010	/* IRQ Enable    */
5718c2ecf20Sopenharmony_ci#define TCTL_OM			0x0020	/* Output Mode   */
5728c2ecf20Sopenharmony_ci#define TCTL_CAP_MASK		0x00c0	/* Capture Edge: */
5738c2ecf20Sopenharmony_ci#define	  TCTL_CAP_RE		0x0040		/* Capture on rizing edge   */
5748c2ecf20Sopenharmony_ci#define   TCTL_CAP_FE		0x0080		/* Capture on falling edge  */
5758c2ecf20Sopenharmony_ci#define TCTL_FRR		0x0010	/* Free-Run Mode */
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci/* '328-compatible definitions */
5788c2ecf20Sopenharmony_ci#define TCTL1_ADDR	TCTL_ADDR
5798c2ecf20Sopenharmony_ci#define TCTL1		TCTL
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_ci/*
5828c2ecf20Sopenharmony_ci * Timer Prescaler Register
5838c2ecf20Sopenharmony_ci */
5848c2ecf20Sopenharmony_ci#define TPRER_ADDR	0xfffff602
5858c2ecf20Sopenharmony_ci#define TPRER		WORD_REF(TPRER_ADDR)
5868c2ecf20Sopenharmony_ci
5878c2ecf20Sopenharmony_ci/* '328-compatible definitions */
5888c2ecf20Sopenharmony_ci#define TPRER1_ADDR	TPRER_ADDR
5898c2ecf20Sopenharmony_ci#define TPRER1		TPRER
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci/*
5928c2ecf20Sopenharmony_ci * Timer Compare Register
5938c2ecf20Sopenharmony_ci */
5948c2ecf20Sopenharmony_ci#define TCMP_ADDR	0xfffff604
5958c2ecf20Sopenharmony_ci#define TCMP		WORD_REF(TCMP_ADDR)
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci/* '328-compatible definitions */
5988c2ecf20Sopenharmony_ci#define TCMP1_ADDR	TCMP_ADDR
5998c2ecf20Sopenharmony_ci#define TCMP1		TCMP
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci/*
6028c2ecf20Sopenharmony_ci * Timer Capture register
6038c2ecf20Sopenharmony_ci */
6048c2ecf20Sopenharmony_ci#define TCR_ADDR	0xfffff606
6058c2ecf20Sopenharmony_ci#define TCR		WORD_REF(TCR_ADDR)
6068c2ecf20Sopenharmony_ci
6078c2ecf20Sopenharmony_ci/* '328-compatible definitions */
6088c2ecf20Sopenharmony_ci#define TCR1_ADDR	TCR_ADDR
6098c2ecf20Sopenharmony_ci#define TCR1		TCR
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci/*
6128c2ecf20Sopenharmony_ci * Timer Counter Register
6138c2ecf20Sopenharmony_ci */
6148c2ecf20Sopenharmony_ci#define TCN_ADDR	0xfffff608
6158c2ecf20Sopenharmony_ci#define TCN		WORD_REF(TCN_ADDR)
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ci/* '328-compatible definitions */
6188c2ecf20Sopenharmony_ci#define TCN1_ADDR	TCN_ADDR
6198c2ecf20Sopenharmony_ci#define TCN1		TCN
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci/*
6228c2ecf20Sopenharmony_ci * Timer Status Register
6238c2ecf20Sopenharmony_ci */
6248c2ecf20Sopenharmony_ci#define TSTAT_ADDR	0xfffff60a
6258c2ecf20Sopenharmony_ci#define TSTAT		WORD_REF(TSTAT_ADDR)
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci#define TSTAT_COMP	0x0001		/* Compare Event occurred */
6288c2ecf20Sopenharmony_ci#define TSTAT_CAPT	0x0001		/* Capture Event occurred */
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci/* '328-compatible definitions */
6318c2ecf20Sopenharmony_ci#define TSTAT1_ADDR	TSTAT_ADDR
6328c2ecf20Sopenharmony_ci#define TSTAT1		TSTAT
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_ci/**********
6358c2ecf20Sopenharmony_ci *
6368c2ecf20Sopenharmony_ci * 0xFFFFF8xx -- Serial Peripheral Interface Master (SPIM)
6378c2ecf20Sopenharmony_ci *
6388c2ecf20Sopenharmony_ci **********/
6398c2ecf20Sopenharmony_ci
6408c2ecf20Sopenharmony_ci/*
6418c2ecf20Sopenharmony_ci * SPIM Data Register
6428c2ecf20Sopenharmony_ci */
6438c2ecf20Sopenharmony_ci#define SPIMDATA_ADDR	0xfffff800
6448c2ecf20Sopenharmony_ci#define SPIMDATA	WORD_REF(SPIMDATA_ADDR)
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_ci/*
6478c2ecf20Sopenharmony_ci * SPIM Control/Status Register
6488c2ecf20Sopenharmony_ci */
6498c2ecf20Sopenharmony_ci#define SPIMCONT_ADDR	0xfffff802
6508c2ecf20Sopenharmony_ci#define SPIMCONT	WORD_REF(SPIMCONT_ADDR)
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci#define SPIMCONT_BIT_COUNT_MASK	 0x000f	/* Transfer Length in Bytes */
6538c2ecf20Sopenharmony_ci#define SPIMCONT_BIT_COUNT_SHIFT 0
6548c2ecf20Sopenharmony_ci#define SPIMCONT_POL		 0x0010	/* SPMCLK Signel Polarity */
6558c2ecf20Sopenharmony_ci#define	SPIMCONT_PHA		 0x0020	/* Clock/Data phase relationship */
6568c2ecf20Sopenharmony_ci#define SPIMCONT_IRQEN		 0x0040 /* IRQ Enable */
6578c2ecf20Sopenharmony_ci#define SPIMCONT_IRQ		 0x0080	/* Interrupt Request */
6588c2ecf20Sopenharmony_ci#define SPIMCONT_XCH		 0x0100	/* Exchange */
6598c2ecf20Sopenharmony_ci#define SPIMCONT_ENABLE		 0x0200	/* Enable SPIM */
6608c2ecf20Sopenharmony_ci#define SPIMCONT_DATA_RATE_MASK	 0xe000	/* SPIM Data Rate */
6618c2ecf20Sopenharmony_ci#define SPIMCONT_DATA_RATE_SHIFT 13
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ci/* '328-compatible definitions */
6648c2ecf20Sopenharmony_ci#define SPIMCONT_SPIMIRQ	SPIMCONT_IRQ
6658c2ecf20Sopenharmony_ci#define SPIMCONT_SPIMEN		SPIMCONT_ENABLE
6668c2ecf20Sopenharmony_ci
6678c2ecf20Sopenharmony_ci/**********
6688c2ecf20Sopenharmony_ci *
6698c2ecf20Sopenharmony_ci * 0xFFFFF9xx -- UART
6708c2ecf20Sopenharmony_ci *
6718c2ecf20Sopenharmony_ci **********/
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci/*
6748c2ecf20Sopenharmony_ci * UART Status/Control Register
6758c2ecf20Sopenharmony_ci */
6768c2ecf20Sopenharmony_ci#define USTCNT_ADDR	0xfffff900
6778c2ecf20Sopenharmony_ci#define USTCNT		WORD_REF(USTCNT_ADDR)
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_ci#define USTCNT_TXAE	0x0001	/* Transmitter Available Interrupt Enable */
6808c2ecf20Sopenharmony_ci#define USTCNT_TXHE	0x0002	/* Transmitter Half Empty Enable */
6818c2ecf20Sopenharmony_ci#define USTCNT_TXEE	0x0004	/* Transmitter Empty Interrupt Enable */
6828c2ecf20Sopenharmony_ci#define USTCNT_RXRE	0x0008	/* Receiver Ready Interrupt Enable */
6838c2ecf20Sopenharmony_ci#define USTCNT_RXHE	0x0010	/* Receiver Half-Full Interrupt Enable */
6848c2ecf20Sopenharmony_ci#define USTCNT_RXFE	0x0020	/* Receiver Full Interrupt Enable */
6858c2ecf20Sopenharmony_ci#define USTCNT_CTSD	0x0040	/* CTS Delta Interrupt Enable */
6868c2ecf20Sopenharmony_ci#define USTCNT_ODEN	0x0080	/* Old Data Interrupt Enable */
6878c2ecf20Sopenharmony_ci#define USTCNT_8_7	0x0100	/* Eight or seven-bit transmission */
6888c2ecf20Sopenharmony_ci#define USTCNT_STOP	0x0200	/* Stop bit transmission */
6898c2ecf20Sopenharmony_ci#define USTCNT_ODD	0x0400	/* Odd Parity */
6908c2ecf20Sopenharmony_ci#define	USTCNT_PEN	0x0800	/* Parity Enable */
6918c2ecf20Sopenharmony_ci#define USTCNT_CLKM	0x1000	/* Clock Mode Select */
6928c2ecf20Sopenharmony_ci#define	USTCNT_TXEN	0x2000	/* Transmitter Enable */
6938c2ecf20Sopenharmony_ci#define USTCNT_RXEN	0x4000	/* Receiver Enable */
6948c2ecf20Sopenharmony_ci#define USTCNT_UEN	0x8000	/* UART Enable */
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ci/* '328-compatible definitions */
6978c2ecf20Sopenharmony_ci#define USTCNT_TXAVAILEN	USTCNT_TXAE
6988c2ecf20Sopenharmony_ci#define USTCNT_TXHALFEN		USTCNT_TXHE
6998c2ecf20Sopenharmony_ci#define USTCNT_TXEMPTYEN	USTCNT_TXEE
7008c2ecf20Sopenharmony_ci#define USTCNT_RXREADYEN	USTCNT_RXRE
7018c2ecf20Sopenharmony_ci#define USTCNT_RXHALFEN		USTCNT_RXHE
7028c2ecf20Sopenharmony_ci#define USTCNT_RXFULLEN		USTCNT_RXFE
7038c2ecf20Sopenharmony_ci#define USTCNT_CTSDELTAEN	USTCNT_CTSD
7048c2ecf20Sopenharmony_ci#define USTCNT_ODD_EVEN		USTCNT_ODD
7058c2ecf20Sopenharmony_ci#define USTCNT_PARITYEN		USTCNT_PEN
7068c2ecf20Sopenharmony_ci#define USTCNT_CLKMODE		USTCNT_CLKM
7078c2ecf20Sopenharmony_ci#define USTCNT_UARTEN		USTCNT_UEN
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_ci/*
7108c2ecf20Sopenharmony_ci * UART Baud Control Register
7118c2ecf20Sopenharmony_ci */
7128c2ecf20Sopenharmony_ci#define UBAUD_ADDR	0xfffff902
7138c2ecf20Sopenharmony_ci#define UBAUD		WORD_REF(UBAUD_ADDR)
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ci#define UBAUD_PRESCALER_MASK	0x003f	/* Actual divisor is 65 - PRESCALER */
7168c2ecf20Sopenharmony_ci#define UBAUD_PRESCALER_SHIFT	0
7178c2ecf20Sopenharmony_ci#define UBAUD_DIVIDE_MASK	0x0700	/* Baud Rate freq. divisor */
7188c2ecf20Sopenharmony_ci#define UBAUD_DIVIDE_SHIFT	8
7198c2ecf20Sopenharmony_ci#define UBAUD_BAUD_SRC		0x0800	/* Baud Rate Source */
7208c2ecf20Sopenharmony_ci#define UBAUD_UCLKDIR		0x2000	/* UCLK Direction */
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci/*
7238c2ecf20Sopenharmony_ci * UART Receiver Register
7248c2ecf20Sopenharmony_ci */
7258c2ecf20Sopenharmony_ci#define URX_ADDR	0xfffff904
7268c2ecf20Sopenharmony_ci#define URX		WORD_REF(URX_ADDR)
7278c2ecf20Sopenharmony_ci
7288c2ecf20Sopenharmony_ci#define URX_RXDATA_ADDR	0xfffff905
7298c2ecf20Sopenharmony_ci#define URX_RXDATA	BYTE_REF(URX_RXDATA_ADDR)
7308c2ecf20Sopenharmony_ci
7318c2ecf20Sopenharmony_ci#define URX_RXDATA_MASK	 0x00ff	/* Received data */
7328c2ecf20Sopenharmony_ci#define URX_RXDATA_SHIFT 0
7338c2ecf20Sopenharmony_ci#define URX_PARITY_ERROR 0x0100	/* Parity Error */
7348c2ecf20Sopenharmony_ci#define URX_BREAK	 0x0200	/* Break Detected */
7358c2ecf20Sopenharmony_ci#define URX_FRAME_ERROR	 0x0400	/* Framing Error */
7368c2ecf20Sopenharmony_ci#define URX_OVRUN	 0x0800	/* Serial Overrun */
7378c2ecf20Sopenharmony_ci#define URX_OLD_DATA	 0x1000	/* Old data in FIFO */
7388c2ecf20Sopenharmony_ci#define URX_DATA_READY	 0x2000	/* Data Ready (FIFO not empty) */
7398c2ecf20Sopenharmony_ci#define URX_FIFO_HALF	 0x4000 /* FIFO is Half-Full */
7408c2ecf20Sopenharmony_ci#define URX_FIFO_FULL	 0x8000	/* FIFO is Full */
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_ci/*
7438c2ecf20Sopenharmony_ci * UART Transmitter Register
7448c2ecf20Sopenharmony_ci */
7458c2ecf20Sopenharmony_ci#define UTX_ADDR	0xfffff906
7468c2ecf20Sopenharmony_ci#define UTX		WORD_REF(UTX_ADDR)
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci#define UTX_TXDATA_ADDR	0xfffff907
7498c2ecf20Sopenharmony_ci#define UTX_TXDATA	BYTE_REF(UTX_TXDATA_ADDR)
7508c2ecf20Sopenharmony_ci
7518c2ecf20Sopenharmony_ci#define UTX_TXDATA_MASK	 0x00ff	/* Data to be transmitted */
7528c2ecf20Sopenharmony_ci#define UTX_TXDATA_SHIFT 0
7538c2ecf20Sopenharmony_ci#define UTX_CTS_DELTA	 0x0100	/* CTS changed */
7548c2ecf20Sopenharmony_ci#define UTX_CTS_STAT	 0x0200	/* CTS State */
7558c2ecf20Sopenharmony_ci#define	UTX_BUSY	 0x0400	/* FIFO is busy, sending a character */
7568c2ecf20Sopenharmony_ci#define	UTX_NOCTS	 0x0800	/* Ignore CTS */
7578c2ecf20Sopenharmony_ci#define UTX_SEND_BREAK	 0x1000	/* Send a BREAK */
7588c2ecf20Sopenharmony_ci#define UTX_TX_AVAIL	 0x2000	/* Transmit FIFO has a slot available */
7598c2ecf20Sopenharmony_ci#define UTX_FIFO_HALF	 0x4000	/* Transmit FIFO is half empty */
7608c2ecf20Sopenharmony_ci#define UTX_FIFO_EMPTY	 0x8000	/* Transmit FIFO is empty */
7618c2ecf20Sopenharmony_ci
7628c2ecf20Sopenharmony_ci/* '328-compatible definitions */
7638c2ecf20Sopenharmony_ci#define UTX_CTS_STATUS	UTX_CTS_STAT
7648c2ecf20Sopenharmony_ci#define UTX_IGNORE_CTS	UTX_NOCTS
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci/*
7678c2ecf20Sopenharmony_ci * UART Miscellaneous Register
7688c2ecf20Sopenharmony_ci */
7698c2ecf20Sopenharmony_ci#define UMISC_ADDR	0xfffff908
7708c2ecf20Sopenharmony_ci#define UMISC		WORD_REF(UMISC_ADDR)
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci#define UMISC_TX_POL	 0x0004	/* Transmit Polarity */
7738c2ecf20Sopenharmony_ci#define UMISC_RX_POL	 0x0008	/* Receive Polarity */
7748c2ecf20Sopenharmony_ci#define UMISC_IRDA_LOOP	 0x0010	/* IrDA Loopback Enable */
7758c2ecf20Sopenharmony_ci#define UMISC_IRDA_EN	 0x0020	/* Infra-Red Enable */
7768c2ecf20Sopenharmony_ci#define UMISC_RTS	 0x0040	/* Set RTS status */
7778c2ecf20Sopenharmony_ci#define UMISC_RTSCONT	 0x0080	/* Choose RTS control */
7788c2ecf20Sopenharmony_ci#define UMISC_IR_TEST	 0x0400	/* IRDA Test Enable */
7798c2ecf20Sopenharmony_ci#define UMISC_BAUD_RESET 0x0800	/* Reset Baud Rate Generation Counters */
7808c2ecf20Sopenharmony_ci#define UMISC_LOOP	 0x1000	/* Serial Loopback Enable */
7818c2ecf20Sopenharmony_ci#define UMISC_FORCE_PERR 0x2000	/* Force Parity Error */
7828c2ecf20Sopenharmony_ci#define UMISC_CLKSRC	 0x4000	/* Clock Source */
7838c2ecf20Sopenharmony_ci#define UMISC_BAUD_TEST	 0x8000	/* Enable Baud Test Mode */
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci/*
7868c2ecf20Sopenharmony_ci * UART Non-integer Prescaler Register
7878c2ecf20Sopenharmony_ci */
7888c2ecf20Sopenharmony_ci#define NIPR_ADDR	0xfffff90a
7898c2ecf20Sopenharmony_ci#define NIPR		WORD_REF(NIPR_ADDR)
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci#define NIPR_STEP_VALUE_MASK	0x00ff	/* NI prescaler step value */
7928c2ecf20Sopenharmony_ci#define NIPR_STEP_VALUE_SHIFT	0
7938c2ecf20Sopenharmony_ci#define NIPR_SELECT_MASK	0x0700	/* Tap Selection */
7948c2ecf20Sopenharmony_ci#define NIPR_SELECT_SHIFT	8
7958c2ecf20Sopenharmony_ci#define NIPR_PRE_SEL		0x8000	/* Non-integer prescaler select */
7968c2ecf20Sopenharmony_ci
7978c2ecf20Sopenharmony_ci
7988c2ecf20Sopenharmony_ci/* generalization of uart control registers to support multiple ports: */
7998c2ecf20Sopenharmony_citypedef volatile struct {
8008c2ecf20Sopenharmony_ci  volatile unsigned short int ustcnt;
8018c2ecf20Sopenharmony_ci  volatile unsigned short int ubaud;
8028c2ecf20Sopenharmony_ci  union {
8038c2ecf20Sopenharmony_ci    volatile unsigned short int w;
8048c2ecf20Sopenharmony_ci    struct {
8058c2ecf20Sopenharmony_ci      volatile unsigned char status;
8068c2ecf20Sopenharmony_ci      volatile unsigned char rxdata;
8078c2ecf20Sopenharmony_ci    } b;
8088c2ecf20Sopenharmony_ci  } urx;
8098c2ecf20Sopenharmony_ci  union {
8108c2ecf20Sopenharmony_ci    volatile unsigned short int w;
8118c2ecf20Sopenharmony_ci    struct {
8128c2ecf20Sopenharmony_ci      volatile unsigned char status;
8138c2ecf20Sopenharmony_ci      volatile unsigned char txdata;
8148c2ecf20Sopenharmony_ci    } b;
8158c2ecf20Sopenharmony_ci  } utx;
8168c2ecf20Sopenharmony_ci  volatile unsigned short int umisc;
8178c2ecf20Sopenharmony_ci  volatile unsigned short int nipr;
8188c2ecf20Sopenharmony_ci  volatile unsigned short int pad1;
8198c2ecf20Sopenharmony_ci  volatile unsigned short int pad2;
8208c2ecf20Sopenharmony_ci} __packed m68328_uart;
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci/**********
8248c2ecf20Sopenharmony_ci *
8258c2ecf20Sopenharmony_ci * 0xFFFFFAxx -- LCD Controller
8268c2ecf20Sopenharmony_ci *
8278c2ecf20Sopenharmony_ci **********/
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci/*
8308c2ecf20Sopenharmony_ci * LCD Screen Starting Address Register
8318c2ecf20Sopenharmony_ci */
8328c2ecf20Sopenharmony_ci#define LSSA_ADDR	0xfffffa00
8338c2ecf20Sopenharmony_ci#define LSSA		LONG_REF(LSSA_ADDR)
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci#define LSSA_SSA_MASK	0x1ffffffe	/* Bits 0 and 29-31 are reserved */
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_ci/*
8388c2ecf20Sopenharmony_ci * LCD Virtual Page Width Register
8398c2ecf20Sopenharmony_ci */
8408c2ecf20Sopenharmony_ci#define LVPW_ADDR	0xfffffa05
8418c2ecf20Sopenharmony_ci#define LVPW		BYTE_REF(LVPW_ADDR)
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_ci/*
8448c2ecf20Sopenharmony_ci * LCD Screen Width Register (not compatible with '328 !!!)
8458c2ecf20Sopenharmony_ci */
8468c2ecf20Sopenharmony_ci#define LXMAX_ADDR	0xfffffa08
8478c2ecf20Sopenharmony_ci#define LXMAX		WORD_REF(LXMAX_ADDR)
8488c2ecf20Sopenharmony_ci
8498c2ecf20Sopenharmony_ci#define LXMAX_XM_MASK	0x02f0		/* Bits 0-3 and 10-15 are reserved */
8508c2ecf20Sopenharmony_ci
8518c2ecf20Sopenharmony_ci/*
8528c2ecf20Sopenharmony_ci * LCD Screen Height Register
8538c2ecf20Sopenharmony_ci */
8548c2ecf20Sopenharmony_ci#define LYMAX_ADDR	0xfffffa0a
8558c2ecf20Sopenharmony_ci#define LYMAX		WORD_REF(LYMAX_ADDR)
8568c2ecf20Sopenharmony_ci
8578c2ecf20Sopenharmony_ci#define LYMAX_YM_MASK	0x01ff		/* Bits 9-15 are reserved */
8588c2ecf20Sopenharmony_ci
8598c2ecf20Sopenharmony_ci/*
8608c2ecf20Sopenharmony_ci * LCD Cursor X Position Register
8618c2ecf20Sopenharmony_ci */
8628c2ecf20Sopenharmony_ci#define LCXP_ADDR	0xfffffa18
8638c2ecf20Sopenharmony_ci#define LCXP		WORD_REF(LCXP_ADDR)
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_ci#define LCXP_CC_MASK	0xc000		/* Cursor Control */
8668c2ecf20Sopenharmony_ci#define   LCXP_CC_TRAMSPARENT	0x0000
8678c2ecf20Sopenharmony_ci#define   LCXP_CC_BLACK		0x4000
8688c2ecf20Sopenharmony_ci#define   LCXP_CC_REVERSED	0x8000
8698c2ecf20Sopenharmony_ci#define   LCXP_CC_WHITE		0xc000
8708c2ecf20Sopenharmony_ci#define LCXP_CXP_MASK	0x02ff		/* Cursor X position */
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_ci/*
8738c2ecf20Sopenharmony_ci * LCD Cursor Y Position Register
8748c2ecf20Sopenharmony_ci */
8758c2ecf20Sopenharmony_ci#define LCYP_ADDR	0xfffffa1a
8768c2ecf20Sopenharmony_ci#define LCYP		WORD_REF(LCYP_ADDR)
8778c2ecf20Sopenharmony_ci
8788c2ecf20Sopenharmony_ci#define LCYP_CYP_MASK	0x01ff		/* Cursor Y Position */
8798c2ecf20Sopenharmony_ci
8808c2ecf20Sopenharmony_ci/*
8818c2ecf20Sopenharmony_ci * LCD Cursor Width and Heigth Register
8828c2ecf20Sopenharmony_ci */
8838c2ecf20Sopenharmony_ci#define LCWCH_ADDR	0xfffffa1c
8848c2ecf20Sopenharmony_ci#define LCWCH		WORD_REF(LCWCH_ADDR)
8858c2ecf20Sopenharmony_ci
8868c2ecf20Sopenharmony_ci#define LCWCH_CH_MASK	0x001f		/* Cursor Height */
8878c2ecf20Sopenharmony_ci#define LCWCH_CH_SHIFT	0
8888c2ecf20Sopenharmony_ci#define LCWCH_CW_MASK	0x1f00		/* Cursor Width */
8898c2ecf20Sopenharmony_ci#define LCWCH_CW_SHIFT	8
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci/*
8928c2ecf20Sopenharmony_ci * LCD Blink Control Register
8938c2ecf20Sopenharmony_ci */
8948c2ecf20Sopenharmony_ci#define LBLKC_ADDR	0xfffffa1f
8958c2ecf20Sopenharmony_ci#define LBLKC		BYTE_REF(LBLKC_ADDR)
8968c2ecf20Sopenharmony_ci
8978c2ecf20Sopenharmony_ci#define LBLKC_BD_MASK	0x7f	/* Blink Divisor */
8988c2ecf20Sopenharmony_ci#define LBLKC_BD_SHIFT	0
8998c2ecf20Sopenharmony_ci#define LBLKC_BKEN	0x80	/* Blink Enabled */
9008c2ecf20Sopenharmony_ci
9018c2ecf20Sopenharmony_ci/*
9028c2ecf20Sopenharmony_ci * LCD Panel Interface Configuration Register
9038c2ecf20Sopenharmony_ci */
9048c2ecf20Sopenharmony_ci#define LPICF_ADDR	0xfffffa20
9058c2ecf20Sopenharmony_ci#define LPICF		BYTE_REF(LPICF_ADDR)
9068c2ecf20Sopenharmony_ci
9078c2ecf20Sopenharmony_ci#define LPICF_GS_MASK	 0x03	 /* Gray-Scale Mode */
9088c2ecf20Sopenharmony_ci#define	  LPICF_GS_BW	   0x00
9098c2ecf20Sopenharmony_ci#define   LPICF_GS_GRAY_4  0x01
9108c2ecf20Sopenharmony_ci#define   LPICF_GS_GRAY_16 0x02
9118c2ecf20Sopenharmony_ci#define LPICF_PBSIZ_MASK 0x0c	/* Panel Bus Width */
9128c2ecf20Sopenharmony_ci#define   LPICF_PBSIZ_1	   0x00
9138c2ecf20Sopenharmony_ci#define   LPICF_PBSIZ_2    0x04
9148c2ecf20Sopenharmony_ci#define   LPICF_PBSIZ_4    0x08
9158c2ecf20Sopenharmony_ci
9168c2ecf20Sopenharmony_ci/*
9178c2ecf20Sopenharmony_ci * LCD Polarity Configuration Register
9188c2ecf20Sopenharmony_ci */
9198c2ecf20Sopenharmony_ci#define LPOLCF_ADDR	0xfffffa21
9208c2ecf20Sopenharmony_ci#define LPOLCF		BYTE_REF(LPOLCF_ADDR)
9218c2ecf20Sopenharmony_ci
9228c2ecf20Sopenharmony_ci#define LPOLCF_PIXPOL	0x01	/* Pixel Polarity */
9238c2ecf20Sopenharmony_ci#define LPOLCF_LPPOL	0x02	/* Line Pulse Polarity */
9248c2ecf20Sopenharmony_ci#define LPOLCF_FLMPOL	0x04	/* Frame Marker Polarity */
9258c2ecf20Sopenharmony_ci#define LPOLCF_LCKPOL	0x08	/* LCD Shift Lock Polarity */
9268c2ecf20Sopenharmony_ci
9278c2ecf20Sopenharmony_ci/*
9288c2ecf20Sopenharmony_ci * LACD (LCD Alternate Crystal Direction) Rate Control Register
9298c2ecf20Sopenharmony_ci */
9308c2ecf20Sopenharmony_ci#define LACDRC_ADDR	0xfffffa23
9318c2ecf20Sopenharmony_ci#define LACDRC		BYTE_REF(LACDRC_ADDR)
9328c2ecf20Sopenharmony_ci
9338c2ecf20Sopenharmony_ci#define LACDRC_ACDSLT	 0x80	/* Signal Source Select */
9348c2ecf20Sopenharmony_ci#define LACDRC_ACD_MASK	 0x0f	/* Alternate Crystal Direction Control */
9358c2ecf20Sopenharmony_ci#define LACDRC_ACD_SHIFT 0
9368c2ecf20Sopenharmony_ci
9378c2ecf20Sopenharmony_ci/*
9388c2ecf20Sopenharmony_ci * LCD Pixel Clock Divider Register
9398c2ecf20Sopenharmony_ci */
9408c2ecf20Sopenharmony_ci#define LPXCD_ADDR	0xfffffa25
9418c2ecf20Sopenharmony_ci#define LPXCD		BYTE_REF(LPXCD_ADDR)
9428c2ecf20Sopenharmony_ci
9438c2ecf20Sopenharmony_ci#define	LPXCD_PCD_MASK	0x3f 	/* Pixel Clock Divider */
9448c2ecf20Sopenharmony_ci#define LPXCD_PCD_SHIFT	0
9458c2ecf20Sopenharmony_ci
9468c2ecf20Sopenharmony_ci/*
9478c2ecf20Sopenharmony_ci * LCD Clocking Control Register
9488c2ecf20Sopenharmony_ci */
9498c2ecf20Sopenharmony_ci#define LCKCON_ADDR	0xfffffa27
9508c2ecf20Sopenharmony_ci#define LCKCON		BYTE_REF(LCKCON_ADDR)
9518c2ecf20Sopenharmony_ci
9528c2ecf20Sopenharmony_ci#define LCKCON_DWS_MASK	 0x0f	/* Display Wait-State */
9538c2ecf20Sopenharmony_ci#define LCKCON_DWS_SHIFT 0
9548c2ecf20Sopenharmony_ci#define LCKCON_DWIDTH	 0x40	/* Display Memory Width  */
9558c2ecf20Sopenharmony_ci#define LCKCON_LCDON	 0x80	/* Enable LCD Controller */
9568c2ecf20Sopenharmony_ci
9578c2ecf20Sopenharmony_ci/* '328-compatible definitions */
9588c2ecf20Sopenharmony_ci#define LCKCON_DW_MASK  LCKCON_DWS_MASK
9598c2ecf20Sopenharmony_ci#define LCKCON_DW_SHIFT LCKCON_DWS_SHIFT
9608c2ecf20Sopenharmony_ci
9618c2ecf20Sopenharmony_ci/*
9628c2ecf20Sopenharmony_ci * LCD Refresh Rate Adjustment Register
9638c2ecf20Sopenharmony_ci */
9648c2ecf20Sopenharmony_ci#define LRRA_ADDR	0xfffffa29
9658c2ecf20Sopenharmony_ci#define LRRA		BYTE_REF(LRRA_ADDR)
9668c2ecf20Sopenharmony_ci
9678c2ecf20Sopenharmony_ci/*
9688c2ecf20Sopenharmony_ci * LCD Panning Offset Register
9698c2ecf20Sopenharmony_ci */
9708c2ecf20Sopenharmony_ci#define LPOSR_ADDR	0xfffffa2d
9718c2ecf20Sopenharmony_ci#define LPOSR		BYTE_REF(LPOSR_ADDR)
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci#define LPOSR_POS_MASK	0x0f	/* Pixel Offset Code */
9748c2ecf20Sopenharmony_ci#define LPOSR_POS_SHIFT	0
9758c2ecf20Sopenharmony_ci
9768c2ecf20Sopenharmony_ci/*
9778c2ecf20Sopenharmony_ci * LCD Frame Rate Control Modulation Register
9788c2ecf20Sopenharmony_ci */
9798c2ecf20Sopenharmony_ci#define LFRCM_ADDR	0xfffffa31
9808c2ecf20Sopenharmony_ci#define LFRCM		BYTE_REF(LFRCM_ADDR)
9818c2ecf20Sopenharmony_ci
9828c2ecf20Sopenharmony_ci#define LFRCM_YMOD_MASK	 0x0f	/* Vertical Modulation */
9838c2ecf20Sopenharmony_ci#define LFRCM_YMOD_SHIFT 0
9848c2ecf20Sopenharmony_ci#define LFRCM_XMOD_MASK	 0xf0	/* Horizontal Modulation */
9858c2ecf20Sopenharmony_ci#define LFRCM_XMOD_SHIFT 4
9868c2ecf20Sopenharmony_ci
9878c2ecf20Sopenharmony_ci/*
9888c2ecf20Sopenharmony_ci * LCD Gray Palette Mapping Register
9898c2ecf20Sopenharmony_ci */
9908c2ecf20Sopenharmony_ci#define LGPMR_ADDR	0xfffffa33
9918c2ecf20Sopenharmony_ci#define LGPMR		BYTE_REF(LGPMR_ADDR)
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci#define LGPMR_G1_MASK	0x0f
9948c2ecf20Sopenharmony_ci#define LGPMR_G1_SHIFT	0
9958c2ecf20Sopenharmony_ci#define LGPMR_G2_MASK	0xf0
9968c2ecf20Sopenharmony_ci#define LGPMR_G2_SHIFT	4
9978c2ecf20Sopenharmony_ci
9988c2ecf20Sopenharmony_ci/*
9998c2ecf20Sopenharmony_ci * PWM Contrast Control Register
10008c2ecf20Sopenharmony_ci */
10018c2ecf20Sopenharmony_ci#define PWMR_ADDR	0xfffffa36
10028c2ecf20Sopenharmony_ci#define PWMR		WORD_REF(PWMR_ADDR)
10038c2ecf20Sopenharmony_ci
10048c2ecf20Sopenharmony_ci#define PWMR_PW_MASK	0x00ff	/* Pulse Width */
10058c2ecf20Sopenharmony_ci#define PWMR_PW_SHIFT	0
10068c2ecf20Sopenharmony_ci#define PWMR_CCPEN	0x0100	/* Contrast Control Enable */
10078c2ecf20Sopenharmony_ci#define PWMR_SRC_MASK	0x0600	/* Input Clock Source */
10088c2ecf20Sopenharmony_ci#define   PWMR_SRC_LINE	  0x0000	/* Line Pulse  */
10098c2ecf20Sopenharmony_ci#define   PWMR_SRC_PIXEL  0x0200	/* Pixel Clock */
10108c2ecf20Sopenharmony_ci#define   PWMR_SRC_LCD    0x4000	/* LCD clock   */
10118c2ecf20Sopenharmony_ci
10128c2ecf20Sopenharmony_ci/**********
10138c2ecf20Sopenharmony_ci *
10148c2ecf20Sopenharmony_ci * 0xFFFFFBxx -- Real-Time Clock (RTC)
10158c2ecf20Sopenharmony_ci *
10168c2ecf20Sopenharmony_ci **********/
10178c2ecf20Sopenharmony_ci
10188c2ecf20Sopenharmony_ci/*
10198c2ecf20Sopenharmony_ci * RTC Hours Minutes and Seconds Register
10208c2ecf20Sopenharmony_ci */
10218c2ecf20Sopenharmony_ci#define RTCTIME_ADDR	0xfffffb00
10228c2ecf20Sopenharmony_ci#define RTCTIME		LONG_REF(RTCTIME_ADDR)
10238c2ecf20Sopenharmony_ci
10248c2ecf20Sopenharmony_ci#define RTCTIME_SECONDS_MASK	0x0000003f	/* Seconds */
10258c2ecf20Sopenharmony_ci#define RTCTIME_SECONDS_SHIFT	0
10268c2ecf20Sopenharmony_ci#define RTCTIME_MINUTES_MASK	0x003f0000	/* Minutes */
10278c2ecf20Sopenharmony_ci#define RTCTIME_MINUTES_SHIFT	16
10288c2ecf20Sopenharmony_ci#define RTCTIME_HOURS_MASK	0x1f000000	/* Hours */
10298c2ecf20Sopenharmony_ci#define RTCTIME_HOURS_SHIFT	24
10308c2ecf20Sopenharmony_ci
10318c2ecf20Sopenharmony_ci/*
10328c2ecf20Sopenharmony_ci *  RTC Alarm Register
10338c2ecf20Sopenharmony_ci */
10348c2ecf20Sopenharmony_ci#define RTCALRM_ADDR    0xfffffb04
10358c2ecf20Sopenharmony_ci#define RTCALRM         LONG_REF(RTCALRM_ADDR)
10368c2ecf20Sopenharmony_ci
10378c2ecf20Sopenharmony_ci#define RTCALRM_SECONDS_MASK    0x0000003f      /* Seconds */
10388c2ecf20Sopenharmony_ci#define RTCALRM_SECONDS_SHIFT   0
10398c2ecf20Sopenharmony_ci#define RTCALRM_MINUTES_MASK    0x003f0000      /* Minutes */
10408c2ecf20Sopenharmony_ci#define RTCALRM_MINUTES_SHIFT   16
10418c2ecf20Sopenharmony_ci#define RTCALRM_HOURS_MASK      0x1f000000      /* Hours */
10428c2ecf20Sopenharmony_ci#define RTCALRM_HOURS_SHIFT     24
10438c2ecf20Sopenharmony_ci
10448c2ecf20Sopenharmony_ci/*
10458c2ecf20Sopenharmony_ci * Watchdog Timer Register
10468c2ecf20Sopenharmony_ci */
10478c2ecf20Sopenharmony_ci#define WATCHDOG_ADDR	0xfffffb0a
10488c2ecf20Sopenharmony_ci#define WATCHDOG	WORD_REF(WATCHDOG_ADDR)
10498c2ecf20Sopenharmony_ci
10508c2ecf20Sopenharmony_ci#define WATCHDOG_EN	0x0001	/* Watchdog Enabled */
10518c2ecf20Sopenharmony_ci#define WATCHDOG_ISEL	0x0002	/* Select the watchdog interrupt */
10528c2ecf20Sopenharmony_ci#define WATCHDOG_INTF	0x0080	/* Watchdog interrupt occurred */
10538c2ecf20Sopenharmony_ci#define WATCHDOG_CNT_MASK  0x0300	/* Watchdog Counter */
10548c2ecf20Sopenharmony_ci#define WATCHDOG_CNT_SHIFT 8
10558c2ecf20Sopenharmony_ci
10568c2ecf20Sopenharmony_ci/*
10578c2ecf20Sopenharmony_ci * RTC Control Register
10588c2ecf20Sopenharmony_ci */
10598c2ecf20Sopenharmony_ci#define RTCCTL_ADDR	0xfffffb0c
10608c2ecf20Sopenharmony_ci#define RTCCTL		WORD_REF(RTCCTL_ADDR)
10618c2ecf20Sopenharmony_ci
10628c2ecf20Sopenharmony_ci#define RTCCTL_XTL	0x0020	/* Crystal Selection */
10638c2ecf20Sopenharmony_ci#define RTCCTL_EN	0x0080	/* RTC Enable */
10648c2ecf20Sopenharmony_ci
10658c2ecf20Sopenharmony_ci/* '328-compatible definitions */
10668c2ecf20Sopenharmony_ci#define RTCCTL_384	RTCCTL_XTL
10678c2ecf20Sopenharmony_ci#define RTCCTL_ENABLE	RTCCTL_EN
10688c2ecf20Sopenharmony_ci
10698c2ecf20Sopenharmony_ci/*
10708c2ecf20Sopenharmony_ci * RTC Interrupt Status Register
10718c2ecf20Sopenharmony_ci */
10728c2ecf20Sopenharmony_ci#define RTCISR_ADDR	0xfffffb0e
10738c2ecf20Sopenharmony_ci#define RTCISR		WORD_REF(RTCISR_ADDR)
10748c2ecf20Sopenharmony_ci
10758c2ecf20Sopenharmony_ci#define RTCISR_SW	0x0001	/* Stopwatch timed out */
10768c2ecf20Sopenharmony_ci#define RTCISR_MIN	0x0002	/* 1-minute interrupt has occurred */
10778c2ecf20Sopenharmony_ci#define RTCISR_ALM	0x0004	/* Alarm interrupt has occurred */
10788c2ecf20Sopenharmony_ci#define RTCISR_DAY	0x0008	/* 24-hour rollover interrupt has occurred */
10798c2ecf20Sopenharmony_ci#define RTCISR_1HZ	0x0010	/* 1Hz interrupt has occurred */
10808c2ecf20Sopenharmony_ci#define RTCISR_HR	0x0020	/* 1-hour interrupt has occurred */
10818c2ecf20Sopenharmony_ci#define RTCISR_SAM0	0x0100	/*   4Hz /   4.6875Hz interrupt has occurred */
10828c2ecf20Sopenharmony_ci#define RTCISR_SAM1	0x0200	/*   8Hz /   9.3750Hz interrupt has occurred */
10838c2ecf20Sopenharmony_ci#define RTCISR_SAM2	0x0400	/*  16Hz /  18.7500Hz interrupt has occurred */
10848c2ecf20Sopenharmony_ci#define RTCISR_SAM3	0x0800	/*  32Hz /  37.5000Hz interrupt has occurred */
10858c2ecf20Sopenharmony_ci#define RTCISR_SAM4	0x1000	/*  64Hz /  75.0000Hz interrupt has occurred */
10868c2ecf20Sopenharmony_ci#define RTCISR_SAM5	0x2000	/* 128Hz / 150.0000Hz interrupt has occurred */
10878c2ecf20Sopenharmony_ci#define RTCISR_SAM6	0x4000	/* 256Hz / 300.0000Hz interrupt has occurred */
10888c2ecf20Sopenharmony_ci#define RTCISR_SAM7	0x8000	/* 512Hz / 600.0000Hz interrupt has occurred */
10898c2ecf20Sopenharmony_ci
10908c2ecf20Sopenharmony_ci/*
10918c2ecf20Sopenharmony_ci * RTC Interrupt Enable Register
10928c2ecf20Sopenharmony_ci */
10938c2ecf20Sopenharmony_ci#define RTCIENR_ADDR	0xfffffb10
10948c2ecf20Sopenharmony_ci#define RTCIENR		WORD_REF(RTCIENR_ADDR)
10958c2ecf20Sopenharmony_ci
10968c2ecf20Sopenharmony_ci#define RTCIENR_SW	0x0001	/* Stopwatch interrupt enable */
10978c2ecf20Sopenharmony_ci#define RTCIENR_MIN	0x0002	/* 1-minute interrupt enable */
10988c2ecf20Sopenharmony_ci#define RTCIENR_ALM	0x0004	/* Alarm interrupt enable */
10998c2ecf20Sopenharmony_ci#define RTCIENR_DAY	0x0008	/* 24-hour rollover interrupt enable */
11008c2ecf20Sopenharmony_ci#define RTCIENR_1HZ	0x0010	/* 1Hz interrupt enable */
11018c2ecf20Sopenharmony_ci#define RTCIENR_HR	0x0020	/* 1-hour interrupt enable */
11028c2ecf20Sopenharmony_ci#define RTCIENR_SAM0	0x0100	/*   4Hz /   4.6875Hz interrupt enable */
11038c2ecf20Sopenharmony_ci#define RTCIENR_SAM1	0x0200	/*   8Hz /   9.3750Hz interrupt enable */
11048c2ecf20Sopenharmony_ci#define RTCIENR_SAM2	0x0400	/*  16Hz /  18.7500Hz interrupt enable */
11058c2ecf20Sopenharmony_ci#define RTCIENR_SAM3	0x0800	/*  32Hz /  37.5000Hz interrupt enable */
11068c2ecf20Sopenharmony_ci#define RTCIENR_SAM4	0x1000	/*  64Hz /  75.0000Hz interrupt enable */
11078c2ecf20Sopenharmony_ci#define RTCIENR_SAM5	0x2000	/* 128Hz / 150.0000Hz interrupt enable */
11088c2ecf20Sopenharmony_ci#define RTCIENR_SAM6	0x4000	/* 256Hz / 300.0000Hz interrupt enable */
11098c2ecf20Sopenharmony_ci#define RTCIENR_SAM7	0x8000	/* 512Hz / 600.0000Hz interrupt enable */
11108c2ecf20Sopenharmony_ci
11118c2ecf20Sopenharmony_ci/*
11128c2ecf20Sopenharmony_ci * Stopwatch Minutes Register
11138c2ecf20Sopenharmony_ci */
11148c2ecf20Sopenharmony_ci#define STPWCH_ADDR	0xfffffb12
11158c2ecf20Sopenharmony_ci#define STPWCH		WORD_REF(STPWCH)
11168c2ecf20Sopenharmony_ci
11178c2ecf20Sopenharmony_ci#define STPWCH_CNT_MASK	 0x003f	/* Stopwatch countdown value */
11188c2ecf20Sopenharmony_ci#define SPTWCH_CNT_SHIFT 0
11198c2ecf20Sopenharmony_ci
11208c2ecf20Sopenharmony_ci/*
11218c2ecf20Sopenharmony_ci * RTC Day Count Register
11228c2ecf20Sopenharmony_ci */
11238c2ecf20Sopenharmony_ci#define DAYR_ADDR	0xfffffb1a
11248c2ecf20Sopenharmony_ci#define DAYR		WORD_REF(DAYR_ADDR)
11258c2ecf20Sopenharmony_ci
11268c2ecf20Sopenharmony_ci#define DAYR_DAYS_MASK	0x1ff	/* Day Setting */
11278c2ecf20Sopenharmony_ci#define DAYR_DAYS_SHIFT 0
11288c2ecf20Sopenharmony_ci
11298c2ecf20Sopenharmony_ci/*
11308c2ecf20Sopenharmony_ci * RTC Day Alarm Register
11318c2ecf20Sopenharmony_ci */
11328c2ecf20Sopenharmony_ci#define DAYALARM_ADDR	0xfffffb1c
11338c2ecf20Sopenharmony_ci#define DAYALARM	WORD_REF(DAYALARM_ADDR)
11348c2ecf20Sopenharmony_ci
11358c2ecf20Sopenharmony_ci#define DAYALARM_DAYSAL_MASK	0x01ff	/* Day Setting of the Alarm */
11368c2ecf20Sopenharmony_ci#define DAYALARM_DAYSAL_SHIFT 	0
11378c2ecf20Sopenharmony_ci
11388c2ecf20Sopenharmony_ci/**********
11398c2ecf20Sopenharmony_ci *
11408c2ecf20Sopenharmony_ci * 0xFFFFFCxx -- DRAM Controller
11418c2ecf20Sopenharmony_ci *
11428c2ecf20Sopenharmony_ci **********/
11438c2ecf20Sopenharmony_ci
11448c2ecf20Sopenharmony_ci/*
11458c2ecf20Sopenharmony_ci * DRAM Memory Configuration Register
11468c2ecf20Sopenharmony_ci */
11478c2ecf20Sopenharmony_ci#define DRAMMC_ADDR	0xfffffc00
11488c2ecf20Sopenharmony_ci#define DRAMMC		WORD_REF(DRAMMC_ADDR)
11498c2ecf20Sopenharmony_ci
11508c2ecf20Sopenharmony_ci#define DRAMMC_ROW12_MASK	0xc000	/* Row address bit for MD12 */
11518c2ecf20Sopenharmony_ci#define   DRAMMC_ROW12_PA10	0x0000
11528c2ecf20Sopenharmony_ci#define   DRAMMC_ROW12_PA21	0x4000
11538c2ecf20Sopenharmony_ci#define   DRAMMC_ROW12_PA23	0x8000
11548c2ecf20Sopenharmony_ci#define	DRAMMC_ROW0_MASK	0x3000	/* Row address bit for MD0 */
11558c2ecf20Sopenharmony_ci#define	  DRAMMC_ROW0_PA11	0x0000
11568c2ecf20Sopenharmony_ci#define   DRAMMC_ROW0_PA22	0x1000
11578c2ecf20Sopenharmony_ci#define   DRAMMC_ROW0_PA23	0x2000
11588c2ecf20Sopenharmony_ci#define DRAMMC_ROW11		0x0800	/* Row address bit for MD11 PA20/PA22 */
11598c2ecf20Sopenharmony_ci#define DRAMMC_ROW10		0x0400	/* Row address bit for MD10 PA19/PA21 */
11608c2ecf20Sopenharmony_ci#define	DRAMMC_ROW9		0x0200	/* Row address bit for MD9  PA9/PA19  */
11618c2ecf20Sopenharmony_ci#define DRAMMC_ROW8		0x0100	/* Row address bit for MD8  PA10/PA20 */
11628c2ecf20Sopenharmony_ci#define DRAMMC_COL10		0x0080	/* Col address bit for MD10 PA11/PA0  */
11638c2ecf20Sopenharmony_ci#define DRAMMC_COL9		0x0040	/* Col address bit for MD9  PA10/PA0  */
11648c2ecf20Sopenharmony_ci#define DRAMMC_COL8		0x0020	/* Col address bit for MD8  PA9/PA0   */
11658c2ecf20Sopenharmony_ci#define DRAMMC_REF_MASK		0x001f	/* Refresh Cycle */
11668c2ecf20Sopenharmony_ci#define DRAMMC_REF_SHIFT	0
11678c2ecf20Sopenharmony_ci
11688c2ecf20Sopenharmony_ci/*
11698c2ecf20Sopenharmony_ci * DRAM Control Register
11708c2ecf20Sopenharmony_ci */
11718c2ecf20Sopenharmony_ci#define DRAMC_ADDR	0xfffffc02
11728c2ecf20Sopenharmony_ci#define DRAMC		WORD_REF(DRAMC_ADDR)
11738c2ecf20Sopenharmony_ci
11748c2ecf20Sopenharmony_ci#define DRAMC_DWE	   0x0001	/* DRAM Write Enable */
11758c2ecf20Sopenharmony_ci#define DRAMC_RST	   0x0002	/* Reset Burst Refresh Enable */
11768c2ecf20Sopenharmony_ci#define DRAMC_LPR	   0x0004	/* Low-Power Refresh Enable */
11778c2ecf20Sopenharmony_ci#define DRAMC_SLW	   0x0008	/* Slow RAM */
11788c2ecf20Sopenharmony_ci#define DRAMC_LSP	   0x0010	/* Light Sleep */
11798c2ecf20Sopenharmony_ci#define DRAMC_MSW	   0x0020	/* Slow Multiplexing */
11808c2ecf20Sopenharmony_ci#define DRAMC_WS_MASK	   0x00c0	/* Wait-states */
11818c2ecf20Sopenharmony_ci#define DRAMC_WS_SHIFT	   6
11828c2ecf20Sopenharmony_ci#define DRAMC_PGSZ_MASK    0x0300	/* Page Size for fast page mode */
11838c2ecf20Sopenharmony_ci#define DRAMC_PGSZ_SHIFT   8
11848c2ecf20Sopenharmony_ci#define   DRAMC_PGSZ_256K  0x0000
11858c2ecf20Sopenharmony_ci#define   DRAMC_PGSZ_512K  0x0100
11868c2ecf20Sopenharmony_ci#define   DRAMC_PGSZ_1024K 0x0200
11878c2ecf20Sopenharmony_ci#define	  DRAMC_PGSZ_2048K 0x0300
11888c2ecf20Sopenharmony_ci#define DRAMC_EDO	   0x0400	/* EDO DRAM */
11898c2ecf20Sopenharmony_ci#define DRAMC_CLK	   0x0800	/* Refresh Timer Clock source select */
11908c2ecf20Sopenharmony_ci#define DRAMC_BC_MASK	   0x3000	/* Page Access Clock Cycle (FP mode) */
11918c2ecf20Sopenharmony_ci#define DRAMC_BC_SHIFT	   12
11928c2ecf20Sopenharmony_ci#define DRAMC_RM	   0x4000	/* Refresh Mode */
11938c2ecf20Sopenharmony_ci#define DRAMC_EN	   0x8000	/* DRAM Controller enable */
11948c2ecf20Sopenharmony_ci
11958c2ecf20Sopenharmony_ci
11968c2ecf20Sopenharmony_ci/**********
11978c2ecf20Sopenharmony_ci *
11988c2ecf20Sopenharmony_ci * 0xFFFFFDxx -- In-Circuit Emulation (ICE)
11998c2ecf20Sopenharmony_ci *
12008c2ecf20Sopenharmony_ci **********/
12018c2ecf20Sopenharmony_ci
12028c2ecf20Sopenharmony_ci/*
12038c2ecf20Sopenharmony_ci * ICE Module Address Compare Register
12048c2ecf20Sopenharmony_ci */
12058c2ecf20Sopenharmony_ci#define ICEMACR_ADDR	0xfffffd00
12068c2ecf20Sopenharmony_ci#define ICEMACR		LONG_REF(ICEMACR_ADDR)
12078c2ecf20Sopenharmony_ci
12088c2ecf20Sopenharmony_ci/*
12098c2ecf20Sopenharmony_ci * ICE Module Address Mask Register
12108c2ecf20Sopenharmony_ci */
12118c2ecf20Sopenharmony_ci#define ICEMAMR_ADDR	0xfffffd04
12128c2ecf20Sopenharmony_ci#define ICEMAMR		LONG_REF(ICEMAMR_ADDR)
12138c2ecf20Sopenharmony_ci
12148c2ecf20Sopenharmony_ci/*
12158c2ecf20Sopenharmony_ci * ICE Module Control Compare Register
12168c2ecf20Sopenharmony_ci */
12178c2ecf20Sopenharmony_ci#define ICEMCCR_ADDR	0xfffffd08
12188c2ecf20Sopenharmony_ci#define ICEMCCR		WORD_REF(ICEMCCR_ADDR)
12198c2ecf20Sopenharmony_ci
12208c2ecf20Sopenharmony_ci#define ICEMCCR_PD	0x0001	/* Program/Data Cycle Selection */
12218c2ecf20Sopenharmony_ci#define ICEMCCR_RW	0x0002	/* Read/Write Cycle Selection */
12228c2ecf20Sopenharmony_ci
12238c2ecf20Sopenharmony_ci/*
12248c2ecf20Sopenharmony_ci * ICE Module Control Mask Register
12258c2ecf20Sopenharmony_ci */
12268c2ecf20Sopenharmony_ci#define ICEMCMR_ADDR	0xfffffd0a
12278c2ecf20Sopenharmony_ci#define ICEMCMR		WORD_REF(ICEMCMR_ADDR)
12288c2ecf20Sopenharmony_ci
12298c2ecf20Sopenharmony_ci#define ICEMCMR_PDM	0x0001	/* Program/Data Cycle Mask */
12308c2ecf20Sopenharmony_ci#define ICEMCMR_RWM	0x0002	/* Read/Write Cycle Mask */
12318c2ecf20Sopenharmony_ci
12328c2ecf20Sopenharmony_ci/*
12338c2ecf20Sopenharmony_ci * ICE Module Control Register
12348c2ecf20Sopenharmony_ci */
12358c2ecf20Sopenharmony_ci#define ICEMCR_ADDR	0xfffffd0c
12368c2ecf20Sopenharmony_ci#define ICEMCR		WORD_REF(ICEMCR_ADDR)
12378c2ecf20Sopenharmony_ci
12388c2ecf20Sopenharmony_ci#define ICEMCR_CEN	0x0001	/* Compare Enable */
12398c2ecf20Sopenharmony_ci#define ICEMCR_PBEN	0x0002	/* Program Break Enable */
12408c2ecf20Sopenharmony_ci#define ICEMCR_SB	0x0004	/* Single Breakpoint */
12418c2ecf20Sopenharmony_ci#define ICEMCR_HMDIS	0x0008	/* HardMap disable */
12428c2ecf20Sopenharmony_ci#define ICEMCR_BBIEN	0x0010	/* Bus Break Interrupt Enable */
12438c2ecf20Sopenharmony_ci
12448c2ecf20Sopenharmony_ci/*
12458c2ecf20Sopenharmony_ci * ICE Module Status Register
12468c2ecf20Sopenharmony_ci */
12478c2ecf20Sopenharmony_ci#define ICEMSR_ADDR	0xfffffd0e
12488c2ecf20Sopenharmony_ci#define ICEMSR		WORD_REF(ICEMSR_ADDR)
12498c2ecf20Sopenharmony_ci
12508c2ecf20Sopenharmony_ci#define ICEMSR_EMUEN	0x0001	/* Emulation Enable */
12518c2ecf20Sopenharmony_ci#define ICEMSR_BRKIRQ	0x0002	/* A-Line Vector Fetch Detected */
12528c2ecf20Sopenharmony_ci#define ICEMSR_BBIRQ	0x0004	/* Bus Break Interrupt Detected */
12538c2ecf20Sopenharmony_ci#define ICEMSR_EMIRQ	0x0008	/* EMUIRQ Falling Edge Detected */
12548c2ecf20Sopenharmony_ci
12558c2ecf20Sopenharmony_ci#endif /* _MC68EZ328_H_ */
1256