Suspend - Resume in Hikey960 platform

Hi @Anonymous,

Now can narrow down suspend stuck issue is related with GPIO19, so at my side I can use below patch as workaround for suspend/resume flow:

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 6e3c143..ed2dbfe 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -379,6 +379,8 @@ static int pl061_suspend(struct device *dev)
        struct pl061_gpio *chip = dev_get_drvdata(dev);
        int offset;
 
+       return 0;
+
        chip->csave_regs.gpio_data = 0;
        chip->csave_regs.gpio_dir = readb(chip->base + GPIODIR);
        chip->csave_regs.gpio_is = readb(chip->base + GPIOIS);
@@ -400,6 +402,8 @@ static int pl061_resume(struct device *dev)
        struct pl061_gpio *chip = dev_get_drvdata(dev);
        int offset;
 
+       return 0;
+
        for (offset = 0; offset < PL061_GPIO_NR; offset++) {
                if (chip->csave_regs.gpio_dir & (BIT(offset)))
                        pl061_direction_output(&chip->gc, offset,

I checked the clock setting for GPIO19, the clock has been enabled properly. So this means except this clock setting, there have other configurations we are missing so cannot access GPIO19 registers properly. I have updated bug tracking: https://bugs.96boards.org/show_bug.cgi?id=611 for following up investigation.

Hi Leo-yan,

Thanks for your support.
I will verify on my side and update you now.

Thanks

Hi Leo-yan,

With above patch also I am seeing the same issue.
System is not resuming back.

echo mem > /sys/power/state
[ 56.847815] PM: suspend entry 1970-01-01 00:02:17.507680722 UTC
[ 56.854043] PM: Syncing filesystems … done.
[ 56.868432] Freezing user space processes … (elapsed 0.002 seconds) done.
[ 56.879627] Freezing remaining freezable tasks … (elapsed 0.002 seconds) done.
[ 56.889395] Suspending console(s) (use no_console_suspend to debug)

Thanks

Hi @Anonymous,

You could enable below debugging configurations for debugging suspend/resume flow:

  1. Enable debug configurations in kernel config:

CONFIG_PM_DEBUG=y
CONFIG_PM_SLEEP_DEBUG=y

  1. Disable console suspend by using kernel command line:

In the file bootimg-960.cfg, you need add “no_console_suspend” at the line of cmdline:

cmdline = loglevel=15 androidboot.hardware=hikey960 androidboot.selinux=permissive firmware_class.path=/system/etc/firmware no_console_suspend

  1. After system boot up, you need enable debugging switch by:

echo 1 > /sys/power/pm_print_times

  1. After system suspend, you could see which callback functions is called and introduce hang issue.

Ah, have you disconnect USB OTG cable?

At my side, I need connect USB OTG cable so USB cannot be suspended, so if you connect USB you can see the CPU can execute system suspend flow and can resume back.

Hi Leo-yan,

I have connected both USB OTG and serial cable.
I am seeing below error now :

130|hikey960:/ #
130|hikey960:/ # echo 10 > /sys/class/rtc/rtc1/wakealarm
hikey960:/ #
hikey960:/ # echo mem > /sys/power/state
[ 112.279694] PM: suspend entry 1970-01-01 00:02:11.248019776 UTC
[ 112.285890] PM: Syncing filesystems … done.
[ 112.298098] Freezing user space processes … (elapsed 0.002 seconds) done.
[ 112.307863] Freezing remaining freezable tasks … (elapsed 0.002 seconds) done.
[ 112.317863] hisi_dwc3_prepare: device state.
[ 112.322248] [dwc3_otg_work]+
[ 112.325217] [dwc3_otg_stop_peripheral]+
[ 112.329294] android_work: sent uevent USB_STATE=DISCONNECTED
[ 112.335101] [dwc3_otg_stop_peripheral]-
[ 112.339018] [dwc3_suspend_device]+
[ 112.342623] [dwc3_runtime_idle]+
[ 112.345895] [dwc3_runtime_suspend]+
[ 112.349423] [dwc3_runtime_suspend]-
[ 112.352965] [dwc3_runtime_idle]-
[ 112.356228] [dwc3_suspend_device]dwc3_suspend_device: 1
[ 112.361509] [dwc3_suspend_device]-
[ 112.364945] [dwc3_otg_work]-
[ 112.372943] ------------[ cut here ]------------
[ 112.377604] WARNING: at drivers/clk/clk.c:680
[ 112.382000] Modules linked in:
[ 112.385082]
[ 112.386585] CPU: 5 PID: 2124 Comm: sh Not tainted 4.4.82-g8892910-dirty #19
[ 112.393615] Hardware name: HiKey960 (DT)
[ 112.397574] task: ffffffc0b8cec080 task.stack: ffffffc0a9798000
[ 112.403563] PC is at clk_core_disable+0x188/0x190
[ 112.408311] LR is at clk_disable+0x34/0x48
[ 112.412444] pc : [] lr : [] pstate: 80000185
[ 112.419913] sp : ffffffc0a979b990
[ 112.423254] x29: ffffffc0a979b990 x28: 0000000000000000
[ 112.428621] x27: ffffff800930e000 x26: ffffffc0b91a64c8
[ 112.433989] x25: ffffff8008641aa8 x24: ffffff800929fad0
[ 112.439356] x23: ffffff8009009b38 x22: ffffff800863484c
[ 112.444722] x21: ffffffc0b91a6410 x20: 0000000000000100
[ 112.450089] x19: ffffffc03212f100 x18: 0000000000000000
[ 112.455455] x17: 0000000000000000 x16: 0000000000000000
[ 112.460821] x15: 0000000000000016 x14: 0ffffffffffffffe
[ 112.466190] x13: 0000000000000028 x12: 0000000000000006
[ 112.471557] x11: ffffff800929f000 x10: 0000000000000000
[ 112.476924] x9 : ffffff8009275000 x8 : ffffff8009241008
[ 112.482290] x7 : 00000000000083ea x6 : ffffffc0bff52090
[ 112.487657] x5 : 0000000000000000 x4 : 0000000000000000
[ 112.493023] x3 : ffffff8009274000 x2 : ffffff800898a41c
[ 112.498390] x1 : 0000000000000001 x0 : 0000000000000000
[ 112.503759]
[ 112.503759] SP: 0xffffffc0a979b910:
[ 112.508769] b910 0863484c ffffff80 09009b38 ffffff80 0929fad0 ffffff80 08641aa8 ffffff80
[ 112.517056] b930 b91a64c8 ffffffc0 0930e000 ffffff80 00000000 00000000 a979b990 ffffffc0
[ 112.525343] b950 0898c474 ffffff80 a979b990 ffffffc0 0898c17c ffffff80 80000185 00000000
[ 112.533629] b970 09498000 ffffff80 088bcb8c ffffff80 00000000 00000080 0898c468 ffffff80
[ 112.541916] b990 a979b9b0 ffffffc0 0898c474 ffffff80 af4e6400 ffffffc0 00000100 00000000
[ 112.550203] b9b0 a979b9d0 ffffffc0 088bd570 ffffff80 af4e6400 ffffffc0 00000002 00000000
[ 112.558489] b9d0 a979b9f0 ffffffc0 08634884 ffffff80 b91a6410 ffffffc0 ffffffff ffffff80
[ 112.566776] b9f0 a979ba10 ffffffc0 08640718 ffffff80 b91a6410 ffffffc0 0947a750 ffffff80
[ 112.575064]
[ 112.575064] X6: 0xffffffc0bff52010:
[ 112.580073] 2010 08005000 ffffff80 0929fad0 ffffff80 bff4e0a0 ffffffc0 bff52090 ffffffc0
[ 112.588360] 2030 a979b850 ffffffc0 0000001e 00000000 bff52080 ffffffc0 080857fc ffffff80
[ 112.596646] 2050 a979b850 ffffffc0 00000000 00000080 a979b980 ffffffc0 088bc544 ffffff80
[ 112.604934] 2070 60000105 00000000 00000000 00000000 a979b980 ffffffc0 a979b850 ffffffc0
[ 112.613220] 2090 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.621507] 20b0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.629793] 20d0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.638080] 20f0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.646369]
[ 112.646369] X19: 0xffffffc03212f080:
[ 112.651467] f080 00000000 00000000 ffffffff ffffffff 00000000 00000000 00000000 00000000
[ 112.659753] f0a0 00000000 00000000 00000000 00000000 b919dca0 ffffffc0 af9f52a8 ffffffc0
[ 112.668039] f0c0 00000000 00000000 b0372018 ffffffc0 3212cfd0 ffffffc0 3212f1d0 ffffffc0
[ 112.676326] f0e0 00000002 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.684612] f100 090b2300 ffffff80 08d82db8 ffffff80 3212ea00 ffffffc0 00000000 00000000
[ 112.692898] f120 b919db00 ffffffc0 3212ea80 ffffffc0 00000000 00000000 00000001 00000000
[ 112.701184] f140 01e84800 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.709471] f160 00000000 00000000 00000020 00000000 00000000 00000000 00000000 00000000
[ 112.717758]
[ 112.717758] X21: 0xffffffc0b91a6390:
[ 112.722855] 6390 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.731142] 63b0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.739429] 63d0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 112.747715] 63f0 00000000 00000000 00000000 00000000 b91aae00 ffffffc0 ffffffff 00000000
[ 112.756002] 6410 b90b1c10 ffffffc0 b919d300 ffffffc0 b91aae00 ffffffc0 af4e3140 ffffffc0
[ 112.764288] 6430 af4e2038 ffffffc0 b90b1c20 ffffffc0 20b8ab00 ffffffc0 0930d140 ffffff80
[ 112.772575] 6450 b91a7640 ffffffc0 00000006 00000007 00000000 00000000 00000000 00000000
[ 112.780862] 6470 00000000 00000000 b91a6478 ffffffc0 b91a6478 ffffffc0 b8cec080 ffffffc0
[ 112.789149]
[ 112.789149] X26: 0xffffffc0b91a6448:
[ 112.794246] 6448 0930d140 ffffff80 b91a7640 ffffffc0 00000006 00000007 00000000 00000000
[ 112.802533] 6468 00000000 00000000 00000000 00000000 b91a6478 ffffffc0 b91a6478 ffffffc0
[ 112.810819] 6488 b8cec080 ffffffc0 00000000 00000000 0930d710 ffffff80 0933e3e0 ffffff80
[ 112.819106] 64a8 00000000 00000000 af4e3018 ffffffc0 00000000 00000084 01140114 00000000
[ 112.827392] 64c8 0930e348 ffffff80 af4e20d8 ffffffc0 00000000 00000000 00010001 00000000
[ 112.835679] 64e8 b91a64e8 ffffffc0 b91a64e8 ffffffc0 00000000 00000000 00000000 00000000
[ 112.843965] 6508 00000200 dead0000 00000000 00000000 fffef358 00000000 0863f8cc ffffff80
[ 112.852252] 6528 b91a6410 ffffffc0 00000002 ffffffff ffffffff 00000000 00000000 00000000
[ 112.860539]
[ 112.860539] X29: 0xffffffc0a979b910:
[ 112.865636] b910 0863484c ffffff80 09009b38 ffffff80 0929fad0 ffffff80 08641aa8 ffffff80
[ 112.873922] b930 b91a64c8 ffffffc0 0930e000 ffffff80 00000000 00000000 a979b990 ffffffc0
[ 112.882209] b950 0898c474 ffffff80 a979b990 ffffffc0 0898c17c ffffff80 80000185 00000000
[ 112.890495] b970 09498000 ffffff80 088bcb8c ffffff80 00000000 00000080 0898c468 ffffff80
[ 112.898782] b990 a979b9b0 ffffffc0 0898c474 ffffff80 af4e6400 ffffffc0 00000100 00000000
[ 112.907068] b9b0 a979b9d0 ffffffc0 088bd570 ffffff80 af4e6400 ffffffc0 00000002 00000000
[ 112.915355] b9d0 a979b9f0 ffffffc0 08634884 ffffff80 b91a6410 ffffffc0 ffffffff ffffff80
[ 112.923641] b9f0 a979ba10 ffffffc0 08640718 ffffff80 b91a6410 ffffffc0 0947a750 ffffff80
[ 112.931928]
[ 112.933425] —[ end trace 639ca8ad99574f70 ]—
[ 112.938085] Call trace:
[ 112.940550] Exception stack(0xffffffc0a979b7c0 to 0xffffffc0a979b8f0)
[ 112.947056] b7c0: ffffffc03212f100 0000008000000000 ffffffc0a979b990 ffffff800898c17c
[ 112.954964] b7e0: 0000000000000003 0000000000000000 ffffffc0a979b830 ffffff80084e0948
[ 112.962873] b800: ffffffc0a979b980 ffffff80080857b4 ffffffc0bff52080 ffffff8008085818
[ 112.970781] b820: ffffffc0a979b850 0000008000000000 ffffffc0a979b870 ffffff80084b9458
[ 112.978689] b840: ffffffc0a979b910 ffffffc0a979b960 ffffffc0b8cec080 ffffffc0b8cec080
[ 112.986597] b860: 0000000000000000 0000000000000001 ffffff800898a41c ffffff8009274000
[ 112.994506] b880: 0000000000000000 0000000000000000 ffffffc0bff52090 00000000000083ea
[ 113.002414] b8a0: ffffff8009241008 ffffff8009275000 0000000000000000 ffffff800929f000
[ 113.010322] b8c0: 0000000000000006 0000000000000028 0ffffffffffffffe 0000000000000016
[ 113.018229] b8e0: 0000000000000000 0000000000000000
[ 113.023154] [] clk_core_disable+0x188/0x190
[ 113.028956] [] clk_disable+0x34/0x48
[ 113.034148] [] dw_i2c_plat_suspend+0x30/0x48
[ 113.040043] [] platform_pm_suspend+0x38/0x6c
[ 113.045934] [] dpm_run_callback+0x3c/0x1d0
[ 113.051649] [] __device_suspend+0x130/0x3a8
[ 113.057451] [] dpm_suspend+0x124/0x37c
[ 113.062814] [] dpm_suspend_start+0x78/0x84
[ 113.068531] [] suspend_devices_and_enter+0x9c/0x324
[ 113.075034] [] pm_suspend+0x498/0x628
[ 113.080308] [] state_store+0x88/0xa4
[ 113.085497] [] kobj_attr_store+0x14/0x24
[ 113.091039] [] sysfs_kf_write+0x5c/0x6c
[ 113.096490] [] kernfs_fop_write+0xc4/0x188
[ 113.102205] [] __vfs_write+0x48/0x104
[ 113.107480] [] vfs_write+0x98/0x190
[ 113.112580] [] SyS_write+0x54/0xb0
[ 113.117593] [] el0_svc_naked+0x24/0x28
[ 113.123003] ------------[ cut here ]------------
[ 113.127664] WARNING: at drivers/clk/clk.c:575
[ 113.132059] Modules linked in:
[ 113.135142]
[ 113.136644] CPU: 5 PID: 2124 Comm: sh Tainted: G W 4.4.82-g8892910-dirty #19
[ 113.144904] Hardware name: HiKey960 (DT)
[ 113.148862] task: ffffffc0b8cec080 task.stack: ffffffc0a9798000
[ 113.154840] PC is at clk_core_unprepare+0x190/0x1a0
[ 113.159764] LR is at clk_unprepare+0x30/0x40
[ 113.164072] pc : [] lr : [] pstate: 60000105
[ 113.171541] sp : ffffffc0a979b990
[ 113.174883] x29: ffffffc0a979b990 x28: 0000000000000000
[ 113.180254] x27: ffffff800930e000 x26: ffffffc0b91a64c8
[ 113.185623] x25: ffffff8008641aa8 x24: ffffff800929fad0
[ 113.190993] x23: ffffff8009009b38 x22: ffffff800863484c
[ 113.196363] x21: ffffffc0b91a6410 x20: 0000000000000002
[ 113.201732] x19: ffffffc03212f100 x18: 0000000000000000
[ 113.207102] x17: 0000000000000000 x16: 0000000000000000
[ 113.212471] x15: 0000000000000016 x14: 0ffffffffffffffe
[ 113.217841] x13: 0000000000000028 x12: 0000000000000006
[ 113.223210] x11: ffffff800929f000 x10: 00000000000009f0
[ 113.228579] x9 : ffffffc0a979b8b0 x8 : ffffffc0b8cecad0
[ 113.233948] x7 : 0000000000000000 x6 : 0000000000000000
[ 113.239318] x5 : 00000040b6d0d000 x4 : 0000000000000002
[ 113.244688] x3 : 0000000000000002 x2 : 0000000000000000
[ 113.250057] x1 : 0000000000000001 x0 : 0000000000000000
[ 113.255427]
[ 113.255427] SP: 0xffffffc0a979b910:
[ 113.260438] b910 0863484c ffffff80 09009b38 ffffff80 0929fad0 ffffff80 08641aa8 ffffff80
[ 113.268735] b930 b91a64c8 ffffffc0 0930e000 ffffff80 00000000 00000000 a979b990 ffffffc0
[ 113.277032] b950 0898c510 ffffff80 a979b990 ffffffc0 0898bdc8 ffffff80 60000105 00000000
[ 113.285329] b970 a979b990 ffffffc0 0898a2b8 ffffff80 00000000 00000080 00000100 00000000
[ 113.293627] b990 a979b9b0 ffffffc0 0898c510 ffffff80 af4e6400 ffffffc0 00000002 00000000
[ 113.301923] b9b0 a979b9d0 ffffffc0 088bd578 ffffff80 af4e6400 ffffffc0 00000002 00000000
[ 113.310220] b9d0 a979b9f0 ffffffc0 08634884 ffffff80 b91a6410 ffffffc0 ffffffff ffffff80
[ 113.318518] b9f0 a979ba10 ffffffc0 08640718 ffffff80 b91a6410 ffffffc0 0947a750 ffffff80
[ 113.326817]
[ 113.326817] X8: 0xffffffc0b8ceca50:
[ 113.331828] ca50 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
[ 113.340124] ca70 89dae180 ffffffc0 b8cec080 ffffffc0 bff58200 ffffffc0 b8cec080 ffffffc0
[ 113.348421] ca90 ad314b40 ffffffc0 00000001 00000000 b8cec6e8 ffffffc0 bff58200 ffffffc0
[ 113.356718] cab0 08c8c7a4 ffffff80 08ca8000 ffffff80 a979b8b0 ffffffc0 a979b8b0 ffffffc0
[ 113.365016] cad0 08087164 ffffff80 b7ffaa40 0000007f 00000000 00000000 00000000 00000000
[ 113.373313] caf0 00000000 00000000 00000000 00000000 b766d6c0 0000007f 65016d01 6f006d01
[ 113.381610] cb10 00000000 00000000 6f686365 00000000 00000000 80200800 00000000 00200000
[ 113.389907] cb30 80200802 80200802 00000000 80200802 00000000 00000000 00000000 00000000
[ 113.398205]
[ 113.398205] X9: 0xffffffc0a979b830:
[ 113.403216] b830 bff58200 ffffffc0 bff58200 ffffffc0 a979b860 ffffffc0 08c90620 ffffff80
[ 113.411514] b850 bff58200 ffffffc0 bff58200 ffffffc0 00000000 00000000 00000001 00000000
[ 113.419809] b870 00000000 00000000 00000002 00000000 00000002 00000000 b6d0d000 00000040
[ 113.428107] b890 00000000 00000000 00000000 00000000 b8cecad0 ffffffc0 a979b8b0 ffffffc0
[ 113.436404] b8b0 000009f0 00000000 0929f000 ffffff80 00000006 00000000 00000028 00000000
[ 113.444701] b8d0 fffffffe 0fffffff 00000016 00000000 00000000 00000000 00000000 00000000
[ 113.452997] b8f0 00000000 00000000 3212f100 ffffffc0 00000002 00000000 b91a6410 ffffffc0
[ 113.461294] b910 0863484c ffffff80 09009b38 ffffff80 0929fad0 ffffff80 08641aa8 ffffff80
[ 113.469593]
[ 113.469593] X19: 0xffffffc03212f080:
[ 113.474692] f080 00000000 00000000 ffffffff ffffffff 00000000 00000000 00000000 00000000
[ 113.482989] f0a0 00000000 00000000 00000000 00000000 b919dca0 ffffffc0 af9f52a8 ffffffc0
[ 113.491285] f0c0 00000000 00000000 b0372018 ffffffc0 3212cfd0 ffffffc0 3212f1d0 ffffffc0
[ 113.499583] f0e0 00000002 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 113.507880] f100 090b2300 ffffff80 08d82db8 ffffff80 3212ea00 ffffffc0 00000000 00000000
[ 113.516177] f120 b919db00 ffffffc0 3212ea80 ffffffc0 00000000 00000000 00000001 00000000
[ 113.524475] f140 01e84800 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 113.532771] f160 00000000 00000000 00000020 00000000 00000000 00000000 00000000 00000000
[ 113.541068]
[ 113.541068] X21: 0xffffffc0b91a6390:
[ 113.546167] 6390 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 113.554464] 63b0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 113.562761] 63d0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 113.571058] 63f0 00000000 00000000 00000000 00000000 b91aae00 ffffffc0 ffffffff 00000000
[ 113.579356] 6410 b90b1c10 ffffffc0 b919d300 ffffffc0 b91aae00 ffffffc0 af4e3140 ffffffc0
[ 113.587653] 6430 af4e2038 ffffffc0 b90b1c20 ffffffc0 20b8ab00 ffffffc0 0930d140 ffffff80
[ 113.595951] 6450 b91a7640 ffffffc0 00000006 00000007 00000000 00000000 00000000 00000000
[ 113.604247] 6470 00000000 00000000 b91a6478 ffffffc0 b91a6478 ffffffc0 b8cec080 ffffffc0
[ 113.612546]
[ 113.612546] X26: 0xffffffc0b91a6448:
[ 113.617644] 6448 0930d140 ffffff80 b91a7640 ffffffc0 00000006 00000007 00000000 00000000
[ 113.625942] 6468 00000000 00000000 00000000 00000000 b91a6478 ffffffc0 b91a6478 ffffffc0
[ 113.634239] 6488 b8cec080 ffffffc0 00000000 00000000 0930d710 ffffff80 0933e3e0 ffffff80
[ 113.642537] 64a8 00000000 00000000 af4e3018 ffffffc0 00000000 00000084 01140114 00000000
[ 113.650833] 64c8 0930e348 ffffff80 af4e20d8 ffffffc0 00000000 00000000 00010001 00000000
[ 113.659131] 64e8 b91a64e8 ffffffc0 b91a64e8 ffffffc0 00000000 00000000 00000000 00000000
[ 113.667427] 6508 00000200 dead0000 00000000 00000000 fffef358 00000000 0863f8cc ffffff80
[ 113.675725] 6528 b91a6410 ffffffc0 00000002 ffffffff ffffffff 00000000 00000000 00000000
[ 113.684023]
[ 113.684023] X29: 0xffffffc0a979b910:
[ 113.689122] b910 0863484c ffffff80 09009b38 ffffff80 0929fad0 ffffff80 08641aa8 ffffff80
[ 113.697419] b930 b91a64c8 ffffffc0 0930e000 ffffff80 00000000 00000000 a979b990 ffffffc0
[ 113.705716] b950 0898c510 ffffff80 a979b990 ffffffc0 0898bdc8 ffffff80 60000105 00000000
[ 113.714014] b970 a979b990 ffffffc0 0898a2b8 ffffff80 00000000 00000080 00000100 00000000
[ 113.722310] b990 a979b9b0 ffffffc0 0898c510 ffffff80 af4e6400 ffffffc0 00000002 00000000
[ 113.730607] b9b0 a979b9d0 ffffffc0 088bd578 ffffff80 af4e6400 ffffffc0 00000002 00000000
[ 113.738904] b9d0 a979b9f0 ffffffc0 08634884 ffffff80 b91a6410 ffffffc0 ffffffff ffffff80
[ 113.747201] b9f0 a979ba10 ffffffc0 08640718 ffffff80 b91a6410 ffffffc0 0947a750 ffffff80
[ 113.755497]
[ 113.756996] —[ end trace 639ca8ad99574f71 ]—
[ 113.761655] Call trace:
[ 113.764119] Exception stack(0xffffffc0a979b7c0 to 0xffffffc0a979b8f0)
[ 113.770624] b7c0: ffffffc03212f100 0000008000000000 ffffffc0a979b990 ffffff800898bdc8
[ 113.778534] b7e0: ffffffc0bff58270 ffffffc0b8cec080 ffffffc0a979b870 ffffff8008102f80
[ 113.786444] b800: ffffffc0ad23ec00 ffffffc0bff58200 ffffffc0bff58200 ffffffc0b8cec080
[ 113.794353] b820: ffffffc0a979b860 ffffff8008c90614 ffffffc0bff58200 ffffffc0bff58200
[ 113.802262] b840: ffffffc0a979b860 ffffff8008c90620 ffffffc0bff58200 ffffffc0bff58200
[ 113.810171] b860: 0000000000000000 0000000000000001 0000000000000000 0000000000000002
[ 113.818081] b880: 0000000000000002 00000040b6d0d000 0000000000000000 0000000000000000
[ 113.825990] b8a0: ffffffc0b8cecad0 ffffffc0a979b8b0 00000000000009f0 ffffff800929f000
[ 113.833899] b8c0: 0000000000000006 0000000000000028 0ffffffffffffffe 0000000000000016
[ 113.841808] b8e0: 0000000000000000 0000000000000000
[ 113.846732] [] clk_core_unprepare+0x190/0x1a0
[ 113.852710] [] clk_unprepare+0x30/0x40
[ 113.858076] [] dw_i2c_plat_suspend+0x38/0x48
[ 113.863966] [] platform_pm_suspend+0x38/0x6c
[ 113.869858] [] dpm_run_callback+0x3c/0x1d0
[ 113.875572] [] __device_suspend+0x130/0x3a8
[ 113.881375] [] dpm_suspend+0x124/0x37c
[ 113.886738] [] dpm_suspend_start+0x78/0x84
[ 113.892454] [] suspend_devices_and_enter+0x9c/0x324
[ 113.898959] [] pm_suspend+0x498/0x628
[ 113.904234] [] state_store+0x88/0xa4
[ 113.909421] [] kobj_attr_store+0x14/0x24
[ 113.914960] [] sysfs_kf_write+0x5c/0x6c
[ 113.920410] [] kernfs_fop_write+0xc4/0x188
[ 113.926125] [] __vfs_write+0x48/0x104
[ 113.931401] [] vfs_write+0x98/0x190
[ 113.936501] [] SyS_write+0x54/0xb0
[ 113.941513] [] el0_svc_naked+0x24/0x28
[ 113.947534] sd 0:0:0:3: [sdd] Synchronizing SCSI cache
[ 113.947708] sd 0:0:0:2: [sdc] Synchronizing SCSI cache
[ 113.948133] mali e82c0000.mali: kbase_device_suspend: suspend +
[ 113.948428] mali e82c0000.mali: kbase_device_suspend: suspend -
[ 113.949491] sd 0:0:0:1: [sdb] Synchronizing SCSI cache
[ 113.950132] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 113.976002] [USB3][hisi_dwc3_suspend]+
[ 113.976006] [USB3][hi3660_usb3phy_shutdown]+
[ 113.976009] [USB3][set_hisi_dwc3_power_flag]get dwc3 lock
[ 113.976011] [USB3][set_hisi_dwc3_power_flag]set hisi_dwc3_power_flag 0
[ 113.976013] [USB3][set_hisi_dwc3_power_flag]put dwc3 lock
[ 113.990601] [USB3][hi3660_usb3phy_shutdown]-
[ 113.990604] [USB3][hisi_dwc3_suspend]-
[ 114.029803] PM: suspend of devices complete after 1661.346 msecs
[ 114.037067] PM: late suspend of devices complete after 1.183 msecs
[ 114.045137] PM: noirq suspend of devices complete after 1.811 msecs
[ 114.051557] Disabling non-boot CPUs …
[ 114.058622] CPU6: update max cpu_capacity 1023
[ 114.075437] CPU1: shutdown
[ 114.078176] psci: CPU1 killed.
[ 114.098652] CPU0: update max cpu_capacity 402
[ 114.119282] CPU7: update max cpu_capacity 1023
[ 114.119304] CPU2: shutdown
[ 114.126600] psci: CPU2 killed.
[ 114.167219] CPU6: update max cpu_capacity 1023
[ 114.167240] CPU3: shutdown
[ 114.174527] psci: CPU3 killed.
[ 114.207017] CPU5: update max cpu_capacity 1023
[ 114.207031] CPU4: shutdown
[ 114.214345] psci: CPU4 killed.

Thanks

Just curious, if you have connected any I2C device on low speed port? Please check if below patch is in your local code base.

commit 036c100b58f742289dfab088a60e35717ec056f4
Author: Ulf Hansson ulf.hansson@linaro.org
Date: Wed Aug 9 15:28:22 2017 +0200

i2c: designware: Fix system suspend

commit a23318feeff662c8d25d21623daebdd2e55ec221 upstream.

As a workaround, you could try below patch for I2C suspend/resume:

> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index e630d4f..07e7c70 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -270,6 +270,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
>  	ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
>  	adap->dev.of_node = pdev->dev.of_node;
>  
> +	dev->pm_runtime_disabled = true;
> +
>  	if (dev->pm_runtime_disabled) {
>  		pm_runtime_forbid(&pdev->dev);
>  	} else {

Hi Leo-yan,

Thanks for all your support.
Suspend-resume is working fine after applying above patch.

Just curious, if you have connected any I2C device on low speed port?
No.
But pci device is not working with UEFI bootloader.

Thanks

Hi @Anonymous, I noticed before we have reported PCIE issue: https://bugs.96boards.org/show_bug.cgi?id=595, and I see seems you reported this issue, so are you are aware this issue?

Can you confirm if use legacy booting images PCIE can be recognized and after swtiching to UEFI/ARM-TF then PCIE cannot work anymore?

Hi Leo-yan,

Below bug is with kernel 4.9 -
https://bugs.96boards.org/show_bug.cgi?id=595

But now I am using kernel 4.4 -
Linux localhost 4.4.82-g8892910-dirty #24 SMP PREEMPT

With kernel 4.4 and legacy boot images PCIE device is working fine.
With kernel 4.4 and UEFI/ARM TF, PCIE device is not recognized.

With UEFI+ARM TF and kernel 4.9 PCIE works? If so I can try it.

Thanks

Hi Leo-yan,

I tried with kernel 4.9 and UEFI+ARM TF images also, pcie device is not recognized.

Logs :

[ 3.870742] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 3.876684] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[ 3.883595] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[ 3.890404] acpiphp_ibm: ibm_acpiphp_init: acpi_walk_namespace failed
[ 3.928650] OF: PCI: host bridge /soc/pcie@f4000000 ranges:
[ 3.934310] OF: PCI: MEM 0xf6000000…0xf7ffffff → 0x00000000
[ 4.941391] Kirin-pcie f4000000.pcie: Link Fail
[ 4.946218] Kirin-pcie f4000000.pcie: PCI host bridge to bus 0000:00
[ 4.952653] pci_bus 0000:00: root bus resource [bus 00-01]
[ 4.958204] pci_bus 0000:00: root bus resource [mem 0xf6000000-0xf7ffffff] (bus address [0x00000000-0x01ffffff])
[ 4.968606] pci 0000:00:00.0: [19e5:3660] type 01 class 0x060400
[ 4.974738] pci 0000:00:00.0: reg 0x10: [mem 0xf6000000-0xf6ffffff]
[ 4.981260] pci 0000:00:00.0: supports D1 D2
[ 4.985590] pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot
[ 4.992182] pci 0000:00:00.0: BAR 0: assigned [mem 0xf6000000-0xf6ffffff]
[ 4.999132] pci 0000:00:00.0: PCI bridge to [bus 01]
[ 5.004688] pcieport 0000:00:00.0: Signaling PME through PCIe PME interrupt
[ 5.011738] pcie_pme 0000:00:00.0:pcie001: service driver pcie_pme loaded

Thanks

Hi Leo-yan,

please let me know if you found fix for the above issue.

Thanks

Hi @Anonymous, I have filed the bug for PCI device issue: https://bugs.96boards.org/show_bug.cgi?id=653

This issue is likely there have some missed setting in ARM-TF/UEFI booting images, but these setting is exist in Hisilicon legacy booting images. Unfortunately, Hisilicon legacy booting images are not open source code, so need go back to check with Hisilicon for this.

You could monitor bug 653 if there have any update for this.

Flashing wrong images.

Hi,
With the latest UEFI bootloader http://builds.96boards.org/snapshots/reference-platform/components/uefi-staging/latest/ lspci is working and with some WARs mentioned, rtcwake is going to suspend and waking up after specified time (busybox rtcwake -d /dev/rtc1 -m mem -s 5)

iff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 6e3c143…ed2dbfe 100644
— a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -379,6 +379,8 @@ static int pl061_suspend(struct device *dev)
struct pl061_gpio *chip = dev_get_drvdata(dev);
int offset;

  •   return 0;
    
  •   chip->csave_regs.gpio_data = 0;
      chip->csave_regs.gpio_dir = readb(chip->base + GPIODIR);
      chip->csave_regs.gpio_is = readb(chip->base + GPIOIS);
    

@@ -400,6 +402,8 @@ static int pl061_resume(struct device *dev)
struct pl061_gpio *chip = dev_get_drvdata(dev);
int offset;

  •   return 0;
    
  •   for (offset = 0; offset < PL061_GPIO_NR; offset++) {
              if (chip->csave_regs.gpio_dir & (BIT(offset)))
                      pl061_direction_output(&chip->gc, offset,
    

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index e630d4f…07e7c70 100644
— a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -270,6 +270,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
adap->dev.of_node = pdev->dev.of_node;

  •   dev->pm_runtime_disabled = true;
    
  •   if (dev->pm_runtime_disabled) {
              pm_runtime_forbid(&pdev->dev);
      } else {
    

We are working on PCIe drivers and we are interested in bringing the PCIe link down to L2, looks like, even though suspend/resume works, the PCIe link is not going to L2 (PCIe root complex is not going to suspend)

Please help.

Thanks,
Shankar

I have fixed the issues.
Now GPIOs can be suspended. And wakeup from RTC is working.
See topic:
[Does Hikey960 support susped-to-mem with Linux 4.9 kernel? - #7 by sreenad]

Hi Sreenad,
Is your patch committed to 4.9 kernel?
Can you please point me to your patch?

Also, are pcie devices .suspend getting called? i.e PCIe link going to L2?

Thanks,
Shankar

Hi @shankyjadhav

I could fix only GPIO18 and GPIO19 suspend-resume hang issue.

I didnt face any problem in PCIe driver.
Let me know upto which stage u could reach during suspend.

Regards,
Sreenad.

Hi Sreenad,
We will try with your patch.
But could you please confirm if Hikey960 PCIe root complex supports L2 (link state 2) or not?
Any code change needed to add RC L2 support?
We would use suspend/resume only if PCIe L2 is supported.

Thanks,
SJ

@shankyjadhav

You would be able to reach upto GPIO suspend, after USB and i2c adapter suspend.

If you are facing problem in that, disable USB pm callbacks (so USB will be powered even after suspend) and for i2c, either disable runtime suspend for it. Or have a state check before going for suspend. Because in my code, runtime pm and suspend pm callbacks where same and did not had a current state check.
At some version, synopsis had fixed the issue in its i2c drivers.

If u are again facing problem in it, let me know.

Regarding PCIe, I don’t have much knowledge in that area to confirm your query.
Also, currently I don’t have 960 board with me, as I am working in different things.

Regards,
Sreenad.