linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/6] pinctrl: single: Prepare for supporting SoC specific features
Date: Wed, 02 Oct 2013 22:42:18 -0700	[thread overview]
Message-ID: <20131003054218.8941.19273.stgit@localhost> (raw)
In-Reply-To: <20131003054104.8941.88857.stgit@localhost>

Let's replace is_pinconf with flags and add struct pcs_soc_data
so we can support SoC specific features like pin wake-up events.

Done in collaboration with Roger Quadros <rogerq@ti.com>.

Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Prakash Manjunathappa <prakash.pm@ti.com>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/pinctrl/pinctrl-single.c |   38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index a82ace4..f88d3d1 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -150,19 +150,27 @@ struct pcs_name {
 };
 
 /**
+ * struct pcs_soc_data - SoC specific settings
+ * @flags:	initial SoC specific PCS_FEAT_xxx values
+ */
+struct pcs_soc_data {
+	unsigned flags;
+};
+
+/**
  * struct pcs_device - pinctrl device instance
  * @res:	resources
  * @base:	virtual address of the controller
  * @size:	size of the ioremapped area
  * @dev:	device entry
  * @pctl:	pin controller device
+ * @flags:	mask of PCS_FEAT_xxx values
  * @mutex:	mutex protecting the lists
  * @width:	bits per mux register
  * @fmask:	function register mask
  * @fshift:	function register shift
  * @foff:	value to turn mux off
  * @fmax:	max number of functions in fmask
- * @is_pinconf:	whether supports pinconf
  * @bits_per_pin:number of bits per pin
  * @names:	array of register names for pins
  * @pins:	physical pins on the SoC
@@ -183,6 +191,8 @@ struct pcs_device {
 	unsigned size;
 	struct device *dev;
 	struct pinctrl_dev *pctl;
+	unsigned flags;
+#define PCS_FEAT_PINCONF	(1 << 0)
 	struct mutex mutex;
 	unsigned width;
 	unsigned fmask;
@@ -190,7 +200,6 @@ struct pcs_device {
 	unsigned foff;
 	unsigned fmax;
 	bool bits_per_mux;
-	bool is_pinconf;
 	unsigned bits_per_pin;
 	struct pcs_name *names;
 	struct pcs_data pins;
@@ -206,6 +215,8 @@ struct pcs_device {
 	void (*write)(unsigned val, void __iomem *reg);
 };
 
+#define PCS_HAS_PINCONF		(pcs->flags & PCS_FEAT_PINCONF)
+
 static int pcs_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin,
 			   unsigned long *config);
 static int pcs_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
@@ -1060,7 +1071,7 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np,
 	};
 
 	/* If pinconf isn't supported, don't parse properties in below. */
-	if (!pcs->is_pinconf)
+	if (!PCS_HAS_PINCONF)
 		return 0;
 
 	/* cacluate how much properties are supported in current node */
@@ -1184,7 +1195,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
 	(*map)->data.mux.group = np->name;
 	(*map)->data.mux.function = np->name;
 
-	if (pcs->is_pinconf) {
+	if (PCS_HAS_PINCONF) {
 		res = pcs_parse_pinconf(pcs, np, function, map);
 		if (res)
 			goto free_pingroups;
@@ -1305,7 +1316,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
 	(*map)->data.mux.group = np->name;
 	(*map)->data.mux.function = np->name;
 
-	if (pcs->is_pinconf) {
+	if (PCS_HAS_PINCONF) {
 		dev_err(pcs->dev, "pinconf not supported\n");
 		goto free_pingroups;
 	}
@@ -1525,6 +1536,7 @@ static int pcs_probe(struct platform_device *pdev)
 	const struct of_device_id *match;
 	struct resource *res;
 	struct pcs_device *pcs;
+	const struct pcs_soc_data *soc;
 	int ret;
 
 	match = of_match_device(pcs_of_match, &pdev->dev);
@@ -1541,7 +1553,8 @@ static int pcs_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&pcs->pingroups);
 	INIT_LIST_HEAD(&pcs->functions);
 	INIT_LIST_HEAD(&pcs->gpiofuncs);
-	pcs->is_pinconf = match->data;
+	soc = match->data;
+	pcs->flags = soc->flags;
 
 	PCS_GET_PROP_U32("pinctrl-single,register-width", &pcs->width,
 			 "register width not specified\n");
@@ -1610,7 +1623,7 @@ static int pcs_probe(struct platform_device *pdev)
 	pcs->desc.name = DRIVER_NAME;
 	pcs->desc.pctlops = &pcs_pinctrl_ops;
 	pcs->desc.pmxops = &pcs_pinmux_ops;
-	if (pcs->is_pinconf)
+	if (PCS_HAS_PINCONF)
 		pcs->desc.confops = &pcs_pinconf_ops;
 	pcs->desc.owner = THIS_MODULE;
 
@@ -1652,9 +1665,16 @@ static int pcs_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct pcs_soc_data pinctrl_single = {
+};
+
+static const struct pcs_soc_data pinconf_single = {
+	.flags = PCS_FEAT_PINCONF,
+};
+
 static struct of_device_id pcs_of_match[] = {
-	{ .compatible = "pinctrl-single", .data = (void *)false },
-	{ .compatible = "pinconf-single", .data = (void *)true },
+	{ .compatible = "pinctrl-single", .data = &pinctrl_single },
+	{ .compatible = "pinconf-single", .data = &pinconf_single },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, pcs_of_match);

  parent reply	other threads:[~2013-10-03  5:42 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03  5:42 [PATCH 0/6] add support for omap wake-up interrupts via pinctrl-single, take2 Tony Lindgren
2013-10-03  5:42 ` [PATCH 1/6] ARM: dts: Fix pinctrl mask for omap3 Tony Lindgren
2013-10-03  5:42 ` [PATCH 2/6] ARM: OMAP2+: Add support for auxdata Tony Lindgren
2013-10-03  5:42 ` Tony Lindgren [this message]
2013-10-07 17:35   ` [PATCH 3/6] pinctrl: single: Prepare for supporting SoC specific features Tony Lindgren
2013-10-08 11:55     ` Linus Walleij
2013-10-08 16:21       ` Tony Lindgren
2013-10-09  5:03       ` Haojian Zhuang
2013-10-09 13:43     ` Linus Walleij
2013-10-09 15:10       ` Tony Lindgren
2013-10-10 15:35         ` Linus Walleij
2013-10-10 22:41           ` Tony Lindgren
2013-10-03  5:42 ` [PATCH 4/6] pinctrl: single: Add support for wake-up interrupts Tony Lindgren
2013-10-03 17:50   ` Tony Lindgren
2013-10-08 12:10   ` Linus Walleij
2013-10-08 16:05     ` Tony Lindgren
2013-10-10 13:24   ` Roger Quadros
2013-10-10 14:04     ` Linus Walleij
2013-10-10 14:35       ` Roger Quadros
2013-10-10 15:32         ` Linus Walleij
2013-10-10 16:15           ` Tony Lindgren
2013-10-10 16:00     ` Tony Lindgren
2013-10-10 16:11       ` Linus Walleij
2013-10-10 16:20         ` Tony Lindgren
2013-10-11  8:00           ` Linus Walleij
2013-10-11  8:56             ` Roger Quadros
2013-10-11 10:32               ` Linus Walleij
2013-10-11 15:43                 ` Tony Lindgren
2013-10-11 15:56                   ` Linus Walleij
2013-10-11 16:01                     ` Tony Lindgren
2013-10-18  7:40                       ` Balaji T K
2013-10-18 15:35                         ` Tony Lindgren
2013-10-18 15:59                           ` Balaji T K
2013-10-18 16:06                             ` Tony Lindgren
2013-10-11 15:36               ` Tony Lindgren
2013-10-11 15:43                 ` Balaji T K
2013-10-11 15:48                   ` Tony Lindgren
2013-10-10 16:23       ` Tony Lindgren
2013-10-11  8:45         ` Roger Quadros
2013-10-11  8:49       ` Roger Quadros
2013-10-11 13:59         ` Roger Quadros
2013-10-11 15:18           ` Tony Lindgren
2013-10-03  5:42 ` [PATCH 5/6] pinctrl: single: Add support for auxdata Tony Lindgren
2013-10-03  5:42 ` [PATCH 6/6] ARM: OMAP: Move DT wake-up event handling over to use pinctrl-single-omap Tony Lindgren
2013-10-10 21:47 ` [PATCH 0/6] add support for omap wake-up interrupts via pinctrl-single, take2 Kevin Hilman
2013-10-10 22:47   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131003054218.8941.19273.stgit@localhost \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).