18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Intel IOP32X and IOP33X register definitions
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: Rory Bolt <rorybolt@pacbell.net>
68c2ecf20Sopenharmony_ci * Copyright (C) 2002 Rory Bolt
78c2ecf20Sopenharmony_ci * Copyright (C) 2004 Intel Corp.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __IOP3XX_H
118c2ecf20Sopenharmony_ci#define __IOP3XX_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * Peripherals that are shared between the iop32x and iop33x but
158c2ecf20Sopenharmony_ci * located at different addresses.
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci#define IOP3XX_TIMER_REG(reg)	(IOP3XX_PERIPHERAL_VIRT_BASE + 0x07e0 + (reg))
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include "iop3xx.h"
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* ATU Parameters
228c2ecf20Sopenharmony_ci * set up a 1:1 bus to physical ram relationship
238c2ecf20Sopenharmony_ci * w/ physical ram on top of pci in the memory map
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci#define IOP32X_MAX_RAM_SIZE            0x40000000UL
268c2ecf20Sopenharmony_ci#define IOP3XX_MAX_RAM_SIZE            IOP32X_MAX_RAM_SIZE
278c2ecf20Sopenharmony_ci#define IOP3XX_PCI_LOWER_MEM_BA        0x80000000
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/*
308c2ecf20Sopenharmony_ci * IOP3XX GPIO handling
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci#define IOP3XX_GPIO_LINE(x)	(x)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
358c2ecf20Sopenharmony_ciextern int init_atu;
368c2ecf20Sopenharmony_ciextern int iop3xx_get_init_atu(void);
378c2ecf20Sopenharmony_ci#endif
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/*
418c2ecf20Sopenharmony_ci * IOP3XX processor registers
428c2ecf20Sopenharmony_ci */
438c2ecf20Sopenharmony_ci#define IOP3XX_PERIPHERAL_PHYS_BASE	0xffffe000
448c2ecf20Sopenharmony_ci#define IOP3XX_PERIPHERAL_VIRT_BASE	0xfedfe000
458c2ecf20Sopenharmony_ci#define IOP3XX_PERIPHERAL_SIZE		0x00002000
468c2ecf20Sopenharmony_ci#define IOP3XX_PERIPHERAL_UPPER_PA (IOP3XX_PERIPHERAL_PHYS_BASE +\
478c2ecf20Sopenharmony_ci					IOP3XX_PERIPHERAL_SIZE - 1)
488c2ecf20Sopenharmony_ci#define IOP3XX_PERIPHERAL_UPPER_VA (IOP3XX_PERIPHERAL_VIRT_BASE +\
498c2ecf20Sopenharmony_ci					IOP3XX_PERIPHERAL_SIZE - 1)
508c2ecf20Sopenharmony_ci#define IOP3XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) (addr) -\
518c2ecf20Sopenharmony_ci					(IOP3XX_PERIPHERAL_PHYS_BASE\
528c2ecf20Sopenharmony_ci					- IOP3XX_PERIPHERAL_VIRT_BASE))
538c2ecf20Sopenharmony_ci#define IOP3XX_REG_ADDR(reg)		(IOP3XX_PERIPHERAL_VIRT_BASE + (reg))
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/* Address Translation Unit  */
568c2ecf20Sopenharmony_ci#define IOP3XX_ATUVID		(volatile u16 *)IOP3XX_REG_ADDR(0x0100)
578c2ecf20Sopenharmony_ci#define IOP3XX_ATUDID		(volatile u16 *)IOP3XX_REG_ADDR(0x0102)
588c2ecf20Sopenharmony_ci#define IOP3XX_ATUCMD		(volatile u16 *)IOP3XX_REG_ADDR(0x0104)
598c2ecf20Sopenharmony_ci#define IOP3XX_ATUSR		(volatile u16 *)IOP3XX_REG_ADDR(0x0106)
608c2ecf20Sopenharmony_ci#define IOP3XX_ATURID		(volatile u8  *)IOP3XX_REG_ADDR(0x0108)
618c2ecf20Sopenharmony_ci#define IOP3XX_ATUCCR		(volatile u32 *)IOP3XX_REG_ADDR(0x0109)
628c2ecf20Sopenharmony_ci#define IOP3XX_ATUCLSR		(volatile u8  *)IOP3XX_REG_ADDR(0x010c)
638c2ecf20Sopenharmony_ci#define IOP3XX_ATULT		(volatile u8  *)IOP3XX_REG_ADDR(0x010d)
648c2ecf20Sopenharmony_ci#define IOP3XX_ATUHTR		(volatile u8  *)IOP3XX_REG_ADDR(0x010e)
658c2ecf20Sopenharmony_ci#define IOP3XX_ATUBIST		(volatile u8  *)IOP3XX_REG_ADDR(0x010f)
668c2ecf20Sopenharmony_ci#define IOP3XX_IABAR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0110)
678c2ecf20Sopenharmony_ci#define IOP3XX_IAUBAR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0114)
688c2ecf20Sopenharmony_ci#define IOP3XX_IABAR1		(volatile u32 *)IOP3XX_REG_ADDR(0x0118)
698c2ecf20Sopenharmony_ci#define IOP3XX_IAUBAR1		(volatile u32 *)IOP3XX_REG_ADDR(0x011c)
708c2ecf20Sopenharmony_ci#define IOP3XX_IABAR2		(volatile u32 *)IOP3XX_REG_ADDR(0x0120)
718c2ecf20Sopenharmony_ci#define IOP3XX_IAUBAR2		(volatile u32 *)IOP3XX_REG_ADDR(0x0124)
728c2ecf20Sopenharmony_ci#define IOP3XX_ASVIR		(volatile u16 *)IOP3XX_REG_ADDR(0x012c)
738c2ecf20Sopenharmony_ci#define IOP3XX_ASIR		(volatile u16 *)IOP3XX_REG_ADDR(0x012e)
748c2ecf20Sopenharmony_ci#define IOP3XX_ERBAR		(volatile u32 *)IOP3XX_REG_ADDR(0x0130)
758c2ecf20Sopenharmony_ci#define IOP3XX_ATUILR		(volatile u8  *)IOP3XX_REG_ADDR(0x013c)
768c2ecf20Sopenharmony_ci#define IOP3XX_ATUIPR		(volatile u8  *)IOP3XX_REG_ADDR(0x013d)
778c2ecf20Sopenharmony_ci#define IOP3XX_ATUMGNT		(volatile u8  *)IOP3XX_REG_ADDR(0x013e)
788c2ecf20Sopenharmony_ci#define IOP3XX_ATUMLAT		(volatile u8  *)IOP3XX_REG_ADDR(0x013f)
798c2ecf20Sopenharmony_ci#define IOP3XX_IALR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0140)
808c2ecf20Sopenharmony_ci#define IOP3XX_IATVR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0144)
818c2ecf20Sopenharmony_ci#define IOP3XX_ERLR		(volatile u32 *)IOP3XX_REG_ADDR(0x0148)
828c2ecf20Sopenharmony_ci#define IOP3XX_ERTVR		(volatile u32 *)IOP3XX_REG_ADDR(0x014c)
838c2ecf20Sopenharmony_ci#define IOP3XX_IALR1		(volatile u32 *)IOP3XX_REG_ADDR(0x0150)
848c2ecf20Sopenharmony_ci#define IOP3XX_IALR2		(volatile u32 *)IOP3XX_REG_ADDR(0x0154)
858c2ecf20Sopenharmony_ci#define IOP3XX_IATVR2		(volatile u32 *)IOP3XX_REG_ADDR(0x0158)
868c2ecf20Sopenharmony_ci#define IOP3XX_OIOWTVR		(volatile u32 *)IOP3XX_REG_ADDR(0x015c)
878c2ecf20Sopenharmony_ci#define IOP3XX_OMWTVR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0160)
888c2ecf20Sopenharmony_ci#define IOP3XX_OUMWTVR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0164)
898c2ecf20Sopenharmony_ci#define IOP3XX_OMWTVR1		(volatile u32 *)IOP3XX_REG_ADDR(0x0168)
908c2ecf20Sopenharmony_ci#define IOP3XX_OUMWTVR1		(volatile u32 *)IOP3XX_REG_ADDR(0x016c)
918c2ecf20Sopenharmony_ci#define IOP3XX_OUDWTVR		(volatile u32 *)IOP3XX_REG_ADDR(0x0178)
928c2ecf20Sopenharmony_ci#define IOP3XX_ATUCR		(volatile u32 *)IOP3XX_REG_ADDR(0x0180)
938c2ecf20Sopenharmony_ci#define IOP3XX_PCSR		(volatile u32 *)IOP3XX_REG_ADDR(0x0184)
948c2ecf20Sopenharmony_ci#define IOP3XX_ATUISR		(volatile u32 *)IOP3XX_REG_ADDR(0x0188)
958c2ecf20Sopenharmony_ci#define IOP3XX_ATUIMR		(volatile u32 *)IOP3XX_REG_ADDR(0x018c)
968c2ecf20Sopenharmony_ci#define IOP3XX_IABAR3		(volatile u32 *)IOP3XX_REG_ADDR(0x0190)
978c2ecf20Sopenharmony_ci#define IOP3XX_IAUBAR3		(volatile u32 *)IOP3XX_REG_ADDR(0x0194)
988c2ecf20Sopenharmony_ci#define IOP3XX_IALR3		(volatile u32 *)IOP3XX_REG_ADDR(0x0198)
998c2ecf20Sopenharmony_ci#define IOP3XX_IATVR3		(volatile u32 *)IOP3XX_REG_ADDR(0x019c)
1008c2ecf20Sopenharmony_ci#define IOP3XX_OCCAR		(volatile u32 *)IOP3XX_REG_ADDR(0x01a4)
1018c2ecf20Sopenharmony_ci#define IOP3XX_OCCDR		(volatile u32 *)IOP3XX_REG_ADDR(0x01ac)
1028c2ecf20Sopenharmony_ci#define IOP3XX_PDSCR		(volatile u32 *)IOP3XX_REG_ADDR(0x01bc)
1038c2ecf20Sopenharmony_ci#define IOP3XX_PMCAPID		(volatile u8  *)IOP3XX_REG_ADDR(0x01c0)
1048c2ecf20Sopenharmony_ci#define IOP3XX_PMNEXT		(volatile u8  *)IOP3XX_REG_ADDR(0x01c1)
1058c2ecf20Sopenharmony_ci#define IOP3XX_APMCR		(volatile u16 *)IOP3XX_REG_ADDR(0x01c2)
1068c2ecf20Sopenharmony_ci#define IOP3XX_APMCSR		(volatile u16 *)IOP3XX_REG_ADDR(0x01c4)
1078c2ecf20Sopenharmony_ci#define IOP3XX_PCIXCAPID	(volatile u8  *)IOP3XX_REG_ADDR(0x01e0)
1088c2ecf20Sopenharmony_ci#define IOP3XX_PCIXNEXT		(volatile u8  *)IOP3XX_REG_ADDR(0x01e1)
1098c2ecf20Sopenharmony_ci#define IOP3XX_PCIXCMD		(volatile u16 *)IOP3XX_REG_ADDR(0x01e2)
1108c2ecf20Sopenharmony_ci#define IOP3XX_PCIXSR		(volatile u32 *)IOP3XX_REG_ADDR(0x01e4)
1118c2ecf20Sopenharmony_ci#define IOP3XX_PCIIRSR		(volatile u32 *)IOP3XX_REG_ADDR(0x01ec)
1128c2ecf20Sopenharmony_ci#define IOP3XX_PCSR_OUT_Q_BUSY (1 << 15)
1138c2ecf20Sopenharmony_ci#define IOP3XX_PCSR_IN_Q_BUSY	(1 << 14)
1148c2ecf20Sopenharmony_ci#define IOP3XX_ATUCR_OUT_EN	(1 << 1)
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define IOP3XX_INIT_ATU_DEFAULT 0
1178c2ecf20Sopenharmony_ci#define IOP3XX_INIT_ATU_DISABLE -1
1188c2ecf20Sopenharmony_ci#define IOP3XX_INIT_ATU_ENABLE	 1
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* Messaging Unit  */
1218c2ecf20Sopenharmony_ci#define IOP3XX_IMR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0310)
1228c2ecf20Sopenharmony_ci#define IOP3XX_IMR1		(volatile u32 *)IOP3XX_REG_ADDR(0x0314)
1238c2ecf20Sopenharmony_ci#define IOP3XX_OMR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0318)
1248c2ecf20Sopenharmony_ci#define IOP3XX_OMR1		(volatile u32 *)IOP3XX_REG_ADDR(0x031c)
1258c2ecf20Sopenharmony_ci#define IOP3XX_IDR		(volatile u32 *)IOP3XX_REG_ADDR(0x0320)
1268c2ecf20Sopenharmony_ci#define IOP3XX_IISR		(volatile u32 *)IOP3XX_REG_ADDR(0x0324)
1278c2ecf20Sopenharmony_ci#define IOP3XX_IIMR		(volatile u32 *)IOP3XX_REG_ADDR(0x0328)
1288c2ecf20Sopenharmony_ci#define IOP3XX_ODR		(volatile u32 *)IOP3XX_REG_ADDR(0x032c)
1298c2ecf20Sopenharmony_ci#define IOP3XX_OISR		(volatile u32 *)IOP3XX_REG_ADDR(0x0330)
1308c2ecf20Sopenharmony_ci#define IOP3XX_OIMR		(volatile u32 *)IOP3XX_REG_ADDR(0x0334)
1318c2ecf20Sopenharmony_ci#define IOP3XX_MUCR		(volatile u32 *)IOP3XX_REG_ADDR(0x0350)
1328c2ecf20Sopenharmony_ci#define IOP3XX_QBAR		(volatile u32 *)IOP3XX_REG_ADDR(0x0354)
1338c2ecf20Sopenharmony_ci#define IOP3XX_IFHPR		(volatile u32 *)IOP3XX_REG_ADDR(0x0360)
1348c2ecf20Sopenharmony_ci#define IOP3XX_IFTPR		(volatile u32 *)IOP3XX_REG_ADDR(0x0364)
1358c2ecf20Sopenharmony_ci#define IOP3XX_IPHPR		(volatile u32 *)IOP3XX_REG_ADDR(0x0368)
1368c2ecf20Sopenharmony_ci#define IOP3XX_IPTPR		(volatile u32 *)IOP3XX_REG_ADDR(0x036c)
1378c2ecf20Sopenharmony_ci#define IOP3XX_OFHPR		(volatile u32 *)IOP3XX_REG_ADDR(0x0370)
1388c2ecf20Sopenharmony_ci#define IOP3XX_OFTPR		(volatile u32 *)IOP3XX_REG_ADDR(0x0374)
1398c2ecf20Sopenharmony_ci#define IOP3XX_OPHPR		(volatile u32 *)IOP3XX_REG_ADDR(0x0378)
1408c2ecf20Sopenharmony_ci#define IOP3XX_OPTPR		(volatile u32 *)IOP3XX_REG_ADDR(0x037c)
1418c2ecf20Sopenharmony_ci#define IOP3XX_IAR		(volatile u32 *)IOP3XX_REG_ADDR(0x0380)
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci/* DMA Controller  */
1448c2ecf20Sopenharmony_ci#define IOP3XX_DMA_PHYS_BASE(chan) (IOP3XX_PERIPHERAL_PHYS_BASE + \
1458c2ecf20Sopenharmony_ci					(0x400 + (chan << 6)))
1468c2ecf20Sopenharmony_ci#define IOP3XX_DMA_UPPER_PA(chan)  (IOP3XX_DMA_PHYS_BASE(chan) + 0x27)
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/* Peripheral bus interface  */
1498c2ecf20Sopenharmony_ci#define IOP3XX_PBCR		(volatile u32 *)IOP3XX_REG_ADDR(0x0680)
1508c2ecf20Sopenharmony_ci#define IOP3XX_PBISR		(volatile u32 *)IOP3XX_REG_ADDR(0x0684)
1518c2ecf20Sopenharmony_ci#define IOP3XX_PBBAR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0688)
1528c2ecf20Sopenharmony_ci#define IOP3XX_PBLR0		(volatile u32 *)IOP3XX_REG_ADDR(0x068c)
1538c2ecf20Sopenharmony_ci#define IOP3XX_PBBAR1		(volatile u32 *)IOP3XX_REG_ADDR(0x0690)
1548c2ecf20Sopenharmony_ci#define IOP3XX_PBLR1		(volatile u32 *)IOP3XX_REG_ADDR(0x0694)
1558c2ecf20Sopenharmony_ci#define IOP3XX_PBBAR2		(volatile u32 *)IOP3XX_REG_ADDR(0x0698)
1568c2ecf20Sopenharmony_ci#define IOP3XX_PBLR2		(volatile u32 *)IOP3XX_REG_ADDR(0x069c)
1578c2ecf20Sopenharmony_ci#define IOP3XX_PBBAR3		(volatile u32 *)IOP3XX_REG_ADDR(0x06a0)
1588c2ecf20Sopenharmony_ci#define IOP3XX_PBLR3		(volatile u32 *)IOP3XX_REG_ADDR(0x06a4)
1598c2ecf20Sopenharmony_ci#define IOP3XX_PBBAR4		(volatile u32 *)IOP3XX_REG_ADDR(0x06a8)
1608c2ecf20Sopenharmony_ci#define IOP3XX_PBLR4		(volatile u32 *)IOP3XX_REG_ADDR(0x06ac)
1618c2ecf20Sopenharmony_ci#define IOP3XX_PBBAR5		(volatile u32 *)IOP3XX_REG_ADDR(0x06b0)
1628c2ecf20Sopenharmony_ci#define IOP3XX_PBLR5		(volatile u32 *)IOP3XX_REG_ADDR(0x06b4)
1638c2ecf20Sopenharmony_ci#define IOP3XX_PMBR0		(volatile u32 *)IOP3XX_REG_ADDR(0x06c0)
1648c2ecf20Sopenharmony_ci#define IOP3XX_PMBR1		(volatile u32 *)IOP3XX_REG_ADDR(0x06e0)
1658c2ecf20Sopenharmony_ci#define IOP3XX_PMBR2		(volatile u32 *)IOP3XX_REG_ADDR(0x06e4)
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* Peripheral performance monitoring unit  */
1688c2ecf20Sopenharmony_ci#define IOP3XX_GTMR		(volatile u32 *)IOP3XX_REG_ADDR(0x0700)
1698c2ecf20Sopenharmony_ci#define IOP3XX_ESR		(volatile u32 *)IOP3XX_REG_ADDR(0x0704)
1708c2ecf20Sopenharmony_ci#define IOP3XX_EMISR		(volatile u32 *)IOP3XX_REG_ADDR(0x0708)
1718c2ecf20Sopenharmony_ci#define IOP3XX_GTSR		(volatile u32 *)IOP3XX_REG_ADDR(0x0710)
1728c2ecf20Sopenharmony_ci/* PERCR0 DOESN'T EXIST - index from 1! */
1738c2ecf20Sopenharmony_ci#define IOP3XX_PERCR0		(volatile u32 *)IOP3XX_REG_ADDR(0x0710)
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci/* Timers  */
1768c2ecf20Sopenharmony_ci#define IOP3XX_TU_TMR0		(volatile u32 *)IOP3XX_TIMER_REG(0x0000)
1778c2ecf20Sopenharmony_ci#define IOP3XX_TU_TMR1		(volatile u32 *)IOP3XX_TIMER_REG(0x0004)
1788c2ecf20Sopenharmony_ci#define IOP3XX_TU_TCR0		(volatile u32 *)IOP3XX_TIMER_REG(0x0008)
1798c2ecf20Sopenharmony_ci#define IOP3XX_TU_TCR1		(volatile u32 *)IOP3XX_TIMER_REG(0x000c)
1808c2ecf20Sopenharmony_ci#define IOP3XX_TU_TRR0		(volatile u32 *)IOP3XX_TIMER_REG(0x0010)
1818c2ecf20Sopenharmony_ci#define IOP3XX_TU_TRR1		(volatile u32 *)IOP3XX_TIMER_REG(0x0014)
1828c2ecf20Sopenharmony_ci#define IOP3XX_TU_TISR		(volatile u32 *)IOP3XX_TIMER_REG(0x0018)
1838c2ecf20Sopenharmony_ci#define IOP3XX_TU_WDTCR		(volatile u32 *)IOP3XX_TIMER_REG(0x001c)
1848c2ecf20Sopenharmony_ci#define IOP_TMR_EN	    0x02
1858c2ecf20Sopenharmony_ci#define IOP_TMR_RELOAD	    0x04
1868c2ecf20Sopenharmony_ci#define IOP_TMR_PRIVILEGED 0x08
1878c2ecf20Sopenharmony_ci#define IOP_TMR_RATIO_1_1  0x00
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* Watchdog timer definitions */
1908c2ecf20Sopenharmony_ci#define IOP_WDTCR_EN_ARM        0x1e1e1e1e
1918c2ecf20Sopenharmony_ci#define IOP_WDTCR_EN            0xe1e1e1e1
1928c2ecf20Sopenharmony_ci/* iop3xx does not support stopping the watchdog, so we just re-arm */
1938c2ecf20Sopenharmony_ci#define IOP_WDTCR_DIS_ARM	(IOP_WDTCR_EN_ARM)
1948c2ecf20Sopenharmony_ci#define IOP_WDTCR_DIS		(IOP_WDTCR_EN)
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci/* Application accelerator unit  */
1978c2ecf20Sopenharmony_ci#define IOP3XX_AAU_PHYS_BASE (IOP3XX_PERIPHERAL_PHYS_BASE + 0x800)
1988c2ecf20Sopenharmony_ci#define IOP3XX_AAU_UPPER_PA (IOP3XX_AAU_PHYS_BASE + 0xa7)
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci/* I2C bus interface unit  */
2018c2ecf20Sopenharmony_ci#define IOP3XX_ICR0		(volatile u32 *)IOP3XX_REG_ADDR(0x1680)
2028c2ecf20Sopenharmony_ci#define IOP3XX_ISR0		(volatile u32 *)IOP3XX_REG_ADDR(0x1684)
2038c2ecf20Sopenharmony_ci#define IOP3XX_ISAR0		(volatile u32 *)IOP3XX_REG_ADDR(0x1688)
2048c2ecf20Sopenharmony_ci#define IOP3XX_IDBR0		(volatile u32 *)IOP3XX_REG_ADDR(0x168c)
2058c2ecf20Sopenharmony_ci#define IOP3XX_IBMR0		(volatile u32 *)IOP3XX_REG_ADDR(0x1694)
2068c2ecf20Sopenharmony_ci#define IOP3XX_ICR1		(volatile u32 *)IOP3XX_REG_ADDR(0x16a0)
2078c2ecf20Sopenharmony_ci#define IOP3XX_ISR1		(volatile u32 *)IOP3XX_REG_ADDR(0x16a4)
2088c2ecf20Sopenharmony_ci#define IOP3XX_ISAR1		(volatile u32 *)IOP3XX_REG_ADDR(0x16a8)
2098c2ecf20Sopenharmony_ci#define IOP3XX_IDBR1		(volatile u32 *)IOP3XX_REG_ADDR(0x16ac)
2108c2ecf20Sopenharmony_ci#define IOP3XX_IBMR1		(volatile u32 *)IOP3XX_REG_ADDR(0x16b4)
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci/*
2148c2ecf20Sopenharmony_ci * IOP3XX I/O and Mem space regions for PCI autoconfiguration
2158c2ecf20Sopenharmony_ci */
2168c2ecf20Sopenharmony_ci#define IOP3XX_PCI_LOWER_MEM_PA	0x80000000
2178c2ecf20Sopenharmony_ci#define IOP3XX_PCI_MEM_WINDOW_SIZE	0x08000000
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define IOP3XX_PCI_LOWER_IO_PA		0x90000000
2208c2ecf20Sopenharmony_ci#define IOP3XX_PCI_LOWER_IO_BA		0x00000000
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#include <linux/types.h>
2258c2ecf20Sopenharmony_ci#include <linux/reboot.h>
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_civoid iop3xx_map_io(void);
2288c2ecf20Sopenharmony_civoid iop_init_cp6_handler(void);
2298c2ecf20Sopenharmony_civoid iop_init_time(unsigned long tickrate);
2308c2ecf20Sopenharmony_civoid iop3xx_restart(enum reboot_mode, const char *);
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistatic inline u32 read_tmr0(void)
2338c2ecf20Sopenharmony_ci{
2348c2ecf20Sopenharmony_ci	u32 val;
2358c2ecf20Sopenharmony_ci	asm volatile("mrc p6, 0, %0, c0, c1, 0" : "=r" (val));
2368c2ecf20Sopenharmony_ci	return val;
2378c2ecf20Sopenharmony_ci}
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistatic inline void write_tmr0(u32 val)
2408c2ecf20Sopenharmony_ci{
2418c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c0, c1, 0" : : "r" (val));
2428c2ecf20Sopenharmony_ci}
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_cistatic inline void write_tmr1(u32 val)
2458c2ecf20Sopenharmony_ci{
2468c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c1, c1, 0" : : "r" (val));
2478c2ecf20Sopenharmony_ci}
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_cistatic inline u32 read_tcr0(void)
2508c2ecf20Sopenharmony_ci{
2518c2ecf20Sopenharmony_ci	u32 val;
2528c2ecf20Sopenharmony_ci	asm volatile("mrc p6, 0, %0, c2, c1, 0" : "=r" (val));
2538c2ecf20Sopenharmony_ci	return val;
2548c2ecf20Sopenharmony_ci}
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_cistatic inline void write_tcr0(u32 val)
2578c2ecf20Sopenharmony_ci{
2588c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c2, c1, 0" : : "r" (val));
2598c2ecf20Sopenharmony_ci}
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_cistatic inline u32 read_tcr1(void)
2628c2ecf20Sopenharmony_ci{
2638c2ecf20Sopenharmony_ci	u32 val;
2648c2ecf20Sopenharmony_ci	asm volatile("mrc p6, 0, %0, c3, c1, 0" : "=r" (val));
2658c2ecf20Sopenharmony_ci	return val;
2668c2ecf20Sopenharmony_ci}
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_cistatic inline void write_tcr1(u32 val)
2698c2ecf20Sopenharmony_ci{
2708c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c3, c1, 0" : : "r" (val));
2718c2ecf20Sopenharmony_ci}
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_cistatic inline void write_trr0(u32 val)
2748c2ecf20Sopenharmony_ci{
2758c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c4, c1, 0" : : "r" (val));
2768c2ecf20Sopenharmony_ci}
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_cistatic inline void write_trr1(u32 val)
2798c2ecf20Sopenharmony_ci{
2808c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c5, c1, 0" : : "r" (val));
2818c2ecf20Sopenharmony_ci}
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_cistatic inline void write_tisr(u32 val)
2848c2ecf20Sopenharmony_ci{
2858c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (val));
2868c2ecf20Sopenharmony_ci}
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_cistatic inline u32 read_wdtcr(void)
2898c2ecf20Sopenharmony_ci{
2908c2ecf20Sopenharmony_ci	u32 val;
2918c2ecf20Sopenharmony_ci	asm volatile("mrc p6, 0, %0, c7, c1, 0":"=r" (val));
2928c2ecf20Sopenharmony_ci	return val;
2938c2ecf20Sopenharmony_ci}
2948c2ecf20Sopenharmony_cistatic inline void write_wdtcr(u32 val)
2958c2ecf20Sopenharmony_ci{
2968c2ecf20Sopenharmony_ci	asm volatile("mcr p6, 0, %0, c7, c1, 0"::"r" (val));
2978c2ecf20Sopenharmony_ci}
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ciextern unsigned long get_iop_tick_rate(void);
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci/* only iop13xx has these registers, we define these to present a
3028c2ecf20Sopenharmony_ci * common register interface for the iop_wdt driver.
3038c2ecf20Sopenharmony_ci */
3048c2ecf20Sopenharmony_ci#define IOP_RCSR_WDT	(0)
3058c2ecf20Sopenharmony_cistatic inline u32 read_rcsr(void)
3068c2ecf20Sopenharmony_ci{
3078c2ecf20Sopenharmony_ci	return 0;
3088c2ecf20Sopenharmony_ci}
3098c2ecf20Sopenharmony_cistatic inline void write_wdtsr(u32 val)
3108c2ecf20Sopenharmony_ci{
3118c2ecf20Sopenharmony_ci	do { } while (0);
3128c2ecf20Sopenharmony_ci}
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ciextern struct platform_device iop3xx_dma_0_channel;
3158c2ecf20Sopenharmony_ciextern struct platform_device iop3xx_dma_1_channel;
3168c2ecf20Sopenharmony_ciextern struct platform_device iop3xx_aau_channel;
3178c2ecf20Sopenharmony_ciextern struct platform_device iop3xx_i2c0_device;
3188c2ecf20Sopenharmony_ciextern struct platform_device iop3xx_i2c1_device;
3198c2ecf20Sopenharmony_ciextern struct gpiod_lookup_table iop3xx_i2c0_gpio_lookup;
3208c2ecf20Sopenharmony_ciextern struct gpiod_lookup_table iop3xx_i2c1_gpio_lookup;
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci#endif
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci#endif
326