PCI: rockchip: Add system PM support
authorShawn Lin <shawn.lin@rock-chips.com>
Mon, 12 Dec 2016 11:50:07 +0000 (19:50 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 11 Jan 2017 18:22:47 +0000 (12:22 -0600)
commit013dd3d5e1835c2cfa9c824e61465b61509afa54
treec680a46bc383c1cece04b84df55a530ff3ac94cf
parent7ce7d89f48834cefece7804d38fc5d85382edf77
PCI: rockchip: Add system PM support

Add 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 after
sending PME_Turn_Off.  Technically it should depend 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.

[1] https://lists.launchpad.net/kernel-packages/msg123315.html
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
drivers/pci/host/pcie-rockchip.c