@@ -185,6 +185,8 @@ struct exynos5_usbdrd_phy_config {
185
185
struct exynos5_usbdrd_phy_drvdata {
186
186
const struct exynos5_usbdrd_phy_config * phy_cfg ;
187
187
const struct phy_ops * phy_ops ;
188
+ const char * const * clk_names ;
189
+ int n_clks ;
188
190
const char * const * core_clk_names ;
189
191
int n_core_clks ;
190
192
u32 pmu_offset_usbdrd0_phy ;
@@ -196,7 +198,7 @@ struct exynos5_usbdrd_phy_drvdata {
196
198
* struct exynos5_usbdrd_phy - driver data for USB 3.0 PHY
197
199
* @dev: pointer to device instance of this platform device
198
200
* @reg_phy: usb phy controller register memory base
199
- * @clk: phy clock for register access
201
+ * @clks: clocks for register access
200
202
* @core_clks: core clocks for phy (ref, pipe3, utmi+, ITP, etc. as required)
201
203
* @drv_data: pointer to SoC level driver data structure
202
204
* @phys: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY
@@ -209,7 +211,7 @@ struct exynos5_usbdrd_phy_drvdata {
209
211
struct exynos5_usbdrd_phy {
210
212
struct device * dev ;
211
213
void __iomem * reg_phy ;
212
- struct clk * clk ;
214
+ struct clk_bulk_data * clks ;
213
215
struct clk_bulk_data * core_clks ;
214
216
const struct exynos5_usbdrd_phy_drvdata * drv_data ;
215
217
struct phy_usb_instance {
@@ -402,7 +404,7 @@ static int exynos5_usbdrd_phy_init(struct phy *phy)
402
404
struct phy_usb_instance * inst = phy_get_drvdata (phy );
403
405
struct exynos5_usbdrd_phy * phy_drd = to_usbdrd_phy (inst );
404
406
405
- ret = clk_prepare_enable (phy_drd -> clk );
407
+ ret = clk_bulk_prepare_enable (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
406
408
if (ret )
407
409
return ret ;
408
410
@@ -452,7 +454,7 @@ static int exynos5_usbdrd_phy_init(struct phy *phy)
452
454
reg &= ~PHYCLKRST_PORTRESET ;
453
455
writel (reg , phy_drd -> reg_phy + EXYNOS5_DRD_PHYCLKRST );
454
456
455
- clk_disable_unprepare (phy_drd -> clk );
457
+ clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
456
458
457
459
return 0 ;
458
460
}
@@ -464,7 +466,7 @@ static int exynos5_usbdrd_phy_exit(struct phy *phy)
464
466
struct phy_usb_instance * inst = phy_get_drvdata (phy );
465
467
struct exynos5_usbdrd_phy * phy_drd = to_usbdrd_phy (inst );
466
468
467
- ret = clk_prepare_enable (phy_drd -> clk );
469
+ ret = clk_bulk_prepare_enable (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
468
470
if (ret )
469
471
return ret ;
470
472
@@ -486,7 +488,7 @@ static int exynos5_usbdrd_phy_exit(struct phy *phy)
486
488
PHYTEST_POWERDOWN_HSP ;
487
489
writel (reg , phy_drd -> reg_phy + EXYNOS5_DRD_PHYTEST );
488
490
489
- clk_disable_unprepare (phy_drd -> clk );
491
+ clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
490
492
491
493
return 0 ;
492
494
}
@@ -811,14 +813,14 @@ static int exynos850_usbdrd_phy_init(struct phy *phy)
811
813
struct exynos5_usbdrd_phy * phy_drd = to_usbdrd_phy (inst );
812
814
int ret ;
813
815
814
- ret = clk_prepare_enable (phy_drd -> clk );
816
+ ret = clk_bulk_prepare_enable (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
815
817
if (ret )
816
818
return ret ;
817
819
818
820
/* UTMI or PIPE3 specific init */
819
821
inst -> phy_cfg -> phy_init (phy_drd );
820
822
821
- clk_disable_unprepare (phy_drd -> clk );
823
+ clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
822
824
823
825
return 0 ;
824
826
}
@@ -831,7 +833,7 @@ static int exynos850_usbdrd_phy_exit(struct phy *phy)
831
833
u32 reg ;
832
834
int ret ;
833
835
834
- ret = clk_prepare_enable (phy_drd -> clk );
836
+ ret = clk_bulk_prepare_enable (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
835
837
if (ret )
836
838
return ret ;
837
839
@@ -854,7 +856,7 @@ static int exynos850_usbdrd_phy_exit(struct phy *phy)
854
856
reg &= ~CLKRST_LINK_SW_RST ;
855
857
writel (reg , regs_base + EXYNOS850_DRD_CLKRST );
856
858
857
- clk_disable_unprepare (phy_drd -> clk );
859
+ clk_bulk_disable_unprepare (phy_drd -> drv_data -> n_clks , phy_drd -> clks );
858
860
859
861
return 0 ;
860
862
}
@@ -873,11 +875,19 @@ static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd)
873
875
struct clk * ref_clk ;
874
876
unsigned long ref_rate ;
875
877
876
- phy_drd -> clk = devm_clk_get (phy_drd -> dev , "phy" );
877
- if (IS_ERR (phy_drd -> clk )) {
878
- dev_err (phy_drd -> dev , "Failed to get phy clock\n" );
879
- return PTR_ERR (phy_drd -> clk );
880
- }
878
+ phy_drd -> clks = devm_kcalloc (phy_drd -> dev , phy_drd -> drv_data -> n_clks ,
879
+ sizeof (* phy_drd -> clks ), GFP_KERNEL );
880
+ if (!phy_drd -> clks )
881
+ return - ENOMEM ;
882
+
883
+ for (int i = 0 ; i < phy_drd -> drv_data -> n_clks ; ++ i )
884
+ phy_drd -> clks [i ].id = phy_drd -> drv_data -> clk_names [i ];
885
+
886
+ ret = devm_clk_bulk_get (phy_drd -> dev , phy_drd -> drv_data -> n_clks ,
887
+ phy_drd -> clks );
888
+ if (ret )
889
+ return dev_err_probe (phy_drd -> dev , ret ,
890
+ "failed to get phy clock(s)\n" );
881
891
882
892
phy_drd -> core_clks = devm_kcalloc (phy_drd -> dev ,
883
893
phy_drd -> drv_data -> n_core_clks ,
@@ -939,6 +949,10 @@ static const struct exynos5_usbdrd_phy_config phy_cfg_exynos850[] = {
939
949
},
940
950
};
941
951
952
+ static const char * const exynos5_clk_names [] = {
953
+ "phy" ,
954
+ };
955
+
942
956
static const char * const exynos5_core_clk_names [] = {
943
957
"ref" ,
944
958
};
@@ -952,6 +966,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {
952
966
.phy_ops = & exynos5_usbdrd_phy_ops ,
953
967
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL ,
954
968
.pmu_offset_usbdrd1_phy = EXYNOS5420_USBDRD1_PHY_CONTROL ,
969
+ .clk_names = exynos5_clk_names ,
970
+ .n_clks = ARRAY_SIZE (exynos5_clk_names ),
955
971
.core_clk_names = exynos5_core_clk_names ,
956
972
.n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
957
973
};
@@ -960,6 +976,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = {
960
976
.phy_cfg = phy_cfg_exynos5 ,
961
977
.phy_ops = & exynos5_usbdrd_phy_ops ,
962
978
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL ,
979
+ .clk_names = exynos5_clk_names ,
980
+ .n_clks = ARRAY_SIZE (exynos5_clk_names ),
963
981
.core_clk_names = exynos5_core_clk_names ,
964
982
.n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
965
983
};
@@ -969,6 +987,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {
969
987
.phy_ops = & exynos5_usbdrd_phy_ops ,
970
988
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL ,
971
989
.pmu_offset_usbdrd1_phy = EXYNOS5433_USBHOST30_PHY_CONTROL ,
990
+ .clk_names = exynos5_clk_names ,
991
+ .n_clks = ARRAY_SIZE (exynos5_clk_names ),
972
992
.core_clk_names = exynos5433_core_clk_names ,
973
993
.n_core_clks = ARRAY_SIZE (exynos5433_core_clk_names ),
974
994
};
@@ -977,6 +997,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
977
997
.phy_cfg = phy_cfg_exynos5 ,
978
998
.phy_ops = & exynos5_usbdrd_phy_ops ,
979
999
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL ,
1000
+ .clk_names = exynos5_clk_names ,
1001
+ .n_clks = ARRAY_SIZE (exynos5_clk_names ),
980
1002
.core_clk_names = exynos5433_core_clk_names ,
981
1003
.n_core_clks = ARRAY_SIZE (exynos5433_core_clk_names ),
982
1004
};
@@ -985,6 +1007,8 @@ static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = {
985
1007
.phy_cfg = phy_cfg_exynos850 ,
986
1008
.phy_ops = & exynos850_usbdrd_phy_ops ,
987
1009
.pmu_offset_usbdrd0_phy = EXYNOS5_USBDRD_PHY_CONTROL ,
1010
+ .clk_names = exynos5_clk_names ,
1011
+ .n_clks = ARRAY_SIZE (exynos5_clk_names ),
988
1012
.core_clk_names = exynos5_core_clk_names ,
989
1013
.n_core_clks = ARRAY_SIZE (exynos5_core_clk_names ),
990
1014
};
0 commit comments