<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7235.2">
<TITLE>u-boot-1.2.0/cpu/mpc8xx/i2c.c: problem in i2c_init when defining CFG_ALLOC_DPRAM</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<P><FONT SIZE=2>Hi all,<BR>
<BR>
looking at the following code I think that dpram is not allocated if iip->iic_rbase is not null and this happen in my case with an MPC880:<BR>
<BR>
//////////////////////////////////////////////////////////////////<BR>
void i2c_init(int speed, int slaveaddr)<BR>
{<BR>
volatile immap_t *immap = (immap_t *)CFG_IMMR ;<BR>
volatile cpm8xx_t *cp = (cpm8xx_t *)&immap->im_cpm;<BR>
volatile i2c8xx_t *i2c = (i2c8xx_t *)&immap->im_i2c;<BR>
volatile iic_t *iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];<BR>
ulong rbase, tbase;<BR>
volatile I2C_BD *rxbd, *txbd;<BR>
uint dpaddr;<BR>
<BR>
#ifdef CFG_I2C_INIT_BOARD<BR>
/* call board specific i2c bus reset routine before accessing the */<BR>
/* environment, which might be in a chip on that bus. For details */<BR>
/* about this problem see doc/I2C_Edge_Conditions. */<BR>
i2c_init_board();<BR>
#endif<BR>
<BR>
#ifdef CFG_I2C_UCODE_PATCH<BR>
iip = (iic_t *)&cp->cp_dpmem[iip->iic_rpbase];<BR>
#else<BR>
iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];<BR>
/* Disable relocation */<BR>
//iip->iic_rpbase = 0;<BR>
#endif<BR>
<BR>
#ifdef CFG_ALLOC_DPRAM<BR>
dpaddr = iip->iic_rbase;<BR>
if (dpaddr == 0) {<BR>
/* need to allocate dual port ram */<BR>
dpaddr = dpram_alloc_align(<BR>
(NUM_RX_BDS * sizeof(I2C_BD)) + (NUM_TX_BDS * sizeof(I2C_BD)) +<BR>
MAX_TX_SPACE, 8);<BR>
}<BR>
#else<BR>
dpaddr = CPM_I2C_BASE;<BR>
#endif<BR>
<BR>
/////////////////////////////////////////////////////////////////////////////<BR>
</FONT>
</P>
</BODY>
</HTML>