From: Serge Semin <fancer.lancer@gmail.com>
To: Elad Nachman <enachman@marvell.com>
Cc: thomas.petazzoni@bootlin.com, bhelgaas@google.com,
lpieralisi@kernel.org, robh@kernel.org, kw@linux.com,
krzysztof.kozlowski+dt@linaro.org, linux-pci@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Yuval Shaia <yshaia@marvell.com>
Subject: Re: [PATCH v4 3/8] PCI: armada8k: Add AC5 MSI support
Date: Thu, 23 Mar 2023 02:23:13 +0300 [thread overview]
Message-ID: <20230322232313.zbxhodgfqeoyclbg@mobilestation> (raw)
In-Reply-To: <20230313124016.17102-4-enachman@marvell.com>
On Mon, Mar 13, 2023 at 02:40:11PM +0200, Elad Nachman wrote:
> From: Yuval Shaia <yshaia@marvell.com>
>
> AC5 requires different handling for MSI as with armada8k.
> Fix it by:
>
> 1. Enabling the relevant bits in init phase
> 2. Dispatch virtual IRQ handlers when MSI interrupts are received
>
> Also enable/disable PCIE_APP_LTSSM for AC5.
>
> Signed-off-by: Yuval Shaia <yshaia@marvell.com>
> Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu>
> ---
> v4:
> Fix commit subject to be aligned with previous patch in series
>
> v2:
> 1) fix W1 warnings which caused by unused leftover code
>
> 2) fix type in "requieres" word in the description
>
> drivers/pci/controller/dwc/pcie-armada8k.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c
> index b9fb1375dc58..02481ecadd25 100644
> --- a/drivers/pci/controller/dwc/pcie-armada8k.c
> +++ b/drivers/pci/controller/dwc/pcie-armada8k.c
> @@ -50,6 +50,7 @@ struct armada8k_pcie_of_data {
>
> #define PCIE_GLOBAL_CONTROL_REG (PCIE_VENDOR_REGS_OFFSET + 0x0)
> #define PCIE_APP_LTSSM_EN BIT(2)
> +#define PCIE_APP_LTSSM_EN_AC5 BIT(24)
> #define PCIE_DEVICE_TYPE_SHIFT 4
> #define PCIE_DEVICE_TYPE_MASK 0xF
> #define PCIE_DEVICE_TYPE_RC 0x4 /* Root complex */
> @@ -69,6 +70,7 @@ struct armada8k_pcie_of_data {
> #define PCIE_INT_B_ASSERT_MASK_AC5 BIT(13)
> #define PCIE_INT_C_ASSERT_MASK_AC5 BIT(14)
> #define PCIE_INT_D_ASSERT_MASK_AC5 BIT(15)
> +#define PCIE_MSI_MASK_AC5 BIT(11)
>
> #define PCIE_ATU_ACCESS_MASK_AC5 GENMASK(21, 20)
>
> @@ -184,6 +186,16 @@ static int armada8k_pcie_start_link(struct dw_pcie *pci)
> return 0;
> }
>
> +static void ac5_pcie_msi_init(struct dw_pcie *pci)
> +{
> + u32 val;
> +
> + /* Set MSI bit in interrupt mask */
> + val = dw_pcie_readl_dbi(pci, PCIE_GLOBAL_INT_MASK1_REG);
> + val |= PCIE_MSI_MASK_AC5;
> + dw_pcie_writel_dbi(pci, PCIE_GLOBAL_INT_MASK1_REG, val);
> +}
> +
> static int armada8k_pcie_host_init(struct dw_pcie_rp *pp)
> {
> u32 reg;
> @@ -193,7 +205,10 @@ static int armada8k_pcie_host_init(struct dw_pcie_rp *pp)
> if (!dw_pcie_link_up(pci)) {
> /* Disable LTSSM state machine to enable configuration */
> reg = dw_pcie_readl_dbi(pci, PCIE_GLOBAL_CONTROL_REG);
> - reg &= ~(PCIE_APP_LTSSM_EN);
> + if (pcie->pcie_type == ARMADA8K_PCIE_TYPE_AC5)
> + reg &= ~(PCIE_APP_LTSSM_EN_AC5);
> + else
> + reg &= ~(PCIE_APP_LTSSM_EN);
This has nothing to do with MSIs.
-Serge(y)
> dw_pcie_writel_dbi(pci, PCIE_GLOBAL_CONTROL_REG, reg);
> }
>
> @@ -233,6 +248,9 @@ static int armada8k_pcie_host_init(struct dw_pcie_rp *pp)
> dw_pcie_writel_dbi(pci, PCIE_GLOBAL_INT_MASK1_REG, reg);
> }
>
> + if (IS_ENABLED(CONFIG_PCI_MSI) && (pcie->pcie_type == ARMADA8K_PCIE_TYPE_AC5))
> + ac5_pcie_msi_init(pci);
> +
> return 0;
> }
>
> @@ -249,6 +267,8 @@ static irqreturn_t armada8k_pcie_irq_handler(int irq, void *arg)
> */
> val = dw_pcie_readl_dbi(pci, PCIE_GLOBAL_INT_CAUSE1_REG);
> dw_pcie_writel_dbi(pci, PCIE_GLOBAL_INT_CAUSE1_REG, val);
> + if ((PCIE_MSI_MASK_AC5 & val) && (pcie->pcie_type == ARMADA8K_PCIE_TYPE_AC5))
> + dw_handle_msi_irq(&pci->pp);
>
> return IRQ_HANDLED;
> }
> --
> 2.17.1
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2023-03-22 23:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230313124016.17102-1-enachman@marvell.com>
2023-03-13 19:22 ` [PATCH v4 0/8] PCI: dwc: Add support for Marvell AC5 SoC Bjorn Helgaas
[not found] ` <20230313124016.17102-9-enachman@marvell.com>
2023-03-13 19:48 ` [PATCH v4 8/8] PCI: dwc: Introduce region limit from DT Bjorn Helgaas
2023-03-14 20:48 ` Serge Semin
2023-03-23 0:11 ` Serge Semin
[not found] ` <20230313124016.17102-8-enachman@marvell.com>
2023-03-17 18:23 ` [PATCH v4 7/8] PCI: dwc: Introduce configurable DMA mask Rob Herring
2023-03-27 17:01 ` Robin Murphy
[not found] ` <20230313124016.17102-5-enachman@marvell.com>
2023-03-17 18:30 ` [PATCH v4 4/8] dt-bindings: PCI: dwc: Add dma-ranges, region mask Rob Herring
[not found] ` <20230313124016.17102-3-enachman@marvell.com>
2023-03-13 19:43 ` [PATCH v4 2/8] PCI: armada8k: Add AC5 SoC support Bjorn Helgaas
2023-03-22 23:19 ` Serge Semin
[not found] ` <20230313124016.17102-4-enachman@marvell.com>
2023-03-22 23:23 ` Serge Semin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230322232313.zbxhodgfqeoyclbg@mobilestation \
--to=fancer.lancer@gmail.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=enachman@marvell.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=yshaia@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox