Skip to contentSkip to conversation

mpc83xx: Add PCI-E support for MPC837XEMDS boards

PATCH New Anton Vorontsov 3 participants 4 messages Jan 8, 2009 – Jan 22, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 mpc83xx: Add PCI-E support for MPC837XEMDS boards

MPC837XEMDS boards can support PCI-E via "PCI-E riser card". The card provides two PCI-E (x2) ports. Though, only one port can be used in x2 mode. Two ports can function simultaneously in x1 mode.

PCI-E x1/x2 modes can be switched via "pex_x2" environment variable.

---
 board/freescale/mpc837xemds/mpc837xemds.c |    6 +-
 board/freescale/mpc837xemds/pci.c         |   89 ++++++++++++++++++++++++++++-
 board/freescale/mpc837xemds/pci.h         |    6 ++
 include/configs/MPC837XEMDS.h             |   21 +++++++
 4 files changed, 117 insertions(+), 5 deletions(-)
 create mode 100644 board/freescale/mpc837xemds/pci.h
board/freescale/mpc837xemds/mpc837xemds.c +2 -4
index acf8ada..156d808 100644
@@ -18,6 +18,7 @@
 #include <tsec.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include "pci.h"
 #include "../common/pq-mds-pib.h"
 
 int board_early_init_f(void)
@@ -38,14 +39,10 @@ int board_early_init_f(void)
 	case SPR_8377:
 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
 				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
-		fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_PEX,
-				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
 		break;
 	case SPR_8378:
 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SGMII,
 				 FSL_SERDES_CLK_125, FSL_SERDES_VDD_1V);
-		fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_PEX,
-				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
 		break;
 	case SPR_8379:
 		fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
@@ -316,6 +313,7 @@ void ft_board_setup(void *blob, bd_t *bd)
 	ft_pci_setup(blob, bd);
 	if (board_pci_host_broken())
 		ft_pci_fixup(blob, bd);
+	ft_pcie_fixup(blob, bd);
 #endif
 }
 #endif /* CONFIG_OF_BOARD_SETUP */
board/freescale/mpc837xemds/pci.c +88 -1

115 lines not on this page · raw message

board/freescale/mpc837xemds/pci.h new file +6 -0
new file mode 100644
index 0000000..fd7a916
@@ -0,0 +1,6 @@
+#ifndef __BOARD_MPC837XEMDS_PCI_H
+#define __BOARD_MPC837XEMDS_PCI_H
+
+extern void ft_pcie_fixup(void *blob, bd_t *bd);
+
+#endif /* __BOARD_MPC837XEMDS_PCI_H */
include/configs/MPC837XEMDS.h +21 -0
index d49155f..28d442b 100644
@@ -354,11 +354,32 @@
 #define CONFIG_SYS_PCI_SLV_MEM_BUS	0x00000000
 #define CONFIG_SYS_PCI_SLV_MEM_SIZE	0x80000000
 
+#define CONFIG_SYS_PCIE1_BASE		0xA0000000
+#define CONFIG_SYS_PCIE1_CFG_BASE	0xA0000000
+#define CONFIG_SYS_PCIE1_CFG_SIZE	0x08000000
+#define CONFIG_SYS_PCIE1_MEM_BASE	0xA8000000
+#define CONFIG_SYS_PCIE1_MEM_PHYS	0xA8000000
+#define CONFIG_SYS_PCIE1_MEM_SIZE	0x10000000
+#define CONFIG_SYS_PCIE1_IO_BASE	0x00000000
+#define CONFIG_SYS_PCIE1_IO_PHYS	0xB8000000
+#define CONFIG_SYS_PCIE1_IO_SIZE	0x00800000
+
+#define CONFIG_SYS_PCIE2_BASE		0xC0000000
+#define CONFIG_SYS_PCIE2_CFG_BASE	0xC0000000
+#define CONFIG_SYS_PCIE2_CFG_SIZE	0x08000000
+#define CONFIG_SYS_PCIE2_MEM_BASE	0xC8000000
+#define CONFIG_SYS_PCIE2_MEM_PHYS	0xC8000000
+#define CONFIG_SYS_PCIE2_MEM_SIZE	0x10000000
+#define CONFIG_SYS_PCIE2_IO_BASE	0x00000000
+#define CONFIG_SYS_PCIE2_IO_PHYS	0xD8000000
+#define CONFIG_SYS_PCIE2_IO_SIZE	0x00800000
+
 #ifdef CONFIG_PCI
 #ifndef __ASSEMBLY__
 extern int board_pci_host_broken(void);
 #endif
 #define CONFIG_83XX_GENERIC_PCI	1 /* Use generic PCI setup */
+#define CONFIG_83XX_GENERIC_PCIE	1
 #define CONFIG_PQ_MDS_PIB	1 /* PQ MDS Platform IO Board */
 
 #define CONFIG_HAS_FSL_DR_USB	1 /* fixup device tree for the DR USB */
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 3/3 mpc83xx: Add PCI-E support for MPC837XEMDS boards

Quoted 20 lines
board/freescale/mpc837xemds/pci.c +15 -0
+	/* Deassert the resets in the control register */
+	out_be32(&sysconf->pecr1, 0xE0008000);
+	if (!pex2)
+		out_be32(&sysconf->pecr2, 0xE0008000);
+	udelay(2000);
+
+	/* Configure PCI Express Local Access Windows */
+	out_be32(&pcie_law[0].bar, CONFIG_SYS_PCIE1_BASE & LAWBAR_BAR);
+	out_be32(&pcie_law[0].ar, LBLAWAR_EN | LBLAWAR_512MB);
+
+	out_be32(&pcie_law[1].bar, CONFIG_SYS_PCIE2_BASE & LAWBAR_BAR);
+	out_be32(&pcie_law[1].ar, LBLAWAR_EN | LBLAWAR_512MB);
+
+	if (pex2)
+		fsl_setup_serdes(CONFIG_FSL_SERDES2, 

FSL_SERDES_PROTO_PEX_X2,

board/freescale/mpc837xemds/pci.c +3 -0
+				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
+	else
+		fsl_setup_serdes(CONFIG_FSL_SERDES2, 

FSL_SERDES_PROTO_PEX,

Review

Quoted 2 lines
(quoted diff) +2 -0
+				 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
+

Umm, The serdes initialization should be finished before negated the reset signal
according to the UM.
So, it is safe to move the serdes initialization before the out_be32(pecr1/2);

include/configs/MPC837XEMDS.h line 359

Quoted 3 lines
include/configs/MPC837XEMDS.h +3 -0
+#define CONFIG_SYS_PCIE1_BASE		0xA0000000
+#define CONFIG_SYS_PCIE1_CFG_BASE	0xA0000000
+#define CONFIG_SYS_PCIE1_CFG_SIZE	0x08000000

Why did you keep the cfg window as 128MB?
Did you consider the compitable with FSL BSP?

include/configs/MPC837XEMDS.h line 369

Quoted 10 lines
include/configs/MPC837XEMDS.h +10 -0
+#define CONFIG_SYS_PCIE1_MEM_BASE	0xA8000000
+#define CONFIG_SYS_PCIE1_MEM_PHYS	0xA8000000
+#define CONFIG_SYS_PCIE1_MEM_SIZE	0x10000000
+#define CONFIG_SYS_PCIE1_IO_BASE	0x00000000
+#define CONFIG_SYS_PCIE1_IO_PHYS	0xB8000000
+#define CONFIG_SYS_PCIE1_IO_SIZE	0x00800000
+
+#define CONFIG_SYS_PCIE2_BASE		0xC0000000
+#define CONFIG_SYS_PCIE2_CFG_BASE	0xC0000000
+#define CONFIG_SYS_PCIE2_CFG_SIZE	0x08000000

same

#2 lore raw

PATCH 3/3 mpc83xx: Add PCI-E support for MPC837XEMDS boards

In reply to Anton Vorontsov
Quoted 8 lines · On Thu, 8 Jan 2009 04:26:19 +0300 Anton Vorontsov <[email protected]>…

MPC837XEMDS boards can support PCI-E via "PCI-E riser card". The card provides two PCI-E (x2) ports. Though, only one port can be used in x2 mode. Two ports can function simultaneously in x1 mode.

PCI-E x1/x2 modes can be switched via "pex_x2" environment variable.

---

applied to u-boot-mpc83xx next.

can you please work together to resolve any issues Dave brought up with this one, and send supplemental patches to u-boot-mpc83xx next? I don't particularly care about BSP compatibility (esp. since you indicated it wasn't worth the effort), but the serdes initialization vs. pecr1 deassertion might need further attention.

Thanks all,

Kim

#3 lore raw

PATCH 3/3 mpc83xx: Add PCI-E support for MPC837XEMDS boards

Quoted 7 lines · Kim Phillips
Quoted 4 lines · On Thu, 8 Jan 2009 04:26:19 +0300 Anton Vorontsov <[email protected]>…

MPC837XEMDS boards can support PCI-E via "PCI-E riser card". The card provides two PCI-E (x2) ports. Though, only one port can be used in x2 mode. Two ports can function simultaneously in x1 mode.

Quoted 6 lines
Quoted 4 lines

PCI-E x1/x2 modes can be switched via "pex_x2" environment variable.

---

applied to u-boot-mpc83xx next.

Thanks Kim.

Quoted 5 lines

can you please work together to resolve any issues Dave brought up with this one, and send supplemental patches to u-boot-mpc83xx next? I don't particularly care about BSP compatibility (esp. since you indicated it wasn't worth the effort), but the serdes initialization vs. pecr1 deassertion might need further attention.

Sure, I didn't forget about the comments. Just got assigned to other tasks... I'll return to the PCI-E work soon, and will address all the issues.

Thank you all for reviews and comments.

Signature · 3 lines
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2