PCI: keembay: Add support for Intel Keem Bay
Subsystems (4)
[email protected]
maintainerv9 cover PCI: keembay: Add support for Intel Keem Bay
From: Srikanth Thokala <[email protected]>
Hi,
The first patch is to document DT bindings for Keem Bay PCIe controller for both Root Complex and Endpoint modes.
The second patch is the driver file, a glue driver. Keem Bay PCIe controller is based on DesignWare PCIe IP.
The patch was tested with Keem Bay evaluation module board, with B0 stepping.
Kindly review.
Thanks!
Srikanth
Changes since v8:
- Use chained IRQ to handle MSIs, as suggested by Lorenzo Pieralisi.
- Rename *_setup_irq() to *_setup_msi_irq() to be more meaningful.
- Move *_setup_msi_irq() call to *_add_pcie_port() to make it invoke only when controller is in Root Complex mode. In Endpoint mode, IRQ will be setup by the respective driver which will be based on PCIe End Point Framework.
Changes since v7:
- Rename keembay_pcie_ltssm_enable() to align to its functionality.
- Fix other minor comments from "Krzysztof Wilczyński <[email protected]>"
Changes since v6:
- Arrange SoB in chronological order.
- Alphabetized and modified status of entry in MAINTAINERS.
- Added a comment to specify the PCIe spec section about the delay.
Changes since v5:
- Rebased to v5.11-rc4.
- Updated maintainers to add myself in DT binding documents.
- Fix checkpatch issues.
Changes since v4:
- Rebased to v5.11-rc1 and retest.
Changes since v3:
- Add Reviewed-by: Rob Herring <[email protected]> tag in dt-bindings patch.
- Remove the keembay_pcie_{readl,writel} wrappers. And replace them with readl() and writel().
- Remove the dead code related to unused irqs.
- Remove unused definition for unused irqs.
- In keembay_pcie_ep_init(), initialize enabled interrupts to known state.
- Rebased to next-20201215.
Changes since v2:
- In keembay_pcie_probe(), use return keembay_pcie_add_pcie_port(pcie, pdev); statement and remove return 0; at the end of the function.
Changes since v1:
- In dt-bindings patch.
- Fixed indent warning for compatible property.
- Rename interrupt-names to pcie, pcie_ev, pcie_err and pcie_mem_access, similar to the name used in datasheet.
- Remove device_type, #address-cells and #size-cells property.
- Remove num-viewport, num-ib-windows and num-ob-windows property.
- Replace additionalProperties with unevaluatedProperties, for RC only.
- Add dbi2 and atu property.
- Remove description for regs and interrupts property.
- Change enum value for num-lanes to 1 and 2 only.
- In driver patch.
- In Kconfig file, remove dependency on ARM64.
- Add new define, PCIE_REGS_PCIE_SII_LINK_UP.
- Remove PCIE_DBI2_MASK.
- In struct keembay_pcie, declare pci member as struct, not pointer. And remove irq number members.
- Rename and rework keembay_pcie_establish_link(), to keembay_pcie_start_link().
- Remove unneeded BAR disable steps.
- Remove unused interrupt handlers; keembay_pcie_ev_irq_handler(), keembay_pcie_err_irq_handler().
- Remove keembay_pcie_enable_interrupts().
- Rework keembay_pcie_setup_irq() and call it from keembay_pcie_probe().
- Remove keembay_pcie_host_init() and make keembay_pcie_host_ops empty.
- Keep and rework keembay_pcie_add_pcie_port() a little.
- Remove keembay_pcie_add_pcie_ep() and call dw_pcie_ep_init() from keembay_pcie_probe().
- In keembay_pcie_probe(), remove dbi setup as it will be handled in dwc common code.
- In keembay_pcie_link_up(), use return (val &
PCIE_REGS_PCIE_SII_LINK_UP) == PCIE_REGS_PCIE_SII_LINK_UP.
- In keembay_pcie_ep_raise_irq(), rework error message for PCI_EPC_IRQ_LEGACY and default cases.
- Rebased to next-20201124, that has dwc pci refactoring,
https://lore.kernel.org/linux-pci/[email protected]/.
Srikanth Thokala (2):
dt-bindings: PCI: Add Intel Keem Bay PCIe controller
PCI: keembay: Add support for Intel Keem Bay
.../bindings/pci/intel,keembay-pcie-ep.yaml | 69 +++ .../bindings/pci/intel,keembay-pcie.yaml | 97 ++++ MAINTAINERS | 7 + drivers/pci/controller/dwc/Kconfig | 28 ++ drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-keembay.c | 451 ++++++++++++++++++ 6 files changed, 653 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/intel,keembay-pcie-ep.yaml create mode 100644 Documentation/devicetree/bindings/pci/intel,keembay-pcie.yaml create mode 100644 drivers/pci/controller/dwc/pcie-keembay.c
base-commit: 88b06399c9c766c283e070b022b5ceafa4f63f19
Signature · 1 line
2.17.1
[email protected]
maintainerPATCH v9 1/2 dt-bindings: PCI: Add Intel Keem Bay PCIe controller
From: Srikanth Thokala <[email protected]>
Document DT bindings for PCIe controller found on Intel Keem Bay SoC.
--- .../bindings/pci/intel,keembay-pcie-ep.yaml | 69 +++++++++++++ .../bindings/pci/intel,keembay-pcie.yaml | 97 +++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/intel,keembay-pcie-ep.yaml create mode 100644 Documentation/devicetree/bindings/pci/intel,keembay-pcie.yaml
Documentation/devicetree/bindings/pci/intel,keembay-pcie-ep.yaml new file +69 -0
@@ -0,0 +1,69 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/pci/intel,keembay-pcie-ep.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Intel Keem Bay PCIe controller Endpoint mode + +maintainers: + - Wan Ahmad Zainie <[email protected]> + - Srikanth Thokala <[email protected]> + +properties: + compatible: + const: intel,keembay-pcie-ep + + reg: + maxItems: 5 + + reg-names: + items: + - const: dbi + - const: dbi2 + - const: atu + - const: addr_space + - const: apb + + interrupts: + maxItems: 4 + + interrupt-names: + items: + - const: pcie + - const: pcie_ev + - const: pcie_err + - const: pcie_mem_access + + num-lanes: + description: Number of lanes to use. + enum: [ 1, 2 ] + +required: + - compatible + - reg + - reg-names + - interrupts + - interrupt-names + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + pcie-ep@37000000 { + compatible = "intel,keembay-pcie-ep"; + reg = <0x37000000 0x00001000>, + <0x37100000 0x00001000>, + <0x37300000 0x00001000>, + <0x36000000 0x01000000>, + <0x37800000 0x00000200>; + reg-names = "dbi", "dbi2", "atu", "addr_space", "apb"; + interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 108 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "pcie", "pcie_ev", "pcie_err", "pcie_mem_access"; + num-lanes = <2>; + };
Documentation/devicetree/bindings/pci/intel,keembay-pcie.yaml new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
2.17.1
[email protected]
maintainerPATCH v9 2/2 PCI: keembay: Add support for Intel Keem Bay
In reply to [email protected]From: Srikanth Thokala <[email protected]>
Add driver for Intel Keem Bay SoC PCIe controller. This controller is based on DesignWare PCIe core.
In Root Complex mode, only internal reference clock is possible for Keem Bay A0. For Keem Bay B0, external reference clock can be used and will be the default configuration. Currently, keembay_pcie_of_data structure has one member. It will be expanded later to handle this difference.
Endpoint mode link initialization is handled by the boot firmware.
--- MAINTAINERS | 7 + drivers/pci/controller/dwc/Kconfig | 28 ++ drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-keembay.c | 451 ++++++++++++++++++++++ 4 files changed, 487 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-keembay.c
MAINTAINERS +7 -0
@@ -14233,6 +14233,13 @@ S: Maintained F: Documentation/devicetree/bindings/pci/hisilicon-histb-pcie.txt F: drivers/pci/controller/dwc/pcie-histb.c +PCIE DRIVER FOR INTEL KEEM BAY +M: Srikanth Thokala <[email protected]> +L: [email protected] +S: Supported +F: Documentation/devicetree/bindings/pci/intel,keembay-pcie* +F: drivers/pci/controller/dwc/pcie-keembay.c + PCIE DRIVER FOR MEDIATEK M: Ryder Lee <[email protected]> M: Jianjun Wang <[email protected]>
drivers/pci/controller/dwc/Kconfig +28 -0
@@ -225,6 +225,34 @@ config PCIE_INTEL_GW The PCIe controller uses the DesignWare core plus Intel-specific hardware wrappers. +config PCIE_KEEMBAY + bool + +config PCIE_KEEMBAY_HOST + bool "Intel Keem Bay PCIe controller - Host mode" + depends on ARCH_KEEMBAY || COMPILE_TEST + depends on PCI && PCI_MSI_IRQ_DOMAIN + select PCIE_DW_HOST + select PCIE_KEEMBAY + help + Say 'Y' here to enable support for the PCIe controller in Keem Bay + to work in host mode. + The PCIe controller is based on DesignWare Hardware and uses + DesignWare core functions. + +config PCIE_KEEMBAY_EP + bool "Intel Keem Bay PCIe controller - Endpoint mode" + depends on ARCH_KEEMBAY || COMPILE_TEST + depends on PCI && PCI_MSI_IRQ_DOMAIN + depends on PCI_ENDPOINT + select PCIE_DW_EP + select PCIE_KEEMBAY + help + Say 'Y' here to enable support for the PCIe controller in Keem Bay + to work in endpoint mode. + The PCIe controller is based on DesignWare Hardware and uses + DesignWare core functions. + config PCIE_KIRIN depends on OF && (ARM64 || COMPILE_TEST) bool "HiSilicon Kirin series SoCs PCIe controllers"
drivers/pci/controller/dwc/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o obj-$(CONFIG_PCIE_INTEL_GW) += pcie-intel-gw.o +obj-$(CONFIG_PCIE_KEEMBAY) += pcie-keembay.o obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o obj-$(CONFIG_PCI_MESON) += pci-meson.o
drivers/pci/controller/dwc/pcie-keembay.c new file +451 -0
451 lines not on this page · raw message
Signature · 1 line
2.17.1
Hi Srikanth,
Everything looks very good!
[...]
drivers/pci/controller/dwc/pcie-keembay.c line 173
Quoted 3 lines
drivers/pci/controller/dwc/pcie-keembay.c new file +3
-0+ ret =devm_add_action_or_reset (dev, + (void (*)(void *))clk_disable_unprepare, + clk);
[...]
Just a small note (no need to change anything) about the above. Some drivers add a small wrapper function around the clk_disable_unprepare() to avoid having to do this case above which is also easier to read as a result. But, this is just a matter of whether it's needed (e.g., some extra steps would be needed to disable clocks, etc.) and personal preference.
Thank you for working on this!
Krzysztof
Thokala, Srikanth
maintainerHi Krzysztof,
Quoted 21 lines
-----Original Message-----
From: Krzysztof Wilczyński <[email protected]>
Sent: Monday, May 24, 2021 4:00 PM
To: Thokala, Srikanth <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v9 2/2] PCI: keembay: Add support for Intel Keem BayHi Srikanth,
Everything looks very good!
[...]
Quoted 3 lines
drivers/pci/controller/dwc/pcie-keembay.c new file +3
-0+ ret =devm_add_action_or_reset (dev, + (void (*)(void *))clk_disable_unprepare, + clk);[...]
Quoted 6 lines
Just a small note (no need to change anything) about the above. Some drivers add a small wrapper function around the
clk_disable_unprepare()to avoid having to do this case above which is also easier to read as a result. But, this is just a matter of whether it's needed (e.g., some extra steps would be needed to disable clocks, etc.) and personal preference.
I will make a note of your suggestion, thank you.
Quoted 4 lines
Thank you for working on this!
Reviewed-by Krzysztof Wilczyński <[email protected]>
Thank you, Krzysztof, for the "Reviewed-by".
Srikanth
Quoted 2 lines
Krzysztof
Hi Srikanth,
[...]
Quoted 3 lines
Quoted 1 line
Reviewed-by Krzysztof Wilczyński <[email protected]>Thank you, Krzysztof, for the "Reviewed-by".
Thank you for working on the driver. :)
Krzysztof
Thokala, Srikanth
maintainerHi all,
Gentle reminder!
Kindly review the patch and comment, if any.
Thanks!
Srikanth
Quoted 130 lines
-----Original Message-----
From: Thokala, Srikanth <[email protected]>
Sent: Tuesday, May 18, 2021 8:31 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; [email protected]; Thokala, Srikanth <[email protected]>
Subject: [PATCH v9 0/2] PCI: keembay: Add support for Intel Keem BayFrom: Srikanth Thokala <[email protected]>
Hi,
The first patch is to document DT bindings for Keem Bay PCIe controller for both Root Complex and Endpoint modes.
The second patch is the driver file, a glue driver. Keem Bay PCIe controller is based on DesignWare PCIe IP.
The patch was tested with Keem Bay evaluation module board, with B0 stepping.
Kindly review.
Thanks!
SrikanthChanges since v8:
- Use chained IRQ to handle MSIs, as suggested by Lorenzo Pieralisi.
- Rename*_setup_irq()to*_setup_msi_irq()to be more meaningful.
- Move*_setup_msi_irq()call to*_add_pcie_port()to make it invoke only when controller is in Root Complex mode. In Endpoint mode, IRQ will be setup by the respective driver which will be based on PCIe End Point Framework.Changes since v7:
- Renamekeembay_pcie_ltssm_enable()to align to its functionality.
- Fix other minor comments from "Krzysztof Wilczyński <[email protected]>"Changes since v6:
- Arrange SoB in chronological order.
- Alphabetized and modified status of entry inMAINTAINERS.
- Added a comment to specify the PCIe spec section about the delay.Changes since v5:
- Rebased to v5.11-rc4.
- Updated maintainers to add myself in DT binding documents.
- Fix checkpatch issues.Changes since v4:
- Rebased to v5.11-rc1 and retest.Changes since v3:
- Add Reviewed-by: Rob Herring <[email protected]> tag in dt-bindings patch.
- Remove the keembay_pcie_{readl,writel} wrappers. And replace them withreadl()andwritel().
- Remove the dead code related to unused irqs.
- Remove unused definition for unused irqs.
- Inkeembay_pcie_ep_init(), initialize enabled interrupts to known state.
- Rebased to next-20201215.Changes since v2:
- Inkeembay_pcie_probe(), use returnkeembay_pcie_add_pcie_port(pcie, pdev); statement and remove return 0; at the end of the function.Changes since v1:
- In dt-bindings patch.
- Fixed indent warning for compatible property.
- Rename interrupt-names to pcie,pcie_ev,pcie_errandpcie_mem_access, similar to the name used in datasheet.
- Removedevice_type, #address-cells and #size-cells property.
- Remove num-viewport, num-ib-windows and num-ob-windows property.
- Replace additionalProperties with unevaluatedProperties, for RC only.
- Add dbi2 and atu property.
- Remove description for regs and interrupts property.
- Change enum value for num-lanes to 1 and 2 only.
- In driver patch.
- InKconfigfile, remove dependency on ARM64.
- Add new define,PCIE_REGS_PCIE_SII_LINK_UP.
- RemovePCIE_DBI2_MASK.
- In structkeembay_pcie, declare pci member as struct, not pointer. And remove irq number members.
- Rename and reworkkeembay_pcie_establish_link(), tokeembay_pcie_start_link().
- Remove unneeded BAR disable steps.
- Remove unused interrupt handlers;keembay_pcie_ev_irq_handler(),keembay_pcie_err_irq_handler().
- Removekeembay_pcie_enable_interrupts().
- Reworkkeembay_pcie_setup_irq()and call it fromkeembay_pcie_probe().
- Removekeembay_pcie_host_init()and makekeembay_pcie_host_opsempty.
- Keep and reworkkeembay_pcie_add_pcie_port()a little.
- Removekeembay_pcie_add_pcie_ep()and calldw_pcie_ep_init()fromkeembay_pcie_probe().
- Inkeembay_pcie_probe(), remove dbi setup as it will be handled in dwc common code.
- Inkeembay_pcie_link_up(), use return (val &PCIE_REGS_PCIE_SII_LINK_UP) == PCIE_REGS_PCIE_SII_LINK_UP.- In
keembay_pcie_ep_raise_irq(), rework error message forPCI_EPC_IRQ_LEGACYand default cases.
- Rebased to next-20201124, that has dwc pci refactoring,
https://lore.kernel.org/linux-pci/20201105211159.1814485-1-
[email protected]/.Srikanth Thokala (2):
dt-bindings: PCI: Add Intel Keem Bay PCIe controller
PCI: keembay: Add support for Intel Keem Bay.../bindings/pci/intel,keembay-pcie-ep.yaml | 69 +++ .../bindings/pci/intel,keembay-pcie.yaml | 97 ++++ MAINTAINERS | 7 + drivers/pci/controller/dwc/Kconfig | 28 ++ drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-keembay.c | 451 ++++++++++++++++++ 6 files changed, 653 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/intel,keembay- pcie-ep.yaml create mode 100644 Documentation/devicetree/bindings/pci/intel,keembay- pcie.yaml create mode 100644 drivers/pci/controller/dwc/pcie-keembay.cbase-commit:
88b06399c9c766c283e070b022b5ceafa4f63f19--
2.17.1