2
2
/*
3
3
* ZynqMP pin controller
4
4
*
5
- * Copyright (C) 2020 Xilinx, Inc.
5
+ * Copyright (C) 2020, 2021 Xilinx, Inc.
6
6
*
7
7
* Sai Krishna Potthuri <[email protected] >
8
8
@@ -252,9 +252,6 @@ static int zynqmp_pinconf_cfg_get(struct pinctrl_dev *pctldev,
252
252
unsigned int arg , param = pinconf_to_config_param (* config );
253
253
int ret ;
254
254
255
- if (pin >= zynqmp_desc .npins )
256
- return - EOPNOTSUPP ;
257
-
258
255
switch (param ) {
259
256
case PIN_CONFIG_SLEW_RATE :
260
257
param = PM_PINCTRL_CONFIG_SLEW_RATE ;
@@ -317,7 +314,7 @@ static int zynqmp_pinconf_cfg_get(struct pinctrl_dev *pctldev,
317
314
}
318
315
break ;
319
316
default :
320
- ret = - EOPNOTSUPP ;
317
+ ret = - ENOTSUPP ;
321
318
break ;
322
319
}
323
320
@@ -348,9 +345,6 @@ static int zynqmp_pinconf_cfg_set(struct pinctrl_dev *pctldev,
348
345
{
349
346
int i , ret ;
350
347
351
- if (pin >= zynqmp_desc .npins )
352
- return - EOPNOTSUPP ;
353
-
354
348
for (i = 0 ; i < num_configs ; i ++ ) {
355
349
unsigned int param = pinconf_to_config_param (configs [i ]);
356
350
unsigned int arg = pinconf_to_config_argument (configs [i ]);
@@ -428,7 +422,7 @@ static int zynqmp_pinconf_cfg_set(struct pinctrl_dev *pctldev,
428
422
dev_warn (pctldev -> dev ,
429
423
"unsupported configuration parameter '%u'\n" ,
430
424
param );
431
- ret = - EOPNOTSUPP ;
425
+ ret = - ENOTSUPP ;
432
426
break ;
433
427
}
434
428
@@ -504,7 +498,7 @@ static int zynqmp_pinctrl_get_function_groups(u32 fid, u32 index, u16 *groups)
504
498
505
499
memcpy (groups , & payload [1 ], PINCTRL_GET_FUNC_GROUPS_RESP_LEN );
506
500
507
- return ret ;
501
+ return 0 ;
508
502
}
509
503
510
504
static int zynqmp_pinctrl_get_func_num_groups (u32 fid , unsigned int * ngroups )
@@ -522,7 +516,7 @@ static int zynqmp_pinctrl_get_func_num_groups(u32 fid, unsigned int *ngroups)
522
516
523
517
* ngroups = payload [1 ];
524
518
525
- return ret ;
519
+ return 0 ;
526
520
}
527
521
528
522
/**
@@ -533,16 +527,16 @@ static int zynqmp_pinctrl_get_func_num_groups(u32 fid, unsigned int *ngroups)
533
527
* @groups: Groups data.
534
528
*
535
529
* Query firmware to get group IDs for each function. Firmware returns
536
- * group IDs. Based on group index for the function, group names in
530
+ * group IDs. Based on the group index for the function, group names in
537
531
* the function are stored. For example, the first group in "eth0" function
538
- * is named as "eth0_0" and second group as "eth0_1" and so on.
532
+ * is named as "eth0_0" and the second group as "eth0_1" and so on.
539
533
*
540
534
* Based on the group ID received from the firmware, function stores name of
541
535
* the group for that group ID. For example, if "eth0" first group ID
542
536
* is x, groups[x] name will be stored as "eth0_0".
543
537
*
544
538
* Once done for each function, each function would have its group names
545
- * and each groups would also have their names.
539
+ * and each group would also have their names.
546
540
*
547
541
* Return: 0 on success else error code.
548
542
*/
@@ -552,7 +546,7 @@ static int zynqmp_pinctrl_prepare_func_groups(struct device *dev, u32 fid,
552
546
{
553
547
u16 resp [NUM_GROUPS_PER_RESP ] = {0 };
554
548
const char * * fgroups ;
555
- int ret = 0 , index , i ;
549
+ int ret , index , i ;
556
550
557
551
fgroups = devm_kzalloc (dev , sizeof (* fgroups ) * func -> ngroups , GFP_KERNEL );
558
552
if (!fgroups )
@@ -588,7 +582,7 @@ static int zynqmp_pinctrl_prepare_func_groups(struct device *dev, u32 fid,
588
582
done :
589
583
func -> groups = fgroups ;
590
584
591
- return ret ;
585
+ return 0 ;
592
586
}
593
587
594
588
static void zynqmp_pinctrl_get_function_name (u32 fid , char * name )
@@ -622,7 +616,7 @@ static int zynqmp_pinctrl_get_num_functions(unsigned int *nfuncs)
622
616
623
617
* nfuncs = payload [1 ];
624
618
625
- return ret ;
619
+ return 0 ;
626
620
}
627
621
628
622
static int zynqmp_pinctrl_get_pin_groups (u32 pin , u32 index , u16 * groups )
@@ -641,7 +635,7 @@ static int zynqmp_pinctrl_get_pin_groups(u32 pin, u32 index, u16 *groups)
641
635
642
636
memcpy (groups , & payload [1 ], PINCTRL_GET_PIN_GROUPS_RESP_LEN );
643
637
644
- return ret ;
638
+ return 0 ;
645
639
}
646
640
647
641
static void zynqmp_pinctrl_group_add_pin (struct zynqmp_pctrl_group * group ,
@@ -660,7 +654,7 @@ static void zynqmp_pinctrl_group_add_pin(struct zynqmp_pctrl_group *group,
660
654
* Based on the firmware response(group IDs for the pin), add
661
655
* pin number to the respective group's pin array.
662
656
*
663
- * Once all pins are queries, each groups would have its number
657
+ * Once all pins are queries, each group would have its number
664
658
* of pins and pin numbers data.
665
659
*
666
660
* Return: 0 on success else error code.
@@ -689,7 +683,7 @@ static int zynqmp_pinctrl_create_pin_groups(struct device *dev,
689
683
index += NUM_GROUPS_PER_RESP ;
690
684
} while (index <= MAX_PIN_GROUPS );
691
685
692
- return ret ;
686
+ return 0 ;
693
687
}
694
688
695
689
/**
@@ -727,7 +721,7 @@ static int zynqmp_pinctrl_prepare_group_pins(struct device *dev,
727
721
* prepare pin control driver data.
728
722
*
729
723
* Query number of functions and number of function groups (number
730
- * of groups in given function) to allocate required memory buffers
724
+ * of groups in the given function) to allocate required memory buffers
731
725
* for functions and groups. Once buffers are allocated to store
732
726
* functions and groups data, query and store required information
733
727
* (number of groups and group names for each function, number of
@@ -778,7 +772,7 @@ static int zynqmp_pinctrl_prepare_function_info(struct device *dev,
778
772
pctrl -> funcs = funcs ;
779
773
pctrl -> groups = groups ;
780
774
781
- return ret ;
775
+ return 0 ;
782
776
}
783
777
784
778
static int zynqmp_pinctrl_get_num_pins (unsigned int * npins )
@@ -795,7 +789,7 @@ static int zynqmp_pinctrl_get_num_pins(unsigned int *npins)
795
789
796
790
* npins = payload [1 ];
797
791
798
- return ret ;
792
+ return 0 ;
799
793
}
800
794
801
795
/**
@@ -853,19 +847,17 @@ static int zynqmp_pinctrl_probe(struct platform_device *pdev)
853
847
& zynqmp_desc .pins ,
854
848
& zynqmp_desc .npins );
855
849
if (ret ) {
856
- dev_err (& pdev -> dev , "pin desc prepare fail with %d\n" ,
857
- ret );
850
+ dev_err (& pdev -> dev , "pin desc prepare fail with %d\n" , ret );
858
851
return ret ;
859
852
}
860
853
861
854
ret = zynqmp_pinctrl_prepare_function_info (& pdev -> dev , pctrl );
862
855
if (ret ) {
863
- dev_err (& pdev -> dev , "function info prepare fail with %d\n" ,
864
- ret );
856
+ dev_err (& pdev -> dev , "function info prepare fail with %d\n" , ret );
865
857
return ret ;
866
858
}
867
859
868
- pctrl -> pctrl = pinctrl_register ( & zynqmp_desc , & pdev -> dev , pctrl );
860
+ pctrl -> pctrl = devm_pinctrl_register ( & pdev -> dev , & zynqmp_desc , pctrl );
869
861
if (IS_ERR (pctrl -> pctrl ))
870
862
return PTR_ERR (pctrl -> pctrl );
871
863
@@ -887,7 +879,6 @@ static const struct of_device_id zynqmp_pinctrl_of_match[] = {
887
879
{ .compatible = "xlnx,zynqmp-pinctrl" },
888
880
{ }
889
881
};
890
-
891
882
MODULE_DEVICE_TABLE (of , zynqmp_pinctrl_of_match );
892
883
893
884
static struct platform_driver zynqmp_pinctrl_driver = {
@@ -898,7 +889,6 @@ static struct platform_driver zynqmp_pinctrl_driver = {
898
889
.probe = zynqmp_pinctrl_probe ,
899
890
.remove = zynqmp_pinctrl_remove ,
900
891
};
901
-
902
892
module_platform_driver (zynqmp_pinctrl_driver );
903
893
904
894
MODULE_AUTHOR (
"Sai Krishna Potthuri <[email protected] >" );
0 commit comments