18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  arch/arm/mach-pxa/include/mach/mainstone.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Author:	Nicolas Pitre
68c2ecf20Sopenharmony_ci *  Created:	Nov 14, 2002
78c2ecf20Sopenharmony_ci *  Copyright:	MontaVista Software Inc.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef ASM_ARCH_MAINSTONE_H
118c2ecf20Sopenharmony_ci#define ASM_ARCH_MAINSTONE_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <mach/irqs.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define MST_ETH_PHYS		PXA_CS4_PHYS
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define MST_FPGA_PHYS		PXA_CS2_PHYS
188c2ecf20Sopenharmony_ci#define MST_FPGA_VIRT		(0xf0000000)
198c2ecf20Sopenharmony_ci#define MST_P2V(x)		((x) - MST_FPGA_PHYS + MST_FPGA_VIRT)
208c2ecf20Sopenharmony_ci#define MST_V2P(x)		((x) - MST_FPGA_VIRT + MST_FPGA_PHYS)
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
238c2ecf20Sopenharmony_ci# define __MST_REG(x)		(*((volatile unsigned long *)MST_P2V(x)))
248c2ecf20Sopenharmony_ci#else
258c2ecf20Sopenharmony_ci# define __MST_REG(x)		MST_P2V(x)
268c2ecf20Sopenharmony_ci#endif
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* board level registers in the FPGA */
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define MST_LEDDAT1		__MST_REG(0x08000010)
318c2ecf20Sopenharmony_ci#define MST_LEDDAT2		__MST_REG(0x08000014)
328c2ecf20Sopenharmony_ci#define MST_LEDCTRL		__MST_REG(0x08000040)
338c2ecf20Sopenharmony_ci#define MST_GPSWR		__MST_REG(0x08000060)
348c2ecf20Sopenharmony_ci#define MST_MSCWR1		__MST_REG(0x08000080)
358c2ecf20Sopenharmony_ci#define MST_MSCWR2		__MST_REG(0x08000084)
368c2ecf20Sopenharmony_ci#define MST_MSCWR3		__MST_REG(0x08000088)
378c2ecf20Sopenharmony_ci#define MST_MSCRD		__MST_REG(0x08000090)
388c2ecf20Sopenharmony_ci#define MST_INTMSKENA		__MST_REG(0x080000c0)
398c2ecf20Sopenharmony_ci#define MST_INTSETCLR		__MST_REG(0x080000d0)
408c2ecf20Sopenharmony_ci#define MST_PCMCIA0		__MST_REG(0x080000e0)
418c2ecf20Sopenharmony_ci#define MST_PCMCIA1		__MST_REG(0x080000e4)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define MST_MSCWR1_CAMERA_ON	(1 << 15)  /* Camera interface power control */
448c2ecf20Sopenharmony_ci#define MST_MSCWR1_CAMERA_SEL	(1 << 14)  /* Camera interface mux control */
458c2ecf20Sopenharmony_ci#define MST_MSCWR1_LCD_CTL	(1 << 13)  /* General-purpose LCD control */
468c2ecf20Sopenharmony_ci#define MST_MSCWR1_MS_ON	(1 << 12)  /* Memory Stick power control */
478c2ecf20Sopenharmony_ci#define MST_MSCWR1_MMC_ON	(1 << 11)  /* MultiMediaCard* power control */
488c2ecf20Sopenharmony_ci#define MST_MSCWR1_MS_SEL	(1 << 10)  /* SD/MS multiplexer control */
498c2ecf20Sopenharmony_ci#define MST_MSCWR1_BB_SEL	(1 << 9)   /* PCMCIA/Baseband multiplexer */
508c2ecf20Sopenharmony_ci#define MST_MSCWR1_BT_ON	(1 << 8)   /* Bluetooth UART transceiver */
518c2ecf20Sopenharmony_ci#define MST_MSCWR1_BTDTR	(1 << 7)   /* Bluetooth UART DTR */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define MST_MSCWR1_IRDA_MASK	(3 << 5)   /* IrDA transceiver mode */
548c2ecf20Sopenharmony_ci#define MST_MSCWR1_IRDA_FULL	(0 << 5)   /* full distance power */
558c2ecf20Sopenharmony_ci#define MST_MSCWR1_IRDA_OFF	(1 << 5)   /* shutdown */
568c2ecf20Sopenharmony_ci#define MST_MSCWR1_IRDA_MED	(2 << 5)   /* 2/3 distance power */
578c2ecf20Sopenharmony_ci#define MST_MSCWR1_IRDA_LOW	(3 << 5)   /* 1/3 distance power */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define MST_MSCWR1_IRDA_FIR	(1 << 4)   /* IrDA transceiver SIR/FIR */
608c2ecf20Sopenharmony_ci#define MST_MSCWR1_GREENLED	(1 << 3)   /* LED D1 control */
618c2ecf20Sopenharmony_ci#define MST_MSCWR1_PDC_CTL	(1 << 2)   /* reserved */
628c2ecf20Sopenharmony_ci#define MST_MSCWR1_MTR_ON	(1 << 1)   /* Silent alert motor */
638c2ecf20Sopenharmony_ci#define MST_MSCWR1_SYSRESET	(1 << 0)   /* System reset */
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define MST_MSCWR2_USB_OTG_RST	(1 << 6)   /* USB On The Go reset */
668c2ecf20Sopenharmony_ci#define MST_MSCWR2_USB_OTG_SEL	(1 << 5)   /* USB On The Go control */
678c2ecf20Sopenharmony_ci#define MST_MSCWR2_nUSBC_SC	(1 << 4)   /* USB client soft connect control */
688c2ecf20Sopenharmony_ci#define MST_MSCWR2_I2S_SPKROFF	(1 << 3)   /* I2S CODEC amplifier control */
698c2ecf20Sopenharmony_ci#define MST_MSCWR2_AC97_SPKROFF	(1 << 2)   /* AC97 CODEC amplifier control */
708c2ecf20Sopenharmony_ci#define MST_MSCWR2_RADIO_PWR	(1 << 1)   /* Radio module power control */
718c2ecf20Sopenharmony_ci#define MST_MSCWR2_RADIO_WAKE	(1 << 0)   /* Radio module wake-up signal */
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define MST_MSCWR3_GPIO_RESET_EN	(1 << 2) /* Enable GPIO Reset */
748c2ecf20Sopenharmony_ci#define MST_MSCWR3_GPIO_RESET		(1 << 1) /* Initiate a GPIO Reset */
758c2ecf20Sopenharmony_ci#define MST_MSCWR3_COMMS_SW_RESET	(1 << 0) /* Communications Processor Reset Control */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define MST_MSCRD_nPENIRQ	(1 << 9)   /* ADI7873* nPENIRQ signal */
788c2ecf20Sopenharmony_ci#define MST_MSCRD_nMEMSTK_CD	(1 << 8)   /* Memory Stick detection signal */
798c2ecf20Sopenharmony_ci#define MST_MSCRD_nMMC_CD	(1 << 7)   /* SD/MMC card detection signal */
808c2ecf20Sopenharmony_ci#define MST_MSCRD_nUSIM_CD	(1 << 6)   /* USIM card detection signal */
818c2ecf20Sopenharmony_ci#define MST_MSCRD_USB_CBL	(1 << 5)   /* USB client cable status */
828c2ecf20Sopenharmony_ci#define MST_MSCRD_TS_BUSY	(1 << 4)   /* ADI7873 busy */
838c2ecf20Sopenharmony_ci#define MST_MSCRD_BTDSR		(1 << 3)   /* Bluetooth UART DSR */
848c2ecf20Sopenharmony_ci#define MST_MSCRD_BTRI		(1 << 2)   /* Bluetooth UART Ring Indicator */
858c2ecf20Sopenharmony_ci#define MST_MSCRD_BTDCD		(1 << 1)   /* Bluetooth UART DCD */
868c2ecf20Sopenharmony_ci#define MST_MSCRD_nMMC_WP	(1 << 0)   /* SD/MMC write-protect status */
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define MST_INT_S1_IRQ		(1 << 15)  /* PCMCIA socket 1 IRQ */
898c2ecf20Sopenharmony_ci#define MST_INT_S1_STSCHG	(1 << 14)  /* PCMCIA socket 1 status changed */
908c2ecf20Sopenharmony_ci#define MST_INT_S1_CD		(1 << 13)  /* PCMCIA socket 1 card detection */
918c2ecf20Sopenharmony_ci#define MST_INT_S0_IRQ		(1 << 11)  /* PCMCIA socket 0 IRQ */
928c2ecf20Sopenharmony_ci#define MST_INT_S0_STSCHG	(1 << 10)  /* PCMCIA socket 0 status changed */
938c2ecf20Sopenharmony_ci#define MST_INT_S0_CD		(1 << 9)   /* PCMCIA socket 0 card detection */
948c2ecf20Sopenharmony_ci#define MST_INT_nEXBRD_INT	(1 << 7)   /* Expansion board IRQ */
958c2ecf20Sopenharmony_ci#define MST_INT_MSINS		(1 << 6)   /* Memory Stick* detection */
968c2ecf20Sopenharmony_ci#define MST_INT_PENIRQ		(1 << 5)   /* ADI7873* touch-screen IRQ */
978c2ecf20Sopenharmony_ci#define MST_INT_AC97		(1 << 4)   /* AC'97 CODEC IRQ */
988c2ecf20Sopenharmony_ci#define MST_INT_ETHERNET	(1 << 3)   /* Ethernet controller IRQ */
998c2ecf20Sopenharmony_ci#define MST_INT_USBC		(1 << 2)   /* USB client cable detection IRQ */
1008c2ecf20Sopenharmony_ci#define MST_INT_USIM		(1 << 1)   /* USIM card detection IRQ */
1018c2ecf20Sopenharmony_ci#define MST_INT_MMC		(1 << 0)   /* MMC/SD card detection IRQ */
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define MST_PCMCIA_nIRQ		(1 << 10)  /* IRQ / ready signal */
1048c2ecf20Sopenharmony_ci#define MST_PCMCIA_nSPKR_BVD2	(1 << 9)   /* VDD sense / digital speaker */
1058c2ecf20Sopenharmony_ci#define MST_PCMCIA_nSTSCHG_BVD1	(1 << 8)   /* VDD sense / card status changed */
1068c2ecf20Sopenharmony_ci#define MST_PCMCIA_nVS2		(1 << 7)   /* VSS voltage sense */
1078c2ecf20Sopenharmony_ci#define MST_PCMCIA_nVS1		(1 << 6)   /* VSS voltage sense */
1088c2ecf20Sopenharmony_ci#define MST_PCMCIA_nCD		(1 << 5)   /* Card detection signal */
1098c2ecf20Sopenharmony_ci#define MST_PCMCIA_RESET	(1 << 4)   /* Card reset signal */
1108c2ecf20Sopenharmony_ci#define MST_PCMCIA_PWR_MASK	(0x000f)   /* MAX1602 power-supply controls */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define MST_PCMCIA_PWR_VPP_0    0x0	   /* voltage VPP = 0V */
1138c2ecf20Sopenharmony_ci#define MST_PCMCIA_PWR_VPP_120  0x2 	   /* voltage VPP = 12V*/
1148c2ecf20Sopenharmony_ci#define MST_PCMCIA_PWR_VPP_VCC  0x1	   /* voltage VPP = VCC */
1158c2ecf20Sopenharmony_ci#define MST_PCMCIA_PWR_VCC_0    0x0	   /* voltage VCC = 0V */
1168c2ecf20Sopenharmony_ci#define MST_PCMCIA_PWR_VCC_33   0x8	   /* voltage VCC = 3.3V */
1178c2ecf20Sopenharmony_ci#define MST_PCMCIA_PWR_VCC_50   0x4	   /* voltage VCC = 5.0V */
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define MST_PCMCIA_INPUTS \
1208c2ecf20Sopenharmony_ci	(MST_PCMCIA_nIRQ | MST_PCMCIA_nSPKR_BVD2 | MST_PCMCIA_nSTSCHG_BVD1 | \
1218c2ecf20Sopenharmony_ci	 MST_PCMCIA_nVS2 | MST_PCMCIA_nVS1 | MST_PCMCIA_nCD)
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/* board specific IRQs */
1248c2ecf20Sopenharmony_ci#define MAINSTONE_NR_IRQS	IRQ_BOARD_START
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci#define MAINSTONE_IRQ(x)	(MAINSTONE_NR_IRQS + (x))
1278c2ecf20Sopenharmony_ci#define MAINSTONE_MMC_IRQ	MAINSTONE_IRQ(0)
1288c2ecf20Sopenharmony_ci#define MAINSTONE_USIM_IRQ	MAINSTONE_IRQ(1)
1298c2ecf20Sopenharmony_ci#define MAINSTONE_USBC_IRQ	MAINSTONE_IRQ(2)
1308c2ecf20Sopenharmony_ci#define MAINSTONE_ETHERNET_IRQ	MAINSTONE_IRQ(3)
1318c2ecf20Sopenharmony_ci#define MAINSTONE_AC97_IRQ	MAINSTONE_IRQ(4)
1328c2ecf20Sopenharmony_ci#define MAINSTONE_PEN_IRQ	MAINSTONE_IRQ(5)
1338c2ecf20Sopenharmony_ci#define MAINSTONE_MSINS_IRQ	MAINSTONE_IRQ(6)
1348c2ecf20Sopenharmony_ci#define MAINSTONE_EXBRD_IRQ	MAINSTONE_IRQ(7)
1358c2ecf20Sopenharmony_ci#define MAINSTONE_S0_CD_IRQ	MAINSTONE_IRQ(9)
1368c2ecf20Sopenharmony_ci#define MAINSTONE_S0_STSCHG_IRQ	MAINSTONE_IRQ(10)
1378c2ecf20Sopenharmony_ci#define MAINSTONE_S0_IRQ	MAINSTONE_IRQ(11)
1388c2ecf20Sopenharmony_ci#define MAINSTONE_S1_CD_IRQ	MAINSTONE_IRQ(13)
1398c2ecf20Sopenharmony_ci#define MAINSTONE_S1_STSCHG_IRQ	MAINSTONE_IRQ(14)
1408c2ecf20Sopenharmony_ci#define MAINSTONE_S1_IRQ	MAINSTONE_IRQ(15)
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#endif
143