Skip to content

Commit 8e65baf

Browse files
Danielmachonvinodkoul
authored andcommitted
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>
1 parent d41bb5e commit 8e65baf

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

drivers/phy/microchip/sparx5_serdes.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,6 +2510,9 @@ static struct sparx5_serdes_io_resource sparx5_serdes_iomap[] = {
25102510
static const struct sparx5_serdes_match_data sparx5_desc = {
25112511
.iomap = sparx5_serdes_iomap,
25122512
.iomap_size = ARRAY_SIZE(sparx5_serdes_iomap),
2513+
.consts = {
2514+
.sd_max = 33,
2515+
},
25132516
};
25142517

25152518
/* Client lookup function, uses serdes index */
@@ -2526,7 +2529,7 @@ static struct phy *sparx5_serdes_xlate(struct device *dev,
25262529
sidx = args->args[0];
25272530

25282531
/* Check validity: ERR_PTR(-ENODEV) if not valid */
2529-
for (idx = 0; idx < SPX5_SERDES_MAX; idx++) {
2532+
for (idx = 0; idx < priv->data->consts.sd_max; idx++) {
25302533
struct sparx5_serdes_macro *macro =
25312534
phy_get_drvdata(priv->phys[idx]);
25322535

@@ -2594,7 +2597,7 @@ static int sparx5_serdes_probe(struct platform_device *pdev)
25942597

25952598
priv->regs[iomap->id] = iomem + iomap->offset;
25962599
}
2597-
for (idx = 0; idx < SPX5_SERDES_MAX; idx++) {
2600+
for (idx = 0; idx < priv->data->consts.sd_max; idx++) {
25982601
err = sparx5_phy_create(priv, idx, &priv->phys[idx]);
25992602
if (err)
26002603
return err;

drivers/phy/microchip/sparx5_serdes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ enum sparx5_serdes_mode {
2626
SPX5_SD_MODE_SFI,
2727
};
2828

29+
struct sparx5_serdes_consts {
30+
int sd_max;
31+
};
32+
2933
struct sparx5_serdes_match_data {
34+
const struct sparx5_serdes_consts consts;
3035
const struct sparx5_serdes_io_resource *iomap;
3136
int iomap_size;
3237
};

0 commit comments

Comments
 (0)