Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc: sunxi: sram: register regmap as syscon

If the system controller had a ethernet controller glue layer control
register, a limited access regmap would be registered and tied to the
system controller struct device for the ethernet driver to use.

Until now, for the ethernet driver to acquire this regmap, it had to
do a of_parse_phandle() + find device + dev_get_regmap() sequence.
Since the syscon framework allows a provider to register a custom
regmap for its device node, and the ethernet driver already uses
syscon for one platform, this provides a much more easier way to
pass the regmap.

Use of_syscon_register_regmap() to register our regmap with the
syscon framework so that consumers can retrieve it that way.

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://patch.msgid.link/20250908181059.1785605-5-wens@kernel.org
Signed-off-by: Chen-Yu Tsai <wens@csie.org>

+6
+6
drivers/soc/sunxi/sunxi_sram.c
··· 12 12 13 13 #include <linux/debugfs.h> 14 14 #include <linux/io.h> 15 + #include <linux/mfd/syscon.h> 15 16 #include <linux/module.h> 16 17 #include <linux/of.h> 17 18 #include <linux/of_address.h> ··· 368 367 const struct sunxi_sramc_variant *variant; 369 368 struct device *dev = &pdev->dev; 370 369 struct regmap *regmap; 370 + int ret; 371 371 372 372 sram_dev = &pdev->dev; 373 373 ··· 386 384 regmap = devm_regmap_init_mmio(dev, base, &sunxi_sram_regmap_config); 387 385 if (IS_ERR(regmap)) 388 386 return PTR_ERR(regmap); 387 + 388 + ret = of_syscon_register_regmap(dev->of_node, regmap); 389 + if (ret) 390 + return ret; 389 391 } 390 392 391 393 of_platform_populate(dev->of_node, NULL, NULL, dev);