Skip to contentSkip to conversation

Add PPC405 External Bus Controller (EBC) Register Field Mnemonics

PATCH New Grant Erickson 3 participants 5 messages May 15, 2008 – Jun 12, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add PPC405 External Bus Controller (EBC) Register Field Mnemonics

Added preprocessor definitions for External Bus Controller (EBC) configuration, bank configuration and access parameter register fields along with a macro for defining them and verifying them against the data sheet or user's manual easier.

Tested against AMCC "Haleakala".

---
 include/ppc405.h |   98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 98 insertions(+), 0 deletions(-)
include/ppc405.h +98 -0
index 37b121c..009aa68 100644
@@ -22,6 +22,9 @@
 #ifndef	__PPC405_H__
 #define __PPC405_H__
 
+#define	PPC_REG_BITS		32
+#define	PPC_REG_VAL(bit, value)	((value) << ((PPC_REG_BITS - 1) - (bit)))
+
 #ifndef CONFIG_IOP480
 #define CFG_DCACHE_SIZE		(16 << 10)	/* For AMCC 405 CPUs	*/
 #else
@@ -363,6 +366,101 @@
 #endif	/* defined(CONFIG_405EZ) */
 
 /******************************************************************************
+ * External Bus Controller (EBC)
+ *****************************************************************************/
+
+/* Bank Configuration Register */
+#define	EBC_BXCR_BAS_MASK	PPC_REG_VAL(11, 0xFFF)
+#define EBC_BXCR_BAS_ENCODE(n)	((((unsigned long)(n))&EBC_BXCR_BAS_MASK)<<0)
+#define EBC_BXCR_BS_MASK	PPC_REG_VAL(14, 0x7)
+#define EBC_BXCR_BS_1MB		PPC_REG_VAL(14, 0x0)
+#define EBC_BXCR_BS_2MB		PPC_REG_VAL(14, 0x1)
+#define EBC_BXCR_BS_4MB		PPC_REG_VAL(14, 0x2)
+#define EBC_BXCR_BS_8MB		PPC_REG_VAL(14, 0x3)
+#define EBC_BXCR_BS_16MB	PPC_REG_VAL(14, 0x4)
+#define EBC_BXCR_BS_32MB	PPC_REG_VAL(14, 0x5)
+#define EBC_BXCR_BS_64MB	PPC_REG_VAL(14, 0x6)
+#define EBC_BXCR_BS_128MB	PPC_REG_VAL(14, 0x7)
+#define EBC_BXCR_BU_MASK	PPC_REG_VAL(16, 0x3)
+#define	EBC_BXCR_BU_NONE	PPC_REG_VAL(16, 0x0)
+#define EBC_BXCR_BU_R		PPC_REG_VAL(16, 0x1)
+#define EBC_BXCR_BU_W		PPC_REG_VAL(16, 0x2)
+#define EBC_BXCR_BU_RW		PPC_REG_VAL(16, 0x3)
+#define EBC_BXCR_BW_MASK	PPC_REG_VAL(18, 0x3)
+#define EBC_BXCR_BW_8BIT	PPC_REG_VAL(18, 0x0)
+#define EBC_BXCR_BW_16BIT	PPC_REG_VAL(18, 0x1)
+#define EBC_BXCR_BW_32BIT	PPC_REG_VAL(18, 0x3)
+
+/* Bank Access Parameter Register */
+#define EBC_BXAP_BME_ENABLED	PPC_REG_VAL(0, 0x1)
+#define EBC_BXAP_BME_DISABLED	PPC_REG_VAL(0, 0x0)
+#define EBC_BXAP_TWT_ENCODE(n)	PPC_REG_VAL(8, ((unsigned long)(n)) & 0xFF)
+#define	EBC_BXAP_FWT_ENCODE(n)	PPC_REG_VAL(5, ((unsigned long)(n)) & 0x1F)
+#define	EBC_BXAP_BWT_ENCODE(n)	PPC_REG_VAL(8, ((unsigned long)(n)) & 0x7)
+#define EBC_BXAP_BCE_DISABLE	PPC_REG_VAL(9, 0x0)
+#define EBC_BXAP_BCE_ENABLE	PPC_REG_VAL(9, 0x1)
+#define EBC_BXAP_BCT_MASK	PPC_REG_VAL(11, 0x3)
+#define EBC_BXAP_BCT_2TRANS	PPC_REG_VAL(11, 0x0)
+#define EBC_BXAP_BCT_4TRANS	PPC_REG_VAL(11, 0x1)
+#define EBC_BXAP_BCT_8TRANS	PPC_REG_VAL(11, 0x2)
+#define EBC_BXAP_BCT_16TRANS	PPC_REG_VAL(11, 0x3)
+#define EBC_BXAP_CSN_ENCODE(n)	PPC_REG_VAL(13, ((unsigned long)(n)) & 0x3)
+#define EBC_BXAP_OEN_ENCODE(n)	PPC_REG_VAL(15, ((unsigned long)(n)) & 0x3)
+#define EBC_BXAP_WBN_ENCODE(n)	PPC_REG_VAL(17, ((unsigned long)(n)) & 0x3)
+#define EBC_BXAP_WBF_ENCODE(n)	PPC_REG_VAL(19, ((unsigned long)(n)) & 0x3)
+#define EBC_BXAP_TH_ENCODE(n)	PPC_REG_VAL(22, ((unsigned long)(n)) & 0x7)
+#define EBC_BXAP_RE_ENABLED	PPC_REG_VAL(23, 0x1)
+#define EBC_BXAP_RE_DISABLED	PPC_REG_VAL(23, 0x0)
+#define EBC_BXAP_SOR_DELAYED	PPC_REG_VAL(24, 0x0)
+#define EBC_BXAP_SOR_NONDELAYED	PPC_REG_VAL(24, 0x1)
+#define EBC_BXAP_BEM_WRITEONLY	PPC_REG_VAL(25, 0x0)
+#define EBC_BXAP_BEM_RW		PPC_REG_VAL(25, 0x1)
+#define EBC_BXAP_PEN_DISABLED	PPC_REG_VAL(26, 0x0)
+#define EBC_BXAP_PEN_ENABLED	PPC_REG_VAL(26, 0x1)
+
+/* Configuration Register */
+#define EBC_CFG_LE_MASK		PPC_REG_VAL(0, 0x1)
+#define EBC_CFG_LE_UNLOCK	PPC_REG_VAL(0, 0x0)
+#define EBC_CFG_LE_LOCK		PPC_REG_VAL(0, 0x1)
+#define EBC_CFG_PTD_MASK	PPC_REG_VAL(1, 0x1)
+#define EBC_CFG_PTD_ENABLE	PPC_REG_VAL(1, 0x0)
+#define EBC_CFG_PTD_DISABLE	PPC_REG_VAL(1, 0x1)
+#define EBC_CFG_RTC_MASK	PPC_REG_VAL(4, 0x7)
+#define EBC_CFG_RTC_16PERCLK	PPC_REG_VAL(4, 0x0)
+#define EBC_CFG_RTC_32PERCLK	PPC_REG_VAL(4, 0x1)
+#define EBC_CFG_RTC_64PERCLK	PPC_REG_VAL(4, 0x2)
+#define EBC_CFG_RTC_128PERCLK	PPC_REG_VAL(4, 0x3)
+#define EBC_CFG_RTC_256PERCLK	PPC_REG_VAL(4, 0x4)
+#define EBC_CFG_RTC_512PERCLK	PPC_REG_VAL(4, 0x5)
+#define EBC_CFG_RTC_1024PERCLK	PPC_REG_VAL(4, 0x6)
+#define EBC_CFG_RTC_2048PERCLK	PPC_REG_VAL(4, 0x7)
+#define EBC_CFG_ATC_MASK	PPC_REG_VAL(5, 0x1)
+#define EBC_CFG_ATC_HI		PPC_REG_VAL(5, 0x0)
+#define EBC_CFG_ATC_PREVIOUS	PPC_REG_VAL(5, 0x1)
+#define EBC_CFG_DTC_MASK	PPC_REG_VAL(6, 0x1)
+#define EBC_CFG_DTC_HI		PPC_REG_VAL(6, 0x0)
+#define EBC_CFG_DTC_PREVIOUS	PPC_REG_VAL(6, 0x1)
+#define EBC_CFG_CTC_MASK	PPC_REG_VAL(7, 0x1)
+#define EBC_CFG_CTC_HI		PPC_REG_VAL(7, 0x0)
+#define EBC_CFG_CTC_PREVIOUS	PPC_REG_VAL(7, 0x1)
+#define EBC_CFG_OEO_MASK	PPC_REG_VAL(8, 0x1)
+#define EBC_CFG_OEO_DISABLE	PPC_REG_VAL(8, 0x0)
+#define EBC_CFG_OEO_ENABLE	PPC_REG_VAL(8, 0x1)
+#define EBC_CFG_EMC_MASK	PPC_REG_VAL(9, 0x1)
+#define EBC_CFG_EMC_NONDEFAULT	PPC_REG_VAL(9, 0x0)
+#define EBC_CFG_EMC_DEFAULT	PPC_REG_VAL(9, 0x1)
+#define EBC_CFG_PME_MASK	PPC_REG_VAL(14, 0x1)
+#define EBC_CFG_PME_DISABLE	PPC_REG_VAL(14, 0x0)
+#define EBC_CFG_PME_ENABLE	PPC_REG_VAL(14, 0x1)
+#define EBC_CFG_PMT_MASK	PPC_REG_VAL(19, 0x1F)
+#define EBC_CFG_PMT_ENCODE(n)	PPC_REG_VAL(19, ((unsigned long)(n)) & 0x1F)
+#define EBC_CFG_PR_MASK		PPC_REG_VAL(21, 0x3)
+#define EBC_CFG_PR_16		PPC_REG_VAL(21, 0x0)
+#define EBC_CFG_PR_32		PPC_REG_VAL(21, 0x1)
+#define EBC_CFG_PR_64		PPC_REG_VAL(21, 0x2)
+#define EBC_CFG_PR_128		PPC_REG_VAL(21, 0x3)
+
+/******************************************************************************
  * SDRAM Controller
  ******************************************************************************/
   /* values for memcfga register - indirect addressing of these regs */
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 Add PPC405 External Bus Controller (EBC) Register Field Mnemonics

Quoted 8 lines · In message <[email protected]> you…

Added preprocessor definitions for External Bus Controller (EBC) configuration, bank configuration and access parameter register fields along with a macro for defining them and verifying them against the data sheet or user's manual easier.

Tested against AMCC "Haleakala".

Are these definitions being used anywhere?

I tend to drop this patch because it seems to be just dead code. Stefan, do you agree?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Fascinating, a totally parochial attitude.
	-- Spock, "Metamorphosis", stardate 3219.8
#2 lore raw

PATCH 1/1 Add PPC405 External Bus Controller (EBC) Register Field Mnemonics

Quoted 13 lines · Wolfgang Denk

In message <[email protected]> you

Quoted 8 lines · wrote:

Added preprocessor definitions for External Bus Controller (EBC) configuration, bank configuration and access parameter register fields along with a macro for defining them and verifying them against the data sheet or user's manual easier.

Tested against AMCC "Haleakala".

Are these definitions being used anywhere?

Quoted 7 lines

I tend to drop this patch because it seems to be just dead code. Stefan, do you agree?

Best regards,

Wolfgang Denk

Wolfgang,

These are actually now used in cpu/ppc4xx/start.S and are probably already included in the latest 4xx pull from Stefan. So, this patch might be a no-op at this point.

Regardless, while they are not used in include/configs/kilauea.h and include/configs/makalu.h yet (but both could and should be) I have used them in the include/config/<board>.h for the new boards I am supporting for a client. They make it much easier to decode BxAP and BxCR settings than an arbitrary 32-bit hex value.

Regards,

Grant

#3 lore raw

PATCH 1/1 Add PPC405 External Bus Controller (EBC) Register Field Mnemonics

Quoted 4 lines · In message <C475A96A.FBA7%[email protected]> you wrote:

These are actually now used in cpu/ppc4xx/start.S and are probably already included in the latest 4xx pull from Stefan. So, this patch might be a no-op at this point.

A slightly different version of this seems to have benn pulled in with your "ppc4xx: Enable Primordial Stack for 40x and Unify ECC Handling" patch (c821b5f120be), but note that we have for example two different implementations of EBC_BXCR_BAS_ENCODE in include/ppc405.h and include/ppc440.h - the include/ppc405.h was changed with your c821b5f120be commit, while the include/ppc440.h code is much older (63153492 from 3 years ago).

Please check that this is as intended.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
CONSUMER NOTICE:  Because  of  the  "Uncertainty  Principle,"  It  Is
Impossible  for  the  Consumer  to  Find  Out  at  the Same Time Both
Precisely Where This Product Is and How Fast It Is Moving.
#4 lore raw

PATCH 1/1 Add PPC405 External Bus Controller (EBC) Register Field Mnemonics

Quoted 13 lines · Wolfgang Denk
Quoted 3 lines · In message <C475A96A.FBA7%[email protected]> you wrote:

These are actually now used in cpu/ppc4xx/start.S and are probably already included in the latest 4xx pull from Stefan. So, this patch might be a no-op at this point.

A slightly different version of this seems to have benn pulled in with your "ppc4xx: Enable Primordial Stack for 40x and Unify ECC Handling" patch (c821b5f120be), but note that we have for example two different implementations of EBC_BXCR_BAS_ENCODE in include/ppc405.h and include/ppc440.h - the include/ppc405.h was changed with your c821b5f120be commit, while the include/ppc440.h code is much older (63153492 from 3 years ago).

Quoted 1 line

Please check that this is as intended.

We should consolidate these defines into one version. No need to have them defined multiple times, since the EBC IP core should be nearly identical on 405 and 440 systems. Perhaps somebody else (Grant?) will find the time to do this soon. If not I'll add it to my list...

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================