From: Bjorn Helgaas <helgaas@kernel.org>
To: Chen Wang <unicornxw@gmail.com>
Cc: kw@linux.com, u.kleine-koenig@baylibre.com,
aou@eecs.berkeley.edu, arnd@arndb.de, bhelgaas@google.com,
unicorn_wang@outlook.com, conor+dt@kernel.org, guoren@kernel.org,
inochiama@outlook.com, krzk+dt@kernel.org, lee@kernel.org,
lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org,
palmer@dabbelt.com, paul.walmsley@sifive.com,
pbrobinson@gmail.com, robh@kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org,
chao.wei@sophgo.com, xiaoguang.xing@sophgo.com,
fengchun.li@sophgo.com
Subject: Re: [PATCH v2 2/5] PCI: sg2042: Add Sophgo SG2042 PCIe driver
Date: Tue, 10 Dec 2024 11:31:23 -0600 [thread overview]
Message-ID: <20241210173123.GA3247614@bhelgaas> (raw)
In-Reply-To: <1d82eff3670f60df24228e5c83cf663c6dd61eaf.1733726572.git.unicorn_wang@outlook.com>
On Mon, Dec 09, 2024 at 03:19:57PM +0800, Chen Wang wrote:
> From: Chen Wang <unicorn_wang@outlook.com>
>
> Add support for PCIe controller in SG2042 SoC. The controller
> uses the Cadence PCIe core programmed by pcie-cadence*.c. The
> PCIe controller will work in host mode only.
> +++ b/drivers/pci/controller/cadence/Makefile
> @@ -4,3 +4,4 @@ obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host.o
> obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o
> obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o
> obj-$(CONFIG_PCI_J721E) += pci-j721e.o
> +obj-$(CONFIG_PCIE_SG2042) += pcie-sg2042.o
> \ No newline at end of file
Add the newline.
> +++ b/drivers/pci/controller/cadence/pcie-sg2042.c
> +#include "../../../irqchip/irq-msi-lib.h"
This is the only file outside drivers/irqchip/ that includes this.
What's special about this driver? Maybe this is a hint that something
here belongs in drivers/irqchip/?
> +#ifdef CONFIG_SMP
No other drivers test CONFIG_SMP, why should this be different?
> +static int sg2042_pcie_msi_irq_set_affinity(struct irq_data *d,
> + const struct cpumask *mask,
> + bool force)
> +{
> + if (d->parent_data)
> + return irq_chip_set_affinity_parent(d, mask, force);
> +
> + return -EINVAL;
> +}
> +#endif /* CONFIG_SMP */
> +static int sg2042_pcie_init_msi_data(struct sg2042_pcie *pcie)
> +{
> + struct device *dev = pcie->cdns_pcie->dev;
> + u32 value;
> + int ret;
> +
> + raw_spin_lock_init(&pcie->msi_lock);
> +
> + /*
> + * Though the PCIe controller can address >32-bit address space, to
> + * facilitate endpoints that support only 32-bit MSI target address,
> + * the mask is set to 32-bit to make sure that MSI target address is
> + * always a 32-bit address
> + */
> + ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
Not sure this is needed. Does DT dma-ranges not cover this?
> +static int sg2042_pcie_setup_msi(struct sg2042_pcie *pcie, struct device_node *msi_node)
Wrap to fit in 80 columns like the rest.
> +/*
> + * SG2042 only support 4-byte aligned access, so for the rootbus (i.e. to read
> + * the PCIe controller itself, read32 is required. For non-rootbus (i.e. to read
s/PCIe controller/Root Port/
> + * the PCIe peripheral registers, supports 1/2/4 byte aligned access, so
> + * directly use read should be fine.
s/use read/using read/
> +static int sg2042_pcie_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct device_node *np = dev->of_node;
> + struct pci_host_bridge *bridge;
> + struct device_node *np_syscon;
> + struct device_node *msi_node;
> + struct cdns_pcie *cdns_pcie;
> + struct sg2042_pcie *pcie;
> + struct cdns_pcie_rc *rc;
> + struct regmap *syscon;
> + int ret;
> +
> + if (!IS_ENABLED(CONFIG_PCIE_CADENCE_HOST))
> + return -ENODEV;
I don't think this is needed since CONFIG_PCIE_SG2042 selects
PCIE_CADENCE_HOST.
Bjorn
next prev parent reply other threads:[~2024-12-10 17:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 7:19 [PATCH v2 0/5] Add PCIe support to Sophgo SG2042 SoC Chen Wang
2024-12-09 7:19 ` [PATCH v2 1/5] dt-bindings: pci: Add Sophgo SG2042 PCIe host Chen Wang
2024-12-10 17:33 ` Bjorn Helgaas
2024-12-11 9:00 ` Chen Wang
2024-12-11 19:20 ` Bjorn Helgaas
2024-12-17 13:10 ` Rob Herring
2024-12-19 2:34 ` Chen Wang
2024-12-19 12:16 ` Rob Herring
2024-12-20 0:14 ` Chen Wang
2025-01-06 23:55 ` Chen Wang
2025-01-07 0:18 ` Bjorn Helgaas
2025-01-07 0:43 ` Chen Wang
2024-12-09 7:19 ` [PATCH v2 2/5] PCI: sg2042: Add Sophgo SG2042 PCIe driver Chen Wang
2024-12-10 17:31 ` Bjorn Helgaas [this message]
2024-12-19 3:23 ` Chen Wang
2024-12-15 9:17 ` kernel test robot
2024-12-15 12:04 ` kernel test robot
2024-12-09 7:20 ` [PATCH v2 3/5] dt-bindings: mfd: syscon: Add sg2042 pcie ctrl compatible Chen Wang
2024-12-10 17:32 ` Bjorn Helgaas
2024-12-09 7:20 ` [PATCH v2 4/5] riscv: sophgo: dts: add pcie controllers for SG2042 Chen Wang
2024-12-09 7:20 ` [PATCH v2 5/5] riscv: sophgo: dts: enable pcie for PioneerBox Chen Wang
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=20241210173123.GA3247614@bhelgaas \
--to=helgaas@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=chao.wei@sophgo.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=fengchun.li@sophgo.com \
--cc=guoren@kernel.org \
--cc=inochiama@outlook.com \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=pbrobinson@gmail.com \
--cc=robh@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=unicorn_wang@outlook.com \
--cc=unicornxw@gmail.com \
--cc=xiaoguang.xing@sophgo.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