@@ -829,6 +829,24 @@ static int byt_set_pull_strength(u32 *reg, u16 strength)
829
829
return 0 ;
830
830
}
831
831
832
+ static void byt_gpio_force_input_mode (struct intel_pinctrl * vg , unsigned int offset )
833
+ {
834
+ void __iomem * reg = byt_gpio_reg (vg , offset , BYT_VAL_REG );
835
+ u32 value ;
836
+
837
+ value = readl (reg );
838
+ if (!(value & BYT_INPUT_EN ))
839
+ return ;
840
+
841
+ /*
842
+ * Pull assignment is only applicable in input mode. If
843
+ * chip is not in input mode, set it and warn about it.
844
+ */
845
+ value &= ~BYT_INPUT_EN ;
846
+ writel (value , reg );
847
+ dev_warn (vg -> dev , "Pin %i: forcibly set to input mode\n" , offset );
848
+ }
849
+
832
850
static int byt_pin_config_get (struct pinctrl_dev * pctl_dev , unsigned int offset ,
833
851
unsigned long * config )
834
852
{
@@ -919,9 +937,8 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
919
937
{
920
938
struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctl_dev );
921
939
void __iomem * conf_reg = byt_gpio_reg (vg , offset , BYT_CONF0_REG );
922
- void __iomem * val_reg = byt_gpio_reg (vg , offset , BYT_VAL_REG );
923
940
void __iomem * db_reg = byt_gpio_reg (vg , offset , BYT_DEBOUNCE_REG );
924
- u32 conf , val , db_pulse , debounce ;
941
+ u32 conf , db_pulse , debounce ;
925
942
enum pin_config_param param ;
926
943
unsigned long flags ;
927
944
int i , ret = 0 ;
@@ -930,7 +947,6 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
930
947
raw_spin_lock_irqsave (& byt_lock , flags );
931
948
932
949
conf = readl (conf_reg );
933
- val = readl (val_reg );
934
950
935
951
for (i = 0 ; i < num_configs ; i ++ ) {
936
952
param = pinconf_to_config_param (configs [i ]);
@@ -945,15 +961,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
945
961
if (arg == 1 )
946
962
arg = 2000 ;
947
963
948
- /*
949
- * Pull assignment is only applicable in input mode. If
950
- * chip is not in input mode, set it and warn about it.
951
- */
952
- if (val & BYT_INPUT_EN ) {
953
- val &= ~BYT_INPUT_EN ;
954
- writel (val , val_reg );
955
- dev_warn (vg -> dev , "Pin %i: forcibly set to input mode\n" , offset );
956
- }
964
+ byt_gpio_force_input_mode (vg , offset );
957
965
958
966
conf &= ~BYT_PULL_ASSIGN_MASK ;
959
967
conf |= BYT_PULL_ASSIGN_DOWN ;
@@ -965,15 +973,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
965
973
if (arg == 1 )
966
974
arg = 2000 ;
967
975
968
- /*
969
- * Pull assignment is only applicable in input mode. If
970
- * chip is not in input mode, set it and warn about it.
971
- */
972
- if (val & BYT_INPUT_EN ) {
973
- val &= ~BYT_INPUT_EN ;
974
- writel (val , val_reg );
975
- dev_warn (vg -> dev , "Pin %i: forcibly set to input mode\n" , offset );
976
- }
976
+ byt_gpio_force_input_mode (vg , offset );
977
977
978
978
conf &= ~BYT_PULL_ASSIGN_MASK ;
979
979
conf |= BYT_PULL_ASSIGN_UP ;
0 commit comments