Skip to content

Commit 8a3eb50

Browse files
committed
Add support for NXP XSPI
Merge series from Haibo Chen <haibo.chen@nxp.com>: XSPI is a flexible SPI host controller which supports up to 2 external devices (2 CS). It support Single/Dual/Quad/Octal mode data transfer. The difference between XSPI and Flexspi is XSPI support multiple independent execution environments (EENVs) for HW virtualization with some limitations. Each EENV has its own interrupt and its own set of programming registers that exists in a specific offset range in the XSPI memory map. The main environment (EENV0) address space contains all of the registers for controlling EENV0 plus all of the general XSPI control and programming registers. The register mnemonics for the user environments (EENV1 to EENV4) have "_SUB_n" appended to the mnemonic for the corresponding main-environment register. Current driver based on EENV0, which means system already give EENV0 right to linux. This driver use SPI memory interface of the SPI framework to issue flash memory operations. Tested this driver with mtd_debug and UBIFS on NXP i.MX943 EVK board which has one MT35XU512ABA spi nor flash. NOw this driver has the following key features: - Support up to OCT DDR mode - Support AHB read - Support IP read and IP write - Support two CS
2 parents 7f7b350 + 29c8c00 commit 8a3eb50

5 files changed

Lines changed: 1493 additions & 0 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/spi/nxp,imx94-xspi.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NXP External Serial Peripheral Interface (xSPI)
8+
9+
maintainers:
10+
- Haibo Chen <haibo.chen@nxp.com>
11+
- Han Xu <han.xu@nxp.com>
12+
13+
properties:
14+
compatible:
15+
oneOf:
16+
- enum:
17+
- nxp,imx94-xspi
18+
19+
reg:
20+
items:
21+
- description: registers address space
22+
- description: memory mapped address space
23+
24+
reg-names:
25+
items:
26+
- const: base
27+
- const: mmap
28+
29+
interrupts:
30+
items:
31+
- description: interrupt for EENV0
32+
- description: interrupt for EENV1
33+
- description: interrupt for EENV2
34+
- description: interrupt for EENV3
35+
- description: interrupt for EENV4
36+
37+
clocks:
38+
items:
39+
- description: SPI serial clock
40+
41+
clock-names:
42+
items:
43+
- const: per
44+
45+
required:
46+
- compatible
47+
- reg
48+
- reg-names
49+
- interrupts
50+
- clocks
51+
- clock-names
52+
53+
allOf:
54+
- $ref: spi-controller.yaml#
55+
56+
unevaluatedProperties: false
57+
58+
examples:
59+
- |
60+
#include <dt-bindings/interrupt-controller/arm-gic.h>
61+
62+
soc {
63+
#address-cells = <2>;
64+
#size-cells = <2>;
65+
66+
spi@42b90000 {
67+
compatible = "nxp,imx94-xspi";
68+
reg = <0x0 0x42b90000 0x0 0x50000>, <0x0 0x28000000 0x0 0x08000000>;
69+
reg-names = "base", "mmap";
70+
interrupts = <GIC_SPI 390 IRQ_TYPE_LEVEL_HIGH>,
71+
<GIC_SPI 391 IRQ_TYPE_LEVEL_HIGH>,
72+
<GIC_SPI 392 IRQ_TYPE_LEVEL_HIGH>,
73+
<GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH>,
74+
<GIC_SPI 394 IRQ_TYPE_LEVEL_HIGH>;
75+
#address-cells = <1>;
76+
#size-cells = <0>;
77+
clocks = <&scmi_1>;
78+
clock-names = "per";
79+
80+
flash@0 {
81+
compatible = "jedec,spi-nor";
82+
reg = <0>;
83+
spi-max-frequency = <200000000>;
84+
spi-rx-bus-width = <8>;
85+
spi-tx-bus-width = <8>;
86+
};
87+
};
88+
};

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18946,6 +18946,15 @@ S: Maintained
1894618946
F: Documentation/devicetree/bindings/sound/trivial-codec.yaml
1894718947
F: sound/soc/codecs/tfa9879*
1894818948

18949+
NXP XSPI DRIVER
18950+
M: Han Xu <han.xu@nxp.com>
18951+
M: Haibo Chen <haibo.chen@nxp.com>
18952+
L: linux-spi@vger.kernel.org
18953+
L: imx@lists.linux.dev
18954+
S: Maintained
18955+
F: Documentation/devicetree/bindings/spi/nxp,imx94-xspi.yaml
18956+
F: drivers/spi/spi-nxp-xspi.c
18957+
1894918958
NXP-NCI NFC DRIVER
1895018959
S: Orphan
1895118960
F: Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml

drivers/spi/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,16 @@ config SPI_NXP_FLEXSPI
481481
This controller does not support generic SPI messages and only
482482
supports the high-level SPI memory interface.
483483

484+
config SPI_NXP_XSPI
485+
tristate "NXP xSPI controller"
486+
depends on ARCH_MXC || COMPILE_TEST
487+
depends on HAS_IOMEM
488+
help
489+
This enables support for the xSPI controller. Up to two devices
490+
can be connected to one host.
491+
This controller does not support generic SPI messages and only
492+
supports the high-level SPI memory interface.
493+
484494
config SPI_GPIO
485495
tristate "GPIO-based bitbanging SPI Master"
486496
depends on GPIOLIB || COMPILE_TEST

drivers/spi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ obj-$(CONFIG_SPI_WPCM_FIU) += spi-wpcm-fiu.o
102102
obj-$(CONFIG_SPI_NPCM_FIU) += spi-npcm-fiu.o
103103
obj-$(CONFIG_SPI_NPCM_PSPI) += spi-npcm-pspi.o
104104
obj-$(CONFIG_SPI_NXP_FLEXSPI) += spi-nxp-fspi.o
105+
obj-$(CONFIG_SPI_NXP_XSPI) += spi-nxp-xspi.o
105106
obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o
106107
spi-octeon-objs := spi-cavium.o spi-cavium-octeon.o
107108
obj-$(CONFIG_SPI_OCTEON) += spi-octeon.o

0 commit comments

Comments
 (0)