PCI: keembay: Add support for Intel Keem Bay
Subsystems (4)
[email protected]
maintainerv6 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 A0 stepping.
I would also like to inform that I will be taking ownership of this patch series from this version as the previous author moved out of the organization.
Kindly review.
Thanks!
Srikanth
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 | 68 +++ .../bindings/pci/intel,keembay-pcie.yaml | 96 ++++ drivers/pci/controller/dwc/Kconfig | 24 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-keembay.c | 448 ++++++++++++++++++ 5 files changed, 637 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: 45dfb8a5659ad286c28fa59008271dbc4e5e3f2d
Signature · 1 line
2.17.1
[email protected]
maintainerPATCH v6 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 v6 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 | 446 ++++++++++++++++++++++ 4 files changed, 482 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-keembay.c
MAINTAINERS +7 -0
@@ -13852,6 +13852,13 @@ L: [email protected] S: Maintained F: drivers/pci/controller/dwc/*spear* +PCI DRIVER FOR INTEL KEEM BAY +M: Srikanth Thokala <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/pci/intel,keembay-pcie* +F: drivers/pci/controller/dwc/pcie-keembay.c + PCMCIA SUBSYSTEM M: Dominik Brodowski <[email protected]> S: Odd Fixes
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
@@ -14,6 +14,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 +446 -0
446 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 29 lines · On Fri, Jan 22, 2021 at 08:56:10AM +0530, [email protected] wrote:
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_datastructure has one member. It will be expanded later to handle this difference.Endpoint mode link initialization is handled by the boot firmware.
Signed-off-by Wan Ahmad Zainie <[email protected]>Signed-off-by Srikanth Thokala <[email protected]>Acked-by Andy Shevchenko <[email protected]>--- MAINTAINERS | 7 + drivers/pci/controller/dwc/Kconfig | 28 ++ drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-keembay.c | 446 ++++++++++++++++++++++ 4 files changed, 482 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-keembay.cMAINTAINERS +0
-0
MAINTAINERS L: [email protected] · line 13860
Quoted 9 lines
MAINTAINERS +6
-0@@ -13852,6 +13852,13 @@ L: [email protected] S: Maintained F: drivers/pci/controller/dwc/*spear* +PCI DRIVER FOR INTEL KEEM BAY +M: Srikanth Thokala <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/pci/intel,keembay-pcie* +F: drivers/pci/controller/dwc/pcie-keembay.c
<checks MAINTAINERS> ... yep, all previous entries are in alphabetical order. This new one just got dropped at the end.
I feel like a broken record, but please, please, take a look at the surrounding code/text/whatever, and MAKE YOUR NEW STUFF MATCH THE EXISTING STYLE. We want the whole thing to be reasonably consistent so readers can make sense of it without being confused by the idiosyncrasies of every contributor.
Also, probably s/PCI DRIVER/PCIE DRIVER/. We have both (an existing inconsistency), but pick one, put it in the section that matches, and alphabetize.
MAINTAINERS L: [email protected]
Quoted 8 lines
MAINTAINERS +4
-0+ PCMCIA SUBSYSTEM M: Dominik Brodowski <[email protected]> S: Odd Fixes +static void keembay_ep_reset_deassert(struct keembay_pcie *pcie) +{ + msleep(100);
Please note the spec section that requires this sleep. Otherwise it's just an unmaintainable magic number.
Quoted 3 lines
MAINTAINERS +3
-0+ gpiod_set_value_cansleep(pcie->reset, 0); + usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); +}
Quoted 4 lines · Bjorn Helgaas
Quoted 2 lines · On Fri, Jan 22, 2021 at 08:56:10AM +0530, [email protected] wrote:
Signed-off-by Wan Ahmad Zainie <[email protected]>Signed-off-by Srikanth Thokala <[email protected]>
This list seems strange. Shouldn't be your SoB last?
...
Quoted 8 lines
<checks
MAINTAINERS> ... yep, all previous entries are in alphabetical order. This new one just got dropped at the end.I feel like a broken record, but please, please, take a look at the surrounding code/text/whatever, and MAKE YOUR NEW STUFF MATCH THE EXISTING STYLE. We want the whole thing to be reasonably consistent so readers can make sense of it without being confused by the idiosyncrasies of every contributor.
I guess even checkpatch.pl should complain about this these days.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Bjorn Helgaas
On Fri, Jan 22, 2021 at 08:56:10AM +0530, [email protected] wrote:
<checksMAINTAINERS> ... yep, all previous entries are in alphabetical order. This new one just got dropped at the end.
Quoted 7 lines
Quoted 5 lines
I feel like a broken record, but please, please, take a look at the surrounding code/text/whatever, and MAKE YOUR NEW STUFF MATCH THE EXISTING STYLE. We want the whole thing to be reasonably consistent so readers can make sense of it without being confused by the idiosyncrasies of every contributor.
I guess even checkpatch.pl should complain about this these days.
Maybe so. But paying attention to the surrounding content can prevent a whole host of style problems that checkpatch.pl can't catch.
We call these changes "patches," but that's an unfortunate term. It suggests a band-aid, which is something very obvious. If a Linux change is done well, a reader should not be able to tell that it was added later. It should look like it was always there from the very beginning.
Bjorn
Thokala, Srikanth
maintainerHi Andy,
Thanks for the review.
Quoted 12 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, January 22, 2021 2:12 AM
To: Bjorn Helgaas <[email protected]>
Cc: Thokala, Srikanth <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v6 2/2] PCI: keembay: Add support for Intel Keem BayOn Thu, Jan 21, 2021 at 01:52:06PM -0600, Bjorn Helgaas wrote:
Quoted 8 lines
Quoted 1 line
On Fri, Jan 22, 2021 at 08:56:10AM +0530, [email protected]
Quoted 1 line · wrote:
Quoted 1 line
Signed-off-by Wan Ahmad ZainieQuoted 1 line
Quoted 1 line
Signed-off-by Srikanth Thokala <[email protected]>This list seems strange. Shouldn't be your SoB last?
Sure, I will fix it.
Quoted 6 lines
...
Quoted 3 lines
<checks
MAINTAINERS> ... yep, all previous entries are in alphabetical order. This new one just got dropped at the end.
Quoted 7 lines
Quoted 5 lines
I feel like a broken record, but please, please, take a look at the surrounding code/text/whatever, and MAKE YOUR NEW STUFF MATCH THE EXISTING STYLE. We want the whole thing to be reasonably consistent so readers can make sense of it without being confused by the idiosyncrasies of every contributor.
I guess even checkpatch.pl should complain about this these days.
Sorry I missed, but there are not any checkpatch warnings. I will fix it in my next version of the patch.
Thanks!
Srikanth
Quoted 5 lines
--
With Best Regards,
Andy Shevchenko
Thokala, Srikanth
maintainerHi Bjorn,
Thanks for the review.
Quoted 61 lines
-----Original Message-----
From: Bjorn Helgaas <[email protected]>
Sent: Friday, January 22, 2021 1:22 AM
To: Thokala, Srikanth <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Raja Subramanian, Lakshmi Bai <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>
Subject: Re: [PATCH v6 2/2] PCI: keembay: Add support for Intel Keem BayQuoted 29 lines · On Fri, Jan 22, 2021 at 08:56:10AM +0530, [email protected] wrote:
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_datastructure has one member. It will be expanded later to handle this difference.Endpoint mode link initialization is handled by the boot firmware.
Signed-off-by Wan Ahmad Zainie <[email protected]>Signed-off-by Srikanth Thokala <[email protected]>Acked-by Andy Shevchenko <[email protected]>--- MAINTAINERS | 7 + drivers/pci/controller/dwc/Kconfig | 28 ++ drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-keembay.c | 446 ++++++++++++++++++++++ 4 files changed, 482 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-keembay.cMAINTAINERS +0
-0MAINTAINERS L: [email protected] · line 13860
Quoted 9 lines
MAINTAINERS +6
-0@@ -13852,6 +13852,13 @@ L: [email protected] S: Maintained F: drivers/pci/controller/dwc/*spear* +PCI DRIVER FOR INTEL KEEM BAY +M: Srikanth Thokala <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/pci/intel,keembay-pcie* +F: drivers/pci/controller/dwc/pcie-keembay.c<checks
MAINTAINERS> ... yep, all previous entries are in alphabetical order. This new one just got dropped at the end.I feel like a broken record, but please, please, take a look at the surrounding code/text/whatever, and MAKE YOUR NEW STUFF MATCH THE EXISTING STYLE. We want the whole thing to be reasonably consistent so readers can make sense of it without being confused by the idiosyncrasies of every contributor.
Quoted 3 lines
Also, probably s/PCI DRIVER/PCIE DRIVER/. We have both (an existing inconsistency), but pick one, put it in the section that matches, and alphabetize.
Sorry I missed; I will fix it in my next version.
Quoted 6 lines
Quoted 5 lines
MAINTAINERS +1
-0+ PCMCIA SUBSYSTEM M: Dominik Brodowski <[email protected]> S: Odd Fixes
Quoted 6 lines
MAINTAINERS
Quoted 3 lines
MAINTAINERS +3
-0+static void keembay_ep_reset_deassert(struct keembay_pcie *pcie) +{ + msleep(100);Please note the spec section that requires this sleep. Otherwise it's just an unmaintainable magic number.
Sure, I will do that.
Thanks!
Srikanth
Quoted 4 lines
Quoted 4 lines
MAINTAINERS +3
-0+ gpiod_set_value_cansleep(pcie->reset, 0); + usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); +}