[PATCH v3 00/13] PCI: apple: Add support for t6020

Marc Zyngier posted 13 patches 10 months, 1 week ago
.../devicetree/bindings/pci/apple,pcie.yaml   |  33 ++-
drivers/pci/controller/pci-host-common.c      |  24 +-
drivers/pci/controller/pcie-apple.c           | 241 +++++++++++++-----
drivers/pci/ecam.c                            |   2 +
include/linux/pci-ecam.h                      |   2 +
5 files changed, 220 insertions(+), 82 deletions(-)
[PATCH v3 00/13] PCI: apple: Add support for t6020
Posted by Marc Zyngier 10 months, 1 week ago
As Alyssa didn't have the bandwidth to deal with this series, I have
taken it over. All bugs are therefore mine.

The initial series [1] stated:

"This series adds T6020 support to the Apple PCIe controller. Mostly
 Apple shuffled registers around (presumably to accommodate the larger
 configurations on those machines). So there's a bit of churn here but
 not too much in the way of functional changes."

The biggest change is affecting the ECAM layer, allowing an ECAM
driver to provide its own probe function instead of relying on the
.init() callback to do the work. The ECAM layer can therefore be used
as a library instead of a convoluted driver.

The rest is a mix of bug fixes, cleanups, and required abstraction.

This has been tested on T6020 (M2-Pro mini) and T8103 (M1 mini).

* From v2[2]:

  - Fixed the DT binding with new constraints specific to t6020

  - Moved the "for_each_available_node()" fix to the head of the series

  - Collected, RBs, TBs, ABs (thanks!)

* From v1[1]:

  - Described the PHY registers in the DT binding

  - Extracted a ecam bridge creation helper from the host-common layer

  - Moved probing into its own function instead of pci_host_common_probe()
    
  - Moved host-specific data to the of_device_id[] table

  - Added dynamic allocation of the RID/SID bitmap

  - Fixed latent bug in RC-generated interrupts

  - Renamed reg_info to hw_info

  - Dropped useless max_msimap

  - Dropped code being moved around without justification

  - Re-split some of the patches to follow a more logical progression

  - General cleanup to fit my own taste

[1] https://lore.kernel.org/r/20250211-pcie-t6-v1-0-b60e6d2501bb@rosenzweig.io
[2] https://lore.kernel.org/r/20250325102610.2073863-1-maz@kernel.org

Alyssa Rosenzweig (1):
  dt-bindings: pci: apple,pcie: Add t6020 compatible string

Hector Martin (6):
  PCI: apple: Fix missing OF node reference in apple_pcie_setup_port
  PCI: apple: Move port PHY registers to their own reg items
  PCI: apple: Drop poll for CORE_RC_PHYIF_STAT_REFCLK
  PCI: apple: Use gpiod_set_value_cansleep in probe flow
  PCI: apple: Abstract register offsets via a SoC-specific structure
  PCI: apple: Add T602x PCIe support

Janne Grunau (1):
  PCI: apple: Set only available ports up

Marc Zyngier (5):
  PCI: host-generic: Extract an ecam bridge creation helper from
    pci_host_common_probe()
  PCI: ecam: Allow cfg->priv to be pre-populated from the root port
    device
  PCI: apple: Move over to standalone probing
  PCI: apple: Dynamically allocate RID-to_SID bitmap
  PCI: apple: Move away from INTMSK{SET,CLR} for INTx and private
    interrupts

 .../devicetree/bindings/pci/apple,pcie.yaml   |  33 ++-
 drivers/pci/controller/pci-host-common.c      |  24 +-
 drivers/pci/controller/pcie-apple.c           | 241 +++++++++++++-----
 drivers/pci/ecam.c                            |   2 +
 include/linux/pci-ecam.h                      |   2 +
 5 files changed, 220 insertions(+), 82 deletions(-)

-- 
2.39.2
Re: [PATCH v3 00/13] PCI: apple: Add support for t6020
Posted by Manivannan Sadhasivam 9 months, 3 weeks ago
On Tue, 01 Apr 2025 10:17:00 +0100, Marc Zyngier wrote:
> As Alyssa didn't have the bandwidth to deal with this series, I have
> taken it over. All bugs are therefore mine.
> 
> The initial series [1] stated:
> 
> "This series adds T6020 support to the Apple PCIe controller. Mostly
>  Apple shuffled registers around (presumably to accommodate the larger
>  configurations on those machines). So there's a bit of churn here but
>  not too much in the way of functional changes."
> 
> [...]

Applied, thanks! 

[01/13] PCI: apple: Set only available ports up
        commit: 751bec089c4eed486578994abd2c5395f08d0302
[02/13] dt-bindings: pci: apple,pcie: Add t6020 compatible string
        commit: 6b7f49be74758a60b760d6c19a48f65a23511dbe
[03/13] PCI: host-generic: Extract an ecam bridge creation helper from pci_host_common_probe()
        commit: 03d6077605a24f6097681f7938820ac93068115e
[04/13] PCI: ecam: Allow cfg->priv to be pre-populated from the root port device
        commit: f998e79b80da3d4f1756d3289f63289fb833f860
[05/13] PCI: apple: Move over to standalone probing
        commit: cf3120fe852f5a5ff896aa3b2b6a0dfd9676ac31
[06/13] PCI: apple: Dynamically allocate RID-to_SID bitmap
        commit: d5d64a71ec55235810b4ef8256c7f400b24d7ce8
[07/13] PCI: apple: Move away from INTMSK{SET,CLR} for INTx and private interrupts
        commit: 0dcb32f3e12e56f5f3bc659195e5691acbfb299d
[08/13] PCI: apple: Fix missing OF node reference in apple_pcie_setup_port
        commit: 02a982baee109180da03bb8e7e89cf63f0232f93
[09/13] PCI: apple: Move port PHY registers to their own reg items
        commit: 5da38e665ad59b15e4b8788d4c695c64f13a53e7
[10/13] PCI: apple: Drop poll for CORE_RC_PHYIF_STAT_REFCLK
        commit: 3add0420d2574344fc2b29d70cfde25bd9d67d47
[11/13] PCI: apple: Use gpiod_set_value_cansleep in probe flow
        commit: 484af093984c35773ee01067b8cea440c5d7e78c
[12/13] PCI: apple: Abstract register offsets via a SoC-specific structure
        commit: 0643c963ed0f902e94b813fdcbf97cbea48a6d1a
[13/13] PCI: apple: Add T602x PCIe support
        commit: f80bfbf4f11758c9e1817f543cd97e66c449d1b4

I've fixed some trivial conflicts while applying. But please check the end
result to make sure I didn't mess up:

https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=controller/apple

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Re: [PATCH v3 00/13] PCI: apple: Add support for t6020
Posted by Marc Zyngier 9 months, 3 weeks ago
On 2025-04-19 15:59, Manivannan Sadhasivam wrote:
> On Tue, 01 Apr 2025 10:17:00 +0100, Marc Zyngier wrote:
>> As Alyssa didn't have the bandwidth to deal with this series, I have
>> taken it over. All bugs are therefore mine.
>> 
>> The initial series [1] stated:
>> 
>> "This series adds T6020 support to the Apple PCIe controller. Mostly
>>  Apple shuffled registers around (presumably to accommodate the larger
>>  configurations on those machines). So there's a bit of churn here but
>>  not too much in the way of functional changes."
>> 
>> [...]
> 
> Applied, thanks!
> 
> [01/13] PCI: apple: Set only available ports up
>         commit: 751bec089c4eed486578994abd2c5395f08d0302
> [02/13] dt-bindings: pci: apple,pcie: Add t6020 compatible string
>         commit: 6b7f49be74758a60b760d6c19a48f65a23511dbe
> [03/13] PCI: host-generic: Extract an ecam bridge creation helper from
> pci_host_common_probe()
>         commit: 03d6077605a24f6097681f7938820ac93068115e
> [04/13] PCI: ecam: Allow cfg->priv to be pre-populated from the root 
> port device
>         commit: f998e79b80da3d4f1756d3289f63289fb833f860
> [05/13] PCI: apple: Move over to standalone probing
>         commit: cf3120fe852f5a5ff896aa3b2b6a0dfd9676ac31
> [06/13] PCI: apple: Dynamically allocate RID-to_SID bitmap
>         commit: d5d64a71ec55235810b4ef8256c7f400b24d7ce8
> [07/13] PCI: apple: Move away from INTMSK{SET,CLR} for INTx and
> private interrupts
>         commit: 0dcb32f3e12e56f5f3bc659195e5691acbfb299d
> [08/13] PCI: apple: Fix missing OF node reference in 
> apple_pcie_setup_port
>         commit: 02a982baee109180da03bb8e7e89cf63f0232f93
> [09/13] PCI: apple: Move port PHY registers to their own reg items
>         commit: 5da38e665ad59b15e4b8788d4c695c64f13a53e7
> [10/13] PCI: apple: Drop poll for CORE_RC_PHYIF_STAT_REFCLK
>         commit: 3add0420d2574344fc2b29d70cfde25bd9d67d47
> [11/13] PCI: apple: Use gpiod_set_value_cansleep in probe flow
>         commit: 484af093984c35773ee01067b8cea440c5d7e78c
> [12/13] PCI: apple: Abstract register offsets via a SoC-specific 
> structure
>         commit: 0643c963ed0f902e94b813fdcbf97cbea48a6d1a
> [13/13] PCI: apple: Add T602x PCIe support
>         commit: f80bfbf4f11758c9e1817f543cd97e66c449d1b4
> 
> I've fixed some trivial conflicts while applying. But please check the 
> end
> result to make sure I didn't mess up:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=controller/apple

I did my own rebase and came up with similar resolutions. The result
booted on my M2-pro mini without issue, so it looks OK to me.

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...