You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
PCI: aspm_ext: Supoprt to check l1ss state
Change-Id: I585d01908751cefb66935951d42cd854299469fa Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
@@ -11,6 +11,10 @@
|
||||
#include <linux/aspm_ext.h>
|
||||
#include <linux/errno.h>
|
||||
|
||||
#define PCIE_RAS_DES_CAP_SD_STATUS_PM 0xB8
|
||||
#define PCIE_RAS_DES_CAP_LISS_SHIFT 13
|
||||
#define PCIE_RAS_DES_CAP_LISS_MASK (0x7 << PCIE_RAS_DES_CAP_LISS_SHIFT)
|
||||
#define PCIE_RAS_DES_CAP_LISS (0x5 << PCIE_RAS_DES_CAP_LISS_SHIFT)
|
||||
|
||||
static u32 rockchip_pcie_pcie_access_cap(struct pci_dev *pdev, int cap, uint offset,
|
||||
bool is_ext, bool is_write, u32 writeval)
|
||||
@@ -343,4 +347,19 @@ void pcie_aspm_ext_l1ss_enable(struct pci_dev *child, struct pci_dev *parent, bo
|
||||
}
|
||||
EXPORT_SYMBOL(pcie_aspm_ext_l1ss_enable);
|
||||
|
||||
bool pcie_aspm_ext_is_in_l1sub_state(struct pci_dev *pdev)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
val = rockchip_pcie_pcie_access_cap(pdev, PCI_EXT_CAP_ID_VNDR,
|
||||
PCIE_RAS_DES_CAP_SD_STATUS_PM,
|
||||
true, false, 0);
|
||||
|
||||
if ((val & PCIE_RAS_DES_CAP_LISS_MASK) == PCIE_RAS_DES_CAP_LISS)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
EXPORT_SYMBOL(pcie_aspm_ext_is_in_l1sub_state);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
#if IS_REACHABLE(CONFIG_PCIEASPM_EXT)
|
||||
bool pcie_aspm_ext_is_rc_ep_l1ss_capable(struct pci_dev *child, struct pci_dev *parent);
|
||||
void pcie_aspm_ext_l1ss_enable(struct pci_dev *child, struct pci_dev *parent, bool enable);
|
||||
bool pcie_aspm_ext_is_in_l1sub_state(struct pci_dev *pdev);
|
||||
#else
|
||||
static inline bool pcie_aspm_ext_is_rc_ep_l1ss_capable(struct pci_dev *child, struct pci_dev *parent) { return false; }
|
||||
static inline void pcie_aspm_ext_l1ss_enable(struct pci_dev *child, struct pci_dev *parent, bool enable) {}
|
||||
static inline bool pcie_aspm_ext_is_in_l1sub_state(struct pci_dev *pdev) { return false; }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user