Skip to contentSkip to conversation

dt-bindings: reset: Add PDC reset binding for SDM845 SoCs

PATCH Superseded Sibi Sankar 5 participants 21 messages Jul 27, 2018 – Aug 21, 2018

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 dt-bindings: reset: Add PDC reset binding for SDM845 SoCs

Add SDM845 PDC (Power Domain Controller) reset controller binding

---
 .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
 include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt
 create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +52 -0
new file mode 100644
index 000000000000..85e159962e08
@@ -0,0 +1,52 @@
+PDC Reset Controller
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {
+	compatible = "qcom,sdm845-pdc-global";
+	reg = <0xb2e0000 0x20000>;
+	#reset-cells = <1>;
+};
+
+PDC reset clients
+======================================
+
+Device nodes that need access to reset lines should
+specify them as a reset phandle in their corresponding node as
+specified in reset.txt.
+
+For list of all valid reset indicies see
+<dt-bindings/reset/qcom,sdm845-pdc.h>
+
+Example:
+
+modem-pil@4080000 {
+	...
+
+	resets = <&pdc_reset PDC_MODEM_SYNC_RESET>;
+	reset-names = "pdc_restart";
+
+	...
+};
include/dt-bindings/reset/qcom,sdm845-pdc.h new file +20 -0
new file mode 100644
index 000000000000..53c37f9c319a
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DT_BINDINGS_RESET_PDC_SDM_845_H
+#define _DT_BINDINGS_RESET_PDC_SDM_845_H
+
+#define PDC_APPS_SYNC_RESET	0
+#define PDC_SP_SYNC_RESET	1
+#define PDC_AUDIO_SYNC_RESET	2
+#define PDC_SENSORS_SYNC_RESET	3
+#define PDC_AOP_SYNC_RESET	4
+#define PDC_DEBUG_SYNC_RESET	5
+#define PDC_GPU_SYNC_RESET	6
+#define PDC_DISPLAY_SYNC_RESET	7
+#define PDC_COMPUTE_SYNC_RESET	8
+#define PDC_MODEM_SYNC_RESET	9
+
+#endif
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH 2/4 reset: qcom: PDC (Power Domain Controller) reset controller

Add reset controller for SDM845 SoC to control reset signals provided by PDC for Modem, Compute, Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS

---
 drivers/reset/Kconfig          |   9 +++
 drivers/reset/Makefile         |   1 +
 drivers/reset/reset-qcom-pdc.c | 139 +++++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+)
 create mode 100644 drivers/reset/reset-qcom-pdc.c
drivers/reset/Kconfig +9 -0
index 13d28fdbdbb5..5344e202a630 100644
@@ -98,6 +98,15 @@ config RESET_QCOM_AOSS
 	  reset signals provided by AOSS for Modem, Venus, ADSP,
 	  GPU, Camera, Wireless, Display subsystem. Otherwise, say N.
 
+config RESET_QCOM_PDC
+	bool "Qcom PDC Reset Driver"
+	depends on ARCH_QCOM || COMPILE_TEST
+	help
+	  This enables the PDC (Power Domain Controller) reset driver
+	  for Qualcomm Technologies Inc SDM845 SoCs. Say Y if you want
+	  to control reset signals provided by PDC for Modem, Compute,
+	  Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS.
+
 config RESET_SIMPLE
 	bool "Simple Reset Controller Driver" if COMPILE_TEST
 	default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED
drivers/reset/Makefile +1 -0
index 4243c38228e2..d08e8b90046a 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o
 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
 obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
 obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
+obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o
 obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
 obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o
 obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
drivers/reset/reset-qcom-pdc.c new file +139 -0

139 lines not on this page · raw message

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#2 lore raw

Re: [PATCH 2/4] reset: qcom: PDC (Power Domain Controller) reset controller

Quoted 109 lines · Sibi Sankar

Add reset controller for SDM845 SoC to control reset signals provided by PDC for Modem, Compute, Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS

---
 drivers/reset/Kconfig          |   9 +++
 drivers/reset/Makefile         |   1 +
 drivers/reset/reset-qcom-pdc.c | 139 +++++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+)
 create mode 100644 drivers/reset/reset-qcom-pdc.c
drivers/reset/Kconfig +9 -0
index 13d28fdbdbb5..5344e202a630 100644
@@ -98,6 +98,15 @@ config RESET_QCOM_AOSS
 	  reset signals provided by AOSS for Modem, Venus, ADSP,
 	  GPU, Camera, Wireless, Display subsystem. Otherwise, say N.
 
+config RESET_QCOM_PDC
+	bool "Qcom PDC Reset Driver"
+	depends on ARCH_QCOM || COMPILE_TEST
+	help
+	  This enables the PDC (Power Domain Controller) reset driver
+	  for Qualcomm Technologies Inc SDM845 SoCs. Say Y if you want
+	  to control reset signals provided by PDC for Modem, Compute,
+	  Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS.
+
 config RESET_SIMPLE
 	bool "Simple Reset Controller Driver" if COMPILE_TEST
 	default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED
drivers/reset/Makefile +1 -0
index 4243c38228e2..d08e8b90046a 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o
 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
 obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
 obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
+obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o
 obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
 obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o
 obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
drivers/reset/reset-qcom-pdc.c new file +59 -0
new file mode 100644
index 000000000000..64a0041e3452
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/regmap.h>
+#include <linux/of_device.h>
+#include <dt-bindings/reset/qcom,sdm845-pdc.h>
+
+struct qcom_pdc_reset_map {
+	u8 bit;
+};
+
+struct qcom_pdc_desc {
+	const struct regmap_config *config;
+	const struct qcom_pdc_reset_map *resets;
+	size_t num_resets;
+};
+
+struct qcom_pdc_reset_data {
+	struct reset_controller_dev rcdev;
+	struct regmap *regmap;
+	const struct qcom_pdc_desc *desc;
+};
+
+static const struct regmap_config sdm845_pdc_regmap_config = {
+	.name		= "pdc-reset",
+	.reg_bits	= 32,
+	.reg_stride	= 4,
+	.val_bits	= 32,
+	.max_register	= 0x20000,
+	.fast_io	= true,
+};
+
+static const struct qcom_pdc_reset_map sdm845_pdc_resets[] = {
+	[PDC_APPS_SYNC_RESET] = {0},
+	[PDC_SP_SYNC_RESET] = {1},
+	[PDC_AUDIO_SYNC_RESET] = {2},
+	[PDC_SENSORS_SYNC_RESET] = {3},
+	[PDC_AOP_SYNC_RESET] = {4},
+	[PDC_DEBUG_SYNC_RESET] = {5},
+	[PDC_GPU_SYNC_RESET] = {6},
+	[PDC_DISPLAY_SYNC_RESET] = {7},
+	[PDC_COMPUTE_SYNC_RESET] = {8},
+	[PDC_MODEM_SYNC_RESET] = {9},
+};
+
+static const struct qcom_pdc_desc sdm845_pdc_desc = {
+	.config = &sdm845_pdc_regmap_config,
+	.resets = sdm845_pdc_resets,
+	.num_resets = ARRAY_SIZE(sdm845_pdc_resets),
+};
+
+static inline struct qcom_pdc_reset_data *to_qcom_pdc_reset_data(
+				struct reset_controller_dev *rcdev)
+{

drivers/reset/reset-qcom-pdc.c line 69

Quoted 10 lines
drivers/reset/reset-qcom-pdc.c new file +10 -0
+	return container_of(rcdev, struct qcom_pdc_reset_data, rcdev);
+}
+
+static int qcom_pdc_control_assert(struct reset_controller_dev *rcdev,
+					unsigned long idx)
+{
+	struct qcom_pdc_reset_data *data = to_qcom_pdc_reset_data(rcdev);
+	const struct qcom_pdc_reset_map *map = &data->desc->resets[idx];
+
+	return regmap_update_bits(data->regmap, 0x100,

Does this register have a name? If so, a #define would be preferable. Otherwise this driver looks fine to me.

Quoted 60 lines
drivers/reset/reset-qcom-pdc.c new file +60 -0
+					BIT(map->bit), BIT(map->bit));
+}
+
+static int qcom_pdc_control_deassert(struct reset_controller_dev *rcdev,
+					unsigned long idx)
+{
+	struct qcom_pdc_reset_data *data = to_qcom_pdc_reset_data(rcdev);
+	const struct qcom_pdc_reset_map *map = &data->desc->resets[idx];
+
+	return regmap_update_bits(data->regmap, 0x100, BIT(map->bit), 0);
+}
+
+static const struct reset_control_ops qcom_pdc_reset_ops = {
+	.assert = qcom_pdc_control_assert,
+	.deassert = qcom_pdc_control_deassert,
+};
+
+static int qcom_pdc_reset_probe(struct platform_device *pdev)
+{
+	struct qcom_pdc_reset_data *data;
+	struct device *dev = &pdev->dev;
+	const struct qcom_pdc_desc *desc;
+	void __iomem *base;
+	struct resource *res;
+
+	desc = of_device_get_match_data(dev);
+	if (!desc)
+		return -EINVAL;
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	data->desc = desc;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	data->regmap = devm_regmap_init_mmio(dev, base, desc->config);
+	if (IS_ERR(data->regmap)) {
+		dev_err(dev, "Unable to get pdc-global regmap");
+		return PTR_ERR(data->regmap);
+	}
+
+	data->rcdev.owner = THIS_MODULE;
+	data->rcdev.ops = &qcom_pdc_reset_ops;
+	data->rcdev.nr_resets = desc->num_resets;
+	data->rcdev.of_node = dev->of_node;
+
+	return devm_reset_controller_register(dev, &data->rcdev);
+}
+
+static const struct of_device_id qcom_pdc_reset_of_match[] = {
+	{ .compatible = "qcom,sdm845-pdc-global", .data = &sdm845_pdc_desc },
+	{}
+};
+
+static struct platform_driver qcom_pdc_reset_driver = {
+	.probe = qcom_pdc_reset_probe,

drivers/reset/reset-qcom-pdc.c line 139

Quoted 10 lines
drivers/reset/reset-qcom-pdc.c new file +10 -0
+	.driver = {
+		.name = "qcom_pdc_reset",
+		.of_match_table = qcom_pdc_reset_of_match,
+	},
+};
+
+builtin_platform_driver(qcom_pdc_reset_driver);
+
+MODULE_DESCRIPTION("Qualcomm PDC Reset Driver");
+MODULE_LICENSE("GPL v2");

regards
Philipp

author
#3 lore raw

Re: [PATCH 2/4] reset: qcom: PDC (Power Domain Controller) reset controller

Hi Philipp,
Thanks for the review!

Quoted 115 lines · Philipp Zabel
Quoted 114 lines · Sibi Sankar

Add reset controller for SDM845 SoC to control reset signals provided by PDC for Modem, Compute, Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS

---
  drivers/reset/Kconfig          |   9 +++
  drivers/reset/Makefile         |   1 +
  drivers/reset/reset-qcom-pdc.c | 139 +++++++++++++++++++++++++++++++++
  3 files changed, 149 insertions(+)

create mode 100644 drivers/reset/reset-qcom-pdc.c

drivers/reset/Kconfig +9 -0
index 13d28fdbdbb5..5344e202a630 100644
@@ -98,6 +98,15 @@ config RESET_QCOM_AOSS
  	  reset signals provided by AOSS for Modem, Venus, ADSP,
  	  GPU, Camera, Wireless, Display subsystem. Otherwise, say N.
 
+config RESET_QCOM_PDC
+	bool "Qcom PDC Reset Driver"
+	depends on ARCH_QCOM || COMPILE_TEST
+	help
+	  This enables the PDC (Power Domain Controller) reset driver
+	  for Qualcomm Technologies Inc SDM845 SoCs. Say Y if you want
+	  to control reset signals provided by PDC for Modem, Compute,
+	  Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS.
+
  config RESET_SIMPLE
  	bool "Simple Reset Controller Driver" if COMPILE_TEST
  	default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED
drivers/reset/Makefile +1 -0
index 4243c38228e2..d08e8b90046a 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o
  obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
  obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
  obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
+obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o
  obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
  obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o
  obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
drivers/reset/reset-qcom-pdc.c new file +64 -0
new file mode 100644
index 000000000000..64a0041e3452
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/regmap.h>
+#include <linux/of_device.h>
+#include <dt-bindings/reset/qcom,sdm845-pdc.h>
+
+struct qcom_pdc_reset_map {
+	u8 bit;
+};
+
+struct qcom_pdc_desc {
+	const struct regmap_config *config;
+	const struct qcom_pdc_reset_map *resets;
+	size_t num_resets;
+};
+
+struct qcom_pdc_reset_data {
+	struct reset_controller_dev rcdev;
+	struct regmap *regmap;
+	const struct qcom_pdc_desc *desc;
+};
+
+static const struct regmap_config sdm845_pdc_regmap_config = {
+	.name		= "pdc-reset",
+	.reg_bits	= 32,
+	.reg_stride	= 4,
+	.val_bits	= 32,
+	.max_register	= 0x20000,
+	.fast_io	= true,
+};
+
+static const struct qcom_pdc_reset_map sdm845_pdc_resets[] = {
+	[PDC_APPS_SYNC_RESET] = {0},
+	[PDC_SP_SYNC_RESET] = {1},
+	[PDC_AUDIO_SYNC_RESET] = {2},
+	[PDC_SENSORS_SYNC_RESET] = {3},
+	[PDC_AOP_SYNC_RESET] = {4},
+	[PDC_DEBUG_SYNC_RESET] = {5},
+	[PDC_GPU_SYNC_RESET] = {6},
+	[PDC_DISPLAY_SYNC_RESET] = {7},
+	[PDC_COMPUTE_SYNC_RESET] = {8},
+	[PDC_MODEM_SYNC_RESET] = {9},
+};
+
+static const struct qcom_pdc_desc sdm845_pdc_desc = {
+	.config = &sdm845_pdc_regmap_config,
+	.resets = sdm845_pdc_resets,
+	.num_resets = ARRAY_SIZE(sdm845_pdc_resets),
+};
+
+static inline struct qcom_pdc_reset_data *to_qcom_pdc_reset_data(
+				struct reset_controller_dev *rcdev)
+{
+	return container_of(rcdev, struct qcom_pdc_reset_data, rcdev);
+}
+
+static int qcom_pdc_control_assert(struct reset_controller_dev *rcdev,
+					unsigned long idx)
Quoted 9 lines

drivers/reset/reset-qcom-pdc.c line 69

Quoted 5 lines
drivers/reset/reset-qcom-pdc.c new file +5 -0
+{
+	struct qcom_pdc_reset_data *data = to_qcom_pdc_reset_data(rcdev);
+	const struct qcom_pdc_reset_map *map = &data->desc->resets[idx];
+
+	return regmap_update_bits(data->regmap, 0x100,

Does this register have a name? If so, a #define would be preferable. Otherwise this driver looks fine to me.

Yes will had a separate #define for it.

Quoted 74 lines
Quoted 60 lines
drivers/reset/reset-qcom-pdc.c new file +60 -0
+					BIT(map->bit), BIT(map->bit));
+}
+
+static int qcom_pdc_control_deassert(struct reset_controller_dev *rcdev,
+					unsigned long idx)
+{
+	struct qcom_pdc_reset_data *data = to_qcom_pdc_reset_data(rcdev);
+	const struct qcom_pdc_reset_map *map = &data->desc->resets[idx];
+
+	return regmap_update_bits(data->regmap, 0x100, BIT(map->bit), 0);
+}
+
+static const struct reset_control_ops qcom_pdc_reset_ops = {
+	.assert = qcom_pdc_control_assert,
+	.deassert = qcom_pdc_control_deassert,
+};
+
+static int qcom_pdc_reset_probe(struct platform_device *pdev)
+{
+	struct qcom_pdc_reset_data *data;
+	struct device *dev = &pdev->dev;
+	const struct qcom_pdc_desc *desc;
+	void __iomem *base;
+	struct resource *res;
+
+	desc = of_device_get_match_data(dev);
+	if (!desc)
+		return -EINVAL;
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	data->desc = desc;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	data->regmap = devm_regmap_init_mmio(dev, base, desc->config);
+	if (IS_ERR(data->regmap)) {
+		dev_err(dev, "Unable to get pdc-global regmap");
+		return PTR_ERR(data->regmap);
+	}
+
+	data->rcdev.owner = THIS_MODULE;
+	data->rcdev.ops = &qcom_pdc_reset_ops;
+	data->rcdev.nr_resets = desc->num_resets;
+	data->rcdev.of_node = dev->of_node;
+
+	return devm_reset_controller_register(dev, &data->rcdev);
+}
+
+static const struct of_device_id qcom_pdc_reset_of_match[] = {
+	{ .compatible = "qcom,sdm845-pdc-global", .data = &sdm845_pdc_desc },
+	{}
+};
+
+static struct platform_driver qcom_pdc_reset_driver = {
+	.probe = qcom_pdc_reset_probe,

drivers/reset/reset-qcom-pdc.c line 139

Quoted 10 lines
drivers/reset/reset-qcom-pdc.c new file +10 -0
+	.driver = {
+		.name = "qcom_pdc_reset",
+		.of_match_table = qcom_pdc_reset_of_match,
+	},
+};
+
+builtin_platform_driver(qcom_pdc_reset_driver);
+
+MODULE_DESCRIPTION("Qualcomm PDC Reset Driver");
+MODULE_LICENSE("GPL v2");

regards
Philipp

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc, is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

Re: [PATCH 2/4] reset: qcom: PDC (Power Domain Controller) reset controller

In reply to Sibi Sankar
Quoted 17 lines · Sibi Sankar

Add reset controller for SDM845 SoC to control reset signals provided by PDC for Modem, Compute, Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS

---
 drivers/reset/Kconfig          |   9 +++
 drivers/reset/Makefile         |   1 +
 drivers/reset/reset-qcom-pdc.c | 139 +++++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+)
 create mode 100644 drivers/reset/reset-qcom-pdc.c
drivers/reset/Kconfig +0 -0
index 13d28fdbdbb5..5344e202a630 100644

drivers/reset/Kconfig config RESET_QCOM_AOSS · line 102

Quoted 5 lines
drivers/reset/Kconfig +2 -0
@@ -98,6 +98,15 @@ config RESET_QCOM_AOSS
 	  reset signals provided by AOSS for Modem, Venus, ADSP,
 	  GPU, Camera, Wireless, Display subsystem. Otherwise, say N.
 
+config RESET_QCOM_PDC
+	bool "Qcom PDC Reset Driver"

"Qualcomm"

And I do not see a strong reason for this not being tristate, the consumers we've talked about so far can all be modules.

drivers/reset/Kconfig config RESET_QCOM_AOSS · line 109

Quoted 7 lines
drivers/reset/Kconfig +7 -0
+	depends on ARCH_QCOM || COMPILE_TEST
+	help
+	  This enables the PDC (Power Domain Controller) reset driver
+	  for Qualcomm Technologies Inc SDM845 SoCs. Say Y if you want
+	  to control reset signals provided by PDC for Modem, Compute,
+	  Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS.
+

Implementation looks fine.

Regards,
Bjorn

#5 lore raw

PATCH 3/4 remoteproc: qcom: q6v5-pil: Explicitly get mss_restart line

In reply to Sibi Sankar

Explicitly get mss_restart to facilitate adding PDC restart line for modem on SDM845 SoCs

---
 drivers/remoteproc/qcom_q6v5_pil.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/remoteproc/qcom_q6v5_pil.c +1 -2
index b1296d614b8b..d57fdb34e3dd 100644
@@ -1176,8 +1176,7 @@ static int q6v5_init_clocks(struct device *dev, struct clk **clks,
 
 static int q6v5_init_reset(struct q6v5 *qproc)
 {
-	qproc->mss_restart = devm_reset_control_get_exclusive(qproc->dev,
-							      NULL);
+	qproc->mss_restart = devm_reset_control_get(qproc->dev, "mss_restart");
 	if (IS_ERR(qproc->mss_restart)) {
 		dev_err(qproc->dev, "failed to acquire mss restart\n");
 		return PTR_ERR(qproc->mss_restart);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#6 lore raw

Re: [PATCH 3/4] remoteproc: qcom: q6v5-pil: Explicitly get mss_restart line

Quoted 13 lines · Sibi Sankar

Explicitly get mss_restart to facilitate adding PDC restart line for modem on SDM845 SoCs

---
 drivers/remoteproc/qcom_q6v5_pil.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/remoteproc/qcom_q6v5_pil.c +0 -0
index b1296d614b8b..d57fdb34e3dd 100644

drivers/remoteproc/qcom_q6v5_pil.c static int q6v5_init_clocks(struct device *dev, struct clk **clks, · line 1179

Quoted 6 lines
drivers/remoteproc/qcom_q6v5_pil.c +1 -2
@@ -1176,8 +1176,7 @@ static int q6v5_init_clocks(struct device *dev, struct clk **clks,
 
 static int q6v5_init_reset(struct q6v5 *qproc)
 {
-	qproc->mss_restart = devm_reset_control_get_exclusive(qproc->dev,
-							      NULL);
+	qproc->mss_restart = devm_reset_control_get(qproc->dev, "mss_restart");

Please keep using devm_reset_control_get_exclusive.

regards
Philipp

author
#7 lore raw

Re: [PATCH 3/4] remoteproc: qcom: q6v5-pil: Explicitly get mss_restart line

Hi Philipp,
Thanks for the review!

Quoted 15 lines · Philipp Zabel
Quoted 14 lines · Sibi Sankar

Explicitly get mss_restart to facilitate adding PDC restart line for modem on SDM845 SoCs

---
  drivers/remoteproc/qcom_q6v5_pil.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/remoteproc/qcom_q6v5_pil.c +0 -0
index b1296d614b8b..d57fdb34e3dd 100644
@@ -1176,8 +1176,7 @@ static int q6v5_init_clocks(struct device *dev, struct clk **clks,
 
Quoted 8 lines

drivers/remoteproc/qcom_q6v5_pil.c static int q6v5_init_clocks(struct device *dev, struct clk **clks, · line 1179

Quoted 5 lines
drivers/remoteproc/qcom_q6v5_pil.c +1 -2
  static int q6v5_init_reset(struct q6v5 *qproc)
  {
-	qproc->mss_restart = devm_reset_control_get_exclusive(qproc->dev,
-							      NULL);
+	qproc->mss_restart = devm_reset_control_get(qproc->dev, "mss_restart");

Please keep using devm_reset_control_get_exclusive.

got misled when I saw it being used in a recent driver :), will revert it back.

Quoted 3 lines

regards
Philipp

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc, is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#8 lore raw

PATCH 4/4 remoteproc: qcom: q6v5-pil: Add PDC restart for modem on SDM845 SoCs

In reply to Sibi Sankar

In the presence of a PDC block working with subsystem RSC, assert/deassert PDC restart in modem start/stop path.

---
 .../bindings/remoteproc/qcom,q6v5.txt         |  4 +++
 drivers/remoteproc/qcom_q6v5_pil.c            | 27 ++++++++++++++++---
 2 files changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +4 -0
index 601dd9f389aa..124fb1dc6fb8 100644
@@ -51,6 +51,8 @@ on the Qualcomm Hexagon core.
 	Usage: required
 	Value type: <phandle>
 	Definition: reference to the reset-controller for the modem sub-system
+		    reference to the list of 2 reset-controllers for the modem
+		    sub-system on SDM845 SoCs
 		    reference to the list of 3 reset-controllers for the
 		    wcss sub-system
 
@@ -58,6 +60,8 @@ on the Qualcomm Hexagon core.
 	Usage: required
 	Value type: <stringlist>
 	Definition: must be "mss_restart" for the modem sub-system
+	Definition: must be "mss_restart", "pdc_restart" for the modem
+		    sub-system on SDM845 SoCs
 	Definition: must be "wcss_aon_reset", "wcss_reset", "wcss_q6_reset"
 		    for the wcss syb-system
 
drivers/remoteproc/qcom_q6v5_pil.c +23 -4
index d57fdb34e3dd..5be794639fc3 100644
@@ -149,6 +149,7 @@ struct q6v5 {
 	u32 halt_nc;
 
 	struct reset_control *mss_restart;
+	struct reset_control *pdc_restart;
 
 	struct qcom_q6v5 q6v5;
 
@@ -349,10 +350,17 @@ static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
 
 static int q6v5_reset_assert(struct q6v5 *qproc)
 {
-	if (qproc->has_alt_reset)
-		return reset_control_reset(qproc->mss_restart);
-	else
-		return reset_control_assert(qproc->mss_restart);
+	int ret;
+
+	if (qproc->has_alt_reset) {
+		reset_control_assert(qproc->pdc_restart);
+		ret = reset_control_reset(qproc->mss_restart);
+		reset_control_deassert(qproc->pdc_restart);
+	} else {
+		ret = reset_control_assert(qproc->mss_restart);
+	}
+
+	return ret;
 }
 
 static int q6v5_reset_deassert(struct q6v5 *qproc)
@@ -360,9 +368,11 @@ static int q6v5_reset_deassert(struct q6v5 *qproc)
 	int ret;
 
 	if (qproc->has_alt_reset) {
+		reset_control_assert(qproc->pdc_restart);
 		writel(1, qproc->rmb_base + RMB_MBA_ALT_RESET);
 		ret = reset_control_reset(qproc->mss_restart);
 		writel(0, qproc->rmb_base + RMB_MBA_ALT_RESET);
+		reset_control_deassert(qproc->pdc_restart);
 	} else {
 		ret = reset_control_deassert(qproc->mss_restart);
 	}
@@ -1182,6 +1192,15 @@ static int q6v5_init_reset(struct q6v5 *qproc)
 		return PTR_ERR(qproc->mss_restart);
 	}
 
+	if (qproc->has_alt_reset) {
+		qproc->pdc_restart = devm_reset_control_get(qproc->dev,
+							    "pdc_restart");
+		if (IS_ERR(qproc->pdc_restart)) {
+			dev_err(qproc->dev, "failed to acquire pdc restart\n");
+			return PTR_ERR(qproc->pdc_restart);
+		}
+	}
+
 	return 0;
 }
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#9 lore raw

Re: [PATCH 4/4] remoteproc: qcom: q6v5-pil: Add PDC restart for modem on SDM845 SoCs

Quoted 13 lines · Sibi Sankar

In the presence of a PDC block working with subsystem RSC, assert/deassert PDC restart in modem start/stop path.

---
 .../bindings/remoteproc/qcom,q6v5.txt         |  4 +++
 drivers/remoteproc/qcom_q6v5_pil.c            | 27 ++++++++++++++++---
 2 files changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +0 -0
index 601dd9f389aa..124fb1dc6fb8 100644

[...]

Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt static int q6v5_init_reset(struct q6v5 *qproc) · line 1197

Quoted 7 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +3 -0
@@ -1182,6 +1192,15 @@ static int q6v5_init_reset(struct q6v5 *qproc)
 		return PTR_ERR(qproc->mss_restart);
 	}
 
+	if (qproc->has_alt_reset) {
+		qproc->pdc_restart = devm_reset_control_get(qproc->dev,
+							    "pdc_restart");

Please use devm_reset_control_get_exclusive() instead.

Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt static int q6v5_init_reset(struct q6v5 *qproc) · line 1205

Quoted 8 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +6 -0
+		if (IS_ERR(qproc->pdc_restart)) {
+			dev_err(qproc->dev, "failed to acquire pdc restart\n");
+			return PTR_ERR(qproc->pdc_restart);
+		}
+	}
+
 	return 0;
 }

regards
Philipp

author
#10 lore raw

Re: [PATCH 4/4] remoteproc: qcom: q6v5-pil: Add PDC restart for modem on SDM845 SoCs

Hi Philipp,
Thanks for the review!

Quoted 19 lines · Philipp Zabel
Quoted 13 lines · Sibi Sankar

In the presence of a PDC block working with subsystem RSC, assert/deassert PDC restart in modem start/stop path.

---
  .../bindings/remoteproc/qcom,q6v5.txt         |  4 +++
  drivers/remoteproc/qcom_q6v5_pil.c            | 27 ++++++++++++++++---
  2 files changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +0 -0
index 601dd9f389aa..124fb1dc6fb8 100644

[...]

Quoted 4 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +0 -0
@@ -1182,6 +1192,15 @@ static int q6v5_init_reset(struct q6v5 *qproc)
  		return PTR_ERR(qproc->mss_restart);
  	}
 
Quoted 6 lines

Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt static int q6v5_init_reset(struct q6v5 *qproc) · line 1197

Quoted 3 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +3 -0
+	if (qproc->has_alt_reset) {
+		qproc->pdc_restart = devm_reset_control_get(qproc->dev,
+							    "pdc_restart");

Please use devm_reset_control_get_exclusive() instead.

will replace it in the next re-spin.

Quoted 12 lines

Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt static int q6v5_init_reset(struct q6v5 *qproc) · line 1205

Quoted 8 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +6 -0
+		if (IS_ERR(qproc->pdc_restart)) {
+			dev_err(qproc->dev, "failed to acquire pdc restart\n");
+			return PTR_ERR(qproc->pdc_restart);
+		}
+	}
+
  	return 0;
  }

regards
Philipp

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc, is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#11 lore raw

Re: [PATCH 4/4] remoteproc: qcom: q6v5-pil: Add PDC restart for modem on SDM845 SoCs

In reply to Sibi Sankar
Quoted 6 lines · Sibi Sankar

In the presence of a PDC block working with subsystem RSC, assert/deassert PDC restart in modem start/stop path.

---
 .../bindings/remoteproc/qcom,q6v5.txt         |  4 +++

Please split bindings to separate patch.

Quoted 25 lines
 drivers/remoteproc/qcom_q6v5_pil.c            | 27 ++++++++++++++++---
 2 files changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +4 -0
index 601dd9f389aa..124fb1dc6fb8 100644
@@ -51,6 +51,8 @@ on the Qualcomm Hexagon core.
 	Usage: required
 	Value type: <phandle>
 	Definition: reference to the reset-controller for the modem sub-system
+		    reference to the list of 2 reset-controllers for the modem
+		    sub-system on SDM845 SoCs
 		    reference to the list of 3 reset-controllers for the
 		    wcss sub-system
 
@@ -58,6 +60,8 @@ on the Qualcomm Hexagon core.
 	Usage: required
 	Value type: <stringlist>
 	Definition: must be "mss_restart" for the modem sub-system
+	Definition: must be "mss_restart", "pdc_restart" for the modem
+		    sub-system on SDM845 SoCs
 	Definition: must be "wcss_aon_reset", "wcss_reset", "wcss_q6_reset"
 		    for the wcss syb-system
 
#12 lore raw

Re: [PATCH 4/4] remoteproc: qcom: q6v5-pil: Add PDC restart for modem on SDM845 SoCs

Quoted 10 lines · Rob Herring
Quoted 6 lines · Sibi Sankar

In the presence of a PDC block working with subsystem RSC, assert/deassert PDC restart in modem start/stop path.

---
  .../bindings/remoteproc/qcom,q6v5.txt         |  4 +++

Please split bindings to separate patch.

Okay will split them.

Quoted 25 lines
Quoted 25 lines
  drivers/remoteproc/qcom_q6v5_pil.c            | 27 ++++++++++++++++---
  2 files changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +4 -0
index 601dd9f389aa..124fb1dc6fb8 100644
@@ -51,6 +51,8 @@ on the Qualcomm Hexagon core.
  	Usage: required
  	Value type: <phandle>
  	Definition: reference to the reset-controller for the modem sub-system
+		    reference to the list of 2 reset-controllers for the modem
+		    sub-system on SDM845 SoCs
  		    reference to the list of 3 reset-controllers for the
  		    wcss sub-system
 
@@ -58,6 +60,8 @@ on the Qualcomm Hexagon core.
  	Usage: required
  	Value type: <stringlist>
  	Definition: must be "mss_restart" for the modem sub-system
+	Definition: must be "mss_restart", "pdc_restart" for the modem
+		    sub-system on SDM845 SoCs
  	Definition: must be "wcss_aon_reset", "wcss_reset", "wcss_q6_reset"
  		    for the wcss syb-system
 
Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc, is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#13 lore raw

Re: [PATCH 4/4] remoteproc: qcom: q6v5-pil: Add PDC restart for modem on SDM845 SoCs

In reply to Sibi Sankar
Quoted 23 lines · Sibi Sankar

In the presence of a PDC block working with subsystem RSC, assert/deassert PDC restart in modem start/stop path.

---
 .../bindings/remoteproc/qcom,q6v5.txt         |  4 +++
 drivers/remoteproc/qcom_q6v5_pil.c            | 27 ++++++++++++++++---
 2 files changed, 27 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +2 -0
index 601dd9f389aa..124fb1dc6fb8 100644
@@ -51,6 +51,8 @@ on the Qualcomm Hexagon core.
 	Usage: required
 	Value type: <phandle>
 	Definition: reference to the reset-controller for the modem sub-system
+		    reference to the list of 2 reset-controllers for the modem
+		    sub-system on SDM845 SoCs
 		    reference to the list of 3 reset-controllers for the
 		    wcss sub-system
 

Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt on the Qualcomm Hexagon core. · line 66

Quoted 7 lines
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +2 -0
@@ -58,6 +60,8 @@ on the Qualcomm Hexagon core.
 	Usage: required
 	Value type: <stringlist>
 	Definition: must be "mss_restart" for the modem sub-system
+	Definition: must be "mss_restart", "pdc_restart" for the modem
+		    sub-system on SDM845 SoCs
 	Definition: must be "wcss_aon_reset", "wcss_reset", "wcss_q6_reset"
 		    for the wcss syb-system

Seems like we got an additional "Definition:" added here as we added the wcss. Please don't add another one.

The rest looks good.

Regards,
Bjorn

maintainer
#14 lore raw
In reply to Sibi Sankar

Hi Sibi,

Quoted 33 lines · Sibi Sankar

Add SDM845 PDC (Power Domain Controller) reset controller binding

---
 .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
 include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt
 create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +17 -0
new file mode 100644
index 000000000000..85e159962e08
@@ -0,0 +1,52 @@
+PDC Reset Controller
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +10 -0
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {

Is this really just a reset controller?

The name makes it sound like a driver binding to this should also provide pm_genpd and the binding should probably call this a power-
controller: Documentation/devicetree/bindings/power/power_domain.txt.

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 29

Quoted 2 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +2 -0
+	compatible = "qcom,sdm845-pdc-global";
+	reg = <0xb2e0000 0x20000>;

This looks like this is the register space of the complete PDC, not just the reset register?

Quoted 39 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +23 -0
+	#reset-cells = <1>;
+};
+
+PDC reset clients
+======================================
+
+Device nodes that need access to reset lines should
+specify them as a reset phandle in their corresponding node as
+specified in reset.txt.
+
+For list of all valid reset indicies see
+<dt-bindings/reset/qcom,sdm845-pdc.h>
+
+Example:
+
+modem-pil@4080000 {
+	...
+
+	resets = <&pdc_reset PDC_MODEM_SYNC_RESET>;
+	reset-names = "pdc_restart";
+
+	...
+};
include/dt-bindings/reset/qcom,sdm845-pdc.h new file +10 -0
new file mode 100644
index 000000000000..53c37f9c319a
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DT_BINDINGS_RESET_PDC_SDM_845_H
+#define _DT_BINDINGS_RESET_PDC_SDM_845_H
+
+#define PDC_APPS_SYNC_RESET	0
+#define PDC_SP_SYNC_RESET	1

include/dt-bindings/reset/qcom,sdm845-pdc.h line 20

Quoted 10 lines
include/dt-bindings/reset/qcom,sdm845-pdc.h new file +10 -0
+#define PDC_AUDIO_SYNC_RESET	2
+#define PDC_SENSORS_SYNC_RESET	3
+#define PDC_AOP_SYNC_RESET	4
+#define PDC_DEBUG_SYNC_RESET	5
+#define PDC_GPU_SYNC_RESET	6
+#define PDC_DISPLAY_SYNC_RESET	7
+#define PDC_COMPUTE_SYNC_RESET	8
+#define PDC_MODEM_SYNC_RESET	9
+
+#endif

regards
Philipp

author
#15 lore raw

Hi Philipp,
Thanks for the review!

Quoted 49 lines · Philipp Zabel

Hi Sibi,

Quoted 33 lines · Sibi Sankar

Add SDM845 PDC (Power Domain Controller) reset controller binding

---
  .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
  include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
  2 files changed, 72 insertions(+)

create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +17 -0
new file mode 100644
index 000000000000..85e159962e08
@@ -0,0 +1,52 @@
+PDC Reset Controller
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +10 -0
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {

Is this really just a reset controller?

Quoted 4 lines

The name makes it sound like a driver binding to this should also provide pm_genpd and the binding should probably call this a power-
controller: Documentation/devicetree/bindings/power/power_domain.txt.

The PDC-global reg space which is a part of PDC-wrapper reg space seems to be only used for the reset lines.

Couple of other drivers use other parts of the PDC-wrapper reg space:
https://patchwork.kernel.org/patch/10223701/ (PDC-Interrupt controller)
https://patchwork.kernel.org/patch/10255767/ (GMU-PDC incorrectly tries to occupy the entire pdc-wrapper reg space)

since it couldn't be logically mapped into pdc-interrupt driver, it had to be included as a separate reset driver.

Quoted 6 lines

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 29

Quoted 2 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +2 -0
+	compatible = "qcom,sdm845-pdc-global";
+	reg = <0xb2e0000 0x20000>;

This looks like this is the register space of the complete PDC, not just the reset register?

The entire register space was chosen because it is only used for its
reset lines (had a good look at the downstream kernel and had a conversation with Lina) and to ensure break backward compatibility for the for the dt entry if the reg-space was used for other purposes in
the future.

Quoted 53 lines
Quoted 39 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +23 -0
+	#reset-cells = <1>;
+};
+
+PDC reset clients
+======================================
+
+Device nodes that need access to reset lines should
+specify them as a reset phandle in their corresponding node as
+specified in reset.txt.
+
+For list of all valid reset indicies see
+<dt-bindings/reset/qcom,sdm845-pdc.h>
+
+Example:
+
+modem-pil@4080000 {
+	...
+
+	resets = <&pdc_reset PDC_MODEM_SYNC_RESET>;
+	reset-names = "pdc_restart";
+
+	...
+};
include/dt-bindings/reset/qcom,sdm845-pdc.h new file +10 -0
new file mode 100644
index 000000000000..53c37f9c319a
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DT_BINDINGS_RESET_PDC_SDM_845_H
+#define _DT_BINDINGS_RESET_PDC_SDM_845_H
+
+#define PDC_APPS_SYNC_RESET	0
+#define PDC_SP_SYNC_RESET	1

include/dt-bindings/reset/qcom,sdm845-pdc.h line 20

Quoted 10 lines
include/dt-bindings/reset/qcom,sdm845-pdc.h new file +10 -0
+#define PDC_AUDIO_SYNC_RESET	2
+#define PDC_SENSORS_SYNC_RESET	3
+#define PDC_AOP_SYNC_RESET	4
+#define PDC_DEBUG_SYNC_RESET	5
+#define PDC_GPU_SYNC_RESET	6
+#define PDC_DISPLAY_SYNC_RESET	7
+#define PDC_COMPUTE_SYNC_RESET	8
+#define PDC_MODEM_SYNC_RESET	9
+
+#endif

regards
Philipp

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc, is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#16 lore raw
Quoted 61 lines · Sibi S

Hi Philipp,
Thanks for the review!

Quoted 49 lines · Philipp Zabel

Hi Sibi,

Quoted 33 lines · Sibi Sankar

Add SDM845 PDC (Power Domain Controller) reset controller binding

---
  .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
  include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
  2 files changed, 72 insertions(+)

create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +17 -0
new file mode 100644
index 000000000000..85e159962e08
@@ -0,0 +1,52 @@
+PDC Reset Controller
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +10 -0
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {

Is this really just a reset controller?

Quoted 4 lines

The name makes it sound like a driver binding to this should also provide pm_genpd and the binding should probably call this a power-
controller: Documentation/devicetree/bindings/power/power_domain.txt.

The PDC-global reg space which is a part of PDC-wrapper reg space seems to be only used for the reset lines.

Quoted 7 lines

Couple of other drivers use other parts of the PDC-wrapper reg space:
https://patchwork.kernel.org/patch/10223701/ (PDC-Interrupt controller)
https://patchwork.kernel.org/patch/10255767/ (GMU-PDC incorrectly tries to occupy the entire pdc-wrapper reg space)

since it couldn't be logically mapped into pdc-interrupt driver, it had to be included as a separate reset driver.

You can't have overlapping regions in DT (well, you can because we have to work-around existing DTs that do, but you shouldn't).

A single node can be multiple providers such as interrupt controller and reset controller. It's an OS problem to split that into multiple drivers.

Quoted 7 lines
Quoted 6 lines

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 29

Quoted 2 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +2 -0
+	compatible = "qcom,sdm845-pdc-global";
+	reg = <0xb2e0000 0x20000>;

This looks like this is the register space of the complete PDC, not just the reset register?

Quoted 5 lines

The entire register space was chosen because it is only used for its reset lines (had a good look at the downstream kernel and had a conversation with Lina) and to ensure break backward compatibility for
the for the dt entry if the reg-space was used for other purposes in the future.

Why do you want to ensure breaking backwards compatibility?

Rob

#17 lore raw

Hi Rob,
Thanks for the review

Quoted 70 lines · Rob Herring
Quoted 61 lines · Sibi S

Hi Philipp,
Thanks for the review!

Quoted 49 lines · Philipp Zabel

Hi Sibi,

Quoted 33 lines · Sibi Sankar

Add SDM845 PDC (Power Domain Controller) reset controller binding

---
   .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
   include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
   2 files changed, 72 insertions(+)

create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +17 -0
new file mode 100644
index 000000000000..85e159962e08
@@ -0,0 +1,52 @@
+PDC Reset Controller
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +10 -0
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {

Is this really just a reset controller?

Quoted 4 lines

The name makes it sound like a driver binding to this should also provide pm_genpd and the binding should probably call this a power-
controller: Documentation/devicetree/bindings/power/power_domain.txt.

The PDC-global reg space which is a part of PDC-wrapper reg space seems to be only used for the reset lines.

Quoted 7 lines

Couple of other drivers use other parts of the PDC-wrapper reg space:
https://patchwork.kernel.org/patch/10223701/ (PDC-Interrupt controller)
https://patchwork.kernel.org/patch/10255767/ (GMU-PDC incorrectly tries to occupy the entire pdc-wrapper reg space)

since it couldn't be logically mapped into pdc-interrupt driver, it had to be included as a separate reset driver.

Quoted 7 lines

You can't have overlapping regions in DT (well, you can because we have to work-around existing DTs that do, but you shouldn't).

A single node can be multiple providers such as interrupt controller and reset controller. It's an OS problem to split that into multiple drivers.

There will be no overlaps. Jordan will be changing the dt binding of gmu_pdc so that there is no overlap I guess. What I meant to say is that pdc-global is a separate reg-space and currently has no other functionality other than exposing the reset lines.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 29

Quoted 2 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +2 -0
+	compatible = "qcom,sdm845-pdc-global";
+	reg = <0xb2e0000 0x20000>;

This looks like this is the register space of the complete PDC, not just the reset register?

Quoted 8 lines
Quoted 5 lines

The entire register space was chosen because it is only used for its reset lines (had a good look at the downstream kernel and had a conversation with Lina) and to ensure break backward compatibility for
the for the dt entry if the reg-space was used for other purposes in the future.

Why do you want to ensure breaking backwards compatibility?

Similar to the AOSS reset driver which had a unused clock part, this driver also exposes a reg space of which only reset lines are used.

Quoted 2 lines

Rob

Signature · 3 lines
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc, is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#18 lore raw
Quoted 77 lines · Sibi Sankar

Hi Rob,
Thanks for the review

Quoted 73 lines · Rob Herring
Quoted 61 lines · Sibi S

Hi Philipp,
Thanks for the review!

Quoted 49 lines · Philipp Zabel

Hi Sibi,

Quoted 33 lines · Sibi Sankar

Add SDM845 PDC (Power Domain Controller) reset controller binding

---
  .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
  include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
  2 files changed, 72 insertions(+)

create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +17 -0
new file mode 100644
index 000000000000..85e159962e08
@@ -0,0 +1,52 @@
+PDC Reset Controller
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +10 -0
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {

Is this really just a reset controller?

Quoted 4 lines

The name makes it sound like a driver binding to this should also provide pm_genpd and the binding should probably call this a power-
controller: Documentation/devicetree/bindings/power/power_domain.txt.

The PDC-global reg space which is a part of PDC-wrapper reg space seems to be only used for the reset lines.

Quoted 7 lines

Couple of other drivers use other parts of the PDC-wrapper reg space:
https://patchwork.kernel.org/patch/10223701/ (PDC-Interrupt controller)
https://patchwork.kernel.org/patch/10255767/ (GMU-PDC incorrectly tries to occupy the entire pdc-wrapper reg space)

since it couldn't be logically mapped into pdc-interrupt driver, it had to be included as a separate reset driver.

You can't have overlapping regions in DT (well, you can because we have to work-around existing DTs that do, but you shouldn't).

Quoted 8 lines
Quoted 3 lines

A single node can be multiple providers such as interrupt controller and reset controller. It's an OS problem to split that into multiple drivers.

There will be no overlaps. Jordan will be changing the dt binding of gmu_pdc so that there is no overlap I guess. What I meant to say is that pdc-global is a separate reg-space and currently has no other functionality other than exposing the reset lines.

Correct - the updated GPU DT will be:

reg = <0x506a000 0x30000>,

     <0xb280000 0x10000>,
     <0xb480000, 0x10000>;

reg-names = "gmu", "gmu_pdc", "gmu_pdc_seq";

Jordan

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#19 lore raw
Quoted 87 lines · Jordan Crouse
Quoted 77 lines · Sibi Sankar

Hi Rob,
Thanks for the review

Quoted 73 lines · Rob Herring
Quoted 61 lines · Sibi S

Hi Philipp,
Thanks for the review!

Quoted 49 lines · Philipp Zabel

Hi Sibi,

Quoted 33 lines · Sibi Sankar

Add SDM845 PDC (Power Domain Controller) reset controller binding

---
  .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
  include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
  2 files changed, 72 insertions(+)

create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +17 -0
new file mode 100644
index 000000000000..85e159962e08
@@ -0,0 +1,52 @@
+PDC Reset Controller
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +10 -0
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {

Is this really just a reset controller?

Quoted 4 lines

The name makes it sound like a driver binding to this should also provide pm_genpd and the binding should probably call this a power-
controller: Documentation/devicetree/bindings/power/power_domain.txt.

The PDC-global reg space which is a part of PDC-wrapper reg space seems to be only used for the reset lines.

Quoted 7 lines

Couple of other drivers use other parts of the PDC-wrapper reg space:
https://patchwork.kernel.org/patch/10223701/ (PDC-Interrupt controller)
https://patchwork.kernel.org/patch/10255767/ (GMU-PDC incorrectly tries to occupy the entire pdc-wrapper reg space)

since it couldn't be logically mapped into pdc-interrupt driver, it had to be included as a separate reset driver.

You can't have overlapping regions in DT (well, you can because we have to work-around existing DTs that do, but you shouldn't).

Quoted 8 lines
Quoted 3 lines

A single node can be multiple providers such as interrupt controller and reset controller. It's an OS problem to split that into multiple drivers.

There will be no overlaps. Jordan will be changing the dt binding of gmu_pdc so that there is no overlap I guess. What I meant to say is that pdc-global is a separate reg-space and currently has no other functionality other than exposing the reset lines.

Quoted 8 lines

Correct - the updated GPU DT will be:

reg = <0x506a000 0x30000>,

     <0xb280000 0x10000>,
     <0xb480000, 0x10000>;

reg-names = "gmu", "gmu_pdc", "gmu_pdc_seq";

Jordan

Code change: https://patchwork.freedesktop.org/patch/243513/
DT change: https://patchwork.freedesktop.org/patch/243539/

Jordan

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#20 lore raw
In reply to Sibi Sankar
Quoted 2 lines · Sibi Sankar

Add SDM845 PDC (Power Domain Controller) reset controller binding

Even though this is currently describing only a reset controller I think this binding better be talking about the "PDC Global" hardware.

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt

Quoted 9 lines
---
 .../bindings/reset/qcom,pdc-reset.txt         | 52 +++++++++++++++++++
 include/dt-bindings/reset/qcom,sdm845-pdc.h   | 20 +++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt
 create mode 100644 include/dt-bindings/reset/qcom,sdm845-pdc.h
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt +0 -0

Rename this qcom,pdc-global to match the compatible, and hardware name.

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 1

Quoted 6 lines

new file mode 100644
index 000000000000..85e159962e08

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +1 -0
@@ -0,0 +1,52 @@
+PDC Reset Controller

PDC Global

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 5

Quoted 4 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +4 -0
+======================================
+
+This binding describes a reset-controller found on PDC-Global(Power Domain
+Controller) block for Qualcomm Technologies Inc SDM845 SoCs.

This looks good.

Quoted 12 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +12 -0
+
+Required properties:
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be:
+		    "qcom,sdm845-pdc-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the register

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +10 -0
+	            space.
+
+- #reset-cells:
+	Usage: required
+	Value type: <uint>
+	Definition: must be 1; cell entry represents the reset index.
+
+Example:
+
+pdc_reset: reset-controller@b2e0000 {

This is perfectly fine, in its current form it is a reset-controller.

Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt line 32

Quoted 5 lines
Documentation/devicetree/bindings/reset/qcom,pdc-reset.txt new file +5 -0
+	compatible = "qcom,sdm845-pdc-global";
+	reg = <0xb2e0000 0x20000>;
+	#reset-cells = <1>;
+};
+

Apart from this, the binding looks good!

Regards,
Bjorn