Skip to content

Commit faaa832

Browse files
committed
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>
1 parent 1217b79 commit faaa832

1 file changed

Lines changed: 2 additions & 47 deletions

File tree

‎drivers/pinctrl/mvebu/pinctrl-mvebu.c‎

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ struct mvebu_pinctrl {
5050
struct device *dev;
5151
struct pinctrl_dev *pctldev;
5252
struct pinctrl_desc desc;
53-
void __iomem *base;
5453
struct mvebu_pinctrl_group *groups;
5554
unsigned num_groups;
5655
struct mvebu_pinctrl_function *functions;
@@ -138,43 +137,6 @@ static struct mvebu_pinctrl_function *mvebu_pinctrl_find_function_by_name(
138137
return NULL;
139138
}
140139

141-
/*
142-
* Common mpp pin configuration registers on MVEBU are
143-
* registers of eight 4-bit values for each mpp setting.
144-
* Register offset and bit mask are calculated accordingly below.
145-
*/
146-
static int mvebu_common_mpp_get(struct mvebu_pinctrl *pctl,
147-
struct mvebu_pinctrl_group *grp,
148-
unsigned long *config)
149-
{
150-
unsigned pin = grp->gid;
151-
unsigned off = (pin / MPPS_PER_REG) * MPP_BITS;
152-
unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS;
153-
154-
*config = readl(pctl->base + off);
155-
*config >>= shift;
156-
*config &= MPP_MASK;
157-
158-
return 0;
159-
}
160-
161-
static int mvebu_common_mpp_set(struct mvebu_pinctrl *pctl,
162-
struct mvebu_pinctrl_group *grp,
163-
unsigned long config)
164-
{
165-
unsigned pin = grp->gid;
166-
unsigned off = (pin / MPPS_PER_REG) * MPP_BITS;
167-
unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS;
168-
unsigned long reg;
169-
170-
reg = readl(pctl->base + off);
171-
reg &= ~(MPP_MASK << shift);
172-
reg |= (config << shift);
173-
writel(reg, pctl->base + off);
174-
175-
return 0;
176-
}
177-
178140
static int mvebu_pinconf_group_get(struct pinctrl_dev *pctldev,
179141
unsigned gid, unsigned long *config)
180142
{
@@ -184,10 +146,7 @@ static int mvebu_pinconf_group_get(struct pinctrl_dev *pctldev,
184146
if (!grp->ctrl)
185147
return -EINVAL;
186148

187-
if (grp->ctrl->mpp_get)
188-
return grp->ctrl->mpp_get(grp->pins[0], config);
189-
190-
return mvebu_common_mpp_get(pctl, grp, config);
149+
return grp->ctrl->mpp_get(grp->pins[0], config);
191150
}
192151

193152
static int mvebu_pinconf_group_set(struct pinctrl_dev *pctldev,
@@ -202,11 +161,7 @@ static int mvebu_pinconf_group_set(struct pinctrl_dev *pctldev,
202161
return -EINVAL;
203162

204163
for (i = 0; i < num_configs; i++) {
205-
if (grp->ctrl->mpp_set)
206-
ret = grp->ctrl->mpp_set(grp->pins[0], configs[i]);
207-
else
208-
ret = mvebu_common_mpp_set(pctl, grp, configs[i]);
209-
164+
ret = grp->ctrl->mpp_set(grp->pins[0], configs[i]);
210165
if (ret)
211166
return ret;
212167
} /* for each config */

0 commit comments

Comments
 (0)