lkml.org 
[lkml]   [2017]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] PCI: mediatek: add msi support for mt2712 and mt7622
From
Date
Hi Honghui,

On Fri, 2017-08-11 at 20:27 +0800, honghui.zhang@mediatek.com wrote:
...
> +static void mtk_pcie_enable_msi(struct mtk_pcie_port *port)
> +{
> + u32 val;
> +
> + val = lower_32_bits((u64)(port->base + PCIE_MSI_VECTOR));
> + writel(val, port->base + PCIE_IMSI_ADDR);
> +
> + val = readl(port->base + PCIE_INT_MASK);
> + val &= ~MSI_MASK;
> + writel(val, port->base + PCIE_INT_MASK);
> +}
> +
> static int mtk_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
> irq_hw_number_t hwirq)
> {
> @@ -460,6 +574,18 @@ static int mtk_pcie_init_irq_domain(struct mtk_pcie_port *port,
> return PTR_ERR(port->irq_domain);
> }
>
> + /* Setup MSI */
> + if (IS_ENABLED(CONFIG_PCI_MSI)) {
> + port->msi_domain = irq_domain_add_linear(node, MTK_MSI_IRQS_NUM,
> + &msi_domain_ops,
> + &mtk_pcie_msi_chip);
> + if (!port->msi_domain) {
> + dev_err(dev, "Failed to get a MSI IRQ domain\n");
> + return PTR_ERR(port->msi_domain);

Just return -ENOMEM. PTR_ERR(NULL) will cause a static checker warning.

> + }
> + mtk_pcie_enable_msi(port);
> + }
> +
> return 0;
> }

Ryder

\
 
 \ /
  Last update: 2017-08-12 02:58    [W:0.022 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site