From: Bjorn Helgaas <helgaas@kernel.org>
To: Shmuel Hazan <sh@tkos.co.il>
Cc: "Baruch Siach" <baruch@tkos.co.il>,
"Jason Cooper" <jason@lakedaemon.net>,
linux-pci@vger.kernel.org, "Marek Behún" <marek.behun@nic.cz>,
"Chris ackham" <chris.packham@alliedtelesis.co.nz>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pci: pci-mvebu: setup BAR0 to internal-regs
Date: Tue, 16 Jun 2020 14:52:52 -0500 [thread overview]
Message-ID: <20200616195252.GA1976810@bjorn-Precision-5520> (raw)
In-Reply-To: <20200611054041.1484001-1-sh@tkos.co.il>
No comment on the patch itself, but "git log --oneline
drivers/pci/controller/pci-mvebu.c" tells you that your subject should
start with:
PCI: mvebu: Set ...
On Thu, Jun 11, 2020 at 08:40:42AM +0300, Shmuel Hazan wrote:
> According to the Armada XP datasheet, section 10.2.6: "in order for
> the device todo a write to the MSI doorbell address, it needs to write
> to a register in the internal registers" space".
s/todo/to do/
There are three " characters above; they need to come in pairs. If
they're nested, use ' for one pair.
> As a result of the requirement above, without this patch, MSI won't
> function and therefore some devices won't operate properly without
> pci=nomsi.
>
> Tested on an Armada 385 board with the following PCIe devices:
> - Wilocity Wil6200 rev 2 (wil6210)
> - Qualcomm Atheros QCA6174 (ath10k_pci)
>
> Both failed to get a response from the device after loading the
> firmware and seem to operate properly with this patch.
>
> Signed-off-by: Shmuel Hazan <sh@tkos.co.il>
> ---
> drivers/pci/controller/pci-mvebu.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
> index 153a64676bc9..101c06602aa1 100644
> --- a/drivers/pci/controller/pci-mvebu.c
> +++ b/drivers/pci/controller/pci-mvebu.c
> @@ -105,6 +105,7 @@ struct mvebu_pcie_port {
> struct mvebu_pcie_window memwin;
> struct mvebu_pcie_window iowin;
> u32 saved_pcie_stat;
> + struct resource regs;
> };
>
> static inline void mvebu_writel(struct mvebu_pcie_port *port, u32 val, u32 reg)
> @@ -149,7 +150,9 @@ static void mvebu_pcie_set_local_dev_nr(struct mvebu_pcie_port *port, int nr)
>
> /*
> * Setup PCIE BARs and Address Decode Wins:
> - * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks
> + * BAR[0] -> internal registers (needed for MSI)
> + * BAR[1] -> covers all DRAM banks
> + * BAR[2] -> Disabled
> * WIN[0-3] -> DRAM bank[0-3]
> */
> static void mvebu_pcie_setup_wins(struct mvebu_pcie_port *port)
> @@ -203,6 +206,12 @@ static void mvebu_pcie_setup_wins(struct mvebu_pcie_port *port)
> mvebu_writel(port, 0, PCIE_BAR_HI_OFF(1));
> mvebu_writel(port, ((size - 1) & 0xffff0000) | 1,
> PCIE_BAR_CTRL_OFF(1));
> +
> + /*
> + * Point BAR[0] to the device's internal registers.
> + */
> + mvebu_writel(port, round_down(port->regs.start, SZ_1M), PCIE_BAR_LO_OFF(0));
> + mvebu_writel(port, 0, PCIE_BAR_HI_OFF(0));
> }
>
> static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port)
> @@ -708,14 +717,13 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
> struct device_node *np,
> struct mvebu_pcie_port *port)
> {
> - struct resource regs;
> int ret = 0;
>
> - ret = of_address_to_resource(np, 0, ®s);
> + ret = of_address_to_resource(np, 0, &port->regs);
> if (ret)
> return (void __iomem *)ERR_PTR(ret);
>
> - return devm_ioremap_resource(&pdev->dev, ®s);
> + return devm_ioremap_resource(&pdev->dev, &port->regs);
> }
>
> #define DT_FLAGS_TO_TYPE(flags) (((flags) >> 24) & 0x03)
> --
> 2.27.0
>
_______________________________________________
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:[~2020-06-16 19:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 5:40 [PATCH] pci: pci-mvebu: setup BAR0 to internal-regs Shmuel Hazan
2020-06-16 19:52 ` Bjorn Helgaas [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=20200616195252.GA1976810@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=baruch@tkos.co.il \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=marek.behun@nic.cz \
--cc=sh@tkos.co.il \
--cc=thomas.petazzoni@bootlin.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