* [PATCH 0/6] pinctrl: rockchip: add rk3188 support
@ 2013-10-15 10:46 Heiko Stübner
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 10:46 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely,
Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA
A patch series, finalizing support for the pin controller in the rk3188.
As mentioned in the individual patches, the rk3188 makes it even more
complex due to its strange pull setting configuration. Therefore a bit
of reordering needed to take place to accomodate this.
Heiko Stuebner (6):
pinctrl: rockchip: separate different sub-types more
of: add function to check against a list of compatible strings
pinctrl: rockchip: add support for multiple bank types
pinctrl: rockchip: remove redundant check
pinctrl: rockchip: add rk3188 specifics
pinctrl: rockchip: emulate both edge triggered interrupts
.../bindings/pinctrl/rockchip,pinctrl.txt | 46 +++-
drivers/of/base.c | 21 ++
drivers/pinctrl/pinctrl-rockchip.c | 290 +++++++++++++++-----
include/linux/of.h | 2 +
4 files changed, 295 insertions(+), 64 deletions(-)
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/6] pinctrl: rockchip: separate different sub-types more
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
@ 2013-10-15 10:47 ` Heiko Stübner
2013-10-15 10:47 ` [PATCH 2/6] of: add function to check against a list of compatible strings Heiko Stübner
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 10:47 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely,
Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA
Further investigation of the different Rockchip SoCs showed that
the differences especially in the pull settings are quite deep.
As further patches will show, the register layout for the pulls of
the rk3188 is quite strange. Also it is to assume, that later
Rockchip SoCs may introduce even more quirks in this regard, making
it hard to support all of those using the current generic pull_*
variables.
Therefore move the driver to hold the type of controller in an enum
and do the handling according to it in the necessary places. Also
instead of calculating the register in the get and set pull functions
move it to a type-specific callback.
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
drivers/pinctrl/pinctrl-rockchip.c | 105 +++++++++++++++++++-----------------
1 file changed, 57 insertions(+), 48 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index e0718b7..df155f9 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -56,6 +56,12 @@
#define GPIO_EXT_PORT 0x50
#define GPIO_LS_SYNC 0x60
+enum rockchip_pinctrl_type {
+ RK2928,
+ RK3066B,
+ RK3188,
+};
+
/**
* @reg_base: register base of the gpio bank
* @clk: clock of the gpio bank
@@ -98,18 +104,16 @@ struct rockchip_pin_bank {
}
/**
- * @pull_auto: some SoCs don't allow pulls to be specified as up or down, but
- * instead decide this automatically based on the pad-type.
*/
struct rockchip_pin_ctrl {
struct rockchip_pin_bank *pin_banks;
u32 nr_banks;
u32 nr_pins;
char *label;
+ enum rockchip_pinctrl_type type;
int mux_offset;
- int pull_offset;
- bool pull_auto;
- int pull_bank_stride;
+ void (*pull_calc_reg)(struct rockchip_pin_bank *bank, int pin_num,
+ void __iomem **reg, u8 *bit);
};
struct rockchip_pin_config {
@@ -354,6 +358,22 @@ static void rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
spin_unlock_irqrestore(&bank->slock, flags);
}
+#define RK2928_PULL_OFFSET 0x118
+#define RK2928_PULL_PINS_PER_REG 16
+#define RK2928_PULL_BANK_STRIDE 8
+
+static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
+ int pin_num, void __iomem **reg, u8 *bit)
+{
+ struct rockchip_pinctrl *info = bank->drvdata;
+
+ *reg = info->reg_base + RK2928_PULL_OFFSET;
+ *reg += bank->bank_num * RK2928_PULL_BANK_STRIDE;
+ *reg += (pin_num / RK2928_PULL_PINS_PER_REG) * 4;
+
+ *bit = pin_num % RK2928_PULL_PINS_PER_REG;
+};
+
static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
{
struct rockchip_pinctrl *info = bank->drvdata;
@@ -362,23 +382,22 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
u8 bit;
/* rk3066b does support any pulls */
- if (!ctrl->pull_offset)
+ if (ctrl->type == RK3066B)
return PIN_CONFIG_BIAS_DISABLE;
- reg = info->reg_base + ctrl->pull_offset;
-
- if (ctrl->pull_auto) {
- reg += bank->bank_num * ctrl->pull_bank_stride;
- reg += (pin_num / 16) * 4;
- bit = pin_num % 16;
-
+ switch (ctrl->type) {
+ case RK2928:
+ ctrl->pull_calc_reg(bank, pin_num, ®, &bit);
return !(readl_relaxed(reg) & BIT(bit))
? PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
: PIN_CONFIG_BIAS_DISABLE;
- } else {
+ case RK3188:
dev_err(info->dev, "pull support for rk31xx not implemented\n");
return -EIO;
- }
+ default:
+ dev_err(info->dev, "unsupported pinctrl type\n");
+ return -EINVAL;
+ };
}
static int rockchip_set_pull(struct rockchip_pin_bank *bank,
@@ -395,21 +414,18 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
bank->bank_num, pin_num, pull);
/* rk3066b does support any pulls */
- if (!ctrl->pull_offset)
+ if (ctrl->type == RK3066B)
return pull ? -EINVAL : 0;
- reg = info->reg_base + ctrl->pull_offset;
-
- if (ctrl->pull_auto) {
+ switch (ctrl->type) {
+ case RK2928:
if (pull != PIN_CONFIG_BIAS_PULL_PIN_DEFAULT &&
pull != PIN_CONFIG_BIAS_DISABLE) {
dev_err(info->dev, "only PIN_DEFAULT and DISABLE allowed\n");
return -EINVAL;
}
- reg += bank->bank_num * ctrl->pull_bank_stride;
- reg += (pin_num / 16) * 4;
- bit = pin_num % 16;
+ ctrl->pull_calc_reg(bank, pin_num, ®, &bit);
spin_lock_irqsave(&bank->slock, flags);
@@ -419,14 +435,13 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
writel(data, reg);
spin_unlock_irqrestore(&bank->slock, flags);
- } else {
- if (pull == PIN_CONFIG_BIAS_PULL_PIN_DEFAULT) {
- dev_err(info->dev, "pull direction (up/down) needs to be specified\n");
- return -EINVAL;
- }
-
+ break;
+ case RK3188:
dev_err(info->dev, "pull support for rk31xx not implemented\n");
return -EIO;
+ default:
+ dev_err(info->dev, "unsupported pinctrl type\n");
+ return -EINVAL;
}
return 0;
@@ -556,20 +571,17 @@ static const struct pinmux_ops rockchip_pmx_ops = {
static bool rockchip_pinconf_pull_valid(struct rockchip_pin_ctrl *ctrl,
enum pin_config_param pull)
{
- /* rk3066b does support any pulls */
- if (!ctrl->pull_offset)
+ switch (ctrl->type) {
+ case RK2928:
+ return (pull == PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ||
+ pull == PIN_CONFIG_BIAS_DISABLE);
+ case RK3066B:
return pull ? false : true;
-
- if (ctrl->pull_auto) {
- if (pull != PIN_CONFIG_BIAS_PULL_PIN_DEFAULT &&
- pull != PIN_CONFIG_BIAS_DISABLE)
- return false;
- } else {
- if (pull == PIN_CONFIG_BIAS_PULL_PIN_DEFAULT)
- return false;
+ case RK3188:
+ return (pull != PIN_CONFIG_BIAS_PULL_PIN_DEFAULT);
}
- return true;
+ return false;
}
/* set the pin config settings for a specified pin */
@@ -1315,10 +1327,9 @@ static struct rockchip_pin_ctrl rk2928_pin_ctrl = {
.pin_banks = rk2928_pin_banks,
.nr_banks = ARRAY_SIZE(rk2928_pin_banks),
.label = "RK2928-GPIO",
+ .type = RK2928,
.mux_offset = 0xa8,
- .pull_offset = 0x118,
- .pull_auto = 1,
- .pull_bank_stride = 8,
+ .pull_calc_reg = rk2928_calc_pull_reg_and_bit,
};
static struct rockchip_pin_bank rk3066a_pin_banks[] = {
@@ -1334,10 +1345,9 @@ static struct rockchip_pin_ctrl rk3066a_pin_ctrl = {
.pin_banks = rk3066a_pin_banks,
.nr_banks = ARRAY_SIZE(rk3066a_pin_banks),
.label = "RK3066a-GPIO",
+ .type = RK2928,
.mux_offset = 0xa8,
- .pull_offset = 0x118,
- .pull_auto = 1,
- .pull_bank_stride = 8,
+ .pull_calc_reg = rk2928_calc_pull_reg_and_bit,
};
static struct rockchip_pin_bank rk3066b_pin_banks[] = {
@@ -1351,8 +1361,8 @@ static struct rockchip_pin_ctrl rk3066b_pin_ctrl = {
.pin_banks = rk3066b_pin_banks,
.nr_banks = ARRAY_SIZE(rk3066b_pin_banks),
.label = "RK3066b-GPIO",
+ .type = RK3066B,
.mux_offset = 0x60,
- .pull_offset = -EINVAL,
};
static struct rockchip_pin_bank rk3188_pin_banks[] = {
@@ -1366,9 +1376,8 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = {
.pin_banks = rk3188_pin_banks,
.nr_banks = ARRAY_SIZE(rk3188_pin_banks),
.label = "RK3188-GPIO",
+ .type = RK3188,
.mux_offset = 0x68,
- .pull_offset = 0x164,
- .pull_bank_stride = 16,
};
static const struct of_device_id rockchip_pinctrl_dt_match[] = {
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/6] of: add function to check against a list of compatible strings
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-10-15 10:47 ` [PATCH 1/6] pinctrl: rockchip: separate different sub-types more Heiko Stübner
@ 2013-10-15 10:47 ` Heiko Stübner
2013-10-15 11:11 ` Mark Rutland
2013-10-15 10:48 ` [PATCH 3/6] pinctrl: rockchip: add support for multiple bank types Heiko Stübner
` (3 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 10:47 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely,
Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA
The basic of functions already provide a of_device_is_compatible to check
if a device's compatible property contains a specific one. But sometimes
it's also necessary to check if the device is compatible to one out of a
list of compatible devices.
Therefore add of_device_is_any_of that reuses the compatible check of
of_device_is_compatible but checks against a list of compatible strings
without the locking overhead of calling of_device_is_compatible multiple
times.
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
drivers/of/base.c | 21 +++++++++++++++++++++
include/linux/of.h | 2 ++
2 files changed, 23 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 865d3f6..589f43e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -366,6 +366,27 @@ int of_device_is_compatible(const struct device_node *device,
EXPORT_SYMBOL(of_device_is_compatible);
/**
+ * Checks if any of the given "compat" strings matches one of the strings
+ * in the device's "compatible" property.
+ */
+int of_device_is_any_of(const struct device_node *device,
+ const char * const *compat, int num) {
+ unsigned long flags;
+ int res = 0, i;
+
+ raw_spin_lock_irqsave(&devtree_lock, flags);
+ for (i = 0; i < num; i++) {
+ if (__of_device_is_compatible(device, compat[i])) {
+ res = 1;
+ break;
+ }
+ }
+ raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ return res;
+}
+EXPORT_SYMBOL(of_device_is_any_of);
+
+/**
* of_machine_is_compatible - Test root of device tree for a given compatible value
* @compat: compatible string to look for in root node's compatible property.
*
diff --git a/include/linux/of.h b/include/linux/of.h
index f95aee3..5bf7c9a 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -262,6 +262,8 @@ extern int of_property_count_strings(struct device_node *np,
const char *propname);
extern int of_device_is_compatible(const struct device_node *device,
const char *);
+extern int of_device_is_any_of(const struct device_node *device,
+ const char * const *compat, int num);
extern int of_device_is_available(const struct device_node *device);
extern const void *of_get_property(const struct device_node *node,
const char *name,
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/6] pinctrl: rockchip: add support for multiple bank types
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-10-15 10:47 ` [PATCH 1/6] pinctrl: rockchip: separate different sub-types more Heiko Stübner
2013-10-15 10:47 ` [PATCH 2/6] of: add function to check against a list of compatible strings Heiko Stübner
@ 2013-10-15 10:48 ` Heiko Stübner
2013-10-15 10:48 ` [PATCH 4/6] pinctrl: rockchip: remove redundant check Heiko Stübner
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 10:48 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely,
Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA
There are Rockchip SoCs, namely the rk3188, that combine a set of
regular banks with banks that need special handling for some settings.
Therefore add the possibility for the driver to handle more than one
bank type.
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
drivers/pinctrl/pinctrl-rockchip.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index df155f9..bfa3abe 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -62,6 +62,10 @@ enum rockchip_pinctrl_type {
RK3188,
};
+enum rockchip_pin_bank_type {
+ COMMON_BANK,
+};
+
/**
* @reg_base: register base of the gpio bank
* @clk: clock of the gpio bank
@@ -86,6 +90,7 @@ struct rockchip_pin_bank {
u8 nr_pins;
char *name;
u8 bank_num;
+ enum rockchip_pin_bank_type bank_type;
bool valid;
struct device_node *of_node;
struct rockchip_pinctrl *drvdata;
@@ -668,7 +673,9 @@ static const struct pinconf_ops rockchip_pinconf_ops = {
.pin_config_set = rockchip_pinconf_set,
};
-static const char *gpio_compat = "rockchip,gpio-bank";
+static const char * const gpio_compat[] = {
+ "rockchip,gpio-bank",
+};
static void rockchip_pinctrl_child_count(struct rockchip_pinctrl *info,
struct device_node *np)
@@ -676,7 +683,8 @@ static void rockchip_pinctrl_child_count(struct rockchip_pinctrl *info,
struct device_node *child;
for_each_child_of_node(np, child) {
- if (of_device_is_compatible(child, gpio_compat))
+ if (of_device_is_any_of(child, gpio_compat,
+ ARRAY_SIZE(gpio_compat)))
continue;
info->nfunctions++;
@@ -819,7 +827,8 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
i = 0;
for_each_child_of_node(np, child) {
- if (of_device_is_compatible(child, gpio_compat))
+ if (of_device_is_any_of(child, gpio_compat,
+ ARRAY_SIZE(gpio_compat)))
continue;
ret = rockchip_pinctrl_parse_functions(child, info, i++);
if (ret) {
@@ -1217,6 +1226,8 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
if (IS_ERR(bank->reg_base))
return PTR_ERR(bank->reg_base);
+ bank->bank_type = COMMON_BANK;
+
bank->irq = irq_of_parse_and_map(bank->of_node, 0);
bank->clk = of_clk_get(bank->of_node, 0);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/6] pinctrl: rockchip: remove redundant check
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
` (2 preceding siblings ...)
2013-10-15 10:48 ` [PATCH 3/6] pinctrl: rockchip: add support for multiple bank types Heiko Stübner
@ 2013-10-15 10:48 ` Heiko Stübner
2013-10-15 10:49 ` [PATCH 5/6] pinctrl: rockchip: add rk3188 specifics Heiko Stübner
2013-10-15 10:49 ` [PATCH 6/6] pinctrl: rockchip: emulate both edge triggered interrupts Heiko Stübner
5 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 10:48 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely,
Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA
The check limiting bias options to supported ones is already
done thru rockchip_pinconf_pull_valid. Therefore this check is
redundant and can be removed.
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
drivers/pinctrl/pinctrl-rockchip.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index bfa3abe..c5bbd24 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -424,12 +424,6 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
switch (ctrl->type) {
case RK2928:
- if (pull != PIN_CONFIG_BIAS_PULL_PIN_DEFAULT &&
- pull != PIN_CONFIG_BIAS_DISABLE) {
- dev_err(info->dev, "only PIN_DEFAULT and DISABLE allowed\n");
- return -EINVAL;
- }
-
ctrl->pull_calc_reg(bank, pin_num, ®, &bit);
spin_lock_irqsave(&bank->slock, flags);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/6] pinctrl: rockchip: add rk3188 specifics
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
` (3 preceding siblings ...)
2013-10-15 10:48 ` [PATCH 4/6] pinctrl: rockchip: remove redundant check Heiko Stübner
@ 2013-10-15 10:49 ` Heiko Stübner
2013-10-15 10:49 ` [PATCH 6/6] pinctrl: rockchip: emulate both edge triggered interrupts Heiko Stübner
5 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 10:49 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely,
Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA
Besides the pull registers sitting in a separate place, the rk3188 also
has the peculiarity that the pull registers of the first bank are split
and the first half is sitting in the register space of the pmu.
Therefore this adds a special bank-type for the first bank, to handle
the two register sources.
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
.../bindings/pinctrl/rockchip,pinctrl.txt | 46 +++++++-
drivers/pinctrl/pinctrl-rockchip.c | 117 ++++++++++++++++++--
2 files changed, 155 insertions(+), 8 deletions(-)
diff --git a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
index b0fb101..f378d34 100644
--- a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
@@ -21,10 +21,13 @@ defined as gpio sub-nodes of the pinmux controller.
Required properties for iomux controller:
- compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl"
"rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl"
+ - reg: first element is the general register space of the iomux controller
+ second element is the separate pull register space of the rk3188
Required properties for gpio sub nodes:
- - compatible: "rockchip,gpio-bank"
+ - compatible: "rockchip,gpio-bank", "rockchip,rk3188-gpio-bank0"
- reg: register of the gpio bank (different than the iomux registerset)
+ second element: separate pull register for rk3188 bank0
- interrupts: base interrupt of the gpio bank in the interrupt controller
- clocks: clock that drives this bank
- gpio-controller: identifies the node as a gpio controller and pin bank.
@@ -95,3 +98,44 @@ uart2: serial@20064000 {
pinctrl-names = "default";
pinctrl-0 = <&uart2_xfer>;
};
+
+Example for rk3188:
+
+ pinctrl@20008000 {
+ compatible = "rockchip,rk3188-pinctrl";
+ reg = <0x20008000 0xa0>,
+ <0x20008164 0x1a0>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+
+ gpio0: gpio0@0x2000a000 {
+ compatible = "rockchip,rk3188-gpio-bank0";
+ reg = <0x2000a000 0x100>,
+ <0x20004064 0x8>;
+ interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clk_gates8 9>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+
+ gpio1: gpio1@0x2003c000 {
+ compatible = "rockchip,gpio-bank";
+ reg = <0x2003c000 0x100>;
+ interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clk_gates8 10>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+
+ ...
+
+ };
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index c5bbd24..4db286c 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -64,10 +64,12 @@ enum rockchip_pinctrl_type {
enum rockchip_pin_bank_type {
COMMON_BANK,
+ RK3188_BANK0,
};
/**
* @reg_base: register base of the gpio bank
+ * @reg_pull: optional separate register for additional pull settings
* @clk: clock of the gpio bank
* @irq: interrupt of the gpio bank
* @pin_base: first pin number
@@ -84,6 +86,7 @@ enum rockchip_pin_bank_type {
*/
struct rockchip_pin_bank {
void __iomem *reg_base;
+ void __iomem *reg_pull;
struct clk *clk;
int irq;
u32 pin_base;
@@ -157,6 +160,7 @@ struct rockchip_pmx_func {
struct rockchip_pinctrl {
void __iomem *reg_base;
+ void __iomem *reg_pull;
struct device *dev;
struct rockchip_pin_ctrl *ctrl;
struct pinctrl_desc pctl;
@@ -379,25 +383,71 @@ static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
*bit = pin_num % RK2928_PULL_PINS_PER_REG;
};
+#define RK3188_PULL_BITS_PER_PIN 2
+#define RK3188_PULL_PINS_PER_REG 8
+#define RK3188_PULL_BANK_STRIDE 16
+
+static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
+ int pin_num, void __iomem **reg, u8 *bit)
+{
+ struct rockchip_pinctrl *info = bank->drvdata;
+
+ /* The first 12 pins of the first bank are located elsewhere */
+ if (bank->bank_type == RK3188_BANK0 && pin_num < 12) {
+ *reg = bank->reg_pull +
+ ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
+ *bit = pin_num % RK3188_PULL_PINS_PER_REG;
+ *bit *= RK3188_PULL_BITS_PER_PIN;
+ } else {
+ *reg = info->reg_pull - 4;
+ *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE;
+ *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
+
+ /*
+ * The bits in these registers have an inverse ordering
+ * with the lowest pin being in bits 15:14 and the highest
+ * pin in bits 1:0
+ */
+ *bit = 7 - (pin_num % RK3188_PULL_PINS_PER_REG);
+ *bit *= RK3188_PULL_BITS_PER_PIN;
+ }
+}
+
static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
{
struct rockchip_pinctrl *info = bank->drvdata;
struct rockchip_pin_ctrl *ctrl = info->ctrl;
void __iomem *reg;
u8 bit;
+ u32 data;
/* rk3066b does support any pulls */
if (ctrl->type == RK3066B)
return PIN_CONFIG_BIAS_DISABLE;
+ ctrl->pull_calc_reg(bank, pin_num, ®, &bit);
+
switch (ctrl->type) {
case RK2928:
- ctrl->pull_calc_reg(bank, pin_num, ®, &bit);
return !(readl_relaxed(reg) & BIT(bit))
? PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
: PIN_CONFIG_BIAS_DISABLE;
case RK3188:
- dev_err(info->dev, "pull support for rk31xx not implemented\n");
+ data = readl_relaxed(reg) >> bit;
+ data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1;
+
+ switch (data) {
+ case 0:
+ return PIN_CONFIG_BIAS_DISABLE;
+ case 1:
+ return PIN_CONFIG_BIAS_PULL_UP;
+ case 2:
+ return PIN_CONFIG_BIAS_PULL_DOWN;
+ case 3:
+ return PIN_CONFIG_BIAS_BUS_HOLD;
+ }
+
+ dev_err(info->dev, "unknown pull setting\n");
return -EIO;
default:
dev_err(info->dev, "unsupported pinctrl type\n");
@@ -422,10 +471,10 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
if (ctrl->type == RK3066B)
return pull ? -EINVAL : 0;
+ ctrl->pull_calc_reg(bank, pin_num, ®, &bit);
+
switch (ctrl->type) {
case RK2928:
- ctrl->pull_calc_reg(bank, pin_num, ®, &bit);
-
spin_lock_irqsave(&bank->slock, flags);
data = BIT(bit + 16);
@@ -436,8 +485,33 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
spin_unlock_irqrestore(&bank->slock, flags);
break;
case RK3188:
- dev_err(info->dev, "pull support for rk31xx not implemented\n");
- return -EIO;
+ spin_lock_irqsave(&bank->slock, flags);
+
+ /* enable the write to the equivalent lower bits */
+ data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16);
+
+ switch (pull) {
+ case PIN_CONFIG_BIAS_DISABLE:
+ break;
+ case PIN_CONFIG_BIAS_PULL_UP:
+ data |= (1 << bit);
+ break;
+ case PIN_CONFIG_BIAS_PULL_DOWN:
+ data |= (2 << bit);
+ break;
+ case PIN_CONFIG_BIAS_BUS_HOLD:
+ data |= (3 << bit);
+ break;
+ default:
+ dev_err(info->dev, "unsupported pull setting %d\n",
+ pull);
+ return -EINVAL;
+ }
+
+ writel(data, reg);
+
+ spin_unlock_irqrestore(&bank->slock, flags);
+ break;
default:
dev_err(info->dev, "unsupported pinctrl type\n");
return -EINVAL;
@@ -608,6 +681,7 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
case PIN_CONFIG_BIAS_PULL_UP:
case PIN_CONFIG_BIAS_PULL_DOWN:
case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
+ case PIN_CONFIG_BIAS_BUS_HOLD:
if (!rockchip_pinconf_pull_valid(info->ctrl, param))
return -ENOTSUPP;
@@ -646,6 +720,7 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
case PIN_CONFIG_BIAS_PULL_UP:
case PIN_CONFIG_BIAS_PULL_DOWN:
case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
+ case PIN_CONFIG_BIAS_BUS_HOLD:
if (!rockchip_pinconf_pull_valid(info->ctrl, param))
return -ENOTSUPP;
@@ -669,6 +744,7 @@ static const struct pinconf_ops rockchip_pinconf_ops = {
static const char * const gpio_compat[] = {
"rockchip,gpio-bank",
+ "rockchip,rk3188-gpio-bank0",
};
static void rockchip_pinctrl_child_count(struct rockchip_pinctrl *info,
@@ -1220,7 +1296,25 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
if (IS_ERR(bank->reg_base))
return PTR_ERR(bank->reg_base);
- bank->bank_type = COMMON_BANK;
+ /*
+ * special case, where parts of the pull setting-registers are
+ * part of the PMU register space
+ */
+ if (of_device_is_compatible(bank->of_node,
+ "rockchip,rk3188-gpio-bank0")) {
+ bank->bank_type = RK3188_BANK0;
+
+ if (of_address_to_resource(bank->of_node, 1, &res)) {
+ dev_err(dev, "cannot find IO resource for bank\n");
+ return -ENOENT;
+ }
+
+ bank->reg_pull = devm_ioremap_resource(dev, &res);
+ if (IS_ERR(bank->reg_pull))
+ return PTR_ERR(bank->reg_pull);
+ } else {
+ bank->bank_type = COMMON_BANK;
+ }
bank->irq = irq_of_parse_and_map(bank->of_node, 0);
@@ -1306,6 +1400,14 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
if (IS_ERR(info->reg_base))
return PTR_ERR(info->reg_base);
+ /* The RK3188 has its pull registers in a separate place */
+ if (ctrl->type == RK3188) {
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ info->reg_pull = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(info->reg_base))
+ return PTR_ERR(info->reg_base);
+ }
+
ret = rockchip_gpiolib_register(pdev, info);
if (ret)
return ret;
@@ -1383,6 +1485,7 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = {
.label = "RK3188-GPIO",
.type = RK3188,
.mux_offset = 0x68,
+ .pull_calc_reg = rk3188_calc_pull_reg_and_bit,
};
static const struct of_device_id rockchip_pinctrl_dt_match[] = {
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/6] pinctrl: rockchip: emulate both edge triggered interrupts
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
` (4 preceding siblings ...)
2013-10-15 10:49 ` [PATCH 5/6] pinctrl: rockchip: add rk3188 specifics Heiko Stübner
@ 2013-10-15 10:49 ` Heiko Stübner
5 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 10:49 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely,
Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA
The gpio interrupt controller on Rockchip socs can do edge triggers only
for single edges but not both. Nevertheless a lot of gpio users rely on
the availability of both-edge triggered interrupts - i.e. gpio-keys.
Therefore implement a solution similar to pinctrl-coh901 re-setting the
triggering edge depending on the gpio value in the interrupt demuxer.
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
drivers/pinctrl/pinctrl-rockchip.c | 61 +++++++++++++++++++++++++++++++-----
1 file changed, 54 insertions(+), 7 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 4db286c..e8988a1 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -101,7 +101,7 @@ struct rockchip_pin_bank {
struct gpio_chip gpio_chip;
struct pinctrl_gpio_range grange;
spinlock_t slock;
-
+ u32 toggle_edge_mode;
};
#define PIN_BANK(id, pins, label) \
@@ -1076,7 +1076,9 @@ static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc)
{
struct irq_chip *chip = irq_get_chip(irq);
struct rockchip_pin_bank *bank = irq_get_handler_data(irq);
+ u32 polarity = 0, data = 0;
u32 pend;
+ bool edge_changed = false;
dev_dbg(bank->drvdata->dev, "got irq for bank %s\n", bank->name);
@@ -1084,6 +1086,12 @@ static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc)
pend = readl_relaxed(bank->reg_base + GPIO_INT_STATUS);
+ if (bank->toggle_edge_mode) {
+ polarity = readl_relaxed(bank->reg_base +
+ GPIO_INT_POLARITY);
+ data = readl_relaxed(bank->reg_base + GPIO_EXT_PORT);
+ }
+
while (pend) {
unsigned int virq;
@@ -1098,9 +1106,30 @@ static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc)
dev_dbg(bank->drvdata->dev, "handling irq %d\n", irq);
+ /*
+ * Triggering IRQ on both rising and falling edge
+ * needs manual intervention.
+ */
+ if (bank->toggle_edge_mode & BIT(irq)) {
+ if (data & BIT(irq))
+ polarity &= ~BIT(irq);
+ else
+ polarity |= BIT(irq);
+
+ edge_changed = true;
+ }
+
generic_handle_irq(virq);
}
+ if (bank->toggle_edge_mode && edge_changed) {
+ /* Interrupt params should only be set with ints disabled */
+ data = readl_relaxed(bank->reg_base + GPIO_INTEN);
+ writel_relaxed(0, bank->reg_base + GPIO_INTEN);
+ writel(polarity, bank->reg_base + GPIO_INT_POLARITY);
+ writel(data, bank->reg_base + GPIO_INTEN);
+ }
+
chained_irq_exit(chip, desc);
}
@@ -1113,6 +1142,12 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
u32 level;
u32 data;
+ /* make sure the pin is configured as gpio input */
+ rockchip_set_mux(bank, d->hwirq, RK_FUNC_GPIO);
+ data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR);
+ data &= ~mask;
+ writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR);
+
if (type & IRQ_TYPE_EDGE_BOTH)
__irq_set_handler_locked(d->irq, handle_edge_irq);
else
@@ -1124,19 +1159,37 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
polarity = readl_relaxed(gc->reg_base + GPIO_INT_POLARITY);
switch (type) {
+ case IRQ_TYPE_EDGE_BOTH:
+ bank->toggle_edge_mode |= mask;
+ level |= mask;
+
+ /*
+ * Determine gpio state. If 1 next interrupt should be falling
+ * otherwise rising.
+ */
+ data = readl(bank->reg_base + GPIO_EXT_PORT);
+ if (data & mask)
+ polarity &= ~mask;
+ else
+ polarity |= mask;
+ break;
case IRQ_TYPE_EDGE_RISING:
+ bank->toggle_edge_mode &= ~mask;
level |= mask;
polarity |= mask;
break;
case IRQ_TYPE_EDGE_FALLING:
+ bank->toggle_edge_mode &= ~mask;
level |= mask;
polarity &= ~mask;
break;
case IRQ_TYPE_LEVEL_HIGH:
+ bank->toggle_edge_mode &= ~mask;
level &= ~mask;
polarity |= mask;
break;
case IRQ_TYPE_LEVEL_LOW:
+ bank->toggle_edge_mode &= ~mask;
level &= ~mask;
polarity &= ~mask;
break;
@@ -1150,12 +1203,6 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
irq_gc_unlock(gc);
- /* make sure the pin is configured as gpio input */
- rockchip_set_mux(bank, d->hwirq, RK_FUNC_GPIO);
- data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR);
- data &= ~mask;
- writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR);
-
return 0;
}
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/6] of: add function to check against a list of compatible strings
2013-10-15 10:47 ` [PATCH 2/6] of: add function to check against a list of compatible strings Heiko Stübner
@ 2013-10-15 11:11 ` Mark Rutland
[not found] ` <20131015111145.GE19196-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Mark Rutland @ 2013-10-15 11:11 UTC (permalink / raw)
To: Heiko Stübner
Cc: grant.likely@linaro.org, devicetree@vger.kernel.org,
Linus Walleij, linux-arm-kernel@lists.infradead.org
Hi Heiko,
On Tue, Oct 15, 2013 at 11:47:50AM +0100, Heiko Stübner wrote:
> The basic of functions already provide a of_device_is_compatible to check
> if a device's compatible property contains a specific one. But sometimes
> it's also necessary to check if the device is compatible to one out of a
> list of compatible devices.
>
> Therefore add of_device_is_any_of that reuses the compatible check of
> of_device_is_compatible but checks against a list of compatible strings
> without the locking overhead of calling of_device_is_compatible multiple
> times.
I don't think we need this -- we already have of_match_node, and you can
use it to achieve the same result.
Thanks,
Mark.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
> drivers/of/base.c | 21 +++++++++++++++++++++
> include/linux/of.h | 2 ++
> 2 files changed, 23 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 865d3f6..589f43e 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -366,6 +366,27 @@ int of_device_is_compatible(const struct device_node *device,
> EXPORT_SYMBOL(of_device_is_compatible);
>
> /**
> + * Checks if any of the given "compat" strings matches one of the strings
> + * in the device's "compatible" property.
> + */
> +int of_device_is_any_of(const struct device_node *device,
> + const char * const *compat, int num) {
> + unsigned long flags;
> + int res = 0, i;
> +
> + raw_spin_lock_irqsave(&devtree_lock, flags);
> + for (i = 0; i < num; i++) {
> + if (__of_device_is_compatible(device, compat[i])) {
> + res = 1;
> + break;
> + }
> + }
> + raw_spin_unlock_irqrestore(&devtree_lock, flags);
> + return res;
> +}
> +EXPORT_SYMBOL(of_device_is_any_of);
> +
> +/**
> * of_machine_is_compatible - Test root of device tree for a given compatible value
> * @compat: compatible string to look for in root node's compatible property.
> *
> diff --git a/include/linux/of.h b/include/linux/of.h
> index f95aee3..5bf7c9a 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -262,6 +262,8 @@ extern int of_property_count_strings(struct device_node *np,
> const char *propname);
> extern int of_device_is_compatible(const struct device_node *device,
> const char *);
> +extern int of_device_is_any_of(const struct device_node *device,
> + const char * const *compat, int num);
> extern int of_device_is_available(const struct device_node *device);
> extern const void *of_get_property(const struct device_node *node,
> const char *name,
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/6] of: add function to check against a list of compatible strings
[not found] ` <20131015111145.GE19196-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
@ 2013-10-15 12:44 ` Heiko Stübner
0 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2013-10-15 12:44 UTC (permalink / raw)
To: Mark Rutland
Cc: Linus Walleij,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, Rob Herring,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Am Dienstag, 15. Oktober 2013, 13:11:46 schrieb Mark Rutland:
> Hi Heiko,
>
> On Tue, Oct 15, 2013 at 11:47:50AM +0100, Heiko Stübner wrote:
> > The basic of functions already provide a of_device_is_compatible to check
> > if a device's compatible property contains a specific one. But sometimes
> > it's also necessary to check if the device is compatible to one out of a
> > list of compatible devices.
> >
> > Therefore add of_device_is_any_of that reuses the compatible check of
> > of_device_is_compatible but checks against a list of compatible strings
> > without the locking overhead of calling of_device_is_compatible multiple
> > times.
>
> I don't think we need this -- we already have of_match_node, and you can
> use it to achieve the same result.
You are right of course, of_match_node does exactly what needed.
Thanks
Heiko
> > Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> > ---
> >
> > drivers/of/base.c | 21 +++++++++++++++++++++
> > include/linux/of.h | 2 ++
> > 2 files changed, 23 insertions(+)
> >
> > diff --git a/drivers/of/base.c b/drivers/of/base.c
> > index 865d3f6..589f43e 100644
> > --- a/drivers/of/base.c
> > +++ b/drivers/of/base.c
> > @@ -366,6 +366,27 @@ int of_device_is_compatible(const struct device_node
> > *device,
> >
> > EXPORT_SYMBOL(of_device_is_compatible);
> >
> > /**
> >
> > + * Checks if any of the given "compat" strings matches one of the
> > strings + * in the device's "compatible" property.
> > + */
> > +int of_device_is_any_of(const struct device_node *device,
> > + const char * const *compat, int num) {
> > + unsigned long flags;
> > + int res = 0, i;
> > +
> > + raw_spin_lock_irqsave(&devtree_lock, flags);
> > + for (i = 0; i < num; i++) {
> > + if (__of_device_is_compatible(device, compat[i])) {
> > + res = 1;
> > + break;
> > + }
> > + }
> > + raw_spin_unlock_irqrestore(&devtree_lock, flags);
> > + return res;
> > +}
> > +EXPORT_SYMBOL(of_device_is_any_of);
> > +
> > +/**
> >
> > * of_machine_is_compatible - Test root of device tree for a given
> > compatible value * @compat: compatible string to look for in root
> > node's compatible property. *
> >
> > diff --git a/include/linux/of.h b/include/linux/of.h
> > index f95aee3..5bf7c9a 100644
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > @@ -262,6 +262,8 @@ extern int of_property_count_strings(struct
> > device_node *np,
> >
> > const char *propname);
> >
> > extern int of_device_is_compatible(const struct device_node *device,
> >
> > const char *);
> >
> > +extern int of_device_is_any_of(const struct device_node *device,
> > + const char * const *compat, int num);
> >
> > extern int of_device_is_available(const struct device_node *device);
> > extern const void *of_get_property(const struct device_node *node,
> >
> > const char *name,
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-10-15 12:44 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 10:46 [PATCH 0/6] pinctrl: rockchip: add rk3188 support Heiko Stübner
[not found] ` <201310151246.49402.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-10-15 10:47 ` [PATCH 1/6] pinctrl: rockchip: separate different sub-types more Heiko Stübner
2013-10-15 10:47 ` [PATCH 2/6] of: add function to check against a list of compatible strings Heiko Stübner
2013-10-15 11:11 ` Mark Rutland
[not found] ` <20131015111145.GE19196-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-10-15 12:44 ` Heiko Stübner
2013-10-15 10:48 ` [PATCH 3/6] pinctrl: rockchip: add support for multiple bank types Heiko Stübner
2013-10-15 10:48 ` [PATCH 4/6] pinctrl: rockchip: remove redundant check Heiko Stübner
2013-10-15 10:49 ` [PATCH 5/6] pinctrl: rockchip: add rk3188 specifics Heiko Stübner
2013-10-15 10:49 ` [PATCH 6/6] pinctrl: rockchip: emulate both edge triggered interrupts Heiko Stübner
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).