supsend: update gx_pm driver [1/1]
authorHong Guo <hong.guo@amlogic.com>
Thu, 18 Apr 2019 08:42:01 +0000 (16:42 +0800)
committerHong Guo <hong.guo@amlogic.com>
Tue, 23 Apr 2019 07:59:33 +0000 (00:59 -0700)
PD#SWPL-7226

Problem:
update gx_pm driver

Solution:
update gx_pm driver

Verify:
test pass on tl1_x309

Change-Id: If078b0744cb8ce46029d77512d5755f4d40c2014
Signed-off-by: Hong Guo <hong.guo@amlogic.com>
25 files changed:
arch/arm/boot/dts/amlogic/mesonaxg.dtsi
arch/arm/boot/dts/amlogic/mesong12a.dtsi
arch/arm/boot/dts/amlogic/mesong12b.dtsi
arch/arm/boot/dts/amlogic/mesong12b_a.dtsi
arch/arm/boot/dts/amlogic/mesongxl.dtsi
arch/arm/boot/dts/amlogic/mesongxl_sei210.dtsi
arch/arm/boot/dts/amlogic/mesongxm.dtsi
arch/arm/boot/dts/amlogic/mesonsm1.dtsi
arch/arm/boot/dts/amlogic/mesontl1.dtsi
arch/arm/boot/dts/amlogic/mesontm2.dtsi
arch/arm/boot/dts/amlogic/mesontxl.dtsi
arch/arm/boot/dts/amlogic/mesontxlx.dtsi
arch/arm64/boot/dts/amlogic/mesonaxg.dtsi
arch/arm64/boot/dts/amlogic/mesong12a.dtsi
arch/arm64/boot/dts/amlogic/mesong12b.dtsi
arch/arm64/boot/dts/amlogic/mesong12b_a.dtsi
arch/arm64/boot/dts/amlogic/mesongxl.dtsi
arch/arm64/boot/dts/amlogic/mesongxl_sei210.dtsi
arch/arm64/boot/dts/amlogic/mesongxm.dtsi
arch/arm64/boot/dts/amlogic/mesonsm1.dtsi
arch/arm64/boot/dts/amlogic/mesontl1.dtsi
arch/arm64/boot/dts/amlogic/mesontm2.dtsi
arch/arm64/boot/dts/amlogic/mesontxl.dtsi
arch/arm64/boot/dts/amlogic/mesontxlx.dtsi
drivers/amlogic/pm/gx_pm.c

index 96331fde716e09a91ed213b13cb2111b3fb26500..50f35d5820ec09d73d41fff654482891774db3c1 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                device_name = "aml_pm";
                status = "okay";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
-
        secmon {
                compatible = "amlogic, secmon";
                memory-region = <&secmon_reserved>;
index d926815858c3ed451ce7864cff3d46a4cc1c1712..9dbd9237d9ab55ef0771d9154beeda0f3c824962 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index 0864c6f87c2bc6f59fb024d1e0c2dbefe68a88e8..d8de3401792db0cc96af23b2c860cc6fcc48e18b 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index 2b1a806f56bbebcde3d324a20dda50db8432317c..32ba3e4542e42e7a4823ae2f06fcb49d342c864e 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index 9125cf8609e4303f461abade8f46740c8f613f5a..e159aa654d1725a6c27b48c6ed0607918bb9cc85 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm{
+       aml_pm {
                compatible = "amlogic, pm";
+               status = "okay";
                device_name = "aml_pm";
-               reg = <0xc81000a8 0x4>,
-                       <0xc810023c 0x4>;
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        secmon {
index c76fb65b3fcf4dc1dd4f28271c67b6afbb6b5851..dfc36e9bce33dc91c42bd6afc30c51efc211d7d5 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm{
+       aml_pm {
                compatible = "amlogic, pm";
+               status = "okay";
                device_name = "aml_pm";
-               reg = <0xc81000a8 0x4
-                       0xc810023c 0x4>;
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        secmon {
index d85f15302be30d75c11385195c68cc077b488ba2..0fe9914d6301db655fb15168a8f8cd22cb0a8cf0 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm{
+       aml_pm {
                compatible = "amlogic, pm";
+               status = "okay";
                device_name = "aml_pm";
-               reg = <0xc81000a8 0x4>,
-                       <0xc810023c 0x4>;
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        secmon {
index 777826f3a836d042e9f68eeadde83cd246028450..3da533ad2ee840942ea040e79cbc6ed0482672a6 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index c60d64186c882b7687649244a489c89521f9c09b..92f4b6b7f2b026e31e9ea2d9ce5340c40162c9bc 100644 (file)
                #clock-cells = <0>;
        };
 
-       meson_suspend: pm {
+       aml_pm {
                compatible = "amlogic, pm";
-               /*gxbaby-suspend;*/
                status = "okay";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+                device_name = "aml_pm";
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        cpuinfo {
index a0a02ef17f0a074cb1f752fe37994ddf508f0ea4..efabf3b4fc48d39850c22fa7798fd5b5ab758482 100644 (file)
                #clock-cells = <0>;
        };
 
-       meson_suspend: pm {
+       aml_pm {
                compatible = "amlogic, pm";
-               /*gxbaby-suspend;*/
                status = "okay";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+               device_name = "aml_pm";
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        cpuinfo {
index 77e2acc4bf318428e55af4027bfe0e31e20b90e5..a99892a96c926575432df358b21cec670373de59 100644 (file)
                pinctrl-1=<&jtag_apee_pins>;
        };
 
-       meson_suspend: pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
-               reg = <0xc81000a8 0x4>,
-                               <0xc810023c 0x4>;
+               device_name = "aml_pm";
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        reboot {
index 061ed8102c58cacdbcf8c739661e6cedd7f262c8..3c862a26570d4241ccdb071423e5410540410ae9 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
-               device_name = "aml_pm";
-               /*gxbaby-suspend;*/
                status = "okay";
-               reg = <0xff8000a8 0x4>,
-                       <0xff80023c 0x4>;
+               device_name = "aml_pm";
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index 19c0e551c923c6db620145690414ac43c2c3d468..96b76229144658632fb09df046e303793f15d0b8 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                device_name = "aml_pm";
                status = "okay";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
-
        secmon {
                compatible = "amlogic, secmon";
                memory-region = <&secmon_reserved>;
index 6ce90d7527107457111537e783159f8d7e31b239..9f38793bc357b806e35bb6c16273e59e6a15e1ec 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index a0f4a083660ebd6332ec4b66c24ecbf15f54e9da..7b760b7cb464e16c01b31d97c381b1b5d1460d46 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index e6a0ebcdbc0393bf3d3d9ddcdea087fb38646739..cc0941f5b5c85206252302891efd83a722f826b6 100644 (file)
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index a0b68a157774912f6c02e3e289d32f822ef1eb57..8c1a63984a749cdf59028e543f4942c6c121d219 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm{
+       aml_pm {
                compatible = "amlogic, pm";
+               status = "okay";
                device_name = "aml_pm";
-               reg = <0x0 0xc81000a8 0x0 0x4>,
-                       <0x0 0xc810023c 0x0 0x4>;
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        secmon {
index ab1a3e8b2e743ecd09a67bb9da4d012b896a3f03..f5e6e9151ece0a3f527e5e8d3c6f6c1cf6df50df 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm{
+       aml_pm {
                compatible = "amlogic, pm";
+               status = "okay";
                device_name = "aml_pm";
-               reg = <0x0 0xc81000a8 0x0 0x4
-                       0x0 0xc810023c 0x0 0x4>;
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        secmon {
index bd6a808a52001dd80ae03e225c1d9c3e8736fea1..c41cf0ff5ad8b3ccfc432d70fa01f385be6785db 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm{
+       aml_pm {
                compatible = "amlogic, pm";
+               status = "okay";
                device_name = "aml_pm";
-               reg = <0x0 0xc81000a8 0x0 0x4>,
-                       <0x0 0xc810023c 0x0 0x4>;
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        secmon {
index 2e828cf40fa9e734b70e18a76c25cdbf0ee51eb9..25c57a6bf13406f91c062816142e1b703e5d75dd 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
                device_name = "aml_pm";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index 40d7c5425640246f901534c5d783ecd695eb39b7..0402bec349ec43e4374a072644c2b1de234f2de5 100644 (file)
                #clock-cells = <0>;
        };
 
-       meson_suspend: pm {
+       aml_pm {
                compatible = "amlogic, pm";
-               /*gxbaby-suspend;*/
                status = "okay";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               device_name = "aml_pm";
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        cpuinfo {
index c8ee9dc6529aa6260dfb40282795bf16f5952aa2..2e18b042862e65482ee2bd84e2f17356baa1fe40 100644 (file)
                #clock-cells = <0>;
        };
 
-       meson_suspend: pm {
+       aml_pm {
                compatible = "amlogic, pm";
-               /*gxbaby-suspend;*/
                status = "okay";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               device_name = "aml_pm";
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        cpuinfo {
index efc6393c5623a8d41695c7c16b3dab9c467a87ec..3bb13752dc1e6d983f696ad5c270dccc081155db 100644 (file)
                pinctrl-1=<&jtag_apee_pins>;
        };
 
-       meson_suspend: pm {
+       aml_pm {
                compatible = "amlogic, pm";
                status = "okay";
-               reg = <0x0 0xc81000a8 0x0 0x4>,
-                               <0x0 0xc810023c 0x0 0x4>;
+               device_name = "aml_pm";
+               debug_reg = <0xc81000a8>;
+               exit_reg = <0xc810023c>;
        };
 
        reboot {
index 13e13ef9996c6a570e39fc2caea40d7bb1edf1f2..0e3f4eb7b886b21273e1880369ba6e9e30a4221c 100644 (file)
                method = "smc";
        };
 
-       meson_suspend:pm {
+       aml_pm {
                compatible = "amlogic, pm";
-               device_name = "aml_pm";
-               /*gxbaby-suspend;*/
                status = "okay";
-               reg = <0x0 0xff8000a8 0x0 0x4>,
-                       <0x0 0xff80023c 0x0 0x4>;
+               device_name = "aml_pm";
+               debug_reg = <0xff8000a8>;
+               exit_reg = <0xff80023c>;
        };
 
        secmon {
index 8228001d15b31f99f91a41c10dd451d2e1f3ead4..951a3dc4b7ed9c01f9984a089d3238c0a0d5f8ee 100644 (file)
@@ -218,8 +218,9 @@ static int __init meson_pm_probe(struct platform_device *pdev)
 {
        struct device_node *cpu_node;
        struct device_node *state_node;
-       int count = 0;
+       int count = 0, ret;
        u32 ver = psci_get_version();
+       u32 paddr = 0;
 
        pr_info("enter meson_pm_probe!\n");
 
@@ -245,11 +246,26 @@ static int __init meson_pm_probe(struct platform_device *pdev)
                suspend_set_ops(&meson_gx_ops);
        }
 
-       debug_reg = of_iomap(pdev->dev.of_node, 0);
-       exit_reg = of_iomap(pdev->dev.of_node, 1);
+       ret = of_property_read_u32(pdev->dev.of_node,
+                               "debug_reg", &paddr);
+               if (!ret) {
+                       pr_debug("debug_reg: 0x%x\n", paddr);
+                       debug_reg = ioremap(paddr, 0x4);
+                       if (IS_ERR_OR_NULL(debug_reg))
+                               goto uniomap;
+               }
+
+       ret = of_property_read_u32(pdev->dev.of_node,
+                       "exit_reg", &paddr);
+       if (!ret) {
+               pr_debug("exit_reg: 0x%x\n", paddr);
+               exit_reg = ioremap(paddr, 0x4);
+               if (IS_ERR_OR_NULL(exit_reg))
+                       goto uniomap;
+       }
+
        device_create_file(&pdev->dev, &dev_attr_suspend_reason);
        device_create_file(&pdev->dev, &dev_attr_time_out);
-       device_rename(&pdev->dev, "aml_pm");
 #ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
        if (lgcy_early_suspend_init())
                return -1;
@@ -258,9 +274,13 @@ static int __init meson_pm_probe(struct platform_device *pdev)
 
        pr_info("meson_pm_probe done\n");
        return 0;
+uniomap:
+       if (debug_reg)
+               iounmap(debug_reg);
+       return -ENXIO;
 }
 
-static int __exit meson_pm_remove(struct platform_device *pdev)
+static int meson_pm_remove(struct platform_device *pdev)
 {
        return 0;
 }
@@ -277,12 +297,13 @@ static struct platform_driver meson_pm_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = amlogic_pm_dt_match,
                   },
-       .remove = __exit_p(meson_pm_remove),
+       .probe = meson_pm_probe,
+       .remove = meson_pm_remove,
 };
 
 static int __init meson_pm_init(void)
 {
-       return platform_driver_probe(&meson_pm_driver, meson_pm_probe);
+       return platform_driver_register(&meson_pm_driver);
 }
 
 late_initcall(meson_pm_init);