@@ -2299,17 +2299,8 @@ static int rockchip_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
2299
2299
{
2300
2300
struct rockchip_pin_bank * bank = gpiochip_get_data (chip );
2301
2301
u32 data ;
2302
- int ret ;
2303
2302
2304
- ret = clk_enable (bank -> clk );
2305
- if (ret < 0 ) {
2306
- dev_err (bank -> drvdata -> dev ,
2307
- "failed to enable clock for bank %s\n" , bank -> name );
2308
- return ret ;
2309
- }
2310
2303
data = readl_relaxed (bank -> reg_base + GPIO_SWPORT_DDR );
2311
- clk_disable (bank -> clk );
2312
-
2313
2304
if (data & BIT (offset ))
2314
2305
return GPIO_LINE_DIRECTION_OUT ;
2315
2306
@@ -2335,7 +2326,6 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip,
2335
2326
if (ret < 0 )
2336
2327
return ret ;
2337
2328
2338
- clk_enable (bank -> clk );
2339
2329
raw_spin_lock_irqsave (& bank -> slock , flags );
2340
2330
2341
2331
data = readl_relaxed (bank -> reg_base + GPIO_SWPORT_DDR );
@@ -2347,7 +2337,6 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip,
2347
2337
writel_relaxed (data , bank -> reg_base + GPIO_SWPORT_DDR );
2348
2338
2349
2339
raw_spin_unlock_irqrestore (& bank -> slock , flags );
2350
- clk_disable (bank -> clk );
2351
2340
2352
2341
return 0 ;
2353
2342
}
@@ -2798,7 +2787,6 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
2798
2787
unsigned long flags ;
2799
2788
u32 data ;
2800
2789
2801
- clk_enable (bank -> clk );
2802
2790
raw_spin_lock_irqsave (& bank -> slock , flags );
2803
2791
2804
2792
data = readl (reg );
@@ -2808,7 +2796,6 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
2808
2796
writel (data , reg );
2809
2797
2810
2798
raw_spin_unlock_irqrestore (& bank -> slock , flags );
2811
- clk_disable (bank -> clk );
2812
2799
}
2813
2800
2814
2801
/*
@@ -2820,9 +2807,7 @@ static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset)
2820
2807
struct rockchip_pin_bank * bank = gpiochip_get_data (gc );
2821
2808
u32 data ;
2822
2809
2823
- clk_enable (bank -> clk );
2824
2810
data = readl (bank -> reg_base + GPIO_EXT_PORT );
2825
- clk_disable (bank -> clk );
2826
2811
data >>= offset ;
2827
2812
data &= 1 ;
2828
2813
return data ;
@@ -2858,7 +2843,6 @@ static void rockchip_gpio_set_debounce(struct gpio_chip *gc,
2858
2843
unsigned long flags ;
2859
2844
u32 data ;
2860
2845
2861
- clk_enable (bank -> clk );
2862
2846
raw_spin_lock_irqsave (& bank -> slock , flags );
2863
2847
2864
2848
data = readl (reg );
@@ -2869,7 +2853,6 @@ static void rockchip_gpio_set_debounce(struct gpio_chip *gc,
2869
2853
writel (data , reg );
2870
2854
2871
2855
raw_spin_unlock_irqrestore (& bank -> slock , flags );
2872
- clk_disable (bank -> clk );
2873
2856
}
2874
2857
2875
2858
/*
@@ -2914,9 +2897,7 @@ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
2914
2897
if (!bank -> domain )
2915
2898
return - ENXIO ;
2916
2899
2917
- clk_enable (bank -> clk );
2918
2900
virq = irq_create_mapping (bank -> domain , offset );
2919
- clk_disable (bank -> clk );
2920
2901
2921
2902
return (virq ) ? : - ENXIO ;
2922
2903
}
@@ -3015,7 +2996,6 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
3015
2996
if (ret < 0 )
3016
2997
return ret ;
3017
2998
3018
- clk_enable (bank -> clk );
3019
2999
raw_spin_lock_irqsave (& bank -> slock , flags );
3020
3000
3021
3001
data = readl_relaxed (bank -> reg_base + GPIO_SWPORT_DDR );
@@ -3073,7 +3053,6 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
3073
3053
default :
3074
3054
irq_gc_unlock (gc );
3075
3055
raw_spin_unlock_irqrestore (& bank -> slock , flags );
3076
- clk_disable (bank -> clk );
3077
3056
return - EINVAL ;
3078
3057
}
3079
3058
@@ -3082,7 +3061,6 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
3082
3061
3083
3062
irq_gc_unlock (gc );
3084
3063
raw_spin_unlock_irqrestore (& bank -> slock , flags );
3085
- clk_disable (bank -> clk );
3086
3064
3087
3065
return 0 ;
3088
3066
}
@@ -3092,28 +3070,23 @@ static void rockchip_irq_suspend(struct irq_data *d)
3092
3070
struct irq_chip_generic * gc = irq_data_get_irq_chip_data (d );
3093
3071
struct rockchip_pin_bank * bank = gc -> private ;
3094
3072
3095
- clk_enable (bank -> clk );
3096
3073
bank -> saved_masks = irq_reg_readl (gc , GPIO_INTMASK );
3097
3074
irq_reg_writel (gc , ~gc -> wake_active , GPIO_INTMASK );
3098
- clk_disable (bank -> clk );
3099
3075
}
3100
3076
3101
3077
static void rockchip_irq_resume (struct irq_data * d )
3102
3078
{
3103
3079
struct irq_chip_generic * gc = irq_data_get_irq_chip_data (d );
3104
3080
struct rockchip_pin_bank * bank = gc -> private ;
3105
3081
3106
- clk_enable (bank -> clk );
3107
3082
irq_reg_writel (gc , bank -> saved_masks , GPIO_INTMASK );
3108
- clk_disable (bank -> clk );
3109
3083
}
3110
3084
3111
3085
static void rockchip_irq_enable (struct irq_data * d )
3112
3086
{
3113
3087
struct irq_chip_generic * gc = irq_data_get_irq_chip_data (d );
3114
3088
struct rockchip_pin_bank * bank = gc -> private ;
3115
3089
3116
- clk_enable (bank -> clk );
3117
3090
irq_gc_mask_clr_bit (d );
3118
3091
}
3119
3092
@@ -3123,7 +3096,6 @@ static void rockchip_irq_disable(struct irq_data *d)
3123
3096
struct rockchip_pin_bank * bank = gc -> private ;
3124
3097
3125
3098
irq_gc_mask_set_bit (d );
3126
- clk_disable (bank -> clk );
3127
3099
}
3128
3100
3129
3101
static int rockchip_interrupts_register (struct platform_device * pdev ,
@@ -3143,19 +3115,11 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
3143
3115
continue ;
3144
3116
}
3145
3117
3146
- ret = clk_enable (bank -> clk );
3147
- if (ret ) {
3148
- dev_err (& pdev -> dev , "failed to enable clock for bank %s\n" ,
3149
- bank -> name );
3150
- continue ;
3151
- }
3152
-
3153
3118
bank -> domain = irq_domain_add_linear (bank -> of_node , 32 ,
3154
3119
& irq_generic_chip_ops , NULL );
3155
3120
if (!bank -> domain ) {
3156
3121
dev_warn (& pdev -> dev , "could not initialize irq domain for bank %s\n" ,
3157
3122
bank -> name );
3158
- clk_disable (bank -> clk );
3159
3123
continue ;
3160
3124
}
3161
3125
@@ -3166,7 +3130,6 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
3166
3130
dev_err (& pdev -> dev , "could not alloc generic chips for bank %s\n" ,
3167
3131
bank -> name );
3168
3132
irq_domain_remove (bank -> domain );
3169
- clk_disable (bank -> clk );
3170
3133
continue ;
3171
3134
}
3172
3135
@@ -3198,7 +3161,6 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
3198
3161
3199
3162
irq_set_chained_handler_and_data (bank -> irq ,
3200
3163
rockchip_irq_demux , bank );
3201
- clk_disable (bank -> clk );
3202
3164
}
3203
3165
3204
3166
return 0 ;
@@ -3317,7 +3279,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
3317
3279
if (IS_ERR (bank -> clk ))
3318
3280
return PTR_ERR (bank -> clk );
3319
3281
3320
- return clk_prepare (bank -> clk );
3282
+ return clk_prepare_enable (bank -> clk );
3321
3283
}
3322
3284
3323
3285
static const struct of_device_id rockchip_pinctrl_dt_match [];
0 commit comments