spi: dt-bindings: microchip,pic32mzda-spi: Convert to DT schema
Subsystems (3)
PATCH v2 1/1 spi: dt-bindings: microchip,pic32mzda-spi: Convert to DT schema
Convert Microchip PIC32 SPI controller devicetree binding from legacy text format to DT schema.
---
Changelog:
Changes since v1:
- Rename schema file to microchip,pic32mzda-spi.yaml
- Update subject prefix to match SPI DT binding conventions
Link to v1: https://lore.kernel.org/all/[email protected]/
--- .../bindings/spi/microchip,pic32mzda-spi.yaml | 78 +++++++++++++++++++ .../bindings/spi/microchip,spi-pic32.txt | 34 -------- 2 files changed, 78 insertions(+), 34 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/microchip,pic32mzda-spi.yaml delete mode 100644 Documentation/devicetree/bindings/spi/microchip,spi-pic32.txt
Documentation/devicetree/bindings/spi/microchip,pic32mzda-spi.yaml new file +78 -0
@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/microchip,pic32mzda-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip PIC32MZDA SPI Controller + +maintainers: + - Thomas Bogendoerfer <[email protected]> + +allOf: + - $ref: spi-controller.yaml# + +properties: + compatible: + const: microchip,pic32mzda-spi + + reg: + maxItems: 1 + + interrupts: + items: + - description: Fault interrupt + - description: Receive interrupt + - description: Transmit interrupt + + interrupt-names: + items: + - const: fault + - const: rx + - const: tx + + clocks: + maxItems: 1 + + clock-names: + items: + - const: mck0 + + dmas: + items: + - description: RX DMA channel + - description: TX DMA channel + + dma-names: + items: + - const: spi-rx + - const: spi-tx + +required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/gpio/gpio.h> + + spi@1f821000 { + compatible = "microchip,pic32mzda-spi"; + reg = <0x1f821000 0x200>; + interrupts = <109 IRQ_TYPE_LEVEL_HIGH>, + <110 IRQ_TYPE_LEVEL_HIGH>, + <111 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "fault", "rx", "tx"; + clocks = <&PBCLK2>; + clock-names = "mck0"; + cs-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; + dmas = <&dma 134>, <&dma 135>; + dma-names = "spi-rx", "spi-tx"; + };
Documentation/devicetree/bindings/spi/microchip,spi-pic32.txt deleted +0 -34
@@ -1,34 +0,0 @@ -Microchip PIC32 SPI Master controller - -Required properties: -- compatible: Should be "microchip,pic32mzda-spi". -- reg: Address and length of register space for the device. -- interrupts: Should contain all three spi interrupts in sequence - of <fault-irq>, <receive-irq>, <transmit-irq>. -- interrupt-names: Should be "fault", "rx", "tx" in order. -- clocks: Phandle of the clock generating SPI clock on the bus. -- clock-names: Should be "mck0". -- cs-gpios: Specifies the gpio pins to be used for chipselects. - See: Documentation/devicetree/bindings/spi/spi-bus.txt - -Optional properties: -- dmas: Two or more DMA channel specifiers following the convention outlined - in Documentation/devicetree/bindings/dma/dma.txt -- dma-names: Names for the dma channels. There must be at least one channel - named "spi-tx" for transmit and named "spi-rx" for receive. - -Example: - -spi1: spi@1f821000 { - compatible = "microchip,pic32mzda-spi"; - reg = <0x1f821000 0x200>; - interrupts = <109 IRQ_TYPE_LEVEL_HIGH>, - <110 IRQ_TYPE_LEVEL_HIGH>, - <111 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "fault", "rx", "tx"; - clocks = <&PBCLK2>; - clock-names = "mck0"; - cs-gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; - dmas = <&dma 134>, <&dma 135>; - dma-names = "spi-rx", "spi-tx"; -};
Signature · 1 line
2.34.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `cs-gpios` property was omitted from the `required` list during the DT schema conversion. --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The cs-gpios property was omitted from the required list during the DT schema conversion. --
commit 418415dcdca7e4f555bde32db4703c62c250ee78
Author: Udaya Kiran Challa <[email protected]>
spi: dt-bindings: microchip,pic32mzda-spi: Convert to DT schema
Convert Microchip PIC32 SPI controller devicetree binding from legacy text format to DT schema.
Quoted 5 lines
Documentation/devicetree/bindings/spi/microchip,pic32mzda-spi.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/spi/microchip,pic32mzda-spi.yaml line 59
Quoted 9 lines
Documentation/devicetree/bindings/spi/microchip,pic32mzda-spi.yaml new file +9
-0+required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + - clock-names + +unevaluatedProperties: false
[Severity: Medium]
Did this conversion intentionally drop cs-gpios from the required properties list?
Looking at the legacy text binding being removed, cs-gpios was explicitly listed under the required properties section. Since the PIC32 SPI driver returns -EINVAL if the GPIO chip select is missing during setup, omitting it here might allow incomplete device trees to pass schema validation but fail later at probe time.
Could we add cs-gpios back to the required list to maintain parity with the old binding constraints?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 2 lines · Udaya Kiran Challa
Convert Microchip PIC32 SPI controller devicetree binding from legacy text format to DT schema.
Please mention here that you dropped requirement of 'cs-gpios' because it is not a mandatory in hardware design nor in current Linux driver... and then CHECK it actually against drivers, which will lead you to conclusion that maybe it is wrong decision...
Quoted 7 lines
Signed-off-by Udaya Kiran Challa <[email protected]>---
Changelog:
Changes since v1:
- Rename schema file to microchip,pic32mzda-spi.yaml
- Update subject prefix to match SPI DT binding conventions
Best regards,
Krzysztof
Quoted 7 lines
Quoted 2 lines
Convert Microchip PIC32 SPI controller devicetree binding from legacy text format to DT schema.
Please mention here that you dropped requirement of 'cs-gpios' because it is not a mandatory in hardware design nor in current Linux driver... and then CHECK it actually against drivers, which will lead you to conclusion that maybe it is wrong decision...
Thank you Krzysztof
I rechecked the driver and found that it uses spi_get_csgpiod() for chip-select handling and sets host->num_chipselect = 1. Therefore, dropping the cs-gpios requirement during the conversion was not justified.
I'll restore cs-gpios as a required property and resend the series with an updated changelog.
Regards,
Udaya Kiran Challa