mbox series

[v3,00/11] imx8mp: Enable PCIe/NVMe support

Message ID 20240312070338.86127-1-sumit.garg@linaro.org
Headers show
Series imx8mp: Enable PCIe/NVMe support | expand

Message

Sumit Garg March 12, 2024, 7:03 a.m. UTC
pcie_imx doesn't seem to share any useful code for iMX8MP SoC and it is
rather tied to quite old port of pcie_designware driver from Linux which
suffices only iMX6 specific needs.

But currently we have the common DWC specific bits which alligns pretty
well with DW PCIe controller on iMX8MP SoC. So lets reuse those common
bits instead as a new driver for iMX8 SoCs. It should be fairly easy to
add support for other iMX8 variants to this driver.

iMX8MP SoC also comes up with standalone PCIe PHY support, so hence we
can reuse the generic PHY infrastructure to power on PCIe PHY.

Testing with this patch-set included:

Verdin iMX8MP # pci enum
PCIE-0: Link up (Gen1-x1, Bus0)
Verdin iMX8MP # 
Verdin iMX8MP # nvme scan
Verdin iMX8MP # 
Verdin iMX8MP # nvme info
Device 0: Vendor: 0x126f Rev: T0828A0  Prod: AA000000000000000720
            Type: Hard Disk
            Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)
Verdin iMX8MP # 
Verdin iMX8MP # load nvme 0 $loadaddr <file-name>

Changes in v3:
- Rebased on top of U-Boot next.
- Incorporated misc. updates to commit messages.
- New patch#2 to refactor reset driver function names.
- Patch#3: Refactored further for better code reuse.
- New patch#4 to fix refcount issue with power domain bus.
- Patch#5: Refactored further for better code reuse.
- Patch#7 & #8: Added dependency on REGMAP and SYSCON. Also, added
  support for vpcie-supply regulator.
- Patch#7 & #8: Added error paths and .remove callback.
- New patch#10 to enable PCIe/NVMe for imx8mp_venice*.

Changes in v2:
- Renamed PCIe IMX driver pcie_dw_imx8.c -> pcie_dw_imx.c.
- Added myself as maintainer for PCIe DWC IMX driver support.
- Incorporated various code and commit message improvement suggestions
  from Marek, thanks.
- Patch#3: Gate PCIe and USB clocks behind corresponding power domain
  IDs.
- Patch#4: Expose HSIO PLL clocks as a regular clock driver instead
  similar to what Linux kernel does.
- Patch#7: Picked up tags.

Sumit Garg (10):
  clk: imx8mp: Add support for PCIe clocks
  reset: imx: Refactor driver to simplify function names
  reset: imx: Add support for i.MX8MP reset controller
  imx8mp: power-domain: Don't power off pd_bus
  imx8mp: power-domain: Add PCIe support
  imx8mp: power-domain: Expose high performance PLL clock
  phy: phy-imx8m-pcie: Add support for i.MX8M{M/P} PCIe PHY
  pci: Add DW PCIe controller support for iMX8MP SoC
  verdin-imx8mp_defconfig: Enable PCIe/NVMe support
  MAINTAINERS: Add entry for PCIe DWC IMX driver

Tim Harvey (1):
  imx8mp_venice_defconfig: Enable PCIe/NVMe support

 MAINTAINERS                           |   6 +
 configs/imx8mp_venice_defconfig       |   8 +
 configs/verdin-imx8mp_defconfig       |   6 +
 drivers/clk/imx/clk-imx8mp.c          |   6 +
 drivers/pci/Kconfig                   |  11 +
 drivers/pci/Makefile                  |   1 +
 drivers/pci/pcie_dw_imx.c             | 338 ++++++++++++++++++++++++++
 drivers/phy/Kconfig                   |  11 +
 drivers/phy/Makefile                  |   1 +
 drivers/phy/phy-imx8m-pcie.c          | 283 +++++++++++++++++++++
 drivers/power/domain/imx8mp-hsiomix.c | 191 ++++++++++++---
 drivers/reset/reset-imx7.c            | 125 +++++++++-
 12 files changed, 937 insertions(+), 50 deletions(-)
 create mode 100644 drivers/pci/pcie_dw_imx.c
 create mode 100644 drivers/phy/phy-imx8m-pcie.c

Comments

Peter Robinson March 12, 2024, 9:43 a.m. UTC | #1
Hi Sumit,

> pcie_imx doesn't seem to share any useful code for iMX8MP SoC and it is
> rather tied to quite old port of pcie_designware driver from Linux which
> suffices only iMX6 specific needs.
>
> But currently we have the common DWC specific bits which alligns pretty
> well with DW PCIe controller on iMX8MP SoC. So lets reuse those common
> bits instead as a new driver for iMX8 SoCs. It should be fairly easy to
> add support for other iMX8 variants to this driver.

The upstream Linux driver is moving towards a single driver [1] for
imx6 -> imx9, would it be possible to add support for all generations
to this driver and then remove the old driver? That would allow this
single modern driver and removing the old imx6 specific driver.

Peter

[1] https://www.spinics.net/lists/linux-pci/msg150359.html

> iMX8MP SoC also comes up with standalone PCIe PHY support, so hence we
> can reuse the generic PHY infrastructure to power on PCIe PHY.
>
> Testing with this patch-set included:
>
> Verdin iMX8MP # pci enum
> PCIE-0: Link up (Gen1-x1, Bus0)
> Verdin iMX8MP #
> Verdin iMX8MP # nvme scan
> Verdin iMX8MP #
> Verdin iMX8MP # nvme info
> Device 0: Vendor: 0x126f Rev: T0828A0  Prod: AA000000000000000720
>             Type: Hard Disk
>             Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)
> Verdin iMX8MP #
> Verdin iMX8MP # load nvme 0 $loadaddr <file-name>
>
> Changes in v3:
> - Rebased on top of U-Boot next.
> - Incorporated misc. updates to commit messages.
> - New patch#2 to refactor reset driver function names.
> - Patch#3: Refactored further for better code reuse.
> - New patch#4 to fix refcount issue with power domain bus.
> - Patch#5: Refactored further for better code reuse.
> - Patch#7 & #8: Added dependency on REGMAP and SYSCON. Also, added
>   support for vpcie-supply regulator.
> - Patch#7 & #8: Added error paths and .remove callback.
> - New patch#10 to enable PCIe/NVMe for imx8mp_venice*.
>
> Changes in v2:
> - Renamed PCIe IMX driver pcie_dw_imx8.c -> pcie_dw_imx.c.
> - Added myself as maintainer for PCIe DWC IMX driver support.
> - Incorporated various code and commit message improvement suggestions
>   from Marek, thanks.
> - Patch#3: Gate PCIe and USB clocks behind corresponding power domain
>   IDs.
> - Patch#4: Expose HSIO PLL clocks as a regular clock driver instead
>   similar to what Linux kernel does.
> - Patch#7: Picked up tags.
>
> Sumit Garg (10):
>   clk: imx8mp: Add support for PCIe clocks
>   reset: imx: Refactor driver to simplify function names
>   reset: imx: Add support for i.MX8MP reset controller
>   imx8mp: power-domain: Don't power off pd_bus
>   imx8mp: power-domain: Add PCIe support
>   imx8mp: power-domain: Expose high performance PLL clock
>   phy: phy-imx8m-pcie: Add support for i.MX8M{M/P} PCIe PHY
>   pci: Add DW PCIe controller support for iMX8MP SoC
>   verdin-imx8mp_defconfig: Enable PCIe/NVMe support
>   MAINTAINERS: Add entry for PCIe DWC IMX driver
>
> Tim Harvey (1):
>   imx8mp_venice_defconfig: Enable PCIe/NVMe support
>
>  MAINTAINERS                           |   6 +
>  configs/imx8mp_venice_defconfig       |   8 +
>  configs/verdin-imx8mp_defconfig       |   6 +
>  drivers/clk/imx/clk-imx8mp.c          |   6 +
>  drivers/pci/Kconfig                   |  11 +
>  drivers/pci/Makefile                  |   1 +
>  drivers/pci/pcie_dw_imx.c             | 338 ++++++++++++++++++++++++++
>  drivers/phy/Kconfig                   |  11 +
>  drivers/phy/Makefile                  |   1 +
>  drivers/phy/phy-imx8m-pcie.c          | 283 +++++++++++++++++++++
>  drivers/power/domain/imx8mp-hsiomix.c | 191 ++++++++++++---
>  drivers/reset/reset-imx7.c            | 125 +++++++++-
>  12 files changed, 937 insertions(+), 50 deletions(-)
>  create mode 100644 drivers/pci/pcie_dw_imx.c
>  create mode 100644 drivers/phy/phy-imx8m-pcie.c
>
> --
> 2.34.1
>
Sumit Garg March 12, 2024, 9:55 a.m. UTC | #2
Hi Peter,

On Tue, 12 Mar 2024 at 15:13, Peter Robinson <pbrobinson@gmail.com> wrote:
>
> Hi Sumit,
>
> > pcie_imx doesn't seem to share any useful code for iMX8MP SoC and it is
> > rather tied to quite old port of pcie_designware driver from Linux which
> > suffices only iMX6 specific needs.
> >
> > But currently we have the common DWC specific bits which alligns pretty
> > well with DW PCIe controller on iMX8MP SoC. So lets reuse those common
> > bits instead as a new driver for iMX8 SoCs. It should be fairly easy to
> > add support for other iMX8 variants to this driver.
>
> The upstream Linux driver is moving towards a single driver [1] for
> imx6 -> imx9, would it be possible to add support for all generations
> to this driver and then remove the old driver?

Sorry but that's not in scope of this patch-set and neither do I
possess boards with all the imx* SoC variants.

> That would allow this
> single modern driver and removing the old imx6 specific driver.

Folks interested in this can build up on this patch-set and port other
imx* variants and then we could have a single modern driver.

-Sumit

>
> Peter
>
> [1] https://www.spinics.net/lists/linux-pci/msg150359.html
>
> > iMX8MP SoC also comes up with standalone PCIe PHY support, so hence we
> > can reuse the generic PHY infrastructure to power on PCIe PHY.
> >
> > Testing with this patch-set included:
> >
> > Verdin iMX8MP # pci enum
> > PCIE-0: Link up (Gen1-x1, Bus0)
> > Verdin iMX8MP #
> > Verdin iMX8MP # nvme scan
> > Verdin iMX8MP #
> > Verdin iMX8MP # nvme info
> > Device 0: Vendor: 0x126f Rev: T0828A0  Prod: AA000000000000000720
> >             Type: Hard Disk
> >             Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)
> > Verdin iMX8MP #
> > Verdin iMX8MP # load nvme 0 $loadaddr <file-name>
> >
> > Changes in v3:
> > - Rebased on top of U-Boot next.
> > - Incorporated misc. updates to commit messages.
> > - New patch#2 to refactor reset driver function names.
> > - Patch#3: Refactored further for better code reuse.
> > - New patch#4 to fix refcount issue with power domain bus.
> > - Patch#5: Refactored further for better code reuse.
> > - Patch#7 & #8: Added dependency on REGMAP and SYSCON. Also, added
> >   support for vpcie-supply regulator.
> > - Patch#7 & #8: Added error paths and .remove callback.
> > - New patch#10 to enable PCIe/NVMe for imx8mp_venice*.
> >
> > Changes in v2:
> > - Renamed PCIe IMX driver pcie_dw_imx8.c -> pcie_dw_imx.c.
> > - Added myself as maintainer for PCIe DWC IMX driver support.
> > - Incorporated various code and commit message improvement suggestions
> >   from Marek, thanks.
> > - Patch#3: Gate PCIe and USB clocks behind corresponding power domain
> >   IDs.
> > - Patch#4: Expose HSIO PLL clocks as a regular clock driver instead
> >   similar to what Linux kernel does.
> > - Patch#7: Picked up tags.
> >
> > Sumit Garg (10):
> >   clk: imx8mp: Add support for PCIe clocks
> >   reset: imx: Refactor driver to simplify function names
> >   reset: imx: Add support for i.MX8MP reset controller
> >   imx8mp: power-domain: Don't power off pd_bus
> >   imx8mp: power-domain: Add PCIe support
> >   imx8mp: power-domain: Expose high performance PLL clock
> >   phy: phy-imx8m-pcie: Add support for i.MX8M{M/P} PCIe PHY
> >   pci: Add DW PCIe controller support for iMX8MP SoC
> >   verdin-imx8mp_defconfig: Enable PCIe/NVMe support
> >   MAINTAINERS: Add entry for PCIe DWC IMX driver
> >
> > Tim Harvey (1):
> >   imx8mp_venice_defconfig: Enable PCIe/NVMe support
> >
> >  MAINTAINERS                           |   6 +
> >  configs/imx8mp_venice_defconfig       |   8 +
> >  configs/verdin-imx8mp_defconfig       |   6 +
> >  drivers/clk/imx/clk-imx8mp.c          |   6 +
> >  drivers/pci/Kconfig                   |  11 +
> >  drivers/pci/Makefile                  |   1 +
> >  drivers/pci/pcie_dw_imx.c             | 338 ++++++++++++++++++++++++++
> >  drivers/phy/Kconfig                   |  11 +
> >  drivers/phy/Makefile                  |   1 +
> >  drivers/phy/phy-imx8m-pcie.c          | 283 +++++++++++++++++++++
> >  drivers/power/domain/imx8mp-hsiomix.c | 191 ++++++++++++---
> >  drivers/reset/reset-imx7.c            | 125 +++++++++-
> >  12 files changed, 937 insertions(+), 50 deletions(-)
> >  create mode 100644 drivers/pci/pcie_dw_imx.c
> >  create mode 100644 drivers/phy/phy-imx8m-pcie.c
> >
> > --
> > 2.34.1
> >
Peter Robinson March 12, 2024, 10 a.m. UTC | #3
On Tue, 12 Mar 2024 at 09:55, Sumit Garg <sumit.garg@linaro.org> wrote:
>
> Hi Peter,
>
> On Tue, 12 Mar 2024 at 15:13, Peter Robinson <pbrobinson@gmail.com> wrote:
> >
> > Hi Sumit,
> >
> > > pcie_imx doesn't seem to share any useful code for iMX8MP SoC and it is
> > > rather tied to quite old port of pcie_designware driver from Linux which
> > > suffices only iMX6 specific needs.
> > >
> > > But currently we have the common DWC specific bits which alligns pretty
> > > well with DW PCIe controller on iMX8MP SoC. So lets reuse those common
> > > bits instead as a new driver for iMX8 SoCs. It should be fairly easy to
> > > add support for other iMX8 variants to this driver.
> >
> > The upstream Linux driver is moving towards a single driver [1] for
> > imx6 -> imx9, would it be possible to add support for all generations
> > to this driver and then remove the old driver?
>
> Sorry but that's not in scope of this patch-set and neither do I
> possess boards with all the imx* SoC variants.
>
> > That would allow this
> > single modern driver and removing the old imx6 specific driver.
>
> Folks interested in this can build up on this patch-set and port other
> imx* variants and then we could have a single modern driver.

That's fine but I think you  should document that this can be future
because the case is that these devices are clearly related.

> -Sumit
>
> >
> > Peter
> >
> > [1] https://www.spinics.net/lists/linux-pci/msg150359.html
> >
> > > iMX8MP SoC also comes up with standalone PCIe PHY support, so hence we
> > > can reuse the generic PHY infrastructure to power on PCIe PHY.
> > >
> > > Testing with this patch-set included:
> > >
> > > Verdin iMX8MP # pci enum
> > > PCIE-0: Link up (Gen1-x1, Bus0)
> > > Verdin iMX8MP #
> > > Verdin iMX8MP # nvme scan
> > > Verdin iMX8MP #
> > > Verdin iMX8MP # nvme info
> > > Device 0: Vendor: 0x126f Rev: T0828A0  Prod: AA000000000000000720
> > >             Type: Hard Disk
> > >             Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)
> > > Verdin iMX8MP #
> > > Verdin iMX8MP # load nvme 0 $loadaddr <file-name>
> > >
> > > Changes in v3:
> > > - Rebased on top of U-Boot next.
> > > - Incorporated misc. updates to commit messages.
> > > - New patch#2 to refactor reset driver function names.
> > > - Patch#3: Refactored further for better code reuse.
> > > - New patch#4 to fix refcount issue with power domain bus.
> > > - Patch#5: Refactored further for better code reuse.
> > > - Patch#7 & #8: Added dependency on REGMAP and SYSCON. Also, added
> > >   support for vpcie-supply regulator.
> > > - Patch#7 & #8: Added error paths and .remove callback.
> > > - New patch#10 to enable PCIe/NVMe for imx8mp_venice*.
> > >
> > > Changes in v2:
> > > - Renamed PCIe IMX driver pcie_dw_imx8.c -> pcie_dw_imx.c.
> > > - Added myself as maintainer for PCIe DWC IMX driver support.
> > > - Incorporated various code and commit message improvement suggestions
> > >   from Marek, thanks.
> > > - Patch#3: Gate PCIe and USB clocks behind corresponding power domain
> > >   IDs.
> > > - Patch#4: Expose HSIO PLL clocks as a regular clock driver instead
> > >   similar to what Linux kernel does.
> > > - Patch#7: Picked up tags.
> > >
> > > Sumit Garg (10):
> > >   clk: imx8mp: Add support for PCIe clocks
> > >   reset: imx: Refactor driver to simplify function names
> > >   reset: imx: Add support for i.MX8MP reset controller
> > >   imx8mp: power-domain: Don't power off pd_bus
> > >   imx8mp: power-domain: Add PCIe support
> > >   imx8mp: power-domain: Expose high performance PLL clock
> > >   phy: phy-imx8m-pcie: Add support for i.MX8M{M/P} PCIe PHY
> > >   pci: Add DW PCIe controller support for iMX8MP SoC
> > >   verdin-imx8mp_defconfig: Enable PCIe/NVMe support
> > >   MAINTAINERS: Add entry for PCIe DWC IMX driver
> > >
> > > Tim Harvey (1):
> > >   imx8mp_venice_defconfig: Enable PCIe/NVMe support
> > >
> > >  MAINTAINERS                           |   6 +
> > >  configs/imx8mp_venice_defconfig       |   8 +
> > >  configs/verdin-imx8mp_defconfig       |   6 +
> > >  drivers/clk/imx/clk-imx8mp.c          |   6 +
> > >  drivers/pci/Kconfig                   |  11 +
> > >  drivers/pci/Makefile                  |   1 +
> > >  drivers/pci/pcie_dw_imx.c             | 338 ++++++++++++++++++++++++++
> > >  drivers/phy/Kconfig                   |  11 +
> > >  drivers/phy/Makefile                  |   1 +
> > >  drivers/phy/phy-imx8m-pcie.c          | 283 +++++++++++++++++++++
> > >  drivers/power/domain/imx8mp-hsiomix.c | 191 ++++++++++++---
> > >  drivers/reset/reset-imx7.c            | 125 +++++++++-
> > >  12 files changed, 937 insertions(+), 50 deletions(-)
> > >  create mode 100644 drivers/pci/pcie_dw_imx.c
> > >  create mode 100644 drivers/phy/phy-imx8m-pcie.c
> > >
> > > --
> > > 2.34.1
> > >
Sumit Garg March 13, 2024, 6:45 a.m. UTC | #4
On Tue, 12 Mar 2024 at 15:30, Peter Robinson <pbrobinson@gmail.com> wrote:
>
> On Tue, 12 Mar 2024 at 09:55, Sumit Garg <sumit.garg@linaro.org> wrote:
> >
> > Hi Peter,
> >
> > On Tue, 12 Mar 2024 at 15:13, Peter Robinson <pbrobinson@gmail.com> wrote:
> > >
> > > Hi Sumit,
> > >
> > > > pcie_imx doesn't seem to share any useful code for iMX8MP SoC and it is
> > > > rather tied to quite old port of pcie_designware driver from Linux which
> > > > suffices only iMX6 specific needs.
> > > >
> > > > But currently we have the common DWC specific bits which alligns pretty
> > > > well with DW PCIe controller on iMX8MP SoC. So lets reuse those common
> > > > bits instead as a new driver for iMX8 SoCs. It should be fairly easy to
> > > > add support for other iMX8 variants to this driver.
> > >
> > > The upstream Linux driver is moving towards a single driver [1] for
> > > imx6 -> imx9, would it be possible to add support for all generations
> > > to this driver and then remove the old driver?
> >
> > Sorry but that's not in scope of this patch-set and neither do I
> > possess boards with all the imx* SoC variants.
> >
> > > That would allow this
> > > single modern driver and removing the old imx6 specific driver.
> >
> > Folks interested in this can build up on this patch-set and port other
> > imx* variants and then we could have a single modern driver.
>
> That's fine but I think you  should document that this can be future
> because the case is that these devices are clearly related.
>

Sure, I suppose it deserves a header comment for the legacy pcie_imx.c
driver. If I don't see any other comments for this series then I can
make that as a follow-up patch. Otherwise I will fold it into this
series.

-Sumit