* [PATCH 0/6] pinctrl: add DT support in PXA series
@ 2012-07-28 6:58 Haojian Zhuang
2012-07-28 6:58 ` [PATCH 1/6] pinctrl: append new pins and groups in pxa910 Haojian Zhuang
` (5 more replies)
0 siblings, 6 replies; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 6:58 UTC (permalink / raw)
To: linux-arm-kernel
1. Add DT support in pinctrl driver of pxa series.
2. Add pinconf support in pinctrl driver of pxa series.
3. Select PINCTRL by default in PXA series boards with DT support.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 1/6] pinctrl: append new pins and groups in pxa910
2012-07-28 6:58 [PATCH 0/6] pinctrl: add DT support in PXA series Haojian Zhuang
@ 2012-07-28 6:58 ` Haojian Zhuang
2012-08-05 0:04 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 2/6] pinctrl: add pinconf support in pxa3xx Haojian Zhuang
` (4 subsequent siblings)
5 siblings, 1 reply; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 6:58 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
drivers/pinctrl/pinctrl-pxa910.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-pxa910.c b/drivers/pinctrl/pinctrl-pxa910.c
index c72ab4b..4164a6b 100644
--- a/drivers/pinctrl/pinctrl-pxa910.c
+++ b/drivers/pinctrl/pinctrl-pxa910.c
@@ -307,6 +307,7 @@ static struct pinctrl_pin_desc pxa910_pads[] = {
PINCTRL_PIN(ND_RDY0, "ND_RDY0"),
PINCTRL_PIN(SM_ADV, "SM_ADV"),
PINCTRL_PIN(ND_RDY1, "ND_RDY1"),
+ PINCTRL_PIN(SM_ADVMUX, "SM_ADVMUX"),
PINCTRL_PIN(SM_RDY, "SM_RDY"),
PINCTRL_PIN(MMC1_DAT7, "MMC1_DAT7"),
PINCTRL_PIN(MMC1_DAT6, "MMC1_DAT6"),
@@ -504,6 +505,8 @@ static const unsigned p910_mmc1_pin1[] = {MMC1_DAT7, MMC1_DAT6, MMC1_DAT5,
MMC1_CLK, MMC1_CD, GPIO99};
static const unsigned p910_mmc2_pin1[] = {GPIO33, GPIO34, GPIO35, GPIO36,
GPIO37, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42};
+static const unsigned p910_mmc2_pin2[] = {GPIO37, GPIO38, GPIO39, GPIO40,
+ GPIO41, GPIO42};
static const unsigned p910_mmc3_pin1[] = {GPIO33, GPIO34, GPIO35, GPIO36,
GPIO49, GPIO50};
static const unsigned p910_mmc3_pin2[] = {ND_IO7, ND_IO6, ND_IO5, ND_IO4,
@@ -674,6 +677,7 @@ static struct pxa3xx_pin_group pxa910_grps[] = {
GRP_910("usim2 3p2", USIM2, p910_usim2_pin2),
GRP_910("mmc1 12p", MMC1, p910_mmc1_pin1),
GRP_910("mmc2 10p", MMC2, p910_mmc2_pin1),
+ GRP_910("mmc2 6p", MMC2, p910_mmc2_pin2),
GRP_910("mmc3 6p", MMC3, p910_mmc3_pin1),
GRP_910("mmc3 10p", MMC3, p910_mmc3_pin2),
GRP_910("uart0 4p", UART0, p910_uart0_pin1),
@@ -808,7 +812,7 @@ static struct pxa3xx_pin_group pxa910_grps[] = {
static const char * const p910_usim2_grps[] = {"usim2 3p1", "usim2 3p2"};
static const char * const p910_mmc1_grps[] = {"mmc1 12p"};
-static const char * const p910_mmc2_grps[] = {"mmc2 10p"};
+static const char * const p910_mmc2_grps[] = {"mmc2 10p", "mmc2 6p"};
static const char * const p910_mmc3_grps[] = {"mmc3 6p", "mmc3 10p"};
static const char * const p910_uart0_grps[] = {"uart0 4p"};
static const char * const p910_uart1_grps[] = {"uart1 2p1", "uart1 2p2",
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/6] pinctrl: add pinconf support in pxa3xx
2012-07-28 6:58 [PATCH 0/6] pinctrl: add DT support in PXA series Haojian Zhuang
2012-07-28 6:58 ` [PATCH 1/6] pinctrl: append new pins and groups in pxa910 Haojian Zhuang
@ 2012-07-28 6:58 ` Haojian Zhuang
2012-07-28 10:22 ` Daniel Mack
2012-08-05 0:05 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 3/6] pinctrl: support dt in pxa series Haojian Zhuang
` (3 subsequent siblings)
5 siblings, 2 replies; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 6:58 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
drivers/pinctrl/pinctrl-pxa3xx.c | 189 ++++++++++++++++++++++++++++++++++++++
drivers/pinctrl/pinctrl-pxa3xx.h | 17 ++++
2 files changed, 206 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
index f14cd6b..cae74db 100644
--- a/drivers/pinctrl/pinctrl-pxa3xx.c
+++ b/drivers/pinctrl/pinctrl-pxa3xx.c
@@ -16,6 +16,8 @@
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+#include <linux/pinctrl/machine.h>
+#include <linux/pinctrl/pinconf.h>
#include "pinctrl-pxa3xx.h"
static struct pinctrl_gpio_range pxa3xx_pinctrl_gpio_range = {
@@ -168,6 +170,192 @@ static struct pinmux_ops pxa3xx_pmx_ops = {
.gpio_request_enable = pxa3xx_pmx_request_gpio,
};
+static int pxa3xx_pinconf_get(struct pinctrl_dev *pctrldev,
+ unsigned pin, unsigned long *config)
+{
+ struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
+ unsigned int data, mask;
+ int mfpr;
+
+ mfpr = info->mfp[pin].mfpr;
+ data = readl_relaxed(info->virt_base + mfpr);
+
+ *config = 0;
+ mask = PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_UP;
+ if ((data & mask) == mask)
+ *config |= PXA3XX_PINCONF_PULL_UP;
+ mask = PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_DOWN;
+ if ((data & mask) == mask)
+ *config |= PXA3XX_PINCONF_PULL_DOWN;
+ mask = info->ds_mask;
+ if (data & mask) {
+ *config |= PXA3XX_PINCONF_DRIVE_STRENGTH;
+ *config |= ((data & mask) >> info->ds_shift)
+ << PXA3XX_PINCONF_DS_SHIFT;
+ }
+ mask = info->slp_mask;
+ if (data & mask) {
+ if (data & info->slp_input_low)
+ *config |= PXA3XX_PINCONF_LOWPOWER_PULL_DOWN;
+ if (data & info->slp_input_high)
+ *config |= PXA3XX_PINCONF_LOWPOWER_PULL_UP;
+ if (data & info->slp_output_low)
+ *config |= PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW;
+ if (data & info->slp_output_high)
+ *config |= PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH;
+ if (data & info->slp_float)
+ *config |= PXA3XX_PINCONF_LOWPOWER_FLOAT;
+ } else
+ *config |= PXA3XX_PINCONF_LOWPOWER_ZERO;
+ return 0;
+}
+
+static int pxa3xx_pinconf_set(struct pinctrl_dev *pctrldev,
+ unsigned pin, unsigned long config)
+{
+ struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
+ unsigned int data;
+ int mfpr;
+
+ mfpr = info->mfp[pin].mfpr;
+ data = readl_relaxed(info->virt_base + mfpr);
+ switch (config & PXA3XX_PINCONF_MASK) {
+ case PXA3XX_PINCONF_PULL_DOWN:
+ data |= PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_DOWN;
+ break;
+ case PXA3XX_PINCONF_PULL_UP:
+ data |= PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_UP;
+ break;
+ case PXA3XX_PINCONF_DRIVE_STRENGTH:
+ data &= ~info->ds_mask;
+ data |= (config >> PXA3XX_PINCONF_DS_SHIFT) << info->ds_shift;
+ break;
+ case PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH:
+ data &= ~info->slp_mask;
+ data |= info->slp_output_high;
+ break;
+ case PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW:
+ data &= ~info->slp_mask;
+ data |= info->slp_output_low;
+ break;
+ case PXA3XX_PINCONF_LOWPOWER_PULL_UP:
+ data &= ~info->slp_mask;
+ data |= info->slp_input_high;
+ break;
+ case PXA3XX_PINCONF_LOWPOWER_PULL_DOWN:
+ data &= ~info->slp_mask;
+ data |= info->slp_input_low;
+ break;
+ case PXA3XX_PINCONF_LOWPOWER_FLOAT:
+ data &= ~info->slp_mask;
+ data |= info->slp_float;
+ break;
+ case PXA3XX_PINCONF_LOWPOWER_ZERO:
+ data &= ~info->slp_mask;
+ break;
+ default:
+ return -ENOTSUPP;
+ }
+ writel_relaxed(data, info->virt_base + mfpr);
+ return 0;
+}
+
+static int pxa3xx_pinconf_group_get(struct pinctrl_dev *pctrldev,
+ unsigned group, unsigned long *config)
+{
+ struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
+ const unsigned *pins = info->grps[group].pins;
+ int npins, i;
+ unsigned long conf, match = 0;
+
+ npins = info->grps[group].npins;
+ for (i = 0; i < npins; i++) {
+ pxa3xx_pinconf_get(pctrldev, pins[i], &conf);
+ if (!match)
+ match = conf;
+ else if (match != conf) {
+ *config = conf;
+ return -EINVAL;
+ }
+ }
+ *config = conf;
+ return 0;
+}
+
+static int pxa3xx_pinconf_group_set(struct pinctrl_dev *pctrldev,
+ unsigned group, unsigned long config)
+{
+ struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
+ const unsigned *pins = info->grps[group].pins;
+ int npins, i;
+
+ npins = info->grps[group].npins;
+ for (i = 0; i < npins; i++)
+ pxa3xx_pinconf_set(pctrldev, pins[i], config);
+ return 0;
+}
+
+static void pxa3xx_pinconf_dbg_show(struct pinctrl_dev *pctrldev,
+ struct seq_file *s, unsigned offset)
+{
+ struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
+ unsigned long config;
+ char buf[80];
+ int i = 0, mfpr;
+
+ pxa3xx_pinconf_get(pctrldev, offset, &config);
+ memset(buf, 0, 80);
+ if (config & PXA3XX_PINCONF_PULL_UP)
+ i += sprintf(buf + i, "PULL UP, ");
+ if (config & PXA3XX_PINCONF_PULL_DOWN)
+ i += sprintf(buf + i, "PULL DOWN, ");
+ if (config & PXA3XX_PINCONF_DRIVE_STRENGTH)
+ i += sprintf(buf + i, "DRIVE STRENGTH (%ld), ",
+ config >> PXA3XX_PINCONF_DS_SHIFT);
+ if (config & PXA3XX_PINCONF_LOWPOWER_PULL_UP)
+ i += sprintf(buf + i, "LP PULL UP, ");
+ if (config & PXA3XX_PINCONF_LOWPOWER_PULL_DOWN)
+ i += sprintf(buf + i, "LP PULL DOWN, ");
+ if (config & PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH)
+ i += sprintf(buf + i, "LP DRIVE HIGH, ");
+ if (config & PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW)
+ i += sprintf(buf + i, "LP DRIVE LOW, ");
+ if (config & PXA3XX_PINCONF_LOWPOWER_FLOAT)
+ i += sprintf(buf + i, "LP FLOAT, ");
+ if (config & PXA3XX_PINCONF_LOWPOWER_ZERO)
+ i += sprintf(buf + i, "LP ZERO, ");
+ seq_printf(s, "%s\n", buf);
+
+ mfpr = info->mfp[offset].mfpr;
+ seq_printf(s, "reg[0x%x]:0x%x\n", info->phy_base + mfpr,
+ readl_relaxed(info->virt_base + mfpr));
+}
+
+static void pxa3xx_pinconf_group_dbg_show(struct pinctrl_dev *pctrldev,
+ struct seq_file *s, unsigned group)
+{
+ struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
+ const unsigned *pins = info->grps[group].pins;
+ int ret;
+ unsigned long config;
+
+ ret = pxa3xx_pinconf_group_get(pctrldev, group, &config);
+ if (ret < 0) {
+ seq_printf(s, "group config is not consistent\n");
+ return;
+ }
+ pxa3xx_pinconf_dbg_show(pctrldev, s, pins[0]);
+}
+
+static struct pinconf_ops pxa3xx_pinconf_ops = {
+ .pin_config_get = pxa3xx_pinconf_get,
+ .pin_config_set = pxa3xx_pinconf_set,
+ .pin_config_group_get = pxa3xx_pinconf_group_get,
+ .pin_config_group_set = pxa3xx_pinconf_group_set,
+ .pin_config_dbg_show = pxa3xx_pinconf_dbg_show,
+ .pin_config_group_dbg_show = pxa3xx_pinconf_group_dbg_show,
+};
+
int pxa3xx_pinctrl_register(struct platform_device *pdev,
struct pxa3xx_pinmux_info *info)
{
@@ -182,6 +370,7 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev,
desc->npins = info->num_pads;
desc->pctlops = &pxa3xx_pctrl_ops;
desc->pmxops = &pxa3xx_pmx_ops;
+ desc->confops = &pxa3xx_pinconf_ops;
info->dev = &pdev->dev;
pxa3xx_pinctrl_gpio_range.npins = info->num_gpio;
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.h b/drivers/pinctrl/pinctrl-pxa3xx.h
index 8135744..fdcf805 100644
--- a/drivers/pinctrl/pinctrl-pxa3xx.h
+++ b/drivers/pinctrl/pinctrl-pxa3xx.h
@@ -12,6 +12,7 @@
*/
#ifndef __PINCTRL_PXA3XX_H
+#define __PINCTRL_PXA3XX_H
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
@@ -23,6 +24,22 @@
#define PXA3xx_MAX_MUX 8
#define MFPR_FUNC_MASK 0x7
+#define PXA3XX_PINCONF_PULL_UP (1 << 0)
+#define PXA3XX_PINCONF_PULL_DOWN (1 << 1)
+#define PXA3XX_PINCONF_DRIVE_STRENGTH (1 << 2)
+#define PXA3XX_PINCONF_LOWPOWER_PULL_UP (1 << 3)
+#define PXA3XX_PINCONF_LOWPOWER_PULL_DOWN (1 << 4)
+#define PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH (1 << 5)
+#define PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW (1 << 6)
+#define PXA3XX_PINCONF_LOWPOWER_FLOAT (1 << 7)
+#define PXA3XX_PINCONF_LOWPOWER_ZERO (1 << 8) /* lowpower bits: 0 */
+#define PXA3XX_PINCONF_MASK 0xffff
+#define PXA3XX_PINCONF_DS_SHIFT 16
+
+#define PXA3XX_MFPR_PULL_SEL (1 << 15)
+#define PXA3XX_MFPR_PULL_UP (1 << 14)
+#define PXA3XX_MFPR_PULL_DOWN (1 << 13)
+
enum pxa_cpu_type {
PINCTRL_INVALID = 0,
PINCTRL_PXA300,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 3/6] pinctrl: support dt in pxa series
2012-07-28 6:58 [PATCH 0/6] pinctrl: add DT support in PXA series Haojian Zhuang
2012-07-28 6:58 ` [PATCH 1/6] pinctrl: append new pins and groups in pxa910 Haojian Zhuang
2012-07-28 6:58 ` [PATCH 2/6] pinctrl: add pinconf support in pxa3xx Haojian Zhuang
@ 2012-07-28 6:58 ` Haojian Zhuang
2012-08-05 0:07 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 4/6] pinctrl: append new groups of mmp2 Haojian Zhuang
` (2 subsequent siblings)
5 siblings, 1 reply; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 6:58 UTC (permalink / raw)
To: linux-arm-kernel
Add DT support in PXA168/PXA910/MMP2 pinctrl driver.
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
drivers/pinctrl/pinctrl-mmp2.c | 10 ++-
drivers/pinctrl/pinctrl-pxa168.c | 10 ++-
drivers/pinctrl/pinctrl-pxa3xx.c | 136 ++++++++++++++++++++++++++++++++++++++
drivers/pinctrl/pinctrl-pxa910.c | 10 ++-
4 files changed, 163 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-mmp2.c b/drivers/pinctrl/pinctrl-mmp2.c
index 2cfed55..25b9cd3 100644
--- a/drivers/pinctrl/pinctrl-mmp2.c
+++ b/drivers/pinctrl/pinctrl-mmp2.c
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include "pinctrl-pxa3xx.h"
@@ -696,10 +697,16 @@ static int __devexit mmp2_pinmux_remove(struct platform_device *pdev)
return pxa3xx_pinctrl_unregister(pdev);
}
+static struct of_device_id mmp2_pinctrl_of_match[] __devinitdata = {
+ { .compatible = "marvell,mmp2-pinmux", },
+ { },
+};
+
static struct platform_driver mmp2_pinmux_driver = {
.driver = {
.name = "mmp2-pinmux",
.owner = THIS_MODULE,
+ .of_match_table = mmp2_pinctrl_of_match,
},
.probe = mmp2_pinmux_probe,
.remove = __devexit_p(mmp2_pinmux_remove),
@@ -718,5 +725,6 @@ static void __exit mmp2_pinmux_exit(void)
module_exit(mmp2_pinmux_exit);
MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
-MODULE_DESCRIPTION("PXA3xx pin control driver");
+MODULE_DESCRIPTION("MMP2 pin control driver");
MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, mmp2_pinctrl_of_match);
diff --git a/drivers/pinctrl/pinctrl-pxa168.c b/drivers/pinctrl/pinctrl-pxa168.c
index c1997fa..959a13d 100644
--- a/drivers/pinctrl/pinctrl-pxa168.c
+++ b/drivers/pinctrl/pinctrl-pxa168.c
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include "pinctrl-pxa3xx.h"
@@ -625,10 +626,16 @@ static int __devexit pxa168_pinmux_remove(struct platform_device *pdev)
return pxa3xx_pinctrl_unregister(pdev);
}
+static struct of_device_id pxa168_pinctrl_of_match[] __devinitdata = {
+ { .compatible = "marvell,pxa168-pinmux", },
+ { },
+};
+
static struct platform_driver pxa168_pinmux_driver = {
.driver = {
.name = "pxa168-pinmux",
.owner = THIS_MODULE,
+ .of_match_table = pxa168_pinctrl_of_match,
},
.probe = pxa168_pinmux_probe,
.remove = __devexit_p(pxa168_pinmux_remove),
@@ -647,5 +654,6 @@ static void __exit pxa168_pinmux_exit(void)
module_exit(pxa168_pinmux_exit);
MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
-MODULE_DESCRIPTION("PXA3xx pin control driver");
+MODULE_DESCRIPTION("PXA168 pin control driver");
MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, pxa168_pinctrl_of_match);
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
index cae74db..125839f 100644
--- a/drivers/pinctrl/pinctrl-pxa3xx.c
+++ b/drivers/pinctrl/pinctrl-pxa3xx.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/device.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/pinctrl/machine.h>
@@ -54,10 +55,145 @@ static int pxa3xx_get_group_pins(struct pinctrl_dev *pctrldev,
return 0;
}
+static int pxa3xx_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrl_dev,
+ struct device_node *np_config,
+ struct pinctrl_map **map,
+ unsigned *num_maps)
+{
+ struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrl_dev);
+ struct device_node *np;
+ struct property *prop;
+ const char *func, *group;
+ int ret, count = 0, i = 0, pin_num, size;
+ u32 ds, cfg;
+
+ /* verify subnode */
+ for_each_child_of_node(np_config, np) {
+ ret = of_property_read_string(np, "marvell,function", &func);
+ if (ret < 0)
+ return ret;
+ ret = of_property_count_strings(np, "marvell,pins");
+ if (ret < 0)
+ return ret;
+ count += ret;
+ pin_num = ret;
+
+ if (!of_property_read_u32(np, "marvell,drive-strength", &ds))
+ count += pin_num;
+
+ if (of_find_property(np, "marvell,pull-up", &size)
+ || of_find_property(np, "marvell,pull-down", &size))
+ count += pin_num;
+
+ if (of_find_property(np, "marvell,lowpower-pull-up", &size)
+ || of_find_property(np, "marvell,lowpower-pull-down",
+ &size)
+ || of_find_property(np, "marvell,lowpower-drive-high",
+ &size)
+ || of_find_property(np, "marvell,lowpower-drive-low",
+ &size)
+ || of_find_property(np, "marvell,lowpower-float", &size)
+ || of_find_property(np, "marvell,lowpower-zero", &size))
+ count += pin_num;
+ }
+
+ if (!count) {
+ dev_err(info->dev, "No child nodes passed via DT\n");
+ return -ENODEV;
+ }
+
+ *map = kzalloc(sizeof(**map) * count, GFP_KERNEL);
+ if (!*map)
+ return -ENOMEM;
+
+ for_each_child_of_node(np_config, np) {
+ of_property_read_string(np, "marvell,function", &func);
+ of_property_for_each_string(np, "marvell,pins", prop, group) {
+ (*map)[i].type = PIN_MAP_TYPE_MUX_GROUP;
+ (*map)[i].data.mux.group = group;
+ (*map)[i].data.mux.function = func;
+ i++;
+
+ cfg = 0;
+ if (of_find_property(np, "marvell,pull-up", &size))
+ cfg = PXA3XX_PINCONF_PULL_UP;
+ else if (of_find_property(np,
+ "marvell,pull-down", &size))
+ cfg = PXA3XX_PINCONF_PULL_DOWN;
+ if (cfg) {
+ (*map)[i].type = PIN_MAP_TYPE_CONFIGS_GROUP;
+ (*map)[i].data.configs.configs =
+ kmemdup(&cfg, sizeof(cfg), GFP_KERNEL);
+ (*map)[i].data.configs.group_or_pin = group;
+ (*map)[i].data.configs.num_configs = 1;
+ i++;
+ }
+
+ cfg = 0;
+ if (of_find_property(np, "marvell,lowpower-pull-up",
+ &size))
+ cfg = PXA3XX_PINCONF_LOWPOWER_PULL_UP;
+ else if (of_find_property(np,
+ "marvell,lowpower-pull-down", &size))
+ cfg = PXA3XX_PINCONF_LOWPOWER_PULL_DOWN;
+ else if (of_find_property(np,
+ "marvell,lowpower-drive-high", &size))
+ cfg = PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH;
+ else if (of_find_property(np,
+ "marvell,lowpower-drive-low", &size))
+ cfg = PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW;
+ else if (of_find_property(np,
+ "marvell,lowpower-float", &size))
+ cfg = PXA3XX_PINCONF_LOWPOWER_FLOAT;
+ else if (of_find_property(np,
+ "marvell,lowpower-zero", &size))
+ cfg = PXA3XX_PINCONF_LOWPOWER_ZERO;
+ if (cfg) {
+ (*map)[i].type = PIN_MAP_TYPE_CONFIGS_GROUP;
+ (*map)[i].data.configs.configs =
+ kmemdup(&cfg, sizeof(cfg), GFP_KERNEL);
+ (*map)[i].data.configs.group_or_pin = group;
+ (*map)[i].data.configs.num_configs = 1;
+ i++;
+ }
+
+ cfg = 0;
+ if (!of_property_read_u32(np,
+ "marvell,drive-strength", &ds))
+ cfg = PXA3XX_PINCONF_DRIVE_STRENGTH
+ | (ds << PXA3XX_PINCONF_DS_SHIFT);
+ if (cfg) {
+ (*map)[i].type = PIN_MAP_TYPE_CONFIGS_GROUP;
+ (*map)[i].data.configs.configs =
+ kmemdup(&cfg, sizeof(cfg), GFP_KERNEL);
+ (*map)[i].data.configs.group_or_pin = group;
+ (*map)[i].data.configs.num_configs = 1;
+ i++;
+ }
+ }
+ }
+ *num_maps = count;
+ return 0;
+}
+
+static void pxa3xx_pinctrl_dt_free_map(struct pinctrl_dev *pctrl_dev,
+ struct pinctrl_map *map,
+ unsigned num_maps)
+{
+ int i;
+
+ for (i = 0; i < num_maps; i++)
+ if (map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
+ kfree(map[i].data.configs.configs);
+ kfree(map);
+}
+
static struct pinctrl_ops pxa3xx_pctrl_ops = {
.get_groups_count = pxa3xx_get_groups_count,
.get_group_name = pxa3xx_get_group_name,
.get_group_pins = pxa3xx_get_group_pins,
+ .dt_node_to_map = pxa3xx_pinctrl_dt_node_to_map,
+ .dt_free_map = pxa3xx_pinctrl_dt_free_map,
};
static int pxa3xx_pmx_get_funcs_count(struct pinctrl_dev *pctrldev)
diff --git a/drivers/pinctrl/pinctrl-pxa910.c b/drivers/pinctrl/pinctrl-pxa910.c
index 4164a6b..ccda259 100644
--- a/drivers/pinctrl/pinctrl-pxa910.c
+++ b/drivers/pinctrl/pinctrl-pxa910.c
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include "pinctrl-pxa3xx.h"
@@ -985,10 +986,16 @@ static int __devexit pxa910_pinmux_remove(struct platform_device *pdev)
return pxa3xx_pinctrl_unregister(pdev);
}
+static struct of_device_id pxa910_pinctrl_of_match[] __devinitdata = {
+ { .compatible = "marvell,pxa910-pinmux", },
+ { },
+};
+
static struct platform_driver pxa910_pinmux_driver = {
.driver = {
.name = "pxa910-pinmux",
.owner = THIS_MODULE,
+ .of_match_table = pxa910_pinctrl_of_match,
},
.probe = pxa910_pinmux_probe,
.remove = __devexit_p(pxa910_pinmux_remove),
@@ -1007,5 +1014,6 @@ static void __exit pxa910_pinmux_exit(void)
module_exit(pxa910_pinmux_exit);
MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
-MODULE_DESCRIPTION("PXA3xx pin control driver");
+MODULE_DESCRIPTION("PXA910 pin control driver");
MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, pxa910_pinctrl_of_match);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 4/6] pinctrl: append new groups of mmp2
2012-07-28 6:58 [PATCH 0/6] pinctrl: add DT support in PXA series Haojian Zhuang
` (2 preceding siblings ...)
2012-07-28 6:58 ` [PATCH 3/6] pinctrl: support dt in pxa series Haojian Zhuang
@ 2012-07-28 6:58 ` Haojian Zhuang
2012-08-05 0:07 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 5/6] ARM: mmp: select pinctrl for boards with DT Haojian Zhuang
2012-07-28 6:58 ` [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files Haojian Zhuang
5 siblings, 1 reply; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 6:58 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
drivers/pinctrl/pinctrl-mmp2.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-mmp2.c b/drivers/pinctrl/pinctrl-mmp2.c
index 25b9cd3..2c56de7 100644
--- a/drivers/pinctrl/pinctrl-mmp2.c
+++ b/drivers/pinctrl/pinctrl-mmp2.c
@@ -483,12 +483,14 @@ struct pxa3xx_mfp_pin mmp2_mfp[] = {
static const unsigned mmp2_uart1_pin1[] = {GPIO29, GPIO30, GPIO31, GPIO32};
static const unsigned mmp2_uart1_pin2[] = {GPIO45, GPIO46};
static const unsigned mmp2_uart1_pin3[] = {GPIO140, GPIO141};
+static const unsigned mmp2_uart1_pin4[] = {GPIO29, GPIO30};
static const unsigned mmp2_uart2_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
static const unsigned mmp2_uart2_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
static const unsigned mmp2_uart2_pin3[] = {GPIO47, GPIO48, GPIO49, GPIO50};
static const unsigned mmp2_uart2_pin4[] = {GPIO74, GPIO75, GPIO76, GPIO77};
static const unsigned mmp2_uart2_pin5[] = {GPIO55, GPIO56};
static const unsigned mmp2_uart2_pin6[] = {GPIO140, GPIO141};
+static const unsigned mmp2_uart2_pin7[] = {GPIO47, GPIO48};
static const unsigned mmp2_uart3_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
static const unsigned mmp2_uart3_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
static const unsigned mmp2_uart3_pin3[] = {GPIO51, GPIO52, GPIO53, GPIO54};
@@ -552,12 +554,14 @@ static struct pxa3xx_pin_group mmp2_grps[] = {
GRP_MMP2("uart1 4p1", UART1, mmp2_uart1_pin1),
GRP_MMP2("uart1 2p2", UART1, mmp2_uart1_pin2),
GRP_MMP2("uart1 2p3", UART1, mmp2_uart1_pin3),
+ GRP_MMP2("uart1 2p4", UART1, mmp2_uart1_pin4),
GRP_MMP2("uart2 4p1", UART2, mmp2_uart2_pin1),
GRP_MMP2("uart2 4p2", UART2, mmp2_uart2_pin2),
GRP_MMP2("uart2 4p3", UART2, mmp2_uart2_pin3),
GRP_MMP2("uart2 4p4", UART2, mmp2_uart2_pin4),
GRP_MMP2("uart2 2p5", UART2, mmp2_uart2_pin5),
GRP_MMP2("uart2 2p6", UART2, mmp2_uart2_pin6),
+ GRP_MMP2("uart2 2p7", UART2, mmp2_uart2_pin7),
GRP_MMP2("uart3 4p1", UART3, mmp2_uart3_pin1),
GRP_MMP2("uart3 4p2", UART3, mmp2_uart3_pin2),
GRP_MMP2("uart3 4p3", UART3, mmp2_uart3_pin3),
@@ -610,9 +614,9 @@ static struct pxa3xx_pin_group mmp2_grps[] = {
};
static const char * const mmp2_uart1_grps[] = {"uart1 4p1", "uart1 2p2",
- "uart1 2p3"};
+ "uart1 2p3", "uart1 2p4"};
static const char * const mmp2_uart2_grps[] = {"uart2 4p1", "uart2 4p2",
- "uart2 4p3", "uart2 4p4", "uart2 4p5", "uart2 4p6"};
+ "uart2 4p3", "uart2 4p4", "uart2 2p5", "uart2 2p6", "uart2 2p7"};
static const char * const mmp2_uart3_grps[] = {"uart3 4p1", "uart3 4p2",
"uart3 4p3", "uart3 4p4", "uart3 4p5", "uart3 2p6"};
static const char * const mmp2_uart4_grps[] = {"uart4 4p1", "uart4 4p2",
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 5/6] ARM: mmp: select pinctrl for boards with DT
2012-07-28 6:58 [PATCH 0/6] pinctrl: add DT support in PXA series Haojian Zhuang
` (3 preceding siblings ...)
2012-07-28 6:58 ` [PATCH 4/6] pinctrl: append new groups of mmp2 Haojian Zhuang
@ 2012-07-28 6:58 ` Haojian Zhuang
2012-08-05 0:08 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files Haojian Zhuang
5 siblings, 1 reply; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 6:58 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
arch/arm/mach-mmp/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 7fddd01..c70c787 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -89,6 +89,7 @@ config MACH_MMP_DT
select CPU_PXA168
select CPU_PXA910
select USE_OF
+ select PINCTRL
help
Include support for Marvell MMP2 based platforms using
the device tree. Needn't select any other machine while
@@ -99,6 +100,7 @@ config MACH_MMP2_DT
depends on !CPU_MOHAWK
select CPU_MMP2
select USE_OF
+ select PINCTRL
help
Include support for Marvell MMP2 based platforms using
the device tree.
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-07-28 6:58 [PATCH 0/6] pinctrl: add DT support in PXA series Haojian Zhuang
` (4 preceding siblings ...)
2012-07-28 6:58 ` [PATCH 5/6] ARM: mmp: select pinctrl for boards with DT Haojian Zhuang
@ 2012-07-28 6:58 ` Haojian Zhuang
2012-08-05 0:09 ` Linus Walleij
2012-08-06 8:44 ` Arnd Bergmann
5 siblings, 2 replies; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 6:58 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
.../bindings/pinctrl/mrvl,pxa3xx-pinctrl.txt | 35 ++++++++++++++
arch/arm/boot/dts/mmp2-brownstone.dts | 51 ++++++++++++++++++++
arch/arm/boot/dts/mmp2.dtsi | 5 ++
arch/arm/boot/dts/pxa168.dtsi | 5 ++
arch/arm/boot/dts/pxa910-dkb.dts | 47 ++++++++++++++++++
arch/arm/boot/dts/pxa910.dtsi | 5 ++
6 files changed, 148 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pinctrl/mrvl,pxa3xx-pinctrl.txt
diff --git a/Documentation/devicetree/bindings/pinctrl/mrvl,pxa3xx-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/mrvl,pxa3xx-pinctrl.txt
new file mode 100644
index 0000000..1f516e4
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/mrvl,pxa3xx-pinctrl.txt
@@ -0,0 +1,35 @@
+Marvell Technology Group, PXA3XX pinmux controller
+
+Required properties:
+- compatible : "marvell,pxa910-pinmux"
+ : "marvell,pxa168-pinmux"
+ : "marvell,mmp2-pinmux"
+- reg : Address range of the pinctrl registers
+
+PXA3xx's pinmux nodes act as a container for an abitrary number of subnodes.
+Each of these subnodes represents muxing for a pin, a group, or a list of
+pins or groups.
+
+The name of each subnode is not important; all subnodes should be enumerated
+and processed purely based on their content.
+
+Required subnode-properties:
+- marvell,pins : An array of strings. Each string contains the name of a pin
+ or group.
+- marvell,function : A string containing the name of the function to mux to the
+ pin or group.
+- marvell,drive-strength : An integer value that means the drive strength of a
+ pin.
+- marvell,pull-up : The property means a pin is pull up for input.
+- marvell,pull-down : The property means a pin is pull down for input.
+- marvell,lowpower-pull-up : The property means a pin is pull up for input in
+ sleep state.
+- marvell,lowpower-pull-down : The property means a pin is pull down for input
+ in sleep state.
+- marvell,lowpower-drive-high : The property means a pin is driving high for
+ output in sleep state.
+- marvell,lowpower-drive-low : The property means a pin is driving low for
+ output in sleep state.
+- marvell,lowpower-float : The property means a pin is float in sleep state.
+- marvell,lowpower-zero : The property means a pin is not configured in sleep
+ state.
diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
index c9b4f27..2ae37df 100644
--- a/arch/arm/boot/dts/mmp2-brownstone.dts
+++ b/arch/arm/boot/dts/mmp2-brownstone.dts
@@ -24,6 +24,57 @@
soc {
apb at d4000000 {
+ pinmux at d401e000 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&state_default>;
+
+ state_default: pinmux {
+ uart1 {
+ marvell,pins = "uart1 2p4";
+ marvell,function = "uart1";
+ };
+ uart2 {
+ marvell,pins = "uart2 2p7";
+ marvell,function = "uart2";
+ };
+ uart3 {
+ marvell,pins = "uart3 2p6";
+ marvell,function = "uart3";
+ };
+ twsi2 {
+ marvell,pins = "twsi2-3";
+ marvell,function = "twsi2";
+ };
+ twsi3 {
+ marvell,pins = "twsi3-1";
+ marvell,function = "twsi3";
+ };
+ twsi4 {
+ marvell,pins = "twsi4";
+ marvell,function = "twsi4";
+ };
+ twsi5 {
+ marvell,pins = "twsi5-3";
+ marvell,function = "twsi5";
+ };
+ twsi6 {
+ marvell,pins = "twsi6-3";
+ marvell,function = "twsi6";
+ };
+ mmc1 {
+ marvell,pins = "mmc1 8p1";
+ marvell,function = "mmc1";
+ };
+ mmc2 {
+ marvell,pins = "mmc2 6p1";
+ marvell,function = "mmc2";
+ };
+ mmc3 {
+ marvell,pins = "mmc3 10p1";
+ marvell,function = "mmc3";
+ };
+ };
+ };
uart3: uart at d4018000 {
status = "okay";
};
diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi
index 80f74e2..cb4ecaf 100644
--- a/arch/arm/boot/dts/mmp2.dtsi
+++ b/arch/arm/boot/dts/mmp2.dtsi
@@ -120,6 +120,11 @@
reg = <0xd4000000 0x00200000>;
ranges;
+ pinmux at d401e000 {
+ compatible = "marvell,mmp2-pinmux";
+ reg = <0xd401e000 0x4000>;
+ };
+
timer0: timer at d4014000 {
compatible = "mrvl,mmp-timer";
reg = <0xd4014000 0x100>;
diff --git a/arch/arm/boot/dts/pxa168.dtsi b/arch/arm/boot/dts/pxa168.dtsi
index 31a7186..f15491d 100644
--- a/arch/arm/boot/dts/pxa168.dtsi
+++ b/arch/arm/boot/dts/pxa168.dtsi
@@ -49,6 +49,11 @@
reg = <0xd4000000 0x00200000>;
ranges;
+ pinmux at d401e000 {
+ compatible = "marvell,pxa168-pinmux";
+ reg = <0xd401e000 0x4000>;
+ };
+
timer0: timer at d4014000 {
compatible = "mrvl,mmp-timer";
reg = <0xd4014000 0x100>;
diff --git a/arch/arm/boot/dts/pxa910-dkb.dts b/arch/arm/boot/dts/pxa910-dkb.dts
index e92be5a..d3ba948 100644
--- a/arch/arm/boot/dts/pxa910-dkb.dts
+++ b/arch/arm/boot/dts/pxa910-dkb.dts
@@ -24,6 +24,53 @@
soc {
apb at d4000000 {
+ pinmux at d401e000 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&state_default>;
+
+ state_default: pinmux {
+ uart0 { /* BT UART */
+ marvell,pins = "uart0 4p";
+ marvell,function = "uart0";
+ };
+ uart1 { /* Serial UART */
+ marvell,pins = "uart1 2p1";
+ marvell,function = "uart1";
+ };
+ uart2 { /* GPS UART */
+ marvell,pins = "uart2 2p1";
+ marvell,function = "uart2";
+ };
+ nand {
+ marvell,pins = "nand";
+ marvell,function = "nand";
+ };
+ twsi1 {
+ marvell,pins = "twsi 2p2";
+ marvell,function = "twsi";
+ };
+ mmc1 {
+ marvell,pins = "mmc1 12p";
+ marvell,function = "mmc1";
+ };
+ mmc2 {
+ marvell,pins = "mmc2 6p";
+ marvell,function = "mmc2";
+ };
+ w1 {
+ marvell,pins = "w1-4";
+ marvell,function = "w1";
+ };
+ ssp1 {
+ marvell,pins = "ssp1 4p1";
+ marvell,function = "ssp1";
+ };
+ gssp {
+ marvell,pins = "gssp";
+ marvell,function = "gssp";
+ };
+ };
+ };
uart1: uart at d4017000 {
status = "okay";
};
diff --git a/arch/arm/boot/dts/pxa910.dtsi b/arch/arm/boot/dts/pxa910.dtsi
index aebf32d..187041d 100644
--- a/arch/arm/boot/dts/pxa910.dtsi
+++ b/arch/arm/boot/dts/pxa910.dtsi
@@ -49,6 +49,11 @@
reg = <0xd4000000 0x00200000>;
ranges;
+ pinmux at d401e000 {
+ compatible = "marvell,pxa910-pinmux";
+ reg = <0xd401e000 0x4000>;
+ };
+
timer0: timer at d4014000 {
compatible = "mrvl,mmp-timer";
reg = <0xd4014000 0x100>;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/6] pinctrl: add pinconf support in pxa3xx
2012-07-28 6:58 ` [PATCH 2/6] pinctrl: add pinconf support in pxa3xx Haojian Zhuang
@ 2012-07-28 10:22 ` Daniel Mack
2012-07-28 15:28 ` Haojian Zhuang
2012-08-05 0:05 ` Linus Walleij
1 sibling, 1 reply; 23+ messages in thread
From: Daniel Mack @ 2012-07-28 10:22 UTC (permalink / raw)
To: linux-arm-kernel
On 28.07.2012 08:58, Haojian Zhuang wrote:
> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
> ---
> drivers/pinctrl/pinctrl-pxa3xx.c | 189 ++++++++++++++++++++++++++++++++++++++
> drivers/pinctrl/pinctrl-pxa3xx.h | 17 ++++
> 2 files changed, 206 insertions(+)
As I'm working on a PXA3xx platform currently that already fully boots
from DT, I'd like to give this series a try.
But I wonder if this is supposed to be fully working yet, because that
code won't be compiled for PXA3xx as long as PINCTRL isn't set for that
platform (arch/arm/mach-pxa/Kconfig).
Daniel
>
> diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
> index f14cd6b..cae74db 100644
> --- a/drivers/pinctrl/pinctrl-pxa3xx.c
> +++ b/drivers/pinctrl/pinctrl-pxa3xx.c
> @@ -16,6 +16,8 @@
> #include <linux/io.h>
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> +#include <linux/pinctrl/machine.h>
> +#include <linux/pinctrl/pinconf.h>
> #include "pinctrl-pxa3xx.h"
>
> static struct pinctrl_gpio_range pxa3xx_pinctrl_gpio_range = {
> @@ -168,6 +170,192 @@ static struct pinmux_ops pxa3xx_pmx_ops = {
> .gpio_request_enable = pxa3xx_pmx_request_gpio,
> };
>
> +static int pxa3xx_pinconf_get(struct pinctrl_dev *pctrldev,
> + unsigned pin, unsigned long *config)
> +{
> + struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
> + unsigned int data, mask;
> + int mfpr;
> +
> + mfpr = info->mfp[pin].mfpr;
> + data = readl_relaxed(info->virt_base + mfpr);
> +
> + *config = 0;
> + mask = PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_UP;
> + if ((data & mask) == mask)
> + *config |= PXA3XX_PINCONF_PULL_UP;
> + mask = PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_DOWN;
> + if ((data & mask) == mask)
> + *config |= PXA3XX_PINCONF_PULL_DOWN;
> + mask = info->ds_mask;
> + if (data & mask) {
> + *config |= PXA3XX_PINCONF_DRIVE_STRENGTH;
> + *config |= ((data & mask) >> info->ds_shift)
> + << PXA3XX_PINCONF_DS_SHIFT;
> + }
> + mask = info->slp_mask;
> + if (data & mask) {
> + if (data & info->slp_input_low)
> + *config |= PXA3XX_PINCONF_LOWPOWER_PULL_DOWN;
> + if (data & info->slp_input_high)
> + *config |= PXA3XX_PINCONF_LOWPOWER_PULL_UP;
> + if (data & info->slp_output_low)
> + *config |= PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW;
> + if (data & info->slp_output_high)
> + *config |= PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH;
> + if (data & info->slp_float)
> + *config |= PXA3XX_PINCONF_LOWPOWER_FLOAT;
> + } else
> + *config |= PXA3XX_PINCONF_LOWPOWER_ZERO;
> + return 0;
> +}
> +
> +static int pxa3xx_pinconf_set(struct pinctrl_dev *pctrldev,
> + unsigned pin, unsigned long config)
> +{
> + struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
> + unsigned int data;
> + int mfpr;
> +
> + mfpr = info->mfp[pin].mfpr;
> + data = readl_relaxed(info->virt_base + mfpr);
> + switch (config & PXA3XX_PINCONF_MASK) {
> + case PXA3XX_PINCONF_PULL_DOWN:
> + data |= PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_DOWN;
> + break;
> + case PXA3XX_PINCONF_PULL_UP:
> + data |= PXA3XX_MFPR_PULL_SEL | PXA3XX_MFPR_PULL_UP;
> + break;
> + case PXA3XX_PINCONF_DRIVE_STRENGTH:
> + data &= ~info->ds_mask;
> + data |= (config >> PXA3XX_PINCONF_DS_SHIFT) << info->ds_shift;
> + break;
> + case PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH:
> + data &= ~info->slp_mask;
> + data |= info->slp_output_high;
> + break;
> + case PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW:
> + data &= ~info->slp_mask;
> + data |= info->slp_output_low;
> + break;
> + case PXA3XX_PINCONF_LOWPOWER_PULL_UP:
> + data &= ~info->slp_mask;
> + data |= info->slp_input_high;
> + break;
> + case PXA3XX_PINCONF_LOWPOWER_PULL_DOWN:
> + data &= ~info->slp_mask;
> + data |= info->slp_input_low;
> + break;
> + case PXA3XX_PINCONF_LOWPOWER_FLOAT:
> + data &= ~info->slp_mask;
> + data |= info->slp_float;
> + break;
> + case PXA3XX_PINCONF_LOWPOWER_ZERO:
> + data &= ~info->slp_mask;
> + break;
> + default:
> + return -ENOTSUPP;
> + }
> + writel_relaxed(data, info->virt_base + mfpr);
> + return 0;
> +}
> +
> +static int pxa3xx_pinconf_group_get(struct pinctrl_dev *pctrldev,
> + unsigned group, unsigned long *config)
> +{
> + struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
> + const unsigned *pins = info->grps[group].pins;
> + int npins, i;
> + unsigned long conf, match = 0;
> +
> + npins = info->grps[group].npins;
> + for (i = 0; i < npins; i++) {
> + pxa3xx_pinconf_get(pctrldev, pins[i], &conf);
> + if (!match)
> + match = conf;
> + else if (match != conf) {
> + *config = conf;
> + return -EINVAL;
> + }
> + }
> + *config = conf;
> + return 0;
> +}
> +
> +static int pxa3xx_pinconf_group_set(struct pinctrl_dev *pctrldev,
> + unsigned group, unsigned long config)
> +{
> + struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
> + const unsigned *pins = info->grps[group].pins;
> + int npins, i;
> +
> + npins = info->grps[group].npins;
> + for (i = 0; i < npins; i++)
> + pxa3xx_pinconf_set(pctrldev, pins[i], config);
> + return 0;
> +}
> +
> +static void pxa3xx_pinconf_dbg_show(struct pinctrl_dev *pctrldev,
> + struct seq_file *s, unsigned offset)
> +{
> + struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
> + unsigned long config;
> + char buf[80];
> + int i = 0, mfpr;
> +
> + pxa3xx_pinconf_get(pctrldev, offset, &config);
> + memset(buf, 0, 80);
> + if (config & PXA3XX_PINCONF_PULL_UP)
> + i += sprintf(buf + i, "PULL UP, ");
> + if (config & PXA3XX_PINCONF_PULL_DOWN)
> + i += sprintf(buf + i, "PULL DOWN, ");
> + if (config & PXA3XX_PINCONF_DRIVE_STRENGTH)
> + i += sprintf(buf + i, "DRIVE STRENGTH (%ld), ",
> + config >> PXA3XX_PINCONF_DS_SHIFT);
> + if (config & PXA3XX_PINCONF_LOWPOWER_PULL_UP)
> + i += sprintf(buf + i, "LP PULL UP, ");
> + if (config & PXA3XX_PINCONF_LOWPOWER_PULL_DOWN)
> + i += sprintf(buf + i, "LP PULL DOWN, ");
> + if (config & PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH)
> + i += sprintf(buf + i, "LP DRIVE HIGH, ");
> + if (config & PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW)
> + i += sprintf(buf + i, "LP DRIVE LOW, ");
> + if (config & PXA3XX_PINCONF_LOWPOWER_FLOAT)
> + i += sprintf(buf + i, "LP FLOAT, ");
> + if (config & PXA3XX_PINCONF_LOWPOWER_ZERO)
> + i += sprintf(buf + i, "LP ZERO, ");
> + seq_printf(s, "%s\n", buf);
> +
> + mfpr = info->mfp[offset].mfpr;
> + seq_printf(s, "reg[0x%x]:0x%x\n", info->phy_base + mfpr,
> + readl_relaxed(info->virt_base + mfpr));
> +}
> +
> +static void pxa3xx_pinconf_group_dbg_show(struct pinctrl_dev *pctrldev,
> + struct seq_file *s, unsigned group)
> +{
> + struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
> + const unsigned *pins = info->grps[group].pins;
> + int ret;
> + unsigned long config;
> +
> + ret = pxa3xx_pinconf_group_get(pctrldev, group, &config);
> + if (ret < 0) {
> + seq_printf(s, "group config is not consistent\n");
> + return;
> + }
> + pxa3xx_pinconf_dbg_show(pctrldev, s, pins[0]);
> +}
> +
> +static struct pinconf_ops pxa3xx_pinconf_ops = {
> + .pin_config_get = pxa3xx_pinconf_get,
> + .pin_config_set = pxa3xx_pinconf_set,
> + .pin_config_group_get = pxa3xx_pinconf_group_get,
> + .pin_config_group_set = pxa3xx_pinconf_group_set,
> + .pin_config_dbg_show = pxa3xx_pinconf_dbg_show,
> + .pin_config_group_dbg_show = pxa3xx_pinconf_group_dbg_show,
> +};
> +
> int pxa3xx_pinctrl_register(struct platform_device *pdev,
> struct pxa3xx_pinmux_info *info)
> {
> @@ -182,6 +370,7 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev,
> desc->npins = info->num_pads;
> desc->pctlops = &pxa3xx_pctrl_ops;
> desc->pmxops = &pxa3xx_pmx_ops;
> + desc->confops = &pxa3xx_pinconf_ops;
> info->dev = &pdev->dev;
> pxa3xx_pinctrl_gpio_range.npins = info->num_gpio;
>
> diff --git a/drivers/pinctrl/pinctrl-pxa3xx.h b/drivers/pinctrl/pinctrl-pxa3xx.h
> index 8135744..fdcf805 100644
> --- a/drivers/pinctrl/pinctrl-pxa3xx.h
> +++ b/drivers/pinctrl/pinctrl-pxa3xx.h
> @@ -12,6 +12,7 @@
> */
>
> #ifndef __PINCTRL_PXA3XX_H
> +#define __PINCTRL_PXA3XX_H
>
> #include <linux/pinctrl/pinctrl.h>
> #include <linux/pinctrl/pinmux.h>
> @@ -23,6 +24,22 @@
> #define PXA3xx_MAX_MUX 8
> #define MFPR_FUNC_MASK 0x7
>
> +#define PXA3XX_PINCONF_PULL_UP (1 << 0)
> +#define PXA3XX_PINCONF_PULL_DOWN (1 << 1)
> +#define PXA3XX_PINCONF_DRIVE_STRENGTH (1 << 2)
> +#define PXA3XX_PINCONF_LOWPOWER_PULL_UP (1 << 3)
> +#define PXA3XX_PINCONF_LOWPOWER_PULL_DOWN (1 << 4)
> +#define PXA3XX_PINCONF_LOWPOWER_DRIVE_HIGH (1 << 5)
> +#define PXA3XX_PINCONF_LOWPOWER_DRIVE_LOW (1 << 6)
> +#define PXA3XX_PINCONF_LOWPOWER_FLOAT (1 << 7)
> +#define PXA3XX_PINCONF_LOWPOWER_ZERO (1 << 8) /* lowpower bits: 0 */
> +#define PXA3XX_PINCONF_MASK 0xffff
> +#define PXA3XX_PINCONF_DS_SHIFT 16
> +
> +#define PXA3XX_MFPR_PULL_SEL (1 << 15)
> +#define PXA3XX_MFPR_PULL_UP (1 << 14)
> +#define PXA3XX_MFPR_PULL_DOWN (1 << 13)
> +
> enum pxa_cpu_type {
> PINCTRL_INVALID = 0,
> PINCTRL_PXA300,
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 2/6] pinctrl: add pinconf support in pxa3xx
2012-07-28 10:22 ` Daniel Mack
@ 2012-07-28 15:28 ` Haojian Zhuang
0 siblings, 0 replies; 23+ messages in thread
From: Haojian Zhuang @ 2012-07-28 15:28 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jul 28, 2012 at 6:22 PM, Daniel Mack <zonque@gmail.com> wrote:
> On 28.07.2012 08:58, Haojian Zhuang wrote:
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
>> ---
>> drivers/pinctrl/pinctrl-pxa3xx.c | 189 ++++++++++++++++++++++++++++++++++++++
>> drivers/pinctrl/pinctrl-pxa3xx.h | 17 ++++
>> 2 files changed, 206 insertions(+)
>
> As I'm working on a PXA3xx platform currently that already fully boots
> from DT, I'd like to give this series a try.
>
> But I wonder if this is supposed to be fully working yet, because that
> code won't be compiled for PXA3xx as long as PINCTRL isn't set for that
> platform (arch/arm/mach-pxa/Kconfig).
>
>
> Daniel
>
>
pinctrl-pxa3xx.c is the common code for those PXA silicons. But I didn't add
the pxa300/pxa310/pxa320 pin support yet. Now I only support pxa168/pxa910/
mmp2 silicon.
Regards
Haojian
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 1/6] pinctrl: append new pins and groups in pxa910
2012-07-28 6:58 ` [PATCH 1/6] pinctrl: append new pins and groups in pxa910 Haojian Zhuang
@ 2012-08-05 0:04 ` Linus Walleij
0 siblings, 0 replies; 23+ messages in thread
From: Linus Walleij @ 2012-08-05 0:04 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jul 28, 2012 at 8:58 AM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
> ---
> drivers/pinctrl/pinctrl-pxa910.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 2/6] pinctrl: add pinconf support in pxa3xx
2012-07-28 6:58 ` [PATCH 2/6] pinctrl: add pinconf support in pxa3xx Haojian Zhuang
2012-07-28 10:22 ` Daniel Mack
@ 2012-08-05 0:05 ` Linus Walleij
1 sibling, 0 replies; 23+ messages in thread
From: Linus Walleij @ 2012-08-05 0:05 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jul 28, 2012 at 8:58 AM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
[Please put in a more verbose commit message, this is a pretty big patch!]
> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 3/6] pinctrl: support dt in pxa series
2012-07-28 6:58 ` [PATCH 3/6] pinctrl: support dt in pxa series Haojian Zhuang
@ 2012-08-05 0:07 ` Linus Walleij
0 siblings, 0 replies; 23+ messages in thread
From: Linus Walleij @ 2012-08-05 0:07 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jul 28, 2012 at 8:58 AM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
> Add DT support in PXA168/PXA910/MMP2 pinctrl driver.
[Expand on what that means a bit please]
> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/6] pinctrl: append new groups of mmp2
2012-07-28 6:58 ` [PATCH 4/6] pinctrl: append new groups of mmp2 Haojian Zhuang
@ 2012-08-05 0:07 ` Linus Walleij
0 siblings, 0 replies; 23+ messages in thread
From: Linus Walleij @ 2012-08-05 0:07 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jul 28, 2012 at 8:58 AM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
> ---
> drivers/pinctrl/pinctrl-mmp2.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 5/6] ARM: mmp: select pinctrl for boards with DT
2012-07-28 6:58 ` [PATCH 5/6] ARM: mmp: select pinctrl for boards with DT Haojian Zhuang
@ 2012-08-05 0:08 ` Linus Walleij
0 siblings, 0 replies; 23+ messages in thread
From: Linus Walleij @ 2012-08-05 0:08 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jul 28, 2012 at 8:58 AM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-07-28 6:58 ` [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files Haojian Zhuang
@ 2012-08-05 0:09 ` Linus Walleij
2012-08-06 8:44 ` Arnd Bergmann
1 sibling, 0 replies; 23+ messages in thread
From: Linus Walleij @ 2012-08-05 0:09 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jul 28, 2012 at 8:58 AM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
I have no clue as to whether these are good DT bindings or not, so
leaving this up to the PXA maintainers :-)
You don't need my ACK for this part anyway.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-07-28 6:58 ` [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files Haojian Zhuang
2012-08-05 0:09 ` Linus Walleij
@ 2012-08-06 8:44 ` Arnd Bergmann
2012-08-06 10:32 ` Daniel Mack
` (2 more replies)
1 sibling, 3 replies; 23+ messages in thread
From: Arnd Bergmann @ 2012-08-06 8:44 UTC (permalink / raw)
To: linux-arm-kernel
On Saturday 28 July 2012, Haojian Zhuang wrote:
> +Required subnode-properties:
> +- marvell,pins : An array of strings. Each string contains the name of a pin
> + or group.
> +- marvell,function : A string containing the name of the function to mux to the
> + pin or group.
> +- marvell,drive-strength : An integer value that means the drive strength of a
> + pin.
> +- marvell,pull-up : The property means a pin is pull up for input.
> +- marvell,pull-down : The property means a pin is pull down for input.
> +- marvell,lowpower-pull-up : The property means a pin is pull up for input in
> + sleep state.
> +- marvell,lowpower-pull-down : The property means a pin is pull down for input
> + in sleep state.
> +- marvell,lowpower-drive-high : The property means a pin is driving high for
> + output in sleep state.
> +- marvell,lowpower-drive-low : The property means a pin is driving low for
> + output in sleep state.
> +- marvell,lowpower-float : The property means a pin is float in sleep state.
> +- marvell,lowpower-zero : The property means a pin is not configured in sleep
> + state.
These (or most of them) look like they are not very Marvell specific. Should
we try to standardize the way they are set across different bindings?
On a side-node, you probably don't want to make all of the above properties
"required" because some of them are mutually exclusive.
Arnd
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-08-06 8:44 ` Arnd Bergmann
@ 2012-08-06 10:32 ` Daniel Mack
2012-08-06 10:33 ` Haojian Zhuang
2012-08-07 6:49 ` Linus Walleij
2 siblings, 0 replies; 23+ messages in thread
From: Daniel Mack @ 2012-08-06 10:32 UTC (permalink / raw)
To: linux-arm-kernel
On 06.08.2012 10:44, Arnd Bergmann wrote:
> On Saturday 28 July 2012, Haojian Zhuang wrote:
>> +Required subnode-properties:
>> +- marvell,pins : An array of strings. Each string contains the name of a pin
>> + or group.
>> +- marvell,function : A string containing the name of the function to mux to the
>> + pin or group.
>> +- marvell,drive-strength : An integer value that means the drive strength of a
>> + pin.
>> +- marvell,pull-up : The property means a pin is pull up for input.
>> +- marvell,pull-down : The property means a pin is pull down for input.
>> +- marvell,lowpower-pull-up : The property means a pin is pull up for input in
>> + sleep state.
>> +- marvell,lowpower-pull-down : The property means a pin is pull down for input
>> + in sleep state.
>> +- marvell,lowpower-drive-high : The property means a pin is driving high for
>> + output in sleep state.
>> +- marvell,lowpower-drive-low : The property means a pin is driving low for
>> + output in sleep state.
>> +- marvell,lowpower-float : The property means a pin is float in sleep state.
>> +- marvell,lowpower-zero : The property means a pin is not configured in sleep
>> + state.
>
> These (or most of them) look like they are not very Marvell specific. Should
> we try to standardize the way they are set across different bindings?
Yes please. That way we also have a higher chance that implementations
on other platforms will be similar.
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-08-06 8:44 ` Arnd Bergmann
2012-08-06 10:32 ` Daniel Mack
@ 2012-08-06 10:33 ` Haojian Zhuang
2012-08-07 6:49 ` Linus Walleij
2 siblings, 0 replies; 23+ messages in thread
From: Haojian Zhuang @ 2012-08-06 10:33 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 6, 2012 at 4:44 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 28 July 2012, Haojian Zhuang wrote:
>> +Required subnode-properties:
>> +- marvell,pins : An array of strings. Each string contains the name of a pin
>> + or group.
>> +- marvell,function : A string containing the name of the function to mux to the
>> + pin or group.
>> +- marvell,drive-strength : An integer value that means the drive strength of a
>> + pin.
>> +- marvell,pull-up : The property means a pin is pull up for input.
>> +- marvell,pull-down : The property means a pin is pull down for input.
>> +- marvell,lowpower-pull-up : The property means a pin is pull up for input in
>> + sleep state.
>> +- marvell,lowpower-pull-down : The property means a pin is pull down for input
>> + in sleep state.
>> +- marvell,lowpower-drive-high : The property means a pin is driving high for
>> + output in sleep state.
>> +- marvell,lowpower-drive-low : The property means a pin is driving low for
>> + output in sleep state.
>> +- marvell,lowpower-float : The property means a pin is float in sleep state.
>> +- marvell,lowpower-zero : The property means a pin is not configured in sleep
>> + state.
>
> These (or most of them) look like they are not very Marvell specific. Should
> we try to standardize the way they are set across different bindings?
>
> On a side-node, you probably don't want to make all of the above properties
> "required" because some of them are mutually exclusive.
>
OK, I'll handle it.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-08-06 8:44 ` Arnd Bergmann
2012-08-06 10:32 ` Daniel Mack
2012-08-06 10:33 ` Haojian Zhuang
@ 2012-08-07 6:49 ` Linus Walleij
2012-08-09 14:28 ` Daniel Mack
2 siblings, 1 reply; 23+ messages in thread
From: Linus Walleij @ 2012-08-07 6:49 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 6, 2012 at 10:44 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 28 July 2012, Haojian Zhuang wrote:
>> +Required subnode-properties:
>> +- marvell,pins : An array of strings. Each string contains the name of a pin
>> + or group.
>> +- marvell,function : A string containing the name of the function to mux to the
>> + pin or group.
>> +- marvell,drive-strength : An integer value that means the drive strength of a
>> + pin.
>> +- marvell,pull-up : The property means a pin is pull up for input.
>> +- marvell,pull-down : The property means a pin is pull down for input.
>> +- marvell,lowpower-pull-up : The property means a pin is pull up for input in
>> + sleep state.
>> +- marvell,lowpower-pull-down : The property means a pin is pull down for input
>> + in sleep state.
>> +- marvell,lowpower-drive-high : The property means a pin is driving high for
>> + output in sleep state.
>> +- marvell,lowpower-drive-low : The property means a pin is driving low for
>> + output in sleep state.
>> +- marvell,lowpower-float : The property means a pin is float in sleep state.
>> +- marvell,lowpower-zero : The property means a pin is not configured in sleep
>> + state.
>
> These (or most of them) look like they are not very Marvell specific. Should
> we try to standardize the way they are set across different bindings?
If the device tree properties are to be standardized, the driver should be
moved over to using generic pin config (drivers/pinctrl/pinconf-generic.c,
include/linux/pinctrl/pinconf-generic.h) too, or it makes no sense.
So please augment the PXA driver to use these, then move the generic
bindings to pinconf-generic.txt or something.
If pinconf-generic needs extending/augmenting in the process, just do it,
it's supposed to be generic...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-08-07 6:49 ` Linus Walleij
@ 2012-08-09 14:28 ` Daniel Mack
2012-08-10 10:56 ` Linus Walleij
0 siblings, 1 reply; 23+ messages in thread
From: Daniel Mack @ 2012-08-09 14:28 UTC (permalink / raw)
To: linux-arm-kernel
On 07.08.2012 08:49, Linus Walleij wrote:
> On Mon, Aug 6, 2012 at 10:44 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Saturday 28 July 2012, Haojian Zhuang wrote:
>>> +Required subnode-properties:
>>> +- marvell,pins : An array of strings. Each string contains the name of a pin
>>> + or group.
>>> +- marvell,function : A string containing the name of the function to mux to the
>>> + pin or group.
>>> +- marvell,drive-strength : An integer value that means the drive strength of a
>>> + pin.
>>> +- marvell,pull-up : The property means a pin is pull up for input.
>>> +- marvell,pull-down : The property means a pin is pull down for input.
>>> +- marvell,lowpower-pull-up : The property means a pin is pull up for input in
>>> + sleep state.
>>> +- marvell,lowpower-pull-down : The property means a pin is pull down for input
>>> + in sleep state.
>>> +- marvell,lowpower-drive-high : The property means a pin is driving high for
>>> + output in sleep state.
>>> +- marvell,lowpower-drive-low : The property means a pin is driving low for
>>> + output in sleep state.
>>> +- marvell,lowpower-float : The property means a pin is float in sleep state.
>>> +- marvell,lowpower-zero : The property means a pin is not configured in sleep
>>> + state.
>>
>> These (or most of them) look like they are not very Marvell specific. Should
>> we try to standardize the way they are set across different bindings?
>
> If the device tree properties are to be standardized, the driver should be
> moved over to using generic pin config (drivers/pinctrl/pinconf-generic.c,
> include/linux/pinctrl/pinconf-generic.h) too, or it makes no sense.
>
> So please augment the PXA driver to use these, then move the generic
> bindings to pinconf-generic.txt or something.
>
> If pinconf-generic needs extending/augmenting in the process, just do it,
> it's supposed to be generic...
I am looking at the generic pinctrl code right now and I wonder if the
following approach would be ok:
- each driver that calls pinctrl_register() has its own dt_match_table
entry, so the 'compatible' part of the bindings is specific to a pin
controller chip.
- introduce a pinctrl_parse_of(struct of_node *) and call that after the
driver has added all its pins. That function walks all the children of
the given node and uses the callbacks provided by the driver to do the
actual work.
- Unfortunately, we can't parse the node from pinctrl_register() as the
gpio ranges are only added after that by the drivers.
If that sounds good, I can come up with a patch.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-08-09 14:28 ` Daniel Mack
@ 2012-08-10 10:56 ` Linus Walleij
2012-08-13 9:43 ` Daniel Mack
0 siblings, 1 reply; 23+ messages in thread
From: Linus Walleij @ 2012-08-10 10:56 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Aug 9, 2012 at 4:28 PM, Daniel Mack <zonque@gmail.com> wrote:
> I am looking at the generic pinctrl code right now
Sweet!
> and I wonder if the following approach would be ok:
>
> - each driver that calls pinctrl_register() has its own dt_match_table
> entry, so the 'compatible' part of the bindings is specific to a pin
> controller chip.
Yep.
> - introduce a pinctrl_parse_of(struct of_node *) and call that after the
> driver has added all its pins. That function walks all the children of
> the given node and uses the callbacks provided by the driver to do the
> actual work.
Isn't that already how it works? Maybe I misunderstand, do you mean
that you want to pass the DT node to pinctrl_register()?
Are you talking about using pinctrl hogs to set up the default
configuration and muxing? That can already be done today,
and has nothing to do with whether you use generic pin config
or not.
This uses the .dt_node_to_map() and .dt_free_map() callbacks
in the pinctrl_ops vtable to generate a map from the device tree,
in any way you want.
So the infrastructure I think already exists, but whereas all
current driver have their own config and mux (etc) parsing
code, pinconf-generic could provide something that would
be common for all driver using generic pin config.
> - Unfortunately, we can't parse the node from pinctrl_register() as the
> gpio ranges are only added after that by the drivers.
The ranges are a *big* problem and we haven't come up with
a proper DT binding for these. After discussion with Grant,
he has proposed that GPIO chips should register their ranges
using their local numberspace and always passing the
struct gpio_chip, instead of pin controllers registering ranges.
Documented here:
https://blueprints.launchpad.net/linux-linaro/+spec/pinctrl-gpiorange-makeover
> If that sounds good, I can come up with a patch.
I think you already have what you need, look closer at how
e.g. the Tegra or i.MX driver does this. Or maybe I'm only
getting it backwards?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-08-10 10:56 ` Linus Walleij
@ 2012-08-13 9:43 ` Daniel Mack
2012-08-13 14:11 ` Linus Walleij
0 siblings, 1 reply; 23+ messages in thread
From: Daniel Mack @ 2012-08-13 9:43 UTC (permalink / raw)
To: linux-arm-kernel
On 10.08.2012 12:56, Linus Walleij wrote:
> On Thu, Aug 9, 2012 at 4:28 PM, Daniel Mack <zonque@gmail.com> wrote:
>
>> I am looking at the generic pinctrl code right now
>
> Sweet!
>
>> and I wonder if the following approach would be ok:
>>
>> - each driver that calls pinctrl_register() has its own dt_match_table
>> entry, so the 'compatible' part of the bindings is specific to a pin
>> controller chip.
>
> Yep.
>
>> - introduce a pinctrl_parse_of(struct of_node *) and call that after the
>> driver has added all its pins. That function walks all the children of
>> the given node and uses the callbacks provided by the driver to do the
>> actual work.
>
> Isn't that already how it works? Maybe I misunderstand, do you mean
> that you want to pass the DT node to pinctrl_register()?
To parse the generic bits, yes. But I realized only now that we already
have dt_to_map_one_config()
> Are you talking about using pinctrl hogs to set up the default
> configuration and muxing? That can already be done today,
> and has nothing to do with whether you use generic pin config
> or not.
>
> This uses the .dt_node_to_map() and .dt_free_map() callbacks
> in the pinctrl_ops vtable to generate a map from the device tree,
> in any way you want.
Yes, I see. And this is where duplication emerges, or, where
consolidation would need to be done. If we want to standardize the way
pins are set up in terms of bias, pullup/pulldown and all that, we would
just need to map generic DT entries to PIN_CONFIG_* and call the pin
controllers specific functions.
> So the infrastructure I think already exists, but whereas all
> current driver have their own config and mux (etc) parsing
> code, pinconf-generic could provide something that would
> be common for all driver using generic pin config.
Exactly. And then the question is whether we want implicit behaviour.
IOW - let dt_to_map_one_config() parse the generic bits and then call
the driver specific augmentation code, if any.
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files
2012-08-13 9:43 ` Daniel Mack
@ 2012-08-13 14:11 ` Linus Walleij
0 siblings, 0 replies; 23+ messages in thread
From: Linus Walleij @ 2012-08-13 14:11 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 13, 2012 at 11:43 AM, Daniel Mack <zonque@gmail.com> wrote:
> On 10.08.2012 12:56, Linus Walleij wrote:
>> So the infrastructure I think already exists, but whereas all
>> current driver have their own config and mux (etc) parsing
>> code, pinconf-generic could provide something that would
>> be common for all driver using generic pin config.
>
> Exactly. And then the question is whether we want implicit behaviour.
> IOW - let dt_to_map_one_config() parse the generic bits and then call
> the driver specific augmentation code, if any.
Well if you make a patch I think we can see pretty clear
from the code what the best way of doing this will be.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2012-08-13 14:11 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-28 6:58 [PATCH 0/6] pinctrl: add DT support in PXA series Haojian Zhuang
2012-07-28 6:58 ` [PATCH 1/6] pinctrl: append new pins and groups in pxa910 Haojian Zhuang
2012-08-05 0:04 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 2/6] pinctrl: add pinconf support in pxa3xx Haojian Zhuang
2012-07-28 10:22 ` Daniel Mack
2012-07-28 15:28 ` Haojian Zhuang
2012-08-05 0:05 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 3/6] pinctrl: support dt in pxa series Haojian Zhuang
2012-08-05 0:07 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 4/6] pinctrl: append new groups of mmp2 Haojian Zhuang
2012-08-05 0:07 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 5/6] ARM: mmp: select pinctrl for boards with DT Haojian Zhuang
2012-08-05 0:08 ` Linus Walleij
2012-07-28 6:58 ` [PATCH 6/6] ARM: dts: add pinctrl in PXA DT files Haojian Zhuang
2012-08-05 0:09 ` Linus Walleij
2012-08-06 8:44 ` Arnd Bergmann
2012-08-06 10:32 ` Daniel Mack
2012-08-06 10:33 ` Haojian Zhuang
2012-08-07 6:49 ` Linus Walleij
2012-08-09 14:28 ` Daniel Mack
2012-08-10 10:56 ` Linus Walleij
2012-08-13 9:43 ` Daniel Mack
2012-08-13 14:11 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).