soc: s4: Add support for power domains controller
authorShunzhou Jiang <shunzhou.jiang@amlogic.com>
Mon, 7 Mar 2022 02:53:57 +0000 (10:53 +0800)
committerNeil Armstrong <narmstrong@baylibre.com>
Mon, 7 Mar 2022 08:40:39 +0000 (09:40 +0100)
Add support s4 Power controller. In s4, power control
registers are in secure domain, and should be accessed by smc.

Signed-off-by: Shunzhou Jiang <shunzhou.jiang@amlogic.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/20220307025357.1368673-3-shunzhou.jiang@amlogic.com
drivers/soc/amlogic/meson-secure-pwrc.c

index 59bd195..a10a417 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <dt-bindings/power/meson-a1-power.h>
+#include <dt-bindings/power/meson-s4-power.h>
 #include <linux/arm-smccc.h>
 #include <linux/firmware/meson/meson_sm.h>
 #include <linux/module.h>
@@ -119,6 +120,18 @@ static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
        SEC_PD(RSA,     0),
 };
 
+static struct meson_secure_pwrc_domain_desc s4_pwrc_domains[] = {
+       SEC_PD(S4_DOS_HEVC,     0),
+       SEC_PD(S4_DOS_VDEC,     0),
+       SEC_PD(S4_VPU_HDMI,     0),
+       SEC_PD(S4_USB_COMB,     0),
+       SEC_PD(S4_GE2D,         0),
+       /* ETH is for ethernet online wakeup, and should be always on */
+       SEC_PD(S4_ETH,          GENPD_FLAG_ALWAYS_ON),
+       SEC_PD(S4_DEMOD,        0),
+       SEC_PD(S4_AUDIO,        0),
+};
+
 static int meson_secure_pwrc_probe(struct platform_device *pdev)
 {
        int i;
@@ -187,11 +200,20 @@ static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = {
        .count = ARRAY_SIZE(a1_pwrc_domains),
 };
 
+static struct meson_secure_pwrc_domain_data meson_secure_s4_pwrc_data = {
+       .domains = s4_pwrc_domains,
+       .count = ARRAY_SIZE(s4_pwrc_domains),
+};
+
 static const struct of_device_id meson_secure_pwrc_match_table[] = {
        {
                .compatible = "amlogic,meson-a1-pwrc",
                .data = &meson_secure_a1_pwrc_data,
        },
+       {
+               .compatible = "amlogic,meson-s4-pwrc",
+               .data = &meson_secure_s4_pwrc_data,
+       },
        { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, meson_secure_pwrc_match_table);