@@ -189,6 +189,8 @@ struct exynos5_usbdrd_phy_drvdata {
189189 int n_clks ;
190190 const char * const * core_clk_names ;
191191 int n_core_clks ;
192+ const char * const * regulator_names ;
193+ int n_regulators ;
192194 u32 pmu_offset_usbdrd0_phy ;
193195 u32 pmu_offset_usbdrd0_phy_ss ;
194196 u32 pmu_offset_usbdrd1_phy ;
@@ -205,8 +207,7 @@ struct exynos5_usbdrd_phy_drvdata {
205207 * instances each with its 'phy' and 'phy_cfg'.
206208 * @extrefclk: frequency select settings when using 'separate
207209 * 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
210211 */
211212struct exynos5_usbdrd_phy {
212213 struct device * dev ;
@@ -222,8 +223,7 @@ struct exynos5_usbdrd_phy {
222223 const struct exynos5_usbdrd_phy_config * phy_cfg ;
223224 } phys [EXYNOS5_DRDPHYS_NUM ];
224225 u32 extrefclk ;
225- struct regulator * vbus ;
226- struct regulator * vbus_boost ;
226+ struct regulator_bulk_data * regulators ;
227227};
228228
229229static inline
@@ -507,32 +507,18 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)
507507 return ret ;
508508
509509 /* 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 ;
525515 }
526516
527517 /* Power-on PHY */
528518 inst -> phy_cfg -> phy_isol (inst , false);
529519
530520 return 0 ;
531521
532- fail_vbus_boost :
533- if (phy_drd -> vbus_boost )
534- regulator_disable (phy_drd -> vbus_boost );
535-
536522fail_vbus :
537523 clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_core_clks ,
538524 phy_drd -> core_clks );
@@ -551,10 +537,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
551537 inst -> phy_cfg -> phy_isol (inst , true);
552538
553539 /* 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 );
558542
559543 clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_core_clks ,
560544 phy_drd -> core_clks );
@@ -961,6 +945,10 @@ static const char * const exynos5433_core_clk_names[] = {
961945 "ref" , "phy_pipe" , "phy_utmi" , "itp" ,
962946};
963947
948+ static const char * const exynos5_regulator_names [] = {
949+ "vbus" , "vbus-boost" ,
950+ };
951+
964952static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
965953 .phy_cfg = phy_cfg_exynos5 ,
966954 .phy_ops = & exynos5_usbdrd_phy_ops ,
@@ -970,6 +958,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
970958 .n_clks = ARRAY_SIZE (exynos5_clk_names ),
971959 .core_clk_names = exynos5_core_clk_names ,
972960 .n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
961+ .regulator_names = exynos5_regulator_names ,
962+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
973963};
974964
975965static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = {
@@ -980,6 +970,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = {
980970 .n_clks = ARRAY_SIZE (exynos5_clk_names ),
981971 .core_clk_names = exynos5_core_clk_names ,
982972 .n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
973+ .regulator_names = exynos5_regulator_names ,
974+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
983975};
984976
985977static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
@@ -991,6 +983,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
991983 .n_clks = ARRAY_SIZE (exynos5_clk_names ),
992984 .core_clk_names = exynos5433_core_clk_names ,
993985 .n_core_clks = ARRAY_SIZE (exynos5433_core_clk_names ),
986+ .regulator_names = exynos5_regulator_names ,
987+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
994988};
995989
996990static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
@@ -1001,6 +995,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
1001995 .n_clks = ARRAY_SIZE (exynos5_clk_names ),
1002996 .core_clk_names = exynos5433_core_clk_names ,
1003997 .n_core_clks = ARRAY_SIZE (exynos5433_core_clk_names ),
998+ .regulator_names = exynos5_regulator_names ,
999+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
10041000};
10051001
10061002static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = {
@@ -1011,6 +1007,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = {
10111007 .n_clks = ARRAY_SIZE (exynos5_clk_names ),
10121008 .core_clk_names = exynos5_core_clk_names ,
10131009 .n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
1010+ .regulator_names = exynos5_regulator_names ,
1011+ .n_regulators = ARRAY_SIZE (exynos5_regulator_names ),
10141012};
10151013
10161014static const struct of_device_id exynos5_usbdrd_phy_of_match [] = {
@@ -1083,26 +1081,20 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
10831081 if (channel < 0 )
10841082 dev_dbg (dev , "Not a multi-controller usbdrd phy\n" );
10851083
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" );
11061098
11071099 dev_vdbg (dev , "Creating usbdrd_phy phy\n" );
11081100
0 commit comments