power: sequencing: pcie-m2: Add PCIe M.2 Key B connector support
Subsystems (6)
v2 cover power: sequencing: pcie-m2: Add PCIe M.2 Key B connector support
Add support for PCIe M.2 Mechanical Key B connectors, commonly used for WWAN adapters.
The series introduces a DT binding for the M.2 Key B connector and extends the PCIe M.2 power sequencing driver to handle the 3.3V/VBAT supply and the FULL_CARD_POWER_OFF#, RESET#, and W_DISABLE1# signals.
Finally, describe the WWAN M.2 Key B connector on the Glymur CRD and the Nord RRD. On Glymur the WWAN supply moves from the PCIe6 Root Port node to the connector, so that the slot power is controlled through the pwrseq-pcie-m2 driver and the PCI pwrctrl framework, like the other M.2 connectors.
The series is based on the qcom tree [1], arm64-for-7.5, which has the Nord PCIe root port DT nodes that the Nord RRD patch needs. That patch also depends on the Nord PCIe controller support from the PCI tree, which is in linux-next.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/log/?h=arm64-for-7.5
---
Changes in v2:
- Binding: describe SATA/PCIe SSD Adapters too, since the Key B slot accepts them (Alexey)
- Binding: add optional config-gpios for CONFIG_0..3 with the Table 3-18 decode, and config-state to fix the configuration on boards that do not sense it; defaults to WWAN PCIe (Alexey)
- Binding: replace w-disable2-gpios and wowwan-gpios with gpio0-gpios to gpio11-gpios, as GPIO_0..11 change function with the Port Configuration; the functions are listed in the binding, with the IPC pins and CONFIG
state 14 marked as vendor defined (Rob, Alexey)
- Binding: add optional alert-gpios for the SSD SMBus ALERT# (Rob), and i2c-parent, devslp-gpios and pln-gpios for the other SSD signals (Alexey)
- Binding: replace one port per interface with one port per muxed pin group, with endpoints selecting the interface: PCIe lane 0/SATA, USB3.1/SSIC/
PCIe lane 1, and USB 2.0 (Rob, Alexey)
- DT: add the Nord RRD WWAN connector (new patch)
- Rebased onto the qcom tree, arm64-for-7.5
- Link to v1: https://patch.msgid.link/[email protected]
---
Krishna Chaitanya Chundru (4):
dt-bindings: connector: Add PCIe M.2 Mechanical Key B connector
power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors
arm64: dts: qcom: glymur-crd: Describe the PCIe M.2 Key B connector
arm64: dts: qcom: nord-rrd: Describe the PCIe M.2 Key B connector
.../bindings/connector/pcie-m2-b-connector.yaml | 332 +++++++++++++++++++++ MAINTAINERS | 1 + arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 29 +- arch/arm64/boot/dts/qcom/nord-rrd.dts | 40 +++ drivers/power/sequencing/pwrseq-pcie-m2.c | 70 +++++ 5 files changed, 470 insertions(+), 2 deletions(-)
---
base-commit: dde0308a2f8867806a444df1fdd7e685b1c56d5b
change-id: 20261021-pcie6_fix-cf66f4b8b387
Best regards,
Signature · 1 line
Krishna Chaitanya Chundru <[email protected]>
PATCH v2 1/4 dt-bindings: connector: Add PCIe M.2 Mechanical Key B connector
Add the devicetree binding for PCIe M.2 Mechanical Key B connector defined in the PCI Express M.2 Specification, r4.2, sec 3.2.19.1. This connector is used to attach WWAN Adapters to the host machine over interfaces such as PCIe, USB3.1 Gen1, SSIC, or USB 2.0. The slot also accepts SATA and PCIe SSD Adapters, which use the same pins.
Interfaces that share connector pins are described as one graph port per pin group, with the endpoint number selecting between the mutually exclusive interfaces.
The connector provides a primary power supply of 3.3V/VBAT, along with optional GPIO signals: FULL_CARD_POWER_OFF#, RESET#, W_DISABLE1# and DPR for WWAN Adapters, and DEVSLP, PLN# and SMBus ALERT# for SSD Adapters, plus an I2C parent for the SSD SMBus.
The function of the GPIO_0..GPIO_11 pins depends on the Port Configuration, so they are described by gpioN-gpios properties with the function of each pin per configuration documented in the binding. The Adapter configuration is either sensed through config-gpios (CONFIG_0..3) or fixed with config-state, which defaults to WWAN PCIe.
--- .../bindings/connector/pcie-m2-b-connector.yaml | 332 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 333 insertions(+)
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +332 -0
@@ -0,0 +1,332 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-b-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key B Connector + +maintainers: + - Krishna Chaitanya Chundru <[email protected]> + +description: + A PCIe M.2 B connector node represents a physical PCIe M.2 Mechanical Key B + connector. Mechanical Key B connectors are used to connect WWAN devices to + the host machine over interfaces like PCIe, USB3.1 Gen1, SSIC, or USB 2.0, + selected by the Adapter's configuration pins. The slot also accepts SATA and + PCIe SSD Adapters, which use the same pins as the WWAN interfaces. + +properties: + compatible: + const: pcie-m2-b-connector + + vpcie3v3-supply: + description: A phandle to the regulator for the 3.3v/VBAT supply. + + full-card-power-off-gpios: + description: GPIO output to FULL_CARD_POWER_OFF# signal. This signal is + used by the host system to turn off the entire Adapter. Refer, PCI + Express M.2 Specification r4.0, sec 3.2.13.1 for more details. + maxItems: 1 + + reset-gpios: + description: GPIO output to RESET# signal. This signal is used by the + host system to place the WWAN Adapter into a power-on reset condition. + Refer, PCI Express M.2 Specification r4.0, sec 3.2.13.2 for more + details. + maxItems: 1 + + w-disable1-gpios: + description: GPIO output to W_DISABLE1# signal. This signal is used by + the host system to disable the WWAN radio on the Adapter. Refer, PCI + Express M.2 Specification r4.0, sec 3.1.12.3 for more details. + maxItems: 1 + + dpr-gpios: + description: GPIO output to the Dynamic Power Reduction (DPR) signal. + This signal is provided by a host system proximity sensor to the + Adapter to trigger a reduction in the radio transmit output power to + meet regulatory SAR requirements. Refer, PCI Express M.2 Specification + r4.0, sec 3.2.13.4 for more details. + maxItems: 1 + + alert-gpios: + description: GPIO input to the SMBus ALERT# signal (pin 44, shared with + GPIO_2). SSD Adapters assert this signal to indicate to the host that + the SMBus device requires attention. It is not present on WWAN + Adapters. Refer, PCI Express M.2 Specification r4.2, sec 3.2.14.2.1 + for more details. + maxItems: 1 + + i2c-parent: + $ref: /schemas/types.yaml#/definitions/phandle + description: Phandle to the host I2C controller connected to the SMBus + pins SMB_CLK and SMB_DATA (pins 40 and 42, shared with GPIO_0 and + GPIO_1). The SMBus is only present on SSD Adapters. Refer, PCI Express + M.2 Specification r4.2, sec 3.2.14.2 for more details. + + devslp-gpios: + description: GPIO output to the DEVSLP signal (pin 38). The host asserts + this signal to tell a SATA SSD to enter the Device Sleep power state. + It is only present on SATA SSD Adapters. Refer, PCI Express M.2 + Specification r4.2, sec 3.2.10.1 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO output to the Power Loss Notification (PLN#) signal + (pin 8, shared with W_DISABLE1#). The host asserts this signal to + notify a PCIe SSD that a power loss event is about to occur. WWAN + boards use w-disable1-gpios for this pin instead. Refer, PCI Express + M.2 Specification r4.2, sec 3.2.18.1 for more details. + maxItems: 1 + + config-gpios: + description: | + GPIO inputs sensing the four CONFIG_0..3 pins (pins 21, 69, 75 and 1 + respectively, listed in that order in this property). The Adapter + grounds or leaves unconnected (NC) each of these pins to tell the host + the Adapter type, the host interface in use and, for WWAN Adapters, the + active GPIO_0..11 Port Configuration. Boards that only ever use one + Adapter type should use config-state instead. If both properties are + present, config-gpios takes precedence. Refer, PCI Express M.2 + Specification r4.2, sec 3.2.15 and Table 3-18 for more details. + + Table 3-18. Socket 2 Add-in Card Configuration: + + CONFIG_0 CONFIG_1 CONFIG_2 CONFIG_3 Adapter Type / Host Interface Port Config + GND GND GND GND SSD - SATA N/A + GND NC GND GND SSD - PCIe N/A + GND GND NC GND WWAN - PCIe 0 + GND NC NC GND WWAN - PCIe 1 + GND GND GND NC WWAN - PCIe, USB3.1 Gen1 0 + GND NC GND NC WWAN - PCIe, USB3.1 Gen1 1 + GND GND NC NC WWAN - PCIe, USB3.1 Gen1 2 + GND NC NC NC WWAN - PCIe, USB3.1 Gen1 3 + NC GND GND GND WWAN - SSIC 0 + NC NC GND GND WWAN - SSIC 1 + NC GND NC GND WWAN - SSIC 2 + NC NC NC GND WWAN - SSIC 3 + NC GND GND NC WWAN - PCIe 2 + NC NC GND NC WWAN - PCIe 3 + NC GND NC NC WWAN - PCIe, USB3.1 Gen1 vendor-defined + NC NC NC NC No Add-in Card present N/A + minItems: 4 + maxItems: 4 + + config-state: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Fixed Adapter configuration for boards that do not sense the CONFIG_0..3 + pins, given as the state number (0-14) of Table 3-18 of the PCI Express + M.2 Specification r4.2. It selects the Adapter type, the host interface + and, for WWAN Adapters, the Port Configuration used to interpret the + gpioN-gpios properties. Ignored if config-gpios is present. If neither + property is present, state 2 (WWAN - PCIe, Port Config_0) is assumed. + minimum: 0 + maximum: 14 + default: 2 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Several interfaces share the same connector pins and are + selected by the CONFIG_0..3 pins, so each port describes one group of + pins and its endpoints describe the mutually exclusive interfaces that + can be present on that group. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Pins 41, 43, 47 and 49. The endpoint number selects the interface: + 0 - PCIe lane 0 + 1 - SATA + patternProperties: + '^endpoint(@[0-9a-f]+)?$': + type: object + properties: + reg: + enum: [0, 1] + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + Pins 29, 31, 35 and 37. The endpoint number selects the interface: + 0 - USB3.1 Gen1 + 1 - SSIC + 2 - PCIe lane 1 + patternProperties: + '^endpoint(@[0-9a-f]+)?$': + type: object + properties: + reg: + enum: [0, 1, 2] + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: USB 2.0 interface (pins 7 and 9) + + anyOf: + - required: + - port@0 + - required: + - port@1 + +patternProperties: + '^gpio([0-9]|1[01])-gpios$': + description: | + GPIO connected to the GPIO_<N> pin of the connector, where N is the + number in the property name. The function of these pins depends on the + Port Configuration selected by config-gpios or config-state (Table 3-15 + of the PCI Express M.2 Specification r4.2, sec 3.2.13.3): + + GPIO Pin Config_0 Config_1 Config_2 Config_3 + 0 40 GNSS_SCL GNSS_SCL SIM_DETECT2 IPC_0 + 1 42 GNSS_SDA GNSS_SDA UIM_DATA2 IPC_1 + 2 44 GNSS_IRQ GNSS_IRQ UIM_CLK2 IPC_2 + 3 46 SYSCLK GNSS_0 UIM_RESET2 IPC_3 + 4 48 TX_BLANKING GNSS_1 UIM_PWR2 IPC_4 + 5 20 AUDIO_0 AUDIO_0 RFU AUDIO_0 + 6 22 AUDIO_1 AUDIO_1 RFU AUDIO_1 + 7 24 AUDIO_2 AUDIO_2 RFU IPC_5/AUDIO_2 + 8 28 AUDIO_3 AUDIO_3 PLA_S2# IPC_6/AUDIO_3 + 9 10 LED_1# LED_1# LED_1# DAS/DSS/IPC_7 + 10 26 W_DISABLE2# W_DISABLE2# W_DISABLE2# HSIC_STROBE + 11 23 WoWWAN# WoWWAN# WoWWAN# HSIC_DATA + + The IPC_0..7 functions of Port Config_3 are vendor defined, as are all + functions in CONFIG state 14. + + On SSD Adapters (CONFIG states 0 and 1) the same pins are SMB_CLK + (GPIO_0), SMB_DATA (GPIO_1), ALERT# (GPIO_2), PLA_S2# (GPIO_8), and + LED_1# or, on SATA, DAS/DSS (GPIO_9). + + Only list the pins that are wired to a host GPIO. Pins used as a bus + signal in the selected Port Configuration (I2C, I2S/SLIMbus, HSIC) are + not GPIOs and are not described by these properties. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key B connector for WWAN with PCIe interface + - | + #include <dt-bindings/gpio/gpio.h> + + connector { + compatible = "pcie-m2-b-connector"; + vpcie3v3-supply = <&vreg_wwan>; + full-card-power-off-gpios = <&tlmm 121 GPIO_ACTIVE_LOW>; + w-disable1-gpios = <&tlmm 122 GPIO_ACTIVE_LOW>; + gpio10-gpios = <&tlmm 123 GPIO_ACTIVE_LOW>; + gpio11-gpios = <&tlmm 128 GPIO_ACTIVE_LOW>; + /* A zero phandle marks a CONFIG pin that is not wired to a host GPIO */ + config-gpios = <&tlmm 124 GPIO_ACTIVE_HIGH>, + <&tlmm 125 GPIO_ACTIVE_HIGH>, + <0>, + <&tlmm 127 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + endpoint@0 { + reg = <0>; + remote-endpoint = <&pcie6_port0_ep>; + }; + }; + + port@2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + + endpoint@0 { + reg = <0>; + remote-endpoint = <&usb_hs_ep>; + }; + }; + }; + }; + + # PCI M.2 Key B connector used for a SATA SSD + - | + #include <dt-bindings/gpio/gpio.h> + + connector { + compatible = "pcie-m2-b-connector"; + vpcie3v3-supply = <&vreg_ssd>; + config-state = <0>; + i2c-parent = <&i2c0>; + alert-gpios = <&tlmm 130 GPIO_ACTIVE_LOW>; + devslp-gpios = <&tlmm 131 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + endpoint@1 { + reg = <1>; + remote-endpoint = <&sata_port0_ep>; + }; + }; + }; + }; + + # PCI M.2 Key B connector used for a 2-lane PCIe SSD + - | + #include <dt-bindings/gpio/gpio.h> + + connector { + compatible = "pcie-m2-b-connector"; + vpcie3v3-supply = <&vreg_ssd>; + config-state = <1>; + pln-gpios = <&tlmm 132 GPIO_ACTIVE_LOW>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + endpoint@0 { + reg = <0>; + remote-endpoint = <&pcie_port0_ep>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + endpoint@2 { + reg = <2>; + remote-endpoint = <&pcie_port1_ep>; + }; + }; + }; + };
MAINTAINERS +1 -0
@@ -22255,6 +22255,7 @@ PCIE M.2 POWER SEQUENCING M: Manivannan Sadhasivam <[email protected]> L: [email protected] S: Maintained +F: Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml F: Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml F: Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml F: drivers/power/sequencing/pwrseq-pcie-m2.c
Signature · 1 line
2.34.1
Re: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key B connector
Hi Krishna,
Quoted 48 lines · Krishna Chaitanya Chundru
Add the devicetree binding for PCIe M.2 Mechanical Key B connector defined in the PCI Express M.2 Specification, r4.2, sec 3.2.19.1. This connector is used to attach WWAN Adapters to the host machine over interfaces such as PCIe, USB3.1 Gen1, SSIC, or USB 2.0. The slot also accepts SATA and PCIe SSD Adapters, which use the same pins.
Interfaces that share connector pins are described as one graph port per pin group, with the endpoint number selecting between the mutually exclusive interfaces.
The connector provides a primary power supply of 3.3V/VBAT, along with optional GPIO signals: FULL_CARD_POWER_OFF#, RESET#, W_DISABLE1# and DPR for WWAN Adapters, and DEVSLP, PLN# and SMBus ALERT# for SSD Adapters, plus an I2C parent for the SSD SMBus.
The function of the GPIO_0..GPIO_11 pins depends on the Port Configuration, so they are described by gpioN-gpios properties with the function of each pin per configuration documented in the binding. The Adapter configuration is either sensed through config-gpios (CONFIG_0..3) or fixed with config-state, which defaults to WWAN PCIe.
Signed-off-by Krishna Chaitanya Chundru <[email protected]>--- .../bindings/connector/pcie-m2-b-connector.yaml | 332 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 333 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +14
-0@@ -0,0 +1,332 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-b-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key B Connector + +maintainers: + - Krishna Chaitanya Chundru <[email protected]> + +description: + A PCIe M.2 B connector node represents a physical PCIe M.2 Mechanical Key B + connector. Mechanical Key B connectors are used to connect WWAN devices to
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 24
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ the host machine over interfaces like PCIe, USB3.1 Gen1, SSIC, or USB 2.0, + selected by the Adapter's configuration pins. The slot also accepts SATA and + PCIe SSD Adapters, which use the same pins as the WWAN interfaces. + +properties: + compatible: + const: pcie-m2-b-connector + + vpcie3v3-supply: + description: A phandle to the regulator for the 3.3v/VBAT supply.
The node name doesn't match what the spec calls it ("pcie" seems redundant). Also, can a module have separate supplies for its 3.3v and VBAT?
Quoted 8 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +8
-0+ full-card-power-off-gpios: + description: GPIO output to FULL_CARD_POWER_OFF# signal. This signal is + used by the host system to turn off the entire Adapter. Refer, PCI + Express M.2 Specification r4.0, sec 3.2.13.1 for more details. + maxItems: 1 + + reset-gpios: + description: GPIO output to RESET# signal. This signal is used by the
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 43
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ host system to place the WWAN Adapter into a power-on reset condition. + Refer, PCI Express M.2 Specification r4.0, sec 3.2.13.2 for more + details. + maxItems: 1 + + w-disable1-gpios: + description: GPIO output to W_DISABLE1# signal. This signal is used by + the host system to disable the WWAN radio on the Adapter. Refer, PCI + Express M.2 Specification r4.0, sec 3.1.12.3 for more details. + maxItems: 1
Shouldn't we also have w-disable2-gpios? The first one typically controls the WWAN radio, and the second one controls GNSS.
Quoted 5 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +5
-0+ dpr-gpios: + description: GPIO output to the Dynamic Power Reduction (DPR) signal. + This signal is provided by a host system proximity sensor to the + Adapter to trigger a reduction in the radio transmit output power to + meet regulatory SAR requirements. Refer, PCI Express M.2 Specification
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 59
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ r4.0, sec 3.2.13.4 for more details. + maxItems: 1 + + alert-gpios: + description: GPIO input to the SMBus ALERT# signal (pin 44, shared with + GPIO_2). SSD Adapters assert this signal to indicate to the host that + the SMBus device requires attention. It is not present on WWAN + Adapters. Refer, PCI Express M.2 Specification r4.2, sec 3.2.14.2.1 + for more details. + maxItems: 1
It's also GNSS_IRQ in Port Config_0 and Port Config_1, so that should probably be reflected in the description. Or maybe treat all multi-function GPIOs (GPIO_0..GPIO_11) uniformly, and either define all alt functions for each of them, or none? Otherwise, this one looks out of line with the rest.
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 66
Quoted 6 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +6
-0+ i2c-parent: + $ref: /schemas/types.yaml#/definitions/phandle + description: Phandle to the host I2C controller connected to the SMBus + pins SMB_CLK and SMB_DATA (pins 40 and 42, shared with GPIO_0 and + GPIO_1). The SMBus is only present on SSD Adapters. Refer, PCI Express + M.2 Specification r4.2, sec 3.2.14.2 for more details.
It's also GNSS_SCL/GNSS_SDA in Port Config_0 and Port Config_1, so that should probably be reflected in the description.
On a broader point, I see you've decided to keep the "slow" interfaces and GPIOs out of the ports schema - is that intentional? I'm afraid that would make referencing e.g. the audio interface provider more cumbersome. Maybe we need to define a DAI subnode for it then?
Also, should pinctrl groups corresponding to different interface configurations be part of the binding?
Quoted 15 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +15
-0+ devslp-gpios: + description: GPIO output to the DEVSLP signal (pin 38). The host asserts + this signal to tell a SATA SSD to enter the Device Sleep power state. + It is only present on SATA SSD Adapters. Refer, PCI Express M.2 + Specification r4.2, sec 3.2.10.1 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO output to the Power Loss Notification (PLN#) signal + (pin 8, shared with W_DISABLE1#). The host asserts this signal to + notify a PCIe SSD that a power loss event is about to occur. WWAN + boards use w-disable1-gpios for this pin instead. Refer, PCI Express + M.2 Specification r4.2, sec 3.2.18.1 for more details. + maxItems: 1 +
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 92
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ config-gpios: + description: | + GPIO inputs sensing the four CONFIG_0..3 pins (pins 21, 69, 75 and 1 + respectively, listed in that order in this property). The Adapter + grounds or leaves unconnected (NC) each of these pins to tell the host + the Adapter type, the host interface in use and, for WWAN Adapters, the + active GPIO_0..11 Port Configuration. Boards that only ever use one + Adapter type should use config-state instead. If both properties are + present, config-gpios takes precedence. Refer, PCI Express M.2 + Specification r4.2, sec 3.2.15 and Table 3-18 for more details.
s/only ever use/only support/ ?
Shall we enforce that only one of config-gpios or config-state is present via the schema, and remove the precedence description from the text?
Quoted 21 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +21
-0+ Table 3-18. Socket 2 Add-in Card Configuration: + + CONFIG_0 CONFIG_1 CONFIG_2 CONFIG_3 Adapter Type / Host Interface Port Config + GND GND GND GND SSD - SATA N/A + GND NC GND GND SSD - PCIe N/A + GND GND NC GND WWAN - PCIe 0 + GND NC NC GND WWAN - PCIe 1 + GND GND GND NC WWAN - PCIe, USB3.1 Gen1 0 + GND NC GND NC WWAN - PCIe, USB3.1 Gen1 1 + GND GND NC NC WWAN - PCIe, USB3.1 Gen1 2 + GND NC NC NC WWAN - PCIe, USB3.1 Gen1 3 + NC GND GND GND WWAN - SSIC 0 + NC NC GND GND WWAN - SSIC 1 + NC GND NC GND WWAN - SSIC 2 + NC NC NC GND WWAN - SSIC 3 + NC GND GND NC WWAN - PCIe 2 + NC NC GND NC WWAN - PCIe 3 + NC GND NC NC WWAN - PCIe, USB3.1 Gen1 vendor-defined + NC NC NC NC No Add-in Card present N/A + minItems: 4 + maxItems: 4
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 124
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ + config-state: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Fixed Adapter configuration for boards that do not sense the CONFIG_0..3 + pins, given as the state number (0-14) of Table 3-18 of the PCI Express + M.2 Specification r4.2. It selects the Adapter type, the host interface + and, for WWAN Adapters, the Port Configuration used to interpret the + gpioN-gpios properties. Ignored if config-gpios is present. If neither + property is present, state 2 (WWAN - PCIe, Port Config_0) is assumed.
Does state 2 follow from the spec? It sounds arbitrary; perhaps mandating either config-gpios or config-state via "required" would be clearer.
Quoted 45 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +45
-0+ minimum: 0 + maximum: 14 + default: 2 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Several interfaces share the same connector pins and are + selected by the CONFIG_0..3 pins, so each port describes one group of + pins and its endpoints describe the mutually exclusive interfaces that + can be present on that group. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Pins 41, 43, 47 and 49. The endpoint number selects the interface: + 0 - PCIe lane 0 + 1 - SATA + patternProperties: + '^endpoint(@[0-9a-f]+)?$': + type: object + properties: + reg: + enum: [0, 1] + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + Pins 29, 31, 35 and 37. The endpoint number selects the interface: + 0 - USB3.1 Gen1 + 1 - SSIC + 2 - PCIe lane 1 + patternProperties: + '^endpoint(@[0-9a-f]+)?$': + type: object + properties: + reg: + enum: [0, 1, 2]
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 179
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: USB 2.0 interface (pins 7 and 9) + + anyOf: + - required: + - port@0 + - required: + - port@1
Can there be a USB 2.0-only host that provides neither port@0 nor port@1?
Quoted 22 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +22
-0+patternProperties: + '^gpio([0-9]|1[01])-gpios$': + description: | + GPIO connected to the GPIO_<N> pin of the connector, where N is the + number in the property name. The function of these pins depends on the + Port Configuration selected by config-gpios or config-state (Table 3-15 + of the PCI Express M.2 Specification r4.2, sec 3.2.13.3): + + GPIO Pin Config_0 Config_1 Config_2 Config_3 + 0 40 GNSS_SCL GNSS_SCL SIM_DETECT2 IPC_0 + 1 42 GNSS_SDA GNSS_SDA UIM_DATA2 IPC_1 + 2 44 GNSS_IRQ GNSS_IRQ UIM_CLK2 IPC_2 + 3 46 SYSCLK GNSS_0 UIM_RESET2 IPC_3 + 4 48 TX_BLANKING GNSS_1 UIM_PWR2 IPC_4 + 5 20 AUDIO_0 AUDIO_0 RFU AUDIO_0 + 6 22 AUDIO_1 AUDIO_1 RFU AUDIO_1 + 7 24 AUDIO_2 AUDIO_2 RFU IPC_5/AUDIO_2 + 8 28 AUDIO_3 AUDIO_3 PLA_S2# IPC_6/AUDIO_3 + 9 10 LED_1# LED_1# LED_1# DAS/DSS/IPC_7 + 10 26 W_DISABLE2# W_DISABLE2# W_DISABLE2# HSIC_STROBE + 11 23 WoWWAN# WoWWAN# WoWWAN# HSIC_DATA +
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 212
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ The IPC_0..7 functions of Port Config_3 are vendor defined, as are all + functions in CONFIG state 14. + + On SSD Adapters (CONFIG states 0 and 1) the same pins are SMB_CLK + (GPIO_0), SMB_DATA (GPIO_1), ALERT# (GPIO_2), PLA_S2# (GPIO_8), and + LED_1# or, on SATA, DAS/DSS (GPIO_9). + + Only list the pins that are wired to a host GPIO. Pins used as a bus + signal in the selected Port Configuration (I2C, I2S/SLIMbus, HSIC) are + not GPIOs and are not described by these properties.
Should those bus signals be reflected in the binding though?
Best regards,
Alexey
Rob Herring
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key B connector
Quoted 58 lines · Alexey Charkov
Hi Krishna,
Quoted 54 lines · Krishna Chaitanya Chundru
Add the devicetree binding for PCIe M.2 Mechanical Key B connector defined in the PCI Express M.2 Specification, r4.2, sec 3.2.19.1. This connector is used to attach WWAN Adapters to the host machine over interfaces such as PCIe, USB3.1 Gen1, SSIC, or USB 2.0. The slot also accepts SATA and PCIe SSD Adapters, which use the same pins.
Interfaces that share connector pins are described as one graph port per pin group, with the endpoint number selecting between the mutually exclusive interfaces.
The connector provides a primary power supply of 3.3V/VBAT, along with optional GPIO signals: FULL_CARD_POWER_OFF#, RESET#, W_DISABLE1# and DPR for WWAN Adapters, and DEVSLP, PLN# and SMBus ALERT# for SSD Adapters, plus an I2C parent for the SSD SMBus.
The function of the GPIO_0..GPIO_11 pins depends on the Port Configuration, so they are described by gpioN-gpios properties with the function of each pin per configuration documented in the binding. The Adapter configuration is either sensed through config-gpios (CONFIG_0..3) or fixed with config-state, which defaults to WWAN PCIe.
Signed-off-by Krishna Chaitanya Chundru <[email protected]>--- .../bindings/connector/pcie-m2-b-connector.yaml | 332 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 333 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +20
-0@@ -0,0 +1,332 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-b-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key B Connector + +maintainers: + - Krishna Chaitanya Chundru <[email protected]> + +description: + A PCIe M.2 B connector node represents a physical PCIe M.2 Mechanical Key B + connector. Mechanical Key B connectors are used to connect WWAN devices to + the host machine over interfaces like PCIe, USB3.1 Gen1, SSIC, or USB 2.0, + selected by the Adapter's configuration pins. The slot also accepts SATA and + PCIe SSD Adapters, which use the same pins as the WWAN interfaces. + +properties: + compatible:
Quoted 8 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 24
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +4
-0+ const: pcie-m2-b-connector + + vpcie3v3-supply: + description: A phandle to the regulator for the 3.3v/VBAT supply.The node name doesn't match what the spec calls it ("pcie" seems redundant). Also, can a module have separate supplies for its 3.3v and VBAT?
Yes, but 'vpcie3v3' is already the name we use elsewhere for PCI.
Don't know about VBAT comment...
Rob
Rob Herring (Arm)
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key B connector
In reply to Krishna Chaitanya ChundruQuoted 21 lines · Krishna Chaitanya Chundru
Add the devicetree binding for PCIe M.2 Mechanical Key B connector defined in the PCI Express M.2 Specification, r4.2, sec 3.2.19.1. This connector is used to attach WWAN Adapters to the host machine over interfaces such as PCIe, USB3.1 Gen1, SSIC, or USB 2.0. The slot also accepts SATA and PCIe SSD Adapters, which use the same pins.
Interfaces that share connector pins are described as one graph port per pin group, with the endpoint number selecting between the mutually exclusive interfaces.
The connector provides a primary power supply of 3.3V/VBAT, along with optional GPIO signals: FULL_CARD_POWER_OFF#, RESET#, W_DISABLE1# and DPR for WWAN Adapters, and DEVSLP, PLN# and SMBus ALERT# for SSD Adapters, plus an I2C parent for the SSD SMBus.
The function of the GPIO_0..GPIO_11 pins depends on the Port Configuration, so they are described by gpioN-gpios properties with the function of each pin per configuration documented in the binding. The Adapter configuration is either sensed through config-gpios (CONFIG_0..3) or fixed with config-state, which defaults to WWAN PCIe.
Quoted 6 lines
Signed-off-by Krishna Chaitanya Chundru <[email protected]>--- .../bindings/connector/pcie-m2-b-connector.yaml | 332 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 333 insertions(+)
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:Documentation/devicetree/bindings/connector/pcie-m2-b-connector.example.dtb: connector (pcie-m2-b-connector): config-gpios: [[4294967295,124,0],[4294967295,125,0,0],[4294967295,127,0]] has less than 4 items
from schema $id: http://devicetree.org/schemas/connector/pcie-m2-b-connector.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Rob Herring
maintainerRe: [PATCH v2 1/4] dt-bindings: connector: Add PCIe M.2 Mechanical Key B connector
In reply to Krishna Chaitanya ChundruQuoted 256 lines · Krishna Chaitanya Chundru
Add the devicetree binding for PCIe M.2 Mechanical Key B connector defined in the PCI Express M.2 Specification, r4.2, sec 3.2.19.1. This connector is used to attach WWAN Adapters to the host machine over interfaces such as PCIe, USB3.1 Gen1, SSIC, or USB 2.0. The slot also accepts SATA and PCIe SSD Adapters, which use the same pins.
Interfaces that share connector pins are described as one graph port per pin group, with the endpoint number selecting between the mutually exclusive interfaces.
The connector provides a primary power supply of 3.3V/VBAT, along with optional GPIO signals: FULL_CARD_POWER_OFF#, RESET#, W_DISABLE1# and DPR for WWAN Adapters, and DEVSLP, PLN# and SMBus ALERT# for SSD Adapters, plus an I2C parent for the SSD SMBus.
The function of the GPIO_0..GPIO_11 pins depends on the Port Configuration, so they are described by gpioN-gpios properties with the function of each pin per configuration documented in the binding. The Adapter configuration is either sensed through config-gpios (CONFIG_0..3) or fixed with config-state, which defaults to WWAN PCIe.
Signed-off-by Krishna Chaitanya Chundru <[email protected]>--- .../bindings/connector/pcie-m2-b-connector.yaml | 332 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 333 insertions(+)Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +223
-0@@ -0,0 +1,332 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/connector/pcie-m2-b-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: PCIe M.2 Mechanical Key B Connector + +maintainers: + - Krishna Chaitanya Chundru <[email protected]> + +description: + A PCIe M.2 B connector node represents a physical PCIe M.2 Mechanical Key B + connector. Mechanical Key B connectors are used to connect WWAN devices to + the host machine over interfaces like PCIe, USB3.1 Gen1, SSIC, or USB 2.0, + selected by the Adapter's configuration pins. The slot also accepts SATA and + PCIe SSD Adapters, which use the same pins as the WWAN interfaces. + +properties: + compatible: + const: pcie-m2-b-connector + + vpcie3v3-supply: + description: A phandle to the regulator for the 3.3v/VBAT supply. + + full-card-power-off-gpios: + description: GPIO output to FULL_CARD_POWER_OFF# signal. This signal is + used by the host system to turn off the entire Adapter. Refer, PCI + Express M.2 Specification r4.0, sec 3.2.13.1 for more details. + maxItems: 1 + + reset-gpios: + description: GPIO output to RESET# signal. This signal is used by the + host system to place the WWAN Adapter into a power-on reset condition. + Refer, PCI Express M.2 Specification r4.0, sec 3.2.13.2 for more + details. + maxItems: 1 + + w-disable1-gpios: + description: GPIO output to W_DISABLE1# signal. This signal is used by + the host system to disable the WWAN radio on the Adapter. Refer, PCI + Express M.2 Specification r4.0, sec 3.1.12.3 for more details. + maxItems: 1 + + dpr-gpios: + description: GPIO output to the Dynamic Power Reduction (DPR) signal. + This signal is provided by a host system proximity sensor to the + Adapter to trigger a reduction in the radio transmit output power to + meet regulatory SAR requirements. Refer, PCI Express M.2 Specification + r4.0, sec 3.2.13.4 for more details. + maxItems: 1 + + alert-gpios: + description: GPIO input to the SMBus ALERT# signal (pin 44, shared with + GPIO_2). SSD Adapters assert this signal to indicate to the host that + the SMBus device requires attention. It is not present on WWAN + Adapters. Refer, PCI Express M.2 Specification r4.2, sec 3.2.14.2.1 + for more details. + maxItems: 1 + + i2c-parent: + $ref: /schemas/types.yaml#/definitions/phandle + description: Phandle to the host I2C controller connected to the SMBus + pins SMB_CLK and SMB_DATA (pins 40 and 42, shared with GPIO_0 and + GPIO_1). The SMBus is only present on SSD Adapters. Refer, PCI Express + M.2 Specification r4.2, sec 3.2.14.2 for more details. + + devslp-gpios: + description: GPIO output to the DEVSLP signal (pin 38). The host asserts + this signal to tell a SATA SSD to enter the Device Sleep power state. + It is only present on SATA SSD Adapters. Refer, PCI Express M.2 + Specification r4.2, sec 3.2.10.1 for more details. + maxItems: 1 + + pln-gpios: + description: GPIO output to the Power Loss Notification (PLN#) signal + (pin 8, shared with W_DISABLE1#). The host asserts this signal to + notify a PCIe SSD that a power loss event is about to occur. WWAN + boards use w-disable1-gpios for this pin instead. Refer, PCI Express + M.2 Specification r4.2, sec 3.2.18.1 for more details. + maxItems: 1 + + config-gpios: + description: | + GPIO inputs sensing the four CONFIG_0..3 pins (pins 21, 69, 75 and 1 + respectively, listed in that order in this property). The Adapter + grounds or leaves unconnected (NC) each of these pins to tell the host + the Adapter type, the host interface in use and, for WWAN Adapters, the + active GPIO_0..11 Port Configuration. Boards that only ever use one + Adapter type should use config-state instead. If both properties are + present, config-gpios takes precedence. Refer, PCI Express M.2 + Specification r4.2, sec 3.2.15 and Table 3-18 for more details. + + Table 3-18. Socket 2 Add-in Card Configuration: + + CONFIG_0 CONFIG_1 CONFIG_2 CONFIG_3 Adapter Type / Host Interface Port Config + GND GND GND GND SSD - SATA N/A + GND NC GND GND SSD - PCIe N/A + GND GND NC GND WWAN - PCIe 0 + GND NC NC GND WWAN - PCIe 1 + GND GND GND NC WWAN - PCIe, USB3.1 Gen1 0 + GND NC GND NC WWAN - PCIe, USB3.1 Gen1 1 + GND GND NC NC WWAN - PCIe, USB3.1 Gen1 2 + GND NC NC NC WWAN - PCIe, USB3.1 Gen1 3 + NC GND GND GND WWAN - SSIC 0 + NC NC GND GND WWAN - SSIC 1 + NC GND NC GND WWAN - SSIC 2 + NC NC NC GND WWAN - SSIC 3 + NC GND GND NC WWAN - PCIe 2 + NC NC GND NC WWAN - PCIe 3 + NC GND NC NC WWAN - PCIe, USB3.1 Gen1 vendor-defined + NC NC NC NC No Add-in Card present N/A + minItems: 4 + maxItems: 4 + + config-state: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Fixed Adapter configuration for boards that do not sense the CONFIG_0..3 + pins, given as the state number (0-14) of Table 3-18 of the PCI Express + M.2 Specification r4.2. It selects the Adapter type, the host interface + and, for WWAN Adapters, the Port Configuration used to interpret the + gpioN-gpios properties. Ignored if config-gpios is present. If neither + property is present, state 2 (WWAN - PCIe, Port Config_0) is assumed. + minimum: 0 + maximum: 14 + default: 2 + + clocks: + description: 32.768 KHz Suspend Clock (SUSCLK) input from the host system to + the M.2 card. Refer, PCI Express M.2 Specification r4.0, sec 3.1.12.1 for + more details. + maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: OF graph bindings modeling the interfaces exposed on the + connector. Several interfaces share the same connector pins and are + selected by the CONFIG_0..3 pins, so each port describes one group of + pins and its endpoints describe the mutually exclusive interfaces that + can be present on that group. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Pins 41, 43, 47 and 49. The endpoint number selects the interface: + 0 - PCIe lane 0 + 1 - SATA + patternProperties: + '^endpoint(@[0-9a-f]+)?$': + type: object + properties: + reg: + enum: [0, 1] + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + Pins 29, 31, 35 and 37. The endpoint number selects the interface: + 0 - USB3.1 Gen1 + 1 - SSIC + 2 - PCIe lane 1 + patternProperties: + '^endpoint(@[0-9a-f]+)?$': + type: object + properties: + reg: + enum: [0, 1, 2] + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: USB 2.0 interface (pins 7 and 9) + + anyOf: + - required: + - port@0 + - required: + - port@1 + +patternProperties: + '^gpio([0-9]|1[01])-gpios$': + description: | + GPIO connected to the GPIO_<N> pin of the connector, where N is the + number in the property name. The function of these pins depends on the + Port Configuration selected by config-gpios or config-state (Table 3-15 + of the PCI Express M.2 Specification r4.2, sec 3.2.13.3): + + GPIO Pin Config_0 Config_1 Config_2 Config_3 + 0 40 GNSS_SCL GNSS_SCL SIM_DETECT2 IPC_0 + 1 42 GNSS_SDA GNSS_SDA UIM_DATA2 IPC_1 + 2 44 GNSS_IRQ GNSS_IRQ UIM_CLK2 IPC_2 + 3 46 SYSCLK GNSS_0 UIM_RESET2 IPC_3 + 4 48 TX_BLANKING GNSS_1 UIM_PWR2 IPC_4 + 5 20 AUDIO_0 AUDIO_0 RFU AUDIO_0 + 6 22 AUDIO_1 AUDIO_1 RFU AUDIO_1 + 7 24 AUDIO_2 AUDIO_2 RFU IPC_5/AUDIO_2 + 8 28 AUDIO_3 AUDIO_3 PLA_S2# IPC_6/AUDIO_3 + 9 10 LED_1# LED_1# LED_1# DAS/DSS/IPC_7 + 10 26 W_DISABLE2# W_DISABLE2# W_DISABLE2# HSIC_STROBE + 11 23 WoWWAN# WoWWAN# WoWWAN# HSIC_DATA + + The IPC_0..7 functions of Port Config_3 are vendor defined, as are all + functions in CONFIG state 14. + + On SSD Adapters (CONFIG states 0 and 1) the same pins are SMB_CLK + (GPIO_0), SMB_DATA (GPIO_1), ALERT# (GPIO_2), PLA_S2# (GPIO_8), and + LED_1# or, on SATA, DAS/DSS (GPIO_9). + + Only list the pins that are wired to a host GPIO. Pins used as a bus + signal in the selected Port Configuration (I2C, I2S/SLIMbus, HSIC) are + not GPIOs and are not described by these properties. + maxItems: 1 + +required: + - compatible + - vpcie3v3-supply + +additionalProperties: false + +examples: + # PCI M.2 Key B connector for WWAN with PCIe interface + - |
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml line 233
Quoted 10 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +10
-0+ #include <dt-bindings/gpio/gpio.h> + + connector { + compatible = "pcie-m2-b-connector"; + vpcie3v3-supply = <&vreg_wwan>; + full-card-power-off-gpios = <&tlmm 121 GPIO_ACTIVE_LOW>; + w-disable1-gpios = <&tlmm 122 GPIO_ACTIVE_LOW>; + gpio10-gpios = <&tlmm 123 GPIO_ACTIVE_LOW>; + gpio11-gpios = <&tlmm 128 GPIO_ACTIVE_LOW>; + /* A zero phandle marks a CONFIG pin that is not wired to a host GPIO */
How would that work exactly?
In any case, that is not supported in examples as the report gave.
Quoted 4 lines
Documentation/devicetree/bindings/connector/pcie-m2-b-connector.yaml new file +4
-0+ config-gpios = <&tlmm 124 GPIO_ACTIVE_HIGH>, + <&tlmm 125 GPIO_ACTIVE_HIGH>, + <0>, + <&tlmm 127 GPIO_ACTIVE_HIGH>;
PATCH v2 2/4 power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors
In reply to Krishna Chaitanya ChundruAdd support for handling the power sequence of the PCIe M.2 Key B connectors. These connectors are used to attach WWAN Adapters to the host machine over interfaces such as PCIe, USB3.1 Gen1, SSIC, or USB 2.0.
Currently, this driver only supports driving the 3.3V/VBAT power supply along with the FULL_CARD_POWER_OFF#, RESET#, and W_DISABLE1# GPIOs as a single "pcie" target, since Key B Adapters expose only a discoverable PCIe/USB interface and no non-discoverable bus (unlike Key E's UART-attached Bluetooth device), so no serdev creation is needed. The other signals described in the binding are not supported yet.
--- drivers/power/sequencing/pwrseq-pcie-m2.c | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
drivers/power/sequencing/pwrseq-pcie-m2.c +70 -0
@@ -39,6 +39,8 @@ struct pwrseq_pcie_m2_ctx {struct notifier_block nb;struct gpio_desc *w_disable1_gpio;struct gpio_desc *w_disable2_gpio; +struct gpio_desc *full_card_power_off_gpio; +struct gpio_desc *reset_gpio;struct device *dev;struct list_head pci_devices;struct mutex list_lock;
@@ -135,6 +137,45 @@ static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data = { .disable = pwrseq_pci_m2_e_pcie_disable, }; +static int pwrseq_pci_m2_b_pcie_enable (struct pwrseq_device *pwrseq) +{ +struct pwrseq_pcie_m2_ctx *ctx =pwrseq_device_get_drvdata (pwrseq); +int ret; + + ret =gpiod_set_value_cansleep (ctx->full_card_power_off_gpio,0 ); +if (ret) +return ret; + + ret =gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +if (ret) +return ret; + +return gpiod_set_value_cansleep (ctx->w_disable1_gpio,0 ); +} + +static int pwrseq_pci_m2_b_pcie_disable (struct pwrseq_device *pwrseq) +{ +struct pwrseq_pcie_m2_ctx *ctx =pwrseq_device_get_drvdata (pwrseq); +int ret; + + ret =gpiod_set_value_cansleep (ctx->w_disable1_gpio,1 ); +if (ret) +return ret; + + ret =gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +if (ret) +return ret; + +return gpiod_set_value_cansleep (ctx->full_card_power_off_gpio,1 ); +} + +static const struct pwrseq_unit_data pwrseq_pcie_m2_b_pcie_unit_data = { + .name ="pcie-enable" , + .deps = pwrseq_pcie_m2_unit_deps, + .enable = pwrseq_pci_m2_b_pcie_enable, + .disable = pwrseq_pci_m2_b_pcie_disable, +}; +static const struct pwrseq_unit_data pwrseq_pcie_m2_m_pcie_unit_data = { .name ="pcie-enable" , .deps = pwrseq_pcie_m2_unit_deps,
@@ -166,6 +207,11 @@ static const struct pwrseq_target_data pwrseq_pcie_m2_e_pcie_target_data = { .is_controllable = pwrseq_pci_m2_e_pcie_is_controllable, }; +static const struct pwrseq_target_data pwrseq_pcie_m2_b_pcie_target_data = { + .name ="pcie" , + .unit = &pwrseq_pcie_m2_b_pcie_unit_data, +}; +static const struct pwrseq_target_data pwrseq_pcie_m2_m_pcie_target_data = { .name ="pcie" , .unit = &pwrseq_pcie_m2_m_pcie_unit_data,
@@ -177,6 +223,11 @@ static const struct pwrseq_target_data *pwrseq_pcie_m2_e_targets[] = {NULL }; +static const struct pwrseq_target_data *pwrseq_pcie_m2_b_targets[] = { + &pwrseq_pcie_m2_b_pcie_target_data, +NULL +}; +static const struct pwrseq_target_data *pwrseq_pcie_m2_m_targets[] = { &pwrseq_pcie_m2_m_pcie_target_data,NULL
@@ -186,6 +237,10 @@ static const struct pwrseq_pcie_m2_pdata pwrseq_pcie_m2_e_of_data = { .targets = pwrseq_pcie_m2_e_targets, }; +static const struct pwrseq_pcie_m2_pdata pwrseq_pcie_m2_b_of_data = { + .targets = pwrseq_pcie_m2_b_targets, +}; +static const struct pwrseq_pcie_m2_pdata pwrseq_pcie_m2_m_of_data = { .targets = pwrseq_pcie_m2_m_targets, };
@@ -577,6 +632,17 @@ static int pwrseq_pcie_m2_probe(struct platform_device *pdev) goto err_free_regulators; } + ctx->full_card_power_off_gpio =devm_gpiod_get_optional (dev,"full-card-power-off" , +GPIOD_OUT_HIGH ); +if (IS_ERR (ctx->full_card_power_off_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->full_card_power_off_gpio), +"Failed to get the FULL_CARD_POWER_OFF# GPIO\n" ); + + ctx->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (ctx->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio), +"Failed to get the RESET# GPIO\n" ); + config.parent = dev; config.owner =THIS_MODULE ; config.drvdata = ctx;
@@ -641,6 +707,10 @@ static const struct of_device_id pwrseq_pcie_m2_of_match[] = { .compatible = "pcie-m2-e-connector", .data = &pwrseq_pcie_m2_e_of_data, }, + { + .compatible = "pcie-m2-b-connector", + .data = &pwrseq_pcie_m2_b_of_data, + }, { } };MODULE_DEVICE_TABLE (of, pwrseq_pcie_m2_of_match);
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v2 2/4] power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] power: sequencing: pcie-m2: regulator leak on GPIO error in pwrseq_pcie_m2_probe() - [Low] power…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] power: sequencing: pcie-m2: regulator leak on GPIO error in pwrseq_pcie_m2_probe()
- [Low] power: sequencing: pcie-m2: missing GPIO rollback in pwrseq_pci_m2_b_pcie_enable()
--
commit 7e388f1a5a5b0e7dcbfd3500f89d85602dad1287
Author: Krishna Chaitanya Chundru <[email protected]>
power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors
This commit adds power sequencing support for PCIe M.2 Key B connectors, handling the power supplies along with the FULL_CARD_POWER_OFF#, RESET#, and W_DISABLE1# GPIOs.
Quoted 4 lines
drivers/power/sequencing/pwrseq-pcie-m2.c +0
-0
[ ... ]
Quoted 9 lines
drivers/power/sequencing/pwrseq-pcie-m2.c +5
-0@@ -135,6 +137,45 @@ static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data = { .disable = pwrseq_pci_m2_e_pcie_disable, }; +static int pwrseq_pci_m2_b_pcie_enable (struct pwrseq_device *pwrseq) +{ +struct pwrseq_pcie_m2_ctx *ctx =pwrseq_device_get_drvdata (pwrseq); +int ret; +
drivers/power/sequencing/pwrseq-pcie-m2.c static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data = { · line 154
Quoted 10 lines
drivers/power/sequencing/pwrseq-pcie-m2.c +10
-0+ ret =gpiod_set_value_cansleep (ctx->full_card_power_off_gpio,0 ); +if (ret) +return ret; + + ret =gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +if (ret) +return ret; + +return gpiod_set_value_cansleep (ctx->w_disable1_gpio,0 ); +}
[Severity: Low]
If gpiod_set_value_cansleep() fails on ctx->reset_gpio or ctx->w_disable1_gpio, should this restore the earlier GPIOs back to 1 before returning?
When unit->enable() fails, pwrseq_unit_enable() disables the regulator dependency units without calling unit->disable(), leaving ctx->full_card_power_off_gpio (and ctx->reset_gpio) deasserted while power is off.
[ ... ]
Quoted 5 lines
drivers/power/sequencing/pwrseq-pcie-m2.c +1
-0@@ -577,6 +632,17 @@ static int pwrseq_pcie_m2_probe(struct platform_device *pdev) goto err_free_regulators; } + ctx->full_card_power_off_gpio = devm_gpiod_get_optional(dev, "full-card-power-off",
drivers/power/sequencing/pwrseq-pcie-m2.c static int pwrseq_pcie_m2_probe(struct platform_device *pdev) · line 645
Quoted 10 lines
drivers/power/sequencing/pwrseq-pcie-m2.c +10
-0+ GPIOD_OUT_HIGH); +if (IS_ERR (ctx->full_card_power_off_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->full_card_power_off_gpio), +"Failed to get the FULL_CARD_POWER_OFF# GPIO\n" ); + + ctx->reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (ctx->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio), +"Failed to get the RESET# GPIO\n" ); +
[Severity: Medium]
Do these error paths leak ctx->regs and the regulator references acquired by of_regulator_bulk_get_all()?
Unlike the w_disable1_gpio and w_disable2_gpio checks right above, returning directly here bypasses the err_free_regulators label that calls regulator_bulk_free() and kfree(ctx->regs).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v2 2/4] power: sequencing: pcie-m2: Add support for PCIe M.2 Key B connectors
In reply to Krishna Chaitanya ChundruHi Krishna,
Quoted 40 lines · Krishna Chaitanya Chundru
Add support for handling the power sequence of the PCIe M.2 Key B connectors. These connectors are used to attach WWAN Adapters to the host machine over interfaces such as PCIe, USB3.1 Gen1, SSIC, or USB 2.0.
Currently, this driver only supports driving the 3.3V/VBAT power supply along with the FULL_CARD_POWER_OFF#, RESET#, and W_DISABLE1# GPIOs as a single "pcie" target, since Key B Adapters expose only a discoverable PCIe/USB interface and no non-discoverable bus (unlike Key E's UART-attached Bluetooth device), so no serdev creation is needed. The other signals described in the binding are not supported yet.
Signed-off-by Krishna Chaitanya Chundru <[email protected]>--- drivers/power/sequencing/pwrseq-pcie-m2.c | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)drivers/power/sequencing/pwrseq-pcie-m2.c +6
-0@@ -39,6 +39,8 @@ struct pwrseq_pcie_m2_ctx {struct notifier_block nb;struct gpio_desc *w_disable1_gpio;struct gpio_desc *w_disable2_gpio; +struct gpio_desc *full_card_power_off_gpio; +struct gpio_desc *reset_gpio;struct device *dev;struct list_head pci_devices;struct mutex list_lock;@@ -135,6 +137,45 @@ static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data = { .disable = pwrseq_pci_m2_e_pcie_disable, }; +static int pwrseq_pci_m2_b_pcie_enable (struct pwrseq_device *pwrseq) +{ +struct pwrseq_pcie_m2_ctx *ctx =pwrseq_device_get_drvdata (pwrseq); +int ret;
drivers/power/sequencing/pwrseq-pcie-m2.c static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data = { · line 153
Quoted 10 lines
drivers/power/sequencing/pwrseq-pcie-m2.c +10
-0+ + ret =gpiod_set_value_cansleep (ctx->full_card_power_off_gpio,0 ); +if (ret) +return ret; + + ret =gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +if (ret) +return ret; + +return gpiod_set_value_cansleep (ctx->w_disable1_gpio,0 );
Can this signal be exposed as an rfkill device instead? Otherwise the pwrseq driver hogs it enabled with no way for userspace to control the radio power, and WWAN power draw is quite non-negligible for portable devices. Ditto for w_disable2_gpio (GNSS).
I'm also wondering if the WWAN-related signals should be skipped altogether for non-WWAN module configs?
Best regards,
Alexey
PATCH v2 3/4 arm64: dts: qcom: glymur-crd: Describe the PCIe M.2 Key B connector
In reply to Krishna Chaitanya ChundruThe Glymur CRD has a WWAN M.2 slot connected to PCIe6, whose vreg_wwan supply is described on the PCIe6 Root Port. Describe the slot as a PCIe M.2 Mechanical Key B connector that owns the supply, so that the slot power is controlled through the pwrseq-pcie-m2 driver and the PCI pwrctrl framework, like the other M.2 connectors on this platform.
--- arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/glymur-crd.dtsi +27 -2
@@ -230,6 +230,27 @@ vreg_wwan: regulator-wwan { pinctrl-names = "default"; }; + wwan-connector { + compatible = "pcie-m2-b-connector"; + vpcie3v3-supply = <&vreg_wwan>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + wwan_m2_pcie_ep: endpoint@0 { + reg = <0>; + remote-endpoint = <&pcie6_port0_ep>; + }; + }; + }; + }; + sound { compatible = "qcom,glymur-sndcard"; model = "GLYMUR-CRD";
@@ -654,10 +675,14 @@ &pcie6_phy { }; &pcie6_port0 { - vpcie3v3-supply = <&vreg_wwan>; - reset-gpios = <&tlmm 149 GPIO_ACTIVE_LOW>; wake-gpios = <&tlmm 151 GPIO_ACTIVE_LOW>; + + port { + pcie6_port0_ep: endpoint { + remote-endpoint = <&wwan_m2_pcie_ep>; + }; + }; }; &pmh0110_f_e1_gpios {
Signature · 1 line
2.34.1
PATCH v2 4/4 arm64: dts: qcom: nord-rrd: Describe the PCIe M.2 Key B connector
In reply to Krishna Chaitanya ChundruThe Nord RRD has an M.2 WWAN slot connected to PCIe3, but neither the slot supply nor its power control is described. Describe the slot as a PCIe M.2 Mechanical Key B connector, so that the slot power is controlled through the pwrseq-pcie-m2 driver and the PCI pwrctrl framework.
The slot is powered by the vreg_wwan fixed regulator, which is enabled by the MODEM_SW_PWR_EN GPIO. The MOD_FULL_CARD_POWER_ON_OFF GPIO drives FULL_CARD_POWER_OFF#, which the Adapter treats as asserted when the signal is low, so describe it as active low.
--- arch/arm64/boot/dts/qcom/nord-rrd.dts | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
arch/arm64/boot/dts/qcom/nord-rrd.dts +40 -0
@@ -100,6 +100,40 @@ vreg_wcn_core_vh_1p95: regulator-wcn-core-vh-1p95 { enable-active-high; }; + vreg_wwan: regulator-wwan { + compatible = "regulator-fixed"; + + regulator-name = "vreg_wwan"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&tlmm 54 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + wwan-connector { + compatible = "pcie-m2-b-connector"; + vpcie3v3-supply = <&vreg_wwan>; + + full-card-power-off-gpios = <&tlmm 53 GPIO_ACTIVE_LOW>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + wwan_m2_pcie_ep: endpoint@0 { + reg = <0>; + remote-endpoint = <&pcie3_port0_ep>; + }; + }; + }; + }; + wcn7850-pmu { compatible = "qcom,wcn7850-pmu";
@@ -537,6 +571,12 @@ &pcie3 { &pcie3_port0 { reset-gpios = <&tlmm 11 GPIO_ACTIVE_LOW>; wake-gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + + port { + pcie3_port0_ep: endpoint { + remote-endpoint = <&wwan_m2_pcie_ep>; + }; + }; }; &qupv3_0 {
Signature · 1 line
2.34.1
[email protected]
AI reviewSashiko has finished reviewing this 4-patch series:
Sashiko has finished reviewing this 4-patch series:
- Patches 1, 3, and 4: no issues found.
- Patch 2 ("power: sequencing: pcie-m2: Add support for PCIe M.2..."): 2 potential issues (1 Medium, 1 Low)
A detailed review has been sent as a separate reply to patch 2.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]