[U-Boot] GPIO - MPC8315

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

That was the problem.
After GPIO configuration this line resolve the problem.
*setbits_be32(&immr->sysconf.sicrh, SICRH_GPIO_0 | SICRH_GPIO_1 | SICRH_GPIO_2);*
The DEBUG output:
SPI - CHIP SELECT CONFIGURATION &gpio = e0000c00 gpio->dir = 3f000000 gpio->odr = 0 gpio->ier = e0bfff0f gpio->imr = 0 gpio->icr = 0 *gpio->dat = e0000000 *
sysconf.sicrl = 0 *sysconf.sicrh = fc000000*
Thanks
Günter Leonhardt wrote:
Did you setup the System I/O Configuration Registers SICRL, SICRH?
I want to configure GPIOs on MPC8315, but I can't set the gpio. Below the configuration code and the output.
What is wrong?
participants (2)
-
Günter Leonhardt
-
Marcos Cunha