@@ -829,6 +829,24 @@ static int byt_set_pull_strength(u32 *reg, u16 strength)
829829 return 0 ;
830830}
831831
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+
832850static int byt_pin_config_get (struct pinctrl_dev * pctl_dev , unsigned int offset ,
833851 unsigned long * config )
834852{
@@ -919,9 +937,8 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
919937{
920938 struct intel_pinctrl * vg = pinctrl_dev_get_drvdata (pctl_dev );
921939 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 );
923940 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 ;
925942 enum pin_config_param param ;
926943 unsigned long flags ;
927944 int i , ret = 0 ;
@@ -930,7 +947,6 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
930947 raw_spin_lock_irqsave (& byt_lock , flags );
931948
932949 conf = readl (conf_reg );
933- val = readl (val_reg );
934950
935951 for (i = 0 ; i < num_configs ; i ++ ) {
936952 param = pinconf_to_config_param (configs [i ]);
@@ -945,15 +961,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
945961 if (arg == 1 )
946962 arg = 2000 ;
947963
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 );
957965
958966 conf &= ~BYT_PULL_ASSIGN_MASK ;
959967 conf |= BYT_PULL_ASSIGN_DOWN ;
@@ -965,15 +973,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
965973 if (arg == 1 )
966974 arg = 2000 ;
967975
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 );
977977
978978 conf &= ~BYT_PULL_ASSIGN_MASK ;
979979 conf |= BYT_PULL_ASSIGN_UP ;
0 commit comments