From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH 05/05] sh: pfc: Unlock register support
Date: Tue, 13 Dec 2011 16:01:14 +0000 [thread overview]
Message-ID: <20111213160114.4021.61545.sendpatchset@w520> (raw)
From: Magnus Damm <damm@opensource.se>
Add PFC support for a 32-bit unlock register. Needed to
drive the r8a7779 PFC that comes with a funky PMMR register.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
drivers/sh/pfc.c | 22 ++++++++++------------
include/linux/sh_pfc.h | 2 ++
2 files changed, 12 insertions(+), 12 deletions(-)
--- 0017/drivers/sh/pfc.c
+++ work/drivers/sh/pfc.c 2011-12-13 11:39:55.000000000 +0900
@@ -210,7 +210,7 @@ static void write_config_reg(struct pinm
unsigned long field, unsigned long value)
{
void __iomem *mapped_reg;
- unsigned long mask, pos;
+ unsigned long mask, pos, data;
config_reg_helper(gpioc, crp, field, &mapped_reg, &mask, &pos);
@@ -221,17 +221,15 @@ static void write_config_reg(struct pinm
mask = ~(mask << pos);
value = value << pos;
- switch (crp->reg_width) {
- case 8:
- iowrite8((ioread8(mapped_reg) & mask) | value, mapped_reg);
- break;
- case 16:
- iowrite16((ioread16(mapped_reg) & mask) | value, mapped_reg);
- break;
- case 32:
- iowrite32((ioread32(mapped_reg) & mask) | value, mapped_reg);
- break;
- }
+ data = gpio_read_raw_reg(mapped_reg, crp->reg_width);
+ data &= mask;
+ data |= value;
+
+ if (gpioc->unlock_reg)
+ gpio_write_raw_reg(pfc_phys_to_virt(gpioc, gpioc->unlock_reg),
+ 32, ~data);
+
+ gpio_write_raw_reg(mapped_reg, crp->reg_width, data);
}
static int setup_data_reg(struct pinmux_info *gpioc, unsigned gpio)
--- 0017/include/linux/sh_pfc.h
+++ work/include/linux/sh_pfc.h 2011-12-13 11:35:55.000000000 +0900
@@ -116,6 +116,8 @@ struct pinmux_info {
unsigned int num_resources;
struct pfc_window *window;
+ unsigned long unlock_reg;
+
struct gpio_chip chip;
};
reply other threads:[~2011-12-13 16:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20111213160114.4021.61545.sendpatchset@w520 \
--to=magnus.damm@gmail.com \
--cc=linux-sh@vger.kernel.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).