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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'renesas-drivers-for-v6.18-tag1' of https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel into soc/drivers

Renesas driver updates for v6.18

- Add syscon/regmap support to the RZ System Controller driver.

* tag 'renesas-drivers-for-v6.18-tag1' of https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel:
soc: renesas: rz-sysc: Add syscon/regmap support

Link: https://lore.kernel.org/r/cover.1756468046.git.geert+renesas@glider.be
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+35 -1
+1
drivers/soc/renesas/Kconfig
··· 449 449 450 450 config SYSC_RZ 451 451 bool "System controller for RZ SoCs" if COMPILE_TEST 452 + select MFD_SYSCON 452 453 453 454 config SYSC_R9A08G045 454 455 bool "Renesas System controller support for R9A08G045 (RZ/G3S)" if COMPILE_TEST
+1
drivers/soc/renesas/r9a08g045-sysc.c
··· 20 20 21 21 const struct rz_sysc_init_data rzg3s_sysc_init_data __initconst = { 22 22 .soc_id_init_data = &rzg3s_sysc_soc_id_init_data, 23 + .max_register = 0xe20, 23 24 };
+1
drivers/soc/renesas/r9a09g047-sys.c
··· 64 64 65 65 const struct rz_sysc_init_data rzg3e_sys_init_data = { 66 66 .soc_id_init_data = &rzg3e_sys_soc_id_init_data, 67 + .max_register = 0x170c, 67 68 };
+1
drivers/soc/renesas/r9a09g057-sys.c
··· 64 64 65 65 const struct rz_sysc_init_data rzv2h_sys_init_data = { 66 66 .soc_id_init_data = &rzv2h_sys_soc_id_init_data, 67 + .max_register = 0x170c, 67 68 };
+29 -1
drivers/soc/renesas/rz-sysc.c
··· 5 5 * Copyright (C) 2024 Renesas Electronics Corp. 6 6 */ 7 7 8 + #include <linux/cleanup.h> 8 9 #include <linux/io.h> 10 + #include <linux/mfd/syscon.h> 9 11 #include <linux/of.h> 10 12 #include <linux/platform_device.h> 13 + #include <linux/regmap.h> 14 + #include <linux/slab.h> 11 15 #include <linux/sys_soc.h> 12 16 13 17 #include "rz-sysc.h" ··· 104 100 105 101 static int rz_sysc_probe(struct platform_device *pdev) 106 102 { 103 + const struct rz_sysc_init_data *data; 107 104 const struct of_device_id *match; 108 105 struct device *dev = &pdev->dev; 106 + struct regmap *regmap; 109 107 struct rz_sysc *sysc; 108 + int ret; 109 + 110 + struct regmap_config *regmap_cfg __free(kfree) = kzalloc(sizeof(*regmap_cfg), GFP_KERNEL); 111 + if (!regmap_cfg) 112 + return -ENOMEM; 110 113 111 114 match = of_match_node(rz_sysc_match, dev->of_node); 112 115 if (!match) 113 116 return -ENODEV; 117 + 118 + data = match->data; 114 119 115 120 sysc = devm_kzalloc(dev, sizeof(*sysc), GFP_KERNEL); 116 121 if (!sysc) ··· 130 117 return PTR_ERR(sysc->base); 131 118 132 119 sysc->dev = dev; 133 - return rz_sysc_soc_init(sysc, match); 120 + ret = rz_sysc_soc_init(sysc, match); 121 + if (ret) 122 + return ret; 123 + 124 + regmap_cfg->name = "rz_sysc_regs"; 125 + regmap_cfg->reg_bits = 32; 126 + regmap_cfg->reg_stride = 4; 127 + regmap_cfg->val_bits = 32; 128 + regmap_cfg->fast_io = true; 129 + regmap_cfg->max_register = data->max_register; 130 + 131 + regmap = devm_regmap_init_mmio(dev, sysc->base, regmap_cfg); 132 + if (IS_ERR(regmap)) 133 + return PTR_ERR(regmap); 134 + 135 + return of_syscon_register_regmap(dev->of_node, regmap); 134 136 } 135 137 136 138 static struct platform_driver rz_sysc_driver = {
+2
drivers/soc/renesas/rz-sysc.h
··· 34 34 /** 35 35 * struct rz_sysc_init_data - RZ SYSC initialization data 36 36 * @soc_id_init_data: RZ SYSC SoC ID initialization data 37 + * @max_register: Maximum SYSC register offset to be used by the regmap config 37 38 */ 38 39 struct rz_sysc_init_data { 39 40 const struct rz_sysc_soc_id_init_data *soc_id_init_data; 41 + u32 max_register; 40 42 }; 41 43 42 44 extern const struct rz_sysc_init_data rzg3e_sys_init_data;