Skip to content

Commit ebd7d6a

Browse files
Demon000broonie
authored andcommitted
spi: rzv2h-rspi: make clocks chip-specific
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs have different clocks compared to RZ/V2H. Set the number of clocks and the name of the transfer clock in the chip-specific structure 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-4-cosmin-gabriel.tanislav.xa@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8e89ee6 commit ebd7d6a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/spi/spi-rzv2h-rspi.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@
6666
#define RSPI_SPSRC_CLEAR 0xfd80
6767

6868
#define RSPI_RESET_NUM 2
69-
#define RSPI_CLK_NUM 3
7069

7170
struct rzv2h_rspi_info {
71+
const char *tclk_name;
7272
unsigned int fifo_size;
73+
unsigned int num_clks;
7374
};
7475

7576
struct rzv2h_rspi_priv {
@@ -373,11 +374,11 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
373374
return PTR_ERR(rspi->base);
374375

375376
ret = devm_clk_bulk_get_all_enabled(dev, &clks);
376-
if (ret != RSPI_CLK_NUM)
377+
if (ret != rspi->info->num_clks)
377378
return dev_err_probe(dev, ret >= 0 ? -EINVAL : ret,
378379
"cannot get clocks\n");
379-
for (i = 0; i < RSPI_CLK_NUM; i++) {
380-
if (!strcmp(clks[i].id, "tclk")) {
380+
for (i = 0; i < rspi->info->num_clks; i++) {
381+
if (!strcmp(clks[i].id, rspi->info->tclk_name)) {
381382
rspi->tclk = clks[i].clk;
382383
break;
383384
}
@@ -452,7 +453,9 @@ static void rzv2h_rspi_remove(struct platform_device *pdev)
452453
}
453454

454455
static const struct rzv2h_rspi_info rzv2h_info = {
456+
.tclk_name = "tclk",
455457
.fifo_size = 16,
458+
.num_clks = 3,
456459
};
457460

458461
static const struct of_device_id rzv2h_rspi_match[] = {

0 commit comments

Comments
 (0)