linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Thippeswamy Havalige <thippesw@amd.com>
Cc: lpieralisi@kernel.org, kw@linux.com, robh@kernel.org,
	bhelgaas@google.com, krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-pci@vger.kernel.org, thippeswamy.havalige@amd.com,
	linux-arm-kernel@lists.infradead.org, michal.simek@amd.com
Subject: Re: [PATCH v2 2/2] PCI: xilinx-xdma: Add Xilinx QDMA Root Port driver
Date: Mon, 22 Jul 2024 17:15:00 -0500	[thread overview]
Message-ID: <20240722221500.GA739438@bhelgaas> (raw)
In-Reply-To: <20240722062558.1578744-3-thippesw@amd.com>

On Mon, Jul 22, 2024 at 11:55:58AM +0530, Thippeswamy Havalige wrote:
> Add support for Xilinx QDMA Soft IP core as Root Port.
> 
> The versal prime devices support QDMA soft IP module in
> programmable logic.

Capitalize brand names.

> The integrated QDMA Soft IP block has integrated bridge function that
> can act as PCIe Root Port.

Rewrap to fill 75 columns.

> +#define QDMA_BRIDGE_BASE_OFF		0xCD8

Other #defines in this file user lower-case hex; please match them.

>  static inline u32 pcie_read(struct pl_dma_pcie *port, u32 reg)
>  {
> -	return readl(port->reg_base + reg);
> +	if (port->variant->version == XDMA)
> +		return readl(port->reg_base + reg);
> +	else
> +		return readl(port->reg_base + reg + QDMA_BRIDGE_BASE_OFF);
>  }
>  
>  static inline void pcie_write(struct pl_dma_pcie *port, u32 val, u32 reg)
>  {
> -	writel(val, port->reg_base + reg);
> +	if (port->variant->version == XDMA)
> +		writel(val, port->reg_base + reg);
> +	else
> +		writel(val, port->reg_base + reg + QDMA_BRIDGE_BASE_OFF);
>  }
>  
>  static inline bool xilinx_pl_dma_pcie_link_up(struct pl_dma_pcie *port)
> @@ -173,7 +198,10 @@ static void __iomem *xilinx_pl_dma_pcie_map_bus(struct pci_bus *bus,
>  	if (!xilinx_pl_dma_pcie_valid_device(bus, devfn))
>  		return NULL;
>  
> -	return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
> +	if (port->variant->version == XDMA)
> +		return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
> +	else
> +		return port->cfg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);

If you rework the variant tests above to use
"if (port->variant->version == QDMA)" instead, they will match the one
below, and you won't need to touch the existing code at all, e.g.,

  + if (port->variant->version == QDMA)
  +   return port->cfg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);

    return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);

>  }
>  
>  /* PCIe operations */
> @@ -731,6 +759,15 @@ static int xilinx_pl_dma_pcie_parse_dt(struct pl_dma_pcie *port,
>  
>  	port->reg_base = port->cfg->win;
>  
> +	if (port->variant->version == QDMA) {
> +		port->cfg_base = port->cfg->win;
> +		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "breg");
> +		port->reg_base = devm_ioremap_resource(dev, res);
> +		if (IS_ERR(port->reg_base))
> +			return PTR_ERR(port->reg_base);
> +		port->phys_reg_base = res->start;
> +	}

  reply	other threads:[~2024-07-22 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22  6:25 [PATCH v2 0/2] Add support for Xilinx XDMA Soft IP as Root Port Thippeswamy Havalige
2024-07-22  6:25 ` [PATCH v2 1/2] dt-bindings: PCI: xilinx-xdma: Add schemas for Xilinx QDMA PCIe Root Port Bridge Thippeswamy Havalige
2024-07-22 16:44   ` Conor Dooley
2024-07-24  9:30     ` Havalige, Thippeswamy
2024-07-24 15:54       ` Conor Dooley
2024-07-22  6:25 ` [PATCH v2 2/2] PCI: xilinx-xdma: Add Xilinx QDMA Root Port driver Thippeswamy Havalige
2024-07-22 22:15   ` Bjorn Helgaas [this message]
2024-07-24  9:50     ` Havalige, Thippeswamy

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=20240722221500.GA739438@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.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=michal.simek@amd.com \
    --cc=robh@kernel.org \
    --cc=thippesw@amd.com \
    --cc=thippeswamy.havalige@amd.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;
as well as URLs for NNTP newsgroup(s).