lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 28 Nov 2012 14:52:57 +0530
From:	Mukund Navada <navada@...com>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:	<linux-kernel@...r.kernel.org>, Mukund Navada <navada@...com>
Subject: [PATCH 1/1] regmap: Add support for continously numbered pages across regmap range

  Page number in some devices increases across regmap ranges since the
selector register to choose the page remains the same. So in order to
write correct page number, the start_page_num is stored in
regmap_range_cfg.

Signed-off-by: Mukund Navada <navada@...com>
---
 drivers/base/regmap/internal.h |    2 ++
 drivers/base/regmap/regmap.c   |    2 ++
 include/linux/regmap.h         |    5 +++++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index 288e135..fd31f5d 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -134,6 +134,8 @@ struct regmap_range_node {
 
 	unsigned int window_start;
 	unsigned int window_len;
+
+	unsigned int start_page_num;
 };
 
 #ifdef CONFIG_DEBUG_FS
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 42d5cb0..39e37a4 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -645,6 +645,7 @@ struct regmap *regmap_init(struct device *dev,
 		new->selector_shift = range_cfg->selector_shift;
 		new->window_start = range_cfg->window_start;
 		new->window_len = range_cfg->window_len;
+		new->start_page_num = range_cfg->start_page_num;
 
 		if (_regmap_range_add(map, new) == false) {
 			dev_err(map->dev, "Failed to add range %d\n", i);
@@ -833,6 +834,7 @@ static int _regmap_select_page(struct regmap *map, unsigned int *reg,
 
 	win_offset = (*reg - range->range_min) % range->window_len;
 	win_page = (*reg - range->range_min) / range->window_len;
+	win_page += range->start_page_num;
 
 	if (val_num > 1) {
 		/* Bulk write shouldn't cross range boundary */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index b7e95bf..96f029e 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -217,6 +217,8 @@ struct regmap_config {
  *
  * @window_start: Address of first (lowest) register in data window.
  * @window_len: Number of registers in data window.
+ *
+ * @start_page_num: Start page number for the range
  */
 struct regmap_range_cfg {
 	const char *name;
@@ -233,6 +235,9 @@ struct regmap_range_cfg {
 	/* Data window (per each page) */
 	unsigned int window_start;
 	unsigned int window_len;
+
+	/* Starting page number when it increases across range */
+	unsigned int start_page_num;
 };
 
 typedef int (*regmap_hw_write)(void *context, const void *data,
-- 
1.7.1

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ