Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: mvebu: remove common get/set functions

With every SoC always providing its own get/set callbacks, we can now
remove the generic ones, remove the obsolete base address, and always
use the provided callbacks.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

+2 -47
+2 -47
drivers/pinctrl/mvebu/pinctrl-mvebu.c
··· 50 50 struct device *dev; 51 51 struct pinctrl_dev *pctldev; 52 52 struct pinctrl_desc desc; 53 - void __iomem *base; 54 53 struct mvebu_pinctrl_group *groups; 55 54 unsigned num_groups; 56 55 struct mvebu_pinctrl_function *functions; ··· 137 138 return NULL; 138 139 } 139 140 140 - /* 141 - * Common mpp pin configuration registers on MVEBU are 142 - * registers of eight 4-bit values for each mpp setting. 143 - * Register offset and bit mask are calculated accordingly below. 144 - */ 145 - static int mvebu_common_mpp_get(struct mvebu_pinctrl *pctl, 146 - struct mvebu_pinctrl_group *grp, 147 - unsigned long *config) 148 - { 149 - unsigned pin = grp->gid; 150 - unsigned off = (pin / MPPS_PER_REG) * MPP_BITS; 151 - unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS; 152 - 153 - *config = readl(pctl->base + off); 154 - *config >>= shift; 155 - *config &= MPP_MASK; 156 - 157 - return 0; 158 - } 159 - 160 - static int mvebu_common_mpp_set(struct mvebu_pinctrl *pctl, 161 - struct mvebu_pinctrl_group *grp, 162 - unsigned long config) 163 - { 164 - unsigned pin = grp->gid; 165 - unsigned off = (pin / MPPS_PER_REG) * MPP_BITS; 166 - unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS; 167 - unsigned long reg; 168 - 169 - reg = readl(pctl->base + off); 170 - reg &= ~(MPP_MASK << shift); 171 - reg |= (config << shift); 172 - writel(reg, pctl->base + off); 173 - 174 - return 0; 175 - } 176 - 177 141 static int mvebu_pinconf_group_get(struct pinctrl_dev *pctldev, 178 142 unsigned gid, unsigned long *config) 179 143 { ··· 146 184 if (!grp->ctrl) 147 185 return -EINVAL; 148 186 149 - if (grp->ctrl->mpp_get) 150 - return grp->ctrl->mpp_get(grp->pins[0], config); 151 - 152 - return mvebu_common_mpp_get(pctl, grp, config); 187 + return grp->ctrl->mpp_get(grp->pins[0], config); 153 188 } 154 189 155 190 static int mvebu_pinconf_group_set(struct pinctrl_dev *pctldev, ··· 161 202 return -EINVAL; 162 203 163 204 for (i = 0; i < num_configs; i++) { 164 - if (grp->ctrl->mpp_set) 165 - ret = grp->ctrl->mpp_set(grp->pins[0], configs[i]); 166 - else 167 - ret = mvebu_common_mpp_set(pctl, grp, configs[i]); 168 - 205 + ret = grp->ctrl->mpp_set(grp->pins[0], configs[i]); 169 206 if (ret) 170 207 return ret; 171 208 } /* for each config */