Skip to contentSkip to conversation

arm64: add Synaptics SL2610 SoCs and RDK boards

PATCH New Jisheng Zhang 2 participants 25 messages Dec 4

Subsystems (8)
lore
Share & tools
lore

Jisheng Zhang

author maintainer
#0 lore raw

v4 cover arm64: add Synaptics SL2610 SoCs and RDK boards

Add initial support for the Synaptics SL261X SoCs and corresponding RDK boards.

The SL261X SoCs include five pin-to-pin compatible SoCs: SL2611, SL2613, SL2615, SL2617, and SL2619.

Only reset, pinctrl, clk/pll, uart, gpio, i2c, spi, i3c are included in this series. The support for Ethernet, USB, SDHCI, CAN, DMAC, XSPI will be submitted after this series is merged.

Since this series may be split once got acks from maintainers. So a consolidated MAINTAINERS update will follow once the subsystem series have merged, avoiding overlapping changes to the Synaptics entry.

Another note: the reset driver use "ENOTSUPP" instead of "EOPNOTSUPP" to keep unified style with reset core driver.

Hi Linus Walleij, Conor,

I didn't split the series in this version, because the same syscon node exports reset, pinctl and clk, so I want to collect some acks before split.

And query one question: the reset IDs, clk IDs header files are needed by both pinctrl/reset drivers and soc dtsi/dts, so I'm not sure how to split the series, any suggestion is appreciated.

since v3:
- use MODULE_LICENSE("GPL")
- drop "depend on MFD_SL2610_SYSCON" from RESET_SL2610
- drop "depend on MFD_SL2610_SYSCON" from SL2610_CLK too
- send out again. I dunno what happened why only 10 patches are out

since v2:
- fix a typo in "GPIO54" offset, 0x887c instead of 0x87c
- adopt Philipp suggestions into reset-sl2610.c
- put sl2610-syscon.c into mfd/ instead of soc/synapitcs/
- dt coding style fixes
- Drop bootargs
- Split the binding file
- move i2c timing properties to board dts

since v1:
- rebase on latest rcN
- drop some patches which have been merged
- let the "gbl" node export pinctrl/reset/clk devices with MFD_CELL_NAME()
- use <linux/platform_device.h> instead of <linux/mod_devicetable.h>
- adopt some coding suggestions from Uwe
- Use 0 and 1 to select normal and strong pull-up on 10-bit pads
- collect Acked-by tag

Jisheng Zhang (13):
arm64: kconfig: let ARCH_BERLIN cover Synaptics arm64 SoCs
pinctrl: berlin: use u16 instead of u8 for the offset
pinctrl: berlin: enable module build support
pinctrl: berlin: add optional pinconf support
dt-bindings: soc: synaptics: add SL2610 system controllers
mfd: synaptics: add SL2610 system controller support
reset: add Synaptics SL2610 reset controller support
pinctrl: berlin: add Synaptics SL2610 pin controller support
clk: berlin: add Synaptics clock controller helpers
clk: berlin: add Synaptics SL2610 clocks and PLLs
dt-bindings: arm: berlin: add Synaptics SL2610 SoCs and RDK boards
arm64: dts: synaptics: add SL2610 family SoCs
arm64: dts: synaptics: add SL2610 family RDK boards

 .../bindings/arm/marvell,berlin.yaml          |  20 +
 .../synaptics/syna,sl2610-avio-syscon.yaml    |  44 +
 .../soc/synaptics/syna,sl2610-cpu-syscon.yaml |  58 ++
 .../soc/synaptics/syna,sl2610-mcu-syscon.yaml |  97 +++
 .../soc/synaptics/syna,sl2610-soc-syscon.yaml | 104 +++
 arch/arm64/Kconfig.platforms                  |   4 +-
 arch/arm64/boot/dts/synaptics/Makefile        |   5 +
 arch/arm64/boot/dts/synaptics/sl2611-rdk.dts  |  16 +
 arch/arm64/boot/dts/synaptics/sl2611.dtsi     | 466 +++++++++++
 arch/arm64/boot/dts/synaptics/sl2613-rdk.dts  |  16 +
 arch/arm64/boot/dts/synaptics/sl2613.dtsi     |  12 +
 arch/arm64/boot/dts/synaptics/sl2615-rdk.dts  |  16 +
 arch/arm64/boot/dts/synaptics/sl2615.dtsi     |  46 ++
 arch/arm64/boot/dts/synaptics/sl2617-rdk.dts  |  16 +
 arch/arm64/boot/dts/synaptics/sl2617.dtsi     |  46 ++
 arch/arm64/boot/dts/synaptics/sl2619-rdk.dts  |  16 +
 arch/arm64/boot/dts/synaptics/sl2619.dtsi     |  44 +
 .../boot/dts/synaptics/sl261x-rdk-common.dtsi | 150 ++++
 drivers/clk/Kconfig                           |   1 +
 drivers/clk/berlin/Kconfig                    |  33 +
 drivers/clk/berlin/Makefile                   |   4 +
 drivers/clk/berlin/clk-sl2610.c               | 360 +++++++++
 drivers/clk/berlin/sl-clk.c                   | 279 +++++++
 drivers/clk/berlin/sl-clk.h                   |  31 +
 drivers/clk/berlin/sl-sysmgr-clk.c            | 241 ++++++
 drivers/clk/berlin/sl-sysmgr-clk.h            |  44 +
 drivers/clk/berlin/sl2610-pll.c               | 145 ++++
 drivers/clk/berlin/sl2610-pll.h               |  14 +
 drivers/mfd/Kconfig                           |  16 +
 drivers/mfd/Makefile                          |   1 +
 drivers/mfd/sl2610-syscon.c                   |  84 ++
 drivers/pinctrl/berlin/Kconfig                |  16 +
 drivers/pinctrl/berlin/Makefile               |   1 +
 drivers/pinctrl/berlin/berlin.c               | 255 +++++-
 drivers/pinctrl/berlin/berlin.h               |  17 +-
 drivers/pinctrl/berlin/pinctrl-sl2610.c       | 759 ++++++++++++++++++
 drivers/reset/Kconfig                         |  12 +
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-sl2610.c                  | 224 ++++++
 include/dt-bindings/clock/syna,sl2610.h       | 131 +++
 include/dt-bindings/reset/syna,sl2610-reset.h |  80 ++
 41 files changed, 3905 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-avio-syscon.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-cpu-syscon.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-soc-syscon.yaml
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2611-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2611.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2613-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2613.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2615-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2615.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2617-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2617.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2619-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2619.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi
 create mode 100644 drivers/clk/berlin/Kconfig
 create mode 100644 drivers/clk/berlin/clk-sl2610.c
 create mode 100644 drivers/clk/berlin/sl-clk.c
 create mode 100644 drivers/clk/berlin/sl-clk.h
 create mode 100644 drivers/clk/berlin/sl-sysmgr-clk.c
 create mode 100644 drivers/clk/berlin/sl-sysmgr-clk.h
 create mode 100644 drivers/clk/berlin/sl2610-pll.c
 create mode 100644 drivers/clk/berlin/sl2610-pll.h
 create mode 100644 drivers/mfd/sl2610-syscon.c
 create mode 100644 drivers/pinctrl/berlin/pinctrl-sl2610.c
 create mode 100644 drivers/reset/reset-sl2610.c
 create mode 100644 include/dt-bindings/clock/syna,sl2610.h
 create mode 100644 include/dt-bindings/reset/syna,sl2610-reset.h
Signature · 1 line
2.55.0
author maintainer
#1 lore raw

PATCH v4 1/13 arm64: kconfig: let ARCH_BERLIN cover Synaptics arm64 SoCs

Extend ARCH_BERLIN to cover Synaptics arm64 SoCs.

---
 arch/arm64/Kconfig.platforms | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/Kconfig.platforms +2 -2
index 49dcd7be82ce..b830161fe68b 100644
@@ -108,13 +108,13 @@ config ARCH_BRCMSTB
 endif
 
 config ARCH_BERLIN
-	bool "Marvell Berlin SoC Family"
+	bool "Synaptics/Marvell Berlin SoC Family"
 	select DW_APB_ICTL
 	select DW_APB_TIMER_OF
 	select GPIOLIB
 	select PINCTRL
 	help
-	  This enables support for Marvell Berlin SoC Family
+	  This enables support for Synaptics SoCs or Marvell Berlin SoC Family
 
 config ARCH_BITMAIN
 	bool "Bitmain SoC Platforms"
Signature · 1 line
2.55.0
author maintainer
#2 lore raw

PATCH v4 2/13 pinctrl: berlin: use u16 instead of u8 for the offset

In reply to Jisheng Zhang

The u8 may not be enough for newer Synaptics SoCs.

---
 drivers/pinctrl/berlin/berlin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/berlin/berlin.h +1 -1
index 231aab61d415..7e7096842eda 100644
@@ -17,7 +17,7 @@ struct berlin_desc_function {
 
 struct berlin_desc_group {
 	const char			*name;
-	u8				offset;
+	u16				offset;
 	u8				bit_width;
 	u8				lsb;
 	struct berlin_desc_function	*functions;
Signature · 1 line
2.55.0
author maintainer
#3 lore raw

PATCH v4 3/13 pinctrl: berlin: enable module build support

In reply to Jisheng Zhang

For Android GKI + vendor_dlkm deployments, where vendor-specific drivers must be kept separate from the GKI vmlinux and loaded as modules from the vendor partition, we need to enable module build support for berlin pinctrl drivers.

To acchive this goal:

1.Use devm_* APIs to alloc memory, so that we don't need to care free when unloading.

2.Export two symbols which will be used by SoC pinctrl drivers.

3.Add MODULE_LICENSE and MODULE_DESCRIPTION

---
 drivers/pinctrl/berlin/berlin.c | 27 ++++++++++++++-------------
 drivers/pinctrl/berlin/berlin.h | 15 +++++++++++++++
 2 files changed, 29 insertions(+), 13 deletions(-)
drivers/pinctrl/berlin/berlin.c +14 -13
index 8a612ce2d1d3..9337de1973af 100644
@@ -215,7 +215,8 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
 	}
 
 	/* we will reallocate later */
-	pctrl->functions = kzalloc_objs(*pctrl->functions, max_functions);
+	pctrl->functions = devm_kcalloc(&pdev->dev, max_functions,
+					sizeof(*pctrl->functions), GFP_KERNEL);
 	if (!pctrl->functions)
 		return -ENOMEM;
 
@@ -230,13 +231,11 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
 		}
 	}
 
-	new_functions = krealloc(pctrl->functions,
-				    pctrl->nfunctions * sizeof(*pctrl->functions),
-				    GFP_KERNEL);
-	if (!new_functions) {
-		kfree(pctrl->functions);
+	new_functions = devm_krealloc(&pdev->dev, pctrl->functions,
+				      pctrl->nfunctions * sizeof(*pctrl->functions),
+				      GFP_KERNEL);
+	if (!new_functions)
 		return -ENOMEM;
-	}
 
 	pctrl->functions = new_functions;
 	/* map functions to theirs groups */
@@ -257,20 +256,17 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
 				function++;
 			}
 
-			if (!found) {
-				kfree(pctrl->functions);
+			if (!found)
 				return -EINVAL;
-			}
 
 			if (!function->groups) {
 				function->groups =
 					devm_kzalloc_objs(&pdev->dev,
 							  *function->groups,
 							  function->ngroups);
-				if (!function->groups) {
-					kfree(pctrl->functions);
+
+				if (!function->groups)
 					return -ENOMEM;
-				}
 			}
 
 			groups = (const char **)function->groups;
@@ -326,6 +322,7 @@ int berlin_pinctrl_probe_regmap(struct platform_device *pdev,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(berlin_pinctrl_probe_regmap);
 
 int berlin_pinctrl_probe(struct platform_device *pdev,
 			 const struct berlin_pinctrl_desc *desc)
@@ -340,3 +337,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev,
 
 	return berlin_pinctrl_probe_regmap(pdev, desc, regmap);
 }
+EXPORT_SYMBOL_GPL(berlin_pinctrl_probe);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("pinctrl library for Synaptics SoCs");
drivers/pinctrl/berlin/berlin.h +15 -0
index 7e7096842eda..8ff70d682593 100644
@@ -20,6 +20,8 @@ struct berlin_desc_group {
 	u16				offset;
 	u8				bit_width;
 	u8				lsb;
+	u16				conf_offset;
+	u8				conf_bits;
 	struct berlin_desc_function	*functions;
 };
 
@@ -28,6 +30,19 @@ struct berlin_pinctrl_desc {
 	unsigned			ngroups;
 };
 
+#define BERLIN_PINCTRLCONF_GROUP(_name, _offset, _width, _lsb,		\
+		_conf_offset, _conf_bits, ...)				\
+	{								\
+		.name = _name,						\
+		.offset = _offset,					\
+		.bit_width = _width,					\
+		.lsb = _lsb,						\
+		.conf_offset = _conf_offset,				\
+		.conf_bits = _conf_bits,				\
+		.functions = (struct berlin_desc_function[]){		\
+			__VA_ARGS__, { } },				\
+	}
+
 #define BERLIN_PINCTRL_GROUP(_name, _offset, _width, _lsb, ...)		\
 	{								\
 		.name = _name,						\
Signature · 1 line
2.55.0
#4 lore raw

Re: [PATCH v4 03/13] pinctrl: berlin: enable module build support

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] pinctrl: berlin: PINCTRL_BERLIN remains bool and built via obj-y - [Low] pinctrl: berlin…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] pinctrl: berlin: PINCTRL_BERLIN remains bool and built via obj-y
- [Low] pinctrl: berlin: unrelated pinconf changes mixed into module build commit
- [Low] pinctrl: berlin: pinctrl patches not split out as requested by maintainer
--

commit 3e5d5d3d1e00faf42d4508d236eb2eb377780414
Author: Jisheng Zhang <[email protected]>

pinctrl: berlin: enable module build support

This commit converts berlin_pinctrl_build_state() allocations to devm_* helpers, exports berlin_pinctrl_probe() and berlin_pinctrl_probe_regmap(), and adds module metadata to drivers/pinctrl/berlin/berlin.c.

Quoted 4 lines
drivers/pinctrl/berlin/berlin.c +0 -0
index 8a612ce2d1d36..9337de1973af9 100644

[ ... ]

drivers/pinctrl/berlin/berlin.c int berlin_pinctrl_probe_regmap(struct platform_device *pdev, · line 325

Quoted 5 lines
drivers/pinctrl/berlin/berlin.c +1 -0
@@ -326,6 +322,7 @@ int berlin_pinctrl_probe_regmap(struct platform_device *pdev,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(berlin_pinctrl_probe_regmap);

[Severity: Low]
As reported by Linus Walleij on v2 [1], should the pinctrl patches be split out and sent separately for the pinctrl tree?

The core Berlin pinctrl patches have no build-time dependencies on the rest of the series, and commit "pinctrl: berlin: add Synaptics SL2610 pin controller support" only references MFD_SL2610_SYSCON in Kconfig.

drivers/pinctrl/berlin/berlin.c int berlin_pinctrl_probe(struct platform_device *pdev, · line 343

Quoted 10 lines
drivers/pinctrl/berlin/berlin.c +4 -0
 int berlin_pinctrl_probe(struct platform_device *pdev,
 			 const struct berlin_pinctrl_desc *desc)
@@ -340,3 +337,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev,
 
 	return berlin_pinctrl_probe_regmap(pdev, desc, regmap);
 }
+EXPORT_SYMBOL_GPL(berlin_pinctrl_probe);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("pinctrl library for Synaptics SoCs");

[Severity: Medium]
Can berlin.c actually be built as a loadable module with these changes?

PINCTRL_BERLIN in drivers/pinctrl/berlin/Kconfig is still bool, so selecting it from a modular SoC driver such as PINCTRL_SL2610 forces berlin.o into vmlinux instead of building berlin.ko.

In addition, drivers/pinctrl/berlin/Makefile still uses obj-y += berlin.o instead of obj-$(CONFIG_PINCTRL_BERLIN) += berlin.o. When PINCTRL_BERLIN is tristate, drivers/pinctrl/Makefile descends via obj-m and drops obj-y, so berlin.ko is never built and modular SoC drivers fail to link.

Quoted 23 lines
drivers/pinctrl/berlin/berlin.h +8 -0
index 7e7096842eda0..8ff70d682593a 100644
@@ -20,6 +20,8 @@ struct berlin_desc_group {
 	u16				offset;
 	u8				bit_width;
 	u8				lsb;
+	u16				conf_offset;
+	u8				conf_bits;
 	struct berlin_desc_function	*functions;
 };
 
@@ -28,6 +30,19 @@ struct berlin_pinctrl_desc {
 	unsigned			ngroups;
 };
 
+#define BERLIN_PINCTRLCONF_GROUP(_name, _offset, _width, _lsb,		\
+		_conf_offset, _conf_bits, ...)				\
+	{								\
+		.name = _name,						\
+		.offset = _offset,					\
+		.bit_width = _width,					\

drivers/pinctrl/berlin/berlin.h struct berlin_pinctrl_desc { · line 48

Quoted 10 lines
drivers/pinctrl/berlin/berlin.h +7 -0
+		.lsb = _lsb,						\
+		.conf_offset = _conf_offset,				\
+		.conf_bits = _conf_bits,				\
+		.functions = (struct berlin_desc_function[]){		\
+			__VA_ARGS__, { } },				\
+	}
+
 #define BERLIN_PINCTRL_GROUP(_name, _offset, _width, _lsb, ...)		\
 	{								\
 		.name = _name,						\

[Severity: Low]
Do these pinconf additions belong in commit "pinctrl: berlin: add optional pinconf support" instead? conf_offset, conf_bits, and BERLIN_PINCTRLCONF_GROUP are unrelated to module build support and are not mentioned in the commit message.

[1] https://lore.kernel.org/r/CAD++jL=TE0pF60vR-Y==z2LDfs4n2rvfZ5FMOuEoFsD2PwMXhw@mail.gmail.com

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
author maintainer
#5 lore raw

PATCH v4 4/13 pinctrl: berlin: add optional pinconf support

In reply to Jisheng Zhang

Add pin configuration support for newer Synaptics SoCs.

---
 drivers/pinctrl/berlin/Kconfig  |   1 +
 drivers/pinctrl/berlin/berlin.c | 228 +++++++++++++++++++++++++++++++-
 2 files changed, 225 insertions(+), 4 deletions(-)
drivers/pinctrl/berlin/Kconfig +1 -0
index 9b1644d1d4ea..abb1c912b9ba 100644
@@ -3,6 +3,7 @@ if (ARCH_BERLIN || COMPILE_TEST)
 
 config PINCTRL_BERLIN
 	bool
+	select GENERIC_PINCONF
 	select PINMUX
 	select REGMAP_MMIO
 
drivers/pinctrl/berlin/berlin.c +224 -4

285 lines not on this page · raw message

Signature · 1 line
2.55.0
#6 lore raw

Re: [PATCH v4 04/13] pinctrl: berlin: add optional pinconf support

Thank you for your contribution! Sashiko AI review found 6 potential issues to consider: - [Medium] pinctrl: berlin: wrong errno -EOPNOTSUPP in berlin_pinconf_group_get() - [Medium] pinctrl: berlin…

Thank you for your contribution! Sashiko AI review found 6 potential issues to consider:
- [Medium] pinctrl: berlin: wrong errno -EOPNOTSUPP in berlin_pinconf_group_get()
- [Medium] pinctrl: berlin: map memory leak on error in berlin_pinctrl_dt_node_to_map()
- [Medium] pinctrl: berlin: raw DS register values used for PIN_CONFIG_DRIVE_STRENGTH
- [Low] pinctrl: berlin: map over-allocation in berlin_pinctrl_dt_node_to_map()
- [Low] pinctrl: berlin: berlin_pinctrl_dt_node_to_map() duplicates core helper
- [Low] pinctrl: berlin: berlin_pinconf_group_get() ignores PINCFG_SPU_10BIT
--

commit feaf1efaaaf2673c7dd44e0c2079579524261efa
Author: Jisheng Zhang <[email protected]>

pinctrl: berlin: add optional pinconf support

This commit adds optional generic pinconf support to the Berlin pinctrl driver, extending DT node-to-map parsing and adding group get/set callbacks for 8-bit and 10-bit pad configuration registers.

Quoted 4 lines
drivers/pinctrl/berlin/berlin.c +0 -0
index 9337de1973af9..82215c36b856a 100644

[ ... ]

Quoted 5 lines
drivers/pinctrl/berlin/berlin.c +1 -0
@@ -75,11 +95,19 @@ static int berlin_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrl_dev,
 		return -EINVAL;
 	}
 
+	ret = pinconf_generic_parse_dt_config(node, pctrl_dev, &configs,

drivers/pinctrl/berlin/berlin.c static int berlin_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrl_dev, · line 107

Quoted 10 lines
drivers/pinctrl/berlin/berlin.c +8 -1
+					      &num_configs);
+	if (ret < 0) {
+		dev_err(pctrl->dev, "%s: could not parse node property\n",
+			node->name);
+		return ret;
+	}
+
 	ret = pinctrl_utils_reserve_map(pctrl_dev, map, &reserved_maps,
-					num_maps, ngroups);
+					num_maps, ngroups * (num_configs + 1));

[Severity: Low]
Does this over-allocate the pinctrl_map array when a node has more than one pinconf property?

pinctrl_utils_add_map_configs() stores all num_configs items in a single struct pinctrl_map entry per group, so each group needs at most two slots (ngroups * (num_configs ? 2 : 1)). Because dt_remember_or_free_map() keeps the allocated array without shrinking it, the excess slots remain allocated for the lifetime of the mapping.

[ ... ]

Quoted 13 lines
drivers/pinctrl/berlin/berlin.c +8 -1
@@ -88,11 +116,22 @@ static int berlin_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrl_dev,
 						function_name);
 		if (ret) {
 			dev_err(pctrl->dev, "can't add map: %d\n", ret);
-			return ret;
+			goto exit;
+		}
+
+		if (num_configs) {
+			ret = pinctrl_utils_add_map_configs(pctrl_dev, map,
+					&reserved_maps, num_maps, group_name,
+					configs, num_configs,
+					PIN_MAP_TYPE_CONFIGS_GROUP);

drivers/pinctrl/berlin/berlin.c static int berlin_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrl_dev, · line 135

Quoted 10 lines
drivers/pinctrl/berlin/berlin.c +5 -1
+			if (ret < 0)
+				goto exit;
 		}
 	}
 
-	return 0;
+exit:
+	kfree(configs);
+	return ret;
 }

[Severity: Medium]
Does the error path leak *map and any previously duplicated per-group configs?

If pinctrl_utils_add_map_configs() fails with -ENOMEM in kmemdup_array() (or pinctrl_utils_add_map_mux() fails), jumping to exit frees only the temporary configs buffer. dt_to_map_one_config() does not call dt_free_map() when dt_node_to_map() returns a negative error, so pinctrl_utils_free_map() is needed on the error path.

drivers/pinctrl/berlin/berlin.c static int berlin_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrl_dev, · line 137

Quoted 1 line
drivers/pinctrl/berlin/berlin.c +0 -0
 static const struct pinctrl_ops berlin_pinctrl_ops = {

[Severity: Low]
Now that PINCTRL_BERLIN selects GENERIC_PINCONF, can berlin_pinctrl_ops.dt_node_to_map use pinconf_generic_dt_node_to_map_group() directly instead of maintaining berlin_pinctrl_dt_node_to_map()?

The core helper already handles group-based mux and generic pinconf mapping with exact map reservation and pinctrl_utils_free_map() cleanup on failure.

[ ... ]

Quoted 7 lines
drivers/pinctrl/berlin/berlin.c +3 -0
@@ -177,6 +216,186 @@ static const struct pinmux_ops berlin_pinmux_ops = {
 	.set_mux		= &berlin_pinmux_set,
 };
 
+static int berlin_pinconf_group_get(struct pinctrl_dev *pctrl_dev,
+				    unsigned int group, unsigned long *configs)
+{

drivers/pinctrl/berlin/berlin.c static const struct pinmux_ops berlin_pinmux_ops = { · line 231

Quoted 10 lines
drivers/pinctrl/berlin/berlin.c +10 -0
+	enum pin_config_param param = pinconf_to_config_param(*configs);
+	struct berlin_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrl_dev);
+	const struct berlin_desc_group *group_desc = pctrl->desc->groups + group;
+	bool enabled;
+	u32 val;
+	int ret;
+	u8 conf_bits = group_desc->conf_bits;
+
+	if (!conf_bits)
+		return -EOPNOTSUPP;

[Severity: Medium]
Should berlin_pinconf_group_get() and berlin_pinconf_group_set() return -ENOTSUPP instead of -EOPNOTSUPP here and in their default branches?

struct pinconf_ops requires -ENOTSUPP for unsupported configurations, and pinconf_generic_dump_one() only treats -EINVAL and -ENOTSUPP as legal errors. Because berlin_confops is registered unconditionally with is_generic = true, reading debugfs pinconf-groups prints "ERROR READING CONFIG SETTING" for unsupported parameters and for every group on older Berlin/AS370 SoCs where conf_bits is 0.

[ ... ]

Quoted 12 lines
drivers/pinctrl/berlin/berlin.c +12 -0
+	case PIN_CONFIG_BIAS_DISABLE:
+		if (conf_bits == 10)
+			enabled = !(val & PINCFG_PE_10BIT);
+		else
+			enabled = !(val & (PINCFG_PD_8BIT | PINCFG_PU_8BIT));
+		val = 0;
+		break;
+	case PIN_CONFIG_BIAS_PULL_DOWN:
+		if (conf_bits == 10)
+			enabled = (val & (PINCFG_PE_10BIT | PINCFG_PS_10BIT)) == PINCFG_PE_10BIT;
+		else
+			enabled = val & PINCFG_PD_8BIT;

drivers/pinctrl/berlin/berlin.c static const struct pinmux_ops berlin_pinmux_ops = { · line 259

Quoted 10 lines
drivers/pinctrl/berlin/berlin.c +10 -0
+		val = enabled ? 1 : 0;
+		break;
+	case PIN_CONFIG_BIAS_PULL_UP:
+		if (conf_bits == 10)
+			enabled = (val & (PINCFG_PE_10BIT | PINCFG_PS_10BIT)) ==
+				  (PINCFG_PE_10BIT | PINCFG_PS_10BIT);
+		else
+			enabled = val & PINCFG_PU_8BIT;
+		val = enabled ? 1 : 0;
+		break;

[Severity: Low]
Should these 10-bit bias cases also check PINCFG_SPU_10BIT?

berlin_pinconf_group_set() includes and clears PINCFG_SPU_10BIT alongside PINCFG_PE_10BIT and PINCFG_PS_10BIT on bias writes, but berlin_pinconf_group_get() ignores it. If reset defaults or firmware leave PINCFG_SPU_10BIT set before a kernel write, reading pinconf-groups can misreport the pad as bias-disabled or pull-down instead of pull-up.

drivers/pinctrl/berlin/berlin.c static const struct pinmux_ops berlin_pinmux_ops = { · line 266

Quoted 7 lines
drivers/pinctrl/berlin/berlin.c +7 -0
+	case PIN_CONFIG_DRIVE_STRENGTH:
+		enabled = true;
+		if (conf_bits == 10)
+			val = FIELD_GET(PINCFG_DS_10BIT, val);
+		else
+			val = FIELD_GET(PINCFG_DS_8BIT, val);
+		break;

[Severity: Medium]
Does PIN_CONFIG_DRIVE_STRENGTH need conversion between milliamps and the raw 3-bit/4-bit DS register field in berlin_pinconf_group_get() and berlin_pinconf_group_set()?

Both PIN_CONFIG_DRIVE_STRENGTH and pincfg-node.yaml define drive-strength in mA, and pinconf_generic_dump_one() prints the returned value with an mA unit. Passing the raw selector through directly reports values like 0 mA in debugfs, rejects valid mA values above 15 (or 7 for 8-bit pads) with -EINVAL, and risks locking raw register selectors into the SL2610 DT ABI.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
author maintainer
#7 lore raw

PATCH v4 5/13 dt-bindings: soc: synaptics: add SL2610 system controllers

In reply to Jisheng Zhang

Describe the SoC, MCU, AVIO and CPU system control blocks, including their clock inputs, clock and reset providers, and pin configuration subnodes. The clock and reset providers share each register block node.

Add the clock and reset identifiers used by consumers of these blocks.

---
 .../synaptics/syna,sl2610-avio-syscon.yaml    |  44 ++++++
 .../soc/synaptics/syna,sl2610-cpu-syscon.yaml |  58 ++++++++
 .../soc/synaptics/syna,sl2610-mcu-syscon.yaml |  97 +++++++++++++
 .../soc/synaptics/syna,sl2610-soc-syscon.yaml | 104 ++++++++++++++
 include/dt-bindings/clock/syna,sl2610.h       | 131 ++++++++++++++++++
 include/dt-bindings/reset/syna,sl2610-reset.h |  80 +++++++++++
 6 files changed, 514 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-avio-syscon.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-cpu-syscon.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-soc-syscon.yaml
 create mode 100644 include/dt-bindings/clock/syna,sl2610.h
 create mode 100644 include/dt-bindings/reset/syna,sl2610-reset.h
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-avio-syscon.yaml new file +44 -0
new file mode 100644
index 000000000000..92e64f53524c
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/synaptics/syna,sl2610-avio-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synaptics SL2610 AVIO audio PLL controller
+
+maintainers:
+  - Jisheng Zhang <[email protected]>
+
+description: |
+  The SL2610 AVIO system control block contains the audio PLLs. The
+  external reference clock supplies the PLL input. This binding does not
+  expose clock specifiers for this block.
+
+properties:
+  compatible:
+    items:
+      - const: syna,sl2610-avio-syscon
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+    description: External reference clock input.
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    syscon@f7490000 {
+        compatible = "syna,sl2610-avio-syscon", "syscon";
+        reg = <0xf7490000 0x4000>;
+        clocks = <&osc>;
+    };
+...
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-cpu-syscon.yaml new file +58 -0

58 lines not on this page · raw message

Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml new file +97 -0

97 lines not on this page · raw message

Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-soc-syscon.yaml new file +104 -0

104 lines not on this page · raw message

include/dt-bindings/clock/syna,sl2610.h new file +131 -0

131 lines not on this page · raw message

include/dt-bindings/reset/syna,sl2610-reset.h new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.55.0
#8 lore raw

Re: [PATCH v4 05/13] dt-bindings: soc: synaptics: add SL2610 system controllers

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [Medium] dt-bindings: soc: synaptics: omit #clock-cells in syna,sl2610-avio-syscon - [Medium] dt-bindings…

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider:
- [Medium] dt-bindings: soc: synaptics: omit #clock-cells in syna,sl2610-avio-syscon
- [Medium] dt-bindings: soc: synaptics: overly permissive pinconf subnode schemas
- [Medium] dt-bindings: synaptics: redefine bias-pull-up/down Ohm arg as 0/1 toggle
- [Low] dt-bindings: clock: sl2610: driver-internal MAX count macros in ABI header
- [Low] dt-bindings: soc: synaptics: place CPU and AVIO clock bindings under clock/
--

commit ee4f371b16e854cca706c6c17171162fafc77e8d
Author: Jisheng Zhang <[email protected]>

dt-bindings: soc: synaptics: add SL2610 system controllers

This commit adds Device Tree binding schemas for the Synaptics SL2610 AVIO, CPU, MCU, and SoC system control blocks, along with their clock and reset ID headers.

Quoted 6 lines
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-avio-syscon.yaml new file +0 -0
new file mode 100644
index 0000000000000..92e64f53524cc
@@ -0,0 +1,44 @@

[ ... ]

Quoted 4 lines
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-avio-syscon.yaml new file +4 -0
+description: |
+  The SL2610 AVIO system control block contains the audio PLLs. The
+  external reference clock supplies the PLL input. This binding does not
+  expose clock specifiers for this block.

[ ... ]

Quoted 1 line

+additionalProperties: false

[Severity: Medium]
Should this binding expose #clock-cells for the audio PLL outputs?

This block takes an external reference clock and provides audio PLLs, yet #clock-cells is omitted and forbidden by additionalProperties: false. Without it, DT consumers cannot reference the PLLs via clocks phandles, which forces hardcoded clock names and creates DT ABI churn later.

Quoted 6 lines
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-cpu-syscon.yaml new file +0 -0
new file mode 100644
index 0000000000000..25af41f158e0e
@@ -0,0 +1,58 @@

[ ... ]

Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-cpu-syscon.yaml line 7

Quoted 4 lines

+$id: http://devicetree.org/schemas/soc/synaptics/syna,sl2610-cpu-syscon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-cpu-syscon.yaml new file +2 -0
+
+title: Synaptics SL2610 CPU clock controller

[Severity: Low]
As reported by Krzysztof Kozlowski on v2 [1], should syna,sl2610-cpu-syscon.yaml and syna,sl2610-avio-syscon.yaml be placed under Documentation/devicetree/bindings/clock/ instead of bindings/soc/?

Unlike the multi-function SoC and MCU syscon bindings, both schemas describe dedicated clock/PLL controllers. Moving them to bindings/clock/ (or documenting any non-clock syscon roles in their titles and descriptions) avoids path and $id churn later.

Quoted 6 lines
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml new file +0 -0
new file mode 100644
index 0000000000000..9902908a57988
@@ -0,0 +1,97 @@

[ ... ]

Quoted 18 lines
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml new file +18 -0
+patternProperties:
+  '-(pmux|pins)$':
+    type: object
+    description: Pin group mux and electrical configuration.
+    allOf:
+      - $ref: /schemas/pinctrl/pinmux-node.yaml#
+      - $ref: /schemas/pinctrl/pincfg-node.yaml#
+    properties:
+      groups:
+        $ref: /schemas/types.yaml#/definitions/string-array
+      function:
+        $ref: /schemas/types.yaml#/definitions/string
+      bias-pull-up:
+        description: |
+          Enable the default pull-up with a boolean or 1, or disable it with 0.
+          Pull resistance is not selectable.
+        oneOf:
+          - type: boolean

Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml line 68

Quoted 10 lines
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml new file +10 -0
+          - $ref: /schemas/types.yaml#/definitions/uint32
+            enum: [0, 1]
+      bias-pull-down:
+        description: |
+          Enable the default pull-down with a boolean or 1, or disable it with 0.
+          Pull resistance is not selectable.
+        oneOf:
+          - type: boolean
+          - $ref: /schemas/types.yaml#/definitions/uint32
+            enum: [0, 1]

[Severity: Medium]
Should bias-pull-up and bias-pull-down be restricted to type: boolean here and in syna,sl2610-soc-syscon.yaml (including dropping bias-pull-up = <1> from its example)?

In pincfg-node.yaml, the optional uint32 argument specifies pull resistance in Ohms on hardware that supports selectable resistance, while disabling bias uses bias-disable.

Both pincfg-node.yaml and parse_fw_cfg() also treat all bias properties as mutually exclusive regardless of value, so redefining 0/1 as a toggle conflicts with generic DT semantics and fails if combined with another bias property.

Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml line 72

Quoted 4 lines
Documentation/devicetree/bindings/soc/synaptics/syna,sl2610-mcu-syscon.yaml new file +4 -0
+    required:
+      - groups
+      - function
+    unevaluatedProperties: false

[Severity: Medium]
Can this pin configuration subnode (and the identical one in syna,sl2610-soc-syscon.yaml) list only the supported properties with
additionalProperties: false instead of unevaluatedProperties: false?

Using unevaluatedProperties: false against pinmux-node.yaml and pincfg-node.yaml lets dtbs_check silently accept unsupported properties that berlin_pinconf_group_set() rejects with -EOPNOTSUPP, while leaving supported pad properties like drive-strength and slew-rate unconstrained.

Also, groups and function redundantly restate $ref types already inherited from pinmux-node.yaml.

[ ... ]

Quoted 6 lines
include/dt-bindings/clock/syna,sl2610.h new file +0 -0
new file mode 100644
index 0000000000000..c563a2b5ed064
@@ -0,0 +1,131 @@

[ ... ]

include/dt-bindings/clock/syna,sl2610.h line 84

Quoted 8 lines
include/dt-bindings/clock/syna,sl2610.h new file +8 -0
+#define CLK_APBDMA		62
+#define SL2610_CLK_MAX		63
+
+/* cpuss */
+#define CLK_CPU0		0
+#define CLK_CPU1		1
+#define CLK_DSU			2
+#define SL2610_CPU_CLK_MAX	3

[Severity: Low]
Should SL2610_CLK_MAX and SL2610_CPU_CLK_MAX be dropped from this DT binding header and kept internal to the clock driver?

Neither macro is a hardware clock specifier ID, and exposing driver array sizes in the binding header means adding any clock ID later breaks the stable DT ABI.

[1] https://lore.kernel.org/r/20261123-bold-neat-albatross-e92a2b@quoll

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
author maintainer
#9 lore raw

PATCH v4 6/13 mfd: synaptics: add SL2610 system controller support

In reply to Jisheng Zhang

Create the clock, reset and pin controller platform devices implemented by each SL2610 system control block. Select the appropriate MFD cells from per-block compatible data while keeping register access available through the shared syscon.

---
 drivers/mfd/Kconfig         | 16 +++++++
 drivers/mfd/Makefile        |  1 +
 drivers/mfd/sl2610-syscon.c | 84 +++++++++++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+)
 create mode 100644 drivers/mfd/sl2610-syscon.c
drivers/mfd/Kconfig +16 -0
index 87ed55c155f0..687012727bb5 100644
@@ -1656,6 +1656,22 @@ config MFD_SUN6I_PRCM
 	  in the A31, A23, and A33 SoCs. Other Allwinner SoCs contain similar
 	  hardware, but they do not use this driver.
 
+config MFD_SL2610_SYSCON
+	tristate "Synaptics SL2610 system controller"
+	depends on ARCH_BERLIN || COMPILE_TEST
+	depends on OF && HAS_IOMEM
+	select MFD_CORE
+	select MFD_SYSCON
+	help
+	  Support the global and control register blocks on Synaptics SL2610
+	  SoCs. This creates devices for the clock, reset and pin controllers
+	  provided by each register block.
+
+	  Say Y here to enable access to these functions on SL2610 systems.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called sl2610-syscon.
+
 config MFD_SYSCON
 	bool "System Controller Register R/W Based on Regmap"
 	select REGMAP_MMIO
drivers/mfd/Makefile +1 -0
index f8101d2a9ce9..7807d98c169f 100644
@@ -239,6 +239,7 @@ sec-core-objs			:= sec-common.o sec-irq.o
 obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o
 obj-$(CONFIG_MFD_SEC_ACPM)	+= sec-acpm.o
 obj-$(CONFIG_MFD_SEC_I2C)	+= sec-i2c.o
+obj-$(CONFIG_MFD_SL2610_SYSCON)	+= sl2610-syscon.o
 obj-$(CONFIG_MFD_SYSCON)	+= syscon.o
 obj-$(CONFIG_MFD_LM3533)	+= lm3533-core.o lm3533-ctrlbank.o
 obj-$(CONFIG_MFD_VEXPRESS_SYSREG)	+= vexpress-sysreg.o
drivers/mfd/sl2610-syscon.c new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.55.0
#10 lore raw

Re: [PATCH v4 06/13] mfd: synaptics: add SL2610 system controller support

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [Medium] mfd: sl2610-syscon: unchecked NULL from device_get_match_data() in probe - [Low] mfd…

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider:
- [Medium] mfd: sl2610-syscon: unchecked NULL from device_get_match_data() in probe
- [Low] mfd: sl2610-syscon: single-function AVIO and CPU blocks wrapped in MFD
- [Low] mfd: sl2610-syscon: pass enum ID instead of mfd_cell arrays in match data
- [Low] mfd: sl2610-syscon: commit subject violates MFD prefix and capitalization
- [Low] mfd: sl2610-syscon: mfd_cell arrays in match data and unchecked dereference
--

commit 7c12564f7c07b048184bd552b6f9d7507c32b275
Author: Jisheng Zhang <[email protected]>

mfd: synaptics: add SL2610 system controller support

This patch adds an MFD driver for Synaptics SL2610 system controller blocks to register platform devices for their clock, reset and pin controller sub-functions.

Quoted 1 line

mfd: synaptics: add SL2610 system controller support

[Severity: Low]
MFD commit subjects follow the "mfd: <driver>: <Capitalized description>" format. For this driver, that would be "mfd: sl2610-syscon: Add Synaptics SL2610 system controller support".

Quoted 6 lines
drivers/mfd/sl2610-syscon.c new file +0 -0
new file mode 100644
index 0000000000000..c6fc2955ac0de
@@ -0,0 +1,84 @@

[ ... ]

drivers/mfd/sl2610-syscon.c line 14

Quoted 4 lines
drivers/mfd/sl2610-syscon.c new file +4 -0
+struct sl2610_syscon_data {
+	const struct mfd_cell *cells;
+	unsigned int num_cells;
+};

[Severity: Low]
Is this wrapper struct needed? New MFD drivers avoid passing mfd_cell arrays via match-table .data; storing a non-zero enum ID in .data and switching in sl2610_syscon_probe() avoids both these wrappers and the unchecked match-data dereference on non-OF binds.

[ ... ]

drivers/mfd/sl2610-syscon.c line 34

Quoted 7 lines
drivers/mfd/sl2610-syscon.c new file +7 -0
+static const struct mfd_cell sl2610_avio_cells[] = {
+	MFD_CELL_NAME("sl2610-avio-clk"),
+};
+
+static const struct mfd_cell sl2610_cpu_cells[] = {
+	MFD_CELL_NAME("sl2610-cpu-clk"),
+};

[Severity: Low]
Should the AVIO and CPU blocks be handled by this MFD driver at all?

Both blocks only instantiate a single clock child, and their DT bindings describe single-function clock controllers rather than multi-function devices. The clock driver can match syna,sl2610-avio-syscon and syna,sl2610-cpu-syscon directly while keeping generic syscon access.

The commit message also states that each block implements clock, reset and pin controller devices, which does not hold for AVIO and CPU.

[ ... ]

drivers/mfd/sl2610-syscon.c line 62

Quoted 7 lines
drivers/mfd/sl2610-syscon.c new file +7 -0
+static int sl2610_syscon_probe(struct platform_device *pdev)
+{
+	const struct sl2610_syscon_data *data = device_get_match_data(&pdev->dev);
+
+	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
+				    data->cells, data->num_cells, NULL, 0, NULL);
+}

[Severity: Medium]
Can device_get_match_data() return NULL here and cause a NULL pointer dereference on data->cells?

sl2610_syscon_driver does not set suppress_bind_attrs, so binding a non-OF platform device via sysfs driver_override and bind invokes sl2610_syscon_probe() without an OF match. Checking if (!data) and returning -ENODEV prevents the oops.

drivers/mfd/sl2610-syscon.c line 70

Quoted 8 lines
drivers/mfd/sl2610-syscon.c new file +8 -0
+
+static const struct of_device_id sl2610_syscon_of_match[] = {
+	{ .compatible = "syna,sl2610-soc-syscon", .data = &sl2610_soc_data },
+	{ .compatible = "syna,sl2610-mcu-syscon", .data = &sl2610_mcu_data },
+	{ .compatible = "syna,sl2610-avio-syscon", .data = &sl2610_avio_data },
+	{ .compatible = "syna,sl2610-cpu-syscon", .data = &sl2610_cpu_data },
+	{ }
+};

[Severity: Low]
Should sl2610_syscon_of_match store enum or integer IDs in .data instead of pointers to mfd_cell wrapper structs? MFD convention for new drivers is to put an ID in .data and pick the static const mfd_cell array with a switch in probe.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
author maintainer
#11 lore raw

PATCH v4 7/13 reset: add Synaptics SL2610 reset controller support

In reply to Jisheng Zhang

Support the SoC and MCU reset controls exposed by the SL2610 system controllers. Match the MFD-created platform devices, use the parent syscon regmap and register each reset provider against the parent DT node.

Handle both pulse resets and sticky resets with assert/deassert controls.

---
 drivers/reset/Kconfig        |  12 ++
 drivers/reset/Makefile       |   1 +
 drivers/reset/reset-sl2610.c | 224 +++++++++++++++++++++++++++++++++++
 3 files changed, 237 insertions(+)
 create mode 100644 drivers/reset/reset-sl2610.c
drivers/reset/Kconfig +12 -0
index eda9c698a95f..0c0f475914f6 100644
@@ -358,6 +358,18 @@ config RESET_SUNXI
 	help
 	  This enables the reset driver for Allwinner SoCs.
 
+config RESET_SL2610
+	tristate "Synaptics SL2610 Reset Driver"
+	depends on ARCH_BERLIN || COMPILE_TEST
+	depends on OF && HAS_IOMEM
+	help
+	  Support the reset controllers in the SoC and MCU system control
+	  blocks of Synaptics SL2610 SoCs. Both pulse and sticky reset lines
+	  are supported.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called reset-sl2610.
+
 config RESET_TENSTORRENT_ATLANTIS
 	tristate "Tenstorrent atlantis reset driver"
 	depends on ARCH_TENSTORRENT || COMPILE_TEST
drivers/reset/Makefile +1 -0
index 489fafd6bbe3..d28276a4f2ea 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_RESET_SCMI) += reset-scmi.o
 obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
 obj-$(CONFIG_RESET_SKY1) += reset-sky1.o
 obj-$(CONFIG_RESET_SKY1_AUDSS) += reset-sky1-audss.o
+obj-$(CONFIG_RESET_SL2610) += reset-sl2610.o
 obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_RESET_SUNPLUS) += reset-sunplus.o
 obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
drivers/reset/reset-sl2610.c new file +224 -0

224 lines not on this page · raw message

Signature · 1 line
2.55.0
#12 lore raw

Re: [PATCH v4 07/13] reset: add Synaptics SL2610 reset controller support

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] reset: sl2610_reset_reset() uses regmap_set_bits() RMW on pulse reset bits - [Medium] reset…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] reset: sl2610_reset_reset() uses regmap_set_bits() RMW on pulse reset bits
- [Medium] reset: sl2610_reset_probe() dereferences NULL platform_get_device_id()
--

commit ce7199e60b6a12fd2ab39a73fe98cf4ce93b1945
Author: Jisheng Zhang <[email protected]>

reset: add Synaptics SL2610 reset controller support

This commit adds a reset controller driver for the Synaptics SL2610 SoC and MCU system controllers, handling both pulse and sticky reset lines via the parent syscon regmap.

Quoted 6 lines
drivers/reset/reset-sl2610.c new file +0 -0
new file mode 100644
index 0000000000000..dc55a05d29d89
@@ -0,0 +1,224 @@

[ ... ]

drivers/reset/reset-sl2610.c line 173

Quoted 11 lines
drivers/reset/reset-sl2610.c new file +11 -0
+static int sl2610_reset_reset(struct reset_controller_dev *rcdev,
+			      unsigned long id)
+{
+	struct sl2610_reset_priv *priv = to_sl2610_reset_priv(rcdev);
+	const struct sl2610_reset_cfg *cfg = &priv->cfgs[id];
+
+	if (cfg->sticky)
+		return -ENOTSUPP;
+
+	return regmap_set_bits(priv->regmap, cfg->reg, cfg->bit);
+}

[Severity: Medium]
Can regmap_set_bits() skip the pulse reset or reset sibling peripherals here?

regmap_set_bits() calls regmap_update_bits_base() with force = false, so _regmap_update_bits() skips the write when cfg->bit already reads as 1 and returns 0 without pulsing the reset.

It also writes back orig | cfg->bit, which re-triggers any sibling peripheral bit in SL2610_GBL_PERIFRESET or SL2610_GBL_APBPERIFRESET that currently reads as 1. Using regmap_write() with cfg->bit (as in berlin_reset_reset()), or regmap_write_bits() if other bits must be preserved, avoids both issues.

[ ... ]

drivers/reset/reset-sl2610.c line 186

Quoted 6 lines
drivers/reset/reset-sl2610.c new file +6 -0
+static int sl2610_reset_probe(struct platform_device *pdev)
+{
+	struct device_node *parent_np = pdev->dev.parent->of_node;
+	struct sl2610_reset_priv *priv;
+	const struct sl2610_reset_data *data =
+		(void *)platform_get_device_id(pdev)->driver_data;

[Severity: Medium]
Could platform_get_device_id(pdev) return NULL here?

When a platform device is bound via sysfs driver_override, platform_match() returns early via device_match_driver_override() without calling platform_match_id(), leaving pdev->id_entry NULL and causing a NULL pointer dereference. Check platform_get_device_id(pdev) for NULL and return -ENODEV.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
author maintainer
#13 lore raw

PATCH v4 8/13 pinctrl: berlin: add Synaptics SL2610 pin controller support

In reply to Jisheng Zhang

Add the SoC and MCU pin groups and mux functions for SL2610, together with their pad configuration register descriptions. Bind to the platform devices created by the system controller and associate pin configurations with the parent syscon DT node.

---
 drivers/pinctrl/berlin/Kconfig          |  15 +
 drivers/pinctrl/berlin/Makefile         |   1 +
 drivers/pinctrl/berlin/pinctrl-sl2610.c | 759 ++++++++++++++++++++++++
 3 files changed, 775 insertions(+)
 create mode 100644 drivers/pinctrl/berlin/pinctrl-sl2610.c
drivers/pinctrl/berlin/Kconfig +15 -0
index abb1c912b9ba..0ed25151caf4 100644
@@ -32,4 +32,19 @@ config PINCTRL_BERLIN_BG4CT
 	depends on OF
 	select PINCTRL_BERLIN
 
+config PINCTRL_SL2610
+	tristate "Synaptics SL2610 pin controller driver"
+	depends on MFD_SL2610_SYSCON
+	depends on OF && HAS_IOMEM
+	select GENERIC_PINCONF
+	select PINCONF
+	select PINCTRL_BERLIN
+	help
+	  Support the SoC and MCU pin controllers on Synaptics SL2610 SoCs.
+	  These provide pin multiplexing and electrical pad configuration
+	  through their parent system control blocks.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called pinctrl-sl2610.
+
 endif
drivers/pinctrl/berlin/Makefile +1 -0
index 7b4aa5444a4a..448965293e6a 100644
@@ -5,3 +5,4 @@ obj-$(CONFIG_PINCTRL_BERLIN_BG2CD)	+= berlin-bg2cd.o
 obj-$(CONFIG_PINCTRL_BERLIN_BG2Q)	+= berlin-bg2q.o
 obj-$(CONFIG_PINCTRL_BERLIN_BG4CT)	+= berlin-bg4ct.o
 obj-$(CONFIG_PINCTRL_AS370)		+= pinctrl-as370.o
+obj-$(CONFIG_PINCTRL_SL2610)		+= pinctrl-sl2610.o
drivers/pinctrl/berlin/pinctrl-sl2610.c new file +759 -0

759 lines not on this page · raw message

Signature · 1 line
2.55.0
#14 lore raw

Re: [PATCH v4 08/13] pinctrl: berlin: add Synaptics SL2610 pin controller support

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [High] pinctrl: berlin: UAF on sl2610-pinctrl unbind or module unload - [Medium] pinctrl: berlin: memory…

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider:
- [High] pinctrl: berlin: UAF on sl2610-pinctrl unbind or module unload
- [Medium] pinctrl: berlin: memory leak on error in berlin_pinctrl_dt_node_to_map()
- [Medium] pinctrl: berlin: unsafe parent node reuse in sl2610_pinctrl_probe()
- [Low] pinctrl: berlin: berlin_pinconf_group_get() returns wrong unsupported errno
- [Low] pinctrl: berlin: PINCTRL_SL2610 Kconfig blocks isolated pinctrl tree builds
--

commit 4f61b6f2c7486fb1374b1521f40ce612d38b00ad
Author: Jisheng Zhang <[email protected]>

pinctrl: berlin: add Synaptics SL2610 pin controller support

This commit adds the Synaptics SL2610 SoC and MCU pin controller driver, defining their pin groups, mux functions, and pad configuration registers, and binding to the platform devices created by the parent system controller.

drivers/pinctrl/berlin/Kconfig config PINCTRL_BERLIN_BG4CT · line 37

Quoted 11 lines
drivers/pinctrl/berlin/Kconfig +3 -0
index abb1c912b9ba0..0ed25151caf41 100644
@@ -32,4 +32,19 @@ config PINCTRL_BERLIN_BG4CT
 	depends on OF
 	select PINCTRL_BERLIN
 
+config PINCTRL_SL2610
+	tristate "Synaptics SL2610 pin controller driver"
+	depends on MFD_SL2610_SYSCON

[Severity: Low]
As reported by Linus Walleij on v2 [1], does this hard dependency on MFD_SL2610_SYSCON prevent PINCTRL_SL2610 from being enabled or compile-tested when the pinctrl patches are applied in isolation?

MFD_SL2610_SYSCON is added by commit "mfd: synaptics: add SL2610 system controller support", while pinctrl-sl2610.c has no build-time dependency on it beyond syscon_node_to_regmap() and platform_device_id matching. Allowing COMPILE_TEST here (for example, depends on MFD_SL2610_SYSCON || COMPILE_TEST) and splitting the pinctrl changes into a standalone series would let the pinctrl tree take them independently.

[ ... ]

Quoted 5 lines
drivers/pinctrl/berlin/pinctrl-sl2610.c new file +0 -0
new file mode 100644
index 0000000000000..90b2538597cc7

[ ... ]

Quoted 11 lines
drivers/pinctrl/berlin/pinctrl-sl2610.c new file +11 -0
+static void sl2610_pinctrl_clear_node(void *data)
+{
+	device_set_node(data, NULL);
+}
+
+static int sl2610_pinctrl_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	const struct berlin_pinctrl_desc *desc =
+		(void *)platform_get_device_id(pdev)->driver_data;
+	struct regmap *regmap;

drivers/pinctrl/berlin/pinctrl-sl2610.c line 743

Quoted 10 lines
drivers/pinctrl/berlin/pinctrl-sl2610.c new file +10 -0
+	int ret;
+
+	regmap = syscon_node_to_regmap(dev->parent->of_node);
+	if (IS_ERR(regmap))
+		return dev_err_probe(dev, PTR_ERR(regmap), "Failed to get syscon regmap\n");
+
+	device_set_node(dev, dev_fwnode(dev->parent));
+	ret = devm_add_action_or_reset(dev, sl2610_pinctrl_clear_node, dev);
+	if (ret)
+		return ret;

[Severity: Medium]
Can reusing the parent syscon node with device_set_node() and clearing it in sl2610_pinctrl_clear_node() misreport the device modalias and race with driver binding to cause a NULL pointer dereference?

Because device_set_node() leaves dev_of_node_reused(dev) false, of_device_modalias() and of_device_uevent_modalias() report the parent syscon OF modalias instead of platform:sl2610-soc-pinctrl on probe, and clearing dev->of_node on a live device during unbind can emit "(null)" in lockless sysfs modalias/uevent reads.

In addition, of_match_device() matches sl2610_syscon_driver against the child pinctrl device while dev_of_node_reused(dev) is false. Because bind_store() calls driver_match_device() without device_lock(dev) and then attaches without re-matching, racing sysfs bind on sl2610-syscon against unbinding sl2610-pinctrl hits a NULL dereference:

CPU0 CPU1
bind_store() [sl2610-syscon]
driver_match_device()

    of_match_device() -> match
                                  unbind [sl2610-pinctrl]
                                    devres_release_all()
                                      sl2610_pinctrl_clear_node()
                                        dev->of_node = NULL
                                    device_set_driver(dev, NULL)
  device_driver_attach()
    sl2610_syscon_probe()
      data = device_get_match_data() -> NULL
      data->cells  <-- NULL pointer dereference

Calling platform_device_set_of_node_from_dev(pdev, dev->parent) instead of device_set_node() and sl2610_pinctrl_clear_node() sets dev_set_of_node_reused(dev), takes a balanced OF node reference, and avoids clearing dev->of_node on a live device.

drivers/pinctrl/berlin/pinctrl-sl2610.c

Quoted 2 lines
drivers/pinctrl/berlin/pinctrl-sl2610.c new file +2 -0
+
+	return berlin_pinctrl_probe_regmap(pdev, desc, regmap);

[Severity: Medium]
When pinconf map allocation fails for these BERLIN_PINCTRLCONF_GROUP controllers, does berlin_pinctrl_dt_node_to_map() leak the reserved pinctrl_map array and any previously duplicated config arrays?

In commit "pinctrl: berlin: add optional pinconf support", the error path frees only the temporary configs buffer:

drivers/pinctrl/berlin/berlin.c:berlin_pinctrl_dt_node_to_map() {
    ...
		if (num_configs) {
			ret = pinctrl_utils_add_map_configs(pctrl_dev, map,
					&reserved_maps, num_maps, group_name,
					configs, num_configs,
					PIN_MAP_TYPE_CONFIGS_GROUP);
			if (ret < 0)
				goto exit;
		}
	}

exit:

	kfree(configs);
	return ret;
}

When pinctrl_utils_add_map_configs() returns -ENOMEM (or pinctrl_utils_add_map_mux() fails), dt_to_map_one_config() returns immediately without calling dt_free_map(), so *map and earlier per-group config copies leak unless the error path calls pinctrl_utils_free_map(pctrl_dev, *map, *num_maps).

[Severity: Low]
Does berlin_pinconf_group_get() return -EOPNOTSUPP instead of -ENOTSUPP for unsupported pinconf parameters or groups without pinconf registers?

In commit "pinctrl: berlin: add optional pinconf support", berlin_pinconf_group_get() returns -EOPNOTSUPP when conf_bits is zero and in the default switch case, but pinconf_generic_dump_one() only skips -EINVAL and -ENOTSUPP:

drivers/pinctrl/pinconf-generic.c:pinconf_generic_dump_one() {
    ...
		if (ret == -EINVAL || ret == -ENOTSUPP)
			continue;
		if (ret) {
			seq_printf(s, "ERROR READING CONFIG SETTING %d ", i);
			continue;
		}
    ...
}

Reading the pinconf-groups debugfs file will therefore print error messages for every unsupported generic parameter on SL2610 groups and for all parameters on legacy Berlin SoCs.

drivers/pinctrl/berlin/pinctrl-sl2610.c line 755

Quoted 10 lines
drivers/pinctrl/berlin/pinctrl-sl2610.c new file +10 -0
+}
+
+static struct platform_driver sl2610_pinctrl_driver = {
+	.probe = sl2610_pinctrl_probe,
+	.id_table = sl2610_pinctrl_ids,
+	.driver = {
+		.name = "sl2610-pinctrl",
+	},
+};
+module_platform_driver(sl2610_pinctrl_driver);

[Severity: High]
Can unloading pinctrl-sl2610 or unbinding its platform device via sysfs cause a use-after-free in bound pinctrl consumers?

Because sl2610_pinctrl_probe() borrows the parent syscon fwnode after the parent has already claimed fwnode->dev, fw_devlink links DT consumers to sl2610-syscon rather than to the child pinctrl devices. In drivers/pinctrl/berlin/berlin.c, berlin_pctrl_desc leaves link_consumers false so pinctrl_link_add() adds no consumer device links, and omits pins/get_group_pins so pin_request() never takes a module reference (and berlin_pctrl_desc.owner is built-in berlin.c's THIS_MODULE).

Running rmmod pinctrl-sl2610 or unbinding via sysfs therefore runs pinctrl_unregister() -> kfree(pctldev) and unmaps the module data while consumers remain bound with dangling setting->pctldev and dt_map->pctldev pointers. A subsequent consumer unbind (pinmux_disable_setting() or dt_free_map()) or pinctrl state change deterministically dereferences the freed pctldev and unmapped module memory.

Setting link_consumers = true in berlin_pctrl_desc ensures consumer device links unbind consumers before pinctrl_unregister() runs.

[1] https://lore.kernel.org/r/CAD++jL=TE0pF60vR-Y==z2LDfs4n2rvfZ5FMOuEoFsD2PwMXhw@mail.gmail.com

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
author maintainer
#15 lore raw

PATCH v4 9/13 clk: berlin: add Synaptics clock controller helpers

In reply to Jisheng Zhang

Add the configurable divider and gate clock implementation shared by Synaptics system controllers. Provide the MCU system manager helper for registering its fixed clocks, gates and peripheral dividers.

Keep clock resources managed by the MFD clock device and obtain the register range and provider node from its parent.

---
 drivers/clk/Kconfig                |   1 +
 drivers/clk/berlin/Kconfig         |   7 +
 drivers/clk/berlin/Makefile        |   2 +
 drivers/clk/berlin/sl-clk.c        | 279 +++++++++++++++++++++++++++++
 drivers/clk/berlin/sl-clk.h        |  31 ++++
 drivers/clk/berlin/sl-sysmgr-clk.c | 241 +++++++++++++++++++++++++
 drivers/clk/berlin/sl-sysmgr-clk.h |  44 +++++
 7 files changed, 605 insertions(+)
 create mode 100644 drivers/clk/berlin/Kconfig
 create mode 100644 drivers/clk/berlin/sl-clk.c
 create mode 100644 drivers/clk/berlin/sl-clk.h
 create mode 100644 drivers/clk/berlin/sl-sysmgr-clk.c
 create mode 100644 drivers/clk/berlin/sl-sysmgr-clk.h
drivers/clk/Kconfig +1 -0
index 37a8e35d4178..906fabfe0d33 100644
@@ -514,6 +514,7 @@ source "drivers/clk/analogbits/Kconfig"
 source "drivers/clk/anlogic/Kconfig"
 source "drivers/clk/aspeed/Kconfig"
 source "drivers/clk/bcm/Kconfig"
+source "drivers/clk/berlin/Kconfig"
 source "drivers/clk/cix/Kconfig"
 source "drivers/clk/davinci/Kconfig"
 source "drivers/clk/eswin/Kconfig"
drivers/clk/berlin/Kconfig new file +7 -0
new file mode 100644
index 000000000000..8f71d4c7a478
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+config SL_COMMON_CLK
+	bool
+
+config SL_SYSMGR_CLK
+	bool
drivers/clk/berlin/Makefile +2 -0
index 3733733a4806..5dbd0fd264ad 100644
@@ -3,3 +3,5 @@ obj-y += berlin2-avpll.o berlin2-pll.o berlin2-div.o
 obj-$(CONFIG_MACH_BERLIN_BG2)	+= bg2.o
 obj-$(CONFIG_MACH_BERLIN_BG2CD)	+= bg2.o
 obj-$(CONFIG_MACH_BERLIN_BG2Q)	+= bg2q.o
+obj-$(CONFIG_SL_COMMON_CLK)	+= sl-clk.o
+obj-$(CONFIG_SL_SYSMGR_CLK)	+= sl-sysmgr-clk.o
drivers/clk/berlin/sl-clk.c new file +279 -0

279 lines not on this page · raw message

drivers/clk/berlin/sl-clk.h new file +31 -0
new file mode 100644
index 000000000000..7489b26a5e8d
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __SL_CLK_H
+#define __SL_CLK_H
+
+#include <linux/compiler_types.h>
+#include <linux/spinlock_types.h>
+
+struct clk_hw;
+struct device;
+
+struct sl_clk_desc {
+	const char	*name;
+	u32		id;
+	u32		offset;
+	unsigned long	flags;
+};
+
+struct sl_gateclk_desc {
+	const char	*name;
+	const char	*parent_name;
+	u32		id;
+	u8		bit_idx;
+	unsigned long	flags;
+};
+
+struct clk_hw *sl_clk_register(struct device *dev, void __iomem *reg,
+			       const char *name, const char * const *parent_names,
+			       unsigned int num_parents, unsigned long flags,
+			       spinlock_t *lock);
+
+#endif /* __SL_CLK_H */
drivers/clk/berlin/sl-sysmgr-clk.c new file +241 -0

241 lines not on this page · raw message

drivers/clk/berlin/sl-sysmgr-clk.h new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.55.0
#16 lore raw

Re: [PATCH v4 09/13] clk: berlin: add Synaptics clock controller helpers

Thank you for your contribution! Sashiko AI review found 8 potential issues to consider: - [High] clk: berlin: IRQ-unsafe spinlock in sl_sysmgr_gateclk_ops - [Medium] clk: berlin: uninitialized…

Thank you for your contribution! Sashiko AI review found 8 potential issues to consider:
- [High] clk: berlin: IRQ-unsafe spinlock in sl_sysmgr_gateclk_ops
- [Medium] clk: berlin: uninitialized struct clk_init_data in sl-sysmgr-clk.c
- [Medium] clk: berlin: sl_clk_determine_rate() ignores min_rate and max_rate
- [Medium] clk: berlin: sl_clk_get_parent() returns 0 on unsupported selector
- [Medium] clk: berlin: sl_sysmgr_clk_ops and gateclk ops omit .disable callback
- [Medium] clk: berlin: sl_sysmgr_clk_setup() ignores descriptor flags
- [Medium] clk: berlin: sl_clk_value() maps DIV_SEL 0, 6, 7 to 0 instead of 1
- [Low] clk: berlin: sl-sysmgr-clk.h is not self-contained and has unused items
--

commit 7ae4f8ba2e3b37f62f72f67fa5bfa73fb4501645
Author: Jisheng Zhang <[email protected]>

clk: berlin: add Synaptics clock controller helpers

This commit adds the shared configurable divider/gate clock driver (sl-clk.c) and the MCU system manager clock helper (sl-sysmgr-clk.c) for Synaptics SL SoCs.

Quoted 6 lines
drivers/clk/berlin/sl-clk.c new file +0 -0
new file mode 100644
index 0000000000000..e212320a0637d
@@ -0,0 +1,279 @@

[ ... ]

Quoted 13 lines
drivers/clk/berlin/sl-clk.c new file +13 -0
+static unsigned int sl_clk_value(u32 val)
+{
+	static const u8 div_table[] = { 0, 2, 4, 6, 8, 12, 0, 0 };
+
+	if (val & SL_CLK_DIV3_SWITCH)
+		return 3;
+	if (!(val & SL_CLK_DIV_SWITCH))
+		return 1;
+
+	return div_table[FIELD_GET(SL_CLK_DIV_SEL, val)];
+}
+
+static unsigned long sl_clk_recalc_rate(struct clk_hw *hw,

drivers/clk/berlin/sl-clk.c line 63

Quoted 10 lines
drivers/clk/berlin/sl-clk.c new file +10 -0
+					unsigned long parent_rate)
+{
+	struct sl_clk *clk = to_sl_clk(hw);
+	unsigned int divisor = sl_clk_value(readl_relaxed(clk->reg));
+
+	if (WARN_ON_ONCE(!divisor))
+		return 0;
+
+	return parent_rate / divisor;
+}

[Severity: Medium]
Should div_table[] map SL_CLK_DIV_SEL encodings 0, 6, and 7 to 1 rather than 0?

This register layout matches BERLIN2_SINGLE_DIV in berlin2-div.h, where berlin2-div.c maps those encodings to divide-by-1 in clk_div[]. If reset or firmware leaves SL_CLK_DIV_SWITCH set with SL_CLK_DIV_SEL in {0, 6, 7}, sl_clk_recalc_rate() triggers WARN_ON_ONCE(!divisor) and reports 0 Hz for the clock and its children.

Quoted 26 lines
drivers/clk/berlin/sl-clk.c new file +26 -0
+
+static unsigned int sl_clk_best(unsigned long parent_rate,
+				unsigned long rate)
+{
+	unsigned long best_diff = ULONG_MAX;
+	unsigned int best = 1, i;
+
+	for (i = 0; i < ARRAY_SIZE(sl_clk_values); i++) {
+		unsigned long candidate = parent_rate / sl_clk_values[i];
+		unsigned long diff = candidate > rate ? candidate - rate :
+							     rate - candidate;
+
+		if (diff < best_diff) {
+			best_diff = diff;
+			best = sl_clk_values[i];
+		}
+	}
+
+	return best;
+}
+
+static int sl_clk_determine_rate(struct clk_hw *hw,
+				 struct clk_rate_request *req)
+{
+	struct clk_hw *parent = clk_hw_get_parent(hw);
+

drivers/clk/berlin/sl-clk.c line 99

Quoted 10 lines
drivers/clk/berlin/sl-clk.c new file +10 -0
+	if (!parent)
+		return -EINVAL;
+
+	req->best_parent_hw = parent;
+	req->best_parent_rate = clk_hw_get_rate(parent);
+	req->rate = req->best_parent_rate /
+		    sl_clk_best(req->best_parent_rate, req->rate);
+
+	return 0;
+}

[Severity: Medium]
Does sl_clk_determine_rate() need to respect req->min_rate and req->max_rate?

sl_clk_best() picks the closest divisor across sl_clk_values[] without checking rate bounds. For example, with a 1200 MHz parent and req->max_rate = 360 MHz, it selects divisor 3 (400 MHz) instead of divisor 4 (300 MHz), causing clk_calc_new_rates() to reject the rate and fail clk_set_rate() with -EINVAL even though a valid in-range divisor exists.

Filtering candidates to [req->min_rate, req->max_rate] and returning -EINVAL if none fits avoids this.

[ ... ]

Quoted 9 lines
drivers/clk/berlin/sl-clk.c new file +9 -0
+static u8 sl_clk_get_parent(struct clk_hw *hw)
+{
+	struct sl_clk *clk = to_sl_clk(hw);
+	u32 val = readl_relaxed(clk->reg);
+	u8 selector;
+	unsigned int index;
+
+	if (!(val & SL_CLK_PLL_SWITCH))
+		return 0;

drivers/clk/berlin/sl-clk.c line 167

Quoted 10 lines
drivers/clk/berlin/sl-clk.c new file +10 -0
+
+	selector = FIELD_GET(SL_CLK_PLL_SEL, val);
+	index = selector + 1;
+	if (index < clk_hw_get_num_parents(hw))
+		return index;
+
+	dev_warn(clk->dev, "%s: unsupported parent selector %u\n",
+		 clk_hw_get_name(hw), selector);
+	return 0;
+}

[Severity: Medium]
Should sl_clk_get_parent() return an out-of-range index instead of 0 when hardware has an unsupported parent selector?

Returning 0 makes __clk_init_parent() attach the clock to parent 0 even though SL_CLK_PLL_SWITCH is still set to the invalid selector. Any later clk_set_parent() targeting parent 0 then short-circuits in clk_core_set_parent_nolock() because core->parent already matches, leaving hardware stuck on the unsupported selector.

Returning index (or clk_hw_get_num_parents(hw)) lets clk_core_get_parent_by_index() treat the clock as orphaned until reparented.

[ ... ]

Quoted 6 lines
drivers/clk/berlin/sl-sysmgr-clk.c new file +0 -0
new file mode 100644
index 0000000000000..f3cf921fc3c1a
@@ -0,0 +1,241 @@

[ ... ]

Quoted 23 lines
drivers/clk/berlin/sl-sysmgr-clk.c new file +23 -0
+static DEFINE_SPINLOCK(sl_sysmgr_gateclk_lock);
+
+#define to_sl_sysmgr_gateclk(hw)	container_of(hw, struct sl_sysmgr_gateclk, hw)
+#define to_sl_sysmgr_clk(hw)		container_of(hw, struct sl_sysmgr_clk, hw)
+
+static int sl_sysmgr_gateclk_enable(struct clk_hw *hw)
+{
+	u32 val;
+	struct sl_sysmgr_gateclk *clk = to_sl_sysmgr_gateclk(hw);
+
+	guard(spinlock)(&sl_sysmgr_gateclk_lock);
+
+	val = readl_relaxed(clk->base);
+	if (!(val & BIT(clk->bit_idx))) {
+		val |= BIT(clk->bit_idx);
+		writel_relaxed(val, clk->base);
+	}
+
+	return 0;
+}
+
+static int sl_sysmgr_gateclk_is_enabled(struct clk_hw *hw)
+{

drivers/clk/berlin/sl-sysmgr-clk.c line 71

Quoted 10 lines
drivers/clk/berlin/sl-sysmgr-clk.c new file +10 -0
+	u32 val;
+	struct sl_sysmgr_gateclk *clk = to_sl_sysmgr_gateclk(hw);
+
+	guard(spinlock)(&sl_sysmgr_gateclk_lock);
+
+	val = readl_relaxed(clk->base);
+	val &= BIT(clk->bit_idx);
+
+	return val ? 1 : 0;
+}

[Severity: High]
Can acquiring sl_sysmgr_gateclk_lock without disabling interrupts cause a hardirq deadlock?

clk_core_enable() calls sl_sysmgr_gateclk_enable() while holding CCF's hardirq-safe enable_lock, whereas clk_summary_show_one() calls sl_sysmgr_gateclk_is_enabled() in process context with interrupts enabled and without enable_lock:

CPU0 CPU1
---- ----
lock(&sl_sysmgr_gateclk_lock)
lock(&enable_lock) lock(&sl_sysmgr_gateclk_lock)
<hardirq>
lock(&enable_lock)

*** DEADLOCK ***

CPU0: clk_summary_show_one() -> clk_core_is_enabled() ->

      sl_sysmgr_gateclk_is_enabled()
      <hardirq> clk_enable() -> clk_core_enable_lock()

CPU1: clk_enable() -> clk_core_enable_lock() ->
sl_sysmgr_gateclk_enable()

A hardirq enabling a SysMgr gate clock on the same CPU also self-deadlocks on sl_sysmgr_gateclk_lock. Since sl_sysmgr_gateclk_is_enabled() only performs a single 32-bit readl_relaxed(), dropping the lock there and using guard(spinlock_irqsave) on the write path avoids both the deadlock and unnecessary global contention.

drivers/clk/berlin/sl-sysmgr-clk.c line 76

Quoted 5 lines
drivers/clk/berlin/sl-sysmgr-clk.c new file +5 -0
+
+static const struct clk_ops sl_sysmgr_gateclk_ops = {
+	.enable		= sl_sysmgr_gateclk_enable,
+	.is_enabled	= sl_sysmgr_gateclk_is_enabled,
+};

[Severity: Medium]
Why do sl_sysmgr_gateclk_ops and sl_sysmgr_clk_ops omit .disable?

Without .disable, clk_disable() and clk_disable_unused() cannot gate these clocks off in hardware once enabled. In addition, clk_is_enabled_when_prepared() checks !(ops->enable && ops->disable) and falsely returns true, causing pm_clk_acquire() to misclassify these clocks as enabled when prepared.

Separately, sl_sysmgr_gateclk duplicates devm_clk_hw_register_gate(), and struct sl_sysmgr_gateclk_desc duplicates struct sl_gateclk_desc in sl-clk.h.

drivers/clk/berlin/sl-sysmgr-clk.c line 89

Quoted 13 lines
drivers/clk/berlin/sl-sysmgr-clk.c new file +13 -0
+
+static int
+sl_sysmgr_gateclk_register(struct device *dev, struct sl_sysmgr_gateclk *gclk,
+			   const char *name, const char *parent_names,
+			   u8 bit_idx, void __iomem *base)
+{
+	struct clk_init_data init;
+
+	init.name = name;
+	init.ops = &sl_sysmgr_gateclk_ops;
+	init.parent_names = &parent_names;
+	init.num_parents = 1;
+	init.flags = 0;

[Severity: Medium]
Does leaving init uninitialized here and in sl_sysmgr_clk_register() pass uninitialized stack memory into clk_core_populate_parent_map()?

Neither function initializes init.parent_data or init.parent_hws, which clk_core_populate_parent_map() reads unconditionally during clock registration, triggering KMSAN warnings. Zero-initializing with struct clk_init_data init = {}; (as sl_clk_register() does) avoids this.

[ ... ]

Quoted 5 lines
drivers/clk/berlin/sl-sysmgr-clk.c new file +5 -0
+	for (i = 0; i < gclk_n; i++) {
+		ret = sl_sysmgr_gateclk_register(&pdev->dev, &priv->gclks[i],
+						 gdescs[i].name, gdescs[i].parent_name,
+						 gdescs[i].bit_idx, base + gclk_offset);
+		if (ret)

drivers/clk/berlin/sl-sysmgr-clk.c line 225

Quoted 10 lines
drivers/clk/berlin/sl-sysmgr-clk.c new file +10 -0
+			return ret;
+
+		id = gdescs[i].id;
+		clk_data->hws[id] = &priv->gclks[i].hw;
+	}
+
+	for (i = 0; i < clk_n; i++) {
+		ret = sl_sysmgr_clk_register(&pdev->dev, &priv->clks[i],
+					     descs[i].name, descs[i].parent_name,
+					     descs[i].div_bits, base + descs[i].offset);

[Severity: Medium]
Should sl_sysmgr_clk_setup() pass gdescs[i].flags and descs[i].flags to the registration helpers?

Both struct sl_sysmgr_gateclk_desc and struct sl_sysmgr_clk_desc expose a flags field, but sl_sysmgr_gateclk_register() and sl_sysmgr_clk_register() hardcode init.flags = 0, silently discarding flags such as CLK_IS_CRITICAL or CLK_IGNORE_UNUSED.

[ ... ]

Quoted 6 lines
drivers/clk/berlin/sl-sysmgr-clk.h new file +0 -0
new file mode 100644
index 0000000000000..5ccf388bcccbd
@@ -0,0 +1,44 @@

[ ... ]

Quoted 11 lines
drivers/clk/berlin/sl-sysmgr-clk.h new file +11 -0
+#ifndef __SL_SYSMGR_CLK_H
+#define __SL_SYSMGR_CLK_H
+
+struct sl_sysmgr_clk_desc {
+	const char	*name;
+	const char	*parent_name;
+	u32		id;
+	u32		offset;
+	u8		div_bits;
+	unsigned long	flags;
+};

[ ... ]

Quoted 1 line

+int sl_sysmgr_clk_setup(struct platform_device *pdev,

[Severity: Low]
Can sl-sysmgr-clk.h be included standalone? It uses u32, u8, and struct platform_device without including linux/types.h or forward-declaring struct platform_device, which fails to build if included before those headers.

In sl-sysmgr-clk.c, linux/version.h and DIV_CHNG_EN are also unused.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
author maintainer
#17 lore raw

PATCH v4 10/13 clk: berlin: add Synaptics SL2610 clocks and PLLs

In reply to Jisheng Zhang

Support the SL2610 SoC, CPU, AVIO and MCU clocks. Register the PLL outputs and the divider, gate and fixed-factor clocks used by the CPU and peripherals.

Match MFD platform devices and register clock providers on their parent system controller nodes.

---
 drivers/clk/berlin/Kconfig      |  26 +++
 drivers/clk/berlin/Makefile     |   2 +
 drivers/clk/berlin/clk-sl2610.c | 360 ++++++++++++++++++++++++++++++++
 drivers/clk/berlin/sl2610-pll.c | 145 +++++++++++++
 drivers/clk/berlin/sl2610-pll.h |  14 ++
 5 files changed, 547 insertions(+)
 create mode 100644 drivers/clk/berlin/clk-sl2610.c
 create mode 100644 drivers/clk/berlin/sl2610-pll.c
 create mode 100644 drivers/clk/berlin/sl2610-pll.h
drivers/clk/berlin/Kconfig +26 -0
index 8f71d4c7a478..88760ad0af5b 100644
@@ -5,3 +5,29 @@ config SL_COMMON_CLK
 
 config SL_SYSMGR_CLK
 	bool
+
+config SL2610_PLL
+	tristate "Synaptics SL2610 PLL Driver"
+	depends on ARCH_BERLIN || COMPILE_TEST
+	default n
+	help
+	  Support the integer and fractional PLL outputs used by the SoC,
+	  CPU and audio clock controllers on Synaptics SL2610 SoCs.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called sl2610-pll.
+
+config SL2610_CLK
+	tristate "Synaptics SL2610 Clock Driver"
+	depends on ARCH_BERLIN || COMPILE_TEST
+	depends on OF && HAS_IOMEM
+	select SL2610_PLL
+	select SL_COMMON_CLK
+	select SL_SYSMGR_CLK
+	help
+	  This driver provides support for clock controller on Synaptics SL2610
+	  SoC. The clock controller generates and supplies clocks to various
+	  peripherals within the SoC.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called clk-sl2610.
drivers/clk/berlin/Makefile +2 -0
index 5dbd0fd264ad..ec87dbed7dd4 100644
@@ -5,3 +5,5 @@ obj-$(CONFIG_MACH_BERLIN_BG2CD)	+= bg2.o
 obj-$(CONFIG_MACH_BERLIN_BG2Q)	+= bg2q.o
 obj-$(CONFIG_SL_COMMON_CLK)	+= sl-clk.o
 obj-$(CONFIG_SL_SYSMGR_CLK)	+= sl-sysmgr-clk.o
+obj-$(CONFIG_SL2610_PLL)	+= sl2610-pll.o
+obj-$(CONFIG_SL2610_CLK)	+= clk-sl2610.o
drivers/clk/berlin/clk-sl2610.c new file +360 -0

360 lines not on this page · raw message

drivers/clk/berlin/sl2610-pll.c new file +145 -0

145 lines not on this page · raw message

drivers/clk/berlin/sl2610-pll.h new file +14 -0
new file mode 100644
index 000000000000..b61a93b28610
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __SL2610_PLL_H
+#define __SL2610_PLL_H
+
+#include <linux/io.h>
+
+struct clk_hw_onecell_data;
+struct device;
+struct device_node;
+
+int sl2610_pll_register(struct device *dev, void __iomem *ctrl,
+			const char *out, const char *outf);
+
+#endif /* __SL2610_PLL_H */
Signature · 1 line
2.55.0
#18 lore raw

Re: [PATCH v4 10/13] clk: berlin: add Synaptics SL2610 clocks and PLLs

Thank you for your contribution! Sashiko AI review found 8 potential issues to consider: - [Medium] clk: berlin: hardcoded osc parent breaks ge0 and ge1 ptp refclks - [Medium] clk: berlin…

Thank you for your contribution! Sashiko AI review found 8 potential issues to consider:
- [Medium] clk: berlin: hardcoded osc parent breaks ge0 and ge1 ptp refclks
- [Medium] clk: berlin: IRQ-unsafe sl_sysmgr_gateclk_lock risks hardirq deadlock
- [Medium] clk: berlin: external clk_hw stored in clk_parent_data.hw
- [Medium] clk: berlin: unchecked platform_get_device_id() in sl2610_clks_probe()
- [Low] clk: berlin: misspelled gate clock names apbuart3lck and apbi2c1lck
- [Low] clk: berlin: unused SL2610_APLL macro and struct forward declarations
- [Low] clk: berlin: ARCH_BERLIN gate in drivers/clk/Makefile breaks COMPILE_TEST
- [Low] clk: berlin: dereference of dev before NULL check in sl2610_pll_register()
--

commit b1f80cb9b6c334b2a4faa23585bae12adc210391
Author: Jisheng Zhang <[email protected]>

clk: berlin: add Synaptics SL2610 clocks and PLLs

This commit adds the Synaptics SL2610 PLL and clock controller drivers, registering the SoC, CPU, AVIO, and MCU clocks via MFD platform devices.

Quoted 14 lines
drivers/clk/berlin/Kconfig +6 -0
index 8f71d4c7a478b..88760ad0af5b9 100644
@@ -5,3 +5,29 @@ config SL_COMMON_CLK
 
 config SL_SYSMGR_CLK
 	bool
+
+config SL2610_PLL
+	tristate "Synaptics SL2610 PLL Driver"
+	depends on ARCH_BERLIN || COMPILE_TEST
+	default n
+	help

drivers/clk/berlin/Kconfig config SL_COMMON_CLK · line 23

Quoted 10 lines
drivers/clk/berlin/Kconfig +10 -0
+	  Support the integer and fractional PLL outputs used by the SoC,
+	  CPU and audio clock controllers on Synaptics SL2610 SoCs.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called sl2610-pll.
+
+config SL2610_CLK
+	tristate "Synaptics SL2610 Clock Driver"
+	depends on ARCH_BERLIN || COMPILE_TEST
+	depends on OF && HAS_IOMEM

[Severity: Low]
Will SL2610_PLL and SL2610_CLK actually be built when COMPILE_TEST is enabled without ARCH_BERLIN?

drivers/clk/Makefile still gates descent into the directory on obj-$(CONFIG_ARCH_BERLIN) += berlin/, so Kbuild silently skips drivers/clk/berlin/ when ARCH_BERLIN is disabled. Switching that entry to obj-y += berlin/ would also require gating the unconditional berlin2-*.o objects in drivers/clk/berlin/Makefile.

Quoted 5 lines
drivers/clk/berlin/clk-sl2610.c new file +0 -0
new file mode 100644
index 0000000000000..b51d3523028de

[ ... ]

drivers/clk/berlin/clk-sl2610.c line 70

Quoted 3 lines
drivers/clk/berlin/clk-sl2610.c new file +3 -0
+	{ "apbuart3lck",	"apbcoreclk",	CLK_APBUART3,		13 },
+	{ "apbi2c0clk",		"apbcoreclk",	CLK_APBI2C0,		14 },
+	{ "apbi2c1lck",		"apbcoreclk",	CLK_APBI2C1,		15 },

[Severity: Low]
apbuart3lck and apbi2c1lck appear to be typos for apbuart3clk and apbi2c1clk, which exposes misspelled names in debugfs and breaks any name-based lookup for those clocks.

[ ... ]

drivers/clk/berlin/clk-sl2610.c line 138

Quoted 7 lines
drivers/clk/berlin/clk-sl2610.c new file +7 -0
+static const char * const ge_ptp_refclk_parent_names[] = {
+	"osc",
+	"apll0_outf",
+	"syspll1_out",
+	"syspll0_out",
+	"clk_mcu_axi",
+};

[Severity: Medium]
Can ge0_ptp_refclk and ge1_ptp_refclk end up orphaned at 0 Hz when parent index 0 is selected?

The DT binding passes the external reference clock by phandle without requiring it to be globally named "osc". In sl2611.dtsi, the fixed-clock node is named clock-osc without clock-output-names, so _of_fixed_clk_setup() registers it as "clock-osc" rather than "osc". Resolving the reference clock from dev->parent->of_node or using clk_parent_data would avoid the mismatch.

[ ... ]

drivers/clk/berlin/clk-sl2610.c line 329

Quoted 7 lines
drivers/clk/berlin/clk-sl2610.c new file +7 -0
+static int sl2610_sysmgr_clk_setup(struct platform_device *pdev)
+{
+	return sl_sysmgr_clk_setup(pdev, sl2610_sysmgr_fixeds, ARRAY_SIZE(sl2610_sysmgr_fixeds),
+				   sl2610_sysmgr_gates, ARRAY_SIZE(sl2610_sysmgr_gates),
+				   CLK_GATE_CTRL0,
+				   sl2610_sysmgr_clks, ARRAY_SIZE(sl2610_sysmgr_clks));
+}

[Severity: Medium]
Can registering these MCU gate clocks trigger a hardirq deadlock on sl_sysmgr_gateclk_lock?

In drivers/clk/berlin/sl-sysmgr-clk.c, both sl_sysmgr_gateclk_enable() and sl_sysmgr_gateclk_is_enabled() acquire sl_sysmgr_gateclk_lock with plain guard(spinlock) without disabling interrupts. Reading /sys/kernel/debug/clk/clk_summary calls sl_sysmgr_gateclk_is_enabled() in process context with IRQs enabled, which can deadlock if a hardirq enables a gate clock on the same CPU:

clk_summary_show_one()
clk_core_is_enabled()
sl_sysmgr_gateclk_is_enabled()
guard(spinlock)(&sl_sysmgr_gateclk_lock)
<hardirq>
clk_enable()
sl_sysmgr_gateclk_enable()
guard(spinlock)(&sl_sysmgr_gateclk_lock) <-- spins forever

It also creates an ABBA lock inversion with CCF's global enable_lock across CPUs. Using guard(spinlock_irqsave) in sl_sysmgr_gateclk_enable() (and either guard(spinlock_irqsave) or a lockless readl_relaxed() in sl_sysmgr_gateclk_is_enabled()) avoids the inversion.

[ ... ]

drivers/clk/berlin/clk-sl2610.c line 347

Quoted 8 lines
drivers/clk/berlin/clk-sl2610.c new file +8 -0
+static int sl2610_clks_probe(struct platform_device *pdev)
+{
+	int (*clk_setup)(struct platform_device *pdev);
+
+	clk_setup = (void *)platform_get_device_id(pdev)->driver_data;
+
+	return clk_setup(pdev);
+}

[Severity: Medium]
Can platform_get_device_id(pdev) return NULL and cause a NULL pointer dereference here?

If an unbound platform device is bound to sl2610-clk via sysfs driver_override, platform_match() returns early on device_match_driver_override() without calling platform_match_id(), leaving pdev->id_entry NULL. Checking for a NULL id and returning -ENODEV prevents the oops.

Quoted 5 lines
drivers/clk/berlin/sl2610-pll.c new file +0 -0
new file mode 100644
index 0000000000000..62c5d2d19c362

[ ... ]

drivers/clk/berlin/sl2610-pll.c line 38

Quoted 2 lines
drivers/clk/berlin/sl2610-pll.c new file +2 -0
+#define SL2610_APLL
+struct sl2610_pll {

[Severity: Low]
SL2610_APLL is an unused leftover macro. In addition, sl2610-pll.h contains unused forward declarations for struct clk_hw_onecell_data and struct device_node.

[ ... ]

drivers/clk/berlin/sl2610-pll.c line 105

Quoted 12 lines
drivers/clk/berlin/sl2610-pll.c new file +12 -0
+int sl2610_pll_register(struct device *dev, void __iomem *ctrl,
+			const char *out, const char *outf)
+{
+	struct device_node *np = dev->parent->of_node;
+	struct clk_parent_data parent = {};
+	struct clk_init_data init = {};
+	struct sl2610_pll *pll;
+	struct clk *input;
+	int ret;
+
+	if (!dev || !ctrl || !out || !outf)
+		return -EINVAL;

[Severity: Low]
Does the initializer for np dereference dev before the !dev check?

Initializing np after validating dev (and dev->parent and np if defensive checking is intended) avoids the dead NULL check and prevents an oops if a caller ever passes a NULL dev.

Quoted 12 lines
drivers/clk/berlin/sl2610-pll.c new file +12 -0
+	input = of_clk_get(np, 0);
+	if (IS_ERR(input))
+		return dev_err_probe(dev, PTR_ERR(input),
+				     "failed to get PLL reference clock\n");
+	parent.hw = __clk_get_hw(input);
+	ret = devm_add_action_or_reset(dev, sl2610_pll_put_clk, input);
+	if (ret)
+		return ret;
+
+	pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL);
+	if (!pll)
+		return -ENOMEM;

drivers/clk/berlin/sl2610-pll.c line 128

Quoted 10 lines
drivers/clk/berlin/sl2610-pll.c new file +10 -0
+	pll->ctrl = ctrl;
+
+	init.name = out;
+	init.ops = &sl2610_pllout_ops;
+	init.parent_data = &parent;
+	init.num_parents = 1;
+	init.flags = CLK_GET_RATE_NOCACHE;
+	pll->pllout.init = &init;
+
+	ret = devm_clk_hw_register(dev, &pll->pllout);

[Severity: Medium]
Can storing __clk_get_hw(input) in parent.hw cause a use-after-free if the external reference clock provider is unregistered?

clk_parent_data.hw is only valid for provider-internal clocks, and holding the struct clk from of_clk_get() does not prevent an external provider from unregistering and freeing its struct clk_hw. On unregistration, clk_core_evict_parent_cache() clears entry->core while leaving entry->hw set, so a later clk_core_fill_parent_index() dereferences entry->hw->core on the freed clk_hw. Since clk_hw_register() already attaches dev->parent->of_node, initializing parent with { .index = 0 } lets CCF resolve the DT parent directly without of_clk_get() or storing an external clk_hw pointer.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
author maintainer
#19 lore raw

PATCH v4 11/13 dt-bindings: arm: berlin: add Synaptics SL2610 SoCs and RDK boards

In reply to Jisheng Zhang

Add devicetree binding for the Synaptics SL2610 SoCs and corresponding RDK boards.

The SL2610 family includes five pin-to-pin compatible SoCs: SL2611, SL2613, SL2615, SL2617, and SL2619.

---
 .../bindings/arm/marvell,berlin.yaml          | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/arm/marvell,berlin.yaml +20 -0
index 4e8442980dcb..30d94059e2f2 100644
@@ -41,5 +41,25 @@ properties:
               - marvell,berlin4ct-stb
           - const: marvell,berlin4ct
           - const: marvell,berlin
+      - items:
+          - enum:
+              - syna,sl2611-rdk
+          - const: syna,sl2611
+      - items:
+          - enum:
+              - syna,sl2613-rdk
+          - const: syna,sl2613
+      - items:
+          - enum:
+              - syna,sl2615-rdk
+          - const: syna,sl2615
+      - items:
+          - enum:
+              - syna,sl2617-rdk
+          - const: syna,sl2617
+      - items:
+          - enum:
+              - syna,sl2619-rdk
+          - const: syna,sl2619
 
 additionalProperties: true
Signature · 1 line
2.55.0
author maintainer
#20 lore raw

PATCH v4 12/13 arm64: dts: synaptics: add SL2610 family SoCs

In reply to Jisheng Zhang

Describe the CPUs, interrupt controller, system controllers and supported serial, I2C, I3C, SPI and GPIO peripherals for the SL2610 family.

Use the SL2610 peripheral compatibles already documented in the upstream bindings and share clock, reset and pin configuration providers through the system controller nodes.

---
 arch/arm64/boot/dts/synaptics/sl2611.dtsi | 466 ++++++++++++++++++++++
 arch/arm64/boot/dts/synaptics/sl2613.dtsi |  12 +
 arch/arm64/boot/dts/synaptics/sl2615.dtsi |  46 +++
 arch/arm64/boot/dts/synaptics/sl2617.dtsi |  46 +++
 arch/arm64/boot/dts/synaptics/sl2619.dtsi |  44 ++
 5 files changed, 614 insertions(+)
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2611.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2613.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2615.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2617.dtsi
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2619.dtsi
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +466 -0
new file mode 100644
index 000000000000..03859bae07bd
@@ -0,0 +1,466 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+#include <dt-bindings/clock/syna,sl2610.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/reset/syna,sl2610-reset.h>
+
+/ {
+	compatible = "syna,sl2611";
+	#address-cells = <2>;
+	#size-cells = <2>;
+	interrupt-parent = <&gic>;
+
+	osc: clock-osc {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a55";
+			reg = <0x0>;
+			cpu-idle-states = <&cpu_sleep_0>;
+			d-cache-line-size = <64>;
+			d-cache-sets = <128>;
+			d-cache-size = <32768>;
+			enable-method = "psci";
+			i-cache-line-size = <64>;
+			i-cache-sets = <128>;
+			i-cache-size = <32768>;
+			next-level-cache = <&l2_0>;
+
+			l2_0: l2-cache {
+				compatible = "cache";
+				cache-level = <2>;
+				cache-line-size = <64>;
+				cache-sets = <256>;
+				cache-size = <65536>;
+				cache-unified;
+				next-level-cache = <&l3>;
+			};
+		};
+
+		idle-states {
+			entry-method = "psci";
+
+			cpu_sleep_0: cpu-sleep-0 {
+				compatible = "arm,idle-state";
+				entry-latency-us = <75>;
+				exit-latency-us = <155>;
+				local-timer-stop;
+				min-residency-us = <50000>;
+				arm,psci-suspend-param = <0x0010000>;
+			};
+		};
+
+		l3: l3-cache0 {
+			compatible = "cache";
+			cache-level = <3>;
+			cache-line-size = <64>;
+			cache-sets = <256>;
+			cache-size = <262144>;
+			cache-unified;
+		};
+	};
+
+	optee {
+		compatible = "linaro,optee-tz";
+		method = "smc";
+	};
+
+	pmu {
+		compatible = "arm,cortex-a55-pmu";
+		interrupt-affinity = <&cpu0>;
+		interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
+	psci {
+		compatible = "arm,psci-1.0";
+		method = "smc";
+	};
+
+	soc {
+		compatible = "simple-bus";
+		ranges = <0 0 0 0xffffffff>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		sm-bus {
+			compatible = "simple-bus";
+			ranges;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			dma-ranges = <0xa0000000 0x00000000 0x10000000>;
+
+			sm_clk: sm_pinctrl: sm_rst: sm_chip: syscon@e5025000 {
+				compatible = "syna,sl2610-mcu-syscon", "syscon";
+				reg = <0xe5025000 0x1000>;
+				#clock-cells = <1>;
+				#reset-cells = <1>;
+				clocks = <&osc>;
+			};
+
+			sm_uart0: serial@e5030000 {
+				compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+				reg = <0xe5030000 0x100>;
+				clocks = <&sm_clk CLK_SER_UART0>, <&sm_clk CLK_CFG_UART0>;
+				clock-names = "baudclk", "apb_pclk";
+				interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
+				reg-shift = <2>;
+
+				status = "disabled";
+			};
+
+			sm_uart1: serial@e5031000 {
+				compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+				reg = <0xe5031000 0x100>;
+				clocks = <&sm_clk CLK_SER_UART1>, <&sm_clk CLK_CFG_UART1>;
+				clock-names = "baudclk", "apb_pclk";
+				interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
+				reg-shift = <2>;
+
+				status = "disabled";
+			};
+
+			sm_uart2: serial@e5032000 {
+				compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+				reg = <0xe5032000 0x100>;
+				clocks = <&sm_clk CLK_SER_UART2>, <&sm_clk CLK_CFG_UART2>;
+				clock-names = "baudclk", "apb_pclk";
+				interrupts = <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>;
+				reg-shift = <2>;
+
+				status = "disabled";
+			};
+
+			sm_uart3: serial@e5033000 {
+				compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+				reg = <0xe5033000 0x100>;
+				clocks = <&sm_clk CLK_SER_UART3>, <&sm_clk CLK_CFG_UART3>;
+				clock-names = "baudclk", "apb_pclk";
+				interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+				reg-shift = <2>;
+
+				status = "disabled";
+			};
+
+			sm_spi1: spi@e5034000 {
+				compatible = "syna,sl2610-spi", "snps,dw-apb-ssi";
+				reg = <0xe5034000 0x100>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_SER_SPIM>, <&sm_clk CLK_CFG_SPIM>;
+				clock-names = "ssi_clk", "pclk";
+				interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
+				num-cs = <4>;
+
+				status = "disabled";
+			};
+
+			sm_i2c0: i2c@e5035000 {
+				compatible = "syna,sl2610-i2c", "snps,designware-i2c";
+				reg = <0xe5035000 0x100>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_SER_I2CM0>, <&sm_clk CLK_CFG_I2CM0>;
+				clock-names = "ref", "pclk";
+				interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>;
+
+				status = "disabled";
+			};
+
+			sm_i2c1: i2c@e5036000 {
+				compatible = "syna,sl2610-i2c", "snps,designware-i2c";
+				reg = <0xe5036000 0x100>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_SER_I2CM1>, <&sm_clk CLK_CFG_I2CM1>;
+				clock-names = "ref", "pclk";
+				interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
+
+				status = "disabled";
+			};
+
+			sm_i3c0: i3c@e5037000 {
+				compatible = "syna,sl2610-i3c", "snps,dw-i3c-master-1.00a";
+				reg = <0xe5037000 0x1000>;
+				#address-cells = <3>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_SER_I3C>, <&sm_clk CLK_CFG_I3C>;
+				clock-names = "core", "apb";
+				interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>;
+				resets = <&sm_rst RST_SM_I3CSRST>, <&sm_rst RST_SM_I3CPRST>;
+
+				status = "disabled";
+			};
+
+			sm_gpio0: gpio@e5038000 {
+				compatible = "snps,dw-apb-gpio";
+				reg = <0xe5038000 0x400>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_CFG_GPIO>, <&sm_clk CLK_DEB_GPIO>;
+				clock-names = "bus", "db";
+
+				portc: gpio-port@0 {
+					compatible = "snps,dw-apb-gpio-port";
+					reg = <0>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					ngpios = <16>;
+				};
+			};
+
+			sm_gpio1: gpio@e5039000 {
+				compatible = "snps,dw-apb-gpio";
+				reg = <0xe5039000 0x400>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_CFG_GPIO>, <&sm_clk CLK_DEB_GPIO>;
+				clock-names = "bus", "db";
+
+				portd: gpio-port@0 {
+					compatible = "snps,dw-apb-gpio-port";
+					reg = <0>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					ngpios = <8>;
+				};
+			};
+
+			sm_gpio2: gpio@e503a000 {
+				compatible = "snps,dw-apb-gpio";
+				reg = <0xe503a000 0x400>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_CFG_GPIO>, <&sm_clk CLK_DEB_GPIO>;
+				clock-names = "bus", "db";
+
+				porte: gpio-port@0 {
+					compatible = "snps,dw-apb-gpio-port";
+					reg = <0>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					ngpios = <8>;
+				};
+			};
+
+			sm_gpio3: gpio@e503b000 {
+				compatible = "snps,dw-apb-gpio";
+				reg = <0xe503b000 0x400>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&sm_clk CLK_CFG_GPIO>, <&sm_clk CLK_DEB_GPIO>;
+				clock-names = "bus", "db";
+
+				portf: gpio-port@0 {
+					compatible = "snps,dw-apb-gpio-port";
+					reg = <0>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					ngpios = <8>;
+				};
+			};
+		};
+
+		aioclk: aviogbl: syscon@f7490000 {
+			compatible = "syna,sl2610-avio-syscon", "syscon";
+			reg = <0xf7490000 0x4000>;
+			clocks = <&osc>;
+		};
+
+		clk: pinctrl: rst: chip: syscon@f7e10000 {
+			compatible = "syna,sl2610-soc-syscon", "syscon";
+			reg = <0xf7e10000 0x10000>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			clocks = <&osc>;
+		};
+
+		cpuclk: cpu_wrap: syscon@f7e30000 {
+			compatible = "syna,sl2610-cpu-syscon", "syscon";
+			reg = <0xf7e30000 0x4000>;
+			#clock-cells = <1>;
+			clocks = <&osc>;
+			syna,gbl-syscon = <&chip>;
+		};
+
+		gic: interrupt-controller@f7e59000 {
+			compatible = "arm,gic-400";
+			reg = <0xf7e59000 0x1000>,
+			      <0xf7e5a000 0x2000>,
+			      <0xf7e5c000 0x2000>,
+			      <0xf7e5e000 0x2000>;
+			#interrupt-cells = <3>;
+			interrupt-controller;
+			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		};
+
+		soc_uart0: serial@f7f00000 {
+			compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+			reg = <0xf7f00000 0x100>;
+			clocks = <&clk CLK_APBUART0>;
+			interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+
+			status = "disabled";
+		};
+
+		soc_uart1: serial@f7f01000 {
+			compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+			reg = <0xf7f01000 0x100>;
+			clocks = <&clk CLK_APBUART1>;
+			interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+
+			status = "disabled";
+		};
+
+		soc_uart2: serial@f7f02000 {
+			compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+			reg = <0xf7f02000 0x100>;
+			clocks = <&clk CLK_APBUART2>;
+			interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+
+			status = "disabled";
+		};
+
+		soc_uart3: serial@f7f03000 {
+			compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+			reg = <0xf7f03000 0x100>;
+			clocks = <&clk CLK_APBUART3>;
+			interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+
+			status = "disabled";
+		};
+
+		soc_spi0: spi@f7f04000 {
+			compatible = "syna,sl2610-spi", "snps,dw-apb-ssi";
+			reg = <0xf7f04000 0x100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBSPI0>;
+			interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+			num-cs = <4>;
+
+			status = "disabled";
+		};
+
+		soc_i2c0: i2c@f7f05000 {
+			compatible = "syna,sl2610-i2c", "snps,designware-i2c";
+			reg = <0xf7f05000 0x100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBI2C0>;
+			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+
+			status = "disabled";
+		};
+
+		soc_i2c1: i2c@f7f06000 {
+			compatible = "syna,sl2610-i2c", "snps,designware-i2c";
+			reg = <0xf7f06000 0x100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBI2C1>;
+			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+
+			status = "disabled";
+		};
+
+		soc_gpio0: gpio@f7f07000 {
+			compatible = "snps,dw-apb-gpio";
+			reg = <0xf7f07000 0x400>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBGPIO>;
+			clock-names = "bus";
+
+			porta: gpio-port@0 {
+				compatible = "snps,dw-apb-gpio-port";
+				reg = <0>;
+				#gpio-cells = <2>;
+				#interrupt-cells = <2>;
+				gpio-controller;
+				interrupt-controller;
+				interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
+				ngpios = <32>;
+			};
+		};
+
+		soc_spi1: spi@f7f0b000 {
+			compatible = "syna,sl2610-spi", "snps,dw-apb-ssi";
+			reg = <0xf7f0b000 0x100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBSPI1>;
+			interrupts = <GIC_SPI 199 IRQ_TYPE_LEVEL_HIGH>;
+			num-cs = <4>;
+
+			status = "disabled";
+		};
+
+		soc_spi2: spi@f7f0c000 {
+			compatible = "syna,sl2610-spi", "snps,dw-apb-ssi";
+			reg = <0xf7f0c000 0x100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBSPI2>;
+			interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
+			num-cs = <4>;
+
+			status = "disabled";
+		};
+
+		soc_spi3: spi@f7f0d000 {
+			compatible = "syna,sl2610-spi", "snps,dw-apb-ssi";
+			reg = <0xf7f0d000 0x100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBSPI3>;
+			interrupts = <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
+			num-cs = <4>;
+
+			status = "disabled";
+		};
+
+		soc_gpio1: gpio@f7f0e000 {
+			compatible = "snps,dw-apb-gpio";
+			reg = <0xf7f0e000 0x400>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk CLK_APBGPIO>;
+			clock-names = "bus";
+
+			portb: gpio-port@0 {
+				compatible = "snps,dw-apb-gpio-port";
+				reg = <0>;
+				#gpio-cells = <2>;
+				#interrupt-cells = <2>;
+				gpio-controller;
+				interrupt-controller;
+				interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
+				ngpios = <32>;
+			};
+		};
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+	};
+};
arch/arm64/boot/dts/synaptics/sl2613.dtsi new file +12 -0
new file mode 100644
index 000000000000..379809901677
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+#include "sl2611.dtsi"
+
+/ {
+	compatible = "syna,sl2613";
+};
arch/arm64/boot/dts/synaptics/sl2615.dtsi new file +46 -0

46 lines not on this page · raw message

arch/arm64/boot/dts/synaptics/sl2617.dtsi new file +46 -0

46 lines not on this page · raw message

arch/arm64/boot/dts/synaptics/sl2619.dtsi new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.55.0
#21 lore raw

Re: [PATCH v4 12/13] arm64: dts: synaptics: add SL2610 family SoCs

Thank you for your contribution! Sashiko AI review found 7 potential issues to consider: - [Medium] arm64: dts: synaptics: missing clock-output-names on clock-osc node - [Medium] arm64: dts…

Thank you for your contribution! Sashiko AI review found 7 potential issues to consider:
- [Medium] arm64: dts: synaptics: missing clock-output-names on clock-osc node
- [Medium] arm64: dts: synaptics: missing sticky resets on SL2610 MCU UART nodes
- [Low] arm64: dts: synaptics: optee node placed under root instead of /firmware
- [Low] arm64: dts: synaptics: 4-CPU PPI mask used on 1-core and 2-core SL2610 SoCs
- [Low] arm64: dts: synaptics: non-generic sm-bus node name in sl2611.dtsi
- [Low] arm64: dts: synaptics: duplicated cpu1 and pmu nodes in sl2615/17/19.dtsi
- [Low] arm64: dts: synaptics: missing root compatible property in sl2619.dtsi
--

commit 9e9c29c7ff9d5fff145a2b154951b9695d30488a
Author: Jisheng Zhang <[email protected]>

arm64: dts: synaptics: add SL2610 family SoCs

This commit adds Devicetree source files for the Synaptics SL2610 family SoCs (SL2611, SL2613, SL2615, SL2617, and SL2619), describing their CPUs, GIC, system controllers, and on-chip peripherals.

Quoted 6 lines
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +0 -0
new file mode 100644
index 0000000000000..03859bae07bda
@@ -0,0 +1,466 @@

[ ... ]

arch/arm64/boot/dts/synaptics/sl2611.dtsi line 21

Quoted 4 lines
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +4 -0
+	osc: clock-osc {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+	};

[Severity: Medium]
Does this node need clock-output-names = "osc"?

Without clock-output-names, _of_fixed_clk_setup() registers the clock under the node name ("clock-osc"), because the DTS label is discarded by dtc.

In drivers/clk/berlin/clk-sl2610.c, ge_ptp_refclk_parent_names[] looks up parent index 0 by the literal name "osc". Without a matching clock name, CLK_GE0_PTP_REF and CLK_GE1_PTP_REF remain orphaned at 0 Hz and sl_clk_determine_rate() returns -EINVAL when parent 0 is selected.

[ ... ]

arch/arm64/boot/dts/synaptics/sl2611.dtsi line 78

Quoted 4 lines
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +4 -0
+	optee {
+		compatible = "linaro,optee-tz";
+		method = "smc";
+	};

[Severity: Low]
Should this optee node live under a /firmware container node instead of directly under the root node?

Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml places optee under /firmware, and of_platform_default_populate_init() populates /firmware children ahead of general root devices.

[ ... ]

arch/arm64/boot/dts/synaptics/sl2611.dtsi line 102

Quoted 6 lines
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +6 -0
+		sm-bus {
+			compatible = "simple-bus";
+			ranges;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			dma-ranges = <0xa0000000 0x00000000 0x10000000>;

[Severity: Low]
This isn't a bug, but Devicetree convention prefers generic node names such as bus (for example sm_bus: bus) rather than subsystem-prefixed names like sm-bus.

[ ... ]

arch/arm64/boot/dts/synaptics/sl2611.dtsi line 121

Quoted 10 lines
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +10 -0
+			sm_uart0: serial@e5030000 {
+				compatible = "syna,sl2610-uart", "snps,dw-apb-uart";
+				reg = <0xe5030000 0x100>;
+				clocks = <&sm_clk CLK_SER_UART0>, <&sm_clk CLK_CFG_UART0>;
+				clock-names = "baudclk", "apb_pclk";
+				interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
+				reg-shift = <2>;
+
+				status = "disabled";
+			};

[Severity: Medium]
Are sm_uart0 through sm_uart3 missing their resets properties for the sticky PRST and SRST lines in sm_rst?

drivers/reset/reset-sl2610.c defines RST_SM_UART{0..3}PRST and SRST in SL2610_SMGBL_STICKYRST0, and commit ac04a6daa030 ("dt-bindings: serial:
snps-dw-apb-uart: Add Synaptics sl2610 uart") allowed two resets for syna,sl2610-uart. Sibling sm_i3c0 also declares its pair from sm_rst.

Without resets, dw8250_probe() cannot deassert them, so any MCU UART left asserted in reset by hardware defaults or firmware (such as non-console ports like sm_uart1) will fail to operate or fault on register access.

[ ... ]

Quoted 10 lines
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +10 -0
+		gic: interrupt-controller@f7e59000 {
+			compatible = "arm,gic-400";
+			reg = <0xf7e59000 0x1000>,
+			      <0xf7e5a000 0x2000>,
+			      <0xf7e5c000 0x2000>,
+			      <0xf7e5e000 0x2000>;
+			#interrupt-cells = <3>;
+			interrupt-controller;
+			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		};

[ ... ]

arch/arm64/boot/dts/synaptics/sl2611.dtsi line 465

Quoted 7 lines
arch/arm64/boot/dts/synaptics/sl2611.dtsi new file +7 -0
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+	};

[Severity: Low]
Should these PPI interrupts use GIC_CPU_MASK_SIMPLE(1) here and GIC_CPU_MASK_SIMPLE(2) in the dual-core SoC files instead of a 4-CPU mask?

sl2611 and sl2613 are single-core SoCs and sl2615, sl2617, and sl2619 are dual-core. While Linux masks off bits [15:8] in gic_irq_domain_translate(), other DT consumers receive an inaccurate 4-CPU PPI mask.

[ ... ]

Quoted 6 lines
arch/arm64/boot/dts/synaptics/sl2617.dtsi new file +0 -0
new file mode 100644
index 0000000000000..17f8ea9f2a44b
@@ -0,0 +1,46 @@

[ ... ]

Quoted 23 lines
arch/arm64/boot/dts/synaptics/sl2617.dtsi new file +23 -0
+	cpus {
+		cpu1: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a55";
+			reg = <0x100>;
+			cpu-idle-states = <&cpu_sleep_0>;
+			d-cache-line-size = <64>;
+			d-cache-sets = <128>;
+			d-cache-size = <32768>;
+			enable-method = "psci";
+			i-cache-line-size = <64>;
+			i-cache-sets = <128>;
+			i-cache-size = <32768>;
+			next-level-cache = <&l2_1>;
+
+			l2_1: l2-cache {
+				compatible = "cache";
+				cache-level = <2>;
+				cache-line-size = <64>;
+				cache-sets = <256>;
+				cache-size = <65536>;
+				cache-unified;
+				next-level-cache = <&l3>;

arch/arm64/boot/dts/synaptics/sl2617.dtsi

Quoted 10 lines
arch/arm64/boot/dts/synaptics/sl2617.dtsi new file +10 -0
+			};
+		};
+	};
+
+	pmu {
+		interrupt-affinity = <&cpu0>,
+				     <&cpu1>;
+		interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+	};

[Severity: Low]
Can sl2617.dtsi and sl2619.dtsi include sl2615.dtsi (or a shared dual-core dtsi) and override only the root compatible property, the way sl2613.dtsi includes sl2611.dtsi?

Right now the same cpu1, l2_1, and pmu definitions are duplicated verbatim across sl2615.dtsi, sl2617.dtsi, and sl2619.dtsi.

Quoted 6 lines
arch/arm64/boot/dts/synaptics/sl2619.dtsi new file +0 -0
new file mode 100644
index 0000000000000..6539c5a3dce04
@@ -0,0 +1,44 @@

[ ... ]

arch/arm64/boot/dts/synaptics/sl2619.dtsi

Quoted 4 lines
arch/arm64/boot/dts/synaptics/sl2619.dtsi new file +4 -0
+#include "sl2613.dtsi"
+
+/ {
+	cpus {

[Severity: Low]
Is compatible = "syna,sl2619" missing from the root node here?

Because sl2619.dtsi includes sl2613.dtsi without overriding compatible, it inherits "syna,sl2613" instead of "syna,sl2619", unlike sl2615.dtsi and sl2617.dtsi.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
author maintainer
#22 lore raw

PATCH v4 13/13 arm64: dts: synaptics: add SL2610 family RDK boards

In reply to Jisheng Zhang

Add device trees for the SL2611, SL2613, SL2615, SL2617 and SL2619 reference development kits. Share their common console, memory, pin configuration and regulator descriptions and enable the populated peripherals.

---
 arch/arm64/boot/dts/synaptics/Makefile        |   5 +
 arch/arm64/boot/dts/synaptics/sl2611-rdk.dts  |  16 ++
 arch/arm64/boot/dts/synaptics/sl2613-rdk.dts  |  16 ++
 arch/arm64/boot/dts/synaptics/sl2615-rdk.dts  |  16 ++
 arch/arm64/boot/dts/synaptics/sl2617-rdk.dts  |  16 ++
 arch/arm64/boot/dts/synaptics/sl2619-rdk.dts  |  16 ++
 .../boot/dts/synaptics/sl261x-rdk-common.dtsi | 150 ++++++++++++++++++
 7 files changed, 235 insertions(+)
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2611-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2613-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2615-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2617-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl2619-rdk.dts
 create mode 100644 arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi
arch/arm64/boot/dts/synaptics/Makefile +5 -0
index de71ddda6835..810d0d08c2de 100644
@@ -2,3 +2,8 @@
 # Berlin SoC Family
 dtb-$(CONFIG_ARCH_BERLIN) += berlin4ct-dmp.dtb
 dtb-$(CONFIG_ARCH_BERLIN) += berlin4ct-stb.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += sl2611-rdk.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += sl2613-rdk.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += sl2615-rdk.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += sl2617-rdk.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += sl2619-rdk.dtb
arch/arm64/boot/dts/synaptics/sl2611-rdk.dts new file +16 -0
new file mode 100644
index 000000000000..585872307834
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "sl2611.dtsi"
+#include "sl261x-rdk-common.dtsi"
+
+/ {
+	model = "Synaptics SL2611 RDK";
+	compatible = "syna,sl2611-rdk", "syna,sl2611";
+};
arch/arm64/boot/dts/synaptics/sl2613-rdk.dts new file +16 -0
new file mode 100644
index 000000000000..de75c9fab6a2
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "sl2613.dtsi"
+#include "sl261x-rdk-common.dtsi"
+
+/ {
+	model = "Synaptics SL2613 RDK";
+	compatible = "syna,sl2613-rdk", "syna,sl2613";
+};
arch/arm64/boot/dts/synaptics/sl2615-rdk.dts new file +16 -0
new file mode 100644
index 000000000000..ae03638a3a53
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "sl2615.dtsi"
+#include "sl261x-rdk-common.dtsi"
+
+/ {
+	model = "Synaptics SL2615 RDK";
+	compatible = "syna,sl2615-rdk", "syna,sl2615";
+};
arch/arm64/boot/dts/synaptics/sl2617-rdk.dts new file +16 -0
new file mode 100644
index 000000000000..ba4ea21ac505
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "sl2617.dtsi"
+#include "sl261x-rdk-common.dtsi"
+
+/ {
+	model = "Synaptics SL2617 RDK";
+	compatible = "syna,sl2617-rdk", "syna,sl2617";
+};
arch/arm64/boot/dts/synaptics/sl2619-rdk.dts new file +16 -0
new file mode 100644
index 000000000000..58901ac2a050
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "sl2619.dtsi"
+#include "sl261x-rdk-common.dtsi"
+
+/ {
+	model = "Synaptics SL2619 RDK";
+	compatible = "syna,sl2619-rdk", "syna,sl2619";
+};
arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi new file +150 -0

150 lines not on this page · raw message

Signature · 1 line
2.55.0
#23 lore raw

Re: [PATCH v4 13/13] arm64: dts: synaptics: add SL2610 family RDK boards

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] arm64: dts: synaptics: sl261x-rdk omits reserved-memory for TrustZone RAM - [Low] arm64: dts…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] arm64: dts: synaptics: sl261x-rdk omits reserved-memory for TrustZone RAM
- [Low] arm64: dts: synaptics: deprecated cpu0-supply used in sl261x-rdk-common.dtsi
- [Low] arm64: dts: synaptics: unused linux-event-codes.h include in sl261x-rdk-common.dtsi
--

commit e756e60b82640c39699865a0df9714da4784bfde
Author: Jisheng Zhang <[email protected]>

arm64: dts: synaptics: add SL2610 family RDK boards

This commit adds devicetree files for the SL2611, SL2613, SL2615, SL2617 and SL2619 RDK boards along with a shared sl261x-rdk-common.dtsi describing their common memory, console, pinctrl, regulator and peripheral setup.

Quoted 6 lines
arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi new file +0 -0
new file mode 100644
index 0000000000000..bad11a9066ccb

arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi line 9

Quoted 9 lines
arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi new file +9 -0
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2025 Synaptics Incorporated
+ *
+ * Author: Jisheng Zhang <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>

[Severity: Low]
Is dt-bindings/input/linux-event-codes.h needed here? Neither sl261x-rdk-common.dtsi nor any of the board dts files that include it defines input devices or uses symbols from this header.

[ ... ]

arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi line 40

Quoted 5 lines
arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi new file +5 -0
+	cpus {
+		cpu@0 {
+			cpu0-supply = <&vcore>;
+		};
+	};

[Severity: Low]
Should this use cpu-supply instead of cpu0-supply?

Documentation/devicetree/bindings/arm/cpus.yaml marks cpu0-supply as deprecated in favor of cpu-supply. drivers/cpufreq/cpufreq-dt.c only checks cpu0-supply on CPU 0 as a legacy fallback, and dual-core variants (SL2615, SL2617, SL2619) define cpu1 where only cpu-supply is recognized.

arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi line 45

Quoted 5 lines
arch/arm64/boot/dts/synaptics/sl261x-rdk-common.dtsi new file +5 -0
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x00000000 0x0 0x80000000>;
+	};

[Severity: Medium]
As reported by Richard GENOUD on v2 [1], should TrustZone secure RAM be excluded here via a reserved-memory no-map node, or is the bootloader expected to fix up memory@0 at runtime?

sl2611.dtsi declares an optee node (linaro,optee-tz), and existing Synaptics boards like berlin4ct-dmp.dts statically exclude firmware memory. If the bootloader passes this DTB without trimming memory@0 or adding a reserved-memory no-map node, Linux can map secure RAM and abort at boot.

[1] https://lore.kernel.org/r/[email protected]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
#24 lore raw
In reply to Jisheng Zhang
Sashiko has finished reviewing this 13-patch series:

Sashiko has finished reviewing this 13-patch series:

- Patches 1, 2, and 11: no issues found.
- Patch 3 ("pinctrl: berlin: enable module build support"): 3 potential issues (1 Medium, 2 Low)
- Patch 4 ("pinctrl: berlin: add optional pinconf support"): 6 potential issues (3 Medium, 3 Low)
- Patch 5 ("dt-bindings: soc: synaptics: add SL2610 system contr..."): 5 potential issues (3 Medium, 2 Low)
- Patch 6 ("mfd: synaptics: add SL2610 system controller support"): 5 potential issues (1 Medium, 4 Low)
- Patch 7 ("reset: add Synaptics SL2610 reset controller support"): 2 potential issues (2 Medium)
- Patch 8 ("pinctrl: berlin: add Synaptics SL2610 pin controller..."): 5 potential issues (1 High, 2 Medium, 2 Low)
- Patch 9 ("clk: berlin: add Synaptics clock controller helpers"): 8 potential issues (1 High, 6 Medium, 1 Low)
- Patch 10 ("clk: berlin: add Synaptics SL2610 clocks and PLLs"): 8 potential issues (4 Medium, 4 Low)
- Patch 12 ("arm64: dts: synaptics: add SL2610 family SoCs"): 7 potential issues (2 Medium, 5 Low)
- Patch 13 ("arm64: dts: synaptics: add SL2610 family RDK boards"): 3 potential issues (1 Medium, 2 Low)

Detailed reviews have been sent as separate replies to patches 3-10, 12, and 13.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]