18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/mach-sa1100/include/mach/simpad.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * based of assabet.h same as HUW_Webpanel
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This file contains the hardware specific definitions for SIMpad
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * 2001/05/14 Juergen Messerer <juergen.messerer@freesurf.ch>
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef __ASM_ARCH_SIMPAD_H
138c2ecf20Sopenharmony_ci#define __ASM_ARCH_SIMPAD_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define GPIO_UART1_RTS	GPIO_GPIO14
178c2ecf20Sopenharmony_ci#define GPIO_UART1_DTR	GPIO_GPIO7
188c2ecf20Sopenharmony_ci#define GPIO_UART1_CTS	GPIO_GPIO8
198c2ecf20Sopenharmony_ci#define GPIO_UART1_DCD	GPIO_GPIO23
208c2ecf20Sopenharmony_ci#define GPIO_UART1_DSR	GPIO_GPIO6
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define GPIO_UART3_RTS	GPIO_GPIO12
238c2ecf20Sopenharmony_ci#define GPIO_UART3_DTR	GPIO_GPIO16
248c2ecf20Sopenharmony_ci#define GPIO_UART3_CTS	GPIO_GPIO13
258c2ecf20Sopenharmony_ci#define GPIO_UART3_DCD	GPIO_GPIO18
268c2ecf20Sopenharmony_ci#define GPIO_UART3_DSR	GPIO_GPIO17
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define GPIO_POWER_BUTTON	GPIO_GPIO0
298c2ecf20Sopenharmony_ci#define GPIO_UCB1300_IRQ	GPIO_GPIO22	/* UCB GPIO and touchscreen */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define IRQ_UART1_CTS	IRQ_GPIO15
328c2ecf20Sopenharmony_ci#define IRQ_UART1_DCD	GPIO_GPIO23
338c2ecf20Sopenharmony_ci#define IRQ_UART1_DSR	GPIO_GPIO6
348c2ecf20Sopenharmony_ci#define IRQ_UART3_CTS	GPIO_GPIO13
358c2ecf20Sopenharmony_ci#define IRQ_UART3_DCD	GPIO_GPIO18
368c2ecf20Sopenharmony_ci#define IRQ_UART3_DSR	GPIO_GPIO17
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO22
398c2ecf20Sopenharmony_ci#define IRQ_GPIO_POWER_BUTTON IRQ_GPIO0
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/*---  PCMCIA  ---*/
438c2ecf20Sopenharmony_ci#define GPIO_CF_CD              24
448c2ecf20Sopenharmony_ci#define GPIO_CF_IRQ             1
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/*--- SmartCard ---*/
478c2ecf20Sopenharmony_ci#define GPIO_SMART_CARD		GPIO_GPIO10
488c2ecf20Sopenharmony_ci#define IRQ_GPIO_SMARD_CARD	IRQ_GPIO10
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/*--- ucb1x00 GPIO ---*/
518c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_BASE	(GPIO_MAX + 1)
528c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_PROG1	(SIMPAD_UCB1X00_GPIO_BASE)
538c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_PROG2	(SIMPAD_UCB1X00_GPIO_BASE + 1)
548c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_UP		(SIMPAD_UCB1X00_GPIO_BASE + 2)
558c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_DOWN	(SIMPAD_UCB1X00_GPIO_BASE + 3)
568c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_LEFT	(SIMPAD_UCB1X00_GPIO_BASE + 4)
578c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_RIGHT	(SIMPAD_UCB1X00_GPIO_BASE + 5)
588c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_6		(SIMPAD_UCB1X00_GPIO_BASE + 6)
598c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_7		(SIMPAD_UCB1X00_GPIO_BASE + 7)
608c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_HEADSET	(SIMPAD_UCB1X00_GPIO_BASE + 8)
618c2ecf20Sopenharmony_ci#define SIMPAD_UCB1X00_GPIO_SPEAKER	(SIMPAD_UCB1X00_GPIO_BASE + 9)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/*--- CS3 Latch ---*/
648c2ecf20Sopenharmony_ci#define SIMPAD_CS3_GPIO_BASE		(GPIO_MAX + 11)
658c2ecf20Sopenharmony_ci#define SIMPAD_CS3_VCC_5V_EN		(SIMPAD_CS3_GPIO_BASE)
668c2ecf20Sopenharmony_ci#define SIMPAD_CS3_VCC_3V_EN		(SIMPAD_CS3_GPIO_BASE + 1)
678c2ecf20Sopenharmony_ci#define SIMPAD_CS3_EN1			(SIMPAD_CS3_GPIO_BASE + 2)
688c2ecf20Sopenharmony_ci#define SIMPAD_CS3_EN0			(SIMPAD_CS3_GPIO_BASE + 3)
698c2ecf20Sopenharmony_ci#define SIMPAD_CS3_DISPLAY_ON		(SIMPAD_CS3_GPIO_BASE + 4)
708c2ecf20Sopenharmony_ci#define SIMPAD_CS3_PCMCIA_BUFF_DIS	(SIMPAD_CS3_GPIO_BASE + 5)
718c2ecf20Sopenharmony_ci#define SIMPAD_CS3_MQ_RESET		(SIMPAD_CS3_GPIO_BASE + 6)
728c2ecf20Sopenharmony_ci#define SIMPAD_CS3_PCMCIA_RESET		(SIMPAD_CS3_GPIO_BASE + 7)
738c2ecf20Sopenharmony_ci#define SIMPAD_CS3_DECT_POWER_ON	(SIMPAD_CS3_GPIO_BASE + 8)
748c2ecf20Sopenharmony_ci#define SIMPAD_CS3_IRDA_SD		(SIMPAD_CS3_GPIO_BASE + 9)
758c2ecf20Sopenharmony_ci#define SIMPAD_CS3_RS232_ON		(SIMPAD_CS3_GPIO_BASE + 10)
768c2ecf20Sopenharmony_ci#define SIMPAD_CS3_SD_MEDIAQ		(SIMPAD_CS3_GPIO_BASE + 11)
778c2ecf20Sopenharmony_ci#define SIMPAD_CS3_LED2_ON		(SIMPAD_CS3_GPIO_BASE + 12)
788c2ecf20Sopenharmony_ci#define SIMPAD_CS3_IRDA_MODE		(SIMPAD_CS3_GPIO_BASE + 13)
798c2ecf20Sopenharmony_ci#define SIMPAD_CS3_ENABLE_5V		(SIMPAD_CS3_GPIO_BASE + 14)
808c2ecf20Sopenharmony_ci#define SIMPAD_CS3_RESET_SIMCARD	(SIMPAD_CS3_GPIO_BASE + 15)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define SIMPAD_CS3_PCMCIA_BVD1		(SIMPAD_CS3_GPIO_BASE + 16)
838c2ecf20Sopenharmony_ci#define SIMPAD_CS3_PCMCIA_BVD2		(SIMPAD_CS3_GPIO_BASE + 17)
848c2ecf20Sopenharmony_ci#define SIMPAD_CS3_PCMCIA_VS1		(SIMPAD_CS3_GPIO_BASE + 18)
858c2ecf20Sopenharmony_ci#define SIMPAD_CS3_PCMCIA_VS2		(SIMPAD_CS3_GPIO_BASE + 19)
868c2ecf20Sopenharmony_ci#define SIMPAD_CS3_LOCK_IND		(SIMPAD_CS3_GPIO_BASE + 20)
878c2ecf20Sopenharmony_ci#define SIMPAD_CS3_CHARGING_STATE	(SIMPAD_CS3_GPIO_BASE + 21)
888c2ecf20Sopenharmony_ci#define SIMPAD_CS3_PCMCIA_SHORT		(SIMPAD_CS3_GPIO_BASE + 22)
898c2ecf20Sopenharmony_ci#define SIMPAD_CS3_GPIO_23		(SIMPAD_CS3_GPIO_BASE + 23)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define CS3_BASE        IOMEM(0xf1000000)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cilong simpad_get_cs3_ro(void);
948c2ecf20Sopenharmony_cilong simpad_get_cs3_shadow(void);
958c2ecf20Sopenharmony_civoid simpad_set_cs3_bit(int value);
968c2ecf20Sopenharmony_civoid simpad_clear_cs3_bit(int value);
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define VCC_5V_EN	0x0001 /* For 5V PCMCIA */
998c2ecf20Sopenharmony_ci#define VCC_3V_EN	0x0002 /* FOR 3.3V PCMCIA */
1008c2ecf20Sopenharmony_ci#define EN1		0x0004 /* This is only for EPROM's */
1018c2ecf20Sopenharmony_ci#define EN0		0x0008 /* Both should be enable for 3.3V or 5V */
1028c2ecf20Sopenharmony_ci#define DISPLAY_ON	0x0010
1038c2ecf20Sopenharmony_ci#define PCMCIA_BUFF_DIS	0x0020
1048c2ecf20Sopenharmony_ci#define MQ_RESET	0x0040
1058c2ecf20Sopenharmony_ci#define PCMCIA_RESET	0x0080
1068c2ecf20Sopenharmony_ci#define DECT_POWER_ON	0x0100
1078c2ecf20Sopenharmony_ci#define IRDA_SD		0x0200 /* Shutdown for powersave */
1088c2ecf20Sopenharmony_ci#define RS232_ON	0x0400
1098c2ecf20Sopenharmony_ci#define SD_MEDIAQ	0x0800 /* Shutdown for powersave */
1108c2ecf20Sopenharmony_ci#define LED2_ON		0x1000
1118c2ecf20Sopenharmony_ci#define IRDA_MODE	0x2000 /* Fast/Slow IrDA mode */
1128c2ecf20Sopenharmony_ci#define ENABLE_5V	0x4000 /* Enable 5V circuit */
1138c2ecf20Sopenharmony_ci#define RESET_SIMCARD	0x8000
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define PCMCIA_BVD1	0x01
1168c2ecf20Sopenharmony_ci#define PCMCIA_BVD2	0x02
1178c2ecf20Sopenharmony_ci#define PCMCIA_VS1	0x04
1188c2ecf20Sopenharmony_ci#define PCMCIA_VS2	0x08
1198c2ecf20Sopenharmony_ci#define LOCK_IND	0x10
1208c2ecf20Sopenharmony_ci#define CHARGING_STATE	0x20
1218c2ecf20Sopenharmony_ci#define PCMCIA_SHORT	0x40
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/*--- Battery ---*/
1248c2ecf20Sopenharmony_cistruct simpad_battery {
1258c2ecf20Sopenharmony_ci	unsigned char ac_status;	/* line connected yes/no */
1268c2ecf20Sopenharmony_ci	unsigned char status;		/* battery loading yes/no */
1278c2ecf20Sopenharmony_ci	unsigned char percentage;	/* percentage loaded */
1288c2ecf20Sopenharmony_ci	unsigned short life;		/* life till empty */
1298c2ecf20Sopenharmony_ci};
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* These should match the apm_bios.h definitions */
1328c2ecf20Sopenharmony_ci#define SIMPAD_AC_STATUS_AC_OFFLINE      0x00
1338c2ecf20Sopenharmony_ci#define SIMPAD_AC_STATUS_AC_ONLINE       0x01
1348c2ecf20Sopenharmony_ci#define SIMPAD_AC_STATUS_AC_BACKUP       0x02   /* What does this mean? */
1358c2ecf20Sopenharmony_ci#define SIMPAD_AC_STATUS_AC_UNKNOWN      0xff
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/* These bitfields are rarely "or'd" together */
1388c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_HIGH          0x01
1398c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_LOW           0x02
1408c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_CRITICAL      0x04
1418c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_CHARGING      0x08
1428c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_CHARGE_MAIN   0x10
1438c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_DEAD          0x20   /* Battery will not charge */
1448c2ecf20Sopenharmony_ci#define SIMPAD_BATT_NOT_INSTALLED        0x20   /* For expansion pack batteries */
1458c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_FULL          0x40   /* Battery fully charged (and connected to AC) */
1468c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_NOBATT        0x80
1478c2ecf20Sopenharmony_ci#define SIMPAD_BATT_STATUS_UNKNOWN       0xff
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ciextern int simpad_get_battery(struct simpad_battery* );
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#endif // __ASM_ARCH_SIMPAD_H
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci
160