[U-Boot] GPIO - MPC8315

Marcos Cunha marcos at atlantico.com.br
Fri Dec 11 00:35:12 CET 2009


I want to configure GPIOs on MPC8315, but I can't set the gpio. Below 
the configuration code and the output.

What is wrong?


#define SPI_CS_IO            0x20000000

int board_mmc_init(bd_t *bd)

{

    volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
    volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&immr->gpio[0];

    printf("INIT MMC\n");

    //tmpval = inbe32(
    out_be32(&gpio->dir,  SPI_CS_IO);  // Set IO as output
    out_be32(&gpio->odr, 0 /*~SPI_CS_IO*/); // Set pulled up
    out_be32(&gpio->ier,  SPI_CS_IO);  // Disable interrupt
    out_be32(&gpio->imr, 0 /*~SPI_CS_IO*/); // Disable interrupt mask
    out_be32(&gpio->icr, 0 /*~SPI_CS_IO*/); // Disable interrupt level/edge

    udelay(2000);
   
    out_be32(&gpio->dat, SPI_CS_IO);  // Set the output pin
 

     /*DEBUG*/
    printf("SPI - CHIP SELECT CONFIGURATION\n");
    printf("$gpio = %x\n", gpio);
    printf("gpio->dir = %x \n", gpio->dir );
    printf("gpio->odr = %x \n", gpio->odr );
    printf("gpio->ier = %x \n", gpio->ier );
    printf("gpio->imr = %x \n", gpio->imr );
    printf("gpio->icr = %x \n", gpio->icr );
    printf("gpio->dat = %x \n", gpio->dat );


}

This is the output.

MMC:  INIT MMC
SPI - CHIP SELECT CONFIGURATION
$gpio = e0000c00
gpio->dir = 3f000000
gpio->odr = 0
gpio->ier = c00dff00
gpio->imr = 0
gpio->icr = 0
gpio->dat = 0
FINISH MMC

Thanks in advance,


Marcos Cunha
Electrical Engineer



More information about the U-Boot mailing list