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 96331fd..50f35d5 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 d926815..9dbd923 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 0864c6f..d8de340 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 2b1a806..32ba3e4 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 9125cf8..e159aa6 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 c76fb65..dfc36e9 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 d85f153..0fe9914 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 777826f..3da533a 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 c60d641..92f4b6b 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 a0a02ef..efabf3b 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 77e2acc..a99892a 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 061ed81..3c862a2 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 19c0e55..96b7622 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 6ce90d7..9f38793 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 a0f4a08..7b760b7 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 e6a0ebc..cc0941f 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 a0b68a1..8c1a639 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 ab1a3e8..f5e6e91 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 bd6a808..c41cf0f 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 2e828cf..25c57a6 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 40d7c54..0402bec 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 c8ee9dc..2e18b04 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 efc6393..3bb1375 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 13e13ef..0e3f4eb 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 8228001..951a3dc 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);