spi: fsl_qspi: add clock support for SpacemiT K3

Add support for the clocks used by the SpacemiT K3 QSPI
controller by retrieving and enabling the qspi_en and qspi
clocks during probe.
Also add a compatible entry and controller data for the
SpacemiT K3 QSPI controller.
Signed-off-by: Chuan <fjchuanil@gmail.com>
This commit is contained in:
Chuan
2026-05-07 17:21:26 +08:00
parent 9fc9b579eb
commit 03cbdb010d
+27 -1
View File
@@ -38,6 +38,7 @@
#include <linux/sizes.h>
#include <linux/err.h>
#include <asm/io.h>
#include <clk.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -266,11 +267,21 @@ static const struct fsl_qspi_devtype_data ls2080a_data = {
.quirks = QUADSPI_QUIRK_TKT253890 | QUADSPI_QUIRK_BASE_INTERNAL,
.little_endian = true,
};
static const struct fsl_qspi_devtype_data spacemit_k3_data = {
.rxfifo = SZ_128,
.txfifo = SZ_256,
.ahb_buf_size = SZ_512,
.quirks = 0,
.little_endian = true,
};
struct fsl_qspi {
struct udevice *dev;
void __iomem *iobase;
void __iomem *ahb_addr;
#if CONFIG_IS_ENABLED(CLK)
struct clk qspi_clk_en;
struct clk qspi_clk;
#endif
u32 memmap_phy;
u32 memmap_size;
const struct fsl_qspi_devtype_data *devtype_data;
@@ -820,7 +831,21 @@ static int fsl_qspi_probe(struct udevice *bus)
dm_bus->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
66000000);
#if CONFIG_IS_ENABLED(CLK)
ret = clk_get_by_name(bus, "qspi_en", &q->qspi_clk_en);
if (ret) {
dev_err(bus, "cannot find qspi_en clock\n");
return ret;
}
ret = clk_get_by_name(bus, "qspi", &q->qspi_clk);
if (ret) {
dev_err(bus, "cannot find qspi clock\n");
return ret;
}
clk_enable(&q->qspi_clk_en);
clk_enable(&q->qspi_clk);
#endif
fsl_qspi_default_setup(q);
return 0;
@@ -870,6 +895,7 @@ static const struct udevice_id fsl_qspi_ids[] = {
{ .compatible = "fsl,ls1021a-qspi", .data = (ulong)&ls1021a_data, },
{ .compatible = "fsl,ls1088a-qspi", .data = (ulong)&ls2080a_data, },
{ .compatible = "fsl,ls2080a-qspi", .data = (ulong)&ls2080a_data, },
{ .compatible = "spacemit,k3-qspi", .data = (ulong)&spacemit_k3_data, },
{ }
};