
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
/////////////////////////////////////////////////////////////////////////////