powerpc: fix 8xx and 82xx type-punning warnings with GCC 4.7
C99's strict aliasing rules are insane to use in low-level code such as a bootloader, but as Wolfgang has rejected -fno-strict-aliasing in the past, add a union so that 16-bit accesses can be performed. Compile-tested only. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
e1208c2fe5
commit
a166fbca20
|
@ -43,7 +43,7 @@ m8260_cpm_reset(void)
|
||||||
} while ((immr->im_cpm.cp_cpcr & CPM_CR_FLG) && ++count < 1000000);
|
} while ((immr->im_cpm.cp_cpcr & CPM_CR_FLG) && ++count < 1000000);
|
||||||
|
|
||||||
#ifdef CONFIG_HARD_I2C
|
#ifdef CONFIG_HARD_I2C
|
||||||
*((unsigned short*)(&immr->im_dprambase[PROFF_I2C_BASE])) = 0;
|
immr->im_dprambase16[PROFF_I2C_BASE / sizeof(u16)] = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ int checkcpu (void)
|
||||||
* in the mask.
|
* in the mask.
|
||||||
*/
|
*/
|
||||||
m = immr & (IMMR_PARTNUM_MSK | IMMR_MASKNUM_MSK);
|
m = immr & (IMMR_PARTNUM_MSK | IMMR_MASKNUM_MSK);
|
||||||
k = *((ushort *) & immap->im_dprambase[PROFF_REVNUM]);
|
k = immap->im_dprambase16[PROFF_REVNUM / sizeof(u16)];
|
||||||
|
|
||||||
switch (m) {
|
switch (m) {
|
||||||
case 0x0000:
|
case 0x0000:
|
||||||
|
|
|
@ -221,14 +221,14 @@ void i2c_init(int speed, int slaveadd)
|
||||||
i2c_init_board();
|
i2c_init_board();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dpaddr = *((unsigned short *) (&immap->im_dprambase[PROFF_I2C_BASE]));
|
dpaddr = immap->im_dprambase16[PROFF_I2C_BASE / sizeof(u16)];
|
||||||
if (dpaddr == 0) {
|
if (dpaddr == 0) {
|
||||||
/* need to allocate dual port ram */
|
/* need to allocate dual port ram */
|
||||||
dpaddr = m8260_cpm_dpalloc(64 +
|
dpaddr = m8260_cpm_dpalloc(64 +
|
||||||
(NUM_RX_BDS * sizeof(I2C_BD)) +
|
(NUM_RX_BDS * sizeof(I2C_BD)) +
|
||||||
(NUM_TX_BDS * sizeof(I2C_BD)) +
|
(NUM_TX_BDS * sizeof(I2C_BD)) +
|
||||||
MAX_TX_SPACE, 64);
|
MAX_TX_SPACE, 64);
|
||||||
*((unsigned short *)(&immap->im_dprambase[PROFF_I2C_BASE])) =
|
immap->im_dprambase16[PROFF_I2C_BASE / sizeof(u16)] =
|
||||||
dpaddr;
|
dpaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ void i2c_newio(i2c_state_t *state)
|
||||||
|
|
||||||
debug("[I2C] i2c_newio\n");
|
debug("[I2C] i2c_newio\n");
|
||||||
|
|
||||||
dpaddr = *((unsigned short *)(&immap->im_dprambase[PROFF_I2C_BASE]));
|
dpaddr = immap->im_dprambase16[PROFF_I2C_BASE / sizeof(u16)];
|
||||||
iip = (iic_t *)&immap->im_dprambase[dpaddr];
|
iip = (iic_t *)&immap->im_dprambase[dpaddr];
|
||||||
state->rx_idx = 0;
|
state->rx_idx = 0;
|
||||||
state->tx_idx = 0;
|
state->tx_idx = 0;
|
||||||
|
@ -480,7 +480,7 @@ int i2c_doio(i2c_state_t *state)
|
||||||
return I2CERR_QUEUE_EMPTY;
|
return I2CERR_QUEUE_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
dpaddr = *((unsigned short *)(&immap->im_dprambase[PROFF_I2C_BASE]));
|
dpaddr = immap->im_dprambase16[PROFF_I2C_BASE / sizeof(u16)];
|
||||||
iip = (iic_t *)&immap->im_dprambase[dpaddr];
|
iip = (iic_t *)&immap->im_dprambase[dpaddr];
|
||||||
iip->iic_rbptr = iip->iic_rbase;
|
iip->iic_rbptr = iip->iic_rbase;
|
||||||
iip->iic_tbptr = iip->iic_tbase;
|
iip->iic_tbptr = iip->iic_tbase;
|
||||||
|
|
|
@ -105,7 +105,7 @@ static int mpc8260_smc_serial_init(void)
|
||||||
/* initialize pointers to SMC */
|
/* initialize pointers to SMC */
|
||||||
|
|
||||||
sp = (smc_t *) &(im->im_smc[SMC_INDEX]);
|
sp = (smc_t *) &(im->im_smc[SMC_INDEX]);
|
||||||
*(ushort *)(&im->im_dprambase[PROFF_SMC_BASE]) = PROFF_SMC;
|
im->im_dprambase16[PROFF_SMC_BASE / sizeof(u16)] = PROFF_SMC;
|
||||||
up = (smc_uart_t *)&im->im_dprambase[PROFF_SMC];
|
up = (smc_uart_t *)&im->im_dprambase[PROFF_SMC];
|
||||||
|
|
||||||
/* Disable transmitter/receiver. */
|
/* Disable transmitter/receiver. */
|
||||||
|
@ -331,7 +331,7 @@ kgdb_serial_init (void)
|
||||||
/* initialize pointers to SMC */
|
/* initialize pointers to SMC */
|
||||||
|
|
||||||
sp = (smc_t *) &(im->im_smc[KGDB_SMC_INDEX]);
|
sp = (smc_t *) &(im->im_smc[KGDB_SMC_INDEX]);
|
||||||
*(ushort *)(&im->im_dprambase[KGDB_PROFF_SMC_BASE]) = KGDB_PROFF_SMC;
|
im->im_dprambase16[KGDB_PROFF_SMC_BASE / sizeof(u16)] = KGDB_PROFF_SMC;
|
||||||
up = (smc_uart_t *)&im->im_dprambase[KGDB_PROFF_SMC];
|
up = (smc_uart_t *)&im->im_dprambase[KGDB_PROFF_SMC];
|
||||||
|
|
||||||
/* Disable transmitter/receiver. */
|
/* Disable transmitter/receiver. */
|
||||||
|
|
|
@ -146,7 +146,7 @@ void spi_init_f (void)
|
||||||
immr = (immap_t *) CONFIG_SYS_IMMR;
|
immr = (immap_t *) CONFIG_SYS_IMMR;
|
||||||
cp = (cpm8260_t *) &immr->im_cpm;
|
cp = (cpm8260_t *) &immr->im_cpm;
|
||||||
|
|
||||||
*(ushort *)(&immr->im_dprambase[PROFF_SPI_BASE]) = PROFF_SPI;
|
immr->im_dprambase16[PROFF_SPI_BASE / sizeof(u16)] = PROFF_SPI;
|
||||||
spi = (spi_t *)&immr->im_dprambase[PROFF_SPI];
|
spi = (spi_t *)&immr->im_dprambase[PROFF_SPI];
|
||||||
|
|
||||||
/* 1 */
|
/* 1 */
|
||||||
|
|
|
@ -78,7 +78,8 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||||
if ((pvr >> 16) != 0x0050)
|
if ((pvr >> 16) != 0x0050)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
|
k = (immr << 16) |
|
||||||
|
immap->im_cpm.cp_dparam16[PROFF_REVNUM / sizeof(u16)];
|
||||||
m = 0;
|
m = 0;
|
||||||
suf = "";
|
suf = "";
|
||||||
|
|
||||||
|
@ -194,7 +195,8 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||||
if ((pvr >> 16) != 0x0050)
|
if ((pvr >> 16) != 0x0050)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
|
k = (immr << 16) |
|
||||||
|
immap->im_cpm.cp_dparam16[PROFF_REVNUM / sizeof(u16)];
|
||||||
m = 0;
|
m = 0;
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
|
@ -253,7 +255,8 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||||
if ((pvr >> 16) != 0x0050)
|
if ((pvr >> 16) != 0x0050)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
k = (immr << 16) | in_be16((ushort *)&immap->im_cpm.cp_dparam[0xB0]);
|
k = (immr << 16) |
|
||||||
|
in_be16(&immap->im_cpm.cp_dparam16[PROFF_REVNUM / sizeof(u16)]);
|
||||||
m = 0;
|
m = 0;
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
|
@ -312,7 +315,8 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||||
if ((pvr >> 16) != 0x0050)
|
if ((pvr >> 16) != 0x0050)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
|
k = (immr << 16) |
|
||||||
|
immap->im_cpm.cp_dparam16[PROFF_REVNUM / sizeof(u16)];
|
||||||
m = 0;
|
m = 0;
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
|
|
|
@ -485,7 +485,12 @@ typedef struct comm_proc {
|
||||||
* Some processors don't have all of it populated.
|
* Some processors don't have all of it populated.
|
||||||
*/
|
*/
|
||||||
u_char cp_dpmem[0x1C00]; /* BD / Data / ucode */
|
u_char cp_dpmem[0x1C00]; /* BD / Data / ucode */
|
||||||
u_char cp_dparam[0x400]; /* Parameter RAM */
|
|
||||||
|
/* Parameter RAM */
|
||||||
|
union {
|
||||||
|
u_char cp_dparam[0x400];
|
||||||
|
u16 cp_dparam16[0x200];
|
||||||
|
};
|
||||||
} cpm8xx_t;
|
} cpm8xx_t;
|
||||||
|
|
||||||
/* Internal memory map.
|
/* Internal memory map.
|
||||||
|
|
|
@ -526,13 +526,18 @@ typedef struct immap {
|
||||||
/* Some references are into the unique and known dpram spaces,
|
/* Some references are into the unique and known dpram spaces,
|
||||||
* others are from the generic base.
|
* others are from the generic base.
|
||||||
*/
|
*/
|
||||||
#define im_dprambase im_dpram1
|
union {
|
||||||
u_char im_dpram1[16*1024];
|
struct {
|
||||||
char res1[16*1024];
|
u_char im_dpram1[16 * 1024];
|
||||||
u_char im_dpram2[4*1024];
|
char res1[16 * 1024];
|
||||||
char res2[8*1024];
|
u_char im_dpram2[4 * 1024];
|
||||||
u_char im_dpram3[4*1024];
|
char res2[8 * 1024];
|
||||||
char res3[16*1024];
|
u_char im_dpram3[4 * 1024];
|
||||||
|
char res3[16 * 1024];
|
||||||
|
};
|
||||||
|
u8 im_dprambase[64 * 1024];
|
||||||
|
u16 im_dprambase16[32 * 1024];
|
||||||
|
};
|
||||||
|
|
||||||
sysconf8260_t im_siu_conf; /* SIU Configuration */
|
sysconf8260_t im_siu_conf; /* SIU Configuration */
|
||||||
memctl8260_t im_memctl; /* Memory Controller */
|
memctl8260_t im_memctl; /* Memory Controller */
|
||||||
|
|
|
@ -535,7 +535,7 @@ do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
volatile iic_t *iip;
|
volatile iic_t *iip;
|
||||||
uint dpaddr;
|
uint dpaddr;
|
||||||
|
|
||||||
dpaddr = *((unsigned short *) (&immap->im_dprambase[PROFF_I2C_BASE]));
|
dpaddr = immap->im_dprambase16[PROFF_I2C_BASE / sizeof(u16)];
|
||||||
if (dpaddr == 0)
|
if (dpaddr == 0)
|
||||||
iip = NULL;
|
iip = NULL;
|
||||||
else
|
else
|
||||||
|
|
|
@ -309,7 +309,8 @@ int idma_init (void)
|
||||||
|
|
||||||
memaddr = dpalloc (sizeof (pram_idma_t), 64);
|
memaddr = dpalloc (sizeof (pram_idma_t), 64);
|
||||||
|
|
||||||
*(volatile ushort *) &immap->im_dprambase[PROFF_IDMA2_BASE] = memaddr;
|
*(volatile u16 *)&immap->im_dprambase16
|
||||||
|
[PROFF_IDMA2_BASE / sizeof(u16)] = memaddr;
|
||||||
piptr = (volatile pram_idma_t *) ((uint) (immap) + memaddr);
|
piptr = (volatile pram_idma_t *) ((uint) (immap) + memaddr);
|
||||||
|
|
||||||
piptr->pi_resv1 = 0; /* manual says: clear it */
|
piptr->pi_resv1 = 0; /* manual says: clear it */
|
||||||
|
|
|
@ -127,6 +127,7 @@ typedef struct cpm_buf_desc {
|
||||||
*/
|
*/
|
||||||
#define PROFF_SCC1 ((uint)0x0000)
|
#define PROFF_SCC1 ((uint)0x0000)
|
||||||
#define PROFF_IIC ((uint)0x0080)
|
#define PROFF_IIC ((uint)0x0080)
|
||||||
|
#define PROFF_REVNUM ((uint)0x00b0)
|
||||||
#define PROFF_SCC2 ((uint)0x0100)
|
#define PROFF_SCC2 ((uint)0x0100)
|
||||||
#define PROFF_SPI ((uint)0x0180)
|
#define PROFF_SPI ((uint)0x0180)
|
||||||
#define PROFF_SCC3 ((uint)0x0200)
|
#define PROFF_SCC3 ((uint)0x0200)
|
||||||
|
|
Loading…
Reference in New Issue