Add support for nuvoton ma35d1 qspi controller
Subsystems (3)
cover Add support for nuvoton ma35d1 qspi controller
This patch series adds qspi driver for the nuvoton ma35 ARMv8 SoC. It includes DT binding documentation and the ma35d1 qspi driver.
Chi-Wen Weng (2):
dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
spi: Add Nuvoton MA35D1 QSPI controller support
.../bindings/spi/nuvoton,ma35d1-qspi.yaml | 61 ++ drivers/spi/Kconfig | 6 + drivers/spi/Makefile | 1 + drivers/spi/spi-ma35d1-qspi.c | 579 ++++++++++++++++++ 4 files changed, 647 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml create mode 100644 drivers/spi/spi-ma35d1-qspi.c
Signature · 1 line
2.25.1
PATCH 1/2 dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
--- .../bindings/spi/nuvoton,ma35d1-qspi.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +61 -0
@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/nuvoton,ma35d1-qspi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton MA35D1 Quad SPI Controller + +maintainers: + - Chi-Wen Weng <[email protected]> + +allOf: + - $ref: spi-controller.yaml# + +properties: + compatible: + const: nuvoton,ma35d1-qspi + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - clocks + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + spi@40680000 { + compatible = "nuvoton,ma35d1-qspi"; + reg = <0x0 0x40680000 0x0 0x100>; + interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk QSPI0_GATE>; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <30000000>; + reg = <0>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; + }; + }; +
Signature · 1 line
2.25.1
PATCH 2/2 spi: Add Nuvoton MA35D1 QSPI controller support
In reply to Chi-Wen Weng--- drivers/spi/Kconfig | 6 + drivers/spi/Makefile | 1 + drivers/spi/spi-ma35d1-qspi.c | 579 ++++++++++++++++++++++++++++++++++ 3 files changed, 586 insertions(+) create mode 100644 drivers/spi/spi-ma35d1-qspi.c
drivers/spi/Kconfig +6 -0
@@ -694,6 +694,12 @@ config SPI_LJCA This driver can also be built as a module. If so, the module will be called spi-ljca. +config SPI_MA35D1_QSPI + tristate "Nuvoton MA35D1 QSPI Controller" + help + This driver provides support for Nuvoton MA35D1 + QSPI controller in master mode. + config SPI_MESON_SPICC tristate "Amlogic Meson SPICC controller" depends on COMMON_CLK
drivers/spi/Makefile +1 -0
@@ -85,6 +85,7 @@ obj-$(CONFIG_SPI_LOONGSON_CORE) += spi-loongson-core.o obj-$(CONFIG_SPI_LOONGSON_PCI) += spi-loongson-pci.o obj-$(CONFIG_SPI_LOONGSON_PLATFORM) += spi-loongson-plat.o obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o +obj-$(CONFIG_SPI_MA35D1_QSPI) += spi-ma35d1-qspi.o obj-$(CONFIG_SPI_MESON_SPICC) += spi-meson-spicc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MICROCHIP_CORE_QSPI) += spi-microchip-core-qspi.o
drivers/spi/spi-ma35d1-qspi.c new file +579 -0
579 lines not on this page · raw message
Signature · 1 line
2.25.1
[email protected]
AI reviewRe: [PATCH 1/2] dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
In reply to Chi-Wen WengThank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: - [High] Sending `op->cmd.opcode` by address fails on Big-Endian architectures and ignores opcode length.…
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Sending op->cmd.opcode by address fails on Big-Endian architectures and ignores opcode length.
- [High] Failure to unconditionally drain the RX FIFO during TX-only transfers can stall the SPI controller.
- [Medium] Silent mapping of invalid chip select numbers to SS1.
- [Medium] Missing num-cs constraint in the device tree binding allows invalid configurations.
- [Medium] Missing 'resets' property in the YAML schema properties list.
--
commit 4a6810e7446469e1e2c0b488d225f75f8420f815
Author: Chi-Wen Weng <[email protected]>
dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
This series introduces the device tree bindings and driver support for the Nuvoton MA35D1 Quad SPI controller. The driver implements standard master mode operations, quad I/O, and SPI memory operations.
Quoted 5 lines
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml line 20
Quoted 6 lines
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +6
-0+properties: + compatible: + const: nuvoton,ma35d1-qspi + + reg: + maxItems: 1
[Severity: Medium]
Should the 'resets' property be included in this schema?
Since the MA35D1 hardware contains reset control lines for QSPI, omitting 'resets' means any board device tree that accurately specifies the hardware's reset line will fail schema validation due to unevaluatedProperties: false.
[Severity: Medium]
Does this binding need a 'num-cs' constraint?
The MA35D1 controller physically supports a maximum of 2 chip selects. Because the binding references spi-controller.yaml without capping num-cs, a device tree specifying num-cs = <4> will pass validation and could cause out-of-bounds indexing in the driver.
[ ... ]
Quoted 5 lines
drivers/spi/spi-ma35d1-qspi.c new file +0
-0
[ ... ]
Quoted 3 lines
drivers/spi/spi-ma35d1-qspi.c new file +3
-0+static int nuvoton_qspi_txrx (struct nuvoton_qspi *qspi,const void *txbuf, +void *rxbuf,unsigned int len) +{
[ ... ]
Quoted 12 lines
drivers/spi/spi-ma35d1-qspi.c new file +12
-0+for (i =0 ; i < words; i++) { + ret =nuvoton_qspi_wait_tx_not_full (qspi); +if (ret) { +dev_err (qspi->dev,"TX FIFO full timeout\n" ); +return ret; + } + +nuvoton_qspi_write (qspi,nuvoton_qspi_tx_word (txbuf, i, + qspi->bits_per_word), +NUVOTON_QSPI_TX_OFFSET ); + +if (rxbuf) {
drivers/spi/spi-ma35d1-qspi.c
Quoted 10 lines
drivers/spi/spi-ma35d1-qspi.c new file +10
-0+ ret =nuvoton_qspi_wait_rx_not_empty (qspi); +if (ret) { +dev_err (qspi->dev,"RX FIFO empty timeout\n" ); +return ret; + } + + val =nuvoton_qspi_read (qspi,NUVOTON_QSPI_RX_OFFSET ); +nuvoton_qspi_rx_word (rxbuf, i, val, qspi->bits_per_word); + } + }
[Severity: High]
Can this stall the SPI controller on large TX-only transfers?
Because SPI is a full-duplex shift register, every byte transmitted shifts a byte into the RX FIFO. By only reading the RX FIFO when rxbuf is not NULL, a long TX-only operation (like a 256-byte page program) will fill and overflow the RX FIFO.
On many controllers this stalls the shift register and causes a hang or timeout in nuvoton_qspi_wait_tx_not_full(). Should the RX FIFO be unconditionally drained on every cycle?
[ ... ]
drivers/spi/spi-ma35d1-qspi.c
Quoted 11 lines
drivers/spi/spi-ma35d1-qspi.c new file +11
-0+static void nuvoton_qspi_set_cs (struct spi_device *spi,bool enable) +{ +struct nuvoton_qspi *qspi =spi_controller_get_devdata (spi->controller); +unsigned int cs =spi_get_chipselect (spi,0 ); +u32 mask; +u32 val; + +if (cs ==0 ) + mask =NUVOTON_QSPI_SSCTL_SS0_MASK ; +else + mask =NUVOTON_QSPI_SSCTL_SS1_MASK ;
[Severity: Medium]
Is it safe to assume any non-zero chip select maps to SS1?
If an incorrect device tree specifies num-cs = <4>, the SPI core might pass cs >= 2 here. This branch will silently map all invalid chip selects to SS1_MASK.
If another peripheral is connected to SS1, could this cause a bus collision?
[ ... ]
Quoted 3 lines
drivers/spi/spi-ma35d1-qspi.c new file +3
-0+static int nuvoton_qspi_mem_exec_op (struct spi_mem *mem, +const struct spi_mem_op *op) +{
[ ... ]
drivers/spi/spi-ma35d1-qspi.c
Quoted 4 lines
drivers/spi/spi-ma35d1-qspi.c new file +4
-0+nuvoton_qspi_set_cs (spi, true); + +nuvoton_qspi_set_bus_width (qspi, op->cmd.buswidth,SPI_MEM_DATA_OUT ); + ret =nuvoton_qspi_txrx (qspi, &op->cmd.opcode,NULL ,1 );
[Severity: High]
What happens here on big-endian systems or with multi-byte opcodes?
op->cmd.opcode is a 16-bit integer, but it's passed by address with a hardcoded length of 1. On big-endian systems, reading a 16-bit integer via a byte pointer reads the most significant byte (which is 0x00 for a typical 1-byte opcode like 0x03), breaking flash communication.
Additionally, this ignores op->cmd.nbytes, which would break operations that require more than 1 byte for the opcode.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCH 2/2] spi: Add Nuvoton MA35D1 QSPI controller support
In reply to Chi-Wen WengThank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: - [High] Passing a pointer to `op->cmd.opcode` (a `u16`) to a buffer-oriented transfer function causes…
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Passing a pointer to op->cmd.opcode (a u16) to a buffer-oriented transfer function causes command corruption on Big-Endian systems.
- [High] Failure to drain the RX FIFO during TX-only transfers causes the SPI controller to stall or drop data due to overflow.
- [High] The driver configures the bidirectional data pins as outputs during SPI memory dummy cycles, risking bus contention.
- [Medium] Memory operations (spi_mem_exec_op) will fail with -EINVAL if the client device configures a 16-bit or 32-bit default word size.
- [Low] The Kconfig symbol SPI_MA35D1_QSPI is missing architecture dependencies.
--
commit 6406cd6c82b9bd8e78df612f2de82f09e50e1f89
Author: Chi-Wen Weng <[email protected]>
Subject: spi: Add Nuvoton MA35D1 QSPI controller support
This commit adds support for the Nuvoton MA35D1 QSPI controller in master mode.
drivers/spi/Kconfig config SPI_LJCA · line 699
Quoted 10 lines
drivers/spi/Kconfig +2
-0@@ -695,6 +695,12 @@ config SPI_LJCA This driver can also be built as a module. If so, the module will be called spi-ljca. +config SPI_MA35D1_QSPI + tristate "Nuvoton MA35D1 QSPI Controller"
[Severity: Low]
Should this config symbol include architecture dependencies, such as depends on ARCH_MA35 || COMPILE_TEST?
Adding dependencies would help prevent cluttering the configuration menu for users building kernels for unrelated hardware architectures.
Quoted 3 lines
drivers/spi/Kconfig +3
-0+ help + This driver provides support for Nuvoton MA35D1 + QSPI controller in master mode.
[ ... ]
Quoted 5 lines
drivers/spi/spi-ma35d1-qspi.c new file +0
-0
[ ... ]
Quoted 3 lines
drivers/spi/spi-ma35d1-qspi.c new file +3
-0+static int nuvoton_qspi_txrx (struct nuvoton_qspi *qspi,const void *txbuf, +void *rxbuf,unsigned int len) +{
[ ... ]
Quoted 12 lines
drivers/spi/spi-ma35d1-qspi.c new file +12
-0+for (i =0 ; i < words; i++) { + ret =nuvoton_qspi_wait_tx_not_full (qspi); +if (ret) { +dev_err (qspi->dev,"TX FIFO full timeout\n" ); +return ret; + } + +nuvoton_qspi_write (qspi,nuvoton_qspi_tx_word (txbuf, i, + qspi->bits_per_word), +NUVOTON_QSPI_TX_OFFSET ); + +if (rxbuf) {
drivers/spi/spi-ma35d1-qspi.c line 335
Quoted 10 lines
drivers/spi/spi-ma35d1-qspi.c new file +10
-0+ ret =nuvoton_qspi_wait_rx_not_empty (qspi); +if (ret) { +dev_err (qspi->dev,"RX FIFO empty timeout\n" ); +return ret; + } + + val =nuvoton_qspi_read (qspi,NUVOTON_QSPI_RX_OFFSET ); +nuvoton_qspi_rx_word (rxbuf, i, val, qspi->bits_per_word); + } + }
[Severity: High]
Does skipping the RX FIFO read when rxbuf is NULL cause the RX FIFO to overflow during TX-only transfers?
In standard SPI operations, every transmitted word also shifts a word into the RX FIFO. Because this loop never empties the RX FIFO in transmit-only cases (like a flash Page Program), could the FIFO rapidly fill up and cause the SPI controller state machine to stall or drop data?
A dummy read might be needed for every word written, even when rxbuf is not provided.
[ ... ]
drivers/spi/spi-ma35d1-qspi.c line 428
Quoted 10 lines
drivers/spi/spi-ma35d1-qspi.c new file +10
-0+static int nuvoton_qspi_mem_exec_op (struct spi_mem *mem, +const struct spi_mem_op *op) +{ +struct spi_device *spi = mem->spi; +struct nuvoton_qspi *qspi =spi_controller_get_devdata (spi->controller); +u8 addr[4 ]; +int ret; +int i; + + ret =nuvoton_qspi_setup_transfer (spi,NULL );
[Severity: Medium]
Will this inherit the default word size from the SPI device?
If a client device configures a 16-bit or 32-bit default word size, bytes_per_word will become 2 or 4. When the driver attempts to transmit the 1-byte command phase below (len = 1), nuvoton_qspi_txrx() will execute its modulus check and return -EINVAL.
Could this explicitly enforce an 8-bit word size for memory operations instead of relying on the device's default?
drivers/spi/spi-ma35d1-qspi.c line 435
Quoted 7 lines
drivers/spi/spi-ma35d1-qspi.c new file +7
-0+if (ret) +return ret; + +nuvoton_qspi_set_cs (spi, true); + +nuvoton_qspi_set_bus_width (qspi, op->cmd.buswidth,SPI_MEM_DATA_OUT ); + ret =nuvoton_qspi_txrx (qspi, &op->cmd.opcode,NULL ,1 );
[Severity: High]
Could passing the address of op->cmd.opcode cause command corruption on big-endian systems?
The op->cmd.opcode field is defined as a u16 in struct spi_mem_op. When passed directly to nuvoton_qspi_txrx() as a byte buffer (const void *txbuf), the function will read the first byte at the lowest memory address.
On big-endian platforms, this reads the most significant byte (0x00) instead of the actual command byte, which would break SPI flash communication.
Quoted 2 lines
drivers/spi/spi-ma35d1-qspi.c new file +2
-0+if (ret) + goto out_deassert_cs;
[ ... ]
drivers/spi/spi-ma35d1-qspi.c line 452
Quoted 3 lines
drivers/spi/spi-ma35d1-qspi.c new file +3
-0+if (op->dummy.nbytes) { +nuvoton_qspi_set_bus_width (qspi, op->dummy.buswidth, +SPI_MEM_DATA_OUT );
[Severity: High]
Is it safe to hardcode SPI_MEM_DATA_OUT for the dummy phase?
For Dual or Quad I/O modes (buswidth > 1), setting the data direction to output configures the SPI data pins to actively drive the bus. However, dummy cycles in SPI flash protocols provide a high-impedance turnaround time so the flash chip can prepare to drive the bus for the data input phase.
Actively driving the lines from the host controller during this phase might lead to direct bus contention.
Quoted 4 lines
drivers/spi/spi-ma35d1-qspi.c new file +4
-0+ ret =nuvoton_qspi_txrx (qspi,NULL ,NULL , op->dummy.nbytes); +if (ret) + goto out_deassert_cs; + }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Mark Brown
maintainerRe: [PATCH 1/2] dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
In reply to Chi-Wen WengQuoted 1 line · Chi-Wen Weng
Signed-off-by Chi-Wen Weng <[email protected]>
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
Re: [PATCH 1/2] dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
Hi Mark,
Thanks, I will fix the subject lines in the next version.
Chi-Wen Weng
Mark Brown 於 2026/6/3 下午 05:04 寫道:
Quoted 7 lines · Chi-Wen Weng
Quoted 1 line
Signed-off-by Chi-Wen Weng <[email protected]>Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
Mark Brown
maintainerRe: [PATCH 2/2] spi: Add Nuvoton MA35D1 QSPI controller support
In reply to Chi-Wen Wengdrivers/spi/Kconfig config SPI_LJCA · line 702
Quoted 6 lines · Chi-Wen Weng
drivers/spi/Kconfig +6
-0+config SPI_MA35D1_QSPI + tristate "Nuvoton MA35D1 QSPI Controller" + help + This driver provides support for Nuvoton MA35D1 + QSPI controller in master mode. +
Other drivers for this SoC seem to have ARCH_MA35 || COMPILE_TEST?
drivers/spi/spi-ma35d1-qspi.c line 7
Quoted 8 lines
drivers/spi/spi-ma35d1-qspi.c new file +7
-0@@ -0,0 +1,579 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Nuvoton MA35D1 QSPI controller driver +* +* Copyright (c) 2026 Nuvoton Technology Corp. +* Author: Chi-Wen Weng <[email protected]> +*/
Please make the entire comment a C++ one so things look more intentional.
Quoted 12 lines
drivers/spi/spi-ma35d1-qspi.c new file +12
-0+static void nuvoton_qspi_set_cs (struct spi_device *spi,bool enable) +{ +struct nuvoton_qspi *qspi =spi_controller_get_devdata (spi->controller); +unsigned int cs =spi_get_chipselect (spi,0 ); +u32 mask; +u32 val; + +if (cs ==0 ) + mask =NUVOTON_QSPI_SSCTL_SS0_MASK ; +else + mask =NUVOTON_QSPI_SSCTL_SS1_MASK ; +
drivers/spi/spi-ma35d1-qspi.c line 417
Quoted 10 lines
drivers/spi/spi-ma35d1-qspi.c new file +10
-0+ val =nuvoton_qspi_read (qspi,NUVOTON_QSPI_SSCTL_OFFSET ); + +/* SPI core passes enable=true when CS is asserted (typically active-low) */ +if (enable) + val |= mask; +else + val &= ~mask; + +nuvoton_qspi_write (qspi, val,NUVOTON_QSPI_SSCTL_OFFSET ); +}
Note that the core deals with SPI_CS_HIGH, the driver doesn't need to...
drivers/spi/spi-ma35d1-qspi.c line 430
Quoted 12 lines
drivers/spi/spi-ma35d1-qspi.c new file +12
-0+static int nuvoton_qspi_mem_exec_op (struct spi_mem *mem, +const struct spi_mem_op *op) +{ +struct spi_device *spi = mem->spi; +struct nuvoton_qspi *qspi =spi_controller_get_devdata (spi->controller); +u8 addr[4 ]; +int ret; +int i; + + ret =nuvoton_qspi_setup_transfer (spi,NULL ); +if (ret) +return ret;
This uses spi->max_speed_hz but spi_mem configures p->max_freq which you should use (it might be lower).
drivers/spi/spi-ma35d1-qspi.c line 432
Quoted 2 lines
drivers/spi/spi-ma35d1-qspi.c new file +2
-0+ +nuvoton_qspi_set_cs (spi, true);
...except where you're calling in directly at which point the driver needs to figure this out.
Re: [PATCH 2/2] spi: Add Nuvoton MA35D1 QSPI controller support
Hi Mark,
Thanks for the review.
I will address these in v2:
- add "depends on ARCH_MA35 || COMPILE_TEST" to the Kconfig entry;
- convert the file header to // comments;
- split the low-level CS register update from the SPI core .set_cs() callback, and make the spi-mem direct CS path handle SPI_CS_HIGH explicitly;
- use op->max_freq for spi-mem operations instead of spi->max_speed_hz.
I will also fix the subject lines in the next version.
Best regards,
Chi-Wen Weng
Mark Brown 於 2026/6/3 下午 05:30 寫道:
Quoted 64 lines · Chi-Wen Weng
drivers/spi/Kconfig config SPI_LJCA · line 702
Quoted 7 lines
drivers/spi/Kconfig +6
-0+config SPI_MA35D1_QSPI + tristate "Nuvoton MA35D1 QSPI Controller" + help + This driver provides support for Nuvoton MA35D1 + QSPI controller in master mode. +Other drivers for this SoC seem to have
ARCH_MA35||COMPILE_TEST?drivers/spi/spi-ma35d1-qspi.c line 7
Quoted 8 lines
drivers/spi/spi-ma35d1-qspi.c new file +7
-0@@ -0,0 +1,579 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Nuvoton MA35D1 QSPI controller driver +* +* Copyright (c) 2026 Nuvoton Technology Corp. +* Author: Chi-Wen Weng <[email protected]> +*/ Please make the entire comment a C++ one so things look more intentional.
Quoted 12 lines
drivers/spi/spi-ma35d1-qspi.c new file +12
-0+static void nuvoton_qspi_set_cs (struct spi_device *spi,bool enable) +{ +struct nuvoton_qspi *qspi =spi_controller_get_devdata (spi->controller); +unsigned int cs =spi_get_chipselect (spi,0 ); +u32 mask; +u32 val; + +if (cs ==0 ) + mask =NUVOTON_QSPI_SSCTL_SS0_MASK ; +else + mask =NUVOTON_QSPI_SSCTL_SS1_MASK ; +drivers/spi/spi-ma35d1-qspi.c line 417
Quoted 10 lines
drivers/spi/spi-ma35d1-qspi.c new file +10
-0+ val =nuvoton_qspi_read (qspi,NUVOTON_QSPI_SSCTL_OFFSET ); + +/* SPI core passes enable=true when CS is asserted (typically active-low) */ +if (enable) + val |= mask; +else + val &= ~mask; + +nuvoton_qspi_write (qspi, val,NUVOTON_QSPI_SSCTL_OFFSET ); +}Note that the core deals with
SPI_CS_HIGH, the driver doesn't need to...drivers/spi/spi-ma35d1-qspi.c line 430
Quoted 12 lines
drivers/spi/spi-ma35d1-qspi.c new file +12
-0+static int nuvoton_qspi_mem_exec_op (struct spi_mem *mem, +const struct spi_mem_op *op) +{ +struct spi_device *spi = mem->spi; +struct nuvoton_qspi *qspi =spi_controller_get_devdata (spi->controller); +u8 addr[4 ]; +int ret; +int i; + + ret =nuvoton_qspi_setup_transfer (spi,NULL ); +if (ret) +return ret;This uses
spi->max_speed_hzbutspi_memconfiguresp->max_freqwhich you should use (it might be lower).drivers/spi/spi-ma35d1-qspi.c line 432
Quoted 2 lines
drivers/spi/spi-ma35d1-qspi.c new file +2
-0+ +nuvoton_qspi_set_cs (spi, true);...except where you're calling in directly at which point the driver needs to figure this out.
Re: [PATCH 1/2] dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
In reply to Chi-Wen WengQuoted 1 line · Chi-Wen Weng
Signed-off-by Chi-Wen Weng <[email protected]>
Missing commit message for one, but why can't your Nuvoton mail be used here?
Sashiko had two comments about resets and num-cs that looked valid.
Quoted 53 lines
--- .../bindings/spi/nuvoton,ma35d1-qspi.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yamlDocumentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +42
-0@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/nuvoton,ma35d1-qspi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton MA35D1 Quad SPI Controller + +maintainers: + - Chi-Wen Weng <[email protected]> + +allOf: + - $ref: spi-controller.yaml# + +properties: + compatible: + const: nuvoton,ma35d1-qspi + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - clocks + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> + + soc { + #address-cells = <2>; + #size-cells = <2>;
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml line 52
Quoted 10 lines
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +10
-0+ + spi@40680000 { + compatible = "nuvoton,ma35d1-qspi"; + reg = <0x0 0x40680000 0x0 0x100>; + interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk QSPI0_GATE>; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 {
Drop this flash node, it serves no purpose here.
pw-bot: changes-requested
Thanks,
Conor.
Quoted 12 lines
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +9
-0+ compatible = "jedec,spi-nor"; + spi-max-frequency = <30000000>; + reg = <0>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; + }; + }; +Signature · 1 line
2.25.1
Re: [PATCH 1/2] dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
Hi Conor,
Thanks for the review.
Quoted 2 lines
Missing commit message for one, but why can't your Nuvoton mail be used here?
I apologize for the missing commit message; I will add a proper description in v2.
Regarding the email address, my Nuvoton mail adds a corporate confidentiality disclaimer to outgoing external mail, so I use my personal address for sending kernel patches.
Quoted 1 line
Sashiko had two comments about resets and num-cs that looked valid.
Noted. I will add the num-cs and resets properties in v2.
Quoted 1 line
Drop this flash node, it serves no purpose here.
Understood, I will remove the flash child node from the example in v2.
Thanks,
Chi-Wen Weng
Conor Dooley 於 2026/6/3 下午 11:24 寫道:
Quoted 89 lines · Chi-Wen Weng
Quoted 1 line
Signed-off-by Chi-Wen Weng <[email protected]>Missing commit message for one, but why can't your Nuvoton mail be used here?
Sashiko had two comments about resets and num-cs that looked valid.
Quoted 53 lines
--- .../bindings/spi/nuvoton,ma35d1-qspi.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+)create mode 100644
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yamlDocumentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +42
-0@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/nuvoton,ma35d1-qspi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton MA35D1 Quad SPI Controller + +maintainers: + - Chi-Wen Weng <[email protected]> + +allOf: + - $ref: spi-controller.yaml# + +properties: + compatible: + const: nuvoton,ma35d1-qspi + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - clocks + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> + + soc { + #address-cells = <2>; + #size-cells = <2>;Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml line 52
Quoted 10 lines
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +10
-0+ + spi@40680000 { + compatible = "nuvoton,ma35d1-qspi"; + reg = <0x0 0x40680000 0x0 0x100>; + interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk QSPI0_GATE>; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 {Drop this flash node, it serves no purpose here.
pw-bot: changes-requested
Thanks,
Conor.Quoted 12 lines
Documentation/devicetree/bindings/spi/nuvoton,ma35d1-qspi.yaml new file +9
-0+ compatible = "jedec,spi-nor"; + spi-max-frequency = <30000000>; + reg = <0>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; + }; + }; +Signature · 1 line
2.25.1
Re: [PATCH 1/2] dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
Quoted 7 lines · Chi-Wen Weng
Hi Conor,
Thanks for the review.
Quoted 2 lines
Missing commit message for one, but why can't your Nuvoton mail be used here?
Quoted 6 lines
I apologize for the missing commit message; I will add a proper description in v2.
Regarding the email address, my Nuvoton mail adds a corporate confidentiality disclaimer to outgoing
external mail, so I use my personal address for sending kernel patches.
This prevents you sending with your work email account, but you can still set your commit author to your Nuvoton address FWIW.
Quoted 3 lines
Conor Dooley 於 2026/6/3 下午 11:24 寫道:
Quoted 2 lines · Chi-Wen Weng
Quoted 1 line
Signed-off-by Chi-Wen Weng <[email protected]>
Re: [PATCH 1/2] dt-bindings: spi: Add for Nuvoton MA35D1 SoC QSPI Controller
Hi Conor,
Thanks for the clarification.
I will keep using my personal mail account for sending the patches to avoid the corporate confidentiality footer, but I will set the commit author and Signed-off-by to my Nuvoton address in v2.
Best regards,
Chi-Wen
Conor Dooley 於 2026/6/4 下午 04:55 寫道:
Quoted 19 lines · Chi-Wen Weng
Quoted 4 lines
Hi Conor,
Thanks for the review.
Quoted 8 lines
Quoted 2 lines
Missing commit message for one, but why can't your Nuvoton mail be used here?
I apologize for the missing commit message; I will add a proper description in v2.
Regarding the email address, my Nuvoton mail adds a corporate confidentiality disclaimer to outgoing
external mail, so I use my personal address for sending kernel patches.This prevents you sending with your work email account, but you can still set your commit author to your Nuvoton address FWIW.
Quoted 3 lines
Conor Dooley 於 2026/6/3 下午 11:24 寫道:
Quoted 2 lines · Chi-Wen Weng
Quoted 1 line
Signed-off-by Chi-Wen Weng <[email protected]>