gemstonedevteam opened a new pull request, #20116:
URL: https://github.com/apache/nuttx/pull/20116

   ### Summary
   
     * Adds the AM67 GPIO lower half and a polled MCU_MCSPI0 master driver, with
       the pad configuration both need.
     * The driver matches the **K3** MCSPI instance rather than the OMAP2 
layout:
       the K3 peripheral prepends an HL header block, so functional registers 
start
       at `0x100` and the module base is `0x04b00000`.
     * Chip selects are driven per channel by hardware through `CHCONF` 
`FORCE`. On
       deassert the driver waits for `CHSTAT.EOT` before clearing `FORCE`, so a
       high SCLK cannot drop CS mid-word and truncate a write; `CHCTRL.EN` stays
       asserted between transfers because toggling it re-initialises the shift
       logic and drops the next transfer's first word.
     * t3-gem-o1 maps its ICM-20948 (CS3) and LPS22DF (CS1) to `SPIDEV_USER(n)`
       and registers `/dev/spi0`.
     * Also raises `CONFIG_NSH_MAXARGUMENTS` to 16 in the board config: the 
default
       of 7 is fewer than the `spi` console tool needs to address a device, so 
the
       driver could not otherwise be exercised from the shell.
   
   ### Impact
   
     * Is new feature added? **YES** — GPIO and SPI support for AM67.
     * Impact on user? **NO** — new drivers, opt-in by Kconfig.
     * Impact on build? **NO** — new files gated by new Kconfig options.
     * Impact on hardware? **YES** — arch/arm/am67 and board t3-gem-o1.
     * Impact on documentation? **YES** — provided in this PR (second commit).
     * Impact on security? **NO**.
     * Impact on compatibility? **NO** — additive.
     * Anything else? Applies directly to master; no dependency on other PRs in
       this series. First commit authored by halak0013.
   
   ### Testing
   
   ```
   Build Host(s): Pardus GNU/Linux 25 (Debian 13 base), x86_64, host gcc 14
   Toolchain:     arm-none-eabi-gcc 14.2.1 20241119 (15:14.2.rel1-1)
   Target:        arm / TI AM67 (J722S) Cortex-R5F, board t3-gem-o1:nsh
   nuttx-apps:    5a7ab4200
   Loaded on the main-domain R5F by Linux remoteproc; console on UART-MAIN1.
   ```
   
   Testing logs before change: no SPI support on this arch.
   
   The version string in the logs is from the tested build; the commits were
   GPG-signed afterwards, which rewrites hashes. The code is unchanged.
   
   Testing logs after change:
   
   ```
   make distclean && ./tools/configure.sh t3-gem-o1:nsh && make -j
     -> nuttx ELF 522396 bytes, 0 compiler warnings
   
   Console:
   nsh> spi exch -b 0 -n 1 -m 3 -x 2 8f00
   Sending:     8F 00 
   Received:    00 B4 
   nsh> spi exch -b 0 -n 3 -m 3 -x 2 8000
   Sending:     80 00 
   Received:    00 EA 
   nsh> 
   nsh> spi exch -b 0 -n 1 -m 3 -x 2 8f00
   Sending:     8F 00 
   Received:    00 B4 
   nsh> spi exch -b 0 -n 3 -m 3 -x 2 8000
   Sending:     80 00 
   Received:    00 EA 
   nsh>
   
   Test plan result:
   console_alive            PASS  prompt responsive
   version                  PASS  NuttX version 0.0.0 833df5b463 Sep 10 2026 
13:47:56 t3-gem-o1:nsh
   procfs                   PASS  procfs readable
   tasks                    PASS  2 task lines
   dev_nodes                PASS  all expected nodes present
   spi_baro_whoami          PASS  LPS22DF WHO_AM_I 0xb4
   spi_imu_whoami           PASS  ICM-20948 WHO_AM_I 0xea
   
   PASS=7
     spi exch -b 0 -n 3 -m 3 -x 2 8000  -> Received: 00 EA   (ICM-20948)
     spi exch -b 0 -n 1 -m 3 -x 2 8f00  -> Received: 00 B4   (LPS22DF)
   ```
   
   ```
   ICM-20948 on CS3 -- wake, then three 6-byte bursts from ACCEL_XOUT_H:
   
   nsh> spi exch -b 0 -n 3 -m 3 -x 2 0601      (PWR_MGMT_1 = 0x01, clear SLEEP)
   nsh> spi exch -b 0 -n 3 -m 3 -x 2 8600      (read it back)
   Received:    00 01
   nsh> spi exch -b 0 -n 3 -m 3 -x 7 ad000000000000
   Received:    FF 02 AC FF F0 BD 94
   nsh> spi exch -b 0 -n 3 -m 3 -x 7 ad000000000000
   Received:    00 02 EC 00 40 BD 30
   nsh> spi exch -b 0 -n 3 -m 3 -x 7 ad000000000000
   Received:    00 02 88 00 08 BD 80
   
   decoded at the default +/-2 g scale (16384 LSB/g), X/Y/Z big-endian int16:
        +0.042 / -0.001 / -1.038 g   |a| = 1.039 g
        +0.046 / +0.004 / -1.044 g   |a| = 1.045 g
        +0.040 / +0.000 / -1.039 g   |a| = 1.040 g
   Gravity on Z, and the samples differ between reads -- live conversions, not
   a latched constant.
   
   LPS22DF on CS1 -- one-shot conversion, pressure and temperature:
   
   nsh> spi exch -b 0 -n 1 -m 3 -x 2 1101      (CTRL_REG2 ONE_SHOT)
   nsh> spi exch -b 0 -n 1 -m 3 -x 2 a700      (STATUS)
   Received:    00 03                       (P_DA | T_DA)
   nsh> spi exch -b 0 -n 1 -m 3 -x 6 a80000000000
   Received:    00 BF 42 3E 80 10           -> 996.17 hPa, 42.24 C
   Received:    00 71 42 3E 80 10           -> 996.15 hPa, 42.24 C
     pressure = int24(XL,L,H) / 4096 hPa, temperature = int16 / 100 C
   ```
   
   ### PR verification Self-Check
   
     * [x] This PR introduces only one functional change.
     * [x] I have updated all required description fields above.
     * [x] My PR adheres to Contributing Guidelines and Documentation.
     * [ ] My PR is still work in progress (not ready for review).
     * [x] My PR is ready for review and can be safely merged into a codebase.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to