mbox series

[v7,0/8] Add support for PCIe controller to work in endpoint mode on R-Car/RZ/G2x SoCs

Message ID 1586360280-10956-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com
Headers show
Series Add support for PCIe controller to work in endpoint mode on R-Car/RZ/G2x SoCs | expand

Message

Lad Prabhakar April 8, 2020, 3:37 p.m. UTC
Hi All,

This patch series adds support for PCIe controller on R-Car/RZ-G2x to work in
endpoint mode, this also extends the epf framework to handle base region
for mapping PCI address locally.

Note:
The cadence/rockchip/designware endpoint drivers are build tested only.

Changes for v7 (Respun this version quickly to ML as the changes requested
were quite small and it has been reviewed substantially):
* Fixed review comments pointed by Shimoda-san
  1] Made DT bindings dual licensed, added Shimoda-san as maintainer and fixed
     the example as its built with #{address,size}-cells = <1>. I have still
     restored the Ack from Rob and Shimoda-san with these changes.
  2] Split up the patches so that they can be picked up by respective subsystem
     patches 1/4-9/11 are now part of this series.
  3] Dropped altering a comment in pci-epc.h
  4] Used a local variable align_size in pci_epc_mem_alloc_addr() so that size
     variable doesn't get overwritten in the loop.
  5] Replaced i-=1 with i--
  6] Replaced rcar with R-Car in patch subject and description.
  7] Set MACCTLR in init() callback

Changes for v6:
1] Rebased patches on endpoint branch of https://git.kernel.org/pub/
   scm/linux/kernel/git/lpieralisi/pci.git/
2] Fixed review comments from Shimoda-san
   a] Made sure defconfig changes were in separate patch
   b] Created rcar_pcie_host/rcar_pcie_ep structures
   c] Added pci-id for R8A774C0
   d] Added entry in MAINTAINERS for dt-binding
   e] Dropped unnecessary braces
3] Added support for msi.

Changes for v5:
1] Rebased patches on next branch of https://git.kernel.org/pub/scm/
   linux/kernel/git/helgaas/pci.git
2] Fixed review comments reported by Kishon while fetching the matching
   window in function pci_epc_get_matching_window()
3] Fixed review comments reported by Bjorn
   a] Split patch up first patch so that its easier to review and incremental
   b] Fixed typos
4] Included Reviewed tag from Rob for the dt-binding patch
5] Fixed issue reported by Nathan for assigning variable to itself

Changes for v4:
1] Fixed dtb_check error reported by Rob
2] Fixed review comments reported by Kishon
   a] Dropped pci_epc_find_best_fit_window()
   b] Fixed initializing mem ptr in __pci_epc_mem_init()
   c] Dropped map_size from pci_epc_mem_window structure

Changes for v3:
1] Fixed review comments from Bjorn and Kishon.
3] Converted to DT schema

Changes for v2:
1] Fixed review comments from Biju for dt-bindings to include an example
   for a tested platform.
2] Fixed review comments from Kishon to extend the features of outbound
   regions in epf framework.
3] Added support to parse outbound-ranges in OF.


Lad Prabhakar (8):
  PCI: rcar: Rename pcie-rcar.c to pcie-rcar-host.c
  PCI: rcar: Move shareable code to a common file
  PCI: rcar: Fix calculating mask for PCIEPAMR register
  PCI: endpoint: Add support to handle multiple base for mapping
    outbound memory
  dt-bindings: PCI: rcar: Add bindings for R-Car PCIe endpoint
    controller
  PCI: rcar: Add support for R-Car PCIe controller in endpoint mode
  PCI: Add Renesas R8A774C0 device ID
  MAINTAINERS: Add file patterns for rcar PCI device tree bindings

 .../devicetree/bindings/pci/rcar-pci-ep.yaml  |   77 ++
 MAINTAINERS                                   |    1 +
 drivers/pci/controller/Kconfig                |   18 +
 drivers/pci/controller/Makefile               |    3 +-
 .../pci/controller/cadence/pcie-cadence-ep.c  |    3 +-
 .../pci/controller/dwc/pcie-designware-ep.c   |   16 +-
 drivers/pci/controller/pcie-rcar-ep.c         |  555 ++++++++
 drivers/pci/controller/pcie-rcar-host.c       | 1065 +++++++++++++++
 drivers/pci/controller/pcie-rcar.c            | 1206 +----------------
 drivers/pci/controller/pcie-rcar.h            |  140 ++
 drivers/pci/controller/pcie-rockchip-ep.c     |    2 +-
 drivers/pci/endpoint/pci-epc-mem.c            |  196 ++-
 include/linux/pci-epc.h                       |   37 +-
 include/linux/pci_ids.h                       |    1 +
 14 files changed, 2071 insertions(+), 1249 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pci/rcar-pci-ep.yaml
 create mode 100644 drivers/pci/controller/pcie-rcar-ep.c
 create mode 100644 drivers/pci/controller/pcie-rcar-host.c
 create mode 100644 drivers/pci/controller/pcie-rcar.h

Comments

Sergei Shtylyov April 9, 2020, 9:36 a.m. UTC | #1
Hello!

On 08.04.2020 18:37, Lad Prabhakar wrote:

> Add R8A774C0 device ID so that this can be used by
> pci_endpoint_test driver.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>   include/linux/pci_ids.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 1dfc4e1dcb94..9e957c18abeb 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2460,6 +2460,7 @@
>   #define PCI_DEVICE_ID_RENESAS_SH7763	0x0004
>   #define PCI_DEVICE_ID_RENESAS_SH7785	0x0007
>   #define PCI_DEVICE_ID_RENESAS_SH7786	0x0010
> +#define PCI_DEVICE_ID_RENESAS_R8A774C0	0x002d

    We don't add the device IDs in this file, unless used in several places.
Is it?

[...]

MBR, Sergei
Lad, Prabhakar April 9, 2020, 10:04 a.m. UTC | #2
Hi Sergei and Bjorn,

On Thu, Apr 9, 2020 at 10:36 AM Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
>
> Hello!
>
> On 08.04.2020 18:37, Lad Prabhakar wrote:
>
> > Add R8A774C0 device ID so that this can be used by
> > pci_endpoint_test driver.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >   include/linux/pci_ids.h | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> > index 1dfc4e1dcb94..9e957c18abeb 100644
> > --- a/include/linux/pci_ids.h
> > +++ b/include/linux/pci_ids.h
> > @@ -2460,6 +2460,7 @@
> >   #define PCI_DEVICE_ID_RENESAS_SH7763        0x0004
> >   #define PCI_DEVICE_ID_RENESAS_SH7785        0x0007
> >   #define PCI_DEVICE_ID_RENESAS_SH7786        0x0010
> > +#define PCI_DEVICE_ID_RENESAS_R8A774C0       0x002d
>
>     We don't add the device IDs in this file, unless used in several places.
> Is it?
>
My bad I should have checked it before making this change actually it
was suggested in my previous version of the series but anyway atm this
was planned to be  used only in pci_endpoint_test driver, so in that
case Ill drop this patch.

Cheers,
--Prabhakar

> [...]
>
> MBR, Sergei
Yoshihiro Shimoda April 10, 2020, 12:12 a.m. UTC | #3
Hi Prabhakar, Sergei, Bjorn,

> From: Lad, Prabhakar, Sent: Thursday, April 9, 2020 7:05 PM
<snip> 
> > > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> > > index 1dfc4e1dcb94..9e957c18abeb 100644
> > > --- a/include/linux/pci_ids.h
> > > +++ b/include/linux/pci_ids.h
> > > @@ -2460,6 +2460,7 @@
> > >   #define PCI_DEVICE_ID_RENESAS_SH7763        0x0004
> > >   #define PCI_DEVICE_ID_RENESAS_SH7785        0x0007
> > >   #define PCI_DEVICE_ID_RENESAS_SH7786        0x0010
> > > +#define PCI_DEVICE_ID_RENESAS_R8A774C0       0x002d
> >
> >     We don't add the device IDs in this file, unless used in several places.
> > Is it?
> >
> My bad I should have checked it before making this change actually it
> was suggested in my previous version of the series but anyway atm this
> was planned to be  used only in pci_endpoint_test driver, so in that
> case Ill drop this patch.

I'm very sorry, this is my fault. I suggested this but I didn't check
this pci_ids.h's rule...

Best regards,
Yoshihiro Shimoda