@@ -2194,9 +2194,6 @@ struct qmp_phy_cfg {
2194
2194
const struct qmp_phy_init_tbl * serdes_4ln_tbl ;
2195
2195
int serdes_4ln_num ;
2196
2196
2197
- /* clock ids to be requested */
2198
- const char * const * clk_list ;
2199
- int num_clks ;
2200
2197
/* resets to be requested */
2201
2198
const char * const * reset_list ;
2202
2199
int num_resets ;
@@ -2275,24 +2272,8 @@ static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val)
2275
2272
}
2276
2273
2277
2274
/* list of clocks required by phy */
2278
- static const char * const ipq8074_pciephy_clk_l [] = {
2279
- "aux" , "cfg_ahb" ,
2280
- };
2281
-
2282
- static const char * const msm8996_phy_clk_l [] = {
2283
- "aux" , "cfg_ahb" , "ref" ,
2284
- };
2285
-
2286
- static const char * const sc8280xp_pciephy_clk_l [] = {
2287
- "aux" , "cfg_ahb" , "ref" , "rchng" ,
2288
- };
2289
-
2290
- static const char * const sdm845_pciephy_clk_l [] = {
2291
- "aux" , "cfg_ahb" , "ref" , "refgen" ,
2292
- };
2293
-
2294
- static const char * const sa8775p_pciephy_clk_l [] = {
2295
- "aux" , "cfg_ahb" , "ref" , "rchng" , "phy_aux" ,
2275
+ static const char * const qmp_pciephy_clk_l [] = {
2276
+ "aux" , "cfg_ahb" , "ref" , "refgen" , "rchng" , "phy_aux" ,
2296
2277
};
2297
2278
2298
2279
/* list of regulators */
@@ -2367,8 +2348,6 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = {
2367
2348
.pcs = ipq8074_pcie_pcs_tbl ,
2368
2349
.pcs_num = ARRAY_SIZE (ipq8074_pcie_pcs_tbl ),
2369
2350
},
2370
- .clk_list = ipq8074_pciephy_clk_l ,
2371
- .num_clks = ARRAY_SIZE (ipq8074_pciephy_clk_l ),
2372
2351
.reset_list = ipq8074_pciephy_reset_l ,
2373
2352
.num_resets = ARRAY_SIZE (ipq8074_pciephy_reset_l ),
2374
2353
.vreg_list = NULL ,
@@ -2394,8 +2373,6 @@ static const struct qmp_phy_cfg ipq8074_pciephy_gen3_cfg = {
2394
2373
.pcs_misc = ipq8074_pcie_gen3_pcs_misc_tbl ,
2395
2374
.pcs_misc_num = ARRAY_SIZE (ipq8074_pcie_gen3_pcs_misc_tbl ),
2396
2375
},
2397
- .clk_list = ipq8074_pciephy_clk_l ,
2398
- .num_clks = ARRAY_SIZE (ipq8074_pciephy_clk_l ),
2399
2376
.reset_list = ipq8074_pciephy_reset_l ,
2400
2377
.num_resets = ARRAY_SIZE (ipq8074_pciephy_reset_l ),
2401
2378
.vreg_list = NULL ,
@@ -2423,8 +2400,6 @@ static const struct qmp_phy_cfg ipq6018_pciephy_cfg = {
2423
2400
.pcs_misc = ipq6018_pcie_pcs_misc_tbl ,
2424
2401
.pcs_misc_num = ARRAY_SIZE (ipq6018_pcie_pcs_misc_tbl ),
2425
2402
},
2426
- .clk_list = ipq8074_pciephy_clk_l ,
2427
- .num_clks = ARRAY_SIZE (ipq8074_pciephy_clk_l ),
2428
2403
.reset_list = ipq8074_pciephy_reset_l ,
2429
2404
.num_resets = ARRAY_SIZE (ipq8074_pciephy_reset_l ),
2430
2405
.vreg_list = NULL ,
@@ -2450,8 +2425,6 @@ static const struct qmp_phy_cfg sdm845_qmp_pciephy_cfg = {
2450
2425
.pcs_misc = sdm845_qmp_pcie_pcs_misc_tbl ,
2451
2426
.pcs_misc_num = ARRAY_SIZE (sdm845_qmp_pcie_pcs_misc_tbl ),
2452
2427
},
2453
- .clk_list = sdm845_pciephy_clk_l ,
2454
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2455
2428
.reset_list = sdm845_pciephy_reset_l ,
2456
2429
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2457
2430
.vreg_list = qmp_phy_vreg_l ,
@@ -2473,8 +2446,6 @@ static const struct qmp_phy_cfg sdm845_qhp_pciephy_cfg = {
2473
2446
.pcs = sdm845_qhp_pcie_pcs_tbl ,
2474
2447
.pcs_num = ARRAY_SIZE (sdm845_qhp_pcie_pcs_tbl ),
2475
2448
},
2476
- .clk_list = sdm845_pciephy_clk_l ,
2477
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2478
2449
.reset_list = sdm845_pciephy_reset_l ,
2479
2450
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2480
2451
.vreg_list = qmp_phy_vreg_l ,
@@ -2510,8 +2481,6 @@ static const struct qmp_phy_cfg sm8250_qmp_gen3x1_pciephy_cfg = {
2510
2481
.pcs_misc = sm8250_qmp_gen3x1_pcie_pcs_misc_tbl ,
2511
2482
.pcs_misc_num = ARRAY_SIZE (sm8250_qmp_gen3x1_pcie_pcs_misc_tbl ),
2512
2483
},
2513
- .clk_list = sdm845_pciephy_clk_l ,
2514
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2515
2484
.reset_list = sdm845_pciephy_reset_l ,
2516
2485
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2517
2486
.vreg_list = qmp_phy_vreg_l ,
@@ -2547,8 +2516,6 @@ static const struct qmp_phy_cfg sm8250_qmp_gen3x2_pciephy_cfg = {
2547
2516
.pcs_misc = sm8250_qmp_gen3x2_pcie_pcs_misc_tbl ,
2548
2517
.pcs_misc_num = ARRAY_SIZE (sm8250_qmp_gen3x2_pcie_pcs_misc_tbl ),
2549
2518
},
2550
- .clk_list = sdm845_pciephy_clk_l ,
2551
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2552
2519
.reset_list = sdm845_pciephy_reset_l ,
2553
2520
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2554
2521
.vreg_list = qmp_phy_vreg_l ,
@@ -2572,8 +2539,6 @@ static const struct qmp_phy_cfg msm8998_pciephy_cfg = {
2572
2539
.pcs = msm8998_pcie_pcs_tbl ,
2573
2540
.pcs_num = ARRAY_SIZE (msm8998_pcie_pcs_tbl ),
2574
2541
},
2575
- .clk_list = msm8996_phy_clk_l ,
2576
- .num_clks = ARRAY_SIZE (msm8996_phy_clk_l ),
2577
2542
.reset_list = ipq8074_pciephy_reset_l ,
2578
2543
.num_resets = ARRAY_SIZE (ipq8074_pciephy_reset_l ),
2579
2544
.vreg_list = qmp_phy_vreg_l ,
@@ -2601,8 +2566,6 @@ static const struct qmp_phy_cfg sc8180x_pciephy_cfg = {
2601
2566
.pcs_misc = sc8180x_qmp_pcie_pcs_misc_tbl ,
2602
2567
.pcs_misc_num = ARRAY_SIZE (sc8180x_qmp_pcie_pcs_misc_tbl ),
2603
2568
},
2604
- .clk_list = sdm845_pciephy_clk_l ,
2605
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2606
2569
.reset_list = sdm845_pciephy_reset_l ,
2607
2570
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2608
2571
.vreg_list = qmp_phy_vreg_l ,
@@ -2636,8 +2599,6 @@ static const struct qmp_phy_cfg sc8280xp_qmp_gen3x1_pciephy_cfg = {
2636
2599
.serdes_num = ARRAY_SIZE (sc8280xp_qmp_gen3x1_pcie_rc_serdes_tbl ),
2637
2600
},
2638
2601
2639
- .clk_list = sc8280xp_pciephy_clk_l ,
2640
- .num_clks = ARRAY_SIZE (sc8280xp_pciephy_clk_l ),
2641
2602
.reset_list = sdm845_pciephy_reset_l ,
2642
2603
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2643
2604
.vreg_list = qmp_phy_vreg_l ,
@@ -2671,8 +2632,6 @@ static const struct qmp_phy_cfg sc8280xp_qmp_gen3x2_pciephy_cfg = {
2671
2632
.serdes_num = ARRAY_SIZE (sc8280xp_qmp_gen3x2_pcie_rc_serdes_tbl ),
2672
2633
},
2673
2634
2674
- .clk_list = sc8280xp_pciephy_clk_l ,
2675
- .num_clks = ARRAY_SIZE (sc8280xp_pciephy_clk_l ),
2676
2635
.reset_list = sdm845_pciephy_reset_l ,
2677
2636
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2678
2637
.vreg_list = qmp_phy_vreg_l ,
@@ -2709,8 +2668,6 @@ static const struct qmp_phy_cfg sc8280xp_qmp_gen3x4_pciephy_cfg = {
2709
2668
.serdes_4ln_tbl = sc8280xp_qmp_gen3x4_pcie_serdes_4ln_tbl ,
2710
2669
.serdes_4ln_num = ARRAY_SIZE (sc8280xp_qmp_gen3x4_pcie_serdes_4ln_tbl ),
2711
2670
2712
- .clk_list = sc8280xp_pciephy_clk_l ,
2713
- .num_clks = ARRAY_SIZE (sc8280xp_pciephy_clk_l ),
2714
2671
.reset_list = sdm845_pciephy_reset_l ,
2715
2672
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2716
2673
.vreg_list = qmp_phy_vreg_l ,
@@ -2751,8 +2708,6 @@ static const struct qmp_phy_cfg sdx55_qmp_pciephy_cfg = {
2751
2708
.pcs_misc_num = ARRAY_SIZE (sdx55_qmp_pcie_ep_pcs_misc_tbl ),
2752
2709
},
2753
2710
2754
- .clk_list = sdm845_pciephy_clk_l ,
2755
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2756
2711
.reset_list = sdm845_pciephy_reset_l ,
2757
2712
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2758
2713
.vreg_list = qmp_phy_vreg_l ,
@@ -2788,8 +2743,6 @@ static const struct qmp_phy_cfg sm8350_qmp_gen3x1_pciephy_cfg = {
2788
2743
.rx_num = ARRAY_SIZE (sm8350_qmp_gen3x1_pcie_rc_rx_tbl ),
2789
2744
},
2790
2745
2791
- .clk_list = sc8280xp_pciephy_clk_l ,
2792
- .num_clks = ARRAY_SIZE (sc8280xp_pciephy_clk_l ),
2793
2746
.reset_list = sdm845_pciephy_reset_l ,
2794
2747
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2795
2748
.vreg_list = qmp_phy_vreg_l ,
@@ -2825,8 +2778,6 @@ static const struct qmp_phy_cfg sm8350_qmp_gen3x2_pciephy_cfg = {
2825
2778
.pcs_num = ARRAY_SIZE (sm8350_qmp_gen3x2_pcie_rc_pcs_tbl ),
2826
2779
},
2827
2780
2828
- .clk_list = sc8280xp_pciephy_clk_l ,
2829
- .num_clks = ARRAY_SIZE (sc8280xp_pciephy_clk_l ),
2830
2781
.reset_list = sdm845_pciephy_reset_l ,
2831
2782
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2832
2783
.vreg_list = qmp_phy_vreg_l ,
@@ -2854,8 +2805,6 @@ static const struct qmp_phy_cfg sdx65_qmp_pciephy_cfg = {
2854
2805
.pcs_misc = sdx65_qmp_pcie_pcs_misc_tbl ,
2855
2806
.pcs_misc_num = ARRAY_SIZE (sdx65_qmp_pcie_pcs_misc_tbl ),
2856
2807
},
2857
- .clk_list = sdm845_pciephy_clk_l ,
2858
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2859
2808
.reset_list = sdm845_pciephy_reset_l ,
2860
2809
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2861
2810
.vreg_list = qmp_phy_vreg_l ,
@@ -2889,8 +2838,6 @@ static const struct qmp_phy_cfg sm8450_qmp_gen3x1_pciephy_cfg = {
2889
2838
.rx_num = ARRAY_SIZE (sm8450_qmp_gen3x1_pcie_rc_rx_tbl ),
2890
2839
},
2891
2840
2892
- .clk_list = sdm845_pciephy_clk_l ,
2893
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2894
2841
.reset_list = sdm845_pciephy_reset_l ,
2895
2842
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2896
2843
.vreg_list = qmp_phy_vreg_l ,
@@ -2931,8 +2878,6 @@ static const struct qmp_phy_cfg sm8450_qmp_gen4x2_pciephy_cfg = {
2931
2878
.pcs_misc_num = ARRAY_SIZE (sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl ),
2932
2879
},
2933
2880
2934
- .clk_list = sdm845_pciephy_clk_l ,
2935
- .num_clks = ARRAY_SIZE (sdm845_pciephy_clk_l ),
2936
2881
.reset_list = sdm845_pciephy_reset_l ,
2937
2882
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2938
2883
.vreg_list = qmp_phy_vreg_l ,
@@ -2960,8 +2905,6 @@ static const struct qmp_phy_cfg sm8550_qmp_gen3x2_pciephy_cfg = {
2960
2905
.pcs_misc = sm8550_qmp_gen3x2_pcie_pcs_misc_tbl ,
2961
2906
.pcs_misc_num = ARRAY_SIZE (sm8550_qmp_gen3x2_pcie_pcs_misc_tbl ),
2962
2907
},
2963
- .clk_list = sc8280xp_pciephy_clk_l ,
2964
- .num_clks = ARRAY_SIZE (sc8280xp_pciephy_clk_l ),
2965
2908
.reset_list = sdm845_pciephy_reset_l ,
2966
2909
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2967
2910
.vreg_list = qmp_phy_vreg_l ,
@@ -2991,8 +2934,6 @@ static const struct qmp_phy_cfg sm8550_qmp_gen4x2_pciephy_cfg = {
2991
2934
.ln_shrd = sm8550_qmp_gen4x2_pcie_ln_shrd_tbl ,
2992
2935
.ln_shrd_num = ARRAY_SIZE (sm8550_qmp_gen4x2_pcie_ln_shrd_tbl ),
2993
2936
},
2994
- .clk_list = sc8280xp_pciephy_clk_l ,
2995
- .num_clks = ARRAY_SIZE (sc8280xp_pciephy_clk_l ),
2996
2937
.reset_list = sdm845_pciephy_reset_l ,
2997
2938
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
2998
2939
.vreg_list = sm8550_qmp_phy_vreg_l ,
@@ -3028,8 +2969,6 @@ static const struct qmp_phy_cfg sa8775p_qmp_gen4x2_pciephy_cfg = {
3028
2969
.pcs_misc_num = ARRAY_SIZE (sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl ),
3029
2970
},
3030
2971
3031
- .clk_list = sa8775p_pciephy_clk_l ,
3032
- .num_clks = ARRAY_SIZE (sa8775p_pciephy_clk_l ),
3033
2972
.reset_list = sdm845_pciephy_reset_l ,
3034
2973
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
3035
2974
.vreg_list = qmp_phy_vreg_l ,
@@ -3064,8 +3003,6 @@ static const struct qmp_phy_cfg sa8775p_qmp_gen4x4_pciephy_cfg = {
3064
3003
.pcs_misc_num = ARRAY_SIZE (sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl ),
3065
3004
},
3066
3005
3067
- .clk_list = sa8775p_pciephy_clk_l ,
3068
- .num_clks = ARRAY_SIZE (sa8775p_pciephy_clk_l ),
3069
3006
.reset_list = sdm845_pciephy_reset_l ,
3070
3007
.num_resets = ARRAY_SIZE (sdm845_pciephy_reset_l ),
3071
3008
.vreg_list = qmp_phy_vreg_l ,
@@ -3188,7 +3125,7 @@ static int qmp_pcie_init(struct phy *phy)
3188
3125
goto err_assert_reset ;
3189
3126
}
3190
3127
3191
- ret = clk_bulk_prepare_enable (cfg -> num_clks , qmp -> clks );
3128
+ ret = clk_bulk_prepare_enable (ARRAY_SIZE ( qmp_pciephy_clk_l ) , qmp -> clks );
3192
3129
if (ret )
3193
3130
goto err_assert_reset ;
3194
3131
@@ -3209,7 +3146,7 @@ static int qmp_pcie_exit(struct phy *phy)
3209
3146
3210
3147
reset_control_bulk_assert (cfg -> num_resets , qmp -> resets );
3211
3148
3212
- clk_bulk_disable_unprepare (cfg -> num_clks , qmp -> clks );
3149
+ clk_bulk_disable_unprepare (ARRAY_SIZE ( qmp_pciephy_clk_l ) , qmp -> clks );
3213
3150
3214
3151
regulator_bulk_disable (cfg -> num_vregs , qmp -> vregs );
3215
3152
@@ -3392,19 +3329,18 @@ static int qmp_pcie_reset_init(struct qmp_pcie *qmp)
3392
3329
3393
3330
static int qmp_pcie_clk_init (struct qmp_pcie * qmp )
3394
3331
{
3395
- const struct qmp_phy_cfg * cfg = qmp -> cfg ;
3396
3332
struct device * dev = qmp -> dev ;
3397
- int num = cfg -> num_clks ;
3333
+ int num = ARRAY_SIZE ( qmp_pciephy_clk_l ) ;
3398
3334
int i ;
3399
3335
3400
3336
qmp -> clks = devm_kcalloc (dev , num , sizeof (* qmp -> clks ), GFP_KERNEL );
3401
3337
if (!qmp -> clks )
3402
3338
return - ENOMEM ;
3403
3339
3404
3340
for (i = 0 ; i < num ; i ++ )
3405
- qmp -> clks [i ].id = cfg -> clk_list [i ];
3341
+ qmp -> clks [i ].id = qmp_pciephy_clk_l [i ];
3406
3342
3407
- return devm_clk_bulk_get (dev , num , qmp -> clks );
3343
+ return devm_clk_bulk_get_optional (dev , num , qmp -> clks );
3408
3344
}
3409
3345
3410
3346
static void phy_clk_release_provider (void * res )
0 commit comments