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