SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH RFC] sh: pfc: Add ability to use separate read & write GPIO data regs
@ 2013-02-08 15:02 Phil Edworthy
  2013-02-11 15:23 ` Paul Mundt
  2013-02-13 12:21 ` phil.edworthy
  0 siblings, 2 replies; 3+ messages in thread
From: Phil Edworthy @ 2013-02-08 15:02 UTC (permalink / raw)
  To: linux-sh

On several devices, there are separate registers for data input
and data output.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
 drivers/sh/pfc/core.c  |    5 +++--
 include/linux/sh_pfc.h |    8 +++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/sh/pfc/core.c b/drivers/sh/pfc/core.c
index 6816937..173126e 100644
--- a/drivers/sh/pfc/core.c
+++ b/drivers/sh/pfc/core.c
@@ -163,14 +163,14 @@ void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
 
 	pr_debug("write_bit addr = %lx, value = %d, pos = %ld, "
 		 "r_width = %ld\n",
-		 dr->reg, !!value, pos, dr->reg_width);
+		 dr->wreg, !!value, pos, dr->reg_width);
 
 	if (value)
 		set_bit(pos, &dr->reg_shadow);
 	else
 		clear_bit(pos, &dr->reg_shadow);
 
-	gpio_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow);
+	gpio_write_raw_reg(dr->mapped_wreg, dr->reg_width, dr->reg_shadow);
 }
 EXPORT_SYMBOL_GPL(sh_pfc_write_bit);
 
@@ -256,6 +256,7 @@ static int setup_data_reg(struct sh_pfc *pfc, unsigned gpio)
 			break;
 
 		data_reg->mapped_reg = pfc_phys_to_virt(pfc, data_reg->reg);
+		data_reg->mapped_wreg = pfc_phys_to_virt(pfc, data_reg->wreg);
 
 		for (n = 0; n < data_reg->reg_width; n++) {
 			if (data_reg->enum_ids[n] = gpiop->enum_id) {
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
index c19a092..bbf955b 100644
--- a/include/linux/sh_pfc.h
+++ b/include/linux/sh_pfc.h
@@ -68,10 +68,16 @@ struct pinmux_data_reg {
 	unsigned long reg, reg_width, reg_shadow;
 	pinmux_enum_t *enum_ids;
 	void __iomem *mapped_reg;
+	unsigned long wreg;	/* separate write reg */
+	void __iomem *mapped_wreg;
 };
 
 #define PINMUX_DATA_REG(name, r, r_width) \
-	.reg = r, .reg_width = r_width,	\
+	.reg = r, .wreg = r, .reg_width = r_width,	\
+	.enum_ids = (pinmux_enum_t [r_width]) \
+
+#define PINMUX_DATA_REG2(name, r, r2, r_width) \
+	.reg = r, .wreg = r2, .reg_width = r_width,	\
 	.enum_ids = (pinmux_enum_t [r_width]) \
 
 struct pinmux_irq {
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-13 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-08 15:02 [PATCH RFC] sh: pfc: Add ability to use separate read & write GPIO data regs Phil Edworthy
2013-02-11 15:23 ` Paul Mundt
2013-02-13 12:21 ` phil.edworthy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox