18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/include/asm/hardware/sa1111.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This file contains definitions for the SA-1111 Companion Chip.
88c2ecf20Sopenharmony_ci * (Structure and naming borrowed from SA-1101.h, by Peter Danielsson.)
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Macro that calculates real address for registers in the SA-1111
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef _ASM_ARCH_SA1111
148c2ecf20Sopenharmony_ci#define _ASM_ARCH_SA1111
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <mach/bitfield.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/*
198c2ecf20Sopenharmony_ci * Don't ask the (SAC) DMA engines to move less than this amount.
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define SA1111_SAC_DMA_MIN_XFER	(0x800)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/*
258c2ecf20Sopenharmony_ci * System Bus Interface (SBI)
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci * Registers
288c2ecf20Sopenharmony_ci *    SKCR	Control Register
298c2ecf20Sopenharmony_ci *    SMCR	Shared Memory Controller Register
308c2ecf20Sopenharmony_ci *    SKID	ID Register
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci#define SA1111_SKCR	0x0000
338c2ecf20Sopenharmony_ci#define SA1111_SMCR	0x0004
348c2ecf20Sopenharmony_ci#define SA1111_SKID	0x0008
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define SKCR_PLL_BYPASS	(1<<0)
378c2ecf20Sopenharmony_ci#define SKCR_RCLKEN	(1<<1)
388c2ecf20Sopenharmony_ci#define SKCR_SLEEP	(1<<2)
398c2ecf20Sopenharmony_ci#define SKCR_DOZE	(1<<3)
408c2ecf20Sopenharmony_ci#define SKCR_VCO_OFF	(1<<4)
418c2ecf20Sopenharmony_ci#define SKCR_SCANTSTEN	(1<<5)
428c2ecf20Sopenharmony_ci#define SKCR_CLKTSTEN	(1<<6)
438c2ecf20Sopenharmony_ci#define SKCR_RDYEN	(1<<7)
448c2ecf20Sopenharmony_ci#define SKCR_SELAC	(1<<8)
458c2ecf20Sopenharmony_ci#define SKCR_OPPC	(1<<9)
468c2ecf20Sopenharmony_ci#define SKCR_PLLTSTEN	(1<<10)
478c2ecf20Sopenharmony_ci#define SKCR_USBIOTSTEN	(1<<11)
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * Don't believe the specs!  Take them, throw them outside.  Leave them
508c2ecf20Sopenharmony_ci * there for a week.  Spit on them.  Walk on them.  Stamp on them.
518c2ecf20Sopenharmony_ci * Pour gasoline over them and finally burn them.  Now think about coding.
528c2ecf20Sopenharmony_ci *  - The October 1999 errata (278260-007) says its bit 13, 1 to enable.
538c2ecf20Sopenharmony_ci *  - The Feb 2001 errata (278260-010) says that the previous errata
548c2ecf20Sopenharmony_ci *    (278260-009) is wrong, and its bit actually 12, fixed in spec
558c2ecf20Sopenharmony_ci *    278242-003.
568c2ecf20Sopenharmony_ci *  - The SA1111 manual (278242) says bit 12, but 0 to enable.
578c2ecf20Sopenharmony_ci *  - Reality is bit 13, 1 to enable.
588c2ecf20Sopenharmony_ci *      -- rmk
598c2ecf20Sopenharmony_ci */
608c2ecf20Sopenharmony_ci#define SKCR_OE_EN	(1<<13)
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define SMCR_DTIM	(1<<0)
638c2ecf20Sopenharmony_ci#define SMCR_MBGE	(1<<1)
648c2ecf20Sopenharmony_ci#define SMCR_DRAC_0	(1<<2)
658c2ecf20Sopenharmony_ci#define SMCR_DRAC_1	(1<<3)
668c2ecf20Sopenharmony_ci#define SMCR_DRAC_2	(1<<4)
678c2ecf20Sopenharmony_ci#define SMCR_DRAC	Fld(3, 2)
688c2ecf20Sopenharmony_ci#define SMCR_CLAT	(1<<5)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define SKID_SIREV_MASK	(0x000000f0)
718c2ecf20Sopenharmony_ci#define SKID_MTREV_MASK (0x0000000f)
728c2ecf20Sopenharmony_ci#define SKID_ID_MASK	(0xffffff00)
738c2ecf20Sopenharmony_ci#define SKID_SA1111_ID	(0x690cc200)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/*
768c2ecf20Sopenharmony_ci * System Controller
778c2ecf20Sopenharmony_ci *
788c2ecf20Sopenharmony_ci * Registers
798c2ecf20Sopenharmony_ci *    SKPCR	Power Control Register
808c2ecf20Sopenharmony_ci *    SKCDR	Clock Divider Register
818c2ecf20Sopenharmony_ci *    SKAUD	Audio Clock Divider Register
828c2ecf20Sopenharmony_ci *    SKPMC	PS/2 Mouse Clock Divider Register
838c2ecf20Sopenharmony_ci *    SKPTC	PS/2 Track Pad Clock Divider Register
848c2ecf20Sopenharmony_ci *    SKPEN0	PWM0 Enable Register
858c2ecf20Sopenharmony_ci *    SKPWM0	PWM0 Clock Register
868c2ecf20Sopenharmony_ci *    SKPEN1	PWM1 Enable Register
878c2ecf20Sopenharmony_ci *    SKPWM1	PWM1 Clock Register
888c2ecf20Sopenharmony_ci */
898c2ecf20Sopenharmony_ci#define SA1111_SKPCR	0x0200
908c2ecf20Sopenharmony_ci#define SA1111_SKCDR	0x0204
918c2ecf20Sopenharmony_ci#define SA1111_SKAUD	0x0208
928c2ecf20Sopenharmony_ci#define SA1111_SKPMC	0x020c
938c2ecf20Sopenharmony_ci#define SA1111_SKPTC	0x0210
948c2ecf20Sopenharmony_ci#define SA1111_SKPEN0	0x0214
958c2ecf20Sopenharmony_ci#define SA1111_SKPWM0	0x0218
968c2ecf20Sopenharmony_ci#define SA1111_SKPEN1	0x021c
978c2ecf20Sopenharmony_ci#define SA1111_SKPWM1	0x0220
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#define SKPCR_UCLKEN	(1<<0)
1008c2ecf20Sopenharmony_ci#define SKPCR_ACCLKEN	(1<<1)
1018c2ecf20Sopenharmony_ci#define SKPCR_I2SCLKEN	(1<<2)
1028c2ecf20Sopenharmony_ci#define SKPCR_L3CLKEN	(1<<3)
1038c2ecf20Sopenharmony_ci#define SKPCR_SCLKEN	(1<<4)
1048c2ecf20Sopenharmony_ci#define SKPCR_PMCLKEN	(1<<5)
1058c2ecf20Sopenharmony_ci#define SKPCR_PTCLKEN	(1<<6)
1068c2ecf20Sopenharmony_ci#define SKPCR_DCLKEN	(1<<7)
1078c2ecf20Sopenharmony_ci#define SKPCR_PWMCLKEN	(1<<8)
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* USB Host controller */
1108c2ecf20Sopenharmony_ci#define SA1111_USB		0x0400
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/*
1138c2ecf20Sopenharmony_ci * Serial Audio Controller
1148c2ecf20Sopenharmony_ci *
1158c2ecf20Sopenharmony_ci * Registers
1168c2ecf20Sopenharmony_ci *    SACR0             Serial Audio Common Control Register
1178c2ecf20Sopenharmony_ci *    SACR1             Serial Audio Alternate Mode (I2C/MSB) Control Register
1188c2ecf20Sopenharmony_ci *    SACR2             Serial Audio AC-link Control Register
1198c2ecf20Sopenharmony_ci *    SASR0             Serial Audio I2S/MSB Interface & FIFO Status Register
1208c2ecf20Sopenharmony_ci *    SASR1             Serial Audio AC-link Interface & FIFO Status Register
1218c2ecf20Sopenharmony_ci *    SASCR             Serial Audio Status Clear Register
1228c2ecf20Sopenharmony_ci *    L3_CAR            L3 Control Bus Address Register
1238c2ecf20Sopenharmony_ci *    L3_CDR            L3 Control Bus Data Register
1248c2ecf20Sopenharmony_ci *    ACCAR             AC-link Command Address Register
1258c2ecf20Sopenharmony_ci *    ACCDR             AC-link Command Data Register
1268c2ecf20Sopenharmony_ci *    ACSAR             AC-link Status Address Register
1278c2ecf20Sopenharmony_ci *    ACSDR             AC-link Status Data Register
1288c2ecf20Sopenharmony_ci *    SADTCS            Serial Audio DMA Transmit Control/Status Register
1298c2ecf20Sopenharmony_ci *    SADTSA            Serial Audio DMA Transmit Buffer Start Address A
1308c2ecf20Sopenharmony_ci *    SADTCA            Serial Audio DMA Transmit Buffer Count Register A
1318c2ecf20Sopenharmony_ci *    SADTSB            Serial Audio DMA Transmit Buffer Start Address B
1328c2ecf20Sopenharmony_ci *    SADTCB            Serial Audio DMA Transmit Buffer Count Register B
1338c2ecf20Sopenharmony_ci *    SADRCS            Serial Audio DMA Receive Control/Status Register
1348c2ecf20Sopenharmony_ci *    SADRSA            Serial Audio DMA Receive Buffer Start Address A
1358c2ecf20Sopenharmony_ci *    SADRCA            Serial Audio DMA Receive Buffer Count Register A
1368c2ecf20Sopenharmony_ci *    SADRSB            Serial Audio DMA Receive Buffer Start Address B
1378c2ecf20Sopenharmony_ci *    SADRCB            Serial Audio DMA Receive Buffer Count Register B
1388c2ecf20Sopenharmony_ci *    SAITR             Serial Audio Interrupt Test Register
1398c2ecf20Sopenharmony_ci *    SADR              Serial Audio Data Register (16 x 32-bit)
1408c2ecf20Sopenharmony_ci */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#define SA1111_SERAUDIO		0x0600
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci/*
1458c2ecf20Sopenharmony_ci * These are offsets from the above base.
1468c2ecf20Sopenharmony_ci */
1478c2ecf20Sopenharmony_ci#define SA1111_SACR0		0x00
1488c2ecf20Sopenharmony_ci#define SA1111_SACR1		0x04
1498c2ecf20Sopenharmony_ci#define SA1111_SACR2		0x08
1508c2ecf20Sopenharmony_ci#define SA1111_SASR0		0x0c
1518c2ecf20Sopenharmony_ci#define SA1111_SASR1		0x10
1528c2ecf20Sopenharmony_ci#define SA1111_SASCR		0x18
1538c2ecf20Sopenharmony_ci#define SA1111_L3_CAR		0x1c
1548c2ecf20Sopenharmony_ci#define SA1111_L3_CDR		0x20
1558c2ecf20Sopenharmony_ci#define SA1111_ACCAR		0x24
1568c2ecf20Sopenharmony_ci#define SA1111_ACCDR		0x28
1578c2ecf20Sopenharmony_ci#define SA1111_ACSAR		0x2c
1588c2ecf20Sopenharmony_ci#define SA1111_ACSDR		0x30
1598c2ecf20Sopenharmony_ci#define SA1111_SADTCS		0x34
1608c2ecf20Sopenharmony_ci#define SA1111_SADTSA		0x38
1618c2ecf20Sopenharmony_ci#define SA1111_SADTCA		0x3c
1628c2ecf20Sopenharmony_ci#define SA1111_SADTSB		0x40
1638c2ecf20Sopenharmony_ci#define SA1111_SADTCB		0x44
1648c2ecf20Sopenharmony_ci#define SA1111_SADRCS		0x48
1658c2ecf20Sopenharmony_ci#define SA1111_SADRSA		0x4c
1668c2ecf20Sopenharmony_ci#define SA1111_SADRCA		0x50
1678c2ecf20Sopenharmony_ci#define SA1111_SADRSB		0x54
1688c2ecf20Sopenharmony_ci#define SA1111_SADRCB		0x58
1698c2ecf20Sopenharmony_ci#define SA1111_SAITR		0x5c
1708c2ecf20Sopenharmony_ci#define SA1111_SADR		0x80
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#ifndef CONFIG_ARCH_PXA
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define SACR0_ENB	(1<<0)
1758c2ecf20Sopenharmony_ci#define SACR0_BCKD	(1<<2)
1768c2ecf20Sopenharmony_ci#define SACR0_RST	(1<<3)
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define SACR1_AMSL	(1<<0)
1798c2ecf20Sopenharmony_ci#define SACR1_L3EN	(1<<1)
1808c2ecf20Sopenharmony_ci#define SACR1_L3MB	(1<<2)
1818c2ecf20Sopenharmony_ci#define SACR1_DREC	(1<<3)
1828c2ecf20Sopenharmony_ci#define SACR1_DRPL	(1<<4)
1838c2ecf20Sopenharmony_ci#define SACR1_ENLBF	(1<<5)
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci#define SACR2_TS3V	(1<<0)
1868c2ecf20Sopenharmony_ci#define SACR2_TS4V	(1<<1)
1878c2ecf20Sopenharmony_ci#define SACR2_WKUP	(1<<2)
1888c2ecf20Sopenharmony_ci#define SACR2_DREC	(1<<3)
1898c2ecf20Sopenharmony_ci#define SACR2_DRPL	(1<<4)
1908c2ecf20Sopenharmony_ci#define SACR2_ENLBF	(1<<5)
1918c2ecf20Sopenharmony_ci#define SACR2_RESET	(1<<6)
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci#define SASR0_TNF	(1<<0)
1948c2ecf20Sopenharmony_ci#define SASR0_RNE	(1<<1)
1958c2ecf20Sopenharmony_ci#define SASR0_BSY	(1<<2)
1968c2ecf20Sopenharmony_ci#define SASR0_TFS	(1<<3)
1978c2ecf20Sopenharmony_ci#define SASR0_RFS	(1<<4)
1988c2ecf20Sopenharmony_ci#define SASR0_TUR	(1<<5)
1998c2ecf20Sopenharmony_ci#define SASR0_ROR	(1<<6)
2008c2ecf20Sopenharmony_ci#define SASR0_L3WD	(1<<16)
2018c2ecf20Sopenharmony_ci#define SASR0_L3RD	(1<<17)
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci#define SASR1_TNF	(1<<0)
2048c2ecf20Sopenharmony_ci#define SASR1_RNE	(1<<1)
2058c2ecf20Sopenharmony_ci#define SASR1_BSY	(1<<2)
2068c2ecf20Sopenharmony_ci#define SASR1_TFS	(1<<3)
2078c2ecf20Sopenharmony_ci#define SASR1_RFS	(1<<4)
2088c2ecf20Sopenharmony_ci#define SASR1_TUR	(1<<5)
2098c2ecf20Sopenharmony_ci#define SASR1_ROR	(1<<6)
2108c2ecf20Sopenharmony_ci#define SASR1_CADT	(1<<16)
2118c2ecf20Sopenharmony_ci#define SASR1_SADR	(1<<17)
2128c2ecf20Sopenharmony_ci#define SASR1_RSTO	(1<<18)
2138c2ecf20Sopenharmony_ci#define SASR1_CLPM	(1<<19)
2148c2ecf20Sopenharmony_ci#define SASR1_CRDY	(1<<20)
2158c2ecf20Sopenharmony_ci#define SASR1_RS3V	(1<<21)
2168c2ecf20Sopenharmony_ci#define SASR1_RS4V	(1<<22)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci#define SASCR_TUR	(1<<5)
2198c2ecf20Sopenharmony_ci#define SASCR_ROR	(1<<6)
2208c2ecf20Sopenharmony_ci#define SASCR_DTS	(1<<16)
2218c2ecf20Sopenharmony_ci#define SASCR_RDD	(1<<17)
2228c2ecf20Sopenharmony_ci#define SASCR_STO	(1<<18)
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#define SADTCS_TDEN	(1<<0)
2258c2ecf20Sopenharmony_ci#define SADTCS_TDIE	(1<<1)
2268c2ecf20Sopenharmony_ci#define SADTCS_TDBDA	(1<<3)
2278c2ecf20Sopenharmony_ci#define SADTCS_TDSTA	(1<<4)
2288c2ecf20Sopenharmony_ci#define SADTCS_TDBDB	(1<<5)
2298c2ecf20Sopenharmony_ci#define SADTCS_TDSTB	(1<<6)
2308c2ecf20Sopenharmony_ci#define SADTCS_TBIU	(1<<7)
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci#define SADRCS_RDEN	(1<<0)
2338c2ecf20Sopenharmony_ci#define SADRCS_RDIE	(1<<1)
2348c2ecf20Sopenharmony_ci#define SADRCS_RDBDA	(1<<3)
2358c2ecf20Sopenharmony_ci#define SADRCS_RDSTA	(1<<4)
2368c2ecf20Sopenharmony_ci#define SADRCS_RDBDB	(1<<5)
2378c2ecf20Sopenharmony_ci#define SADRCS_RDSTB	(1<<6)
2388c2ecf20Sopenharmony_ci#define SADRCS_RBIU	(1<<7)
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci#define SAD_CS_DEN	(1<<0)
2418c2ecf20Sopenharmony_ci#define SAD_CS_DIE	(1<<1)	/* Not functional on metal 1 */
2428c2ecf20Sopenharmony_ci#define SAD_CS_DBDA	(1<<3)	/* Not functional on metal 1 */
2438c2ecf20Sopenharmony_ci#define SAD_CS_DSTA	(1<<4)
2448c2ecf20Sopenharmony_ci#define SAD_CS_DBDB	(1<<5)	/* Not functional on metal 1 */
2458c2ecf20Sopenharmony_ci#define SAD_CS_DSTB	(1<<6)
2468c2ecf20Sopenharmony_ci#define SAD_CS_BIU	(1<<7)	/* Not functional on metal 1 */
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci#define SAITR_TFS	(1<<0)
2498c2ecf20Sopenharmony_ci#define SAITR_RFS	(1<<1)
2508c2ecf20Sopenharmony_ci#define SAITR_TUR	(1<<2)
2518c2ecf20Sopenharmony_ci#define SAITR_ROR	(1<<3)
2528c2ecf20Sopenharmony_ci#define SAITR_CADT	(1<<4)
2538c2ecf20Sopenharmony_ci#define SAITR_SADR	(1<<5)
2548c2ecf20Sopenharmony_ci#define SAITR_RSTO	(1<<6)
2558c2ecf20Sopenharmony_ci#define SAITR_TDBDA	(1<<8)
2568c2ecf20Sopenharmony_ci#define SAITR_TDBDB	(1<<9)
2578c2ecf20Sopenharmony_ci#define SAITR_RDBDA	(1<<10)
2588c2ecf20Sopenharmony_ci#define SAITR_RDBDB	(1<<11)
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci#endif  /* !CONFIG_ARCH_PXA */
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci/*
2638c2ecf20Sopenharmony_ci * General-Purpose I/O Interface
2648c2ecf20Sopenharmony_ci *
2658c2ecf20Sopenharmony_ci * Registers
2668c2ecf20Sopenharmony_ci *    PA_DDR		GPIO Block A Data Direction
2678c2ecf20Sopenharmony_ci *    PA_DRR/PA_DWR	GPIO Block A Data Value Register (read/write)
2688c2ecf20Sopenharmony_ci *    PA_SDR		GPIO Block A Sleep Direction
2698c2ecf20Sopenharmony_ci *    PA_SSR		GPIO Block A Sleep State
2708c2ecf20Sopenharmony_ci *    PB_DDR		GPIO Block B Data Direction
2718c2ecf20Sopenharmony_ci *    PB_DRR/PB_DWR	GPIO Block B Data Value Register (read/write)
2728c2ecf20Sopenharmony_ci *    PB_SDR		GPIO Block B Sleep Direction
2738c2ecf20Sopenharmony_ci *    PB_SSR		GPIO Block B Sleep State
2748c2ecf20Sopenharmony_ci *    PC_DDR		GPIO Block C Data Direction
2758c2ecf20Sopenharmony_ci *    PC_DRR/PC_DWR	GPIO Block C Data Value Register (read/write)
2768c2ecf20Sopenharmony_ci *    PC_SDR		GPIO Block C Sleep Direction
2778c2ecf20Sopenharmony_ci *    PC_SSR		GPIO Block C Sleep State
2788c2ecf20Sopenharmony_ci */
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci#define SA1111_GPIO	0x1000
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci#define SA1111_GPIO_PADDR	(0x000)
2838c2ecf20Sopenharmony_ci#define SA1111_GPIO_PADRR	(0x004)
2848c2ecf20Sopenharmony_ci#define SA1111_GPIO_PADWR	(0x004)
2858c2ecf20Sopenharmony_ci#define SA1111_GPIO_PASDR	(0x008)
2868c2ecf20Sopenharmony_ci#define SA1111_GPIO_PASSR	(0x00c)
2878c2ecf20Sopenharmony_ci#define SA1111_GPIO_PBDDR	(0x010)
2888c2ecf20Sopenharmony_ci#define SA1111_GPIO_PBDRR	(0x014)
2898c2ecf20Sopenharmony_ci#define SA1111_GPIO_PBDWR	(0x014)
2908c2ecf20Sopenharmony_ci#define SA1111_GPIO_PBSDR	(0x018)
2918c2ecf20Sopenharmony_ci#define SA1111_GPIO_PBSSR	(0x01c)
2928c2ecf20Sopenharmony_ci#define SA1111_GPIO_PCDDR	(0x020)
2938c2ecf20Sopenharmony_ci#define SA1111_GPIO_PCDRR	(0x024)
2948c2ecf20Sopenharmony_ci#define SA1111_GPIO_PCDWR	(0x024)
2958c2ecf20Sopenharmony_ci#define SA1111_GPIO_PCSDR	(0x028)
2968c2ecf20Sopenharmony_ci#define SA1111_GPIO_PCSSR	(0x02c)
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci#define GPIO_A0		(1 << 0)
2998c2ecf20Sopenharmony_ci#define GPIO_A1		(1 << 1)
3008c2ecf20Sopenharmony_ci#define GPIO_A2		(1 << 2)
3018c2ecf20Sopenharmony_ci#define GPIO_A3		(1 << 3)
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci#define GPIO_B0		(1 << 8)
3048c2ecf20Sopenharmony_ci#define GPIO_B1		(1 << 9)
3058c2ecf20Sopenharmony_ci#define GPIO_B2		(1 << 10)
3068c2ecf20Sopenharmony_ci#define GPIO_B3		(1 << 11)
3078c2ecf20Sopenharmony_ci#define GPIO_B4		(1 << 12)
3088c2ecf20Sopenharmony_ci#define GPIO_B5		(1 << 13)
3098c2ecf20Sopenharmony_ci#define GPIO_B6		(1 << 14)
3108c2ecf20Sopenharmony_ci#define GPIO_B7		(1 << 15)
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci#define GPIO_C0		(1 << 16)
3138c2ecf20Sopenharmony_ci#define GPIO_C1		(1 << 17)
3148c2ecf20Sopenharmony_ci#define GPIO_C2		(1 << 18)
3158c2ecf20Sopenharmony_ci#define GPIO_C3		(1 << 19)
3168c2ecf20Sopenharmony_ci#define GPIO_C4		(1 << 20)
3178c2ecf20Sopenharmony_ci#define GPIO_C5		(1 << 21)
3188c2ecf20Sopenharmony_ci#define GPIO_C6		(1 << 22)
3198c2ecf20Sopenharmony_ci#define GPIO_C7		(1 << 23)
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci/*
3228c2ecf20Sopenharmony_ci * Interrupt Controller
3238c2ecf20Sopenharmony_ci *
3248c2ecf20Sopenharmony_ci * Registers
3258c2ecf20Sopenharmony_ci *    INTTEST0		Test register 0
3268c2ecf20Sopenharmony_ci *    INTTEST1		Test register 1
3278c2ecf20Sopenharmony_ci *    INTEN0		Interrupt Enable register 0
3288c2ecf20Sopenharmony_ci *    INTEN1		Interrupt Enable register 1
3298c2ecf20Sopenharmony_ci *    INTPOL0		Interrupt Polarity selection 0
3308c2ecf20Sopenharmony_ci *    INTPOL1		Interrupt Polarity selection 1
3318c2ecf20Sopenharmony_ci *    INTTSTSEL		Interrupt source selection
3328c2ecf20Sopenharmony_ci *    INTSTATCLR0	Interrupt Status/Clear 0
3338c2ecf20Sopenharmony_ci *    INTSTATCLR1	Interrupt Status/Clear 1
3348c2ecf20Sopenharmony_ci *    INTSET0		Interrupt source set 0
3358c2ecf20Sopenharmony_ci *    INTSET1		Interrupt source set 1
3368c2ecf20Sopenharmony_ci *    WAKE_EN0		Wake-up source enable 0
3378c2ecf20Sopenharmony_ci *    WAKE_EN1		Wake-up source enable 1
3388c2ecf20Sopenharmony_ci *    WAKE_POL0		Wake-up polarity selection 0
3398c2ecf20Sopenharmony_ci *    WAKE_POL1		Wake-up polarity selection 1
3408c2ecf20Sopenharmony_ci */
3418c2ecf20Sopenharmony_ci#define SA1111_INTC		0x1600
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci/*
3448c2ecf20Sopenharmony_ci * These are offsets from the above base.
3458c2ecf20Sopenharmony_ci */
3468c2ecf20Sopenharmony_ci#define SA1111_INTTEST0		0x0000
3478c2ecf20Sopenharmony_ci#define SA1111_INTTEST1		0x0004
3488c2ecf20Sopenharmony_ci#define SA1111_INTEN0		0x0008
3498c2ecf20Sopenharmony_ci#define SA1111_INTEN1		0x000c
3508c2ecf20Sopenharmony_ci#define SA1111_INTPOL0		0x0010
3518c2ecf20Sopenharmony_ci#define SA1111_INTPOL1		0x0014
3528c2ecf20Sopenharmony_ci#define SA1111_INTTSTSEL	0x0018
3538c2ecf20Sopenharmony_ci#define SA1111_INTSTATCLR0	0x001c
3548c2ecf20Sopenharmony_ci#define SA1111_INTSTATCLR1	0x0020
3558c2ecf20Sopenharmony_ci#define SA1111_INTSET0		0x0024
3568c2ecf20Sopenharmony_ci#define SA1111_INTSET1		0x0028
3578c2ecf20Sopenharmony_ci#define SA1111_WAKEEN0		0x002c
3588c2ecf20Sopenharmony_ci#define SA1111_WAKEEN1		0x0030
3598c2ecf20Sopenharmony_ci#define SA1111_WAKEPOL0		0x0034
3608c2ecf20Sopenharmony_ci#define SA1111_WAKEPOL1		0x0038
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci/* PS/2 Trackpad and Mouse Interfaces */
3638c2ecf20Sopenharmony_ci#define SA1111_KBD		0x0a00
3648c2ecf20Sopenharmony_ci#define SA1111_MSE		0x0c00
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci/* PCMCIA Interface */
3678c2ecf20Sopenharmony_ci#define SA1111_PCMCIA		0x1600
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ciextern struct bus_type sa1111_bus_type;
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci#define SA1111_DEVID_SBI	(1 << 0)
3768c2ecf20Sopenharmony_ci#define SA1111_DEVID_SK		(1 << 1)
3778c2ecf20Sopenharmony_ci#define SA1111_DEVID_USB	(1 << 2)
3788c2ecf20Sopenharmony_ci#define SA1111_DEVID_SAC	(1 << 3)
3798c2ecf20Sopenharmony_ci#define SA1111_DEVID_SSP	(1 << 4)
3808c2ecf20Sopenharmony_ci#define SA1111_DEVID_PS2	(3 << 5)
3818c2ecf20Sopenharmony_ci#define SA1111_DEVID_PS2_KBD	(1 << 5)
3828c2ecf20Sopenharmony_ci#define SA1111_DEVID_PS2_MSE	(1 << 6)
3838c2ecf20Sopenharmony_ci#define SA1111_DEVID_GPIO	(1 << 7)
3848c2ecf20Sopenharmony_ci#define SA1111_DEVID_INT	(1 << 8)
3858c2ecf20Sopenharmony_ci#define SA1111_DEVID_PCMCIA	(1 << 9)
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_cistruct sa1111_dev {
3888c2ecf20Sopenharmony_ci	struct device	dev;
3898c2ecf20Sopenharmony_ci	unsigned int	devid;
3908c2ecf20Sopenharmony_ci	struct resource	res;
3918c2ecf20Sopenharmony_ci	void __iomem	*mapbase;
3928c2ecf20Sopenharmony_ci	unsigned int	skpcr_mask;
3938c2ecf20Sopenharmony_ci	unsigned int	hwirq[6];
3948c2ecf20Sopenharmony_ci	u64		dma_mask;
3958c2ecf20Sopenharmony_ci};
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci#define to_sa1111_device(x)	container_of(x, struct sa1111_dev, dev)
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci#define sa1111_get_drvdata(d)	dev_get_drvdata(&(d)->dev)
4008c2ecf20Sopenharmony_ci#define sa1111_set_drvdata(d,p)	dev_set_drvdata(&(d)->dev, p)
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_cistruct sa1111_driver {
4038c2ecf20Sopenharmony_ci	struct device_driver	drv;
4048c2ecf20Sopenharmony_ci	unsigned int		devid;
4058c2ecf20Sopenharmony_ci	int (*probe)(struct sa1111_dev *);
4068c2ecf20Sopenharmony_ci	int (*remove)(struct sa1111_dev *);
4078c2ecf20Sopenharmony_ci};
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci#define SA1111_DRV(_d)	container_of((_d), struct sa1111_driver, drv)
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci#define SA1111_DRIVER_NAME(_sadev) ((_sadev)->dev.driver->name)
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci/*
4148c2ecf20Sopenharmony_ci * These frob the SKPCR register, and call platform specific
4158c2ecf20Sopenharmony_ci * enable/disable functions.
4168c2ecf20Sopenharmony_ci */
4178c2ecf20Sopenharmony_ciint sa1111_enable_device(struct sa1111_dev *);
4188c2ecf20Sopenharmony_civoid sa1111_disable_device(struct sa1111_dev *);
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ciint sa1111_get_irq(struct sa1111_dev *, unsigned num);
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ciunsigned int sa1111_pll_clock(struct sa1111_dev *);
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci#define SA1111_AUDIO_ACLINK	0
4258c2ecf20Sopenharmony_ci#define SA1111_AUDIO_I2S	1
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_civoid sa1111_select_audio_mode(struct sa1111_dev *sadev, int mode);
4288c2ecf20Sopenharmony_ciint sa1111_set_audio_rate(struct sa1111_dev *sadev, int rate);
4298c2ecf20Sopenharmony_ciint sa1111_get_audio_rate(struct sa1111_dev *sadev);
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ciint sa1111_check_dma_bug(dma_addr_t addr);
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ciint sa1111_driver_register(struct sa1111_driver *);
4348c2ecf20Sopenharmony_civoid sa1111_driver_unregister(struct sa1111_driver *);
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_cistruct sa1111_platform_data {
4378c2ecf20Sopenharmony_ci	int	irq_base;	/* base for cascaded on-chip IRQs */
4388c2ecf20Sopenharmony_ci	unsigned disable_devs;
4398c2ecf20Sopenharmony_ci	void	*data;
4408c2ecf20Sopenharmony_ci	int	(*enable)(void *, unsigned);
4418c2ecf20Sopenharmony_ci	void	(*disable)(void *, unsigned);
4428c2ecf20Sopenharmony_ci};
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci#endif  /* _ASM_ARCH_SA1111 */
445