[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331757790-10583-2-git-send-email-marc@cpdesign.com.au>
Date: Thu, 15 Mar 2012 07:43:05 +1100
From: Marc Reilly <marc@...esign.com.au>
To: sameo@...ux.intel.com
Cc: linux-arm-kernel@...ts.infradead.org,
spi-devel-general@...ts.sourceforge.net, linux-i2c@...r.kernel.org,
u.kleine-koenig@...gutronix.de, oskar@...ra.com,
linux-kernel@...r.kernel.org, broonie@...nsource.wolfsonmicro.com,
Marc Reilly <marc@...esign.com.au>
Subject: [PATCH v3 1/6] regmap: add support for 7_25 format
This adds support for devices with 7 address bits and 25 data bits.
The initial intended user for this are the mc13xxx mfds in spi mode.
(The 25th data bit is actually a dummy bit)
Signed-off-by: Marc Reilly <marc@...esign.com.au>
---
drivers/base/regmap/regmap.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index be10a4f..62ef0df 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -100,6 +100,14 @@ static void regmap_format_10_14_write(struct regmap *map,
out[0] = reg >> 2;
}
+static void regmap_format_7_25_write(struct regmap *map,
+ unsigned int reg, unsigned int val)
+{
+ __be32 *out = map->work_buf;
+
+ *out = (reg << 25) | val;
+}
+
static void regmap_format_8(void *buf, unsigned int val)
{
u8 *b = buf;
@@ -193,6 +201,9 @@ struct regmap *regmap_init(struct device *dev,
case 9:
map->format.format_write = regmap_format_7_9_write;
break;
+ case 25:
+ map->format.format_write = regmap_format_7_25_write;
+ break;
default:
goto err_map;
}
--
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists