mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
PCI: cadence: Use cdns_pcie_read_sz() for byte or word read access
The commit18ac51ae9d("PCI: cadence: Implement capability search using PCI core APIs") assumed all the platforms using Cadence PCIe controller support byte and word register accesses. This is not true for all platforms (e.g., TI J721E SoC, which only supports dword register accesses). This causes capability searches via cdns_pcie_find_capability() to fail on such platforms. Fix this by using cdns_pcie_read_sz() for config read functions, which properly handles size-aligned accesses. Remove the now-unused byte and word read wrapper functions (cdns_pcie_readw and cdns_pcie_readb). Fixes:18ac51ae9d("PCI: cadence: Implement capability search using PCI core APIs") Signed-off-by: Aksh Garg <a-garg7@ti.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260402085545.284457-1-a-garg7@ti.com
This commit is contained in:
parent
6de23f81a5
commit
d9cf7154de
|
|
@ -249,37 +249,6 @@ static inline u32 cdns_pcie_hpa_readl(struct cdns_pcie *pcie,
|
|||
return readl(pcie->reg_base + reg);
|
||||
}
|
||||
|
||||
static inline u16 cdns_pcie_readw(struct cdns_pcie *pcie, u32 reg)
|
||||
{
|
||||
return readw(pcie->reg_base + reg);
|
||||
}
|
||||
|
||||
static inline u8 cdns_pcie_readb(struct cdns_pcie *pcie, u32 reg)
|
||||
{
|
||||
return readb(pcie->reg_base + reg);
|
||||
}
|
||||
|
||||
static inline int cdns_pcie_read_cfg_byte(struct cdns_pcie *pcie, int where,
|
||||
u8 *val)
|
||||
{
|
||||
*val = cdns_pcie_readb(pcie, where);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static inline int cdns_pcie_read_cfg_word(struct cdns_pcie *pcie, int where,
|
||||
u16 *val)
|
||||
{
|
||||
*val = cdns_pcie_readw(pcie, where);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static inline int cdns_pcie_read_cfg_dword(struct cdns_pcie *pcie, int where,
|
||||
u32 *val)
|
||||
{
|
||||
*val = cdns_pcie_readl(pcie, where);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static inline u32 cdns_pcie_read_sz(void __iomem *addr, int size)
|
||||
{
|
||||
void __iomem *aligned_addr = PTR_ALIGN_DOWN(addr, 0x4);
|
||||
|
|
@ -320,6 +289,31 @@ static inline void cdns_pcie_write_sz(void __iomem *addr, int size, u32 value)
|
|||
writel(val, aligned_addr);
|
||||
}
|
||||
|
||||
static inline int cdns_pcie_read_cfg_byte(struct cdns_pcie *pcie, int where,
|
||||
u8 *val)
|
||||
{
|
||||
void __iomem *addr = pcie->reg_base + where;
|
||||
|
||||
*val = cdns_pcie_read_sz(addr, 0x1);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static inline int cdns_pcie_read_cfg_word(struct cdns_pcie *pcie, int where,
|
||||
u16 *val)
|
||||
{
|
||||
void __iomem *addr = pcie->reg_base + where;
|
||||
|
||||
*val = cdns_pcie_read_sz(addr, 0x2);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static inline int cdns_pcie_read_cfg_dword(struct cdns_pcie *pcie, int where,
|
||||
u32 *val)
|
||||
{
|
||||
*val = cdns_pcie_readl(pcie, where);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Root Port register access */
|
||||
static inline void cdns_pcie_rp_writeb(struct cdns_pcie *pcie,
|
||||
u32 reg, u8 value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user