<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style>.EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; }</style>
</head>
<body>
<font face="Arial Unicode MS, sans-serif" size="2">
<div>Add support for UPM configuration on the 85xx platform.</div>
<div>In addition, on the MPC83xx, remove MPC834x precompiler condition, in order to support all MPC83xx processors.</div>
<div><font face="Times New Roman, serif" size="3"> </font></div>
<div>Signed-off-by: David Saada <david.saada@ecitele.com></div>
<div><font face="Times New Roman, serif" size="3"> </font></div>
<div>cpu/mpc83xx/cpu.c | 5 ----</div>
<div>cpu/mpc85xx/cpu.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++</div>
<div>include/mpc85xx.h | 7 ++++-</div>
<div>3 files changed, 72 insertions(+), 6 deletions(-)</div>
<div><font face="Times New Roman, serif" size="3"> </font></div>
<div>--- a/cpu/mpc83xx/cpu.c 2008-05-15 01:42:46.000000000 +0300</div>
<div>+++ b/cpu/mpc83xx/cpu.c 2008-05-18 11:22:34.503036000 +0300</div>
<div>@@ -147,7 +147,6 @@ int checkcpu(void)</div>
<div> */</div>
<div> void upmconfig (uint upm, uint *table, uint size)</div>
<div> {</div>
<div>-#if defined(CONFIG_MPC834X)</div>
<div> volatile immap_t *immap = (immap_t *) CFG_IMMR;</div>
<div> volatile lbus83xx_t *lbus = &immap->lbus;</div>
<div> volatile uchar *dummy = NULL;</div>
<div>@@ -180,10 +179,6 @@ void upmconfig (uint upm, uint *table, u</div>
<div> </div>
<div> /* Set the OP field in the MxMR to "normal" and the MAD field to 000000 */</div>
<div> *mxmr &= 0xCFFFFFC0;</div>
<div>-#else</div>
<div>- printf("Error: %s() not defined for this configuration.\n", __FUNCTION__);</div>
<div>- hang();</div>
<div>-#endif</div>
<div> }</div>
<div> </div>
<div> </div>
<div>--- a/cpu/mpc85xx/cpu.c 2008-05-15 01:42:46.000000000 +0300</div>
<div>+++ b/cpu/mpc85xx/cpu.c 2008-05-18 11:22:34.528046000 +0300</div>
<div>@@ -29,6 +29,7 @@</div>
<div> #include <watchdog.h></div>
<div> #include <command.h></div>
<div> #include <asm/cache.h></div>
<div>+#include "asm/immap_85xx.h"</div>
<div> </div>
<div> DECLARE_GLOBAL_DATA_PTR;</div>
<div> </div>
<div>@@ -274,3 +275,68 @@ int dma_xfer(void *dest, uint count, voi</div>
<div> return dma_check();</div>
<div> }</div>
<div> #endif</div>
<div>+</div>
<div>+/*</div>
<div>+ * Program a UPM with the code supplied in the table.</div>
<div>+ *</div>
<div>+ * The 'dummy' variable is used to increment the MAD. 'dummy' is</div>
<div>+ * supposed to be a pointer to the memory of the device being</div>
<div>+ * programmed by the UPM. The data in the MDR is written into</div>
<div>+ * memory and the MAD is incremented every time there's a read</div>
<div>+ * from 'dummy'. Unfortunately, the current prototype for this</div>
<div>+ * function doesn't allow for passing the address of this</div>
<div>+ * device, and changing the prototype will break a number lots</div>
<div>+ * of other code, so we need to use a round-about way of finding</div>
<div>+ * the value for 'dummy'.</div>
<div>+ *</div>
<div>+ * The value can be extracted from the base address bits of the</div>
<div>+ * Base Register (BR) associated with the specific UPM. To find</div>
<div>+ * that BR, we need to scan all BRs until we find the one that</div>
<div>+ * has its MSEL bits matching the UPM we want. Once we know the</div>
<div>+ * right BR, we can extract the base address bits from it.</div>
<div>+ *</div>
<div>+ * The MxMR and the BR and OR of the chosen bank should all be</div>
<div>+ * configured before calling this function.</div>
<div>+ *</div>
<div>+ * Parameters:</div>
<div>+ * upm: 0=UPMA, 1=UPMB, 2=UPMC</div>
<div>+ * table: Pointer to an array of values to program</div>
<div>+ * size: Number of elements in the array. Must be 64 or less.</div>
<div>+ */</div>
<div>+void upmconfig (uint upm, uint *table, uint size)</div>
<div>+{</div>
<div>+ volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);</div>
<div>+ volatile uchar *dummy = NULL;</div>
<div>+ const u32 msel = (upm + 4) << BRx_MS_SHIFT; /* What the MSEL field in BRn should be */</div>
<div>+ volatile uint *mxmr = &lbc->mamr + upm; /* Pointer to mamr, mbmr, or mcmr */</div>
<div>+ volatile uint *brx = &lbc->br0; /* Pointer to BRx */</div>
<div>+ uint i;</div>
<div>+</div>
<div>+ /* Scan all the banks to determine the base address of the device */</div>
<div>+ for (i = 0; i < 8; i++) {</div>
<div>+ if ((*brx & BRx_MS_MSK) == msel) {</div>
<div>+ dummy = (uchar *) (*brx & BRx_BA_MSK);</div>
<div>+ break;</div>
<div>+ }</div>
<div>+ brx += 2; /* Skip to next BRx */</div>
<div>+ }</div>
<div>+</div>
<div>+ if (!dummy) {</div>
<div>+ printf("Error: %s() could not find matching BR\n", __FUNCTION__);</div>
<div>+ hang();</div>
<div>+ }</div>
<div>+</div>
<div>+ /* Set the OP field in the MxMR to "write" and the MAD field to 000000 */</div>
<div>+ *mxmr = (*mxmr & 0xCFFFFFC0) | MxMR_OP_WARR;</div>
<div>+</div>
<div>+ for (i = 0; i < size; i++) {</div>
<div>+ lbc->mdr = table[i];</div>
<div>+ __asm__ __volatile__ ("sync");</div>
<div>+ *dummy; /* Write the value to memory and increment MAD */</div>
<div>+ __asm__ __volatile__ ("sync");</div>
<div>+ }</div>
<div>+</div>
<div>+ /* Set the OP field in the MxMR to "normal" and the MAD field to 000000 */</div>
<div>+ *mxmr &= 0xCFFFFFC0;</div>
<div>+}</div>
<div>+</div>
<div>--- a/include/mpc85xx.h 2008-05-15 01:42:46.000000000 +0300</div>
<div>+++ b/include/mpc85xx.h 2008-05-18 11:22:34.519035000 +0300</div>
<div>@@ -35,7 +35,10 @@</div>
<div> #define BRx_MS_UPMA 0x00000080 /* U.P.M.A Machine Select */</div>
<div> #define BRx_MS_UPMB 0x000000a0 /* U.P.M.B Machine Select */</div>
<div> #define BRx_MS_UPMC 0x000000c0 /* U.P.M.C Machine Select */</div>
<div>+#define BRx_MS_MSK 0x000000e0 /* Machine select mask */</div>
<div>+#define BRx_MS_SHIFT 5 /* Machine select shift */</div>
<div> #define BRx_PS_8 0x00000800 /* 8 bit port size */</div>
<div>+#define BRx_PS_16 0x00001000 /* 16 bit port size */</div>
<div> #define BRx_PS_32 0x00001800 /* 32 bit port size */</div>
<div> #define BRx_BA_MSK 0xffff8000 /* Base Address Mask */</div>
<div> </div>
<div>@@ -53,8 +56,10 @@</div>
<div> #define ORxU_AM_MSK 0xffff8000 /* Address Mask Mask */</div>
<div> </div>
<div> #define MxMR_OP_NORM 0x00000000 /* Normal Operation */</div>
<div>-#define MxMR_DSx_2_CYCL 0x00400000 /* 2 cycle Disable Period */</div>
<div> #define MxMR_OP_WARR 0x10000000 /* Write to Array */</div>
<div>+#define MxMR_DSx_2_CYCL 0x00400000 /* 2 cycle Disable Period */</div>
<div>+#define MxMR_DSx_3_CYCL 0x00800000 /* 3 cycle Disable Period */</div>
<div>+#define MxMR_GPL4_LPWT 0x00040000 /* LGPL4 Line in LUPWAIT mode */</div>
<div> #define MxMR_BSEL 0x80000000 /* Bus Select */</div>
<div> </div>
<div> /* helpers to convert values into an OR address mask (GPCM mode) */</div>
<div><font face="Times New Roman, serif" size="3"> </font></div>
</font>
</body>
</html>