summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2021-08-26 11:17:45 +0200
committerArnd Bergmann <arnd@arndb.de>2021-08-26 11:17:46 +0200
commit9b3878a99ad606fe76a50a290273d7b801f0f895 (patch)
tree507414e2366114b857ae988b8af526790b2a362a
parent5c785014b67fb25d8e2a36d24940dad0c416a005 (diff)
parent9e5747c57807ad8a04c356340190cfdd0bd54111 (diff)
Merge tag 'v5.15-rockchip-driver1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into arm/drivers
Yaml conversion of io-domain bindings and addition of rk3568 io domains. * tag 'v5.15-rockchip-driver1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip: soc: rockchip: io-domain: Remove unneeded semicolon soc: rockchip: io-domain: add rk3568 support dt-bindings: power: add rk3568-pmu-io-domain support dt-bindings: soc: rockchip: add rockchip-io-domain.yaml object to grf.yaml dt-bindings: power: convert rockchip-io-domain.txt to YAML soc: rockchip: ROCKCHIP_GRF should not default to y, unconditionally Link: https://lore.kernel.org/r/9718620.EvYhyI6sBW@phil Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--Documentation/devicetree/bindings/power/rockchip-io-domain.txt135
-rw-r--r--Documentation/devicetree/bindings/power/rockchip-io-domain.yaml360
-rw-r--r--Documentation/devicetree/bindings/soc/rockchip/grf.yaml19
-rw-r--r--drivers/soc/rockchip/Kconfig4
-rw-r--r--drivers/soc/rockchip/io-domain.c88
5 files changed, 455 insertions, 151 deletions
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/power/rockchip-io-domain.yaml b/Documentation/devicetree/bindings/power/rockchip-io-domain.yaml
new file mode 100644
index 000000000000..1727bf108979
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/rockchip-io-domain.yaml
@@ -0,0 +1,360 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/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>
+
+description: |
+ 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 SoCs
+ General Register File (GRF) in sync with the actual value of a voltage
+ hooked up to the pins.
+
+ Note that this driver specifically does not 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 regulators 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.
+
+ 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.
+
+properties:
+ compatible:
+ 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,rk3568-pmu-io-voltage-domain
+ - rockchip,rv1108-io-voltage-domain
+ - rockchip,rv1108-pmu-io-voltage-domain
+
+required:
+ - compatible
+
+unevaluatedProperties: false
+
+allOf:
+ - $ref: "#/$defs/px30"
+ - $ref: "#/$defs/px30-pmu"
+ - $ref: "#/$defs/rk3188"
+ - $ref: "#/$defs/rk3228"
+ - $ref: "#/$defs/rk3288"
+ - $ref: "#/$defs/rk3328"
+ - $ref: "#/$defs/rk3368"
+ - $ref: "#/$defs/rk3368-pmu"
+ - $ref: "#/$defs/rk3399"
+ - $ref: "#/$defs/rk3399-pmu"
+ - $ref: "#/$defs/rk3568-pmu"
+ - $ref: "#/$defs/rv1108"
+ - $ref: "#/$defs/rv1108-pmu"
+
+$defs:
+ px30:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,px30-io-voltage-domain
+
+ then:
+ properties:
+ vccio1-supply:
+ description: The supply connected to VCCIO1.
+ vccio2-supply:
+ description: The supply connected to VCCIO2.
+ vccio3-supply:
+ description: The supply connected to VCCIO3.
+ vccio4-supply:
+ description: The supply connected to VCCIO4.
+ vccio5-supply:
+ description: The supply connected to VCCIO5.
+ vccio6-supply:
+ description: The supply connected to VCCIO6.
+ vccio-oscgpi-supply:
+ description: The supply connected to VCCIO_OSCGPI.
+
+ px30-pmu:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,px30-pmu-io-voltage-domain
+
+ then:
+ properties:
+ pmuio1-supply:
+ description: The supply connected to PMUIO1.
+ pmuio2-supply:
+ description: The supply connected to PMUIO2.
+
+ rk3188:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3188-io-voltage-domain
+
+ then:
+ properties:
+ ap0-supply:
+ description: The supply connected to AP0_VCC.
+ ap1-supply:
+ description: The supply connected to AP1_VCC.
+ cif-supply:
+ description: The supply connected to CIF_VCC.
+ flash-supply:
+ description: The supply connected to FLASH_VCC.
+ lcdc0-supply:
+ description: The supply connected to LCD0_VCC.
+ lcdc1-supply:
+ description: The supply connected to LCD1_VCC.
+ vccio0-supply:
+ description: The supply connected to VCCIO0.
+ vccio1-supply:
+ description: The supply connected to VCCIO1. Also labeled as VCCIO2.
+
+ rk3228:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3228-io-voltage-domain
+
+ then:
+ properties:
+ vccio1-supply:
+ description: The supply connected to VCCIO1.
+ vccio2-supply:
+ description: The supply connected to VCCIO2.
+ vccio3-supply:
+ description: The supply connected to VCCIO3.
+ vccio4-supply:
+ description: The supply connected to VCCIO4.
+
+ rk3288:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3288-io-voltage-domain
+
+ then:
+ properties:
+ audio-supply:
+ description: The supply connected to APIO4_VDD.
+ bb-supply:
+ description: The supply connected to APIO5_VDD.
+ dvp-supply:
+ description: The supply connected to DVPIO_VDD.
+ flash0-supply:
+ description: The supply connected to FLASH0_VDD. Typically for eMMC.
+ flash1-supply:
+ description: The supply connected to FLASH1_VDD. Also known as SDIO1.
+ gpio30-supply:
+ description: The supply connected to APIO1_VDD.
+ gpio1830-supply:
+ description: The supply connected to APIO2_VDD.
+ lcdc-supply:
+ description: The supply connected to LCDC_VDD.
+ sdcard-supply:
+ description: The supply connected to SDMMC0_VDD.
+ wifi-supply:
+ description: The supply connected to APIO3_VDD. Also known as SDIO0.
+
+ rk3328:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3328-io-voltage-domain
+
+ then:
+ properties:
+ vccio1-supply:
+ description: The supply connected to VCCIO1.
+ vccio2-supply:
+ description: The supply connected to VCCIO2.
+ vccio3-supply:
+ description: The supply connected to VCCIO3.
+ vccio4-supply:
+ description: The supply connected to VCCIO4.
+ vccio5-supply:
+ description: The supply connected to VCCIO5.
+ vccio6-supply:
+ description: The supply connected to VCCIO6.
+ pmuio-supply:
+ description: The supply connected to VCCIO_PMU.
+
+ rk3368:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3368-io-voltage-domain
+
+ then:
+ properties:
+ audio-supply:
+ description: The supply connected to APIO3_VDD.
+ dvp-supply:
+ description: The supply connected to DVPIO_VDD.
+ flash0-supply:
+ description: The supply connected to FLASH0_VDD. Typically for eMMC.
+ gpio30-supply:
+ description: The supply connected to APIO1_VDD.
+ gpio1830-supply:
+ description: The supply connected to APIO4_VDD.
+ sdcard-supply:
+ description: The supply connected to SDMMC0_VDD.
+ wifi-supply:
+ description: The supply connected to APIO2_VDD. Also known as SDIO0.
+
+ rk3368-pmu:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3368-pmu-io-voltage-domain
+
+ then:
+ properties:
+ pmu-supply:
+ description: The supply connected to PMUIO_VDD.
+ vop-supply:
+ description: The supply connected to LCDC_VDD.
+
+ rk3399:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3399-io-voltage-domain
+
+ then:
+ properties:
+ audio-supply:
+ description: The supply connected to APIO5_VDD.
+ bt656-supply:
+ description: The supply connected to APIO2_VDD.
+ gpio1830-supply:
+ description: The supply connected to APIO4_VDD.
+ sdmmc-supply:
+ description: The supply connected to SDMMC0_VDD.
+
+ rk3399-pmu:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3399-pmu-io-voltage-domain
+
+ then:
+ properties:
+ pmu1830-supply:
+ description: The supply connected to PMUIO2_VDD.
+
+ rk3568-pmu:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rk3568-pmu-io-voltage-domain
+
+ then:
+ properties:
+ pmuio1-supply:
+ description: The supply connected to PMUIO1.
+ pmuio2-supply:
+ description: The supply connected to PMUIO2.
+ vccio1-supply:
+ description: The supply connected to VCCIO1.
+ vccio2-supply:
+ description: The supply connected to VCCIO2.
+ vccio3-supply:
+ description: The supply connected to VCCIO3.
+ vccio4-supply:
+ description: The supply connected to VCCIO4.
+ vccio5-supply:
+ description: The supply connected to VCCIO5.
+ vccio6-supply:
+ description: The supply connected to VCCIO6.
+ vccio7-supply:
+ description: The supply connected to VCCIO7.
+
+ rv1108:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rv1108-io-voltage-domain
+
+ then:
+ properties:
+ vccio1-supply:
+ description: The supply connected to APIO1_VDD.
+ vccio2-supply:
+ description: The supply connected to APIO2_VDD.
+ vccio3-supply:
+ description: The supply connected to APIO3_VDD.
+ vccio5-supply:
+ description: The supply connected to APIO5_VDD.
+ vccio6-supply:
+ description: The supply connected to APIO6_VDD.
+
+ rv1108-pmu:
+ if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,rv1108-pmu-io-voltage-domain
+
+ then:
+ properties:
+ pmu-supply:
+ description: The supply connected to PMUIO_VDD.
+
+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>;
+ };
diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
index 62fa72cfea34..dfebf425ca49 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
+++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
@@ -15,7 +15,6 @@ properties:
- items:
- enum:
- rockchip,rk3288-sgrf
- - rockchip,rv1108-pmugrf
- rockchip,rv1108-usbgrf
- const: syscon
- items:
@@ -41,6 +40,7 @@ properties:
- rockchip,rk3568-grf
- rockchip,rk3568-pmugrf
- rockchip,rv1108-grf
+ - rockchip,rv1108-pmugrf
- const: syscon
- const: simple-mfd
@@ -198,21 +198,28 @@ allOf:
compatible:
contains:
enum:
- - rockchip,px30-pmugrf
- rockchip,px30-grf
+ - rockchip,px30-pmugrf
+ - rockchip,rk3188-grf
- rockchip,rk3228-grf
- rockchip,rk3288-grf
- rockchip,rk3328-grf
- - rockchip,rk3368-pmugrf
- rockchip,rk3368-grf
- - rockchip,rk3399-pmugrf
+ - rockchip,rk3368-pmugrf
- rockchip,rk3399-grf
+ - rockchip,rk3399-pmugrf
+ - rockchip,rk3568-pmugrf
+ - rockchip,rv1108-grf
+ - rockchip,rv1108-pmugrf
then:
properties:
io-domains:
- description:
- Documentation/devicetree/bindings/power/rockchip-io-domain.txt
+ type: object
+
+ $ref: "/schemas/power/rockchip-io-domain.yaml#"
+
+ unevaluatedProperties: false
examples:
- |
diff --git a/drivers/soc/rockchip/Kconfig b/drivers/soc/rockchip/Kconfig
index 2c13bf4dd5db..25eb2c1e31bb 100644
--- a/drivers/soc/rockchip/Kconfig
+++ b/drivers/soc/rockchip/Kconfig
@@ -6,8 +6,8 @@ if ARCH_ROCKCHIP || COMPILE_TEST
#
config ROCKCHIP_GRF
- bool
- default y
+ bool "Rockchip General Register Files support" if COMPILE_TEST
+ default y if ARCH_ROCKCHIP
help
The General Register Files are a central component providing
special additional settings registers for a lot of soc-components.
diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c
index cf8182fc3642..9df513d1219b 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 = {
@@ -470,6 +533,10 @@ static const struct of_device_id rockchip_iodomain_match[] = {
.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;