162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * arch/arm/include/asm/hardware/sa1111.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * This file contains definitions for the SA-1111 Companion Chip.
862306a36Sopenharmony_ci * (Structure and naming borrowed from SA-1101.h, by Peter Danielsson.)
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Macro that calculates real address for registers in the SA-1111
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifndef _ASM_ARCH_SA1111
1462306a36Sopenharmony_ci#define _ASM_ARCH_SA1111
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci * Don't ask the (SAC) DMA engines to move less than this amount.
1862306a36Sopenharmony_ci */
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define SA1111_SAC_DMA_MIN_XFER	(0x800)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/*
2362306a36Sopenharmony_ci * System Bus Interface (SBI)
2462306a36Sopenharmony_ci *
2562306a36Sopenharmony_ci * Registers
2662306a36Sopenharmony_ci *    SKCR	Control Register
2762306a36Sopenharmony_ci *    SMCR	Shared Memory Controller Register
2862306a36Sopenharmony_ci *    SKID	ID Register
2962306a36Sopenharmony_ci */
3062306a36Sopenharmony_ci#define SA1111_SKCR	0x0000
3162306a36Sopenharmony_ci#define SA1111_SMCR	0x0004
3262306a36Sopenharmony_ci#define SA1111_SKID	0x0008
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define SKCR_PLL_BYPASS	(1<<0)
3562306a36Sopenharmony_ci#define SKCR_RCLKEN	(1<<1)
3662306a36Sopenharmony_ci#define SKCR_SLEEP	(1<<2)
3762306a36Sopenharmony_ci#define SKCR_DOZE	(1<<3)
3862306a36Sopenharmony_ci#define SKCR_VCO_OFF	(1<<4)
3962306a36Sopenharmony_ci#define SKCR_SCANTSTEN	(1<<5)
4062306a36Sopenharmony_ci#define SKCR_CLKTSTEN	(1<<6)
4162306a36Sopenharmony_ci#define SKCR_RDYEN	(1<<7)
4262306a36Sopenharmony_ci#define SKCR_SELAC	(1<<8)
4362306a36Sopenharmony_ci#define SKCR_OPPC	(1<<9)
4462306a36Sopenharmony_ci#define SKCR_PLLTSTEN	(1<<10)
4562306a36Sopenharmony_ci#define SKCR_USBIOTSTEN	(1<<11)
4662306a36Sopenharmony_ci/*
4762306a36Sopenharmony_ci * Don't believe the specs!  Take them, throw them outside.  Leave them
4862306a36Sopenharmony_ci * there for a week.  Spit on them.  Walk on them.  Stamp on them.
4962306a36Sopenharmony_ci * Pour gasoline over them and finally burn them.  Now think about coding.
5062306a36Sopenharmony_ci *  - The October 1999 errata (278260-007) says its bit 13, 1 to enable.
5162306a36Sopenharmony_ci *  - The Feb 2001 errata (278260-010) says that the previous errata
5262306a36Sopenharmony_ci *    (278260-009) is wrong, and its bit actually 12, fixed in spec
5362306a36Sopenharmony_ci *    278242-003.
5462306a36Sopenharmony_ci *  - The SA1111 manual (278242) says bit 12, but 0 to enable.
5562306a36Sopenharmony_ci *  - Reality is bit 13, 1 to enable.
5662306a36Sopenharmony_ci *      -- rmk
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_ci#define SKCR_OE_EN	(1<<13)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define SMCR_DTIM	(1<<0)
6162306a36Sopenharmony_ci#define SMCR_MBGE	(1<<1)
6262306a36Sopenharmony_ci#define SMCR_DRAC_0	(1<<2)
6362306a36Sopenharmony_ci#define SMCR_DRAC_1	(1<<3)
6462306a36Sopenharmony_ci#define SMCR_DRAC_2	(1<<4)
6562306a36Sopenharmony_ci#define SMCR_DRAC	Fld(3, 2)
6662306a36Sopenharmony_ci#define SMCR_CLAT	(1<<5)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define SKID_SIREV_MASK	(0x000000f0)
6962306a36Sopenharmony_ci#define SKID_MTREV_MASK (0x0000000f)
7062306a36Sopenharmony_ci#define SKID_ID_MASK	(0xffffff00)
7162306a36Sopenharmony_ci#define SKID_SA1111_ID	(0x690cc200)
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/*
7462306a36Sopenharmony_ci * System Controller
7562306a36Sopenharmony_ci *
7662306a36Sopenharmony_ci * Registers
7762306a36Sopenharmony_ci *    SKPCR	Power Control Register
7862306a36Sopenharmony_ci *    SKCDR	Clock Divider Register
7962306a36Sopenharmony_ci *    SKAUD	Audio Clock Divider Register
8062306a36Sopenharmony_ci *    SKPMC	PS/2 Mouse Clock Divider Register
8162306a36Sopenharmony_ci *    SKPTC	PS/2 Track Pad Clock Divider Register
8262306a36Sopenharmony_ci *    SKPEN0	PWM0 Enable Register
8362306a36Sopenharmony_ci *    SKPWM0	PWM0 Clock Register
8462306a36Sopenharmony_ci *    SKPEN1	PWM1 Enable Register
8562306a36Sopenharmony_ci *    SKPWM1	PWM1 Clock Register
8662306a36Sopenharmony_ci */
8762306a36Sopenharmony_ci#define SA1111_SKPCR	0x0200
8862306a36Sopenharmony_ci#define SA1111_SKCDR	0x0204
8962306a36Sopenharmony_ci#define SA1111_SKAUD	0x0208
9062306a36Sopenharmony_ci#define SA1111_SKPMC	0x020c
9162306a36Sopenharmony_ci#define SA1111_SKPTC	0x0210
9262306a36Sopenharmony_ci#define SA1111_SKPEN0	0x0214
9362306a36Sopenharmony_ci#define SA1111_SKPWM0	0x0218
9462306a36Sopenharmony_ci#define SA1111_SKPEN1	0x021c
9562306a36Sopenharmony_ci#define SA1111_SKPWM1	0x0220
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci#define SKPCR_UCLKEN	(1<<0)
9862306a36Sopenharmony_ci#define SKPCR_ACCLKEN	(1<<1)
9962306a36Sopenharmony_ci#define SKPCR_I2SCLKEN	(1<<2)
10062306a36Sopenharmony_ci#define SKPCR_L3CLKEN	(1<<3)
10162306a36Sopenharmony_ci#define SKPCR_SCLKEN	(1<<4)
10262306a36Sopenharmony_ci#define SKPCR_PMCLKEN	(1<<5)
10362306a36Sopenharmony_ci#define SKPCR_PTCLKEN	(1<<6)
10462306a36Sopenharmony_ci#define SKPCR_DCLKEN	(1<<7)
10562306a36Sopenharmony_ci#define SKPCR_PWMCLKEN	(1<<8)
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci/* USB Host controller */
10862306a36Sopenharmony_ci#define SA1111_USB		0x0400
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/*
11162306a36Sopenharmony_ci * Serial Audio Controller
11262306a36Sopenharmony_ci *
11362306a36Sopenharmony_ci * Registers
11462306a36Sopenharmony_ci *    SACR0             Serial Audio Common Control Register
11562306a36Sopenharmony_ci *    SACR1             Serial Audio Alternate Mode (I2C/MSB) Control Register
11662306a36Sopenharmony_ci *    SACR2             Serial Audio AC-link Control Register
11762306a36Sopenharmony_ci *    SASR0             Serial Audio I2S/MSB Interface & FIFO Status Register
11862306a36Sopenharmony_ci *    SASR1             Serial Audio AC-link Interface & FIFO Status Register
11962306a36Sopenharmony_ci *    SASCR             Serial Audio Status Clear Register
12062306a36Sopenharmony_ci *    L3_CAR            L3 Control Bus Address Register
12162306a36Sopenharmony_ci *    L3_CDR            L3 Control Bus Data Register
12262306a36Sopenharmony_ci *    ACCAR             AC-link Command Address Register
12362306a36Sopenharmony_ci *    ACCDR             AC-link Command Data Register
12462306a36Sopenharmony_ci *    ACSAR             AC-link Status Address Register
12562306a36Sopenharmony_ci *    ACSDR             AC-link Status Data Register
12662306a36Sopenharmony_ci *    SADTCS            Serial Audio DMA Transmit Control/Status Register
12762306a36Sopenharmony_ci *    SADTSA            Serial Audio DMA Transmit Buffer Start Address A
12862306a36Sopenharmony_ci *    SADTCA            Serial Audio DMA Transmit Buffer Count Register A
12962306a36Sopenharmony_ci *    SADTSB            Serial Audio DMA Transmit Buffer Start Address B
13062306a36Sopenharmony_ci *    SADTCB            Serial Audio DMA Transmit Buffer Count Register B
13162306a36Sopenharmony_ci *    SADRCS            Serial Audio DMA Receive Control/Status Register
13262306a36Sopenharmony_ci *    SADRSA            Serial Audio DMA Receive Buffer Start Address A
13362306a36Sopenharmony_ci *    SADRCA            Serial Audio DMA Receive Buffer Count Register A
13462306a36Sopenharmony_ci *    SADRSB            Serial Audio DMA Receive Buffer Start Address B
13562306a36Sopenharmony_ci *    SADRCB            Serial Audio DMA Receive Buffer Count Register B
13662306a36Sopenharmony_ci *    SAITR             Serial Audio Interrupt Test Register
13762306a36Sopenharmony_ci *    SADR              Serial Audio Data Register (16 x 32-bit)
13862306a36Sopenharmony_ci */
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define SA1111_SERAUDIO		0x0600
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci/*
14362306a36Sopenharmony_ci * These are offsets from the above base.
14462306a36Sopenharmony_ci */
14562306a36Sopenharmony_ci#define SA1111_SACR0		0x00
14662306a36Sopenharmony_ci#define SA1111_SACR1		0x04
14762306a36Sopenharmony_ci#define SA1111_SACR2		0x08
14862306a36Sopenharmony_ci#define SA1111_SASR0		0x0c
14962306a36Sopenharmony_ci#define SA1111_SASR1		0x10
15062306a36Sopenharmony_ci#define SA1111_SASCR		0x18
15162306a36Sopenharmony_ci#define SA1111_L3_CAR		0x1c
15262306a36Sopenharmony_ci#define SA1111_L3_CDR		0x20
15362306a36Sopenharmony_ci#define SA1111_ACCAR		0x24
15462306a36Sopenharmony_ci#define SA1111_ACCDR		0x28
15562306a36Sopenharmony_ci#define SA1111_ACSAR		0x2c
15662306a36Sopenharmony_ci#define SA1111_ACSDR		0x30
15762306a36Sopenharmony_ci#define SA1111_SADTCS		0x34
15862306a36Sopenharmony_ci#define SA1111_SADTSA		0x38
15962306a36Sopenharmony_ci#define SA1111_SADTCA		0x3c
16062306a36Sopenharmony_ci#define SA1111_SADTSB		0x40
16162306a36Sopenharmony_ci#define SA1111_SADTCB		0x44
16262306a36Sopenharmony_ci#define SA1111_SADRCS		0x48
16362306a36Sopenharmony_ci#define SA1111_SADRSA		0x4c
16462306a36Sopenharmony_ci#define SA1111_SADRCA		0x50
16562306a36Sopenharmony_ci#define SA1111_SADRSB		0x54
16662306a36Sopenharmony_ci#define SA1111_SADRCB		0x58
16762306a36Sopenharmony_ci#define SA1111_SAITR		0x5c
16862306a36Sopenharmony_ci#define SA1111_SADR		0x80
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci#ifndef CONFIG_ARCH_PXA
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci#define SACR0_ENB	(1<<0)
17362306a36Sopenharmony_ci#define SACR0_BCKD	(1<<2)
17462306a36Sopenharmony_ci#define SACR0_RST	(1<<3)
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci#define SACR1_AMSL	(1<<0)
17762306a36Sopenharmony_ci#define SACR1_L3EN	(1<<1)
17862306a36Sopenharmony_ci#define SACR1_L3MB	(1<<2)
17962306a36Sopenharmony_ci#define SACR1_DREC	(1<<3)
18062306a36Sopenharmony_ci#define SACR1_DRPL	(1<<4)
18162306a36Sopenharmony_ci#define SACR1_ENLBF	(1<<5)
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci#define SACR2_TS3V	(1<<0)
18462306a36Sopenharmony_ci#define SACR2_TS4V	(1<<1)
18562306a36Sopenharmony_ci#define SACR2_WKUP	(1<<2)
18662306a36Sopenharmony_ci#define SACR2_DREC	(1<<3)
18762306a36Sopenharmony_ci#define SACR2_DRPL	(1<<4)
18862306a36Sopenharmony_ci#define SACR2_ENLBF	(1<<5)
18962306a36Sopenharmony_ci#define SACR2_RESET	(1<<6)
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci#define SASR0_TNF	(1<<0)
19262306a36Sopenharmony_ci#define SASR0_RNE	(1<<1)
19362306a36Sopenharmony_ci#define SASR0_BSY	(1<<2)
19462306a36Sopenharmony_ci#define SASR0_TFS	(1<<3)
19562306a36Sopenharmony_ci#define SASR0_RFS	(1<<4)
19662306a36Sopenharmony_ci#define SASR0_TUR	(1<<5)
19762306a36Sopenharmony_ci#define SASR0_ROR	(1<<6)
19862306a36Sopenharmony_ci#define SASR0_L3WD	(1<<16)
19962306a36Sopenharmony_ci#define SASR0_L3RD	(1<<17)
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci#define SASR1_TNF	(1<<0)
20262306a36Sopenharmony_ci#define SASR1_RNE	(1<<1)
20362306a36Sopenharmony_ci#define SASR1_BSY	(1<<2)
20462306a36Sopenharmony_ci#define SASR1_TFS	(1<<3)
20562306a36Sopenharmony_ci#define SASR1_RFS	(1<<4)
20662306a36Sopenharmony_ci#define SASR1_TUR	(1<<5)
20762306a36Sopenharmony_ci#define SASR1_ROR	(1<<6)
20862306a36Sopenharmony_ci#define SASR1_CADT	(1<<16)
20962306a36Sopenharmony_ci#define SASR1_SADR	(1<<17)
21062306a36Sopenharmony_ci#define SASR1_RSTO	(1<<18)
21162306a36Sopenharmony_ci#define SASR1_CLPM	(1<<19)
21262306a36Sopenharmony_ci#define SASR1_CRDY	(1<<20)
21362306a36Sopenharmony_ci#define SASR1_RS3V	(1<<21)
21462306a36Sopenharmony_ci#define SASR1_RS4V	(1<<22)
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci#define SASCR_TUR	(1<<5)
21762306a36Sopenharmony_ci#define SASCR_ROR	(1<<6)
21862306a36Sopenharmony_ci#define SASCR_DTS	(1<<16)
21962306a36Sopenharmony_ci#define SASCR_RDD	(1<<17)
22062306a36Sopenharmony_ci#define SASCR_STO	(1<<18)
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci#define SADTCS_TDEN	(1<<0)
22362306a36Sopenharmony_ci#define SADTCS_TDIE	(1<<1)
22462306a36Sopenharmony_ci#define SADTCS_TDBDA	(1<<3)
22562306a36Sopenharmony_ci#define SADTCS_TDSTA	(1<<4)
22662306a36Sopenharmony_ci#define SADTCS_TDBDB	(1<<5)
22762306a36Sopenharmony_ci#define SADTCS_TDSTB	(1<<6)
22862306a36Sopenharmony_ci#define SADTCS_TBIU	(1<<7)
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci#define SADRCS_RDEN	(1<<0)
23162306a36Sopenharmony_ci#define SADRCS_RDIE	(1<<1)
23262306a36Sopenharmony_ci#define SADRCS_RDBDA	(1<<3)
23362306a36Sopenharmony_ci#define SADRCS_RDSTA	(1<<4)
23462306a36Sopenharmony_ci#define SADRCS_RDBDB	(1<<5)
23562306a36Sopenharmony_ci#define SADRCS_RDSTB	(1<<6)
23662306a36Sopenharmony_ci#define SADRCS_RBIU	(1<<7)
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci#define SAD_CS_DEN	(1<<0)
23962306a36Sopenharmony_ci#define SAD_CS_DIE	(1<<1)	/* Not functional on metal 1 */
24062306a36Sopenharmony_ci#define SAD_CS_DBDA	(1<<3)	/* Not functional on metal 1 */
24162306a36Sopenharmony_ci#define SAD_CS_DSTA	(1<<4)
24262306a36Sopenharmony_ci#define SAD_CS_DBDB	(1<<5)	/* Not functional on metal 1 */
24362306a36Sopenharmony_ci#define SAD_CS_DSTB	(1<<6)
24462306a36Sopenharmony_ci#define SAD_CS_BIU	(1<<7)	/* Not functional on metal 1 */
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci#define SAITR_TFS	(1<<0)
24762306a36Sopenharmony_ci#define SAITR_RFS	(1<<1)
24862306a36Sopenharmony_ci#define SAITR_TUR	(1<<2)
24962306a36Sopenharmony_ci#define SAITR_ROR	(1<<3)
25062306a36Sopenharmony_ci#define SAITR_CADT	(1<<4)
25162306a36Sopenharmony_ci#define SAITR_SADR	(1<<5)
25262306a36Sopenharmony_ci#define SAITR_RSTO	(1<<6)
25362306a36Sopenharmony_ci#define SAITR_TDBDA	(1<<8)
25462306a36Sopenharmony_ci#define SAITR_TDBDB	(1<<9)
25562306a36Sopenharmony_ci#define SAITR_RDBDA	(1<<10)
25662306a36Sopenharmony_ci#define SAITR_RDBDB	(1<<11)
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci#endif  /* !CONFIG_ARCH_PXA */
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci/*
26162306a36Sopenharmony_ci * General-Purpose I/O Interface
26262306a36Sopenharmony_ci *
26362306a36Sopenharmony_ci * Registers
26462306a36Sopenharmony_ci *    PA_DDR		GPIO Block A Data Direction
26562306a36Sopenharmony_ci *    PA_DRR/PA_DWR	GPIO Block A Data Value Register (read/write)
26662306a36Sopenharmony_ci *    PA_SDR		GPIO Block A Sleep Direction
26762306a36Sopenharmony_ci *    PA_SSR		GPIO Block A Sleep State
26862306a36Sopenharmony_ci *    PB_DDR		GPIO Block B Data Direction
26962306a36Sopenharmony_ci *    PB_DRR/PB_DWR	GPIO Block B Data Value Register (read/write)
27062306a36Sopenharmony_ci *    PB_SDR		GPIO Block B Sleep Direction
27162306a36Sopenharmony_ci *    PB_SSR		GPIO Block B Sleep State
27262306a36Sopenharmony_ci *    PC_DDR		GPIO Block C Data Direction
27362306a36Sopenharmony_ci *    PC_DRR/PC_DWR	GPIO Block C Data Value Register (read/write)
27462306a36Sopenharmony_ci *    PC_SDR		GPIO Block C Sleep Direction
27562306a36Sopenharmony_ci *    PC_SSR		GPIO Block C Sleep State
27662306a36Sopenharmony_ci */
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci#define SA1111_GPIO	0x1000
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci#define SA1111_GPIO_PADDR	(0x000)
28162306a36Sopenharmony_ci#define SA1111_GPIO_PADRR	(0x004)
28262306a36Sopenharmony_ci#define SA1111_GPIO_PADWR	(0x004)
28362306a36Sopenharmony_ci#define SA1111_GPIO_PASDR	(0x008)
28462306a36Sopenharmony_ci#define SA1111_GPIO_PASSR	(0x00c)
28562306a36Sopenharmony_ci#define SA1111_GPIO_PBDDR	(0x010)
28662306a36Sopenharmony_ci#define SA1111_GPIO_PBDRR	(0x014)
28762306a36Sopenharmony_ci#define SA1111_GPIO_PBDWR	(0x014)
28862306a36Sopenharmony_ci#define SA1111_GPIO_PBSDR	(0x018)
28962306a36Sopenharmony_ci#define SA1111_GPIO_PBSSR	(0x01c)
29062306a36Sopenharmony_ci#define SA1111_GPIO_PCDDR	(0x020)
29162306a36Sopenharmony_ci#define SA1111_GPIO_PCDRR	(0x024)
29262306a36Sopenharmony_ci#define SA1111_GPIO_PCDWR	(0x024)
29362306a36Sopenharmony_ci#define SA1111_GPIO_PCSDR	(0x028)
29462306a36Sopenharmony_ci#define SA1111_GPIO_PCSSR	(0x02c)
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci#define GPIO_A0		(1 << 0)
29762306a36Sopenharmony_ci#define GPIO_A1		(1 << 1)
29862306a36Sopenharmony_ci#define GPIO_A2		(1 << 2)
29962306a36Sopenharmony_ci#define GPIO_A3		(1 << 3)
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci#define GPIO_B0		(1 << 8)
30262306a36Sopenharmony_ci#define GPIO_B1		(1 << 9)
30362306a36Sopenharmony_ci#define GPIO_B2		(1 << 10)
30462306a36Sopenharmony_ci#define GPIO_B3		(1 << 11)
30562306a36Sopenharmony_ci#define GPIO_B4		(1 << 12)
30662306a36Sopenharmony_ci#define GPIO_B5		(1 << 13)
30762306a36Sopenharmony_ci#define GPIO_B6		(1 << 14)
30862306a36Sopenharmony_ci#define GPIO_B7		(1 << 15)
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci#define GPIO_C0		(1 << 16)
31162306a36Sopenharmony_ci#define GPIO_C1		(1 << 17)
31262306a36Sopenharmony_ci#define GPIO_C2		(1 << 18)
31362306a36Sopenharmony_ci#define GPIO_C3		(1 << 19)
31462306a36Sopenharmony_ci#define GPIO_C4		(1 << 20)
31562306a36Sopenharmony_ci#define GPIO_C5		(1 << 21)
31662306a36Sopenharmony_ci#define GPIO_C6		(1 << 22)
31762306a36Sopenharmony_ci#define GPIO_C7		(1 << 23)
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci/*
32062306a36Sopenharmony_ci * Interrupt Controller
32162306a36Sopenharmony_ci *
32262306a36Sopenharmony_ci * Registers
32362306a36Sopenharmony_ci *    INTTEST0		Test register 0
32462306a36Sopenharmony_ci *    INTTEST1		Test register 1
32562306a36Sopenharmony_ci *    INTEN0		Interrupt Enable register 0
32662306a36Sopenharmony_ci *    INTEN1		Interrupt Enable register 1
32762306a36Sopenharmony_ci *    INTPOL0		Interrupt Polarity selection 0
32862306a36Sopenharmony_ci *    INTPOL1		Interrupt Polarity selection 1
32962306a36Sopenharmony_ci *    INTTSTSEL		Interrupt source selection
33062306a36Sopenharmony_ci *    INTSTATCLR0	Interrupt Status/Clear 0
33162306a36Sopenharmony_ci *    INTSTATCLR1	Interrupt Status/Clear 1
33262306a36Sopenharmony_ci *    INTSET0		Interrupt source set 0
33362306a36Sopenharmony_ci *    INTSET1		Interrupt source set 1
33462306a36Sopenharmony_ci *    WAKE_EN0		Wake-up source enable 0
33562306a36Sopenharmony_ci *    WAKE_EN1		Wake-up source enable 1
33662306a36Sopenharmony_ci *    WAKE_POL0		Wake-up polarity selection 0
33762306a36Sopenharmony_ci *    WAKE_POL1		Wake-up polarity selection 1
33862306a36Sopenharmony_ci */
33962306a36Sopenharmony_ci#define SA1111_INTC		0x1600
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci/*
34262306a36Sopenharmony_ci * These are offsets from the above base.
34362306a36Sopenharmony_ci */
34462306a36Sopenharmony_ci#define SA1111_INTTEST0		0x0000
34562306a36Sopenharmony_ci#define SA1111_INTTEST1		0x0004
34662306a36Sopenharmony_ci#define SA1111_INTEN0		0x0008
34762306a36Sopenharmony_ci#define SA1111_INTEN1		0x000c
34862306a36Sopenharmony_ci#define SA1111_INTPOL0		0x0010
34962306a36Sopenharmony_ci#define SA1111_INTPOL1		0x0014
35062306a36Sopenharmony_ci#define SA1111_INTTSTSEL	0x0018
35162306a36Sopenharmony_ci#define SA1111_INTSTATCLR0	0x001c
35262306a36Sopenharmony_ci#define SA1111_INTSTATCLR1	0x0020
35362306a36Sopenharmony_ci#define SA1111_INTSET0		0x0024
35462306a36Sopenharmony_ci#define SA1111_INTSET1		0x0028
35562306a36Sopenharmony_ci#define SA1111_WAKEEN0		0x002c
35662306a36Sopenharmony_ci#define SA1111_WAKEEN1		0x0030
35762306a36Sopenharmony_ci#define SA1111_WAKEPOL0		0x0034
35862306a36Sopenharmony_ci#define SA1111_WAKEPOL1		0x0038
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci/* PS/2 Trackpad and Mouse Interfaces */
36162306a36Sopenharmony_ci#define SA1111_KBD		0x0a00
36262306a36Sopenharmony_ci#define SA1111_MSE		0x0c00
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci/* PCMCIA Interface */
36562306a36Sopenharmony_ci#define SA1111_PCMCIA		0x1600
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ciextern struct bus_type sa1111_bus_type;
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ci#define SA1111_DEVID_SBI	(1 << 0)
37462306a36Sopenharmony_ci#define SA1111_DEVID_SK		(1 << 1)
37562306a36Sopenharmony_ci#define SA1111_DEVID_USB	(1 << 2)
37662306a36Sopenharmony_ci#define SA1111_DEVID_SAC	(1 << 3)
37762306a36Sopenharmony_ci#define SA1111_DEVID_SSP	(1 << 4)
37862306a36Sopenharmony_ci#define SA1111_DEVID_PS2	(3 << 5)
37962306a36Sopenharmony_ci#define SA1111_DEVID_PS2_KBD	(1 << 5)
38062306a36Sopenharmony_ci#define SA1111_DEVID_PS2_MSE	(1 << 6)
38162306a36Sopenharmony_ci#define SA1111_DEVID_GPIO	(1 << 7)
38262306a36Sopenharmony_ci#define SA1111_DEVID_INT	(1 << 8)
38362306a36Sopenharmony_ci#define SA1111_DEVID_PCMCIA	(1 << 9)
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_cistruct sa1111_dev {
38662306a36Sopenharmony_ci	struct device	dev;
38762306a36Sopenharmony_ci	unsigned int	devid;
38862306a36Sopenharmony_ci	struct resource	res;
38962306a36Sopenharmony_ci	void __iomem	*mapbase;
39062306a36Sopenharmony_ci	unsigned int	skpcr_mask;
39162306a36Sopenharmony_ci	unsigned int	hwirq[6];
39262306a36Sopenharmony_ci	u64		dma_mask;
39362306a36Sopenharmony_ci};
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_ci#define to_sa1111_device(x)	container_of(x, struct sa1111_dev, dev)
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ci#define sa1111_get_drvdata(d)	dev_get_drvdata(&(d)->dev)
39862306a36Sopenharmony_ci#define sa1111_set_drvdata(d,p)	dev_set_drvdata(&(d)->dev, p)
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_cistruct sa1111_driver {
40162306a36Sopenharmony_ci	struct device_driver	drv;
40262306a36Sopenharmony_ci	unsigned int		devid;
40362306a36Sopenharmony_ci	int (*probe)(struct sa1111_dev *);
40462306a36Sopenharmony_ci	void (*remove)(struct sa1111_dev *);
40562306a36Sopenharmony_ci};
40662306a36Sopenharmony_ci
40762306a36Sopenharmony_ci#define SA1111_DRV(_d)	container_of((_d), struct sa1111_driver, drv)
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci#define SA1111_DRIVER_NAME(_sadev) ((_sadev)->dev.driver->name)
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ci/*
41262306a36Sopenharmony_ci * These frob the SKPCR register, and call platform specific
41362306a36Sopenharmony_ci * enable/disable functions.
41462306a36Sopenharmony_ci */
41562306a36Sopenharmony_ciint sa1111_enable_device(struct sa1111_dev *);
41662306a36Sopenharmony_civoid sa1111_disable_device(struct sa1111_dev *);
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ciint sa1111_get_irq(struct sa1111_dev *, unsigned num);
41962306a36Sopenharmony_ci
42062306a36Sopenharmony_ciunsigned int sa1111_pll_clock(struct sa1111_dev *);
42162306a36Sopenharmony_ci
42262306a36Sopenharmony_ci#define SA1111_AUDIO_ACLINK	0
42362306a36Sopenharmony_ci#define SA1111_AUDIO_I2S	1
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_civoid sa1111_select_audio_mode(struct sa1111_dev *sadev, int mode);
42662306a36Sopenharmony_ciint sa1111_set_audio_rate(struct sa1111_dev *sadev, int rate);
42762306a36Sopenharmony_ciint sa1111_get_audio_rate(struct sa1111_dev *sadev);
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ciint sa1111_check_dma_bug(dma_addr_t addr);
43062306a36Sopenharmony_ci
43162306a36Sopenharmony_ciint sa1111_driver_register(struct sa1111_driver *);
43262306a36Sopenharmony_civoid sa1111_driver_unregister(struct sa1111_driver *);
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_cistruct sa1111_platform_data {
43562306a36Sopenharmony_ci	int	irq_base;	/* base for cascaded on-chip IRQs */
43662306a36Sopenharmony_ci	unsigned disable_devs;
43762306a36Sopenharmony_ci	void	*data;
43862306a36Sopenharmony_ci	int	(*enable)(void *, unsigned);
43962306a36Sopenharmony_ci	void	(*disable)(void *, unsigned);
44062306a36Sopenharmony_ci};
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ci#endif  /* _ASM_ARCH_SA1111 */
443