Skip to contentSkip to conversation

clk: versaclock: regmap modernisations

PATCH Applied Mark Brown 2 participants 9 messages Sep 29, 2023 – Oct 10, 2023

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

cover clk: versaclock: regmap modernisations

The maple tree register cache is a more modern replacement for the rbtree cache which uses a more modern data structure and makes decisions likely to be better for more current hardware, update the versaclock drivers to use it.

While looking at updating the cache types I noticed a minor optimisation opportunity with a redundant _is_writeable() operation in versaclock3 so I updated that too.

---
Mark Brown (4):
clk: versaclock3: Remove redundant _is_writeable()
clk: versaclock3: Convert to use maple tree register cache
clk: versaclock5: Convert to use maple tree register cache
clk: versaclock7: Convert to use maple tree register cache

 drivers/clk/clk-versaclock3.c | 8 +-------
 drivers/clk/clk-versaclock5.c | 2 +-
 drivers/clk/clk-versaclock7.c | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)

---
base-commit: 6465e260f48790807eef06b583b38ca9789b6072
change-id: 20230929-clk-maple-versaclk-129fa4fb712f

Best regards,

Signature · 1 line
Mark Brown <[email protected]>
author
#1 lore raw

PATCH 1/4 clk: versaclock3: Remove redundant _is_writeable()

The versaclock3 driver provides an _is_writeable() function which returns true for all registers. This is the default assumption for regmaps so we can remove the function for a very minor improvement in performance and code size.

---
 drivers/clk/clk-versaclock3.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/clk/clk-versaclock3.c +0 -6
index 7ab2447bd203..a5ab48ff242c 100644
@@ -586,17 +586,11 @@ static const struct clk_ops vc3_clk_mux_ops = {
 	.get_parent = vc3_clk_mux_get_parent,
 };
 
-static bool vc3_regmap_is_writeable(struct device *dev, unsigned int reg)
-{
-	return true;
-}
-
 static const struct regmap_config vc3_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 	.cache_type = REGCACHE_RBTREE,
 	.max_register = 0x24,
-	.writeable_reg = vc3_regmap_is_writeable,
 };
 
 static struct vc3_hw_data clk_div[5];
Signature · 1 line
2.39.2
maintainer Applied
#2 lore raw

Re: [PATCH 1/4] clk: versaclock3: Remove redundant _is_writeable()

Quoting Mark Brown (2023-09-29 07:26:05)

Quoted 7 lines

The versaclock3 driver provides an _is_writeable() function which returns true for all registers. This is the default assumption for regmaps so we can remove the function for a very minor improvement in performance and code size.

---

Applied to clk-next

author
#3 lore raw

PATCH 2/4 clk: versaclock3: Convert to use maple tree register cache

In reply to Mark Brown

The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.

---
 drivers/clk/clk-versaclock3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-versaclock3.c +1 -1
index a5ab48ff242c..b4a89c083c11 100644
@@ -589,7 +589,7 @@ static const struct clk_ops vc3_clk_mux_ops = {
 static const struct regmap_config vc3_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
-	.cache_type = REGCACHE_RBTREE,
+	.cache_type = REGCACHE_MAPLE,
 	.max_register = 0x24,
 };
 
Signature · 1 line
2.39.2
maintainer Applied
#4 lore raw

Re: [PATCH 2/4] clk: versaclock3: Convert to use maple tree register cache

Quoting Mark Brown (2023-09-29 07:26:06)

Quoted 6 lines

The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.

---

Applied to clk-next

author
#5 lore raw

PATCH 3/4 clk: versaclock5: Convert to use maple tree register cache

In reply to Mark Brown

The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.

---
 drivers/clk/clk-versaclock5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-versaclock5.c +1 -1
index 17cbb30d20ad..6d31cd54d7cf 100644
@@ -217,7 +217,7 @@ static bool vc5_regmap_is_writeable(struct device *dev, unsigned int reg)
 static const struct regmap_config vc5_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
-	.cache_type = REGCACHE_RBTREE,
+	.cache_type = REGCACHE_MAPLE,
 	.max_register = 0x76,
 	.writeable_reg = vc5_regmap_is_writeable,
 };
Signature · 1 line
2.39.2
maintainer Applied
#6 lore raw

Re: [PATCH 3/4] clk: versaclock5: Convert to use maple tree register cache

Quoting Mark Brown (2023-09-29 07:26:07)

Quoted 6 lines

The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.

---

Applied to clk-next

author
#7 lore raw

PATCH 4/4 clk: versaclock7: Convert to use maple tree register cache

In reply to Mark Brown

The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.

---
 drivers/clk/clk-versaclock7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-versaclock7.c +1 -1
index 9ab35c1af0ff..f323263e32c3 100644
@@ -1275,7 +1275,7 @@ static const struct regmap_config vc7_regmap_config = {
 	.ranges = vc7_range_cfg,
 	.num_ranges = ARRAY_SIZE(vc7_range_cfg),
 	.volatile_reg = vc7_volatile_reg,
-	.cache_type = REGCACHE_RBTREE,
+	.cache_type = REGCACHE_MAPLE,
 	.can_multi_write = true,
 	.reg_format_endian = REGMAP_ENDIAN_LITTLE,
 	.val_format_endian = REGMAP_ENDIAN_LITTLE,
Signature · 1 line
2.39.2
maintainer Applied
#8 lore raw

Re: [PATCH 4/4] clk: versaclock7: Convert to use maple tree register cache

Quoting Mark Brown (2023-09-29 07:26:08)

Quoted 6 lines

The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache.

---

Applied to clk-next