[PATCH v3 3/3] PCI: rockchip: Add system PM support
Bjorn Helgaas
helgaas at kernel.org
Wed Dec 7 13:46:53 PST 2016
Hi Shawn,
On Thu, Nov 24, 2016 at 09:54:22AM +0800, Shawn Lin wrote:
> 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 statment 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 at rock-chips.com>
>
> Reviewed-by: Brian Norris <briannorris at chromium.org>
> @@ -1196,8 +1207,96 @@ static int rockchip_cfg_atu(struct rockchip_pcie *rockchip)
> }
> }
>
> + /* assign message regions */
> + rockchip_pcie_prog_ob_atu(rockchip, reg_no + 1 + offset,
> + AXI_WRAPPER_NOR_MSG,
> + 20 - 1, 0, 0);
> + if (rockchip->msg_region)
> + goto out;
> +
> + rockchip->msg_region = devm_ioremap(rockchip->dev,
> + rockchip->mem_bus_addr +
> + ((reg_no + offset) << 20),
> + SZ_1M);
> + if (!rockchip->msg_region)
> + err = -ENOMEM;
I don't really like this strategy of "if msg_region is already mapped,
skip it; otherwise map it." The ioremap() looks like something that
should be done at probe-time and does not need to be re-done at
resume-time.
Bjorn
More information about the Linux-rockchip
mailing list