Skip to content

Commit c6e9a39

Browse files
committed
arm64/am62x: Add TISCI client, GPIO and I2C drivers
On K3 SoCs the A53 cluster does not own device power, clocks, resets or interrupt routing; these are managed by the DM/TIFS firmware and requested over TISCI through the secure-proxy mailbox. Add: - a TISCI client (secure-proxy transport plus device/clock/reset helpers) - a GPIO driver for banks 0/1 with pad mux and TISCI power-on - an OMAP-I2C driver for the main-domain I2C controllers and wire them into the PocketBeagle2 and BeaglePlay bring-up. Tested on PocketBeagle2 (SYSFW 11.2.5) with the TechLab cape attached: nsh> i2c bus nsh> i2c dev -b 0 0x03 0x77 # I2C0 detects onboard 0x20 and 0x50 nsh> gpio -o 1 /dev/gpio3 # drives a user LED; read back with: nsh> gpio /dev/gpio3 Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
1 parent bc3a259 commit c6e9a39

25 files changed

Lines changed: 2838 additions & 39 deletions

arch/arm64/include/am62x/irq.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,16 @@
102102
#define AM62X_IRQ_UART5 215 /* GIC_SPI 183 */
103103
#define AM62X_IRQ_UART6 216 /* GIC_SPI 184 */
104104

105+
/* GPIO */
106+
107+
#define AM62X_IRQ_GPIO0 57
108+
#define AM62X_IRQ_GPIO1 58
109+
110+
/* I2C */
111+
112+
#define AM62X_IRQ_I2C0 193 /* GIC_SPI 161 */
113+
#define AM62X_IRQ_I2C1 194 /* GIC_SPI 162 */
114+
#define AM62X_IRQ_I2C2 195 /* GIC_SPI 163 */
115+
#define AM62X_IRQ_I2C3 196 /* GIC_SPI 164 */
116+
105117
#endif /* __ARCH_ARM64_INCLUDE_AM62X_IRQ_H */

arch/arm64/src/am62x/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222

2323
# AM62x SoC sources that are always compiled
2424

25-
list(APPEND SRCS am62x_boot.c am62x_16550serial.c)
25+
list(APPEND SRCS am62x_boot.c am62x_16550serial.c am62x_gpio.c am62x_i2c.c)
26+
27+
if(CONFIG_AM62X_TISCI)
28+
list(APPEND SRCS am62x_tisci.c)
29+
endif()
30+
2631

2732
# Early UART assembly (needed for CONFIG_ARCH_EARLY_PRINT / semihosting console
2833
# before the full serial driver is up)

arch/arm64/src/am62x/Kconfig

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,94 @@
77

88
if ARCH_CHIP_AM62X
99

10-
comment "AM62x peripheral selection is provided by board defconfig for now."
10+
menu "AM62x peripheral support"
11+
12+
config AM62X_TISCI
13+
bool "TISCI system controller (DM/TIFS) client"
14+
default n
15+
---help---
16+
Enable the AM62x TISCI client. On K3 SoCs the A53 does not own
17+
device power, clocks, resets, or interrupt routing; those are
18+
requested from the DM/TIFS firmware over the TISCI protocol via the
19+
secure-proxy mailbox. This driver provides the request helpers used
20+
by peripheral drivers to power on a block, enable its functional
21+
clock, release resets, and route its interrupt to the GIC.
22+
23+
if AM62X_TISCI
24+
25+
config AM62X_TISCI_HOST_ID
26+
int "TISCI host ID"
27+
default 12
28+
---help---
29+
Host ID this core presents to the DM/TIFS firmware. Must match the
30+
host allocation in the firmware boardcfg. 12 is the standard A53
31+
HLOS host on AM62x.
32+
33+
config AM62X_TISCI_RX_THREAD
34+
int "Secure proxy RX (response) thread"
35+
default 12
36+
---help---
37+
Secure-proxy thread the firmware uses to send responses back to this
38+
host.
39+
40+
config AM62X_TISCI_TX_THREAD
41+
int "Secure proxy TX (request) thread"
42+
default 13
43+
---help---
44+
Secure-proxy thread this host uses to send requests to the firmware.
45+
46+
endif # AM62X_TISCI
47+
48+
config AM62X_GPIO
49+
bool "GPIO support"
50+
default n
51+
---help---
52+
Enable the AM62x main-domain GPIO controller driver, including
53+
basic GPIO input/output operations, pad-mux helper support, and
54+
per-pin interrupt callback dispatch for GPIO0/GPIO1.
55+
56+
config AM62X_GPIO_IRQ
57+
bool "GPIO interrupt (GIC) delivery"
58+
depends on AM62X_GPIO
59+
default n
60+
---help---
61+
Enable per-bank GPIO interrupt delivery through the GIC. On AM62x
62+
the GPIO bank interrupts are routed through the main GPIO interrupt
63+
router, which must be programmed over TISCI (RM_IRQ_SET) before the
64+
GIC input line is valid. Until that routing is implemented, leave
65+
this disabled: enabling an unrouted GIC line faults at boot. GPIO
66+
input/output and the callback API still work without it.
67+
68+
config AM62X_I2C0
69+
bool "I2C0 support"
70+
depends on I2C
71+
default n
72+
73+
config AM62X_I2C1
74+
bool "I2C1 support"
75+
depends on I2C
76+
default n
77+
78+
config AM62X_I2C2
79+
bool "I2C2 support"
80+
depends on I2C
81+
default n
82+
83+
config AM62X_I2C3
84+
bool "I2C3 support"
85+
depends on I2C
86+
default n
87+
88+
config AM62X_I2CTIMEOSEC
89+
int "I2C transfer timeout seconds"
90+
default 0
91+
depends on AM62X_I2C0 || AM62X_I2C1 || AM62X_I2C2 || AM62X_I2C3
92+
93+
config AM62X_I2CTIMEOMS
94+
int "I2C transfer timeout milliseconds"
95+
default 500
96+
depends on AM62X_I2C0 || AM62X_I2C1 || AM62X_I2C2 || AM62X_I2C3
97+
98+
endmenu
1199

12100
endif # ARCH_CHIP_AM62X

arch/arm64/src/am62x/Make.defs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ include common/Make.defs
2929

3030
CHIP_CSRCS = am62x_boot.c
3131
CHIP_CSRCS += am62x_16550serial.c
32+
CHIP_CSRCS += am62x_gpio.c
33+
CHIP_CSRCS += am62x_i2c.c
34+
35+
ifeq ($(CONFIG_AM62X_TISCI),y)
36+
CHIP_CSRCS += am62x_tisci.c
37+
endif
38+
3239

3340
# Early UART assembly (only when CONFIG_ARCH_EARLY_PRINT is set, which
3441
# is selected automatically when CONFIG_ARCH_HAVE_LOWPUTC is enabled

0 commit comments

Comments
 (0)