[PATCH 3/3] bsps/qoriq: Add VME support for MVME2500

Christian Mauderer christian.mauderer at embedded-brains.de
Tue Jan 23 09:09:01 UTC 2024


This enables the VME support for the MVME2500. Note that the PCIe
support from libbsd is used. So you need the related libbsd patches for
this to work.

If the drivers in libbsd are not enabled, the linker should not pick up
anything from this patch.
---
 bsps/powerpc/qoriq/include/bsp/VMEConfig.h | 50 ++++++++++++++++++++++
 spec/build/bsps/powerpc/qoriq/grp.yml      |  2 +
 spec/build/bsps/powerpc/qoriq/obj.yml      |  3 +-
 3 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/bsps/powerpc/qoriq/include/bsp/VMEConfig.h b/bsps/powerpc/qoriq/include/bsp/VMEConfig.h
index 79c22d137a..4bb7c0d62f 100644
--- a/bsps/powerpc/qoriq/include/bsp/VMEConfig.h
+++ b/bsps/powerpc/qoriq/include/bsp/VMEConfig.h
@@ -7,6 +7,9 @@
  *
  * @brief This header file provides the interfaces used by VME bus device
  *   drivers.
+ *
+ * Note that for the MVME2500, you need the PCIe support from libbsd for this to
+ * work.
  */
 
 /*
@@ -43,6 +46,53 @@ extern "C" {
 
 #define _VME_DRIVER_TSI148
 
+/*
+ * Base address of the PCI that is used for the VME bridge. Value is set in
+ * libbsd during device discovery.
+ */
+extern uintptr_t bsp_vme_pcie_base_address;
+
+#define PCI_MEM_BASE 0
+#define PCI_DRAM_OFFSET 0
+
+/*
+ * NOTE: shared vmeconfig.c uses hardcoded window lengths that match this layout
+ *
+ * The memory length of the PCIe controllers on the P2020 processor is
+ * 0x20000000. The Tsi148 registers are mapped at the bsp_vme_pcie_base_address
+ * with a size of 0x1000. Therefore the VME windows are arranged a bit different
+ * then on other BSPs.
+ */
+#define _VME_A32_WIN0_ON_PCI   (bsp_vme_pcie_base_address + 0x10000000)
+#define _VME_A24_ON_PCI        (bsp_vme_pcie_base_address + 0x03000000)
+#define _VME_A16_ON_PCI        (bsp_vme_pcie_base_address + 0x02000000)
+#define _VME_CSR_ON_PCI        (bsp_vme_pcie_base_address + 0x01000000)
+
+/* FIXME: Make this a BSP config option */
+#define _VME_A32_WIN0_ON_VME 0x20000000
+
+/*
+ * FIXME: The fixed QORIQ_IRQ_EXT_0 is valid for the MVME2500 board. In theory
+ * there should be some possibility to get that information from the device tree
+ * or from PCI config space. But I didn't find it anywhere.
+ */
+#define BSP_VME_INSTALL_IRQ_MGR(err) \
+  do { \
+    err = qoriq_pic_set_sense_and_polarity(\
+      QORIQ_IRQ_EXT_0, \
+      QORIQ_EIRQ_TRIGGER_LEVEL_LOW, \
+      NULL \
+    ); \
+    if (err == 0) { \
+      err = vmeTsi148InstallIrqMgrAlt(0, 0, QORIQ_IRQ_EXT_0, -1); \
+    } \
+  } while (0)
+
+/* Add prototypes that are in all VMEConfig.h files */
+extern int BSP_VMEInit(void);
+extern int BSP_VMEIrqMgrInstall(void);
+extern unsigned short (*_BSP_clear_vmebridge_errors)(int);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/spec/build/bsps/powerpc/qoriq/grp.yml b/spec/build/bsps/powerpc/qoriq/grp.yml
index 2acb506c89..65e623fdbd 100644
--- a/spec/build/bsps/powerpc/qoriq/grp.yml
+++ b/spec/build/bsps/powerpc/qoriq/grp.yml
@@ -28,6 +28,8 @@ links:
   uid: ../obj
 - role: build-dependency
   uid: ../objexc
+- role: build-dependency
+  uid: ../objvme
 - role: build-dependency
   uid: abi
 - role: build-dependency
diff --git a/spec/build/bsps/powerpc/qoriq/obj.yml b/spec/build/bsps/powerpc/qoriq/obj.yml
index 8926cc2135..b0ab1e6ca2 100644
--- a/spec/build/bsps/powerpc/qoriq/obj.yml
+++ b/spec/build/bsps/powerpc/qoriq/obj.yml
@@ -17,6 +17,7 @@ install:
   - bsps/powerpc/qoriq/include/asm/fsl_hcalls.h
 - destination: ${BSP_INCLUDEDIR}/bsp
   source:
+  - bsps/powerpc/qoriq/include/bsp/VMEConfig.h
   - bsps/powerpc/qoriq/include/bsp/intercom.h
   - bsps/powerpc/qoriq/include/bsp/irq.h
   - bsps/powerpc/qoriq/include/bsp/mmu.h
@@ -63,8 +64,6 @@ source:
 - bsps/powerpc/shared/start/bsp-start-zero.S
 - bsps/powerpc/shared/start/bspidle.c
 - bsps/powerpc/shared/start/tictac.c
-- bsps/powerpc/shared/vme/bspVmeDmaList.c
-- bsps/powerpc/shared/vme/vmeTsi148.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
 - bsps/shared/dev/rtc/rtc-support.c
 - bsps/shared/dev/serial/console-termios-init.c
-- 
2.35.3



More information about the devel mailing list