Skip to contentSkip to conversation

arm: mvebu: turris_mox: Fix and enable PCIe devices

PATCH New Pali Rohár 3 participants 14 messages Feb 5, 2021 – Feb 26, 2021 PCI

lore
Share & tools
lore
#0 lore raw

cover arm: mvebu: turris_mox: Fix and enable PCIe devices

This patch series fix PCIe on Armada 3720 and enable PCIe devices (USB and NVMe) on Turris MOX.

Marek Beh?n (1):
arm: mvebu: turris_mox: Enable NVMe support

Pali Roh?r (3):
arm: a37xx: pci: Set Max Payload Size and Max Read Request Size to 512
bytes
arm: mvebu: turris_mox: Enable CONFIG_PCI_PNP
arm: mvebu: turris_mox: Enable CONFIG_USB_XHCI_PCI

 configs/turris_mox_defconfig | 3 ++-
 drivers/pci/pci-aardvark.c   | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 arm: a37xx: pci: Set Max Payload Size and Max Read Request Size to 512 bytes

Fix usage of VL805 XHCI PCIe controller when it is connected via PCIe to Armada 3720 SOC. Without this U-Boot crashes when trying to access enumerated USB devices connected to this XHCI PCIe controller.

This should be done according to the PCIe Link Initialization sequence, as defined in Marvell Armada 3720 Functional Specification.

Linux has this code too.

---
 drivers/pci/pci-aardvark.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/pci/pci-aardvark.c +8 -0
index 8713b88461..b4e1b60240 100644
@@ -42,6 +42,10 @@
 #define PCIE_CORE_DEV_CTRL_STATS_REG				0xc8
 #define     PCIE_CORE_DEV_CTRL_STATS_RELAX_ORDER_DISABLE	(0 << 4)
 #define     PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE		(0 << 11)
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE		0x2
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE_SHIFT	5
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE		0x2
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT	12
 #define PCIE_CORE_LINK_CTRL_STAT_REG				0xd0
 #define     PCIE_CORE_LINK_TRAINING				BIT(5)
 #define PCIE_CORE_ERR_CAPCTL_REG				0x118
@@ -534,6 +538,10 @@ static int pcie_advk_setup_hw(struct pcie_advk *pcie)
 
 	/* Set PCIe Device Control and Status 1 PF0 register */
 	reg = PCIE_CORE_DEV_CTRL_STATS_RELAX_ORDER_DISABLE |
+		(PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE <<
+		 PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE_SHIFT) |
+		(PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE <<
+		 PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT) |
 		PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE;
 	advk_writel(pcie, reg, PCIE_CORE_DEV_CTRL_STATS_REG);
 
Signature · 1 line
2.20.1
#3 lore raw

PATCH 1/4 arm: a37xx: pci: Set Max Payload Size and Max Read Request Size to 512 bytes

In reply to Pali Rohár
Quoted 10 lines · Pali Roh?r

Fix usage of VL805 XHCI PCIe controller when it is connected via PCIe to Armada 3720 SOC. Without this U-Boot crashes when trying to access enumerated USB devices connected to this XHCI PCIe controller.

This should be done according to the PCIe Link Initialization sequence, as defined in Marvell Armada 3720 Functional Specification.

Linux has this code too.

Thanks,
Stefan

Quoted 21 lines
---
  drivers/pci/pci-aardvark.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/pci/pci-aardvark.c +4 -0
index 8713b88461..b4e1b60240 100644
@@ -42,6 +42,10 @@
  #define PCIE_CORE_DEV_CTRL_STATS_REG				0xc8
  #define     PCIE_CORE_DEV_CTRL_STATS_RELAX_ORDER_DISABLE	(0 << 4)
  #define     PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE		(0 << 11)
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE		0x2
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE_SHIFT	5
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE		0x2
+#define     PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT	12
  #define PCIE_CORE_LINK_CTRL_STAT_REG				0xd0
  #define     PCIE_CORE_LINK_TRAINING				BIT(5)
  #define PCIE_CORE_ERR_CAPCTL_REG				0x118

drivers/pci/pci-aardvark.c static int pcie_advk_setup_hw(struct pcie_advk *pcie) · line 547

Quoted 10 lines
drivers/pci/pci-aardvark.c +4 -0
@@ -534,6 +538,10 @@ static int pcie_advk_setup_hw(struct pcie_advk *pcie)
 
  	/* Set PCIe Device Control and Status 1 PF0 register */
  	reg = PCIE_CORE_DEV_CTRL_STATS_RELAX_ORDER_DISABLE |
+		(PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE <<
+		 PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SIZE_SHIFT) |
+		(PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE <<
+		 PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT) |
  		PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE;
  	advk_writel(pcie, reg, PCIE_CORE_DEV_CTRL_STATS_REG);
 

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#4 lore raw

PATCH 2/4 arm: mvebu: turris_mox: Enable CONFIG_PCI_PNP

In reply to Pali Rohár

PCIe devices do not work in U-Boot without proper initialization and configuration of PCI config space like the PCI_BASE_ADDRESS_0 register.

---
 configs/turris_mox_defconfig | 1 -
 1 file changed, 1 deletion(-)
configs/turris_mox_defconfig +0 -1
index dde7437f24..329c596cea 100644
@@ -64,7 +64,6 @@ CONFIG_MVNETA=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_PCI_AARDVARK=y
-# CONFIG_PCI_PNP is not set
 CONFIG_MVEBU_COMPHY_SUPPORT=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_ARMADA_37XX=y
Signature · 1 line
2.20.1
#6 lore raw

PATCH 2/4 arm: mvebu: turris_mox: Enable CONFIG_PCI_PNP

In reply to Pali Rohár
Quoted 4 lines · Pali Roh?r

PCIe devices do not work in U-Boot without proper initialization and configuration of PCI config space like the PCI_BASE_ADDRESS_0 register.

Thanks,
Stefan

Quoted 10 lines
---
  configs/turris_mox_defconfig | 1 -
  1 file changed, 1 deletion(-)
configs/turris_mox_defconfig +0 -0
index dde7437f24..329c596cea 100644

configs/turris_mox_defconfig CONFIG_MVNETA=y · line 69

Quoted 7 lines
configs/turris_mox_defconfig +0 -1
@@ -64,7 +64,6 @@ CONFIG_MVNETA=y
  CONFIG_PCI=y
  CONFIG_DM_PCI=y
  CONFIG_PCI_AARDVARK=y
-# CONFIG_PCI_PNP is not set
  CONFIG_MVEBU_COMPHY_SUPPORT=y
  CONFIG_PINCTRL=y
  CONFIG_PINCTRL_ARMADA_37XX=y

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#7 lore raw

PATCH 3/4 arm: mvebu: turris_mox: Enable CONFIG_USB_XHCI_PCI

In reply to Pali Rohár

USB devices can be connected to Turris MOX also via MOX F extension which contains VL805 PCIe based USB 3.0 controller.

---
 configs/turris_mox_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/turris_mox_defconfig +1 -0
index 329c596cea..27a5179fe5 100644
@@ -77,6 +77,7 @@ CONFIG_MVEBU_A3700_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_PCI=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
Signature · 1 line
2.20.1
#9 lore raw

PATCH 3/4 arm: mvebu: turris_mox: Enable CONFIG_USB_XHCI_PCI

In reply to Pali Rohár
Quoted 4 lines · Pali Roh?r

USB devices can be connected to Turris MOX also via MOX F extension which contains VL805 PCIe based USB 3.0 controller.

Thanks,
Stefan

Quoted 10 lines
---
  configs/turris_mox_defconfig | 1 +
  1 file changed, 1 insertion(+)
configs/turris_mox_defconfig +0 -0
index 329c596cea..27a5179fe5 100644

configs/turris_mox_defconfig CONFIG_MVEBU_A3700_SPI=y · line 83

Quoted 7 lines
configs/turris_mox_defconfig +1 -0
@@ -77,6 +77,7 @@ CONFIG_MVEBU_A3700_SPI=y
  CONFIG_USB=y
  CONFIG_DM_USB=y
  CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_PCI=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_HOST_ETHER=y
  CONFIG_USB_ETHER_ASIX=y

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#10 lore raw

PATCH 4/4 arm: mvebu: turris_mox: Enable NVMe support

In reply to Pali Rohár

From: Marek Beh?n <[email protected]>

NVMe drives can be connected to Turris MOX via MOX B and MOX G extensions.

---
 configs/turris_mox_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/turris_mox_defconfig +1 -0
index 27a5179fe5..f938fbb475 100644
@@ -61,6 +61,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
+CONFIG_NVME=y
 CONFIG_PCI=y
 CONFIG_DM_PCI=y
 CONFIG_PCI_AARDVARK=y
Signature · 1 line
2.20.1
#12 lore raw

PATCH 4/4 arm: mvebu: turris_mox: Enable NVMe support

In reply to Pali Rohár
Quoted 6 lines · Pali Roh?r

From: Marek Beh?n <[email protected]>

NVMe drives can be connected to Turris MOX via MOX B and MOX G extensions.

Thanks,
Stefan

Quoted 10 lines
---
  configs/turris_mox_defconfig | 1 +
  1 file changed, 1 insertion(+)
configs/turris_mox_defconfig +0 -0
index 27a5179fe5..f938fbb475 100644

configs/turris_mox_defconfig CONFIG_SPI_FLASH_WINBOND=y · line 67

Quoted 7 lines
configs/turris_mox_defconfig +1 -0
@@ -61,6 +61,7 @@ CONFIG_SPI_FLASH_WINBOND=y
  CONFIG_PHY_MARVELL=y
  CONFIG_PHY_GIGE=y
  CONFIG_MVNETA=y
+CONFIG_NVME=y
  CONFIG_PCI=y
  CONFIG_DM_PCI=y
  CONFIG_PCI_AARDVARK=y

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#13 lore raw

cover arm: mvebu: turris_mox: Fix and enable PCIe devices

In reply to Pali Rohár
Quoted 12 lines · Pali Roh?r

This patch series fix PCIe on Armada 3720 and enable PCIe devices (USB and NVMe) on Turris MOX.

Marek Beh?n (1):
arm: mvebu: turris_mox: Enable NVMe support

Pali Roh?r (3):
arm: a37xx: pci: Set Max Payload Size and Max Read Request Size to 512
bytes
arm: mvebu: turris_mox: Enable CONFIG_PCI_PNP
arm: mvebu: turris_mox: Enable CONFIG_USB_XHCI_PCI

Quoted 4 lines
  configs/turris_mox_defconfig | 3 ++-
  drivers/pci/pci-aardvark.c   | 8 ++++++++
  2 files changed, 10 insertions(+), 1 deletion(-)

Applied to u-boot-marvell/master

Thanks,
Stefan