FROMLIST: PCI: rockchip: Add system PM support
authorShawn Lin <shawn.lin@rock-chips.com>
Tue, 3 Jan 2017 07:35:28 +0000 (15:35 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 3 Jan 2017 09:19:35 +0000 (17:19 +0800)
commit606a3d417948c0736b575cf0c75783c9d285cbf5
treed5027063d95a3dd7fa88a93cd12a37efb98c1c3d
parent79b943881e8a74ac05d4fde7e32c326e7d97b21e
FROMLIST: PCI: rockchip: Add system PM support

This patch adds system PM support for Rockchip's RC.
For pre S3, the EP is configured into D3 state which guarantees
the link state should be in L1. So we could send PME_Turn_Off message
to the EP and wait for its ACK to make the link state into L2 or L3
without the aux-supply. This could help save more power which I think
should be very important for mobile devices.

As note that there is a 5s timeout for RC to wait for the PMA_ACK
aftering send PME_Turn_Off. Technically it should depends on the
hierarchy of devices but seems PCIe core framework doesn't handle the
L2/3 for S3 at all. So that means we should presume to set a default
value for PME_ACK. From the bug report[1], we could find a statement that
Microsoft Windows versions typically wait for 5 seconds. So we are prone
to take 5s for this timeout here.

Change-Id: I3500911daaad07dfd632cda0f2f4b62cfc2909a2
[1] https://lists.launchpad.net/kernel-packages/msg123315.html
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from https://patchwork.kernel.org/patch/9470515/)
drivers/pci/host/pcie-rockchip.c