[rtems commit] bsp/mpc55xx: Add optional EBI configuration
Sebastian Huber
sebh at rtems.org
Mon Dec 3 12:14:54 UTC 2012
Module: rtems
Branch: master
Commit: e1e248f6af9bbc891285a070f78d90a3369fc396
Changeset: http://git.rtems.org/rtems/commit/?id=e1e248f6af9bbc891285a070f78d90a3369fc396
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Nov 26 17:02:44 2012 +0100
bsp/mpc55xx: Add optional EBI configuration
---
c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am | 1 +
.../powerpc/mpc55xxevb/include/mpc55xx-config.h | 15 ++++-
.../powerpc/mpc55xxevb/startup/start-config-ebi.c | 61 ++++++++++++++++++++
.../powerpc/mpc55xxevb/startup/start-early.c | 49 +++++-----------
4 files changed, 90 insertions(+), 36 deletions(-)
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
index 1987e0c..a03a99b 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
@@ -78,6 +78,7 @@ libbsp_a_SOURCES += startup/reset.c
libbsp_a_SOURCES += startup/restart.c
libbsp_a_SOURCES += startup/idle-thread.c
libbsp_a_SOURCES += startup/start-config-clock.c
+libbsp_a_SOURCES += startup/start-config-ebi.c
libbsp_a_SOURCES += startup/start-config-ebi-cs.c
libbsp_a_SOURCES += startup/start-config-ebi-cs-cal.c
libbsp_a_SOURCES += startup/start-config-mmu.c
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h
index e95997a..9db918a 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h
@@ -93,8 +93,19 @@ extern BSP_START_DATA_SECTION const mpc55xx_clock_config
mpc55xx_start_config_clock [];
#ifdef MPC55XX_HAS_EBI
- extern BSP_START_DATA_SECTION const struct
- EBI_CS_tag mpc55xx_start_config_ebi_cs [];
+ typedef struct {
+ union EBI_MCR_tag ebi_mcr;
+ uint32_t siu_eccr_ebdf;
+ } mpc55xx_ebi_config;
+
+ extern BSP_START_DATA_SECTION const mpc55xx_ebi_config
+ mpc55xx_start_config_ebi [];
+
+ extern BSP_START_DATA_SECTION const size_t
+ mpc55xx_start_config_ebi_count [];
+
+ extern BSP_START_DATA_SECTION const struct EBI_CS_tag
+ mpc55xx_start_config_ebi_cs [];
extern BSP_START_DATA_SECTION const size_t
mpc55xx_start_config_ebi_cs_count [];
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi.c
new file mode 100644
index 0000000..d2b2182
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi.c
@@ -0,0 +1,61 @@
+/**
+ * @file
+ *
+ * @ingroup mpc55xx
+ *
+ * @brief EBI configuration.
+ */
+
+/*
+ * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <bsp/mpc55xx-config.h>
+
+#ifdef MPC55XX_HAS_EBI
+
+const mpc55xx_ebi_config mpc55xx_start_config_ebi [] = {
+ #if defined(MPC55XX_BOARD_GWLCFM)
+ {
+ .ebi_mcr = {
+ .B = {
+ .DBM = 1,
+ .AD_MUX = 1, /* use multiplexed bus */
+ .D16_31 = 1 /* use lower AD bus */
+ }
+ },
+ .siu_eccr_ebdf = 4 - 1 /* use CLK/4 as bus clock */
+ }
+ #elif (defined(MPC55XX_BOARD_MPC5674FEVB) \
+ || defined(MPC55XX_BOARD_MPC5674F_ECU508)) \
+ && defined(MPC55XX_NEEDS_LOW_LEVEL_INIT)
+ {
+ .ebi_mcr = {
+ .B = {
+ .ACGE = 0,
+ .MDIS = 0,
+ .D16_31 = 1,
+ .AD_MUX = 0,
+ .DBM = 0
+ }
+ },
+ .siu_eccr_ebdf = 2 - 1
+ }
+ #endif
+};
+
+const size_t mpc55xx_start_config_ebi_count [] = {
+ RTEMS_ARRAY_SIZE(mpc55xx_start_config_ebi)
+};
+
+#endif /* MPC55XX_HAS_EBI */
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c
index c1b4a80..e756e4c 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c
@@ -145,47 +145,28 @@ static BSP_START_TEXT_SECTION void mpc55xx_start_siu(void)
static BSP_START_TEXT_SECTION void mpc55xx_start_ebi_chip_select(void)
{
- #ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT
- #ifdef MPC55XX_HAS_EBI
- size_t i = 0;
+ #ifdef MPC55XX_HAS_EBI
+ size_t i = 0;
- for (i = 0; i < mpc55xx_start_config_ebi_cs_count [0]; ++i) {
- EBI.CS [i] = mpc55xx_start_config_ebi_cs [i];
- }
+ for (i = 0; i < mpc55xx_start_config_ebi_cs_count [0]; ++i) {
+ EBI.CS [i] = mpc55xx_start_config_ebi_cs [i];
+ }
- for (i = 0; i < mpc55xx_start_config_ebi_cal_cs_count [0]; ++i) {
- EBI.CAL_CS [i] = mpc55xx_start_config_ebi_cal_cs [i];
- }
- #endif
+ for (i = 0; i < mpc55xx_start_config_ebi_cal_cs_count [0]; ++i) {
+ EBI.CAL_CS [i] = mpc55xx_start_config_ebi_cal_cs [i];
+ }
#endif
}
static BSP_START_TEXT_SECTION void mpc55xx_start_ebi(void)
{
- #ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT
- #if defined(MPC55XX_BOARD_GWLCFM)
- /*
- * init EBI for Muxed AD bus
- */
- EBI.MCR.B.DBM = 1;
- EBI.MCR.B.AD_MUX = 1; /* use multiplexed bus */
- EBI.MCR.B.D16_31 = 1; /* use lower AD bus */
-
- SIU.ECCR.B.EBDF = 3; /* use CLK/4 as bus clock */
- #elif defined(MPC55XX_BOARD_MPC5674FEVB) \
- || defined(MPC55XX_BOARD_MPC5674F_ECU508)
- union EBI_MCR_tag mcr = {
- .B = {
- .ACGE = 0,
- .MDIS = 0,
- .D16_31 = 1,
- .AD_MUX = 0,
- .DBM = 0
- }
- };
-
- EBI.MCR.R = mcr.R;
- #endif
+ #ifdef MPC55XX_HAS_EBI
+ size_t i = 0;
+
+ for (i = 0; i < mpc55xx_start_config_ebi_count [0]; ++i) {
+ SIU.ECCR.B.EBDF = mpc55xx_start_config_ebi [i].siu_eccr_ebdf;
+ EBI.MCR.R = mpc55xx_start_config_ebi [i].ebi_mcr.R;
+ }
#endif
}
More information about the vc
mailing list