xref: /openbmc/linux/arch/arm/mach-ep93xx/soc.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2258249ecSRyan Mallon /*
3258249ecSRyan Mallon  * arch/arm/mach-ep93xx/soc.h
4258249ecSRyan Mallon  *
5258249ecSRyan Mallon  * Copyright (C) 2012 Open Kernel Labs <www.ok-labs.com>
6258249ecSRyan Mallon  * Copyright (C) 2012 Ryan Mallon <rmallon@gmail.com>
7258249ecSRyan Mallon  */
8258249ecSRyan Mallon 
9258249ecSRyan Mallon #ifndef _EP93XX_SOC_H
10258249ecSRyan Mallon #define _EP93XX_SOC_H
11258249ecSRyan Mallon 
12*4e5f36f8SArnd Bergmann #include "ep93xx-regs.h"
1336f1a4aeSArnd Bergmann #include "irqs.h"
14a6de3df4SRyan Mallon 
15258249ecSRyan Mallon /*
16258249ecSRyan Mallon  * EP93xx Physical Memory Map:
17258249ecSRyan Mallon  *
18258249ecSRyan Mallon  * The ASDO pin is sampled at system reset to select a synchronous or
19258249ecSRyan Mallon  * asynchronous boot configuration.  When ASDO is "1" (i.e. pulled-up)
20258249ecSRyan Mallon  * the synchronous boot mode is selected.  When ASDO is "0" (i.e
21258249ecSRyan Mallon  * pulled-down) the asynchronous boot mode is selected.
22258249ecSRyan Mallon  *
23258249ecSRyan Mallon  * In synchronous boot mode nSDCE3 is decoded starting at physical address
24258249ecSRyan Mallon  * 0x00000000 and nCS0 is decoded starting at 0xf0000000.  For asynchronous
25258249ecSRyan Mallon  * boot mode they are swapped with nCS0 decoded at 0x00000000 ann nSDCE3
26258249ecSRyan Mallon  * decoded at 0xf0000000.
27258249ecSRyan Mallon  *
28258249ecSRyan Mallon  * There is known errata for the EP93xx dealing with External Memory
29258249ecSRyan Mallon  * Configurations.  Please refer to "AN273: EP93xx Silicon Rev E Design
30258249ecSRyan Mallon  * Guidelines" for more information.  This document can be found at:
31258249ecSRyan Mallon  *
32258249ecSRyan Mallon  *	http://www.cirrus.com/en/pubs/appNote/AN273REV4.pdf
33258249ecSRyan Mallon  */
34258249ecSRyan Mallon 
35258249ecSRyan Mallon #define EP93XX_CS0_PHYS_BASE_ASYNC	0x00000000	/* ASDO Pin = 0 */
36258249ecSRyan Mallon #define EP93XX_SDCE3_PHYS_BASE_SYNC	0x00000000	/* ASDO Pin = 1 */
37258249ecSRyan Mallon #define EP93XX_CS1_PHYS_BASE		0x10000000
38258249ecSRyan Mallon #define EP93XX_CS2_PHYS_BASE		0x20000000
39258249ecSRyan Mallon #define EP93XX_CS3_PHYS_BASE		0x30000000
40258249ecSRyan Mallon #define EP93XX_PCMCIA_PHYS_BASE		0x40000000
41258249ecSRyan Mallon #define EP93XX_CS6_PHYS_BASE		0x60000000
42258249ecSRyan Mallon #define EP93XX_CS7_PHYS_BASE		0x70000000
43258249ecSRyan Mallon #define EP93XX_SDCE0_PHYS_BASE		0xc0000000
44258249ecSRyan Mallon #define EP93XX_SDCE1_PHYS_BASE		0xd0000000
45258249ecSRyan Mallon #define EP93XX_SDCE2_PHYS_BASE		0xe0000000
46258249ecSRyan Mallon #define EP93XX_SDCE3_PHYS_BASE_ASYNC	0xf0000000	/* ASDO Pin = 0 */
47258249ecSRyan Mallon #define EP93XX_CS0_PHYS_BASE_SYNC	0xf0000000	/* ASDO Pin = 1 */
48258249ecSRyan Mallon 
49a05baf33SRyan Mallon /* AHB peripherals */
50a05baf33SRyan Mallon #define EP93XX_DMA_BASE			EP93XX_AHB_IOMEM(0x00000000)
51a05baf33SRyan Mallon 
52a05baf33SRyan Mallon #define EP93XX_ETHERNET_PHYS_BASE	EP93XX_AHB_PHYS(0x00010000)
53a05baf33SRyan Mallon #define EP93XX_ETHERNET_BASE		EP93XX_AHB_IOMEM(0x00010000)
54a05baf33SRyan Mallon 
55a05baf33SRyan Mallon #define EP93XX_USB_PHYS_BASE		EP93XX_AHB_PHYS(0x00020000)
56a05baf33SRyan Mallon #define EP93XX_USB_BASE			EP93XX_AHB_IOMEM(0x00020000)
57a05baf33SRyan Mallon 
58a05baf33SRyan Mallon #define EP93XX_RASTER_PHYS_BASE		EP93XX_AHB_PHYS(0x00030000)
59a05baf33SRyan Mallon #define EP93XX_RASTER_BASE		EP93XX_AHB_IOMEM(0x00030000)
60a05baf33SRyan Mallon 
61a05baf33SRyan Mallon #define EP93XX_GRAPHICS_ACCEL_BASE	EP93XX_AHB_IOMEM(0x00040000)
62a05baf33SRyan Mallon 
63a05baf33SRyan Mallon #define EP93XX_SDRAM_CONTROLLER_BASE	EP93XX_AHB_IOMEM(0x00060000)
64a05baf33SRyan Mallon 
65a05baf33SRyan Mallon #define EP93XX_PCMCIA_CONTROLLER_BASE	EP93XX_AHB_IOMEM(0x00080000)
66a05baf33SRyan Mallon 
67a05baf33SRyan Mallon #define EP93XX_BOOT_ROM_BASE		EP93XX_AHB_IOMEM(0x00090000)
68a05baf33SRyan Mallon 
69eb774a09SRafal Prylowski #define EP93XX_IDE_PHYS_BASE		EP93XX_AHB_PHYS(0x000a0000)
70a05baf33SRyan Mallon #define EP93XX_IDE_BASE			EP93XX_AHB_IOMEM(0x000a0000)
71a05baf33SRyan Mallon 
72a05baf33SRyan Mallon #define EP93XX_VIC1_BASE		EP93XX_AHB_IOMEM(0x000b0000)
73a05baf33SRyan Mallon 
74a05baf33SRyan Mallon #define EP93XX_VIC2_BASE		EP93XX_AHB_IOMEM(0x000c0000)
75a05baf33SRyan Mallon 
76a05baf33SRyan Mallon /* APB peripherals */
77a05baf33SRyan Mallon #define EP93XX_TIMER_BASE		EP93XX_APB_IOMEM(0x00010000)
78a05baf33SRyan Mallon 
79a05baf33SRyan Mallon #define EP93XX_I2S_PHYS_BASE		EP93XX_APB_PHYS(0x00020000)
80a05baf33SRyan Mallon #define EP93XX_I2S_BASE			EP93XX_APB_IOMEM(0x00020000)
81a05baf33SRyan Mallon 
82a05baf33SRyan Mallon #define EP93XX_SECURITY_BASE		EP93XX_APB_IOMEM(0x00030000)
83a05baf33SRyan Mallon 
84a05baf33SRyan Mallon #define EP93XX_AAC_PHYS_BASE		EP93XX_APB_PHYS(0x00080000)
85a05baf33SRyan Mallon #define EP93XX_AAC_BASE			EP93XX_APB_IOMEM(0x00080000)
86a05baf33SRyan Mallon 
87a05baf33SRyan Mallon #define EP93XX_SPI_PHYS_BASE		EP93XX_APB_PHYS(0x000a0000)
88a05baf33SRyan Mallon #define EP93XX_SPI_BASE			EP93XX_APB_IOMEM(0x000a0000)
89a05baf33SRyan Mallon 
90a05baf33SRyan Mallon #define EP93XX_IRDA_BASE		EP93XX_APB_IOMEM(0x000b0000)
91a05baf33SRyan Mallon 
92a05baf33SRyan Mallon #define EP93XX_KEY_MATRIX_PHYS_BASE	EP93XX_APB_PHYS(0x000f0000)
93a05baf33SRyan Mallon #define EP93XX_KEY_MATRIX_BASE		EP93XX_APB_IOMEM(0x000f0000)
94a05baf33SRyan Mallon 
955364c647SAlexander Sverdlin #define EP93XX_ADC_PHYS_BASE		EP93XX_APB_PHYS(0x00100000)
96a05baf33SRyan Mallon #define EP93XX_ADC_BASE			EP93XX_APB_IOMEM(0x00100000)
97a05baf33SRyan Mallon #define EP93XX_TOUCHSCREEN_BASE		EP93XX_APB_IOMEM(0x00100000)
98a05baf33SRyan Mallon 
99a05baf33SRyan Mallon #define EP93XX_PWM_PHYS_BASE		EP93XX_APB_PHYS(0x00110000)
100a05baf33SRyan Mallon #define EP93XX_PWM_BASE			EP93XX_APB_IOMEM(0x00110000)
101a05baf33SRyan Mallon 
102a05baf33SRyan Mallon #define EP93XX_RTC_PHYS_BASE		EP93XX_APB_PHYS(0x00120000)
103a05baf33SRyan Mallon #define EP93XX_RTC_BASE			EP93XX_APB_IOMEM(0x00120000)
104a05baf33SRyan Mallon 
105a05baf33SRyan Mallon #define EP93XX_WATCHDOG_PHYS_BASE	EP93XX_APB_PHYS(0x00140000)
106a05baf33SRyan Mallon #define EP93XX_WATCHDOG_BASE		EP93XX_APB_IOMEM(0x00140000)
107a05baf33SRyan Mallon 
1089aeec63eSRyan Mallon /* System controller */
1099aeec63eSRyan Mallon #define EP93XX_SYSCON_BASE		EP93XX_APB_IOMEM(0x00130000)
1109aeec63eSRyan Mallon #define EP93XX_SYSCON_REG(x)		(EP93XX_SYSCON_BASE + (x))
1119aeec63eSRyan Mallon #define EP93XX_SYSCON_POWER_STATE	EP93XX_SYSCON_REG(0x00)
1129aeec63eSRyan Mallon #define EP93XX_SYSCON_PWRCNT		EP93XX_SYSCON_REG(0x04)
1139aeec63eSRyan Mallon #define EP93XX_SYSCON_PWRCNT_FIR_EN	(1<<31)
1149aeec63eSRyan Mallon #define EP93XX_SYSCON_PWRCNT_UARTBAUD	(1<<29)
1159645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_USH_EN	28
1169645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2M1	27
1179645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2M0	26
1189645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P8	25
1199645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P9	24
1209645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P6	23
1219645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P7	22
1229645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P4	21
1239645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P5	20
1249645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P2	19
1259645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P3	18
1269645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P0	17
1279645ccc7SNikita Shubin #define EP93XX_SYSCON_PWRCNT_DMA_M2P1	16
1289aeec63eSRyan Mallon #define EP93XX_SYSCON_HALT		EP93XX_SYSCON_REG(0x08)
1299aeec63eSRyan Mallon #define EP93XX_SYSCON_STANDBY		EP93XX_SYSCON_REG(0x0c)
1309aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKSET1		EP93XX_SYSCON_REG(0x20)
1319aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKSET1_NBYP1	(1<<23)
1329aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKSET2		EP93XX_SYSCON_REG(0x24)
1339aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKSET2_NBYP2	(1<<19)
1349aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKSET2_PLL2_EN	(1<<18)
1359aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG		EP93XX_SYSCON_REG(0x80)
1369aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_SWRST	(1<<31)
1379aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_D1ONG	(1<<30)
1389aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_D0ONG	(1<<29)
1399aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_IONU2	(1<<28)
1409aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_GONK	(1<<27)
1419aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_TONG	(1<<26)
1429aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_MONG	(1<<25)
1439645ccc7SNikita Shubin #define EP93XX_SYSCON_DEVCFG_U3EN	24
1449aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_CPENA	(1<<23)
1459aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_A2ONG	(1<<22)
1469aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_A1ONG	(1<<21)
1479645ccc7SNikita Shubin #define EP93XX_SYSCON_DEVCFG_U2EN	20
1489aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_EXVC	(1<<19)
1499645ccc7SNikita Shubin #define EP93XX_SYSCON_DEVCFG_U1EN	18
1509aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_TIN	(1<<17)
1519aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_HC3IN	(1<<15)
1529aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_HC3EN	(1<<14)
1539aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_HC1IN	(1<<13)
1549aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_HC1EN	(1<<12)
1559aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_HONIDE	(1<<11)
1569aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_GONIDE	(1<<10)
1579aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_PONG	(1<<9)
1589aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_EONIDE	(1<<8)
1599aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_I2SONSSP	(1<<7)
1609aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_I2SONAC97	(1<<6)
1619aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_RASONP3	(1<<4)
1629aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_RAS	(1<<3)
1639aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_ADCPD	(1<<2)
1649aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_KEYS	(1<<1)
1659aeec63eSRyan Mallon #define EP93XX_SYSCON_DEVCFG_SHENA	(1<<0)
1669aeec63eSRyan Mallon #define EP93XX_SYSCON_VIDCLKDIV		EP93XX_SYSCON_REG(0x84)
1679645ccc7SNikita Shubin #define EP93XX_SYSCON_CLKDIV_ENABLE	15
1689aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKDIV_ESEL	(1<<14)
1699aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKDIV_PSEL	(1<<13)
1709aeec63eSRyan Mallon #define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT	8
1719aeec63eSRyan Mallon #define EP93XX_SYSCON_I2SCLKDIV		EP93XX_SYSCON_REG(0x8c)
1729645ccc7SNikita Shubin #define EP93XX_SYSCON_I2SCLKDIV_SENA	31
1739aeec63eSRyan Mallon #define EP93XX_SYSCON_I2SCLKDIV_ORIDE   (1<<29)
1749aeec63eSRyan Mallon #define EP93XX_SYSCON_I2SCLKDIV_SPOL	(1<<19)
1759aeec63eSRyan Mallon #define EP93XX_I2SCLKDIV_SDIV		(1 << 16)
1769aeec63eSRyan Mallon #define EP93XX_I2SCLKDIV_LRDIV32	(0 << 17)
1779aeec63eSRyan Mallon #define EP93XX_I2SCLKDIV_LRDIV64	(1 << 17)
1789aeec63eSRyan Mallon #define EP93XX_I2SCLKDIV_LRDIV128	(2 << 17)
1799aeec63eSRyan Mallon #define EP93XX_I2SCLKDIV_LRDIV_MASK	(3 << 17)
1809aeec63eSRyan Mallon #define EP93XX_SYSCON_KEYTCHCLKDIV	EP93XX_SYSCON_REG(0x90)
1819645ccc7SNikita Shubin #define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN	31
1829645ccc7SNikita Shubin #define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV	16
1839645ccc7SNikita Shubin #define EP93XX_SYSCON_KEYTCHCLKDIV_KEN	15
1849aeec63eSRyan Mallon #define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV	(1<<0)
1859aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG		EP93XX_SYSCON_REG(0x9c)
1869aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_REV_MASK	(0xf0000000)
1879aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_REV_SHIFT	(28)
1889aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_SBOOT	(1<<8)
1899aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_LCSN7	(1<<7)
1909aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_LCSN6	(1<<6)
1919aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_LASDO	(1<<5)
1929aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_LEEDA	(1<<4)
1939aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_LEECLK	(1<<3)
1949aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_LCSN2	(1<<1)
1959aeec63eSRyan Mallon #define EP93XX_SYSCON_SYSCFG_LCSN1	(1<<0)
1969aeec63eSRyan Mallon #define EP93XX_SYSCON_SWLOCK		EP93XX_SYSCON_REG(0xc0)
1979aeec63eSRyan Mallon 
198999c53fbSRyan Mallon /* EP93xx System Controller software locked register write */
199999c53fbSRyan Mallon void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg);
200999c53fbSRyan Mallon void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits);
201999c53fbSRyan Mallon 
ep93xx_devcfg_set_bits(unsigned int bits)202999c53fbSRyan Mallon static inline void ep93xx_devcfg_set_bits(unsigned int bits)
203999c53fbSRyan Mallon {
204999c53fbSRyan Mallon 	ep93xx_devcfg_set_clear(bits, 0x00);
205999c53fbSRyan Mallon }
206999c53fbSRyan Mallon 
ep93xx_devcfg_clear_bits(unsigned int bits)207999c53fbSRyan Mallon static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
208999c53fbSRyan Mallon {
209999c53fbSRyan Mallon 	ep93xx_devcfg_set_clear(0x00, bits);
210999c53fbSRyan Mallon }
211999c53fbSRyan Mallon 
212258249ecSRyan Mallon #endif /* _EP93XX_SOC_H */
213