linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben.hutchings@codethink.co.uk>
To: Ian Molton <ian@mnementh.co.uk>, linux-mmc@vger.kernel.org
Cc: linux-sh@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@lists.codethink.co.uk,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	Simon Horman <horms@verge.net.au>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Subject: [PATCH v2 2/6] pinctrl: sh-pfc: Add set_mux operation to struct sh_pfc_function
Date: Wed, 10 Jun 2015 00:23:20 +0100	[thread overview]
Message-ID: <1433892200.12074.51.camel@codethink.co.uk> (raw)
In-Reply-To: <1433892104.12074.49.camel@codethink.co.uk>

In some cases a change of function requires changes in more than just
the GPSR/IPSR registers.  In particular, changing the SDHI between 3.3V
and 1.8V signalling also requires modifying IOCTRL6.

Add this optional operation so that such special cases can be handled
in each SoC's code.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/pinctrl/sh-pfc/pinctrl.c |  4 ++++
 drivers/pinctrl/sh-pfc/sh_pfc.h  | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index 072e7c62cab7..068b1cdeddde 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -317,6 +317,7 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
 {
 	struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
 	struct sh_pfc *pfc = pmx->pfc;
+	const struct sh_pfc_function *func = &pfc->info->functions[selector];
 	const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
 	unsigned long flags;
 	unsigned int i;
@@ -340,6 +341,9 @@ static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
 			break;
 	}
 
+	if (func->set_mux)
+		func->set_mux(pfc, func, grp);
+
 done:
 	spin_unlock_irqrestore(&pfc->lock, flags);
 	return ret;
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index c7508d5f6886..0ce4f5c7add8 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -28,6 +28,8 @@ enum {
 #define SH_PFC_PIN_CFG_PULL_DOWN	(1 << 3)
 #define SH_PFC_PIN_CFG_NO_GPIO		(1 << 31)
 
+struct sh_pfc;
+
 struct sh_pfc_pin {
 	u16 pin;
 	u16 enum_id;
@@ -50,17 +52,23 @@ struct sh_pfc_pin_group {
 	unsigned int nr_pins;
 };
 
-#define SH_PFC_FUNCTION(n)				\
+#define SH_PFC_FUNCTION_SPECIAL(n, set_mux_fn)		\
 	{						\
 		.name = #n,				\
 		.groups = n##_groups,			\
 		.nr_groups = ARRAY_SIZE(n##_groups),	\
+		.set_mux = (set_mux_fn),		\
 	}
 
+#define SH_PFC_FUNCTION(n) SH_PFC_FUNCTION_SPECIAL(n, NULL)
+
 struct sh_pfc_function {
 	const char *name;
 	const char * const *groups;
 	unsigned int nr_groups;
+	void (*set_mux)(struct sh_pfc *pfc,
+			const struct sh_pfc_function *func,
+			const struct sh_pfc_pin_group *grp);
 };
 
 struct pinmux_func {
-- 
2.1.4





  parent reply	other threads:[~2015-06-09 23:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 23:21 [PATCH v2 0/6] UHS-I support for sh_mobile_sdhi Ben Hutchings
2015-06-09 23:22 ` [PATCH v2 1/6] mmc: tmio: Add UHS-I mode support Ben Hutchings
2015-06-09 23:23 ` Ben Hutchings [this message]
2015-06-09 23:23 ` [PATCH v2 3/6] pinctrl: sh-pfc: r8a7790: Add separate functions for SDHI 1.8V operation Ben Hutchings
2015-06-12  7:18   ` Laurent Pinchart
2015-06-12 13:23     ` Ben Hutchings
2015-06-12 19:07       ` Laurent Pinchart
2015-06-15  0:40         ` Ben Hutchings
2015-06-15  2:02           ` Laurent Pinchart
2015-06-30  6:05             ` Linus Walleij
2015-06-30  8:30               ` Laurent Pinchart
2015-06-09 23:23 ` [PATCH v2 4/6] mmc: sh_mobile_sdhi: Add UHS-I mode support Ben Hutchings
2015-06-09 23:24 ` [PATCH v2 5/6] ARM: shmobile: lager: Set clock rates for SDHI Ben Hutchings
2015-06-11  1:20   ` Kuninori Morimoto
2015-06-11  1:47     ` Ben Hutchings
2015-06-09 23:24 ` [PATCH v2 6/6] ARM: shmobile: lager: Enable UHS-I SDR-50 Ben Hutchings
2015-06-10  9:16 ` [PATCH v2 0/6] UHS-I support for sh_mobile_sdhi Ulf Hansson
2015-06-10 23:57   ` Ben Hutchings
2015-06-11  2:49     ` Simon Horman
2015-06-11 15:02       ` Ben Hutchings
2015-06-14  7:36         ` Geert Uytterhoeven
2015-06-15  0:30           ` Ben Hutchings
2015-06-15  0:30           ` Ben Hutchings

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=1433892200.12074.51.camel@codethink.co.uk \
    --to=ben.hutchings@codethink.co.uk \
    --cc=horms@verge.net.au \
    --cc=ian@mnementh.co.uk \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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).