Skip to content

Commit 4405c24

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 4405c24

30 files changed

Lines changed: 2998 additions & 52 deletions

File tree

Documentation/platforms/arm64/am62x/boards/beagleplay/index.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ Features
1818
* Four user LEDs
1919
* Gigabit Ethernet, USB, Wi-Fi, and Bluetooth hardware on the board
2020

21-
Current NuttX support is limited to early boot, the 16550 serial console,
22-
interactive NSH, and ``procfs`` mount during board bring-up. GPIO, LEDs,
23-
I2C, SPI, MMC/SD, Ethernet, Wi-Fi, Bluetooth, and USB runtime support are
24-
not implemented yet.
21+
Current NuttX support includes early boot, the 16550 serial console,
22+
interactive NSH, ``procfs`` mount during board bring-up, AM62x TISCI
23+
initialization, main-domain GPIO, and I2C0/I2C1 controller support in the
24+
``beagleplay:i2c`` configuration. SPI, MMC/SD, Ethernet, Wi-Fi, Bluetooth,
25+
and USB runtime support are not implemented yet.
2526

2627
Buttons and LEDs
2728
================
@@ -37,8 +38,8 @@ USR2 GPIO1_24 Red user LED
3738
USR3 GPIO1_25 Blue user LED
3839
====== ======== ==================
3940

40-
The current NuttX port does not yet provide functional GPIO-backed LED
41-
control. The ``CONFIG_ARCH_LEDS`` hooks are present as placeholders only.
41+
The current NuttX port initializes the AM62x GPIO controller. Automatic
42+
``CONFIG_ARCH_LEDS`` LED hooks remain placeholders only.
4243

4344
Serial Console
4445
==============
@@ -57,7 +58,9 @@ Interface SoC signal Notes
5758
=========== ====================== =======================================
5859
DEBUG USB-C UART0 Default NuttX serial console
5960
microSD MMC1 Validated boot media for ``nuttx.bin``
60-
USR0-3 GPIO1_22 through 1_25 User LEDs, not yet driven by NuttX
61+
USR0-3 GPIO1_22 through 1_25 User LEDs on the main GPIO block
62+
I2C0 I2C0 Available in ``beagleplay:i2c``
63+
I2C1 I2C1 Available in ``beagleplay:i2c``
6164
=========== ====================== =======================================
6265

6366
Power Supply
@@ -116,5 +119,8 @@ Configurations
116119
``beagleplay:nsh``
117120
Interactive NSH configuration for serial bring-up and shell access.
118121

122+
``beagleplay:i2c``
123+
NSH configuration with AM62x I2C0/I2C1 and the ``i2c`` tool enabled.
124+
119125
``beagleplay:ostest``
120126
Hardware validation configuration that boots directly into ``ostest_main``.

Documentation/platforms/arm64/am62x/boards/pocketbeagle2/index.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ Features
1717
* Expansion headers for GPIO, I2C, SPI, UART, PWM, and ADC
1818
* User LEDs exposed by the board port
1919

20-
Current NuttX support is limited to early boot, the 16550 serial console,
21-
interactive NSH, and ``procfs`` mount during board bring-up. GPIO, functional
22-
LED control, I2C, SPI, MMC/SD runtime support, Ethernet, and USB runtime
23-
support are not implemented yet.
20+
Current NuttX support includes early boot, the 16550 serial console,
21+
interactive NSH, ``procfs`` mount during board bring-up, AM62x TISCI
22+
initialization, main-domain GPIO, and I2C0/I2C2 controller support in the
23+
``pocketbeagle2:i2c`` configuration. SPI, MMC/SD runtime support, Ethernet,
24+
and USB runtime support are not implemented yet.
2425

2526
Buttons and LEDs
2627
================
@@ -35,7 +36,8 @@ USR1 Amber ``CONFIG_ARCH_LEDS`` placeholder
3536
USR2 Red ``CONFIG_ARCH_LEDS`` placeholder
3637
====== ======== =====================
3738

38-
These LEDs are not driven yet because AM62x GPIO support has not been added.
39+
The AM62x GPIO controller is initialized by the board port. Automatic
40+
``CONFIG_ARCH_LEDS`` LED hooks remain placeholders only.
3941

4042
Serial Console
4143
==============
@@ -54,7 +56,9 @@ Interface SoC signal Notes
5456
=========== ====================== =======================================
5557
USB-C debug UART6 Default NuttX serial console
5658
microSD MMC1 Validated boot media for ``nuttx.bin``
57-
USR0-2 Board user LEDs Not yet driven by NuttX GPIO support
59+
USR0-2 Board user LEDs Available through the main GPIO block
60+
I2C0 I2C0 Available in ``pocketbeagle2:i2c``
61+
I2C2 Header I2C2 Available in ``pocketbeagle2:i2c``
5862
=========== ====================== =======================================
5963

6064
Power Supply
@@ -106,5 +110,8 @@ Configurations
106110
``pocketbeagle2:nsh``
107111
Interactive NSH configuration for serial bring-up and shell access.
108112

113+
``pocketbeagle2:i2c``
114+
NSH configuration with AM62x I2C0/I2C2 and the ``i2c`` tool enabled.
115+
109116
``pocketbeagle2:ostest``
110117
Hardware validation configuration that boots directly into ``ostest_main``.

Documentation/platforms/arm64/am62x/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Texas Instruments featuring:
1010
- **Boot:** ROM → R5 SYSFW (TIFS) → U-Boot SPL → U-Boot → NuttX
1111
- **Memory:** External DDR4/LPDDR4 (512 MB – 2 GB depending on board)
1212
- **UART:** Seven 16550-compatible UARTs (48 MHz clock)
13+
- **GPIO:** Main-domain GPIO controller support
14+
- **I2C:** Main-domain I2C controller support
1315

1416
Supported Boards
1517
================

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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
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()
2630

2731
# Early UART assembly (needed for CONFIG_ARCH_EARLY_PRINT / semihosting console
2832
# 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)