From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Andrea della Porta <andrea.porta@suse.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Krzysztof Wilczynski <kw@linux.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Linus Walleij <linus.walleij@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Derek Kiernan <derek.kiernan@amd.com>,
Dragan Cvetic <dragan.cvetic@amd.com>,
Arnd Bergmann <arnd@arndb.de>,
Saravana Kannan <saravanak@google.com>,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linux-gpio@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Stefan Wahren <wahrenst@gmx.net>,
Herve Codina <herve.codina@bootlin.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH v6 08/10] misc: rp1: RaspberryPi RP1 misc driver
Date: Tue, 21 Jan 2025 09:48:00 +0100 [thread overview]
Message-ID: <2025012143-rippling-rehydrate-581b@gregkh> (raw)
In-Reply-To: <Z49eOdVvwknOoD3E@apocalypse>
On Tue, Jan 21, 2025 at 09:43:37AM +0100, Andrea della Porta wrote:
> Hi Greg,
>
> On 12:47 Fri 17 Jan , Greg Kroah-Hartman wrote:
> > On Mon, Jan 13, 2025 at 03:58:07PM +0100, Andrea della Porta wrote:
> > > The RaspberryPi RP1 is a PCI multi function device containing
> > > peripherals ranging from Ethernet to USB controller, I2C, SPI
> > > and others.
> > >
> > > Implement a bare minimum driver to operate the RP1, leveraging
> > > actual OF based driver implementations for the on-board peripherals
> > > by loading a devicetree overlay during driver probe.
> > >
> > > The peripherals are accessed by mapping MMIO registers starting
> > > from PCI BAR1 region.
> > >
> > > With the overlay approach we can achieve more generic and agnostic
> > > approach to managing this chipset, being that it is a PCI endpoint
> > > and could possibly be reused in other hw implementations. The
> > > presented approach is also used by Bootlin's Microchip LAN966x
> > > patchset (see link) as well, for a similar chipset.
> > >
> > > For reasons why this driver is contained in drivers/misc, please
> > > check the links.
> >
> > Links aren't always around all the time, please document it here why
> > this is needed, and then links can "add to" that summary.
>
> Ack.
>
> >
> > > This driver is heavily based on downstream code from RaspberryPi
> > > Foundation, and the original author is Phil Elwell.
> > >
> > > Link: https://datasheets.raspberrypi.com/rp1/rp1-peripherals.pdf
>
> ...
>
> > > diff --git a/drivers/misc/rp1/rp1_pci.c b/drivers/misc/rp1/rp1_pci.c
> > > new file mode 100644
> > > index 000000000000..3e8ba3fa7fd5
> > > --- /dev/null
> > > +++ b/drivers/misc/rp1/rp1_pci.c
> > > @@ -0,0 +1,305 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * Copyright (c) 2018-24 Raspberry Pi Ltd.
> > > + * All rights reserved.
> > > + */
> > > +
> > > +#include <linux/err.h>
> > > +#include <linux/interrupt.h>
> > > +#include <linux/irq.h>
> > > +#include <linux/irqchip/chained_irq.h>
> > > +#include <linux/irqdomain.h>
> > > +#include <linux/module.h>
> > > +#include <linux/msi.h>
> > > +#include <linux/of_platform.h>
> > > +#include <linux/pci.h>
> > > +#include <linux/platform_device.h>
> > > +
> > > +#include "rp1_pci.h"
> >
> > Why does a self-contained .c file need a .h file? Please put it all in
> > here.
>
> I agree with you. Indeed, the very first version of this patch had the header
> file placed inside the .c, but I received concerns about it and some advice to
> do it differently, as you can see here:
> https://lore.kernel.org/all/ZtWDpaqUG9d9yPPf@apocalypse/
> so I've changed it accordingly in V2. So right now I'm not sure what the
> acceptable behaviour should be ...
It's a pretty simple rule:
Only use a .h file if multiple .c files need to see the symbol.
So no .h file is needed here.
> > > +struct rp1_dev {
> > > + struct pci_dev *pdev;
> > > + struct irq_domain *domain;
> > > + struct irq_data *pcie_irqds[64];
> > > + void __iomem *bar1;
> > > + int ovcs_id; /* overlay changeset id */
> > > + bool level_triggered_irq[RP1_INT_END];
> > > +};
> > > +
> > > +static void msix_cfg_set(struct rp1_dev *rp1, unsigned int hwirq, u32 value)
> > > +{
> > > + iowrite32(value, rp1->bar1 + RP1_PCIE_APBS_BASE + REG_SET + MSIX_CFG(hwirq));
> >
> > Do your writes need a read to flush them properly? Or can they handle
> > this automatically?
> >
>
> I had some thoughts with RaspberryPi foundation folks to double check it, and it
> seems that there should be no need to readback the value (unless we want to go
> really paranoid), so I would avoid that since in case of level handled interrupt
> we would end up reading the register on every triggering interrupts.
Ok, if it passes testing, that's fine, hopefully it works properly, but
if not, you now have a trail to go and fix it in the future :)
thanks,
greg k-h
next prev parent reply other threads:[~2025-01-21 8:48 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 14:57 [PATCH v6 00/10] Add support for RaspberryPi RP1 PCI device using a DT overlay Andrea della Porta
2025-01-13 14:58 ` [PATCH v6 01/10] dt-bindings: clock: Add RaspberryPi RP1 clock bindings Andrea della Porta
2025-01-17 16:49 ` Florian Fainelli
2025-01-13 14:58 ` [PATCH v6 02/10] dt-bindings: pinctrl: Add RaspberryPi RP1 gpio/pinctrl/pinmux bindings Andrea della Porta
2025-01-17 16:48 ` Florian Fainelli
2025-01-13 14:58 ` [PATCH v6 03/10] dt-bindings: pci: Add common schema for devices accessible through PCI BARs Andrea della Porta
2025-01-17 16:48 ` Florian Fainelli
2025-01-13 14:58 ` [PATCH v6 04/10] dt-bindings: misc: Add device specific bindings for RaspberryPi RP1 Andrea della Porta
2025-01-17 16:52 ` Florian Fainelli
2025-01-13 14:58 ` [PATCH v6 05/10] clk: rp1: Add support for clocks provided by RP1 Andrea della Porta
2025-02-03 23:44 ` Bjorn Helgaas
2025-02-07 9:50 ` Andrea della Porta
2025-01-13 14:58 ` [PATCH v6 06/10] pinctrl: rp1: Implement RaspberryPi RP1 gpio support Andrea della Porta
2025-01-13 14:58 ` [PATCH v6 07/10] arm64: dts: rp1: Add support for RaspberryPi's RP1 device Andrea della Porta
2025-01-17 16:51 ` Florian Fainelli
2025-01-13 14:58 ` [PATCH v6 08/10] misc: rp1: RaspberryPi RP1 misc driver Andrea della Porta
2025-01-17 11:47 ` Greg Kroah-Hartman
2025-01-21 8:43 ` Andrea della Porta
2025-01-21 8:48 ` Greg Kroah-Hartman [this message]
2025-01-21 13:59 ` Andrea della Porta
2025-01-21 14:18 ` Greg Kroah-Hartman
2025-01-21 14:38 ` Andrea della Porta
2025-01-21 14:49 ` Greg Kroah-Hartman
2025-01-21 15:15 ` Herve Codina
2025-01-21 15:19 ` Andrea della Porta
2025-01-21 14:53 ` Andrew Lunn
2025-01-21 15:11 ` Andrea della Porta
2025-01-13 14:58 ` [PATCH v6 09/10] arm64: dts: bcm2712: Add external clock for RP1 chipset on Rpi5 Andrea della Porta
2025-01-17 16:51 ` Florian Fainelli
2025-01-13 14:58 ` [PATCH v6 10/10] arm64: defconfig: Enable RP1 misc/clock/gpio drivers Andrea della Porta
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=2025012143-rippling-rehydrate-581b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=andrea.porta@suse.com \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhelgaas@google.com \
--cc=brgl@bgdev.pl \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=derek.kiernan@amd.com \
--cc=devicetree@vger.kernel.org \
--cc=dragan.cvetic@amd.com \
--cc=florian.fainelli@broadcom.com \
--cc=herve.codina@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=manivannan.sadhasivam@linaro.org \
--cc=masahiroy@kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=sboyd@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wahrenst@gmx.net \
--cc=will@kernel.org \
/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).