Re: [PATCH v5 2/2] PCI: amlogic: Add the Amlogic Meson PCIe controller driver

2018-11-21 Thread Hanjie Lin



On 2018/11/17 1:49, Lorenzo Pieralisi wrote:
> On Tue, Oct 09, 2018 at 09:53:10AM +0800, Hanjie Lin wrote:
>> From: Yue Wang 
>>
>> The Amlogic Meson PCIe host controller is based on the Synopsys DesignWare
>> PCI core. This patch adds the driver support for Meson PCIe controller.
>>
>> Signed-off-by: Yue Wang 
>> Signed-off-by: Hanjie Lin 
>> ---
>>  MAINTAINERS|   7 +
>>  drivers/pci/controller/dwc/Kconfig |  10 +
>>  drivers/pci/controller/dwc/Makefile|   1 +
>>  drivers/pci/controller/dwc/pci-meson.c | 593 
>> +
>>  4 files changed, 611 insertions(+)
>>  create mode 100644 drivers/pci/controller/dwc/pci-meson.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 02a3961..da579ef 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -11333,6 +11333,13 @@ L:  linux-...@vger.kernel.org
>>  S:  Maintained
>>  F:  drivers/pci/controller/dwc/*spear*
>>  
>> +PCIE DRIVER FOR AMLOGIC MESON
> 
> Entries for PCIe host bridges are in alphabetical order, this one
> isn't so you should fix it.
> 

Yes, I will fix it.

>> +M:  Yue Wang 
>> +L:  linux-...@vger.kernel.org
>> +L:  linux-amlo...@lists.infradead.org
>> +S:  Maintained
>> +F:  drivers/pci/controller/dwc/pci-meson.c
>> +
>>  PCMCIA SUBSYSTEM
>>  M:  Dominik Brodowski 
>>  T:  git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia.git
>> diff --git a/drivers/pci/controller/dwc/Kconfig 
>> b/drivers/pci/controller/dwc/Kconfig
>> index 91b0194..7800322 100644
>> --- a/drivers/pci/controller/dwc/Kconfig
>> +++ b/drivers/pci/controller/dwc/Kconfig
>> @@ -193,4 +193,14 @@ config PCIE_HISI_STB
>>  help
>>Say Y here if you want PCIe controller support on HiSilicon STB 
>> SoCs
>>  
>> +config PCI_MESON
>> +bool "MESON PCIe controller"
>> +depends on PCI_MSI_IRQ_DOMAIN
>> +select PCIE_DW_HOST
>> +help
>> +  Say Y here if you want to enable PCI controller support on Amlogic
>> +  SoCs. The PCI controller on Amlogic is based on DesignWare hardware
>> +  and therefore the driver re-uses the DesignWare core functions to
>> +  implement the driver.
>> +
>>  endmenu
>> diff --git a/drivers/pci/controller/dwc/Makefile 
>> b/drivers/pci/controller/dwc/Makefile
>> index 5d2ce72..cf676bd 100644
>> --- a/drivers/pci/controller/dwc/Makefile
>> +++ b/drivers/pci/controller/dwc/Makefile
>> @@ -14,6 +14,7 @@ obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
>>  obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
>>  obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o
>> +obj-$(CONFIG_PCI_MESON) += pci-meson.o
>>  
>>  # The following drivers are for devices that use the generic ACPI
>>  # pci_root.c driver but don't support standard ECAM config access.
>> diff --git a/drivers/pci/controller/dwc/pci-meson.c 
>> b/drivers/pci/controller/dwc/pci-meson.c
>> new file mode 100644
>> index 000..2278b48
>> --- /dev/null
>> +++ b/drivers/pci/controller/dwc/pci-meson.c
>> @@ -0,0 +1,593 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * PCIe host controller driver for Amlogic MESON SoCs
>> + *
>> + * Copyright (c) 2018 Amlogic, inc.
>> + * Author: Yue Wang 
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include "pcie-designware.h"
>> +
>> +#define to_meson_pcie(x) dev_get_drvdata((x)->dev)
>> +
>> +/* External local bus interface registers */
>> +#define PLR_OFFSET  0x700
>> +#define PCIE_PORT_LINK_CTRL_OFF (PLR_OFFSET + 0x10)
>> +#define FAST_LINK_MODE  BIT(7)
>> +#define LINK_CAPABLE_MASK   GENMASK(21, 16)
>> +#define LINK_CAPABLE_X1 BIT(16)
>> +
>> +#define PCIE_GEN2_CTRL_OFF  (PLR_OFFSET + 0x10c)
>> +#define NUM_OF_LANES_MASK   GENMASK(12, 8)
>> +#define NUM_OF_LANES_X1 BIT(8)
>> +#define DIRECT_SPEED_CHANGE BIT(17)
>> +
>> +#define TYPE1_HDR_OFFSET0x0
>> +#define PCIE_STATUS_COMMAND (TYPE1_HDR_OFFSET + 0x04)
>> +#define PCI_IO_EN   BIT(0)
>> +#define PCI_MEM_SPACE_ENBIT(1)
>> +#define PCI_BUS_MASTER_EN   BIT(2)
>> +#define PCIE_BASE_ADDR0 (TYPE1_HDR_OFFSET + 0x10)
>> +#define PCIE_BASE_ADDR1 (TYPE1_HDR_OFFSET + 0x14)
>> +
>> +#define PCIE_CAP_OFFSET 0x70
>> +#define PCIE_DEV_CTRL_DEV_STUS  (PCIE_CAP_OFFSET + 0x08)
>> +#define PCIE_CAP_MAX_PAYLOAD_MASK   GENMASK(7, 5)
>> +#define PCIE_CAP_MAX_PAYLOAD_SIZE(x)((x) << 5)
>> +#define PCIE_CAP_MAX_READ_REQ_MASK  GENMASK(14, 12)
>> +#define PCIE_CAP_MAX_READ_REQ_SIZE(x)   ((x) << 12)
>> +
>> +#define PCI_CLASS_REVISION_MASK GENMASK(7, 0)
> 
> And the reason for not using standard PCI register macros is ?
> 

These registers macros are only used in MESON AXG PCIE driver.
It's a expression of MESON AXG 

Re: [PATCH v5 2/2] PCI: amlogic: Add the Amlogic Meson PCIe controller driver

2018-11-21 Thread Hanjie Lin



On 2018/11/17 1:49, Lorenzo Pieralisi wrote:
> On Tue, Oct 09, 2018 at 09:53:10AM +0800, Hanjie Lin wrote:
>> From: Yue Wang 
>>
>> The Amlogic Meson PCIe host controller is based on the Synopsys DesignWare
>> PCI core. This patch adds the driver support for Meson PCIe controller.
>>
>> Signed-off-by: Yue Wang 
>> Signed-off-by: Hanjie Lin 
>> ---
>>  MAINTAINERS|   7 +
>>  drivers/pci/controller/dwc/Kconfig |  10 +
>>  drivers/pci/controller/dwc/Makefile|   1 +
>>  drivers/pci/controller/dwc/pci-meson.c | 593 
>> +
>>  4 files changed, 611 insertions(+)
>>  create mode 100644 drivers/pci/controller/dwc/pci-meson.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 02a3961..da579ef 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -11333,6 +11333,13 @@ L:  linux-...@vger.kernel.org
>>  S:  Maintained
>>  F:  drivers/pci/controller/dwc/*spear*
>>  
>> +PCIE DRIVER FOR AMLOGIC MESON
> 
> Entries for PCIe host bridges are in alphabetical order, this one
> isn't so you should fix it.
> 

Yes, I will fix it.

>> +M:  Yue Wang 
>> +L:  linux-...@vger.kernel.org
>> +L:  linux-amlo...@lists.infradead.org
>> +S:  Maintained
>> +F:  drivers/pci/controller/dwc/pci-meson.c
>> +
>>  PCMCIA SUBSYSTEM
>>  M:  Dominik Brodowski 
>>  T:  git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia.git
>> diff --git a/drivers/pci/controller/dwc/Kconfig 
>> b/drivers/pci/controller/dwc/Kconfig
>> index 91b0194..7800322 100644
>> --- a/drivers/pci/controller/dwc/Kconfig
>> +++ b/drivers/pci/controller/dwc/Kconfig
>> @@ -193,4 +193,14 @@ config PCIE_HISI_STB
>>  help
>>Say Y here if you want PCIe controller support on HiSilicon STB 
>> SoCs
>>  
>> +config PCI_MESON
>> +bool "MESON PCIe controller"
>> +depends on PCI_MSI_IRQ_DOMAIN
>> +select PCIE_DW_HOST
>> +help
>> +  Say Y here if you want to enable PCI controller support on Amlogic
>> +  SoCs. The PCI controller on Amlogic is based on DesignWare hardware
>> +  and therefore the driver re-uses the DesignWare core functions to
>> +  implement the driver.
>> +
>>  endmenu
>> diff --git a/drivers/pci/controller/dwc/Makefile 
>> b/drivers/pci/controller/dwc/Makefile
>> index 5d2ce72..cf676bd 100644
>> --- a/drivers/pci/controller/dwc/Makefile
>> +++ b/drivers/pci/controller/dwc/Makefile
>> @@ -14,6 +14,7 @@ obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
>>  obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
>>  obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o
>> +obj-$(CONFIG_PCI_MESON) += pci-meson.o
>>  
>>  # The following drivers are for devices that use the generic ACPI
>>  # pci_root.c driver but don't support standard ECAM config access.
>> diff --git a/drivers/pci/controller/dwc/pci-meson.c 
>> b/drivers/pci/controller/dwc/pci-meson.c
>> new file mode 100644
>> index 000..2278b48
>> --- /dev/null
>> +++ b/drivers/pci/controller/dwc/pci-meson.c
>> @@ -0,0 +1,593 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * PCIe host controller driver for Amlogic MESON SoCs
>> + *
>> + * Copyright (c) 2018 Amlogic, inc.
>> + * Author: Yue Wang 
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include "pcie-designware.h"
>> +
>> +#define to_meson_pcie(x) dev_get_drvdata((x)->dev)
>> +
>> +/* External local bus interface registers */
>> +#define PLR_OFFSET  0x700
>> +#define PCIE_PORT_LINK_CTRL_OFF (PLR_OFFSET + 0x10)
>> +#define FAST_LINK_MODE  BIT(7)
>> +#define LINK_CAPABLE_MASK   GENMASK(21, 16)
>> +#define LINK_CAPABLE_X1 BIT(16)
>> +
>> +#define PCIE_GEN2_CTRL_OFF  (PLR_OFFSET + 0x10c)
>> +#define NUM_OF_LANES_MASK   GENMASK(12, 8)
>> +#define NUM_OF_LANES_X1 BIT(8)
>> +#define DIRECT_SPEED_CHANGE BIT(17)
>> +
>> +#define TYPE1_HDR_OFFSET0x0
>> +#define PCIE_STATUS_COMMAND (TYPE1_HDR_OFFSET + 0x04)
>> +#define PCI_IO_EN   BIT(0)
>> +#define PCI_MEM_SPACE_ENBIT(1)
>> +#define PCI_BUS_MASTER_EN   BIT(2)
>> +#define PCIE_BASE_ADDR0 (TYPE1_HDR_OFFSET + 0x10)
>> +#define PCIE_BASE_ADDR1 (TYPE1_HDR_OFFSET + 0x14)
>> +
>> +#define PCIE_CAP_OFFSET 0x70
>> +#define PCIE_DEV_CTRL_DEV_STUS  (PCIE_CAP_OFFSET + 0x08)
>> +#define PCIE_CAP_MAX_PAYLOAD_MASK   GENMASK(7, 5)
>> +#define PCIE_CAP_MAX_PAYLOAD_SIZE(x)((x) << 5)
>> +#define PCIE_CAP_MAX_READ_REQ_MASK  GENMASK(14, 12)
>> +#define PCIE_CAP_MAX_READ_REQ_SIZE(x)   ((x) << 12)
>> +
>> +#define PCI_CLASS_REVISION_MASK GENMASK(7, 0)
> 
> And the reason for not using standard PCI register macros is ?
> 

These registers macros are only used in MESON AXG PCIE driver.
It's a expression of MESON AXG 

Re: [PATCH v5 2/2] PCI: amlogic: Add the Amlogic Meson PCIe controller driver

2018-11-16 Thread Lorenzo Pieralisi
On Tue, Oct 09, 2018 at 09:53:10AM +0800, Hanjie Lin wrote:
> From: Yue Wang 
> 
> The Amlogic Meson PCIe host controller is based on the Synopsys DesignWare
> PCI core. This patch adds the driver support for Meson PCIe controller.
> 
> Signed-off-by: Yue Wang 
> Signed-off-by: Hanjie Lin 
> ---
>  MAINTAINERS|   7 +
>  drivers/pci/controller/dwc/Kconfig |  10 +
>  drivers/pci/controller/dwc/Makefile|   1 +
>  drivers/pci/controller/dwc/pci-meson.c | 593 
> +
>  4 files changed, 611 insertions(+)
>  create mode 100644 drivers/pci/controller/dwc/pci-meson.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 02a3961..da579ef 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11333,6 +11333,13 @@ L:   linux-...@vger.kernel.org
>  S:   Maintained
>  F:   drivers/pci/controller/dwc/*spear*
>  
> +PCIE DRIVER FOR AMLOGIC MESON

Entries for PCIe host bridges are in alphabetical order, this one
isn't so you should fix it.

> +M:   Yue Wang 
> +L:   linux-...@vger.kernel.org
> +L:   linux-amlo...@lists.infradead.org
> +S:   Maintained
> +F:   drivers/pci/controller/dwc/pci-meson.c
> +
>  PCMCIA SUBSYSTEM
>  M:   Dominik Brodowski 
>  T:   git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia.git
> diff --git a/drivers/pci/controller/dwc/Kconfig 
> b/drivers/pci/controller/dwc/Kconfig
> index 91b0194..7800322 100644
> --- a/drivers/pci/controller/dwc/Kconfig
> +++ b/drivers/pci/controller/dwc/Kconfig
> @@ -193,4 +193,14 @@ config PCIE_HISI_STB
>   help
>Say Y here if you want PCIe controller support on HiSilicon STB 
> SoCs
>  
> +config PCI_MESON
> + bool "MESON PCIe controller"
> + depends on PCI_MSI_IRQ_DOMAIN
> + select PCIE_DW_HOST
> + help
> +   Say Y here if you want to enable PCI controller support on Amlogic
> +   SoCs. The PCI controller on Amlogic is based on DesignWare hardware
> +   and therefore the driver re-uses the DesignWare core functions to
> +   implement the driver.
> +
>  endmenu
> diff --git a/drivers/pci/controller/dwc/Makefile 
> b/drivers/pci/controller/dwc/Makefile
> index 5d2ce72..cf676bd 100644
> --- a/drivers/pci/controller/dwc/Makefile
> +++ b/drivers/pci/controller/dwc/Makefile
> @@ -14,6 +14,7 @@ obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
>  obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
>  obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o
> +obj-$(CONFIG_PCI_MESON) += pci-meson.o
>  
>  # The following drivers are for devices that use the generic ACPI
>  # pci_root.c driver but don't support standard ECAM config access.
> diff --git a/drivers/pci/controller/dwc/pci-meson.c 
> b/drivers/pci/controller/dwc/pci-meson.c
> new file mode 100644
> index 000..2278b48
> --- /dev/null
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -0,0 +1,593 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * PCIe host controller driver for Amlogic MESON SoCs
> + *
> + * Copyright (c) 2018 Amlogic, inc.
> + * Author: Yue Wang 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "pcie-designware.h"
> +
> +#define to_meson_pcie(x) dev_get_drvdata((x)->dev)
> +
> +/* External local bus interface registers */
> +#define PLR_OFFSET   0x700
> +#define PCIE_PORT_LINK_CTRL_OFF  (PLR_OFFSET + 0x10)
> +#define FAST_LINK_MODE   BIT(7)
> +#define LINK_CAPABLE_MASKGENMASK(21, 16)
> +#define LINK_CAPABLE_X1  BIT(16)
> +
> +#define PCIE_GEN2_CTRL_OFF   (PLR_OFFSET + 0x10c)
> +#define NUM_OF_LANES_MASKGENMASK(12, 8)
> +#define NUM_OF_LANES_X1  BIT(8)
> +#define DIRECT_SPEED_CHANGE  BIT(17)
> +
> +#define TYPE1_HDR_OFFSET 0x0
> +#define PCIE_STATUS_COMMAND  (TYPE1_HDR_OFFSET + 0x04)
> +#define PCI_IO_ENBIT(0)
> +#define PCI_MEM_SPACE_EN BIT(1)
> +#define PCI_BUS_MASTER_ENBIT(2)
> +#define PCIE_BASE_ADDR0  (TYPE1_HDR_OFFSET + 0x10)
> +#define PCIE_BASE_ADDR1  (TYPE1_HDR_OFFSET + 0x14)
> +
> +#define PCIE_CAP_OFFSET  0x70
> +#define PCIE_DEV_CTRL_DEV_STUS   (PCIE_CAP_OFFSET + 0x08)
> +#define PCIE_CAP_MAX_PAYLOAD_MASKGENMASK(7, 5)
> +#define PCIE_CAP_MAX_PAYLOAD_SIZE(x) ((x) << 5)
> +#define PCIE_CAP_MAX_READ_REQ_MASK   GENMASK(14, 12)
> +#define PCIE_CAP_MAX_READ_REQ_SIZE(x)((x) << 12)
> +
> +#define PCI_CLASS_REVISION_MASK  GENMASK(7, 0)

And the reason for not using standard PCI register macros is ?

> +/* PCIe specific config registers */
> +#define PCIE_CFG00x0
> +#define APP_LTSSM_ENABLE BIT(7)
> +
> +#define PCIE_CFG_STATUS120x30
> +#define IS_SMLH_LINK_UP(x)   ((x) & (1 << 6))
> +#define IS_RDLH_LINK_UP(x)   

Re: [PATCH v5 2/2] PCI: amlogic: Add the Amlogic Meson PCIe controller driver

2018-11-16 Thread Lorenzo Pieralisi
On Tue, Oct 09, 2018 at 09:53:10AM +0800, Hanjie Lin wrote:
> From: Yue Wang 
> 
> The Amlogic Meson PCIe host controller is based on the Synopsys DesignWare
> PCI core. This patch adds the driver support for Meson PCIe controller.
> 
> Signed-off-by: Yue Wang 
> Signed-off-by: Hanjie Lin 
> ---
>  MAINTAINERS|   7 +
>  drivers/pci/controller/dwc/Kconfig |  10 +
>  drivers/pci/controller/dwc/Makefile|   1 +
>  drivers/pci/controller/dwc/pci-meson.c | 593 
> +
>  4 files changed, 611 insertions(+)
>  create mode 100644 drivers/pci/controller/dwc/pci-meson.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 02a3961..da579ef 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11333,6 +11333,13 @@ L:   linux-...@vger.kernel.org
>  S:   Maintained
>  F:   drivers/pci/controller/dwc/*spear*
>  
> +PCIE DRIVER FOR AMLOGIC MESON

Entries for PCIe host bridges are in alphabetical order, this one
isn't so you should fix it.

> +M:   Yue Wang 
> +L:   linux-...@vger.kernel.org
> +L:   linux-amlo...@lists.infradead.org
> +S:   Maintained
> +F:   drivers/pci/controller/dwc/pci-meson.c
> +
>  PCMCIA SUBSYSTEM
>  M:   Dominik Brodowski 
>  T:   git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia.git
> diff --git a/drivers/pci/controller/dwc/Kconfig 
> b/drivers/pci/controller/dwc/Kconfig
> index 91b0194..7800322 100644
> --- a/drivers/pci/controller/dwc/Kconfig
> +++ b/drivers/pci/controller/dwc/Kconfig
> @@ -193,4 +193,14 @@ config PCIE_HISI_STB
>   help
>Say Y here if you want PCIe controller support on HiSilicon STB 
> SoCs
>  
> +config PCI_MESON
> + bool "MESON PCIe controller"
> + depends on PCI_MSI_IRQ_DOMAIN
> + select PCIE_DW_HOST
> + help
> +   Say Y here if you want to enable PCI controller support on Amlogic
> +   SoCs. The PCI controller on Amlogic is based on DesignWare hardware
> +   and therefore the driver re-uses the DesignWare core functions to
> +   implement the driver.
> +
>  endmenu
> diff --git a/drivers/pci/controller/dwc/Makefile 
> b/drivers/pci/controller/dwc/Makefile
> index 5d2ce72..cf676bd 100644
> --- a/drivers/pci/controller/dwc/Makefile
> +++ b/drivers/pci/controller/dwc/Makefile
> @@ -14,6 +14,7 @@ obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
>  obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
>  obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o
> +obj-$(CONFIG_PCI_MESON) += pci-meson.o
>  
>  # The following drivers are for devices that use the generic ACPI
>  # pci_root.c driver but don't support standard ECAM config access.
> diff --git a/drivers/pci/controller/dwc/pci-meson.c 
> b/drivers/pci/controller/dwc/pci-meson.c
> new file mode 100644
> index 000..2278b48
> --- /dev/null
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -0,0 +1,593 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * PCIe host controller driver for Amlogic MESON SoCs
> + *
> + * Copyright (c) 2018 Amlogic, inc.
> + * Author: Yue Wang 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "pcie-designware.h"
> +
> +#define to_meson_pcie(x) dev_get_drvdata((x)->dev)
> +
> +/* External local bus interface registers */
> +#define PLR_OFFSET   0x700
> +#define PCIE_PORT_LINK_CTRL_OFF  (PLR_OFFSET + 0x10)
> +#define FAST_LINK_MODE   BIT(7)
> +#define LINK_CAPABLE_MASKGENMASK(21, 16)
> +#define LINK_CAPABLE_X1  BIT(16)
> +
> +#define PCIE_GEN2_CTRL_OFF   (PLR_OFFSET + 0x10c)
> +#define NUM_OF_LANES_MASKGENMASK(12, 8)
> +#define NUM_OF_LANES_X1  BIT(8)
> +#define DIRECT_SPEED_CHANGE  BIT(17)
> +
> +#define TYPE1_HDR_OFFSET 0x0
> +#define PCIE_STATUS_COMMAND  (TYPE1_HDR_OFFSET + 0x04)
> +#define PCI_IO_ENBIT(0)
> +#define PCI_MEM_SPACE_EN BIT(1)
> +#define PCI_BUS_MASTER_ENBIT(2)
> +#define PCIE_BASE_ADDR0  (TYPE1_HDR_OFFSET + 0x10)
> +#define PCIE_BASE_ADDR1  (TYPE1_HDR_OFFSET + 0x14)
> +
> +#define PCIE_CAP_OFFSET  0x70
> +#define PCIE_DEV_CTRL_DEV_STUS   (PCIE_CAP_OFFSET + 0x08)
> +#define PCIE_CAP_MAX_PAYLOAD_MASKGENMASK(7, 5)
> +#define PCIE_CAP_MAX_PAYLOAD_SIZE(x) ((x) << 5)
> +#define PCIE_CAP_MAX_READ_REQ_MASK   GENMASK(14, 12)
> +#define PCIE_CAP_MAX_READ_REQ_SIZE(x)((x) << 12)
> +
> +#define PCI_CLASS_REVISION_MASK  GENMASK(7, 0)

And the reason for not using standard PCI register macros is ?

> +/* PCIe specific config registers */
> +#define PCIE_CFG00x0
> +#define APP_LTSSM_ENABLE BIT(7)
> +
> +#define PCIE_CFG_STATUS120x30
> +#define IS_SMLH_LINK_UP(x)   ((x) & (1 << 6))
> +#define IS_RDLH_LINK_UP(x)