mbox series

[00/13] Add support for Hikey 970 PCIe

Message ID cover.1612271903.git.mchehab+huawei@kernel.org
Headers show
Series Add support for Hikey 970 PCIe | expand

Message

Mauro Carvalho Chehab Feb. 2, 2021, 1:29 p.m. UTC
This series add support for Kirin 970 and for the Hikey 970
board at the already-existing  driver.

patches 1-3 were previously submitted as RFC:

- Patch 1 converts the Synopsys Designware PCIe binding
  documentation to the DT schema;
- Patch 2 converts the pcie-kirin DT binding to the DT schema;
- Patch 3 adds some extra configuration needed by
  Kirin 970.

Patches 4-5 were imported from Manivannan's Hikey 970
tree:

   https://git.linaro.org/people/manivannan.sadhasivam/96b-common.git/commit/?h=hikey970_pcie&id=4917380ad023c62960aa0f876bd4f23cefc8729e

It contains the original port made by Linaro.

patches 6 to 12 contains several cleanups applied on the
top of Manivann's work, in order to simplify the extra data
that would be required at DT, and to ensure that the power
regulator needed to enable the PCI support on Hikey970
will be enabled before trying to power it on, as otherwise,
PCI resource allocation will fail.

-

patch 13 is here mostly as an example about what is needed
in order for PCIe (and Ethernet) to start working on Hikey 970.

It won't apply cleanly, as it depends on another patch series,
adding the needed regulator drivers.

I'll re-submit patch 13 after the pending stuff gets merged
upstream.

Manivannan Sadhasivam (2):
  pci: dwc: pcie-kirin: add HI3670 PCI-E controller support
  arm64: dts: hisilicon: Add HI3670 PCI-E controller support

Mauro Carvalho Chehab (11):
  doc: bindings: pci: designware-pcie.txt: convert it to yaml
  doc: bindings: kirin-pcie.txt: convert it to yaml
  doc: bindings: add new parameters used by Hikey 970
  pci: dwc: pcie-kirin: simplify error handling logic
  pci: dwc: pcie-kirin: simplify kirin 970 get resource logic
  pci: dwc: pcie-kirin: place common init code altogether
  pci: dwc: pcie-kirin: allow to optionally require a regulator
  pci: dwc: pcie-kirin: allow using multiple reset GPIOs
  pci: dwc: pcie-kirin: add support for clkreq GPIOs
  pci: dwc: pcie-kirin: cleanup kirin970_pcie_get_eyeparam()
  arm64: dts: hisilicon: cleanup Hikey 970 PCI schema

 .../bindings/pci/amlogic,meson-pcie.txt       |   4 +-
 .../bindings/pci/axis,artpec6-pcie.txt        |   2 +-
 .../bindings/pci/designware-pcie.txt          |  77 --
 .../bindings/pci/fsl,imx6q-pcie.txt           |   2 +-
 .../bindings/pci/hisilicon,kirin-pcie.yaml    | 144 ++++
 .../bindings/pci/hisilicon-histb-pcie.txt     |   2 +-
 .../bindings/pci/hisilicon-pcie.txt           |   2 +-
 .../devicetree/bindings/pci/kirin-pcie.txt    |  50 --
 .../bindings/pci/layerscape-pci.txt           |   2 +-
 .../bindings/pci/nvidia,tegra194-pcie.txt     |   4 +-
 .../devicetree/bindings/pci/pci-armada8k.txt  |   2 +-
 .../devicetree/bindings/pci/pci-keystone.txt  |  10 +-
 .../devicetree/bindings/pci/pcie-al.txt       |   2 +-
 .../devicetree/bindings/pci/qcom,pcie.txt     |  14 +-
 .../bindings/pci/samsung,exynos-pcie.yaml     |   2 +-
 .../devicetree/bindings/pci/snps,pcie.yaml    | 139 ++++
 .../pci/socionext,uniphier-pcie-ep.yaml       |   2 +-
 .../devicetree/bindings/pci/ti-pci.txt        |   4 +-
 .../devicetree/bindings/pci/uniphier-pcie.txt |   2 +-
 MAINTAINERS                                   |   4 +-
 arch/arm64/boot/dts/hisilicon/hi3670.dtsi     |  64 ++
 .../boot/dts/hisilicon/hikey970-pmic.dtsi     |   1 -
 drivers/pci/controller/dwc/pcie-kirin.c       | 736 +++++++++++++++++-
 23 files changed, 1084 insertions(+), 187 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pci/designware-pcie.txt
 create mode 100644 Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml
 delete mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt
 create mode 100644 Documentation/devicetree/bindings/pci/snps,pcie.yaml

Comments

Bjorn Helgaas Feb. 2, 2021, 2:48 p.m. UTC | #1
On Tue, Feb 02, 2021 at 02:29:45PM +0100, Mauro Carvalho Chehab wrote:
> This series add support for Kirin 970 and for the Hikey 970
> board at the already-existing  driver.
> 
> patches 1-3 were previously submitted as RFC:
> 
> - Patch 1 converts the Synopsys Designware PCIe binding
>   documentation to the DT schema;
> - Patch 2 converts the pcie-kirin DT binding to the DT schema;
> - Patch 3 adds some extra configuration needed by
>   Kirin 970.
> 
> Patches 4-5 were imported from Manivannan's Hikey 970
> tree:
> 
>    https://git.linaro.org/people/manivannan.sadhasivam/96b-common.git/commit/?h=hikey970_pcie&id=4917380ad023c62960aa0f876bd4f23cefc8729e
> 
> It contains the original port made by Linaro.
> 
> patches 6 to 12 contains several cleanups applied on the
> top of Manivann's work, in order to simplify the extra data
> that would be required at DT, and to ensure that the power
> regulator needed to enable the PCI support on Hikey970
> will be enabled before trying to power it on, as otherwise,
> PCI resource allocation will fail.
> 
> -
> 
> patch 13 is here mostly as an example about what is needed
> in order for PCIe (and Ethernet) to start working on Hikey 970.
> 
> It won't apply cleanly, as it depends on another patch series,
> adding the needed regulator drivers.
> 
> I'll re-submit patch 13 after the pending stuff gets merged
> upstream.
> 
> Manivannan Sadhasivam (2):
>   pci: dwc: pcie-kirin: add HI3670 PCI-E controller support
>   arm64: dts: hisilicon: Add HI3670 PCI-E controller support
> 
> Mauro Carvalho Chehab (11):
>   doc: bindings: pci: designware-pcie.txt: convert it to yaml
>   doc: bindings: kirin-pcie.txt: convert it to yaml
>   doc: bindings: add new parameters used by Hikey 970
>   pci: dwc: pcie-kirin: simplify error handling logic
>   pci: dwc: pcie-kirin: simplify kirin 970 get resource logic
>   pci: dwc: pcie-kirin: place common init code altogether
>   pci: dwc: pcie-kirin: allow to optionally require a regulator
>   pci: dwc: pcie-kirin: allow using multiple reset GPIOs
>   pci: dwc: pcie-kirin: add support for clkreq GPIOs
>   pci: dwc: pcie-kirin: cleanup kirin970_pcie_get_eyeparam()
>   arm64: dts: hisilicon: cleanup Hikey 970 PCI schema

Please match:

  $ git log --oneline drivers/pci/controller/dwc/pcie-kirin.c
  60f5b73fa0f2 ("PCI: dwc: Remove unnecessary wrappers around dw_pcie_host_init()")
  b9ac0f9dc8ea ("PCI: dwc: Move dw_pcie_setup_rc() to DWC common code")
  59fbab1ae40e ("PCI: dwc: Move dw_pcie_msi_init() into core")
  886a9c134755 ("PCI: dwc: Move link handling into common code")
  5bcb1757e637 ("PCI: dwc: Move MSI interrupt setup into DWC common code")
  a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code")
  ecc3e424d190 ("PCI: kirin: Return -EPROBE_DEFER in case the gpio isn't ready")

We've already picked "PCIe" (not "PCI-E") as the preferred spelling.
Please adopt in subject lines, commit logs, comments, etc.

Similarly, "YAML" in comments & text, since acronyms are normally
capitalized.

"DesignWare" (not "Designware").

HiSilicon seems to use "HiKey" (not "Hikey"), so let's follow them.

Pick either "Kirin 970" or "HiKey 970" From
http://www.o.hisilicon.com/en/Products/ProductList/HiKey, it looks
like "HiKey 970" refers to a board, and "Kirin 970" refers to a piece
of it.

Please wrap commit logs to fill 75 columns.

>  .../bindings/pci/amlogic,meson-pcie.txt       |   4 +-
>  .../bindings/pci/axis,artpec6-pcie.txt        |   2 +-
>  .../bindings/pci/designware-pcie.txt          |  77 --
>  .../bindings/pci/fsl,imx6q-pcie.txt           |   2 +-
>  .../bindings/pci/hisilicon,kirin-pcie.yaml    | 144 ++++
>  .../bindings/pci/hisilicon-histb-pcie.txt     |   2 +-
>  .../bindings/pci/hisilicon-pcie.txt           |   2 +-
>  .../devicetree/bindings/pci/kirin-pcie.txt    |  50 --
>  .../bindings/pci/layerscape-pci.txt           |   2 +-
>  .../bindings/pci/nvidia,tegra194-pcie.txt     |   4 +-
>  .../devicetree/bindings/pci/pci-armada8k.txt  |   2 +-
>  .../devicetree/bindings/pci/pci-keystone.txt  |  10 +-
>  .../devicetree/bindings/pci/pcie-al.txt       |   2 +-
>  .../devicetree/bindings/pci/qcom,pcie.txt     |  14 +-
>  .../bindings/pci/samsung,exynos-pcie.yaml     |   2 +-
>  .../devicetree/bindings/pci/snps,pcie.yaml    | 139 ++++
>  .../pci/socionext,uniphier-pcie-ep.yaml       |   2 +-
>  .../devicetree/bindings/pci/ti-pci.txt        |   4 +-
>  .../devicetree/bindings/pci/uniphier-pcie.txt |   2 +-
>  MAINTAINERS                                   |   4 +-
>  arch/arm64/boot/dts/hisilicon/hi3670.dtsi     |  64 ++
>  .../boot/dts/hisilicon/hikey970-pmic.dtsi     |   1 -
>  drivers/pci/controller/dwc/pcie-kirin.c       | 736 +++++++++++++++++-
>  23 files changed, 1084 insertions(+), 187 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/pci/designware-pcie.txt
>  create mode 100644 Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml
>  delete mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt
>  create mode 100644 Documentation/devicetree/bindings/pci/snps,pcie.yaml
> 
> -- 
> 2.29.2
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Mauro Carvalho Chehab Feb. 3, 2021, 6:49 a.m. UTC | #2
Hi Rob,

Em Tue, 02 Feb 2021 11:44:54 -0600
Rob Herring <robh@kernel.org> escreveu:

> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: properties:snps,enable-cdm-check: 'oneOf' conditional failed, one must be fixed:
> 	'type' is a required property
> 	Additional properties are not allowed ('$ref' was unexpected)
> 	/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: properties:snps,enable-cdm-check: 'oneOf' conditional failed, one must be fixed:
> 		'enum' is a required property
> 		'const' is a required property
> 	'/schemas/types.yaml#definitions/flag' does not match 'types.yaml#/definitions/'
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: ignoring, error in schema: properties: snps,enable-cdm-check
> warning: no schema found in file: ./Documentation/devicetree/bindings/pci/snps,pcie.yaml
> 
> See https://patchwork.ozlabs.org/patch/1434686
> 
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit.

I've no idea why the bot is hitting those. My tree is based on
staging-testing[1], as I need the regulator patches merged there.
Such tree is based on v5.11-rc5.

There, dt_binding_check doesn't get any warnings on this schema:

$ pip3 install dtschema --upgrade --user
Requirement already up-to-date: dtschema in /home/mchehab/.local/lib/python3.9/site-packages (2020.12)
Requirement already satisfied, skipping upgrade: ruamel.yaml>0.15.69 in /usr/lib/python3.9/site-packages (from dtschema) (0.16.6)
Requirement already satisfied, skipping upgrade: jsonschema>=3.0.1 in /usr/lib/python3.9/site-packages (from dtschema) (3.2.0)
Requirement already satisfied, skipping upgrade: rfc3987 in /home/mchehab/.local/lib/python3.9/site-packages (from dtschema) (1.3.8)
Requirement already satisfied, skipping upgrade: attrs>=17.4.0 in /usr/lib/python3.9/site-packages (from jsonschema>=3.0.1->dtschema) (19.3.0)
Requirement already satisfied, skipping upgrade: pyrsistent>=0.14.0 in /usr/lib64/python3.9/site-packages (from jsonschema>=3.0.1->dtschema) (0.16.0)
Requirement already satisfied, skipping upgrade: setuptools in /usr/lib/python3.9/site-packages (from jsonschema>=3.0.1->dtschema) (49.1.3)
Requirement already satisfied, skipping upgrade: six>=1.11.0 in /usr/lib/python3.9/site-packages (from jsonschema>=3.0.1->dtschema) (1.15.0)

$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 DT_SCHEMA_FILES=Documentation/devicetree/bindings/pci/snps,pcie.yaml dt_binding_check
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/pci/snps,pcie.example.dts
./Documentation/devicetree/bindings/sound/mt8192-mt6359-rt1015-rt5682.yaml:10:4: [warning] wrong indentation: expected 2 but found 3 (indentation)
./Documentation/devicetree/bindings/pinctrl/microchip,sparx5-sgpio.yaml:102:10: [warning] wrong indentation: expected 10 but found 9 (indentation)
  CHKDT   Documentation/devicetree/bindings/processed-schema-examples.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema-examples.json
  DTC     Documentation/devicetree/bindings/pci/snps,pcie.example.dt.yaml
  CHECK   Documentation/devicetree/bindings/pci/snps,pcie.example.dt.yaml

$ git merge v5.11-rc6
Merge made by the 'recursive' strategy.
...
$ make CROSS_COMPILE=aarch64-linux-gnu- dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/pci/snps,pcie.yaml 
  LINT    Documentation/devicetree/bindings
./Documentation/devicetree/bindings/pinctrl/microchip,sparx5-sgpio.yaml:102:10: [warning] wrong indentation: expected 10 but found 9 (indentation)
  CHKDT   Documentation/devicetree/bindings/processed-schema-examples.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema-examples.json
  DTC     Documentation/devicetree/bindings/pci/snps,pcie.example.dt.yaml
  CHECK   Documentation/devicetree/bindings/pci/snps,pcie.example.dt.yaml

Thanks,
Mauro
Rob Herring (Arm) Feb. 4, 2021, 5:29 p.m. UTC | #3
On Wed, Feb 03, 2021 at 07:49:00AM +0100, Mauro Carvalho Chehab wrote:
> Hi Rob,
> 
> Em Tue, 02 Feb 2021 11:44:54 -0600
> Rob Herring <robh@kernel.org> escreveu:
> 
> > My bot found errors running 'make dt_binding_check' on your patch:
> > 
> > yamllint warnings/errors:
> > 
> > dtschema/dtc warnings/errors:
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: properties:snps,enable-cdm-check: 'oneOf' conditional failed, one must be fixed:
> > 	'type' is a required property
> > 	Additional properties are not allowed ('$ref' was unexpected)
> > 	/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: properties:snps,enable-cdm-check: 'oneOf' conditional failed, one must be fixed:
> > 		'enum' is a required property
> > 		'const' is a required property
> > 	'/schemas/types.yaml#definitions/flag' does not match 'types.yaml#/definitions/'

You need a '/' between '#' and 'definitions'.


> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: ignoring, error in schema: properties: snps,enable-cdm-check
> > warning: no schema found in file: ./Documentation/devicetree/bindings/pci/snps,pcie.yaml
> > 
> > See https://patchwork.ozlabs.org/patch/1434686
> > 
> > This check can fail if there are any dependencies. The base for a patch
> > series is generally the most recent rc1.
> > 
> > If you already ran 'make dt_binding_check' and didn't see the above
> > error(s), then make sure 'yamllint' is installed and dt-schema is up to
> > date:
> > 
> > pip3 install dtschema --upgrade
> > 
> > Please check and re-submit.
> 
> I've no idea why the bot is hitting those. My tree is based on
> staging-testing[1], as I need the regulator patches merged there.
> Such tree is based on v5.11-rc5.
> 
> There, dt_binding_check doesn't get any warnings on this schema:
> 
> $ pip3 install dtschema --upgrade --user
> Requirement already up-to-date: dtschema in /home/mchehab/.local/lib/python3.9/site-packages (2020.12)

This particular check is in master, but not yet a release on pypi. I'll 
be tagging a release soon.

I've got this problem that adding new meta-schema checks like this one 
requires fixing up all the existing in tree schemas first. So I give 
some amount of time before adding them to a tagged release. However, I 
want to start testing new schemas right away. I haven't come up with a 
better solution short of importing the meta-schema into the kernel tree 
or separately versioning them.

Rob
Mauro Carvalho Chehab Feb. 4, 2021, 6:29 p.m. UTC | #4
Em Thu, 4 Feb 2021 11:29:45 -0600
Rob Herring <robh@kernel.org> escreveu:

> On Wed, Feb 03, 2021 at 07:49:00AM +0100, Mauro Carvalho Chehab wrote:
> > Hi Rob,
> > 
> > Em Tue, 02 Feb 2021 11:44:54 -0600
> > Rob Herring <robh@kernel.org> escreveu:
> >   
> > > My bot found errors running 'make dt_binding_check' on your patch:
> > > 
> > > yamllint warnings/errors:
> > > 
> > > dtschema/dtc warnings/errors:
> > > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: properties:snps,enable-cdm-check: 'oneOf' conditional failed, one must be fixed:
> > > 	'type' is a required property
> > > 	Additional properties are not allowed ('$ref' was unexpected)
> > > 	/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: properties:snps,enable-cdm-check: 'oneOf' conditional failed, one must be fixed:
> > > 		'enum' is a required property
> > > 		'const' is a required property
> > > 	'/schemas/types.yaml#definitions/flag' does not match 'types.yaml#/definitions/'  
> 
> You need a '/' between '#' and 'definitions'.

ah, OK. Will add it at the next version.
 
> > > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pci/snps,pcie.yaml: ignoring, error in schema: properties: snps,enable-cdm-check
> > > warning: no schema found in file: ./Documentation/devicetree/bindings/pci/snps,pcie.yaml
> > > 
> > > See https://patchwork.ozlabs.org/patch/1434686
> > > 
> > > This check can fail if there are any dependencies. The base for a patch
> > > series is generally the most recent rc1.
> > > 
> > > If you already ran 'make dt_binding_check' and didn't see the above
> > > error(s), then make sure 'yamllint' is installed and dt-schema is up to
> > > date:
> > > 
> > > pip3 install dtschema --upgrade
> > > 
> > > Please check and re-submit.  
> > 
> > I've no idea why the bot is hitting those. My tree is based on
> > staging-testing[1], as I need the regulator patches merged there.
> > Such tree is based on v5.11-rc5.
> > 
> > There, dt_binding_check doesn't get any warnings on this schema:
> > 
> > $ pip3 install dtschema --upgrade --user
> > Requirement already up-to-date: dtschema in /home/mchehab/.local/lib/python3.9/site-packages (2020.12)  
> 
> This particular check is in master, but not yet a release on pypi. I'll 
> be tagging a release soon.
> 
> I've got this problem that adding new meta-schema checks like this one 
> requires fixing up all the existing in tree schemas first. So I give 
> some amount of time before adding them to a tagged release. However, I 
> want to start testing new schemas right away. I haven't come up with a 
> better solution short of importing the meta-schema into the kernel tree 
> or separately versioning them.

IMO, having the meta-schema inside the Kernel tree would be better...

It took me some time to discover that some problems I had with a past
version of this patch series were due to something outside the
Kernel tree, at local/lib/python3.9/site-packages.

Thanks,
Mauro