[U-Boot-Users] u-boot-1.2.0/cpu/mpc8xx/i2c.c: problem in i2c_init when defining CFG_ALLOC_DPRAM

DI BACCO ANTONIO - technolabs Antonio.DiBacco at technolabs.it
Thu Nov 15 19:59:11 CET 2007


Hi all,

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:

//////////////////////////////////////////////////////////////////
void i2c_init(int speed, int slaveaddr)
{
	volatile immap_t *immap = (immap_t *)CFG_IMMR ;
	volatile cpm8xx_t *cp = (cpm8xx_t *)&immap->im_cpm;
	volatile i2c8xx_t *i2c	= (i2c8xx_t *)&immap->im_i2c;
	volatile iic_t *iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
	ulong rbase, tbase;
	volatile I2C_BD *rxbd, *txbd;
	uint dpaddr;

#ifdef CFG_I2C_INIT_BOARD
	/* call board specific i2c bus reset routine before accessing the   */
	/* environment, which might be in a chip on that bus. For details   */
	/* about this problem see doc/I2C_Edge_Conditions.                  */
	i2c_init_board();
#endif

#ifdef CFG_I2C_UCODE_PATCH
	iip = (iic_t *)&cp->cp_dpmem[iip->iic_rpbase];
#else
        iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
	/* Disable relocation */
	//iip->iic_rpbase = 0;
#endif

#ifdef CFG_ALLOC_DPRAM
	dpaddr = iip->iic_rbase;
	if (dpaddr == 0) {
	    /* need to allocate dual port ram */
	    dpaddr = dpram_alloc_align(
		(NUM_RX_BDS * sizeof(I2C_BD)) + (NUM_TX_BDS * sizeof(I2C_BD)) +
		MAX_TX_SPACE, 8);
	}
#else
	dpaddr = CPM_I2C_BASE;
#endif

/////////////////////////////////////////////////////////////////////////////
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20071115/78f13e17/attachment.htm 


More information about the U-Boot mailing list