Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
718ba91
extcon: Add STM32 SPI IPC driver
Overdr0ne Jun 1, 2026
6fc6a6f
arm64: configs: Enable STM32 SPI IPC extcon driver
Overdr0ne Jun 1, 2026
579eca8
arm64: dts: freescale: Add STM32 SPI IPC and extcon nodes
Overdr0ne Jun 1, 2026
ba8eea0
extcon: Kconfig: select CRC8 and improve stm32-ipc help description
Overdr0ne Jun 3, 2026
2cedf5c
extcon: stm32-ipc: remove unused GPIO header
Overdr0ne Jun 3, 2026
7ee736b
extcon: stm32-ipc: fallback to safe disconnected state error
Overdr0ne Jun 3, 2026
d24f351
extcon: stm32-ipc: Use dev_dbg in threaded IRQ to avoid log flooding
Overdr0ne Jun 3, 2026
97c4e67
extcon: stm32-ipc: create per-device debugfs to avoid collisions
Overdr0ne Jun 3, 2026
2398ab9
extcon: stm32-ipc: implement CRC-8/length validation on SPI packets
Overdr0ne Jun 3, 2026
813a866
extcon: stm32-ipc: replace magic numbers with enum and defines
Overdr0ne Jun 3, 2026
fa00235
extcon: stm32-ipc: add Kconfig dependency on OF
Overdr0ne Jul 8, 2026
a76fffd
extcon: stm32-ipc: fix declarations after statements
Overdr0ne Jul 8, 2026
4033d42
extcon: stm32-ipc: validate port-id DT property
Overdr0ne Jul 8, 2026
a18f363
extcon: stm32-ipc: use dev_warn_ratelimited
Overdr0ne Jul 8, 2026
af22146
extcon: stm32-ipc: initialize CRC-8 table once
Overdr0ne Jul 8, 2026
7db84be
extcon: stm32-ipc: fix debugfs lifetime management
Overdr0ne Jul 8, 2026
57f6c94
extcon: stm32-ipc: cache states to reduce churn
Overdr0ne Jul 9, 2026
9d2588b
extcon: stm32-ipc: rate-limit SPI transfer error logs
Overdr0ne Jul 9, 2026
39b5db7
extcon: stm32-ipc: warn on unmatched connector ports
Overdr0ne Jul 9, 2026
f61e32c
extcon: stm32-ipc: clean up debugfs to avoid UAF
Overdr0ne Jul 9, 2026
9ec6b44
extcon: stm32-ipc: register platform driver first
Overdr0ne Jul 9, 2026
371883f
extcon: stm32-ipc: pass device struct directly
Overdr0ne Jul 9, 2026
8e20baa
extcon: stm32-ipc: fix debugfs double-free on unbind
Overdr0ne Jul 13, 2026
2bfa6ab
dt-bindings: extcon: add multitracks,stm32-spi-ipc
Overdr0ne Jul 13, 2026
49b1080
arm64: dts: freescale: mt-connect: wire both extcon phandles
Overdr0ne Jul 13, 2026
35dd274
extcon: stm32-ipc: track connector match via a flag
Overdr0ne Jul 13, 2026
e3f6b79
extcon: stm32-ipc: take IRQ trigger type from DT
Overdr0ne Jul 13, 2026
04586ee
arm64: dts: freescale: mt-connect: fix STM IPC interrupt to GPIO4_IO29
Overdr0ne Jul 13, 2026
0715ac6
extcon: stm32-ipc: require the attention interrupt
Overdr0ne Jul 13, 2026
bc6331c
extcon: stm32-ipc: clean up comments and line lengths
Overdr0ne Jul 13, 2026
0c7d705
arm64: dts: freescale: mt-connect: drop redundant ECSPI2 SS0 pinmux
Overdr0ne Jul 13, 2026
18f9826
extcon: stm32-ipc: narrow irq handler lock scope
Overdr0ne Jul 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/extcon/multitracks,stm32-spi-ipc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: MultiTracks STM32 SPI IPC USB extcon provider

maintainers:
- Samuel Morris <scmorris.dev@gmail.com>

description: |
An SPI client that talks to an external STM32 co-processor. The STM32 reports
USB cable/role events (disconnected, peripheral or host) for each physical USB
port over SPI, signalled by a dedicated attention (interrupt) line.

Each USB port is described by a child connector node that acts as an extcon
provider (EXTCON_USB / EXTCON_USB_HOST) for the USB OTG controller wired to
that port, allowing it to switch between host and peripheral roles.

properties:
compatible:
const: multitracks,stm32-spi-ipc

reg:
maxItems: 1

interrupts:
maxItems: 1
description:
Attention line, driven by the STM32 co-processor to signal that a new
event packet is pending on the SPI bus.

patternProperties:
'^connector-usb[0-9]+$':
type: object
description:
A virtual USB connector exposed as an extcon provider. Reference it from
the "extcon" property of the corresponding USB OTG controller node.

properties:
compatible:
const: multitracks,stm32-usb-connector

port-id:
$ref: /schemas/types.yaml#/definitions/uint32
maximum: 255
description:
Identifier of the USB port on the STM32 co-processor that this
connector represents. It is matched against the "port" field of the
incoming SPI event packet.

required:
- compatible
- port-id

additionalProperties: false

required:
- compatible
- reg
- interrupts

allOf:
- $ref: /schemas/spi/spi-peripheral-props.yaml#

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>

spi {
#address-cells = <1>;
#size-cells = <0>;

ipc@0 {
compatible = "multitracks,stm32-spi-ipc";
reg = <0>;
spi-max-frequency = <10000000>;
interrupt-parent = <&gpio2>;
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;

connector-usb1 {
compatible = "multitracks,stm32-usb-connector";
port-id = <0>;
};

connector-usb2 {
compatible = "multitracks,stm32-usb-connector";
port-id = <1>;
};
};
};
...
42 changes: 32 additions & 10 deletions arch/arm64/boot/dts/freescale/mt-connect.dts
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,29 @@
};

&ecspi2 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_stm_ipc>;
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
status = "okay";

spidev1: spi@0 {
stm_ipc: stm32-ipc@0 {
compatible = "multitracks,stm32-spi-ipc";
reg = <0>;
compatible = "rohm,dh2228fv";
spi-max-frequency = <500000>;
spi-max-frequency = <10000000>;
interrupt-parent = <&gpio4>;
interrupts = <29 IRQ_TYPE_EDGE_FALLING>;

usb1_connector: connector-usb1 {
compatible = "multitracks,stm32-usb-connector";
port-id = <0>;
};

usb2_connector: connector-usb2 {
compatible = "multitracks,stm32-usb-connector";
port-id = <1>;
};
};
};

Expand All @@ -520,6 +534,14 @@
};

&usbotg1 {
/*
* ChipIdea reads extcon phandle 0 as the VBUS (EXTCON_USB) source and
* phandle 1 as the ID (EXTCON_USB_HOST) source. The connector provides
* both cable types, so point both indices at it; otherwise the ID/host
* notifier is never registered by ci_extcon_register() and host-role
* events are dropped.
*/
extcon = <&usb1_connector>, <&usb1_connector>;
hnp-disable;
srp-disable;
adp-disable;
Expand All @@ -533,6 +555,8 @@
};

&usbotg2 {
/* Both extcon indices point at the connector; see &usbotg1. */
extcon = <&usb2_connector>, <&usb2_connector>;
hnp-disable;
srp-disable;
adp-disable;
Expand Down Expand Up @@ -710,9 +734,9 @@
>;
};

pinctrl_typec1: typec1grp {
pinctrl_stm_ipc: stmipcgrp {
fsl,pins = <
MX8MM_IOMUXC_SD1_STROBE_GPIO2_IO11 0x159
MX8MM_IOMUXC_SAI3_RXC_GPIO4_IO29 0x82 /* STM IPC attention (ECSPI2 INT) */
>;
};

Expand All @@ -735,9 +759,7 @@
MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x82
MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x82
MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x82
MX8MM_IOMUXC_ECSPI2_SS0_ECSPI2_SS0 0x82
MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x140 /* ECSPI2 NSS */
MX8MM_IOMUXC_SAI3_RXC_GPIO4_IO29 0x82 /* ECSPI2 INT */
MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x140 /* ECSPI2 NSS (cs-gpios) */
>;
};

Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/mt_connect_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ CONFIG_FSL_QIXIS=y
CONFIG_SOC_TI=y
CONFIG_EXTCON_PTN5150=m
CONFIG_EXTCON_USB_GPIO=y
CONFIG_EXTCON_STM32_SPI_IPC=y
CONFIG_IIO=y
CONFIG_FXLS8962AF_I2C=m
CONFIG_IIO_ST_ACCEL_3AXIS=m
Expand Down
9 changes: 9 additions & 0 deletions drivers/extcon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ config EXTCON_USB_GPIO
Say Y here to enable GPIO based USB cable detection extcon support.
Used typically if GPIO is used for USB ID pin detection.

config EXTCON_STM32_SPI_IPC
tristate "STM32 SPI IPC and Virtual Extcon support"
depends on SPI && OF
select CRC8
Comment thread
Overdr0ne marked this conversation as resolved.
help
Say Y here to enable the STM32 SPI IPC and Virtual Extcon driver,
which handles USB connection/cable event notifications reported
by an external STM32 co-processor over SPI.

config EXTCON_USBC_CROS_EC
tristate "ChromeOS Embedded Controller EXTCON support"
depends on CROS_EC
Expand Down
1 change: 1 addition & 0 deletions drivers/extcon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ obj-$(CONFIG_EXTCON_QCOM_SPMI_MISC) += extcon-qcom-spmi-misc.o
obj-$(CONFIG_EXTCON_RT8973A) += extcon-rt8973a.o
obj-$(CONFIG_EXTCON_SM5502) += extcon-sm5502.o
obj-$(CONFIG_EXTCON_USB_GPIO) += extcon-usb-gpio.o
obj-$(CONFIG_EXTCON_STM32_SPI_IPC) += extcon-stm32-ipc.o
obj-$(CONFIG_EXTCON_USBC_CROS_EC) += extcon-usbc-cros-ec.o
obj-$(CONFIG_EXTCON_USBC_TUSB320) += extcon-usbc-tusb320.o
Loading