18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ep93xx/soc.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Open Kernel Labs <www.ok-labs.com> 68c2ecf20Sopenharmony_ci * Copyright (C) 2012 Ryan Mallon <rmallon@gmail.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _EP93XX_SOC_H 108c2ecf20Sopenharmony_ci#define _EP93XX_SOC_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <mach/ep93xx-regs.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* 158c2ecf20Sopenharmony_ci * EP93xx Physical Memory Map: 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * The ASDO pin is sampled at system reset to select a synchronous or 188c2ecf20Sopenharmony_ci * asynchronous boot configuration. When ASDO is "1" (i.e. pulled-up) 198c2ecf20Sopenharmony_ci * the synchronous boot mode is selected. When ASDO is "0" (i.e 208c2ecf20Sopenharmony_ci * pulled-down) the asynchronous boot mode is selected. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * In synchronous boot mode nSDCE3 is decoded starting at physical address 238c2ecf20Sopenharmony_ci * 0x00000000 and nCS0 is decoded starting at 0xf0000000. For asynchronous 248c2ecf20Sopenharmony_ci * boot mode they are swapped with nCS0 decoded at 0x00000000 ann nSDCE3 258c2ecf20Sopenharmony_ci * decoded at 0xf0000000. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * There is known errata for the EP93xx dealing with External Memory 288c2ecf20Sopenharmony_ci * Configurations. Please refer to "AN273: EP93xx Silicon Rev E Design 298c2ecf20Sopenharmony_ci * Guidelines" for more information. This document can be found at: 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * http://www.cirrus.com/en/pubs/appNote/AN273REV4.pdf 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define EP93XX_CS0_PHYS_BASE_ASYNC 0x00000000 /* ASDO Pin = 0 */ 358c2ecf20Sopenharmony_ci#define EP93XX_SDCE3_PHYS_BASE_SYNC 0x00000000 /* ASDO Pin = 1 */ 368c2ecf20Sopenharmony_ci#define EP93XX_CS1_PHYS_BASE 0x10000000 378c2ecf20Sopenharmony_ci#define EP93XX_CS2_PHYS_BASE 0x20000000 388c2ecf20Sopenharmony_ci#define EP93XX_CS3_PHYS_BASE 0x30000000 398c2ecf20Sopenharmony_ci#define EP93XX_PCMCIA_PHYS_BASE 0x40000000 408c2ecf20Sopenharmony_ci#define EP93XX_CS6_PHYS_BASE 0x60000000 418c2ecf20Sopenharmony_ci#define EP93XX_CS7_PHYS_BASE 0x70000000 428c2ecf20Sopenharmony_ci#define EP93XX_SDCE0_PHYS_BASE 0xc0000000 438c2ecf20Sopenharmony_ci#define EP93XX_SDCE1_PHYS_BASE 0xd0000000 448c2ecf20Sopenharmony_ci#define EP93XX_SDCE2_PHYS_BASE 0xe0000000 458c2ecf20Sopenharmony_ci#define EP93XX_SDCE3_PHYS_BASE_ASYNC 0xf0000000 /* ASDO Pin = 0 */ 468c2ecf20Sopenharmony_ci#define EP93XX_CS0_PHYS_BASE_SYNC 0xf0000000 /* ASDO Pin = 1 */ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* AHB peripherals */ 498c2ecf20Sopenharmony_ci#define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000) 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define EP93XX_ETHERNET_PHYS_BASE EP93XX_AHB_PHYS(0x00010000) 528c2ecf20Sopenharmony_ci#define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000) 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define EP93XX_USB_PHYS_BASE EP93XX_AHB_PHYS(0x00020000) 558c2ecf20Sopenharmony_ci#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define EP93XX_RASTER_PHYS_BASE EP93XX_AHB_PHYS(0x00030000) 588c2ecf20Sopenharmony_ci#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define EP93XX_SDRAM_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00060000) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define EP93XX_PCMCIA_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00080000) 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#define EP93XX_IDE_PHYS_BASE EP93XX_AHB_PHYS(0x000a0000) 698c2ecf20Sopenharmony_ci#define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000) 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define EP93XX_VIC2_BASE EP93XX_AHB_IOMEM(0x000c0000) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* APB peripherals */ 768c2ecf20Sopenharmony_ci#define EP93XX_TIMER_BASE EP93XX_APB_IOMEM(0x00010000) 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define EP93XX_I2S_PHYS_BASE EP93XX_APB_PHYS(0x00020000) 798c2ecf20Sopenharmony_ci#define EP93XX_I2S_BASE EP93XX_APB_IOMEM(0x00020000) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define EP93XX_SECURITY_BASE EP93XX_APB_IOMEM(0x00030000) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define EP93XX_AAC_PHYS_BASE EP93XX_APB_PHYS(0x00080000) 848c2ecf20Sopenharmony_ci#define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define EP93XX_SPI_PHYS_BASE EP93XX_APB_PHYS(0x000a0000) 878c2ecf20Sopenharmony_ci#define EP93XX_SPI_BASE EP93XX_APB_IOMEM(0x000a0000) 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define EP93XX_KEY_MATRIX_PHYS_BASE EP93XX_APB_PHYS(0x000f0000) 928c2ecf20Sopenharmony_ci#define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000) 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci#define EP93XX_ADC_PHYS_BASE EP93XX_APB_PHYS(0x00100000) 958c2ecf20Sopenharmony_ci#define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000) 968c2ecf20Sopenharmony_ci#define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000) 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci#define EP93XX_PWM_PHYS_BASE EP93XX_APB_PHYS(0x00110000) 998c2ecf20Sopenharmony_ci#define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000) 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define EP93XX_RTC_PHYS_BASE EP93XX_APB_PHYS(0x00120000) 1028c2ecf20Sopenharmony_ci#define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define EP93XX_WATCHDOG_PHYS_BASE EP93XX_APB_PHYS(0x00140000) 1058c2ecf20Sopenharmony_ci#define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* System controller */ 1088c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000) 1098c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_REG(x) (EP93XX_SYSCON_BASE + (x)) 1108c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_POWER_STATE EP93XX_SYSCON_REG(0x00) 1118c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT EP93XX_SYSCON_REG(0x04) 1128c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_FIR_EN (1<<31) 1138c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_UARTBAUD (1<<29) 1148c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_USH_EN (1<<28) 1158c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2M1 (1<<27) 1168c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2M0 (1<<26) 1178c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P8 (1<<25) 1188c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P9 (1<<24) 1198c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P6 (1<<23) 1208c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P7 (1<<22) 1218c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P4 (1<<21) 1228c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P5 (1<<20) 1238c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P2 (1<<19) 1248c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P3 (1<<18) 1258c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P0 (1<<17) 1268c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_PWRCNT_DMA_M2P1 (1<<16) 1278c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08) 1288c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c) 1298c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKSET1 EP93XX_SYSCON_REG(0x20) 1308c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKSET1_NBYP1 (1<<23) 1318c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKSET2 EP93XX_SYSCON_REG(0x24) 1328c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKSET2_NBYP2 (1<<19) 1338c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKSET2_PLL2_EN (1<<18) 1348c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG EP93XX_SYSCON_REG(0x80) 1358c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_SWRST (1<<31) 1368c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_D1ONG (1<<30) 1378c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_D0ONG (1<<29) 1388c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_IONU2 (1<<28) 1398c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_GONK (1<<27) 1408c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_TONG (1<<26) 1418c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_MONG (1<<25) 1428c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_U3EN (1<<24) 1438c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_CPENA (1<<23) 1448c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_A2ONG (1<<22) 1458c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_A1ONG (1<<21) 1468c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_U2EN (1<<20) 1478c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_EXVC (1<<19) 1488c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_U1EN (1<<18) 1498c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_TIN (1<<17) 1508c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_HC3IN (1<<15) 1518c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_HC3EN (1<<14) 1528c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_HC1IN (1<<13) 1538c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_HC1EN (1<<12) 1548c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_HONIDE (1<<11) 1558c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_GONIDE (1<<10) 1568c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_PONG (1<<9) 1578c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_EONIDE (1<<8) 1588c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_I2SONSSP (1<<7) 1598c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_I2SONAC97 (1<<6) 1608c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_RASONP3 (1<<4) 1618c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_RAS (1<<3) 1628c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_ADCPD (1<<2) 1638c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_KEYS (1<<1) 1648c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_DEVCFG_SHENA (1<<0) 1658c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_VIDCLKDIV EP93XX_SYSCON_REG(0x84) 1668c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKDIV_ENABLE (1<<15) 1678c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKDIV_ESEL (1<<14) 1688c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKDIV_PSEL (1<<13) 1698c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT 8 1708c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_I2SCLKDIV EP93XX_SYSCON_REG(0x8c) 1718c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_I2SCLKDIV_SENA (1<<31) 1728c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_I2SCLKDIV_ORIDE (1<<29) 1738c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_I2SCLKDIV_SPOL (1<<19) 1748c2ecf20Sopenharmony_ci#define EP93XX_I2SCLKDIV_SDIV (1 << 16) 1758c2ecf20Sopenharmony_ci#define EP93XX_I2SCLKDIV_LRDIV32 (0 << 17) 1768c2ecf20Sopenharmony_ci#define EP93XX_I2SCLKDIV_LRDIV64 (1 << 17) 1778c2ecf20Sopenharmony_ci#define EP93XX_I2SCLKDIV_LRDIV128 (2 << 17) 1788c2ecf20Sopenharmony_ci#define EP93XX_I2SCLKDIV_LRDIV_MASK (3 << 17) 1798c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90) 1808c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN (1<<31) 1818c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) 1828c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15) 1838c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0) 1848c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG EP93XX_SYSCON_REG(0x9c) 1858c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_REV_MASK (0xf0000000) 1868c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_REV_SHIFT (28) 1878c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_SBOOT (1<<8) 1888c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_LCSN7 (1<<7) 1898c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_LCSN6 (1<<6) 1908c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_LASDO (1<<5) 1918c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_LEEDA (1<<4) 1928c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_LEECLK (1<<3) 1938c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_LCSN2 (1<<1) 1948c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SYSCFG_LCSN1 (1<<0) 1958c2ecf20Sopenharmony_ci#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci/* EP93xx System Controller software locked register write */ 1988c2ecf20Sopenharmony_civoid ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg); 1998c2ecf20Sopenharmony_civoid ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits); 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_cistatic inline void ep93xx_devcfg_set_bits(unsigned int bits) 2028c2ecf20Sopenharmony_ci{ 2038c2ecf20Sopenharmony_ci ep93xx_devcfg_set_clear(bits, 0x00); 2048c2ecf20Sopenharmony_ci} 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_cistatic inline void ep93xx_devcfg_clear_bits(unsigned int bits) 2078c2ecf20Sopenharmony_ci{ 2088c2ecf20Sopenharmony_ci ep93xx_devcfg_set_clear(0x00, bits); 2098c2ecf20Sopenharmony_ci} 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci#endif /* _EP93XX_SOC_H */ 212