@@ -2507,6 +2507,11 @@ static struct sparx5_serdes_io_resource sparx5_serdes_iomap[] = {
2507
2507
{ TARGET_SD_LANE_25G + 7 , 0x5c8000 }, /* 0x610dd0000: sd_lane_25g_32 */
2508
2508
};
2509
2509
2510
+ static const struct sparx5_serdes_match_data sparx5_desc = {
2511
+ .iomap = sparx5_serdes_iomap ,
2512
+ .iomap_size = ARRAY_SIZE (sparx5_serdes_iomap ),
2513
+ };
2514
+
2510
2515
/* Client lookup function, uses serdes index */
2511
2516
static struct phy * sparx5_serdes_xlate (struct device * dev ,
2512
2517
const struct of_phandle_args * args )
@@ -2555,6 +2560,10 @@ static int sparx5_serdes_probe(struct platform_device *pdev)
2555
2560
platform_set_drvdata (pdev , priv );
2556
2561
priv -> dev = & pdev -> dev ;
2557
2562
2563
+ priv -> data = device_get_match_data (priv -> dev );
2564
+ if (!priv -> data )
2565
+ return - EINVAL ;
2566
+
2558
2567
/* Get coreclock */
2559
2568
clk = devm_clk_get (priv -> dev , NULL );
2560
2569
if (IS_ERR (clk )) {
@@ -2579,8 +2588,9 @@ static int sparx5_serdes_probe(struct platform_device *pdev)
2579
2588
iores -> name );
2580
2589
return - ENOMEM ;
2581
2590
}
2582
- for (idx = 0 ; idx < ARRAY_SIZE (sparx5_serdes_iomap ); idx ++ ) {
2583
- struct sparx5_serdes_io_resource * iomap = & sparx5_serdes_iomap [idx ];
2591
+ for (idx = 0 ; idx < priv -> data -> iomap_size ; idx ++ ) {
2592
+ const struct sparx5_serdes_io_resource * iomap =
2593
+ & priv -> data -> iomap [idx ];
2584
2594
2585
2595
priv -> regs [iomap -> id ] = iomem + iomap -> offset ;
2586
2596
}
@@ -2599,7 +2609,7 @@ static int sparx5_serdes_probe(struct platform_device *pdev)
2599
2609
}
2600
2610
2601
2611
static const struct of_device_id sparx5_serdes_match [] = {
2602
- { .compatible = "microchip,sparx5-serdes" },
2612
+ { .compatible = "microchip,sparx5-serdes" , . data = & sparx5_desc },
2603
2613
{ }
2604
2614
};
2605
2615
MODULE_DEVICE_TABLE (of , sparx5_serdes_match );
0 commit comments