pinctrl/mvf: add MVF pinctrl driver
PATCH v2 1/2 pinctrl/mvf: add MVF pinctrl driver
It adds Freescale Vybrid Family pin controller
driver to IMX iomuxc common driver framework.
---
V2:
Update the driver according to the IMX new pinctrl framework
.../bindings/pinctrl/fsl,mvf-pinctrl.txt | 48 +++ drivers/pinctrl/Kconfig | 8 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-mvf.c | 337 +++++++++++++++++++++ 4 files changed, 394 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/fsl,mvf-pinctrl.txt create mode 100644 drivers/pinctrl/pinctrl-mvf.c
Documentation/devicetree/bindings/pinctrl/fsl,mvf-pinctrl.txt new file +48 -0
@@ -0,0 +1,48 @@ +Freescale Vybrid IOMUX Controller + +Please refer to fsl,imx-pinctrl.txt in this directory for common binding part +and usage. + +Note: +- On Vybrid, pin's mux mode and pad control are in one 32-bit register. + mux mode bits occupy bit[20:22] and config bits occupy bit[[0:15]. + So the config word is a combination of mux_mode and pad control value. + +Required properties: +- compatible: "fsl,mvf-iomuxc" +- fsl,pins: A pin function macro with one argument, represents a group of + pin's mux and pad control setting. + The format is fsl,pins = < PIN_FUNC_ID(CONFIG) >, PIN_FUNC_ID is a pin + working on a specific function, CONFIG is the pad setting value such as + pull-up, spedd, ode and so on for this pin. + Please refer to Vybrid datasheet for the valid pad mux and control settings. + +CONFIG bits definition: +PAD_MUX_MODE(x) (x << 20) +PAD_CTL_SPEED_LOW (1 << 12) +PAD_CTL_SPEED_MED (2 << 12) +PAD_CTL_SPEED_HIGH (3 << 12) +PAD_CTL_SRE_FAST (1 << 11) +PAD_CTL_SRE_SLOW (0 << 11) +PAD_CTL_ODE (1 << 10) +PAD_CTL_HYS (1 << 9) +PAD_CTL_DSE_DISABLE (0 << 6) +PAD_CTL_DSE_150ohm (1 << 6) +PAD_CTL_DSE_75ohm (2 << 6) +PAD_CTL_DSE_50ohm (3 << 6) +PAD_CTL_DSE_37ohm (4 << 6) +PAD_CTL_DSE_30ohm (5 << 6) +PAD_CTL_DSE_25ohm (6 << 6) +PAD_CTL_DSE_20ohm (7 << 6) +PAD_CTL_PUS_100K_DOWN (0 << 4) +PAD_CTL_PUS_47K_UP (1 << 4) +PAD_CTL_PUS_100K_UP (2 << 4) +PAD_CTL_PUS_22K_UP (3 << 4) +PAD_CTL_PKE (1 << 3) +PAD_CTL_PUE (1 << 2) +PAD_CTL_OBE_ENABLE (1 << 1) +PAD_CTL_IBE_ENABLE (1 << 0) +PAD_CTL_OBE_IBE_ENABLE (3 << 0) + +Please refer to mvf600-pinfunc.h in device tree source folder +for all available PIN_FUNC_ID for Vybrid.
drivers/pinctrl/Kconfig +8 -0
@@ -108,6 +108,14 @@ config PINCTRL_IMX6SL help Say Y here to enable the imx6sl pinctrl driver +config PINCTRL_MVF + bool "Vybrid pinctrl driver" + depends on OF + depends on SOC_MVF600 + select PINCTRL_IMX + help + Say Y here to enable the Freescale Vybrid pinctrl driver + config PINCTRL_LANTIQ bool depends on LANTIQ
drivers/pinctrl/Makefile +1 -0
@@ -45,6 +45,7 @@ obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o obj-$(CONFIG_PINCTRL_S3C64XX) += pinctrl-s3c64xx.o obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o +obj-$(CONFIG_PINCTRL_MVF) += pinctrl-mvf.o obj-$(CONFIG_PLAT_ORION) += mvebu/ obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/
drivers/pinctrl/pinctrl-mvf.c new file +337 -0
337 lines not on this page · raw message
Signature · 1 line
1.8.0
PATCH 2/2 pinctrl/imx: add zero register offset valid for Vybrid platform
On some platform such as Vybrid, offset of mux and pad ctrl register may be zero. This patch add a platform condition to imx core pinctrl framework, making zero register offset valid on setting mux_mode and pad config value.
--- drivers/pinctrl/pinctrl-imx.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/pinctrl/pinctrl-imx.c +22 -12
@@ -221,10 +221,14 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, pin_id = pins[i]; pin_reg = &info->pin_regs[pin_id]; -if (!pin_reg->mux_reg) { -dev_err (ipctl->dev,"Pin(%s) does not support mux function\n" , - info->pins[pin_id].name); -return -EINVAL ; +/* mux_reg offset maybe zero on some platform such as Vybrid */ +if (!of_machine_is_compatible ("fsl,mvf600" )) { +if (!pin_reg->mux_reg) { +dev_err (ipctl->dev, +"Pin(%s) does not support mux function\n" , + info->pins[pin_id].name); +return -EINVAL ; + } }writel (mux[i], ipctl->base + pin_reg->mux_reg);
@@ -287,10 +291,13 @@ static int imx_pinconf_get(struct pinctrl_dev *pctldev,const struct imx_pinctrl_soc_info *info = ipctl->info;const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; -if (!pin_reg->conf_reg) { -dev_err (info->dev,"Pin(%s) does not support config function\n" , - info->pins[pin_id].name); -return -EINVAL ; +if (!of_machine_is_compatible ("fsl,mvf600" )) { +if (!pin_reg->conf_reg) { +dev_err (info->dev, +"Pin(%s) does not support config function\n" , + info->pins[pin_id].name); +return -EINVAL ; + } } *config =readl (ipctl->base + pin_reg->conf_reg);
@@ -305,10 +312,13 @@ static int imx_pinconf_set(struct pinctrl_dev *pctldev,const struct imx_pinctrl_soc_info *info = ipctl->info;const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; -if (!pin_reg->conf_reg) { -dev_err (info->dev,"Pin(%s) does not support config function\n" , - info->pins[pin_id].name); -return -EINVAL ; +if (!of_machine_is_compatible ("fsl,mvf600" )) { +if (!pin_reg->conf_reg) { +dev_err (info->dev, +"Pin(%s) does not support config function\n" , + info->pins[pin_id].name); +return -EINVAL ; + } } dev_dbg(ipctl->dev, "pinconf set pin %s\n",
Signature · 1 line
1.8.0
Sascha Hauer
maintainerPATCH 2/2 pinctrl/imx: add zero register offset valid for Vybrid platform
Quoted 15 lines · Jingchang Lu
On some platform such as Vybrid, offset of mux and pad ctrl register may be zero. This patch add a platform condition to imx core pinctrl framework, making zero register offset valid on setting
mux_modeand pad config value.Signed-off-by Jingchang Lu <[email protected]>--- drivers/pinctrl/pinctrl-imx.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)drivers/pinctrl/pinctrl-imx.c +0
-0
drivers/pinctrl/pinctrl-imx.c static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, · line 226
Quoted 10 lines
drivers/pinctrl/pinctrl-imx.c +3
-4@@ -221,10 +221,14 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, pin_id = pins[i]; pin_reg = &info->pin_regs[pin_id]; -if (!pin_reg->mux_reg) { -dev_err (ipctl->dev,"Pin(%s) does not support mux function\n" , - info->pins[pin_id].name); -return -EINVAL ; +/* mux_reg offset maybe zero on some platform such as Vybrid */ +if (!of_machine_is_compatible ("fsl,mvf600" )) { +if (!pin_reg->mux_reg) {
Please add a zero_offset_valid flag to the drivers private structure instead of using a rather expensive function in a frequently used path. Also the && operator can be used to test for two conditions being true.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH 2/2 pinctrl/imx: add zero register offset valid for Vybrid platform
Quoted 4 lines · Sascha Hauer
Quoted 4 lines
drivers/pinctrl/pinctrl-imx.c +0
-0@@ -221,10 +221,14 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, pin_id = pins[i]; pin_reg = &info->pin_regs[pin_id];
Quoted 11 lines
drivers/pinctrl/pinctrl-imx.c static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, · line 226
Quoted 7 lines
drivers/pinctrl/pinctrl-imx.c +3
-4-if (!pin_reg->mux_reg) { -dev_err (ipctl->dev,"Pin(%s) does not support mux function\n" , - info->pins[pin_id].name); -return -EINVAL ; +/* mux_reg offset maybe zero on some platform such as Vybrid */ +if (!of_machine_is_compatible ("fsl,mvf600" )) { +if (!pin_reg->mux_reg) {Please add a
zero_offset_validflag to the drivers private structure instead of using a rather expensive function in a frequently used path. Also the && operator can be used to test for two conditions being true.
Agreed. I would suggest that we add a flag member into struct imx_pinctrl_soc_info telling the mvf case, and handle the following mvf specialties by checking the flag.
* FSL_PIN_SIZE is 20 on mvf, as PIN_FUNC_ID consists of 4 u32 there.
* Assign mux_reg to conf_reg in imx_pinctrl_parse_groups() for mvf case.
* In imx_pmx_enable(), write mux_reg[22:20] bit field rather than the whole register for mvf case.
* In imx_pinconf_set(), write conf_reg[15:0] bit field rather than the whole register for mvf case.
Doing above will ease the defining of the pin function ID in mvf600-pinfunc.h.
Shawn
PATCH v2 1/2 pinctrl/mvf: add MVF pinctrl driver
In reply to Jingchang LuQuoted 9 lines · Jingchang Lu
It adds Freescale Vybrid Family pin controller
driver to IMX iomuxc common driver framework.Signed-off-by Jingchang Lu <[email protected]>---
V2:
Update the driver according to the IMX new pinctrl framework.../bindings/pinctrl/fsl,mvf-pinctrl.txt | 48 +++
fsl,mvf600-pinctrl.txt
Quoted 3 lines
drivers/pinctrl/Kconfig | 8 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-mvf.c | 337 +++++++++++++++++++++
pinctrl-mvf600.c
Quoted 12 lines
4 files changed, 394 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/fsl,mvf-pinctrl.txt create mode 100644 drivers/pinctrl/pinctrl-mvf.cDocumentation/devicetree/bindings/pinctrl/fsl,mvf-pinctrl.txt new file +2
-0@@ -0,0 +1,48 @@ +Freescale Vybrid IOMUX Controller +
Documentation/devicetree/bindings/pinctrl/fsl,mvf-pinctrl.txt line 12
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/fsl,mvf-pinctrl.txt new file +10
-0+Please refer to fsl,imx-pinctrl.txt in this directory for common binding part +and usage. + +Note: +- On Vybrid, pin's mux mode and pad control are in one 32-bit register. + mux mode bits occupy bit[20:22] and config bits occupy bit[[0:15]. + So the config word is a combination of mux_mode and pad control value. + +Required properties: +- compatible: "fsl,mvf-iomuxc"
fsl,mvf600-iomuxc
Quoted 41 lines
Documentation/devicetree/bindings/pinctrl/fsl,mvf-pinctrl.txt new file +36
-0+- fsl,pins: A pin function macro with one argument, represents a group of + pin's mux and pad control setting. + The format is fsl,pins = < PIN_FUNC_ID(CONFIG) >, PIN_FUNC_ID is a pin + working on a specific function, CONFIG is the pad setting value such as + pull-up, spedd, ode and so on for this pin. + Please refer to Vybrid datasheet for the valid pad mux and control settings. + +CONFIG bits definition: +PAD_MUX_MODE(x) (x << 20) +PAD_CTL_SPEED_LOW (1 << 12) +PAD_CTL_SPEED_MED (2 << 12) +PAD_CTL_SPEED_HIGH (3 << 12) +PAD_CTL_SRE_FAST (1 << 11) +PAD_CTL_SRE_SLOW (0 << 11) +PAD_CTL_ODE (1 << 10) +PAD_CTL_HYS (1 << 9) +PAD_CTL_DSE_DISABLE (0 << 6) +PAD_CTL_DSE_150ohm (1 << 6) +PAD_CTL_DSE_75ohm (2 << 6) +PAD_CTL_DSE_50ohm (3 << 6) +PAD_CTL_DSE_37ohm (4 << 6) +PAD_CTL_DSE_30ohm (5 << 6) +PAD_CTL_DSE_25ohm (6 << 6) +PAD_CTL_DSE_20ohm (7 << 6) +PAD_CTL_PUS_100K_DOWN (0 << 4) +PAD_CTL_PUS_47K_UP (1 << 4) +PAD_CTL_PUS_100K_UP (2 << 4) +PAD_CTL_PUS_22K_UP (3 << 4) +PAD_CTL_PKE (1 << 3) +PAD_CTL_PUE (1 << 2) +PAD_CTL_OBE_ENABLE (1 << 1) +PAD_CTL_IBE_ENABLE (1 << 0) +PAD_CTL_OBE_IBE_ENABLE (3 << 0) + +Please refer to mvf600-pinfunc.h in device tree source folder +for all available PIN_FUNC_ID for Vybrid.drivers/pinctrl/Kconfig +0
-0
drivers/pinctrl/Kconfig config PINCTRL_IMX6SL · line 111
Quoted 4 lines
drivers/pinctrl/Kconfig +1
-0@@ -108,6 +108,14 @@ config PINCTRL_IMX6SL help Say Y here to enable the imx6sl pinctrl driver +config PINCTRL_MVF
PINCTRL_MVF600
Quoted 49 lines
drivers/pinctrl/Kconfig +7
-0+ bool "Vybrid pinctrl driver" + depends on OF + depends on SOC_MVF600 + select PINCTRL_IMX + help + Say Y here to enable the Freescale Vybrid pinctrl driver + config PINCTRL_LANTIQ bool depends on LANTIQdrivers/pinctrl/Makefile +1
-0@@ -45,6 +45,7 @@ obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o obj-$(CONFIG_PINCTRL_S3C64XX) += pinctrl-s3c64xx.o obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o +obj-$(CONFIG_PINCTRL_MVF) += pinctrl-mvf.o obj-$(CONFIG_PLAT_ORION) += mvebu/ obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/drivers/pinctrl/pinctrl-mvf.c new file +21
-0@@ -0,0 +1,337 @@ +/* +* Vybrid pinctrl driver based on imx pinmux and pinconf core +* +* Copyright 2013 Freescale Semiconductor, Inc. +* +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/pinctrl/pinctrl.h> + +#include "pinctrl-imx.h"
...
Quoted 26 lines
drivers/pinctrl/pinctrl-mvf.c new file +26
-0+static struct imx_pinctrl_soc_info mvf600_pinctrl_info = { + .pins = mvf600_pinctrl_pads, + .npins =ARRAY_SIZE (mvf600_pinctrl_pads), +}; + +static struct of_device_id mvf600_pinctrl_of_match[] = { + { .compatible ="fsl,mvf-iomuxc" , }, + {/* sentinel */ } +}; + +static int mvf600_pinctrl_probe (struct platform_device *pdev) +{ +return imx_pinctrl_probe (pdev, &mvf600_pinctrl_info); +} + +static struct platform_driver mvf600_pinctrl_driver = { + .driver = { + .name ="mvf600-pinctrl" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (mvf600_pinctrl_of_match), + }, + .probe = mvf600_pinctrl_probe, + .remove = imx_pinctrl_remove, +}; + +static int __init mvf600_pinctrl_init (void )
drivers/pinctrl/pinctrl-mvf.c line 335
Quoted 10 lines
drivers/pinctrl/pinctrl-mvf.c new file +10
-0+{ +return platform_driver_register (&mvf600_pinctrl_driver); +} +arch_initcall (mvf600_pinctrl_init); + +static void __exit mvf600_pinctrl_exit(void) +{ +platform_driver_unregister (&mvf600_pinctrl_driver); +} +module_exit (mvf600_pinctrl_exit);
Put a blank line here.
Shawn
Quoted 6 lines
drivers/pinctrl/pinctrl-mvf.c new file +2
-0+MODULE_DESCRIPTION ("Freescale MVF600 pinctrl driver" ); +MODULE_LICENSE ("GPL v2" );Signature · 1 line
1.8.0