From 8a1b63b14fe7df811439235606c146faa15faa52 Mon Sep 17 00:00:00 2001 From: Johan Jonker Date: Thu, 24 Mar 2022 13:01:22 +0100 Subject: [PATCH 1/7] dt-bindings: soc: rockchip: add naneng combo phy register compatible Add Naneng combo phy register compatible. Signed-off-by: Johan Jonker Signed-off-by: Yifeng Zhao Acked-by: Rob Herring Link: https://lore.kernel.org/r/20220324120122.1339-1-jbx6244@gmail.com Signed-off-by: Heiko Stuebner --- Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml index b2ba7bed89b2..5079e9d24af6 100644 --- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml +++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml @@ -15,6 +15,8 @@ properties: - items: - enum: - rockchip,rk3288-sgrf + - rockchip,rk3568-pipe-grf + - rockchip,rk3568-pipe-phy-grf - rockchip,rk3568-usb2phy-grf - rockchip,rv1108-usbgrf - const: syscon From 07905844f4880df27a3d80adb07342ec152fd2d7 Mon Sep 17 00:00:00 2001 From: Sebastian Fricke Date: Sat, 26 Mar 2022 19:34:50 +0100 Subject: [PATCH 2/7] soc: rockchip: pm_domains: Fix typo in comment s/eject devices form power domain/eject devices from the power domain/ Signed-off-by: Sebastian Fricke Link: https://lore.kernel.org/r/20220326183451.66115-1-sebastian.fricke@collabora.com Signed-off-by: Heiko Stuebner --- drivers/soc/rockchip/pm_domains.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index 0868b7d406fb..1b029e494274 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -1068,9 +1068,9 @@ static struct platform_driver rockchip_pm_domain_driver = { .name = "rockchip-pm-domain", .of_match_table = rockchip_pm_domain_dt_match, /* - * We can't forcibly eject devices form power domain, - * so we can't really remove power domains once they - * were added. + * We can't forcibly eject devices from the power + * domain, so we can't really remove power domains + * once they were added. */ .suppress_bind_attrs = true, }, From 2a872dd86eeb349f169df0a204668afa578a94b2 Mon Sep 17 00:00:00 2001 From: Peter Geis Date: Fri, 8 Apr 2022 11:12:33 -0400 Subject: [PATCH 3/7] dt-bindings: soc: rockchip: add rk3566-pipe-grf compatible The rk3566 requires special handling for the dwc3-otg clock in order for the port to function correctly. Add a binding for the rk3566-pipe-grf so we can handle setup with the grf driver. Signed-off-by: Peter Geis Acked-by: Rob Herring Link: https://lore.kernel.org/r/20220408151237.3165046-2-pgwipeout@gmail.com Signed-off-by: Heiko Stuebner --- Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml index 5079e9d24af6..75a2b8bb25fb 100644 --- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml +++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml @@ -15,6 +15,7 @@ properties: - items: - enum: - rockchip,rk3288-sgrf + - rockchip,rk3566-pipe-grf - rockchip,rk3568-pipe-grf - rockchip,rk3568-pipe-phy-grf - rockchip,rk3568-usb2phy-grf From 5c0bb71138770d85ea840acd379edc6471b867ee Mon Sep 17 00:00:00 2001 From: Peter Geis Date: Fri, 8 Apr 2022 11:12:34 -0400 Subject: [PATCH 4/7] soc: rockchip: set dwc3 clock for rk3566 The rk3566 dwc3 otg port clock is unavailable at boot, as it defaults to the combophy as the clock source. As combophy0 doesn't exist on rk3566, we need to set the clock source to the usb2 phy instead. Add handling to the grf driver to handle this on boot. Signed-off-by: Peter Geis Link: https://lore.kernel.org/r/20220408151237.3165046-3-pgwipeout@gmail.com Signed-off-by: Heiko Stuebner --- drivers/soc/rockchip/grf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c index 494cf2b5bf7b..384461b70684 100644 --- a/drivers/soc/rockchip/grf.c +++ b/drivers/soc/rockchip/grf.c @@ -108,6 +108,20 @@ static const struct rockchip_grf_info rk3399_grf __initconst = { .num_values = ARRAY_SIZE(rk3399_defaults), }; +#define RK3566_GRF_USB3OTG0_CON1 0x0104 + +static const struct rockchip_grf_value rk3566_defaults[] __initconst = { + { "usb3otg port switch", RK3566_GRF_USB3OTG0_CON1, HIWORD_UPDATE(0, 1, 12) }, + { "usb3otg clock switch", RK3566_GRF_USB3OTG0_CON1, HIWORD_UPDATE(1, 1, 7) }, + { "usb3otg disable usb3", RK3566_GRF_USB3OTG0_CON1, HIWORD_UPDATE(1, 1, 0) }, +}; + +static const struct rockchip_grf_info rk3566_pipegrf __initconst = { + .values = rk3566_defaults, + .num_values = ARRAY_SIZE(rk3566_defaults), +}; + + static const struct of_device_id rockchip_grf_dt_match[] __initconst = { { .compatible = "rockchip,rk3036-grf", @@ -130,6 +144,9 @@ static const struct of_device_id rockchip_grf_dt_match[] __initconst = { }, { .compatible = "rockchip,rk3399-grf", .data = (void *)&rk3399_grf, + }, { + .compatible = "rockchip,rk3566-pipe-grf", + .data = (void *)&rk3566_pipegrf, }, { /* sentinel */ }, }; From 9be1a9996ebd8da27cafc947e4578b2d419dc07e Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Mon, 25 Apr 2022 18:45:42 -0700 Subject: [PATCH 5/7] soc: rockchip: Clean up Kconfig whitespace There are spaces instead of tabs, and other inconsistent indentation. Signed-off-by: Brian Norris Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220426014545.628100-1-briannorris@chromium.org Signed-off-by: Heiko Stuebner --- drivers/soc/rockchip/Kconfig | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/soc/rockchip/Kconfig b/drivers/soc/rockchip/Kconfig index 156ac0e0c8fe..aff2f7e95237 100644 --- a/drivers/soc/rockchip/Kconfig +++ b/drivers/soc/rockchip/Kconfig @@ -23,23 +23,23 @@ config ROCKCHIP_IODOMAIN voltage supplied by the regulators. config ROCKCHIP_PM_DOMAINS - bool "Rockchip generic power domain" - depends on PM - select PM_GENERIC_DOMAINS - help - Say y here to enable power domain support. - In order to meet high performance and low power requirements, a power - management unit is designed or saving power when RK3288 in low power - mode. The RK3288 PMU is dedicated for managing the power of the whole chip. + bool "Rockchip generic power domain" + depends on PM + select PM_GENERIC_DOMAINS + help + Say y here to enable power domain support. + In order to meet high performance and low power requirements, a power + management unit is designed or saving power when RK3288 in low power + mode. The RK3288 PMU is dedicated for managing the power of the whole chip. - If unsure, say N. + If unsure, say N. config ROCKCHIP_DTPM tristate "Rockchip DTPM hierarchy" depends on DTPM && m help - Describe the hierarchy for the Dynamic Thermal Power - Management tree on this platform. That will create all the - power capping capable devices. + Describe the hierarchy for the Dynamic Thermal Power Management tree + on this platform. That will create all the power capping capable + devices. endif From 2ca9e472c70f15de768ab200571e2f6634f66394 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Mon, 25 Apr 2022 18:45:43 -0700 Subject: [PATCH 6/7] soc: rockchip: power-domain: Replace dsb() with smb() It's unclear if these are really needed at all, but seemingly their purpose is only as a write barrier. Use the general macro instead of the ARM-specific one. This driver is partially marked for COMPILE_TEST'ing, but it doesn't build under non-ARM architectures. Fix this up before *really* enabling it for COMPILE_TEST. Signed-off-by: Brian Norris Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220426014545.628100-2-briannorris@chromium.org Signed-off-by: Heiko Stuebner --- drivers/soc/rockchip/pm_domains.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index 1b029e494274..cf16ff9b73b3 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -178,7 +178,7 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd, regmap_update_bits(pmu->regmap, pmu->info->req_offset, pd_info->req_mask, idle ? -1U : 0); - dsb(sy); + wmb(); /* Wait util idle_ack = 1 */ target_ack = idle ? pd_info->ack_mask : 0; @@ -285,7 +285,7 @@ static void rockchip_do_pmu_set_power_domain(struct rockchip_pm_domain *pd, regmap_update_bits(pmu->regmap, pmu->info->pwr_offset, pd->info->pwr_mask, on ? 0 : -1U); - dsb(sy); + wmb(); if (readx_poll_timeout_atomic(rockchip_pmu_domain_is_on, pd, is_on, is_on == on, 0, 10000)) { From add9f6f30e54b5c07e7a0260cda459ef1d9646b7 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Mon, 25 Apr 2022 18:45:44 -0700 Subject: [PATCH 7/7] soc: rockchip: Fix compile-testing SoC drivers Similar to commit 7f94b69ece51 ("ARM: ixp4xx: fix compile-testing soc drivers"). drivers/soc/rockchip/Kconfig makes plenty of provision for configuring drivers either for ARCH_ROCKCHIP or for COMPILE_TEST. But drivers/soc/Makefile pulls the rug out from under us, by refusing to build anything if we specified COMPILE_TEST but not ARCH_ROCKCHIP. Currently, I'm not aware of anything that breaks without this patch, but it certainly makes for confusing builds (CONFIG_ROCKCHIP_PM_DOMAINS=y, but we didn't actually compile the driver?) and leaves room for future error (I have pending patches that break confusingly with COMPILE_TEST=y even though their Kconfig dependencies seem correct [1]). Defer to drivers/soc/rockchip/{Makefile,Kconfig} to do the right thing. [1] e.g., https://lore.kernel.org/linux-rockchip/20220405184816.RFC.2.I2d73b403944f0b8b5871a77585b73f31ccc62999@changeid/ [RFC PATCH 2/2] PM / devfreq: rk3399_dmc: Block PMU during transitions Signed-off-by: Brian Norris Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220425184503.v3.3.Id5f16dec920f620120c0a143a97a12e16d401760@changeid Signed-off-by: Heiko Stuebner --- drivers/soc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 904eec2a7871..3c08514d66f1 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -22,7 +22,7 @@ obj-y += microchip/ obj-y += amlogic/ obj-y += qcom/ obj-y += renesas/ -obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ +obj-y += rockchip/ obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_SOC_SIFIVE) += sifive/ obj-y += sunxi/