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

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

In message F1F6EC0C8B75034F9E3A79FC85122E8E2649F0@aquib01a you wrote:
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:
The exising code has probably only ever been used with the older members of the MPC8xx family (823, 850, 855, 860) and need fixing for the newer ones like 880, 885 etc.
Patches are welcome (note that they must work with both types of preocessors, then).
Best regards,
Wolfgang Denk
participants (2)
-
DI BACCO ANTONIO - technolabs
-
Wolfgang Denk