lkml.org 
[lkml]   [2019]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 058/118] PCI: designware-ep: Use aligned ATU window for raising MSI interrupts
    Date
    [ Upstream commit 6b7330303a8186fb211357e6d379237fe9d2ece1 ]

    Certain platforms like K2G reguires the outbound ATU window to be
    aligned. The alignment size is already present in mem->page_size.
    Use the alignment size present in mem->page_size to configure an
    aligned ATU window. In order to raise an interrupt, CPU has to write
    to address offset from the start of the window unlike before where
    writes were always to the beginning of the ATU window.

    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/pci/controller/dwc/pcie-designware-ep.c | 7 +++++--
    1 file changed, 5 insertions(+), 2 deletions(-)

    diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
    index de8635af4cde..739d97080d3b 100644
    --- a/drivers/pci/controller/dwc/pcie-designware-ep.c
    +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
    @@ -385,6 +385,7 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
    {
    struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
    struct pci_epc *epc = ep->epc;
    + unsigned int aligned_offset;
    u16 msg_ctrl, msg_data;
    u32 msg_addr_lower, msg_addr_upper, reg;
    u64 msg_addr;
    @@ -410,13 +411,15 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
    reg = ep->msi_cap + PCI_MSI_DATA_32;
    msg_data = dw_pcie_readw_dbi(pci, reg);
    }
    - msg_addr = ((u64) msg_addr_upper) << 32 | msg_addr_lower;
    + aligned_offset = msg_addr_lower & (epc->mem->page_size - 1);
    + msg_addr = ((u64)msg_addr_upper) << 32 |
    + (msg_addr_lower & ~aligned_offset);
    ret = dw_pcie_ep_map_addr(epc, func_no, ep->msi_mem_phys, msg_addr,
    epc->mem->page_size);
    if (ret)
    return ret;

    - writel(msg_data | (interrupt_num - 1), ep->msi_mem);
    + writel(msg_data | (interrupt_num - 1), ep->msi_mem + aligned_offset);

    dw_pcie_ep_unmap_addr(epc, func_no, ep->msi_mem_phys);

    --
    2.20.1


    \
     
     \ /
      Last update: 2019-06-13 18:18    [W:4.353 / U:0.992 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site