* [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles
@ 2026-10-08 8:53 Tim Kuo
2026-10-08 8:53 ` [PATCH v3 2/2] spi: mt65xx: support wider tick delay field on MT7987/MT7989 Tim Kuo
2026-10-09 10:18 ` [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles Krzysztof Kozlowski
0 siblings, 2 replies; 3+ messages in thread
From: Tim Kuo @ 2026-10-08 8:53 UTC (permalink / raw)
To: Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno
Cc: linux-spi, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, Steven Liu, Sky Huang, Sam Shih, Tim Kuo
The MT7987 and MT7989 SPI IPs are IPM designs, so they keep
"mediatek,spi-ipm" as their fallback compatible, but they widen the tick
delay field of SPI_CMD_REG and therefore need compatibles of their own.
Signed-off-by: Tim Kuo <Tim.Kuo@mediatek.com>
---
v2: Add mt7987 and mt7989 real device compatible
v3:
- Drop "mediatek,spi-ipm-v59"
- Move compatible of mt7987 and mt7989 to group of spi-ipm fallback
Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
index 3bf3eb1f8728..63b23928c734 100644
--- a/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
+++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
@@ -35,8 +35,10 @@ properties:
- enum:
- mediatek,mt7981-spi-ipm
- mediatek,mt7986-spi-ipm
+ - mediatek,mt7987-spi
- mediatek,mt7988-spi-quad
- mediatek,mt7988-spi-single
+ - mediatek,mt7989-spi
- mediatek,mt8188-spi-ipm
- const: mediatek,spi-ipm
- items:
base-commit: 0d9d0dbf2fddcff5859d623e90ca73c4054276e1
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3 2/2] spi: mt65xx: support wider tick delay field on MT7987/MT7989
2026-10-08 8:53 [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles Tim Kuo
@ 2026-10-08 8:53 ` Tim Kuo
2026-10-09 10:18 ` [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Tim Kuo @ 2026-10-08 8:53 UTC (permalink / raw)
To: Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno
Cc: linux-spi, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, Steven Liu, Sky Huang, Sam Shih, Tim Kuo
The MT7987 and MT7989 SPI IPs widen the tick delay field in SPI_CMD_REG
from 3 bits (bits 24:22) to 7 bits (bits 28:22), so the field width can
no longer be hardcoded in mtk_spi_hw_init().
Add a tick_dly_mask member to struct mtk_spi_compatible and use
field_prep() with the per-SoC mask instead of the open-coded
mask-and-shift, then add a mt7987_compat entry carrying the wider mask
and match it against both "mediatek,mt7987-spi" and
"mediatek,mt7989-spi".
Existing IPM designs keep GENMASK(24, 22) and are functionally
unchanged.
Signed-off-by: Tim Kuo <Tim.Kuo@mediatek.com>
---
v2: remove unused tickdly offset deadcode
v3:
- remove spi-ipm-v59 compatible
- add mt7987 and mt7989 compatible
drivers/spi/spi-mt65xx.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index b845a599f7c6..0603c9f051a8 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -4,6 +4,7 @@
* Author: Leilk Liu <leilk.liu@mediatek.com>
*/
+#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/err.h>
@@ -78,9 +79,9 @@
#define SPI_CMD_PAUSE_IE BIT(17)
#define SPI_CMD_IPM_NONIDLE_MODE BIT(19)
#define SPI_CMD_IPM_SPIM_LOOP BIT(21)
-#define SPI_CMD_IPM_GET_TICKDLY_OFFSET 22
#define SPI_CMD_IPM_GET_TICKDLY_MASK GENMASK(24, 22)
+#define SPI_CMD_IPM_V59_GET_TICKDLY_MASK GENMASK(28, 22)
#define PIN_MODE_CFG(x) ((x) / 2)
@@ -120,6 +121,7 @@
* @dma_ext: DMA address extension supported
* @no_need_unprepare: Don't unprepare the SPI clk during runtime
* @ipm_design: Adjust/extend registers to support IPM design IP features
+ * @tick_dly_mask: Tick delay field of SPI_CMD_REG, IPM designs only
*/
struct mtk_spi_compatible {
bool need_pad_sel;
@@ -128,6 +130,7 @@ struct mtk_spi_compatible {
bool dma_ext;
bool no_need_unprepare;
bool ipm_design;
+ u32 tick_dly_mask;
};
/**
@@ -187,6 +190,14 @@ static const struct mtk_spi_compatible mtk_ipm_compat = {
.enhance_timing = true,
.dma_ext = true,
.ipm_design = true,
+ .tick_dly_mask = SPI_CMD_IPM_GET_TICKDLY_MASK,
+};
+
+static const struct mtk_spi_compatible mt7987_compat = {
+ .enhance_timing = true,
+ .dma_ext = true,
+ .ipm_design = true,
+ .tick_dly_mask = SPI_CMD_IPM_V59_GET_TICKDLY_MASK,
};
static const struct mtk_spi_compatible mt6765_compat = {
@@ -226,6 +237,7 @@ static const struct mtk_spi_compatible mt6991_compat = {
.enhance_timing = true,
.dma_ext = true,
.ipm_design = true,
+ .tick_dly_mask = SPI_CMD_IPM_GET_TICKDLY_MASK,
};
/*
@@ -262,6 +274,12 @@ static const struct of_device_id mtk_spi_of_match[] = {
{ .compatible = "mediatek,mt7629-spi",
.data = (void *)&mt7622_compat,
},
+ { .compatible = "mediatek,mt7987-spi",
+ .data = (void *)&mt7987_compat,
+ },
+ { .compatible = "mediatek,mt7989-spi",
+ .data = (void *)&mt7987_compat,
+ },
{ .compatible = "mediatek,mt8135-spi",
.data = (void *)&mtk_common_compat,
},
@@ -366,7 +384,7 @@ static int mtk_spi_hw_init(struct spi_controller *host,
struct spi_device *spi)
{
u16 cpha, cpol;
- u32 reg_val;
+ u32 reg_val, mask;
struct mtk_chip_config *chip_config = spi->controller_data;
struct mtk_spi *mdata = spi_controller_get_devdata(host);
@@ -443,10 +461,10 @@ static int mtk_spi_hw_init(struct spi_controller *host,
/* tick delay */
if (mdata->dev_comp->enhance_timing) {
if (mdata->dev_comp->ipm_design) {
+ mask = mdata->dev_comp->tick_dly_mask;
reg_val = readl(mdata->base + SPI_CMD_REG);
- reg_val &= ~SPI_CMD_IPM_GET_TICKDLY_MASK;
- reg_val |= ((chip_config->tick_delay & 0x7)
- << SPI_CMD_IPM_GET_TICKDLY_OFFSET);
+ reg_val &= ~mask;
+ reg_val |= field_prep(mask, chip_config->tick_delay);
writel(reg_val, mdata->base + SPI_CMD_REG);
} else {
reg_val = readl(mdata->base + SPI_CFG1_REG);
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles
2026-10-08 8:53 [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles Tim Kuo
2026-10-08 8:53 ` [PATCH v3 2/2] spi: mt65xx: support wider tick delay field on MT7987/MT7989 Tim Kuo
@ 2026-10-09 10:18 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-10-09 10:18 UTC (permalink / raw)
To: Tim Kuo
Cc: Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno, linux-spi,
devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
Steven Liu, Sky Huang, Sam Shih
On Thu, Oct 08, 2026 at 04:53:31PM +0800, Tim Kuo wrote:
> The MT7987 and MT7989 SPI IPs are IPM designs, so they keep
> "mediatek,spi-ipm" as their fallback compatible, but they widen the tick
> delay field of SPI_CMD_REG and therefore need compatibles of their own.
>
> Signed-off-by: Tim Kuo <Tim.Kuo@mediatek.com>
> ---
> v2: Add mt7987 and mt7989 real device compatible
> v3:
> - Drop "mediatek,spi-ipm-v59"
> - Move compatible of mt7987 and mt7989 to group of spi-ipm fallback
>
> Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml b/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
> index 3bf3eb1f8728..63b23928c734 100644
> --- a/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
> +++ b/Documentation/devicetree/bindings/spi/mediatek,spi-mt65xx.yaml
> @@ -35,8 +35,10 @@ properties:
> - enum:
> - mediatek,mt7981-spi-ipm
> - mediatek,mt7986-spi-ipm
> + - mediatek,mt7987-spi
> - mediatek,mt7988-spi-quad
> - mediatek,mt7988-spi-single
> + - mediatek,mt7989-spi
> - mediatek,mt8188-spi-ipm
> - const: mediatek,spi-ipm
Nope. How is this a specific compatible?
Look at git or even read the REST of this file.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-09 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 8:53 [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles Tim Kuo
2026-10-08 8:53 ` [PATCH v3 2/2] spi: mt65xx: support wider tick delay field on MT7987/MT7989 Tim Kuo
2026-10-09 10:18 ` [PATCH v3 1/2] spi: dt-bindings: mediatek,spi-mt65xx: add MT7987/MT7989 compatibles Krzysztof Kozlowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.