Skip to contentSkip to conversation

mpc83xx: Add UPMA configuration to SIMPC8313

PATCH New Ron Madrid 2 participants 5 messages Apr 28, 2010

lore
Share & tools
lore

Ron Madrid

author
#0 lore raw

PATCH 1/1 mpc83xx: Add UPMA configuration to SIMPC8313

Added UPM array table, upmconfig, and Local Bus configuration support for SIMPC8313

---
 board/sheldon/simpc8313/simpc8313.c |   34 ++++++++++++++++++++++++++++++++++
 include/configs/SIMPC8313.h         |   10 ++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)
board/sheldon/simpc8313/simpc8313.c +34 -0
index 1044de2..3bfd4db 100644
@@ -91,6 +91,40 @@ void pci_init_board(void)
 int misc_init_r(void)
 {
 	int rc = 0;
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
+	volatile fsl_lbus_t *lbus = &immap->lbus;
+	volatile u32 *mxmr = &lbus->mamr;	/* Pointer to mamr */
+
+	/* UPM Table Configuration Code */
+	static uint UPMATable[] = {
+		/* Read Single-Beat (RSS) */
+		0x0fff0c00, 0x0fffdc00, 0x0fff0c05, 0xfffffc00,
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+		/* Read Burst (RBS) */
+		0x0fff0c00, 0x0ffcdc00, 0x0ffc0c00, 0x0ffc0f0c,
+		0x0ffccf0c, 0x0ffc0f0c, 0x0ffcce0c, 0x3ffc0c05,
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+		/* Write Single-Beat (WSS) */
+		0x0ffc0c00, 0x0ffcdc00, 0x0ffc0c05, 0xfffffc00,
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+		/* Write Burst (WBS) */
+		0x0ffc0c00, 0x0fffcc0c, 0x0fff0c00, 0x0fffcc00,
+		0x0fff1c00, 0x0fffcf0c, 0x0fff0f0c, 0x0fffcf0c,
+		0x0fff0c0c, 0x0fffcc0c, 0x0fff0c05, 0xfffffc00,
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+		/* Refresh Timer (RTS) */
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00,
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01,
+		/* Exception Condition (EXS) */
+		0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01
+	};
+
+	upmconfig(UPMA, UPMATable, sizeof(UPMATable) / sizeof(UPMATable[0]));
+
+	/* Set LUPWAIT to be active low and enabled */
+	*mxmr = 0x08000000 | MxMR_GPL_x4DIS;
 
 	return rc;
 }
include/configs/SIMPC8313.h +10 -0
index 84af8df..889050f 100644
@@ -184,6 +184,16 @@
 #define CONFIG_SYS_NAND_LBLAWBAR_PRELIM	CONFIG_SYS_LBLAWBAR0_PRELIM
 #define CONFIG_SYS_NAND_LBLAWAR_PRELIM	CONFIG_SYS_LBLAWAR0_PRELIM
 
+#define CONFIG_SYS_BR1_PRELIM		( 0xFF000000	/* FPGA Base Addr */ \
+					| BR_PS_16 \
+					| BR_MS_UPMA \
+					| BR_V )
+#define CONFIG_SYS_OR1_PRELIM		( 0xFFE00000	/* length 2MB */ \
+					| OR_UPM_BCTLD)
+
+#define CONFIG_SYS_LBLAWBAR1_PRELIM	0xFF000000	/* FPGA Base Addr */
+#define CONFIG_SYS_LBLAWAR1_PRELIM	0x80000014	/* 2MB */
+
 /*
  * JFFS2 configuration
  */
Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 1/1 mpc83xx: Add UPMA configuration to SIMPC8313

board/sheldon/simpc8313/simpc8313.c void pci_init_board(void) · line 96

Quoted 3 lines · On Wed, 28 Apr 2010 10:48:44 -0700 Ron Madrid <[email protected]> wrote:
board/sheldon/simpc8313/simpc8313.c +3 -0
+	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
+	volatile fsl_lbus_t *lbus = &immap->lbus;
+	volatile u32 *mxmr = &lbus->mamr;	/* Pointer to mamr */

no volatiles...

board/sheldon/simpc8313/simpc8313.c void pci_init_board(void) · line 127

Quoted 2 lines
board/sheldon/simpc8313/simpc8313.c +2 -0
+	/* Set LUPWAIT to be active low and enabled */
+	*mxmr = 0x08000000 | MxMR_GPL_x4DIS;

...because we should now be using i/o accessors. Also, let's add a MxMR_UWPL in fsl_lbc.h please (can be in same patch).

include/configs/SIMPC8313.h line 191

Quoted 5 lines
include/configs/SIMPC8313.h +5 -0
+#define CONFIG_SYS_BR1_PRELIM		( 0xFF000000	/* FPGA Base Addr */ \
+					| BR_PS_16 \
+					| BR_MS_UPMA \
+					| BR_V )
+#define CONFIG_SYS_OR1_PRELIM		( 0xFFE00000	/* length 2MB */ \

OR_AM_2MB (and therefore drop the comment).

include/configs/SIMPC8313.h line 194

Quoted 3 lines
include/configs/SIMPC8313.h +3 -0
+					| OR_UPM_BCTLD)
+
+#define CONFIG_SYS_LBLAWBAR1_PRELIM	0xFF000000	/* FPGA Base Addr */

if FPGA base address becomes a recurring reference, best to name it something like CONFIG_SYS_FPGA_BASE.

Quoted 1 line

+#define CONFIG_SYS_LBLAWAR1_PRELIM 0x80000014 /* 2MB */

(LBLAWAR_EN | LBLAWAR_2MB)

Kim

author
#2 lore raw

PATCH 1/1 mpc83xx: Add UPMA configuration to SIMPC8313

Quoted 6 lines
Quoted 1 line

+ /* Set LUPWAIT to be active low

and enabled */

Quoted 1 line

+ *mxmr = 0x08000000 |

MxMR_GPL_x4DIS;

...because we should now be using i/o accessors.

Not entirely sure what you mean here. Should I be using __raw_writel, or writel, or ...?

Thanks.

Ron

#3 lore raw

PATCH 1/1 mpc83xx: Add UPMA configuration to SIMPC8313

Quoted 9 lines · On Wed, 28 Apr 2010 15:18:36 -0700 Ron Madrid <[email protected]> wrote:
Quoted 6 lines
Quoted 1 line

+ /* Set LUPWAIT to be active low

and enabled */

Quoted 1 line

+ *mxmr = 0x08000000 |

MxMR_GPL_x4DIS;

...because we should now be using i/o accessors.

Not entirely sure what you mean here. Should I be using __raw_writel, or writel, or ...?

out_be32 (or even setbits_be32) looks appropriate here. The raw accessors can be used as an alternative when performance and/or code density issues arise.

Kim

author
#4 lore raw

PATCH 1/1 mpc83xx: Add UPMA configuration to SIMPC8313

Quoted 5 lines

out_be32 (or even setbits_be32) looks appropriate here. The raw
accessors can be used as an alternative when performance and/or code
density issues arise.

Thanks for the clarification!

Ron