Skip to content

Commit 8e89ee6

Browse files
Demon000broonie
authored andcommitted
spi: rzv2h-rspi: make FIFO size chip-specific
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs have a different FIFO size compared to RZ/V2H. Add a chip-specific structure, and set the FIFO size inside it, to prepare for adding support for them. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Link: https://patch.msgid.link/20251119161434.595677-3-cosmin-gabriel.tanislav.xa@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent aead5ae commit 8e89ee6

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

drivers/spi/spi-rzv2h-rspi.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
/* Register SPDCR2 */
5959
#define RSPI_SPDCR2_TTRG GENMASK(11, 8)
6060
#define RSPI_SPDCR2_RTRG GENMASK(3, 0)
61-
#define RSPI_FIFO_SIZE 16
6261

6362
/* Register SPSR */
6463
#define RSPI_SPSR_SPRF BIT(15)
@@ -69,9 +68,14 @@
6968
#define RSPI_RESET_NUM 2
7069
#define RSPI_CLK_NUM 3
7170

71+
struct rzv2h_rspi_info {
72+
unsigned int fifo_size;
73+
};
74+
7275
struct rzv2h_rspi_priv {
7376
struct reset_control_bulk_data resets[RSPI_RESET_NUM];
7477
struct spi_controller *controller;
78+
const struct rzv2h_rspi_info *info;
7579
void __iomem *base;
7680
struct clk *tclk;
7781
wait_queue_head_t wait;
@@ -305,7 +309,7 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
305309
writeb(0, rspi->base + RSPI_SSLP);
306310

307311
/* Setup FIFO thresholds */
308-
conf16 = FIELD_PREP(RSPI_SPDCR2_TTRG, RSPI_FIFO_SIZE - 1);
312+
conf16 = FIELD_PREP(RSPI_SPDCR2_TTRG, rspi->info->fifo_size - 1);
309313
conf16 |= FIELD_PREP(RSPI_SPDCR2_RTRG, 0);
310314
writew(conf16, rspi->base + RSPI_SPDCR2);
311315

@@ -362,6 +366,8 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
362366

363367
rspi->controller = controller;
364368

369+
rspi->info = device_get_match_data(dev);
370+
365371
rspi->base = devm_platform_ioremap_resource(pdev, 0);
366372
if (IS_ERR(rspi->base))
367373
return PTR_ERR(rspi->base);
@@ -445,8 +451,12 @@ static void rzv2h_rspi_remove(struct platform_device *pdev)
445451
reset_control_bulk_assert(RSPI_RESET_NUM, rspi->resets);
446452
}
447453

454+
static const struct rzv2h_rspi_info rzv2h_info = {
455+
.fifo_size = 16,
456+
};
457+
448458
static const struct of_device_id rzv2h_rspi_match[] = {
449-
{ .compatible = "renesas,r9a09g057-rspi" },
459+
{ .compatible = "renesas,r9a09g057-rspi", &rzv2h_info },
450460
{ /* sentinel */ }
451461
};
452462
MODULE_DEVICE_TABLE(of, rzv2h_rspi_match);

0 commit comments

Comments
 (0)