Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/soc/pinmux.h
1476 views
1
/*
2
* Copyright (c) 2018 naehrwert
3
* Copyright (c) 2018-2024 CTCaer
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms and conditions of the GNU General Public License,
7
* version 2, as published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef _PINMUX_H_
19
#define _PINMUX_H_
20
21
#include <utils/types.h>
22
23
/*! APB MISC registers. */
24
#define APB_MISC_GP_SDMMC1_CLK_LPBK_CONTROL 0x8D4
25
#define APB_MISC_GP_SDMMC3_CLK_LPBK_CONTROL 0x8D8
26
#define APB_MISC_GP_SDMMC1_PAD_CFGPADCTRL 0xA98
27
#define APB_MISC_GP_VGPIO_GPIO_MUX_SEL 0xB74
28
29
/*! Pinmux registers. */
30
#define PINMUX_AUX_SDMMC1_CLK 0x00
31
#define PINMUX_AUX_SDMMC1_CMD 0x04
32
#define PINMUX_AUX_SDMMC1_DAT3 0x08
33
#define PINMUX_AUX_SDMMC1_DAT2 0x0C
34
#define PINMUX_AUX_SDMMC1_DAT1 0x10
35
#define PINMUX_AUX_SDMMC1_DAT0 0x14
36
#define PINMUX_AUX_SDMMC3_CLK 0x1C
37
#define PINMUX_AUX_SDMMC3_CMD 0x20
38
#define PINMUX_AUX_SDMMC3_DAT0 0x24
39
#define PINMUX_AUX_SDMMC3_DAT1 0x28
40
#define PINMUX_AUX_SDMMC3_DAT2 0x2C
41
#define PINMUX_AUX_SDMMC3_DAT3 0x30
42
#define PINMUX_AUX_SATA_LED_ACTIVE 0x4C
43
#define PINMUX_AUX_GPIO_PA5_T210B01 PINMUX_AUX_SATA_LED_ACTIVE
44
#define PINMUX_AUX_DMIC3_CLK 0xB4
45
#define PINMUX_AUX_DMIC3_DAT 0xB8
46
#define PINMUX_AUX_CAM_I2C_SCL 0xD4
47
#define PINMUX_AUX_CAM_I2C_SDA 0xD8
48
#define PINMUX_AUX_UART2_TX 0xF4
49
#define PINMUX_AUX_UART3_TX 0x104
50
#define PINMUX_AUX_DAP4_DIN 0x148
51
#define PINMUX_AUX_DAP4_DOUT 0x14C
52
#define PINMUX_AUX_DAP4_SCLK 0x150
53
#define PINMUX_AUX_CLK_32K_OUT 0x164
54
#define PINMUX_AUX_AUD_MCLK 0x180
55
#define PINMUX_AUX_GPIO_X1_AUD 0x18C
56
#define PINMUX_AUX_GPIO_X3_AUD 0x190
57
#define PINMUX_AUX_SPDIF_IN 0x1A4
58
#define PINMUX_AUX_USB_VBUS_EN0 0x1A8
59
#define PINMUX_AUX_USB_VBUS_EN1 0x1AC
60
#define PINMUX_AUX_WIFI_EN 0x1B4
61
#define PINMUX_AUX_WIFI_RST 0x1B8
62
#define PINMUX_AUX_AP_WAKE_NFC 0x1CC
63
#define PINMUX_AUX_NFC_EN 0x1D0
64
#define PINMUX_AUX_NFC_INT 0x1D4
65
#define PINMUX_AUX_CAM_RST 0x1E0
66
#define PINMUX_AUX_CAM1_PWDN 0x1EC
67
#define PINMUX_AUX_CAM2_PWDN 0x1F0
68
#define PINMUX_AUX_CAM1_STROBE 0x1F4
69
#define PINMUX_AUX_LCD_BL_PWM 0x1FC
70
#define PINMUX_AUX_LCD_BL_EN 0x200
71
#define PINMUX_AUX_LCD_RST 0x204
72
#define PINMUX_AUX_LCD_GPIO1 0x208
73
#define PINMUX_AUX_LCD_GPIO2 0x20C
74
#define PINMUX_AUX_TOUCH_RST 0x214
75
#define PINMUX_AUX_TOUCH_CLK 0x218
76
#define PINMUX_AUX_TOUCH_INT 0x220
77
#define PINMUX_AUX_MOTION_INT 0x224
78
#define PINMUX_AUX_ALS_PROX_INT 0x228
79
#define PINMUX_AUX_BUTTON_POWER_ON 0x230
80
#define PINMUX_AUX_BUTTON_HOME 0x240
81
#define PINMUX_AUX_GPIO_PE6 0x248
82
#define PINMUX_AUX_GPIO_PE7 0x24C
83
#define PINMUX_AUX_GPIO_PH6 0x250
84
#define PINMUX_AUX_GPIO_PK3 0x260
85
#define PINMUX_AUX_GPIO_PK7 0x270
86
#define PINMUX_AUX_GPIO_PZ1 0x280
87
#define PINMUX_AUX_GPIO_PZ4 0x28C
88
/* Only in T210B01 */
89
#define PINMUX_AUX_SDMMC2_DAT0 0x294
90
#define PINMUX_AUX_SDMMC2_DAT1 0x298
91
#define PINMUX_AUX_SDMMC2_DAT2 0x29C
92
#define PINMUX_AUX_SDMMC2_DAT3 0x2A0
93
#define PINMUX_AUX_SDMMC2_DAT4 0x2A4
94
#define PINMUX_AUX_SDMMC2_DAT5 0x2A8
95
#define PINMUX_AUX_SDMMC2_DAT6 0x2AC
96
#define PINMUX_AUX_SDMMC2_DAT7 0x2B0
97
#define PINMUX_AUX_SDMMC2_CLK 0x2B4
98
#define PINMUX_AUX_SDMMC2_CMD 0x2BC
99
100
/*! 0:UART-A, 1:UART-B, 3:UART-C, 3:UART-D */
101
#define PINMUX_AUX_UARTX_TX(x) (0xE4 + 0x10 * (x))
102
#define PINMUX_AUX_UARTX_RX(x) (0xE8 + 0x10 * (x))
103
#define PINMUX_AUX_UARTX_RTS(x) (0xEC + 0x10 * (x))
104
#define PINMUX_AUX_UARTX_CTS(x) (0xF0 + 0x10 * (x))
105
/*! 0:GEN1, 1:GEN2, 2:GEN3, 3:CAM, 4:PWR */
106
#define PINMUX_AUX_X_I2C_SCL(x) (0xBC + 8 * (x))
107
#define PINMUX_AUX_X_I2C_SDA(x) (0xC0 + 8 * (x))
108
/*! 0:I2S1, 1:I2S2 */
109
#define PINMUX_AUX_X_I2S_LRCK(x) (0x124 + 0x10 * (x))
110
#define PINMUX_AUX_X_I2C_DIN(x) (0x128 + 0x10 * (x))
111
#define PINMUX_AUX_X_I2C_DOUT(x) (0x12c + 0x10 * (x))
112
#define PINMUX_AUX_X_I2C_BCLK(x) (0x130 + 0x10 * (x))
113
114
#define PINMUX_FUNC_MASK (3 << 0)
115
116
#define PINMUX_PULL_MASK (3 << 2)
117
#define PINMUX_PULL_NONE (0 << 2)
118
#define PINMUX_PULL_DOWN (1 << 2)
119
#define PINMUX_PULL_UP (2 << 2)
120
121
#define PINMUX_TRISTATE BIT(4)
122
#define PINMUX_PARKED BIT(5)
123
#define PINMUX_INPUT_ENABLE BIT(6)
124
#define PINMUX_LOCK BIT(7)
125
#define PINMUX_LPDR BIT(8)
126
#define PINMUX_HSM BIT(9)
127
128
#define PINMUX_IO_HV BIT(10)
129
#define PINMUX_OPEN_DRAIN BIT(11)
130
#define PINMUX_SCHMT BIT(12)
131
132
#define PINMUX_DRIVE_MASK (3 << 13)
133
#define PINMUX_DRIVE_1X (0 << 13)
134
#define PINMUX_DRIVE_2X (1 << 13)
135
#define PINMUX_DRIVE_3X (2 << 13)
136
#define PINMUX_DRIVE_4X (3 << 13)
137
138
#define PINMUX_PREEMP BIT(15)
139
140
void pinmux_config_uart(u32 idx);
141
void pinmux_config_i2c(u32 idx);
142
void pinmux_config_i2s(u32 idx);
143
144
#endif
145
146