Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: sparx5-serdes: add constants to match data

We need to handle a few different constants that differ for Sparx5 and
lan969x. Add a new struct: sparx5_serdes_consts for this purpose. We
populate it with an initial field for the number of SERDES'es: sd_max.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com>
Link: https://lore.kernel.org/r/20240909-sparx5-lan969x-serdes-driver-v2-2-d695bcb57b84@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Daniel Machon and committed by
Vinod Koul
8e65baf8 d41bb5e0

+10 -2
+5 -2
drivers/phy/microchip/sparx5_serdes.c
··· 2510 2510 static const struct sparx5_serdes_match_data sparx5_desc = { 2511 2511 .iomap = sparx5_serdes_iomap, 2512 2512 .iomap_size = ARRAY_SIZE(sparx5_serdes_iomap), 2513 + .consts = { 2514 + .sd_max = 33, 2515 + }, 2513 2516 }; 2514 2517 2515 2518 /* Client lookup function, uses serdes index */ ··· 2529 2526 sidx = args->args[0]; 2530 2527 2531 2528 /* Check validity: ERR_PTR(-ENODEV) if not valid */ 2532 - for (idx = 0; idx < SPX5_SERDES_MAX; idx++) { 2529 + for (idx = 0; idx < priv->data->consts.sd_max; idx++) { 2533 2530 struct sparx5_serdes_macro *macro = 2534 2531 phy_get_drvdata(priv->phys[idx]); 2535 2532 ··· 2597 2594 2598 2595 priv->regs[iomap->id] = iomem + iomap->offset; 2599 2596 } 2600 - for (idx = 0; idx < SPX5_SERDES_MAX; idx++) { 2597 + for (idx = 0; idx < priv->data->consts.sd_max; idx++) { 2601 2598 err = sparx5_phy_create(priv, idx, &priv->phys[idx]); 2602 2599 if (err) 2603 2600 return err;
+5
drivers/phy/microchip/sparx5_serdes.h
··· 26 26 SPX5_SD_MODE_SFI, 27 27 }; 28 28 29 + struct sparx5_serdes_consts { 30 + int sd_max; 31 + }; 32 + 29 33 struct sparx5_serdes_match_data { 34 + const struct sparx5_serdes_consts consts; 30 35 const struct sparx5_serdes_io_resource *iomap; 31 36 int iomap_size; 32 37 };