diff options
Diffstat (limited to 'drivers/pinctrl/spear/pinctrl-spear.c')
-rw-r--r-- | drivers/pinctrl/spear/pinctrl-spear.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c index cbca6dc66eb7..f9483ae42726 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.c +++ b/drivers/pinctrl/spear/pinctrl-spear.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/io.h> | ||
18 | #include <linux/module.h> | 17 | #include <linux/module.h> |
19 | #include <linux/of.h> | 18 | #include <linux/of.h> |
20 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
@@ -29,16 +28,6 @@ | |||
29 | 28 | ||
30 | #define DRIVER_NAME "spear-pinmux" | 29 | #define DRIVER_NAME "spear-pinmux" |
31 | 30 | ||
32 | static inline u32 pmx_readl(struct spear_pmx *pmx, u32 reg) | ||
33 | { | ||
34 | return readl_relaxed(pmx->vbase + reg); | ||
35 | } | ||
36 | |||
37 | static inline void pmx_writel(struct spear_pmx *pmx, u32 val, u32 reg) | ||
38 | { | ||
39 | writel_relaxed(val, pmx->vbase + reg); | ||
40 | } | ||
41 | |||
42 | static void muxregs_endisable(struct spear_pmx *pmx, | 31 | static void muxregs_endisable(struct spear_pmx *pmx, |
43 | struct spear_muxreg *muxregs, u8 count, bool enable) | 32 | struct spear_muxreg *muxregs, u8 count, bool enable) |
44 | { | 33 | { |
@@ -316,16 +305,25 @@ static int gpio_request_endisable(struct pinctrl_dev *pctldev, | |||
316 | struct pinctrl_gpio_range *range, unsigned offset, bool enable) | 305 | struct pinctrl_gpio_range *range, unsigned offset, bool enable) |
317 | { | 306 | { |
318 | struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); | 307 | struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); |
308 | struct spear_pinctrl_machdata *machdata = pmx->machdata; | ||
319 | struct spear_gpio_pingroup *gpio_pingroup; | 309 | struct spear_gpio_pingroup *gpio_pingroup; |
320 | 310 | ||
311 | /* | ||
312 | * Some SoC have configuration options applicable to group of pins, | ||
313 | * rather than a single pin. | ||
314 | */ | ||
321 | gpio_pingroup = get_gpio_pingroup(pmx, offset); | 315 | gpio_pingroup = get_gpio_pingroup(pmx, offset); |
322 | if (IS_ERR(gpio_pingroup)) | ||
323 | return PTR_ERR(gpio_pingroup); | ||
324 | |||
325 | if (gpio_pingroup) | 316 | if (gpio_pingroup) |
326 | muxregs_endisable(pmx, gpio_pingroup->muxregs, | 317 | muxregs_endisable(pmx, gpio_pingroup->muxregs, |
327 | gpio_pingroup->nmuxregs, enable); | 318 | gpio_pingroup->nmuxregs, enable); |
328 | 319 | ||
320 | /* | ||
321 | * SoC may need some extra configurations, or configurations for single | ||
322 | * pin | ||
323 | */ | ||
324 | if (machdata->gpio_request_endisable) | ||
325 | machdata->gpio_request_endisable(pmx, offset, enable); | ||
326 | |||
329 | return 0; | 327 | return 0; |
330 | } | 328 | } |
331 | 329 | ||