coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
iomap.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 
3 #ifndef __SOC_QUALCOMM_IPQ40XX_IOMAP_H_
4 #define __SOC_QUALCOMM_IPQ40XX_IOMAP_H_
5 
6 #include <device/mmio.h>
7 #include <soc/cdp.h>
8 #include <soc/blsp.h>
9 
10 /* Typecast to allow integers being passed as address
11  This needs to be included because vendor code is not compliant with our
12  macros for read/write. Hence, special macros for readl_i and writel_i are
13  included to do this in one place for all occurrences in vendor code
14  */
15 #define readl_i(a) read32((const void *)(a))
16 #define writel_i(v,a) write32((void *)a, v)
17 #define clrsetbits32_i(addr, clear, set) \
18  clrsetbits32(((void *)(addr)), (clear), (set))
19 
20 #define GCC_CLK_CTL_REG ((void *)0x01800000u)
21 #define MSM_CLK_CTL_BASE GCC_CLK_CTL_REG
22 #define GCC_CLK_BRANCH_ENA (GCC_CLK_CTL_REG + 0x6000)
23 #define IMEM_AXI (1 << 17)
24 #define SYS_NOC_APSS_AHB (1 << 16)
25 #define BIMC_AXI_M0 (1 << 15)
26 #define APSS_AHB (1 << 14)
27 #define APSS_AXI (1 << 13)
28 #define MPM_AHB (1 << 12)
29 #define GMEM_SYS_NOC_AXI (1 << 11)
30 #define BLSP1_AHB (1 << 10)
31 #define BLSP1_SLEEP (1 << 9)
32 #define PRNG_AHB (1 << 8)
33 #define BOOT_ROM_AHB (1 << 7)
34 #define MSG_RAM_AHB (1 << 6)
35 #define TLMM_AHB (1 << 5)
36 #define TLMM (1 << 4)
37 #define SPMI_PCNOC_AHB (1 << 3)
38 #define CRYPTO (1 << 2)
39 #define CRYPTO_AXI (1 << 1)
40 #define CRYPTO_AHB (1 << 0)
41 
42 #define GCC_BLSP1_QUP1_I2C_APPS_CBCR (MSM_CLK_CTL_BASE + 0x2008)
43 #define GCC_BLSP1_QUP1_I2C_APPS_CMD_RCGR (MSM_CLK_CTL_BASE + 0x200c)
44 #define GCC_BLSP1_QUP1_I2C_APPS_CFG_RCGR (MSM_CLK_CTL_BASE + 0x2010)
45 #define GCC_BLSP1_QUP2_I2C_APPS_CBCR (MSM_CLK_CTL_BASE + 0x3010)
46 #define GCC_BLSP1_QUP2_I2C_APPS_CMD_RCGR (MSM_CLK_CTL_BASE + 0x3000)
47 #define GCC_BLSP1_QUP2_I2C_APPS_CFG_RCGR (MSM_CLK_CTL_BASE + 0x3004)
48 
49 #define GCNT_GLOBAL_CTRL_BASE ((void *)0x004a0000u)
50 #define GCNT_CNTCR (GCNT_GLOBAL_CTRL_BASE + 0x1000)
51 #define GCNT_GLB_CNTCV_LO (GCNT_GLOBAL_CTRL_BASE + 0x1008)
52 #define GCNT_GLB_CNTCV_HI (GCNT_GLOBAL_CTRL_BASE + 0x100c)
53 #define GCNT_CNTCV_LO (GCNT_GLOBAL_CTRL_BASE + 0x2000)
54 #define GCNT_CNTCV_HI (GCNT_GLOBAL_CTRL_BASE + 0x2004)
55 
56 #define GCNT_PSHOLD ((void *)0x004AB000u)
57 
58 /* RPM interface constants */
59 #define RPM_INT ((void *)0x63020)
60 #define RPM_INT_ACK ((void *)0x63060)
61 #define RPM_SIGNAL_COOKIE ((void *)0x47C20)
62 #define RPM_SIGNAL_ENTRY ((void *)0x47C24)
63 #define RPM_FW_MAGIC_NUM 0x4D505242
64 
65 #define TLMM_BASE_ADDR ((void *)0x01000000)
66 #define GPIO_CONFIG_ADDR(x) (TLMM_BASE_ADDR + 0x1000 * (x))
67 #define GPIO_IN_OUT_ADDR(x) (GPIO_CONFIG_ADDR(x) + 4)
68 
69 /* Yes, this is not a typo... host2 is actually mapped before host1. */
70 #define USB_HOST2_XHCI_BASE 0x10000000
71 #define USB_HOST2_DWC3_BASE 0x1000C100
72 #define USB_HOST2_PHY_BASE 0x100F8800
73 #define USB_HOST1_XHCI_BASE 0x11000000
74 #define USB_HOST1_DWC3_BASE 0x1100C100
75 #define USB_HOST1_PHY_BASE 0x110F8800
76 
77 #define UART1_DM_BASE ((void *)0x078af000)
78 #define UART2_DM_BASE ((void *)0x078b0000)
79 
80 enum {
83 };
84 
85 #define GCC_BLSP1_UART_BCR_BASE (GCC_CLK_CTL_REG + 0x2038)
86 #define GCC_BLSP1_UART_BCR(x) (GCC_BLSP1_UART_BCR_BASE + (x) * 0xff0)
87 #define GCC_BLSP1_UART_APPS_CBCR(x) (GCC_BLSP1_UART_BCR(x) + 4)
88 #define GCC_BLSP1_UART_APPS_CMD_RCGR(x) (GCC_BLSP1_UART_APPS_CBCR(x) + 8)
89 #define GCC_BLSP1_UART_APPS_CFG_RCGR(x) (GCC_BLSP1_UART_APPS_CMD_RCGR(x) + 4)
90 #define GCC_BLSP1_UART_APPS_M(x) (GCC_BLSP1_UART_APPS_CFG_RCGR(x) + 4)
91 #define GCC_BLSP1_UART_APPS_N(x) (GCC_BLSP1_UART_APPS_M(x) + 4)
92 #define GCC_BLSP1_UART_APPS_D(x) (GCC_BLSP1_UART_APPS_N(x) + 4)
93 #define GCC_BLSP1_UART_MISC(x) (GCC_BLSP1_UART_APPS_D(x) + 4)
94 
95 #define BLSP1_QUP0_BASE ((void *)0x078B5000)
96 #define BLSP1_QUP1_BASE ((void *)0x078B6000)
97 #define BLSP1_QUP2_BASE ((void *)0x078B7000)
98 #define BLSP1_QUP3_BASE ((void *)0x078B8000)
99 
100 #define TCSR_BOOT_MISC_DETECT ((void *)0x0193D100)
101 #define TCSR_RESET_DEBUG_SW_ENTRY ((void *)0x01940000)
102 
103 static inline void *blsp_qup_base(blsp_qup_id_t id)
104 {
105  switch (id) {
106  case BLSP_QUP_ID_0: return BLSP1_QUP0_BASE;
107  case BLSP_QUP_ID_1: return BLSP1_QUP1_BASE;
108  case BLSP_QUP_ID_2: return BLSP1_QUP2_BASE;
109  case BLSP_QUP_ID_3: return BLSP1_QUP3_BASE;
110  }
111  return NULL;
112 }
113 
114 #define BLSP_MINI_CORE_SHIFT 8
115 #define BLSP_MINI_CORE_I2C (0x2u << BLSP_MINI_CORE_SHIFT)
116 #define BLSP_MINI_CORE_MASK (0xfu << BLSP_MINI_CORE_SHIFT)
117 
118 #define ETIMEDOUT -10
119 #define EINVAL -11
120 #define EIO -12
121 
122 #endif // __SOC_QUALCOMM_IPQ40XX_IOMAP_H_
blsp_qup_id_t
Definition: blsp.h:6
@ BLSP_QUP_ID_1
Definition: blsp.h:8
@ BLSP_QUP_ID_3
Definition: blsp.h:10
@ BLSP_QUP_ID_0
Definition: blsp.h:7
@ BLSP_QUP_ID_2
Definition: blsp.h:9
@ BLSP1_UART1
Definition: iomap.h:81
@ BLSP1_UART2
Definition: iomap.h:82
#define BLSP1_QUP3_BASE
Definition: iomap.h:98
#define BLSP1_QUP2_BASE
Definition: iomap.h:97
#define BLSP1_QUP0_BASE
Definition: iomap.h:95
static void * blsp_qup_base(blsp_qup_id_t id)
Definition: iomap.h:103
#define BLSP1_QUP1_BASE
Definition: iomap.h:96
#define NULL
Definition: stddef.h:19