forked from nxp-imx/linux-imx
-
Notifications
You must be signed in to change notification settings - Fork 9
MT-158113: imx8mm-evk-spi-transport devicetree overlay #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MT-MichaelLoh
wants to merge
35
commits into
MultiTracksDotCom:develop
Choose a base branch
from
MT-MichaelLoh:MT-158113
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
b357ec6
MT-158113: add MultiTracks SPI transport driver (Host role) for imx8m…
MT-MichaelLoh d3091e2
MT-158113: fix spi-mt-transport header lookup under out-of-tree kerne…
MT-MichaelLoh 4797fd2
MT-158113: add stdbool.h/stdint.h/stdarg.h kernel-compat shims
MT-MichaelLoh bb0003d
MT-158113: fix pAbort() no-op race corrupting SPI core state on DMA t…
MT-MichaelLoh 650eefe
MT-158113: log/count link events, add event_counters sysfs attribute
MT-MichaelLoh 2b60361
MT-158113: remove spi-mt-transport driver -- moved to an out-of-tree …
MT-MichaelLoh 271a69d
MT-158113: revive in-tree spi-mt-transport driver, core stays out
MT-MichaelLoh 969c3d4
MT-158113: fix Copilot review findings on the revived in-tree driver
MT-MichaelLoh a3ec60e
MT-158113: second round of Copilot review fixes
MT-MichaelLoh 05ac4fc
MT-158113: third round of Copilot review fixes (DT schema, fail-fast)
MT-MichaelLoh 47c3d31
MT-158113: fourth round of Copilot review fixes (IRQ0, remove() race)
MT-MichaelLoh 0ddfa20
MT-158113: fifth round of Copilot review fixes (miscdevice UAF, reade…
MT-MichaelLoh b9362b9
MT-158113: sixth round of Copilot review fixes (wake removed waiters)
MT-MichaelLoh a506207
MT-158113: seventh round of Copilot review fixes (brace style nit)
MT-MichaelLoh 3315caa
MT-158113: document known tx_in_flight_idx capacity gap (MT-158925)
MT-MichaelLoh cbe5980
MT-158113: ninth round of Copilot review fixes (probe() IRQ-vs-kref U…
MT-MichaelLoh d6d05b2
MT-158113: tenth round of Copilot review fixes (va_list portability)
MT-MichaelLoh f6dab87
MT-158113: add channel 2 (Property Model) support to spi-mt-transport
MT-MichaelLoh 13bf6a0
MT-158113: fix event_callback context type confusion (NULL-deref Oops)
MT-MichaelLoh 89bb2f2
MT-158113: eleventh round of Copilot review fixes (transferComplete o…
MT-MichaelLoh 1496c4b
MT-158113: address PR #46's suppressed Copilot findings (read race, r…
MT-MichaelLoh fa0c170
MT-159369: generalize spi-mt-transport to register all raw channels
MT-MichaelLoh 9c926b2
MT-159369: bind spi-mt-transport onto mt-connect.dts's ecspi2 (was sp…
MT-MichaelLoh de532a1
MT-159369: bump spi-transport SPI clock from 500kHz to 10MHz
MT-MichaelLoh cac7f7c
MT-159369: step spi-transport clock down to 4MHz to isolate rate-depe…
MT-MichaelLoh 81e7f70
MT-159369: step spi-transport clock back to 500kHz, isolate structura…
MT-MichaelLoh 70215bb
MT-159369: add arm-to-complete timing instrumentation for the DMA-arm…
MT-MichaelLoh 5aca8c2
MT-159369: log calling thread on the still-in-flight guard trip
MT-MichaelLoh 944a152
MT-159369: dump raw RX buffer on the first few header/payload CRC fai…
MT-MichaelLoh 91668e6
MT-159369: poison RX buffer with sentinel before every arm to test th…
MT-MichaelLoh 5902526
MT-159369: add DMA residue verification after RX/TX completion
MT-MichaelLoh 317dbb7
MT-159369: hex-dump first few TX/RX frames for cross-side comparison
MT-MichaelLoh d5d1f57
MT-159369: ratelimit per-event/per-frame logging -- unthrottled dev_w…
MT-MichaelLoh 59f5789
MT-159369: NRDY IRQ handler should only wake the tick thread, not act…
MT-MichaelLoh 1f7da38
MT-159369: address 5 of 6 unresolved PR #46 review threads
MT-MichaelLoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
Documentation/devicetree/bindings/spi/multitracks,spi-transport.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # SPDX-License-Identifier: GPL-2.0 | ||
| %YAML 1.2 | ||
| --- | ||
| $id: http://devicetree.org/schemas/spi/multitracks,spi-transport.yaml# | ||
| $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
|
|
||
| title: MultiTracks SPI transport protocol (Host role) | ||
|
|
||
| maintainers: | ||
| - Michael Loh <michael@multitracks.com> | ||
|
|
||
| description: | | ||
| A framed, multi-channel, ack/retry link between an i.MX SoC (Host) and an | ||
| STM32-class client MCU (Client) over a raw SPI bus, plus a companion NRDY | ||
| GPIO handshake line in addition to the physical SPI SCK/MOSI/MISO lines. | ||
| See the firmware repo's firmware-common/spi-transport/docs/ProtocolSpec.md | ||
| for the full wire protocol. | ||
|
|
||
| NSS and NRDY are bound here as driver-private properties, not the | ||
| standard "cs-gpios" -- the protocol holds NSS low continuously across a | ||
| multi-step request/ack/clock/complete cycle, not just one SPI transfer, | ||
| so the driver owns and drives it directly rather than letting the SPI | ||
| core auto-toggle it per-message. | ||
|
|
||
| allOf: | ||
| - $ref: /schemas/spi/spi-peripheral-props.yaml# | ||
|
|
||
| properties: | ||
| compatible: | ||
| const: multitracks,spi-transport | ||
|
|
||
| reg: | ||
| maxItems: 1 | ||
|
|
||
| multitracks,nss-gpios: | ||
| maxItems: 1 | ||
| description: | ||
| Host-driven NSS (transfer request) line, held low across the whole | ||
| request/ack/clock/complete cycle. Always GPIO_ACTIVE_HIGH regardless | ||
| of the physical wire's true active sense, so the driver's logical | ||
| value always equals the literal pin level (the protocol's own | ||
| convention is "true = pin HIGH"). | ||
|
|
||
| multitracks,nrdy-gpios: | ||
| maxItems: 1 | ||
| description: | ||
| Client-driven NRDY (ready/ack) line, read by the Host. Same | ||
| GPIO_ACTIVE_HIGH convention as multitracks,nss-gpios. | ||
|
|
||
| required: | ||
| - compatible | ||
| - reg | ||
| - spi-max-frequency | ||
| - multitracks,nss-gpios | ||
| - multitracks,nrdy-gpios | ||
|
|
||
| unevaluatedProperties: false | ||
|
|
||
| examples: | ||
| - | | ||
| #include <dt-bindings/gpio/gpio.h> | ||
| spi { | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
|
|
||
| spi@0 { | ||
| compatible = "multitracks,spi-transport"; | ||
| reg = <0>; | ||
| spi-max-frequency = <500000>; | ||
|
|
||
| multitracks,nss-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH>; | ||
| multitracks,nrdy-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; | ||
| }; | ||
| }; | ||
|
|
||
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
arch/arm64/boot/dts/freescale/imx8mm-evk-spi-transport.dts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // SPDX-License-Identifier: GPL-2.0 | ||
| // | ||
| // Copyright 2026 MultiTracks.com, LLC. | ||
| // | ||
| // MT-158113: binds the MultiTracks SPI transport driver (Host role) onto | ||
| // ecspi2, mirroring the pins already used for this same purpose on the | ||
| // mt-connect production board (mt-connect.dts) -- see | ||
| // firmware/firmware-common/spi-transport/docs/ProtocolSpec.md for the wire | ||
| // protocol and NSS/NRDY handshake this binds to real hardware. | ||
| // | ||
| // NSS/NRDY are bound here as driver-private "multitracks,nss-gpios"/ | ||
| // "multitracks,nrdy-gpios" properties, NOT the standard "cs-gpios" -- the | ||
| // transport protocol holds | ||
| // NSS low continuously across a multi-step request/ack/clock/complete | ||
| // cycle, not just one SPI transfer, so the driver must own and drive it | ||
| // directly rather than let the SPI core auto-toggle it per-message. Both | ||
| // are declared GPIO_ACTIVE_HIGH regardless of the physical wire's true | ||
| // active sense, so the driver's gpiod_get/set_value_cansleep() calls | ||
| // always see the literal pin level, matching the protocol's own | ||
| // "true = pin HIGH" convention (see drivers/spi/spi-mt-transport/ | ||
| // spi_transport_hw_linux.c). | ||
|
|
||
| #include "imx8mm-evk.dts" | ||
|
|
||
| /delete-node/ &spidev0; | ||
|
|
||
| &ecspi2 { | ||
| /delete-property/ cs-gpios; | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs &pinctrl_ecspi2_nrdy>; | ||
|
|
||
| mt_transport0: spi@0 { | ||
| compatible = "multitracks,spi-transport"; | ||
| reg = <0>; | ||
| spi-max-frequency = <500000>; /* matches mt-connect.dts -- back to the soak-tested-clean rate, MT-159369 */ | ||
|
|
||
| multitracks,nss-gpios = <&gpio5 13 GPIO_ACTIVE_HIGH>; | ||
| multitracks,nrdy-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; | ||
| }; | ||
| }; | ||
|
|
||
| &iomuxc { | ||
| pinctrl_ecspi2_nrdy: ecspi2nrdygrp { | ||
| fsl,pins = < | ||
| MX8MM_IOMUXC_SAI3_RXC_GPIO4_IO29 0x82 | ||
| >; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # core/ is the portable SPI transport protocol core -- single source of | ||
| # truth lives in the firmware repo (firmware-common/spi-transport/), staged | ||
| # here at Yocto build time (see imx8mmini-bb-evk's meta-mt-transport-evk | ||
| # linux-imx_%.bbappend), never committed into this repo. | ||
| core/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # SPDX-License-Identifier: GPL-2.0 | ||
| # | ||
| # IMPORTANT -- this module only builds inside the imx8mmini-bb-evk Yocto BSP | ||
| # pipeline, not from a plain checkout of this kernel tree built directly | ||
| # (e.g. a bare `make -C . M=drivers/spi/spi-mt-transport modules`). The | ||
| # core/ referenced below is deliberately NOT committed to this repo (see | ||
| # core/'s absence and the .gitignore in this directory) -- it's the | ||
| # portable protocol core, whose single source of truth is the firmware | ||
| # repo's firmware-common/spi-transport/{src,inc}/. Yocto's | ||
| # meta-mt-transport-evk/recipes-kernel/linux-imx/linux-imx_%.bbappend | ||
| # fetches it separately and stages it into core/ via a do_patch[postfuncs] | ||
| # hook *before* this Makefile ever runs. This Makefile is only ever | ||
| # evaluated when CONFIG_SPI_MT_TRANSPORT is already enabled (Kbuild only | ||
| # descends here via drivers/spi/Makefile's obj-$(CONFIG_SPI_MT_TRANSPORT) | ||
| # line), so the check below fires exactly when it matters and fails fast | ||
| # with a clear message instead of the opaque "No rule to make target | ||
| # core/spi_transport.o" a missing core/ would otherwise produce deep in | ||
| # the build. | ||
| # $(src) alone resolves against $(objtree) under Yocto's out-of-tree (O=) | ||
| # kernel builds, same reason the ccflags-y line below needs the | ||
| # $(srctree)/ prefix -- this check needs it too, or it always reports | ||
| # core/ missing even when it's genuinely staged (confirmed via a real | ||
| # false-positive build failure without this prefix). | ||
| ifeq ($(wildcard $(srctree)/$(src)/core/spi_transport.c),) | ||
| $(error spi-mt-transport: core/ is not staged. This module only builds inside \ | ||
| the imx8mmini-bb-evk Yocto BSP pipeline, which fetches the portable \ | ||
| protocol core from the firmware repo and stages it into core/ before \ | ||
| this Makefile runs -- build via bitbake, not a plain kernel checkout) | ||
| endif | ||
|
|
||
| obj-$(CONFIG_SPI_MT_TRANSPORT) += spi-mt-transport.o | ||
| spi-mt-transport-y := \ | ||
| core/spi_transport.o \ | ||
| core/spi_transport_channel.o \ | ||
| core/spi_transport_frame.o \ | ||
| core/spi_transport_crc16.o \ | ||
| core/spi_transport_hw.o \ | ||
| spi_transport_os_linux.o \ | ||
| spi_transport_hw_linux.o \ | ||
| spi_mt_transport_drv.o | ||
|
|
||
| # $(src) alone resolves against $(objtree) under Yocto's out-of-tree (O=) | ||
| # kernel builds; these headers only exist in the source tree, so the | ||
| # $(srctree)/ prefix is required or the compile can't find them. | ||
| ccflags-y += -I$(srctree)/$(src)/kernel-compat -I$(srctree)/$(src)/core/include |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||
| /* | ||
| * Compat shim only -- NOT part of the portable core (../../../.. relative to here). | ||
| * | ||
| * The portable core targets hosted C11, so it includes the standard | ||
| * <stdarg.h>. Under the kernel's -nostdinc build this cross-compiler's own | ||
| * freestanding headers aren't on the search path either, so <stdarg.h> | ||
| * doesn't resolve at all -- linux/stdarg.h is the kernel's own sanctioned | ||
| * replacement for exactly this case. Only reached via this module's own | ||
| * Makefile (ccflags-y += -I$(src)/kernel-compat), so it | ||
| * cannot shadow <stdarg.h> anywhere else in the kernel tree. | ||
| */ | ||
| #include <linux/stdarg.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||
| /* | ||
| * Compat shim only -- NOT part of the portable core (../../../.. relative to here). | ||
| * | ||
| * The portable core targets hosted C11, so it includes the standard | ||
| * <stdbool.h> for bool/true/false. Under the kernel's -nostdinc build this | ||
| * cross-compiler's own freestanding headers aren't on the search path | ||
| * either, so <stdbool.h> doesn't resolve at all. linux/types.h (bool) and | ||
| * linux/stddef.h (true/false) are the kernel's equivalents. Only reached via | ||
| * this module's own Makefile (ccflags-y += -I$(src)/kernel-compat), | ||
| * so it cannot shadow <stdbool.h> anywhere else in the kernel tree. | ||
| */ | ||
| #include <linux/stddef.h> | ||
| #include <linux/types.h> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.