162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* linux/arch/arm/plat-s3c64xx/include/mach/regs-gpio.h
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright 2008 Openmoko, Inc.
562306a36Sopenharmony_ci * Copyright 2008 Simtec Electronics
662306a36Sopenharmony_ci *      Ben Dooks <ben@simtec.co.uk>
762306a36Sopenharmony_ci *      http://armlinux.simtec.co.uk/
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * S3C64XX - GPIO register definitions
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifndef __ASM_PLAT_S3C64XX_REGS_GPIO_H
1362306a36Sopenharmony_ci#define __ASM_PLAT_S3C64XX_REGS_GPIO_H __FILE__
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* Base addresses for each of the banks */
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define S3C64XX_GPIOREG(reg)	(S3C64XX_VA_GPIO + (reg))
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define S3C64XX_GPA_BASE	S3C64XX_GPIOREG(0x0000)
2062306a36Sopenharmony_ci#define S3C64XX_GPB_BASE	S3C64XX_GPIOREG(0x0020)
2162306a36Sopenharmony_ci#define S3C64XX_GPC_BASE	S3C64XX_GPIOREG(0x0040)
2262306a36Sopenharmony_ci#define S3C64XX_GPD_BASE	S3C64XX_GPIOREG(0x0060)
2362306a36Sopenharmony_ci#define S3C64XX_GPE_BASE	S3C64XX_GPIOREG(0x0080)
2462306a36Sopenharmony_ci#define S3C64XX_GPF_BASE	S3C64XX_GPIOREG(0x00A0)
2562306a36Sopenharmony_ci#define S3C64XX_GPG_BASE	S3C64XX_GPIOREG(0x00C0)
2662306a36Sopenharmony_ci#define S3C64XX_GPH_BASE	S3C64XX_GPIOREG(0x00E0)
2762306a36Sopenharmony_ci#define S3C64XX_GPI_BASE	S3C64XX_GPIOREG(0x0100)
2862306a36Sopenharmony_ci#define S3C64XX_GPJ_BASE	S3C64XX_GPIOREG(0x0120)
2962306a36Sopenharmony_ci#define S3C64XX_GPK_BASE	S3C64XX_GPIOREG(0x0800)
3062306a36Sopenharmony_ci#define S3C64XX_GPL_BASE	S3C64XX_GPIOREG(0x0810)
3162306a36Sopenharmony_ci#define S3C64XX_GPM_BASE	S3C64XX_GPIOREG(0x0820)
3262306a36Sopenharmony_ci#define S3C64XX_GPN_BASE	S3C64XX_GPIOREG(0x0830)
3362306a36Sopenharmony_ci#define S3C64XX_GPO_BASE	S3C64XX_GPIOREG(0x0140)
3462306a36Sopenharmony_ci#define S3C64XX_GPP_BASE	S3C64XX_GPIOREG(0x0160)
3562306a36Sopenharmony_ci#define S3C64XX_GPQ_BASE	S3C64XX_GPIOREG(0x0180)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* SPCON */
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#define S3C64XX_SPCON		S3C64XX_GPIOREG(0x1A0)
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_CAM_MASK		(0x3 << 30)
4262306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_CAM_SHIFT		(30)
4362306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_CAM_2mA		(0x0 << 30)
4462306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_CAM_4mA		(0x1 << 30)
4562306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_CAM_7mA		(0x2 << 30)
4662306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_CAM_9mA		(0x3 << 30)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSSPI_MASK		(0x3 << 28)
4962306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSSPI_SHIFT	(28)
5062306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSSPI_2mA		(0x0 << 28)
5162306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSSPI_4mA		(0x1 << 28)
5262306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSSPI_7mA		(0x2 << 28)
5362306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSSPI_9mA		(0x3 << 28)
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSMMC_MASK		(0x3 << 26)
5662306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSMMC_SHIFT	(26)
5762306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSMMC_2mA		(0x0 << 26)
5862306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSMMC_4mA		(0x1 << 26)
5962306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSMMC_7mA		(0x2 << 26)
6062306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_HSMMC_9mA		(0x3 << 26)
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_LCD_MASK		(0x3 << 24)
6362306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_LCD_SHIFT		(24)
6462306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_LCD_2mA		(0x0 << 24)
6562306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_LCD_4mA		(0x1 << 24)
6662306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_LCD_7mA		(0x2 << 24)
6762306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_LCD_9mA		(0x3 << 24)
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_MODEM_MASK		(0x3 << 22)
7062306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_MODEM_SHIFT	(22)
7162306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_MODEM_2mA		(0x0 << 22)
7262306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_MODEM_4mA		(0x1 << 22)
7362306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_MODEM_7mA		(0x2 << 22)
7462306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_MODEM_9mA		(0x3 << 22)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define S3C64XX_SPCON_nRSTOUT_OEN		(1 << 21)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_SPICLK1_MASK	(0x3 << 18)
7962306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_SPICLK1_SHIFT	(18)
8062306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_SPICLK1_2mA	(0x0 << 18)
8162306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_SPICLK1_4mA	(0x1 << 18)
8262306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_SPICLK1_7mA	(0x2 << 18)
8362306a36Sopenharmony_ci#define S3C64XX_SPCON_DRVCON_SPICLK1_9mA	(0x3 << 18)
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_DQS_PUD_MASK		(0x3 << 16)
8662306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_DQS_PUD_SHIFT	(16)
8762306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_DQS_PUD_DISABLED	(0x0 << 16)
8862306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_DQS_PUD_DOWN		(0x1 << 16)
8962306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_DQS_PUD_UP		(0x2 << 16)
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD1_MASK		(0x3 << 14)
9262306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD1_SHIFT		(14)
9362306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD1_DISABLED	(0x0 << 14)
9462306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD1_DOWN		(0x1 << 14)
9562306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD1_UP		(0x2 << 14)
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD0_MASK		(0x3 << 12)
9862306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD0_SHIFT		(12)
9962306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD0_DISABLED	(0x0 << 12)
10062306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD0_DOWN		(0x1 << 12)
10162306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM1_D_PUD0_UP		(0x2 << 12)
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM0_D_PUD_MASK		(0x3 << 8)
10462306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM0_D_PUD_SHIFT		(8)
10562306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM0_D_PUD_DISABLED	(0x0 << 8)
10662306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM0_D_PUD_DOWN		(0x1 << 8)
10762306a36Sopenharmony_ci#define S3C64XX_SPCON_MEM0_D_PUD_UP		(0x2 << 8)
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#define S3C64XX_SPCON_USBH_DMPD			(1 << 7)
11062306a36Sopenharmony_ci#define S3C64XX_SPCON_USBH_DPPD			(1 << 6)
11162306a36Sopenharmony_ci#define S3C64XX_SPCON_USBH_PUSW2		(1 << 5)
11262306a36Sopenharmony_ci#define S3C64XX_SPCON_USBH_PUSW1		(1 << 4)
11362306a36Sopenharmony_ci#define S3C64XX_SPCON_USBH_SUSPND		(1 << 3)
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define S3C64XX_SPCON_LCD_SEL_MASK		(0x3 << 0)
11662306a36Sopenharmony_ci#define S3C64XX_SPCON_LCD_SEL_SHIFT		(0)
11762306a36Sopenharmony_ci#define S3C64XX_SPCON_LCD_SEL_HOST		(0x0 << 0)
11862306a36Sopenharmony_ci#define S3C64XX_SPCON_LCD_SEL_RGB		(0x1 << 0)
11962306a36Sopenharmony_ci#define S3C64XX_SPCON_LCD_SEL_606_656		(0x2 << 0)
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci/* External interrupt registers */
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define S3C64XX_EINT12CON	S3C64XX_GPIOREG(0x200)
12562306a36Sopenharmony_ci#define S3C64XX_EINT34CON	S3C64XX_GPIOREG(0x204)
12662306a36Sopenharmony_ci#define S3C64XX_EINT56CON	S3C64XX_GPIOREG(0x208)
12762306a36Sopenharmony_ci#define S3C64XX_EINT78CON	S3C64XX_GPIOREG(0x20C)
12862306a36Sopenharmony_ci#define S3C64XX_EINT9CON	S3C64XX_GPIOREG(0x210)
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define S3C64XX_EINT12FLTCON	S3C64XX_GPIOREG(0x220)
13162306a36Sopenharmony_ci#define S3C64XX_EINT34FLTCON	S3C64XX_GPIOREG(0x224)
13262306a36Sopenharmony_ci#define S3C64XX_EINT56FLTCON	S3C64XX_GPIOREG(0x228)
13362306a36Sopenharmony_ci#define S3C64XX_EINT78FLTCON	S3C64XX_GPIOREG(0x22C)
13462306a36Sopenharmony_ci#define S3C64XX_EINT9FLTCON	S3C64XX_GPIOREG(0x230)
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define S3C64XX_EINT12MASK	S3C64XX_GPIOREG(0x240)
13762306a36Sopenharmony_ci#define S3C64XX_EINT34MASK	S3C64XX_GPIOREG(0x244)
13862306a36Sopenharmony_ci#define S3C64XX_EINT56MASK	S3C64XX_GPIOREG(0x248)
13962306a36Sopenharmony_ci#define S3C64XX_EINT78MASK	S3C64XX_GPIOREG(0x24C)
14062306a36Sopenharmony_ci#define S3C64XX_EINT9MASK	S3C64XX_GPIOREG(0x250)
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci#define S3C64XX_EINT12PEND	S3C64XX_GPIOREG(0x260)
14362306a36Sopenharmony_ci#define S3C64XX_EINT34PEND	S3C64XX_GPIOREG(0x264)
14462306a36Sopenharmony_ci#define S3C64XX_EINT56PEND	S3C64XX_GPIOREG(0x268)
14562306a36Sopenharmony_ci#define S3C64XX_EINT78PEND	S3C64XX_GPIOREG(0x26C)
14662306a36Sopenharmony_ci#define S3C64XX_EINT9PEND	S3C64XX_GPIOREG(0x270)
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci#define S3C64XX_PRIORITY	S3C64XX_GPIOREG(0x280)
14962306a36Sopenharmony_ci#define S3C64XX_PRIORITY_ARB(x)	(1 << (x))
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci#define S3C64XX_SERVICE		S3C64XX_GPIOREG(0x284)
15262306a36Sopenharmony_ci#define S3C64XX_SERVICEPEND	S3C64XX_GPIOREG(0x288)
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci#define S3C64XX_EINT0CON0	S3C64XX_GPIOREG(0x900)
15562306a36Sopenharmony_ci#define S3C64XX_EINT0CON1	S3C64XX_GPIOREG(0x904)
15662306a36Sopenharmony_ci#define S3C64XX_EINT0FLTCON0	S3C64XX_GPIOREG(0x910)
15762306a36Sopenharmony_ci#define S3C64XX_EINT0FLTCON1	S3C64XX_GPIOREG(0x914)
15862306a36Sopenharmony_ci#define S3C64XX_EINT0FLTCON2	S3C64XX_GPIOREG(0x918)
15962306a36Sopenharmony_ci#define S3C64XX_EINT0FLTCON3	S3C64XX_GPIOREG(0x91C)
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci#define S3C64XX_EINT0MASK	S3C64XX_GPIOREG(0x920)
16262306a36Sopenharmony_ci#define S3C64XX_EINT0PEND	S3C64XX_GPIOREG(0x924)
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci/* GPIO sleep configuration */
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci#define S3C64XX_SPCONSLP	S3C64XX_GPIOREG(0x880)
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_TDO_PULLDOWN	(1 << 14)
16962306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_CKE1INIT	(1 << 5)
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_RSTOUT_MASK	(0x3 << 12)
17262306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_RSTOUT_OUT0	(0x0 << 12)
17362306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_RSTOUT_OUT1	(0x1 << 12)
17462306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_RSTOUT_HIZ	(0x2 << 12)
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_KPCOL_MASK	(0x3 << 0)
17762306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_KPCOL_OUT0	(0x0 << 0)
17862306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_KPCOL_OUT1	(0x1 << 0)
17962306a36Sopenharmony_ci#define S3C64XX_SPCONSLP_KPCOL_INP	(0x2 << 0)
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci#define S3C64XX_SLPEN		S3C64XX_GPIOREG(0x930)
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci#define S3C64XX_SLPEN_USE_xSLP		(1 << 0)
18562306a36Sopenharmony_ci#define S3C64XX_SLPEN_CFG_BYSLPEN	(1 << 1)
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#endif /* __ASM_PLAT_S3C64XX_REGS_GPIO_H */
18862306a36Sopenharmony_ci
189