18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  linux/include/asm-arm/arch-pxa/balloon3.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Authors:	Nick Bane and Wookey
68c2ecf20Sopenharmony_ci *  Created:	Oct, 2005
78c2ecf20Sopenharmony_ci *  Copyright:	Toby Churchill Ltd
88c2ecf20Sopenharmony_ci *  Cribbed from mainstone.c, by Nicholas Pitre
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef ASM_ARCH_BALLOON3_H
128c2ecf20Sopenharmony_ci#define ASM_ARCH_BALLOON3_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "irqs.h" /* PXA_NR_BUILTIN_GPIO */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cienum balloon3_features {
178c2ecf20Sopenharmony_ci	BALLOON3_FEATURE_OHCI,
188c2ecf20Sopenharmony_ci	BALLOON3_FEATURE_MMC,
198c2ecf20Sopenharmony_ci	BALLOON3_FEATURE_CF,
208c2ecf20Sopenharmony_ci	BALLOON3_FEATURE_AUDIO,
218c2ecf20Sopenharmony_ci	BALLOON3_FEATURE_TOPPOLY,
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define BALLOON3_FPGA_PHYS	PXA_CS4_PHYS
258c2ecf20Sopenharmony_ci#define BALLOON3_FPGA_VIRT	IOMEM(0xf1000000)	/* as per balloon2 */
268c2ecf20Sopenharmony_ci#define BALLOON3_FPGA_LENGTH	0x01000000
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define	BALLOON3_FPGA_SETnCLR		(0x1000)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* FPGA / CPLD registers for CF socket */
318c2ecf20Sopenharmony_ci#define	BALLOON3_CF_STATUS_REG		(BALLOON3_FPGA_VIRT + 0x00e00008)
328c2ecf20Sopenharmony_ci#define	BALLOON3_CF_CONTROL_REG		(BALLOON3_FPGA_VIRT + 0x00e00008)
338c2ecf20Sopenharmony_ci/* FPGA / CPLD version register */
348c2ecf20Sopenharmony_ci#define	BALLOON3_FPGA_VER		(BALLOON3_FPGA_VIRT + 0x00e0001c)
358c2ecf20Sopenharmony_ci/* FPGA / CPLD registers for NAND flash */
368c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_BASE		(PXA_CS4_PHYS + 0x00e00000)
378c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_IO_REG		(BALLOON3_FPGA_VIRT + 0x00e00000)
388c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL2_REG	(BALLOON3_FPGA_VIRT + 0x00e00010)
398c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_STAT_REG		(BALLOON3_FPGA_VIRT + 0x00e00014)
408c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_REG	(BALLOON3_FPGA_VIRT + 0x00e00014)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* fpga/cpld interrupt control register */
438c2ecf20Sopenharmony_ci#define BALLOON3_INT_CONTROL_REG	(BALLOON3_FPGA_VIRT + 0x00e0000C)
448c2ecf20Sopenharmony_ci#define BALLOON3_VERSION_REG		(BALLOON3_FPGA_VIRT + 0x00e0001c)
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define BALLOON3_SAMOSA_ADDR_REG	(BALLOON3_FPGA_VIRT + 0x00c00000)
478c2ecf20Sopenharmony_ci#define BALLOON3_SAMOSA_DATA_REG	(BALLOON3_FPGA_VIRT + 0x00c00004)
488c2ecf20Sopenharmony_ci#define BALLOON3_SAMOSA_STATUS_REG	(BALLOON3_FPGA_VIRT + 0x00c0001c)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* CF Status Register bits (read-only) bits */
518c2ecf20Sopenharmony_ci#define BALLOON3_CF_nIRQ		(1 << 0)
528c2ecf20Sopenharmony_ci#define BALLOON3_CF_nSTSCHG_BVD1	(1 << 1)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* CF Control Set Register bits / CF Control Clear Register bits (write-only) */
558c2ecf20Sopenharmony_ci#define BALLOON3_CF_RESET		(1 << 0)
568c2ecf20Sopenharmony_ci#define BALLOON3_CF_ENABLE		(1 << 1)
578c2ecf20Sopenharmony_ci#define BALLOON3_CF_ADD_ENABLE		(1 << 2)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* CF Interrupt sources */
608c2ecf20Sopenharmony_ci#define BALLOON3_BP_CF_NRDY_IRQ		BALLOON3_IRQ(0)
618c2ecf20Sopenharmony_ci#define BALLOON3_BP_NSTSCHG_IRQ		BALLOON3_IRQ(1)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* NAND Control register */
648c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLWP	(1 << 7)
658c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLSE	(1 << 6)
668c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLCE3	(1 << 5)
678c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLCE2	(1 << 4)
688c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLCE1	(1 << 3)
698c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLCE0	(1 << 2)
708c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLALE	(1 << 1)
718c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL_FLCLE	(1 << 0)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* NAND Status register */
748c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_STAT_RNB		(1 << 0)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* NAND Control2 register */
778c2ecf20Sopenharmony_ci#define	BALLOON3_NAND_CONTROL2_16BIT	(1 << 0)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* GPIOs for irqs */
808c2ecf20Sopenharmony_ci#define BALLOON3_GPIO_AUX_NIRQ		(94)
818c2ecf20Sopenharmony_ci#define BALLOON3_GPIO_CODEC_IRQ		(95)
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* Timer and Idle LED locations */
848c2ecf20Sopenharmony_ci#define BALLOON3_GPIO_LED_NAND		(9)
858c2ecf20Sopenharmony_ci#define BALLOON3_GPIO_LED_IDLE		(10)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* backlight control */
888c2ecf20Sopenharmony_ci#define BALLOON3_GPIO_RUN_BACKLIGHT	(99)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define BALLOON3_GPIO_S0_CD		(105)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* NAND */
938c2ecf20Sopenharmony_ci#define BALLOON3_GPIO_RUN_NAND		(102)
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* PCF8574A Leds */
968c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_BASE		160
978c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED0		(BALLOON3_PCF_GPIO_BASE + 0)
988c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED1		(BALLOON3_PCF_GPIO_BASE + 1)
998c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED2		(BALLOON3_PCF_GPIO_BASE + 2)
1008c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED3		(BALLOON3_PCF_GPIO_BASE + 3)
1018c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED4		(BALLOON3_PCF_GPIO_BASE + 4)
1028c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED5		(BALLOON3_PCF_GPIO_BASE + 5)
1038c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED6		(BALLOON3_PCF_GPIO_BASE + 6)
1048c2ecf20Sopenharmony_ci#define	BALLOON3_PCF_GPIO_LED7		(BALLOON3_PCF_GPIO_BASE + 7)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* FPGA Interrupt Mask/Acknowledge Register */
1078c2ecf20Sopenharmony_ci#define BALLOON3_INT_S0_IRQ		(1 << 0)  /* PCMCIA 0 IRQ */
1088c2ecf20Sopenharmony_ci#define BALLOON3_INT_S0_STSCHG		(1 << 1)  /* PCMCIA 0 status changed */
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* CPLD (and FPGA) interface definitions */
1118c2ecf20Sopenharmony_ci#define CPLD_LCD0_DATA_SET             0x00
1128c2ecf20Sopenharmony_ci#define CPLD_LCD0_DATA_CLR             0x10
1138c2ecf20Sopenharmony_ci#define CPLD_LCD0_COMMAND_SET          0x01
1148c2ecf20Sopenharmony_ci#define CPLD_LCD0_COMMAND_CLR          0x11
1158c2ecf20Sopenharmony_ci#define CPLD_LCD1_DATA_SET             0x02
1168c2ecf20Sopenharmony_ci#define CPLD_LCD1_DATA_CLR             0x12
1178c2ecf20Sopenharmony_ci#define CPLD_LCD1_COMMAND_SET          0x03
1188c2ecf20Sopenharmony_ci#define CPLD_LCD1_COMMAND_CLR          0x13
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define CPLD_MISC_SET                  0x07
1218c2ecf20Sopenharmony_ci#define CPLD_MISC_CLR                  0x17
1228c2ecf20Sopenharmony_ci#define CPLD_MISC_LOON_NRESET_BIT      0
1238c2ecf20Sopenharmony_ci#define CPLD_MISC_LOON_UNSUSP_BIT      1
1248c2ecf20Sopenharmony_ci#define CPLD_MISC_RUN_5V_BIT           2
1258c2ecf20Sopenharmony_ci#define CPLD_MISC_CHG_D0_BIT           3
1268c2ecf20Sopenharmony_ci#define CPLD_MISC_CHG_D1_BIT           4
1278c2ecf20Sopenharmony_ci#define CPLD_MISC_DAC_NCS_BIT          5
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#define CPLD_LCD_SET                   0x08
1308c2ecf20Sopenharmony_ci#define CPLD_LCD_CLR                   0x18
1318c2ecf20Sopenharmony_ci#define CPLD_LCD_BACKLIGHT_EN_0_BIT    0
1328c2ecf20Sopenharmony_ci#define CPLD_LCD_BACKLIGHT_EN_1_BIT    1
1338c2ecf20Sopenharmony_ci#define CPLD_LCD_LED_RED_BIT           4
1348c2ecf20Sopenharmony_ci#define CPLD_LCD_LED_GREEN_BIT         5
1358c2ecf20Sopenharmony_ci#define CPLD_LCD_NRESET_BIT            7
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define CPLD_LCD_RO_SET                0x09
1388c2ecf20Sopenharmony_ci#define CPLD_LCD_RO_CLR                0x19
1398c2ecf20Sopenharmony_ci#define CPLD_LCD_RO_LCD0_nWAIT_BIT     0
1408c2ecf20Sopenharmony_ci#define CPLD_LCD_RO_LCD1_nWAIT_BIT     1
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#define CPLD_SERIAL_SET                0x0a
1438c2ecf20Sopenharmony_ci#define CPLD_SERIAL_CLR                0x1a
1448c2ecf20Sopenharmony_ci#define CPLD_SERIAL_GSM_RI_BIT         0
1458c2ecf20Sopenharmony_ci#define CPLD_SERIAL_GSM_CTS_BIT        1
1468c2ecf20Sopenharmony_ci#define CPLD_SERIAL_GSM_DTR_BIT        2
1478c2ecf20Sopenharmony_ci#define CPLD_SERIAL_LPR_CTS_BIT        3
1488c2ecf20Sopenharmony_ci#define CPLD_SERIAL_TC232_CTS_BIT      4
1498c2ecf20Sopenharmony_ci#define CPLD_SERIAL_TC232_DSR_BIT      5
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define CPLD_SROUTING_SET              0x0b
1528c2ecf20Sopenharmony_ci#define CPLD_SROUTING_CLR              0x1b
1538c2ecf20Sopenharmony_ci#define CPLD_SROUTING_MSP430_LPR       0
1548c2ecf20Sopenharmony_ci#define CPLD_SROUTING_MSP430_TC232     1
1558c2ecf20Sopenharmony_ci#define CPLD_SROUTING_MSP430_GSM       2
1568c2ecf20Sopenharmony_ci#define CPLD_SROUTING_LOON_LPR         (0 << 4)
1578c2ecf20Sopenharmony_ci#define CPLD_SROUTING_LOON_TC232       (1 << 4)
1588c2ecf20Sopenharmony_ci#define CPLD_SROUTING_LOON_GSM         (2 << 4)
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci#define CPLD_AROUTING_SET              0x0c
1618c2ecf20Sopenharmony_ci#define CPLD_AROUTING_CLR              0x1c
1628c2ecf20Sopenharmony_ci#define CPLD_AROUTING_MIC2PHONE_BIT    0
1638c2ecf20Sopenharmony_ci#define CPLD_AROUTING_PHONE2INT_BIT    1
1648c2ecf20Sopenharmony_ci#define CPLD_AROUTING_PHONE2EXT_BIT    2
1658c2ecf20Sopenharmony_ci#define CPLD_AROUTING_LOONL2INT_BIT    3
1668c2ecf20Sopenharmony_ci#define CPLD_AROUTING_LOONL2EXT_BIT    4
1678c2ecf20Sopenharmony_ci#define CPLD_AROUTING_LOONR2PHONE_BIT  5
1688c2ecf20Sopenharmony_ci#define CPLD_AROUTING_LOONR2INT_BIT    6
1698c2ecf20Sopenharmony_ci#define CPLD_AROUTING_LOONR2EXT_BIT    7
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/* Balloon3 Interrupts */
1728c2ecf20Sopenharmony_ci#define BALLOON3_IRQ(x)		(IRQ_BOARD_START + (x))
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define BALLOON3_AUX_NIRQ	PXA_GPIO_TO_IRQ(BALLOON3_GPIO_AUX_NIRQ)
1758c2ecf20Sopenharmony_ci#define BALLOON3_CODEC_IRQ	PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ)
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci#define BALLOON3_NR_IRQS	(IRQ_BOARD_START + 16)
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ciextern int balloon3_has(enum balloon3_features feature);
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci#endif
182