linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] rockchip io domain
@ 2021-05-27  8:29 Jianqun Xu
  2021-05-27  8:29 ` [PATCH v2 1/3] dt-bindings: soc: rockchip: convert io-domain.txt to YAML Jianqun Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jianqun Xu @ 2021-05-27  8:29 UTC (permalink / raw)
  To: heiko, lee.jones, ulf.hansson, robh+dt
  Cc: devicetree, jbx6244, linux-rockchip, linux-kernel, Jianqun Xu

Covert rockchip io domain document to YAML, and add rk3568 support.

Jianqun Xu (3):
  dt-bindings: soc: rockchip: convert io-domain.txt to YAML
  soc: rockchip: io-domain: add rk3568 support
  dt-bindings: soc: rockchip: add rk3568-pmu-io-domain support

 .../bindings/power/rockchip-io-domain.txt     | 135 ------------------
 .../bindings/soc/rockchip/io-domain.yaml      |  46 ++++++
 drivers/soc/rockchip/io-domain.c              |  88 ++++++++++--
 3 files changed, 126 insertions(+), 143 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/rockchip-io-domain.txt
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml

--
v2:
- add yaml
2.25.1




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/3] dt-bindings: soc: rockchip: convert io-domain.txt to YAML
  2021-05-27  8:29 [PATCH v2 0/3] rockchip io domain Jianqun Xu
@ 2021-05-27  8:29 ` Jianqun Xu
  2021-05-27 14:23   ` Rob Herring
  2021-05-27  8:29 ` [PATCH v2 2/3] soc: rockchip: io-domain: add rk3568 support Jianqun Xu
  2021-05-27  8:29 ` [PATCH v2 3/3] dt-bindings: soc: rockchip: add rk3568-pmu-io-domain support Jianqun Xu
  2 siblings, 1 reply; 7+ messages in thread
From: Jianqun Xu @ 2021-05-27  8:29 UTC (permalink / raw)
  To: heiko, lee.jones, ulf.hansson, robh+dt
  Cc: devicetree, jbx6244, linux-rockchip, linux-kernel, Jianqun Xu

This patch moves the rockchip-io-domain.txt from power/avs dir to soc
dir and rename to io-domain.txt, without any change in the step.

Then covert the io-domain.txt to YAML.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
v2:
- first version
 .../bindings/power/rockchip-io-domain.txt     | 135 ------------------
 .../bindings/soc/rockchip/io-domain.yaml      |  45 ++++++
 2 files changed, 45 insertions(+), 135 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/rockchip-io-domain.txt
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml

diff --git a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
deleted file mode 100644
index e66fd4eab71c..000000000000
--- a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
+++ /dev/null
@@ -1,135 +0,0 @@
-Rockchip SRAM for IO Voltage Domains:
--------------------------------------
-
-IO domain voltages on some Rockchip SoCs are variable but need to be
-kept in sync between the regulators and the SoC using a special
-register.
-
-A specific example using rk3288:
-- If the regulator hooked up to a pin like SDMMC0_VDD is 3.3V then
-  bit 7 of GRF_IO_VSEL needs to be 0.  If the regulator hooked up to
-  that same pin is 1.8V then bit 7 of GRF_IO_VSEL needs to be 1.
-
-Said another way, this driver simply handles keeping bits in the SoC's
-general register file (GRF) in sync with the actual value of a voltage
-hooked up to the pins.
-
-Note that this driver specifically doesn't include:
-- any logic for deciding what voltage we should set regulators to
-- any logic for deciding whether regulators (or internal SoC blocks)
-  should have power or not have power
-
-If there were some other software that had the smarts of making
-decisions about regulators, it would work in conjunction with this
-driver.  When that other software adjusted a regulator's voltage then
-this driver would handle telling the SoC about it.  A good example is
-vqmmc for SD.  In that case the dw_mmc driver simply is told about a
-regulator.  It changes the regulator between 3.3V and 1.8V at the
-right time.  This driver notices the change and makes sure that the
-SoC is on the same page.
-
-
-Required properties:
-- compatible: should be one of:
-  - "rockchip,px30-io-voltage-domain" for px30
-  - "rockchip,px30-pmu-io-voltage-domain" for px30 pmu-domains
-  - "rockchip,rk3188-io-voltage-domain" for rk3188
-  - "rockchip,rk3228-io-voltage-domain" for rk3228
-  - "rockchip,rk3288-io-voltage-domain" for rk3288
-  - "rockchip,rk3328-io-voltage-domain" for rk3328
-  - "rockchip,rk3368-io-voltage-domain" for rk3368
-  - "rockchip,rk3368-pmu-io-voltage-domain" for rk3368 pmu-domains
-  - "rockchip,rk3399-io-voltage-domain" for rk3399
-  - "rockchip,rk3399-pmu-io-voltage-domain" for rk3399 pmu-domains
-  - "rockchip,rv1108-io-voltage-domain" for rv1108
-  - "rockchip,rv1108-pmu-io-voltage-domain" for rv1108 pmu-domains
-
-Deprecated properties:
-- rockchip,grf: phandle to the syscon managing the "general register files"
-    Systems should move the io-domains to a sub-node of the grf simple-mfd.
-
-You specify supplies using the standard regulator bindings by including
-a phandle the relevant regulator.  All specified supplies must be able
-to report their voltage.  The IO Voltage Domain for any non-specified
-supplies will be not be touched.
-
-Possible supplies for PX30:
-- vccio6-supply: The supply connected to VCCIO6.
-- vccio1-supply: The supply connected to VCCIO1.
-- vccio2-supply: The supply connected to VCCIO2.
-- vccio3-supply: The supply connected to VCCIO3.
-- vccio4-supply: The supply connected to VCCIO4.
-- vccio5-supply: The supply connected to VCCIO5.
-- vccio-oscgpi-supply: The supply connected to VCCIO_OSCGPI.
-
-Possible supplies for PX30 pmu-domains:
-- pmuio1-supply: The supply connected to PMUIO1.
-- pmuio2-supply: The supply connected to PMUIO2.
-
-Possible supplies for rk3188:
-- ap0-supply:    The supply connected to AP0_VCC.
-- ap1-supply:    The supply connected to AP1_VCC.
-- cif-supply:    The supply connected to CIF_VCC.
-- flash-supply:  The supply connected to FLASH_VCC.
-- lcdc0-supply:  The supply connected to LCD0_VCC.
-- lcdc1-supply:  The supply connected to LCD1_VCC.
-- vccio0-supply: The supply connected to VCCIO0.
-- vccio1-supply: The supply connected to VCCIO1.
-                 Sometimes also labeled VCCIO1 and VCCIO2.
-
-Possible supplies for rk3228:
-- vccio1-supply: The supply connected to VCCIO1.
-- vccio2-supply: The supply connected to VCCIO2.
-- vccio3-supply: The supply connected to VCCIO3.
-- vccio4-supply: The supply connected to VCCIO4.
-
-Possible supplies for rk3288:
-- audio-supply:  The supply connected to APIO4_VDD.
-- bb-supply:     The supply connected to APIO5_VDD.
-- dvp-supply:    The supply connected to DVPIO_VDD.
-- flash0-supply: The supply connected to FLASH0_VDD.  Typically for eMMC
-- flash1-supply: The supply connected to FLASH1_VDD.  Also known as SDIO1.
-- gpio30-supply: The supply connected to APIO1_VDD.
-- gpio1830       The supply connected to APIO2_VDD.
-- lcdc-supply:   The supply connected to LCDC_VDD.
-- sdcard-supply: The supply connected to SDMMC0_VDD.
-- wifi-supply:   The supply connected to APIO3_VDD.  Also known as SDIO0.
-
-Possible supplies for rk3368:
-- audio-supply:  The supply connected to APIO3_VDD.
-- dvp-supply:    The supply connected to DVPIO_VDD.
-- flash0-supply: The supply connected to FLASH0_VDD.  Typically for eMMC
-- gpio30-supply: The supply connected to APIO1_VDD.
-- gpio1830       The supply connected to APIO4_VDD.
-- sdcard-supply: The supply connected to SDMMC0_VDD.
-- wifi-supply:   The supply connected to APIO2_VDD.  Also known as SDIO0.
-
-Possible supplies for rk3368 pmu-domains:
-- pmu-supply:    The supply connected to PMUIO_VDD.
-- vop-supply:    The supply connected to LCDC_VDD.
-
-Possible supplies for rk3399:
-- bt656-supply:  The supply connected to APIO2_VDD.
-- audio-supply:  The supply connected to APIO5_VDD.
-- sdmmc-supply:  The supply connected to SDMMC0_VDD.
-- gpio1830       The supply connected to APIO4_VDD.
-
-Possible supplies for rk3399 pmu-domains:
-- pmu1830-supply:The supply connected to PMUIO2_VDD.
-
-Example:
-
-	io-domains {
-		compatible = "rockchip,rk3288-io-voltage-domain";
-		rockchip,grf = <&grf>;
-
-		audio-supply = <&vcc18_codec>;
-		bb-supply = <&vcc33_io>;
-		dvp-supply = <&vcc_18>;
-		flash0-supply = <&vcc18_flashio>;
-		gpio1830-supply = <&vcc33_io>;
-		gpio30-supply = <&vcc33_pmuio>;
-		lcdc-supply = <&vcc33_lcd>;
-		sdcard-supply = <&vccio_sd>;
-		wifi-supply = <&vcc18_wl>;
-	};
diff --git a/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml b/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml
new file mode 100644
index 000000000000..2931e0ea8fa8
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/rockchip/io-domain.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip SRAM for IO Voltage Domains
+
+maintainers:
+  - Heiko Stuebner <heiko@sntech.de>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+            - rockchip,px30-io-voltage-domain
+            - rockchip,px30-pmu-io-voltage-domain
+            - rockchip,rk3188-io-voltage-domain
+            - rockchip,rk3228-io-voltage-domain
+            - rockchip,rk3288-io-voltage-domain
+            - rockchip,rk3328-io-voltage-domain
+            - rockchip,rk3368-io-voltage-domain
+            - rockchip,rk3368-pmu-io-voltage-domain
+            - rockchip,rk3399-io-voltage-domain
+            - rockchip,rk3399-pmu-io-voltage-domain
+            - rockchip,rv1108-io-voltage-domain
+            - rockchip,rv1108-pmu-io-voltage-domain
+
+
+examples:
+  - |
+    io-domains {
+        compatible = "rockchip,rk3288-io-voltage-domain";
+
+	audio-supply = <&vcc18_codec>;
+	bb-supply = <&vcc33_io>;
+	dvp-supply = <&vcc_18>;
+	flash0-supply = <&vcc18_flashio>;
+	gpio1830-supply = <&vcc33_io>;
+	gpio30-supply = <&vcc33_pmuio>;
+	lcdc-supply = <&vcc33_lcd>;
+	sdcard-supply = <&vccio_sd>;
+	wifi-supply = <&vcc18_wl>;
+    };
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] soc: rockchip: io-domain: add rk3568 support
  2021-05-27  8:29 [PATCH v2 0/3] rockchip io domain Jianqun Xu
  2021-05-27  8:29 ` [PATCH v2 1/3] dt-bindings: soc: rockchip: convert io-domain.txt to YAML Jianqun Xu
@ 2021-05-27  8:29 ` Jianqun Xu
  2021-08-05 13:02   ` Peter Geis
  2021-05-27  8:29 ` [PATCH v2 3/3] dt-bindings: soc: rockchip: add rk3568-pmu-io-domain support Jianqun Xu
  2 siblings, 1 reply; 7+ messages in thread
From: Jianqun Xu @ 2021-05-27  8:29 UTC (permalink / raw)
  To: heiko, lee.jones, ulf.hansson, robh+dt
  Cc: devicetree, jbx6244, linux-rockchip, linux-kernel, Jianqun Xu

The io-domain registers on RK3568 SoCs have three separated bits to
enable/disable the 1.8v/2.5v/3.3v power.

This patch make the write to be a operation, allow rk3568 uses a private
register set function.

Since the 2.5v is not used on RK3568, so the driver only set
1.8v [enable] + 3.3v [disable] for 1.8v mode
1.8v [disable] + 3.3v [enable] for 3.3v mode

There is not register order requirement which has been cleared by our IC
team.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
v2:
- none
 drivers/soc/rockchip/io-domain.c | 88 +++++++++++++++++++++++++++++---
 1 file changed, 80 insertions(+), 8 deletions(-)

diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c
index cf8182fc3642..13c446fd33a9 100644
--- a/drivers/soc/rockchip/io-domain.c
+++ b/drivers/soc/rockchip/io-domain.c
@@ -51,13 +51,11 @@
 #define RK3399_PMUGRF_CON0_VSEL		BIT(8)
 #define RK3399_PMUGRF_VSEL_SUPPLY_NUM	9
 
-struct rockchip_iodomain;
+#define RK3568_PMU_GRF_IO_VSEL0		(0x0140)
+#define RK3568_PMU_GRF_IO_VSEL1		(0x0144)
+#define RK3568_PMU_GRF_IO_VSEL2		(0x0148)
 
-struct rockchip_iodomain_soc_data {
-	int grf_offset;
-	const char *supply_names[MAX_SUPPLIES];
-	void (*init)(struct rockchip_iodomain *iod);
-};
+struct rockchip_iodomain;
 
 struct rockchip_iodomain_supply {
 	struct rockchip_iodomain *iod;
@@ -66,13 +64,62 @@ struct rockchip_iodomain_supply {
 	int idx;
 };
 
+struct rockchip_iodomain_soc_data {
+	int grf_offset;
+	const char *supply_names[MAX_SUPPLIES];
+	void (*init)(struct rockchip_iodomain *iod);
+	int (*write)(struct rockchip_iodomain_supply *supply, int uV);
+};
+
 struct rockchip_iodomain {
 	struct device *dev;
 	struct regmap *grf;
 	const struct rockchip_iodomain_soc_data *soc_data;
 	struct rockchip_iodomain_supply supplies[MAX_SUPPLIES];
+	int (*write)(struct rockchip_iodomain_supply *supply, int uV);
 };
 
+static int rk3568_iodomain_write(struct rockchip_iodomain_supply *supply, int uV)
+{
+	struct rockchip_iodomain *iod = supply->iod;
+	u32 is_3v3 = uV > MAX_VOLTAGE_1_8;
+	u32 val0, val1;
+	int b;
+
+	switch (supply->idx) {
+	case 0: /* pmuio1 */
+		break;
+	case 1: /* pmuio2 */
+		b = supply->idx;
+		val0 = BIT(16 + b) | (is_3v3 ? 0 : BIT(b));
+		b = supply->idx + 4;
+		val1 = BIT(16 + b) | (is_3v3 ? BIT(b) : 0);
+
+		regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL2, val0);
+		regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL2, val1);
+		break;
+	case 3: /* vccio2 */
+		break;
+	case 2: /* vccio1 */
+	case 4: /* vccio3 */
+	case 5: /* vccio4 */
+	case 6: /* vccio5 */
+	case 7: /* vccio6 */
+	case 8: /* vccio7 */
+		b = supply->idx - 1;
+		val0 = BIT(16 + b) | (is_3v3 ? 0 : BIT(b));
+		val1 = BIT(16 + b) | (is_3v3 ? BIT(b) : 0);
+
+		regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL0, val0);
+		regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL1, val1);
+		break;
+	default:
+		return -EINVAL;
+	};
+
+	return 0;
+}
+
 static int rockchip_iodomain_write(struct rockchip_iodomain_supply *supply,
 				   int uV)
 {
@@ -136,7 +183,7 @@ static int rockchip_iodomain_notify(struct notifier_block *nb,
 			return NOTIFY_BAD;
 	}
 
-	ret = rockchip_iodomain_write(supply, uV);
+	ret = supply->iod->write(supply, uV);
 	if (ret && event == REGULATOR_EVENT_PRE_VOLTAGE_CHANGE)
 		return NOTIFY_BAD;
 
@@ -398,6 +445,22 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
 	.init = rk3399_pmu_iodomain_init,
 };
 
+static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = {
+	.grf_offset = 0x140,
+	.supply_names = {
+		"pmuio1",
+		"pmuio2",
+		"vccio1",
+		"vccio2",
+		"vccio3",
+		"vccio4",
+		"vccio5",
+		"vccio6",
+		"vccio7",
+	},
+	.write = rk3568_iodomain_write,
+};
+
 static const struct rockchip_iodomain_soc_data soc_data_rv1108 = {
 	.grf_offset = 0x404,
 	.supply_names = {
@@ -469,6 +532,10 @@ static const struct of_device_id rockchip_iodomain_match[] = {
 		.compatible = "rockchip,rk3399-pmu-io-voltage-domain",
 		.data = &soc_data_rk3399_pmu
 	},
+	{
+		.compatible = "rockchip,rk3568-pmu-io-voltage-domain",
+		.data = &soc_data_rk3568_pmu
+	},
 	{
 		.compatible = "rockchip,rv1108-io-voltage-domain",
 		.data = &soc_data_rv1108
@@ -502,6 +569,11 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
 	match = of_match_node(rockchip_iodomain_match, np);
 	iod->soc_data = match->data;
 
+	if (iod->soc_data->write)
+		iod->write = iod->soc_data->write;
+	else
+		iod->write = rockchip_iodomain_write;
+
 	parent = pdev->dev.parent;
 	if (parent && parent->of_node) {
 		iod->grf = syscon_node_to_regmap(parent->of_node);
@@ -562,7 +634,7 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
 		supply->reg = reg;
 		supply->nb.notifier_call = rockchip_iodomain_notify;
 
-		ret = rockchip_iodomain_write(supply, uV);
+		ret = iod->write(supply, uV);
 		if (ret) {
 			supply->reg = NULL;
 			goto unreg_notify;
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] dt-bindings: soc: rockchip: add rk3568-pmu-io-domain support
  2021-05-27  8:29 [PATCH v2 0/3] rockchip io domain Jianqun Xu
  2021-05-27  8:29 ` [PATCH v2 1/3] dt-bindings: soc: rockchip: convert io-domain.txt to YAML Jianqun Xu
  2021-05-27  8:29 ` [PATCH v2 2/3] soc: rockchip: io-domain: add rk3568 support Jianqun Xu
@ 2021-05-27  8:29 ` Jianqun Xu
  2 siblings, 0 replies; 7+ messages in thread
From: Jianqun Xu @ 2021-05-27  8:29 UTC (permalink / raw)
  To: heiko, lee.jones, ulf.hansson, robh+dt
  Cc: devicetree, jbx6244, linux-rockchip, linux-kernel, Jianqun Xu

Add support for rk3568-pmu-io-domain.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
v2:
- first version
 Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml b/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml
index 2931e0ea8fa8..debfcadd3f2f 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml
+++ b/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml
@@ -24,6 +24,7 @@ properties:
             - rockchip,rk3368-pmu-io-voltage-domain
             - rockchip,rk3399-io-voltage-domain
             - rockchip,rk3399-pmu-io-voltage-domain
+            - rockchip,rk3568-pmu-io-voltage-domain
             - rockchip,rv1108-io-voltage-domain
             - rockchip,rv1108-pmu-io-voltage-domain
 
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: soc: rockchip: convert io-domain.txt to YAML
  2021-05-27  8:29 ` [PATCH v2 1/3] dt-bindings: soc: rockchip: convert io-domain.txt to YAML Jianqun Xu
@ 2021-05-27 14:23   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2021-05-27 14:23 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: devicetree, heiko, lee.jones, linux-rockchip, ulf.hansson,
	linux-kernel, robh+dt, jbx6244

On Thu, 27 May 2021 16:29:03 +0800, Jianqun Xu wrote:
> This patch moves the rockchip-io-domain.txt from power/avs dir to soc
> dir and rename to io-domain.txt, without any change in the step.
> 
> Then covert the io-domain.txt to YAML.
> 
> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
> ---
> v2:
> - first version
>  .../bindings/power/rockchip-io-domain.txt     | 135 ------------------
>  .../bindings/soc/rockchip/io-domain.yaml      |  45 ++++++
>  2 files changed, 45 insertions(+), 135 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/power/rockchip-io-domain.txt
>  create mode 100644 Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml:17:13: [warning] wrong indentation: expected 14 but found 12 (indentation)
./Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml:36:1: [error] syntax error: found character '\t' that cannot start any token (syntax)

dtschema/dtc warnings/errors:
make[1]: *** Deleting file 'Documentation/devicetree/bindings/soc/rockchip/io-domain.example.dts'
Traceback (most recent call last):
  File "/usr/local/bin/dt-extract-example", line 45, in <module>
    binding = yaml.load(open(args.yamlfile, encoding='utf-8').read())
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 421, in load
    return constructor.get_single_data()
  File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 109, in get_single_data
    node = self.composer.get_single_node()
  File "_ruamel_yaml.pyx", line 706, in _ruamel_yaml.CParser.get_single_node
  File "_ruamel_yaml.pyx", line 724, in _ruamel_yaml.CParser._compose_document
  File "_ruamel_yaml.pyx", line 775, in _ruamel_yaml.CParser._compose_node
  File "_ruamel_yaml.pyx", line 889, in _ruamel_yaml.CParser._compose_mapping_node
  File "_ruamel_yaml.pyx", line 773, in _ruamel_yaml.CParser._compose_node
  File "_ruamel_yaml.pyx", line 848, in _ruamel_yaml.CParser._compose_sequence_node
  File "_ruamel_yaml.pyx", line 904, in _ruamel_yaml.CParser._parse_next_event
ruamel.yaml.scanner.ScannerError: while scanning a block scalar
  in "<unicode string>", line 32, column 5
found a tab character where an indentation space is expected
  in "<unicode string>", line 36, column 1
make[1]: *** [Documentation/devicetree/bindings/Makefile:20: Documentation/devicetree/bindings/soc/rockchip/io-domain.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs....
./Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml:  while scanning a block scalar
  in "<unicode string>", line 32, column 5
found a tab character where an indentation space is expected
  in "<unicode string>", line 36, column 1
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml: ignoring, error parsing file
warning: no schema found in file: ./Documentation/devicetree/bindings/soc/rockchip/io-domain.yaml
make: *** [Makefile:1416: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1484505

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/3] soc: rockchip: io-domain: add rk3568 support
  2021-05-27  8:29 ` [PATCH v2 2/3] soc: rockchip: io-domain: add rk3568 support Jianqun Xu
@ 2021-08-05 13:02   ` Peter Geis
  2021-08-05 14:10     ` Heiko Stübner
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Geis @ 2021-08-05 13:02 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: Heiko Stuebner, Lee Jones, Ulf Hansson, Rob Herring, devicetree,
	Johan Jonker, open list:ARM/Rockchip SoC...,
	Linux Kernel Mailing List

On Thu, May 27, 2021 at 4:31 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
>
> The io-domain registers on RK3568 SoCs have three separated bits to
> enable/disable the 1.8v/2.5v/3.3v power.
>
> This patch make the write to be a operation, allow rk3568 uses a private
> register set function.
>
> Since the 2.5v is not used on RK3568, so the driver only set
> 1.8v [enable] + 3.3v [disable] for 1.8v mode
> 1.8v [disable] + 3.3v [enable] for 3.3v mode

Good Morning,

I see this still hasn't landed, but for what it's worth I've been
running it for months and it seems to work well.
(Also it's necessary for sdio support)

Tested on Quartz64 Model A, Quartz64 Model B.
So - Tested-by: Peter Geis <pgwipeout@gmail.com>

>
> There is not register order requirement which has been cleared by our IC
> team.
>
> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
> ---
> v2:
> - none
>  drivers/soc/rockchip/io-domain.c | 88 +++++++++++++++++++++++++++++---
>  1 file changed, 80 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c
> index cf8182fc3642..13c446fd33a9 100644
> --- a/drivers/soc/rockchip/io-domain.c
> +++ b/drivers/soc/rockchip/io-domain.c
> @@ -51,13 +51,11 @@
>  #define RK3399_PMUGRF_CON0_VSEL                BIT(8)
>  #define RK3399_PMUGRF_VSEL_SUPPLY_NUM  9
>
> -struct rockchip_iodomain;
> +#define RK3568_PMU_GRF_IO_VSEL0                (0x0140)
> +#define RK3568_PMU_GRF_IO_VSEL1                (0x0144)
> +#define RK3568_PMU_GRF_IO_VSEL2                (0x0148)
>
> -struct rockchip_iodomain_soc_data {
> -       int grf_offset;
> -       const char *supply_names[MAX_SUPPLIES];
> -       void (*init)(struct rockchip_iodomain *iod);
> -};
> +struct rockchip_iodomain;
>
>  struct rockchip_iodomain_supply {
>         struct rockchip_iodomain *iod;
> @@ -66,13 +64,62 @@ struct rockchip_iodomain_supply {
>         int idx;
>  };
>
> +struct rockchip_iodomain_soc_data {
> +       int grf_offset;
> +       const char *supply_names[MAX_SUPPLIES];
> +       void (*init)(struct rockchip_iodomain *iod);
> +       int (*write)(struct rockchip_iodomain_supply *supply, int uV);
> +};
> +
>  struct rockchip_iodomain {
>         struct device *dev;
>         struct regmap *grf;
>         const struct rockchip_iodomain_soc_data *soc_data;
>         struct rockchip_iodomain_supply supplies[MAX_SUPPLIES];
> +       int (*write)(struct rockchip_iodomain_supply *supply, int uV);
>  };
>
> +static int rk3568_iodomain_write(struct rockchip_iodomain_supply *supply, int uV)
> +{
> +       struct rockchip_iodomain *iod = supply->iod;
> +       u32 is_3v3 = uV > MAX_VOLTAGE_1_8;
> +       u32 val0, val1;
> +       int b;
> +
> +       switch (supply->idx) {
> +       case 0: /* pmuio1 */
> +               break;
> +       case 1: /* pmuio2 */
> +               b = supply->idx;
> +               val0 = BIT(16 + b) | (is_3v3 ? 0 : BIT(b));
> +               b = supply->idx + 4;
> +               val1 = BIT(16 + b) | (is_3v3 ? BIT(b) : 0);
> +
> +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL2, val0);
> +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL2, val1);
> +               break;
> +       case 3: /* vccio2 */
> +               break;
> +       case 2: /* vccio1 */
> +       case 4: /* vccio3 */
> +       case 5: /* vccio4 */
> +       case 6: /* vccio5 */
> +       case 7: /* vccio6 */
> +       case 8: /* vccio7 */
> +               b = supply->idx - 1;
> +               val0 = BIT(16 + b) | (is_3v3 ? 0 : BIT(b));
> +               val1 = BIT(16 + b) | (is_3v3 ? BIT(b) : 0);
> +
> +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL0, val0);
> +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL1, val1);
> +               break;
> +       default:
> +               return -EINVAL;
> +       };
> +
> +       return 0;
> +}
> +
>  static int rockchip_iodomain_write(struct rockchip_iodomain_supply *supply,
>                                    int uV)
>  {
> @@ -136,7 +183,7 @@ static int rockchip_iodomain_notify(struct notifier_block *nb,
>                         return NOTIFY_BAD;
>         }
>
> -       ret = rockchip_iodomain_write(supply, uV);
> +       ret = supply->iod->write(supply, uV);
>         if (ret && event == REGULATOR_EVENT_PRE_VOLTAGE_CHANGE)
>                 return NOTIFY_BAD;
>
> @@ -398,6 +445,22 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
>         .init = rk3399_pmu_iodomain_init,
>  };
>
> +static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = {
> +       .grf_offset = 0x140,
> +       .supply_names = {
> +               "pmuio1",
> +               "pmuio2",
> +               "vccio1",
> +               "vccio2",
> +               "vccio3",
> +               "vccio4",
> +               "vccio5",
> +               "vccio6",
> +               "vccio7",
> +       },
> +       .write = rk3568_iodomain_write,
> +};
> +
>  static const struct rockchip_iodomain_soc_data soc_data_rv1108 = {
>         .grf_offset = 0x404,
>         .supply_names = {
> @@ -469,6 +532,10 @@ static const struct of_device_id rockchip_iodomain_match[] = {
>                 .compatible = "rockchip,rk3399-pmu-io-voltage-domain",
>                 .data = &soc_data_rk3399_pmu
>         },
> +       {
> +               .compatible = "rockchip,rk3568-pmu-io-voltage-domain",
> +               .data = &soc_data_rk3568_pmu
> +       },
>         {
>                 .compatible = "rockchip,rv1108-io-voltage-domain",
>                 .data = &soc_data_rv1108
> @@ -502,6 +569,11 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
>         match = of_match_node(rockchip_iodomain_match, np);
>         iod->soc_data = match->data;
>
> +       if (iod->soc_data->write)
> +               iod->write = iod->soc_data->write;
> +       else
> +               iod->write = rockchip_iodomain_write;
> +
>         parent = pdev->dev.parent;
>         if (parent && parent->of_node) {
>                 iod->grf = syscon_node_to_regmap(parent->of_node);
> @@ -562,7 +634,7 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
>                 supply->reg = reg;
>                 supply->nb.notifier_call = rockchip_iodomain_notify;
>
> -               ret = rockchip_iodomain_write(supply, uV);
> +               ret = iod->write(supply, uV);
>                 if (ret) {
>                         supply->reg = NULL;
>                         goto unreg_notify;
> --
> 2.25.1
>
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/3] soc: rockchip: io-domain: add rk3568 support
  2021-08-05 13:02   ` Peter Geis
@ 2021-08-05 14:10     ` Heiko Stübner
  0 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2021-08-05 14:10 UTC (permalink / raw)
  To: Jianqun Xu, Peter Geis
  Cc: Lee Jones, Ulf Hansson, Rob Herring, devicetree, Johan Jonker,
	open list:ARM/Rockchip SoC...,
	Linux Kernel Mailing List

Am Donnerstag, 5. August 2021, 15:02:21 CEST schrieb Peter Geis:
> On Thu, May 27, 2021 at 4:31 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
> >
> > The io-domain registers on RK3568 SoCs have three separated bits to
> > enable/disable the 1.8v/2.5v/3.3v power.
> >
> > This patch make the write to be a operation, allow rk3568 uses a private
> > register set function.
> >
> > Since the 2.5v is not used on RK3568, so the driver only set
> > 1.8v [enable] + 3.3v [disable] for 1.8v mode
> > 1.8v [disable] + 3.3v [enable] for 3.3v mode
> 
> Good Morning,
> 
> I see this still hasn't landed, but for what it's worth I've been
> running it for months and it seems to work well.
> (Also it's necessary for sdio support)
> 
> Tested on Quartz64 Model A, Quartz64 Model B.
> So - Tested-by: Peter Geis <pgwipeout@gmail.com>

Just for people reading along, Michael has picked this up and adapted
the binding addition to the already landed yaml conversion, see

https://lore.kernel.org/r/20210805120107.27007-1-michael.riesch@wolfvision.net


Heiko

> 
> >
> > There is not register order requirement which has been cleared by our IC
> > team.
> >
> > Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
> > ---
> > v2:
> > - none
> >  drivers/soc/rockchip/io-domain.c | 88 +++++++++++++++++++++++++++++---
> >  1 file changed, 80 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c
> > index cf8182fc3642..13c446fd33a9 100644
> > --- a/drivers/soc/rockchip/io-domain.c
> > +++ b/drivers/soc/rockchip/io-domain.c
> > @@ -51,13 +51,11 @@
> >  #define RK3399_PMUGRF_CON0_VSEL                BIT(8)
> >  #define RK3399_PMUGRF_VSEL_SUPPLY_NUM  9
> >
> > -struct rockchip_iodomain;
> > +#define RK3568_PMU_GRF_IO_VSEL0                (0x0140)
> > +#define RK3568_PMU_GRF_IO_VSEL1                (0x0144)
> > +#define RK3568_PMU_GRF_IO_VSEL2                (0x0148)
> >
> > -struct rockchip_iodomain_soc_data {
> > -       int grf_offset;
> > -       const char *supply_names[MAX_SUPPLIES];
> > -       void (*init)(struct rockchip_iodomain *iod);
> > -};
> > +struct rockchip_iodomain;
> >
> >  struct rockchip_iodomain_supply {
> >         struct rockchip_iodomain *iod;
> > @@ -66,13 +64,62 @@ struct rockchip_iodomain_supply {
> >         int idx;
> >  };
> >
> > +struct rockchip_iodomain_soc_data {
> > +       int grf_offset;
> > +       const char *supply_names[MAX_SUPPLIES];
> > +       void (*init)(struct rockchip_iodomain *iod);
> > +       int (*write)(struct rockchip_iodomain_supply *supply, int uV);
> > +};
> > +
> >  struct rockchip_iodomain {
> >         struct device *dev;
> >         struct regmap *grf;
> >         const struct rockchip_iodomain_soc_data *soc_data;
> >         struct rockchip_iodomain_supply supplies[MAX_SUPPLIES];
> > +       int (*write)(struct rockchip_iodomain_supply *supply, int uV);
> >  };
> >
> > +static int rk3568_iodomain_write(struct rockchip_iodomain_supply *supply, int uV)
> > +{
> > +       struct rockchip_iodomain *iod = supply->iod;
> > +       u32 is_3v3 = uV > MAX_VOLTAGE_1_8;
> > +       u32 val0, val1;
> > +       int b;
> > +
> > +       switch (supply->idx) {
> > +       case 0: /* pmuio1 */
> > +               break;
> > +       case 1: /* pmuio2 */
> > +               b = supply->idx;
> > +               val0 = BIT(16 + b) | (is_3v3 ? 0 : BIT(b));
> > +               b = supply->idx + 4;
> > +               val1 = BIT(16 + b) | (is_3v3 ? BIT(b) : 0);
> > +
> > +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL2, val0);
> > +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL2, val1);
> > +               break;
> > +       case 3: /* vccio2 */
> > +               break;
> > +       case 2: /* vccio1 */
> > +       case 4: /* vccio3 */
> > +       case 5: /* vccio4 */
> > +       case 6: /* vccio5 */
> > +       case 7: /* vccio6 */
> > +       case 8: /* vccio7 */
> > +               b = supply->idx - 1;
> > +               val0 = BIT(16 + b) | (is_3v3 ? 0 : BIT(b));
> > +               val1 = BIT(16 + b) | (is_3v3 ? BIT(b) : 0);
> > +
> > +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL0, val0);
> > +               regmap_write(iod->grf, RK3568_PMU_GRF_IO_VSEL1, val1);
> > +               break;
> > +       default:
> > +               return -EINVAL;
> > +       };
> > +
> > +       return 0;
> > +}
> > +
> >  static int rockchip_iodomain_write(struct rockchip_iodomain_supply *supply,
> >                                    int uV)
> >  {
> > @@ -136,7 +183,7 @@ static int rockchip_iodomain_notify(struct notifier_block *nb,
> >                         return NOTIFY_BAD;
> >         }
> >
> > -       ret = rockchip_iodomain_write(supply, uV);
> > +       ret = supply->iod->write(supply, uV);
> >         if (ret && event == REGULATOR_EVENT_PRE_VOLTAGE_CHANGE)
> >                 return NOTIFY_BAD;
> >
> > @@ -398,6 +445,22 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
> >         .init = rk3399_pmu_iodomain_init,
> >  };
> >
> > +static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = {
> > +       .grf_offset = 0x140,
> > +       .supply_names = {
> > +               "pmuio1",
> > +               "pmuio2",
> > +               "vccio1",
> > +               "vccio2",
> > +               "vccio3",
> > +               "vccio4",
> > +               "vccio5",
> > +               "vccio6",
> > +               "vccio7",
> > +       },
> > +       .write = rk3568_iodomain_write,
> > +};
> > +
> >  static const struct rockchip_iodomain_soc_data soc_data_rv1108 = {
> >         .grf_offset = 0x404,
> >         .supply_names = {
> > @@ -469,6 +532,10 @@ static const struct of_device_id rockchip_iodomain_match[] = {
> >                 .compatible = "rockchip,rk3399-pmu-io-voltage-domain",
> >                 .data = &soc_data_rk3399_pmu
> >         },
> > +       {
> > +               .compatible = "rockchip,rk3568-pmu-io-voltage-domain",
> > +               .data = &soc_data_rk3568_pmu
> > +       },
> >         {
> >                 .compatible = "rockchip,rv1108-io-voltage-domain",
> >                 .data = &soc_data_rv1108
> > @@ -502,6 +569,11 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
> >         match = of_match_node(rockchip_iodomain_match, np);
> >         iod->soc_data = match->data;
> >
> > +       if (iod->soc_data->write)
> > +               iod->write = iod->soc_data->write;
> > +       else
> > +               iod->write = rockchip_iodomain_write;
> > +
> >         parent = pdev->dev.parent;
> >         if (parent && parent->of_node) {
> >                 iod->grf = syscon_node_to_regmap(parent->of_node);
> > @@ -562,7 +634,7 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
> >                 supply->reg = reg;
> >                 supply->nb.notifier_call = rockchip_iodomain_notify;
> >
> > -               ret = rockchip_iodomain_write(supply, uV);
> > +               ret = iod->write(supply, uV);
> >                 if (ret) {
> >                         supply->reg = NULL;
> >                         goto unreg_notify;
> > --
> > 2.25.1
> >
> >
> >
> >
> > _______________________________________________
> > Linux-rockchip mailing list
> > Linux-rockchip@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-rockchip
> 





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-05 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27  8:29 [PATCH v2 0/3] rockchip io domain Jianqun Xu
2021-05-27  8:29 ` [PATCH v2 1/3] dt-bindings: soc: rockchip: convert io-domain.txt to YAML Jianqun Xu
2021-05-27 14:23   ` Rob Herring
2021-05-27  8:29 ` [PATCH v2 2/3] soc: rockchip: io-domain: add rk3568 support Jianqun Xu
2021-08-05 13:02   ` Peter Geis
2021-08-05 14:10     ` Heiko Stübner
2021-05-27  8:29 ` [PATCH v2 3/3] dt-bindings: soc: rockchip: add rk3568-pmu-io-domain support Jianqun Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).