@@ -189,6 +189,8 @@ struct exynos5_usbdrd_phy_drvdata {
189
189
int n_clks ;
190
190
const char * const * core_clk_names ;
191
191
int n_core_clks ;
192
+ const char * const * regulator_names ;
193
+ int n_regulators ;
192
194
u32 pmu_offset_usbdrd0_phy ;
193
195
u32 pmu_offset_usbdrd0_phy_ss ;
194
196
u32 pmu_offset_usbdrd1_phy ;
@@ -205,8 +207,7 @@ struct exynos5_usbdrd_phy_drvdata {
205
207
* instances each with its 'phy' and 'phy_cfg'.
206
208
* @extrefclk: frequency select settings when using 'separate
207
209
* reference clocks' for SS and HS operations
208
- * @vbus: VBUS regulator for phy
209
- * @vbus_boost: Boost regulator for VBUS present on few Exynos boards
210
+ * @regulators: regulators for phy
210
211
*/
211
212
struct exynos5_usbdrd_phy {
212
213
struct device * dev ;
@@ -222,8 +223,7 @@ struct exynos5_usbdrd_phy {
222
223
const struct exynos5_usbdrd_phy_config * phy_cfg ;
223
224
} phys [EXYNOS5_DRDPHYS_NUM ];
224
225
u32 extrefclk ;
225
- struct regulator * vbus ;
226
- struct regulator * vbus_boost ;
226
+ struct regulator_bulk_data * regulators ;
227
227
};
228
228
229
229
static inline
@@ -507,32 +507,18 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)
507
507
return ret ;
508
508
509
509
/* Enable VBUS supply */
510
- if (phy_drd -> vbus_boost ) {
511
- ret = regulator_enable (phy_drd -> vbus_boost );
512
- if (ret ) {
513
- dev_err (phy_drd -> dev ,
514
- "Failed to enable VBUS boost supply\n" );
515
- goto fail_vbus ;
516
- }
517
- }
518
-
519
- if (phy_drd -> vbus ) {
520
- ret = regulator_enable (phy_drd -> vbus );
521
- if (ret ) {
522
- dev_err (phy_drd -> dev , "Failed to enable VBUS supply\n" );
523
- goto fail_vbus_boost ;
524
- }
510
+ ret = regulator_bulk_enable (phy_drd -> drv_data -> n_regulators ,
511
+ phy_drd -> regulators );
512
+ if (ret ) {
513
+ dev_err (phy_drd -> dev , "Failed to enable PHY regulator(s)\n" );
514
+ goto fail_vbus ;
525
515
}
526
516
527
517
/* Power-on PHY */
528
518
inst -> phy_cfg -> phy_isol (inst , false);
529
519
530
520
return 0 ;
531
521
532
- fail_vbus_boost :
533
- if (phy_drd -> vbus_boost )
534
- regulator_disable (phy_drd -> vbus_boost );
535
-
536
522
fail_vbus :
537
523
clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_core_clks ,
538
524
phy_drd -> core_clks );
@@ -551,10 +537,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
551
537
inst -> phy_cfg -> phy_isol (inst , true);
552
538
553
539
/* Disable VBUS supply */
554
- if (phy_drd -> vbus )
555
- regulator_disable (phy_drd -> vbus );
556
- if (phy_drd -> vbus_boost )
557
- regulator_disable (phy_drd -> vbus_boost );
540
+ regulator_bulk_disable (phy_drd -> drv_data -> n_regulators ,
541
+ phy_drd -> regulators );
558
542
559
543
clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_core_clks ,
560
544
phy_drd -> core_clks );
@@ -961,6 +945,10 @@ static const char * const exynos5433_core_clk_names[] = {
961
945
"ref" , "phy_pipe" , "phy_utmi" , "itp" ,
962
946
};
963
947
948
+ static const char * const exynos5_regulator_names [] = {
949
+ "vbus" , "vbus-boost" ,
950
+ };
951
+
964
952
static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
965
953
.phy_cfg = phy_cfg_exynos5 ,
966
954
.phy_ops = & exynos5_usbdrd_phy_ops ,
@@ -970,6 +958,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
970
958
.n_clks = ARRAY_SIZE (exynos5_clk_names ),
971
959
.core_clk_names = exynos5_core_clk_names ,
972
960
.n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
961
+ .regulator_names = exynos5_regulator_names ,
962
+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
973
963
};
974
964
975
965
static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = {
@@ -980,6 +970,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = {
980
970
.n_clks = ARRAY_SIZE (exynos5_clk_names ),
981
971
.core_clk_names = exynos5_core_clk_names ,
982
972
.n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
973
+ .regulator_names = exynos5_regulator_names ,
974
+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
983
975
};
984
976
985
977
static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
@@ -991,6 +983,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
991
983
.n_clks = ARRAY_SIZE (exynos5_clk_names ),
992
984
.core_clk_names = exynos5433_core_clk_names ,
993
985
.n_core_clks = ARRAY_SIZE (exynos5433_core_clk_names ),
986
+ .regulator_names = exynos5_regulator_names ,
987
+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
994
988
};
995
989
996
990
static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
@@ -1001,6 +995,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
1001
995
.n_clks = ARRAY_SIZE (exynos5_clk_names ),
1002
996
.core_clk_names = exynos5433_core_clk_names ,
1003
997
.n_core_clks = ARRAY_SIZE (exynos5433_core_clk_names ),
998
+ .regulator_names = exynos5_regulator_names ,
999
+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
1004
1000
};
1005
1001
1006
1002
static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = {
@@ -1011,6 +1007,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = {
1011
1007
.n_clks = ARRAY_SIZE (exynos5_clk_names ),
1012
1008
.core_clk_names = exynos5_core_clk_names ,
1013
1009
.n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
1010
+ .regulator_names = exynos5_regulator_names ,
1011
+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
1014
1012
};
1015
1013
1016
1014
static const struct of_device_id exynos5_usbdrd_phy_of_match [] = {
@@ -1083,26 +1081,20 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
1083
1081
if (channel < 0 )
1084
1082
dev_dbg (dev , "Not a multi-controller usbdrd phy\n" );
1085
1083
1086
- /* Get Vbus regulators */
1087
- phy_drd -> vbus = devm_regulator_get (dev , "vbus" );
1088
- if (IS_ERR (phy_drd -> vbus )) {
1089
- ret = PTR_ERR (phy_drd -> vbus );
1090
- if (ret == - EPROBE_DEFER )
1091
- return ret ;
1092
-
1093
- dev_warn (dev , "Failed to get VBUS supply regulator\n" );
1094
- phy_drd -> vbus = NULL ;
1095
- }
1096
-
1097
- phy_drd -> vbus_boost = devm_regulator_get (dev , "vbus-boost" );
1098
- if (IS_ERR (phy_drd -> vbus_boost )) {
1099
- ret = PTR_ERR (phy_drd -> vbus_boost );
1100
- if (ret == - EPROBE_DEFER )
1101
- return ret ;
1102
-
1103
- dev_warn (dev , "Failed to get VBUS boost supply regulator\n" );
1104
- phy_drd -> vbus_boost = NULL ;
1105
- }
1084
+ /* Get regulators */
1085
+ phy_drd -> regulators = devm_kcalloc (dev ,
1086
+ drv_data -> n_regulators ,
1087
+ sizeof (* phy_drd -> regulators ),
1088
+ GFP_KERNEL );
1089
+ if (!phy_drd -> regulators )
1090
+ return ENOMEM ;
1091
+ regulator_bulk_set_supply_names (phy_drd -> regulators ,
1092
+ drv_data -> regulator_names ,
1093
+ drv_data -> n_regulators );
1094
+ ret = devm_regulator_bulk_get (dev , drv_data -> n_regulators ,
1095
+ phy_drd -> regulators );
1096
+ if (ret )
1097
+ return dev_err_probe (dev , ret , "failed to get regulators\n" );
1106
1098
1107
1099
dev_vdbg (dev , "Creating usbdrd_phy phy\n" );
1108
1100
0 commit comments