@@ -128,11 +128,6 @@ struct aspeed_kcs_bmc {
128
128
} obe ;
129
129
};
130
130
131
- struct aspeed_kcs_of_ops {
132
- int (* get_channel )(struct platform_device * pdev );
133
- int (* get_io_address )(struct platform_device * pdev , u32 addrs [2 ]);
134
- };
135
-
136
131
static inline struct aspeed_kcs_bmc * to_aspeed_kcs_bmc (struct kcs_bmc_device * kcs_bmc )
137
132
{
138
133
return container_of (kcs_bmc , struct aspeed_kcs_bmc , kcs_bmc );
@@ -475,38 +470,7 @@ static const struct kcs_ioreg ast_kcs_bmc_ioregs[KCS_CHANNEL_MAX] = {
475
470
{ .idr = LPC_IDR4 , .odr = LPC_ODR4 , .str = LPC_STR4 },
476
471
};
477
472
478
- static int aspeed_kcs_of_v1_get_channel (struct platform_device * pdev )
479
- {
480
- struct device_node * np ;
481
- u32 channel ;
482
- int rc ;
483
-
484
- np = pdev -> dev .of_node ;
485
-
486
- rc = of_property_read_u32 (np , "kcs_chan" , & channel );
487
- if ((rc != 0 ) || (channel == 0 || channel > KCS_CHANNEL_MAX )) {
488
- dev_err (& pdev -> dev , "no valid 'kcs_chan' configured\n" );
489
- return - EINVAL ;
490
- }
491
-
492
- return channel ;
493
- }
494
-
495
- static int
496
- aspeed_kcs_of_v1_get_io_address (struct platform_device * pdev , u32 addrs [2 ])
497
- {
498
- int rc ;
499
-
500
- rc = of_property_read_u32 (pdev -> dev .of_node , "kcs_addr" , addrs );
501
- if (rc || addrs [0 ] > 0xffff ) {
502
- dev_err (& pdev -> dev , "no valid 'kcs_addr' configured\n" );
503
- return - EINVAL ;
504
- }
505
-
506
- return 1 ;
507
- }
508
-
509
- static int aspeed_kcs_of_v2_get_channel (struct platform_device * pdev )
473
+ static int aspeed_kcs_of_get_channel (struct platform_device * pdev )
510
474
{
511
475
struct device_node * np ;
512
476
struct kcs_ioreg ioreg ;
@@ -535,12 +499,11 @@ static int aspeed_kcs_of_v2_get_channel(struct platform_device *pdev)
535
499
if (!memcmp (& ast_kcs_bmc_ioregs [i ], & ioreg , sizeof (ioreg )))
536
500
return i + 1 ;
537
501
}
538
-
539
502
return - EINVAL ;
540
503
}
541
504
542
505
static int
543
- aspeed_kcs_of_v2_get_io_address (struct platform_device * pdev , u32 addrs [2 ])
506
+ aspeed_kcs_of_get_io_address (struct platform_device * pdev , u32 addrs [2 ])
544
507
{
545
508
int rc ;
546
509
@@ -567,7 +530,6 @@ aspeed_kcs_of_v2_get_io_address(struct platform_device *pdev, u32 addrs[2])
567
530
568
531
static int aspeed_kcs_probe (struct platform_device * pdev )
569
532
{
570
- const struct aspeed_kcs_of_ops * ops ;
571
533
struct kcs_bmc_device * kcs_bmc ;
572
534
struct aspeed_kcs_bmc * priv ;
573
535
struct device_node * np ;
@@ -585,15 +547,11 @@ static int aspeed_kcs_probe(struct platform_device *pdev)
585
547
return - ENODEV ;
586
548
}
587
549
588
- ops = of_device_get_match_data (& pdev -> dev );
589
- if (!ops )
590
- return - EINVAL ;
591
-
592
- channel = ops -> get_channel (pdev );
550
+ channel = aspeed_kcs_of_get_channel (pdev );
593
551
if (channel < 0 )
594
552
return channel ;
595
553
596
- nr_addrs = ops -> get_io_address (pdev , addrs );
554
+ nr_addrs = aspeed_kcs_of_get_io_address (pdev , addrs );
597
555
if (nr_addrs < 0 )
598
556
return nr_addrs ;
599
557
@@ -678,22 +636,10 @@ static int aspeed_kcs_remove(struct platform_device *pdev)
678
636
return 0 ;
679
637
}
680
638
681
- static const struct aspeed_kcs_of_ops of_v1_ops = {
682
- .get_channel = aspeed_kcs_of_v1_get_channel ,
683
- .get_io_address = aspeed_kcs_of_v1_get_io_address ,
684
- };
685
-
686
- static const struct aspeed_kcs_of_ops of_v2_ops = {
687
- .get_channel = aspeed_kcs_of_v2_get_channel ,
688
- .get_io_address = aspeed_kcs_of_v2_get_io_address ,
689
- };
690
-
691
639
static const struct of_device_id ast_kcs_bmc_match [] = {
692
- { .compatible = "aspeed,ast2400-kcs-bmc" , .data = & of_v1_ops },
693
- { .compatible = "aspeed,ast2500-kcs-bmc" , .data = & of_v1_ops },
694
- { .compatible = "aspeed,ast2400-kcs-bmc-v2" , .data = & of_v2_ops },
695
- { .compatible = "aspeed,ast2500-kcs-bmc-v2" , .data = & of_v2_ops },
696
- { .compatible = "aspeed,ast2600-kcs-bmc" , .data = & of_v2_ops },
640
+ { .compatible = "aspeed,ast2400-kcs-bmc-v2" },
641
+ { .compatible = "aspeed,ast2500-kcs-bmc-v2" },
642
+ { .compatible = "aspeed,ast2600-kcs-bmc" },
697
643
{ }
698
644
};
699
645
MODULE_DEVICE_TABLE (of , ast_kcs_bmc_match );
0 commit comments