* [U-Boot] GPIO - MPC8315
@ 2009-12-10 23:35 Marcos Cunha
2009-12-11 15:26 ` Günter Leonhardt
0 siblings, 1 reply; 3+ messages in thread
From: Marcos Cunha @ 2009-12-10 23:35 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] GPIO - MPC8315
2009-12-10 23:35 [U-Boot] GPIO - MPC8315 Marcos Cunha
@ 2009-12-11 15:26 ` Günter Leonhardt
2009-12-14 13:04 ` Marcos Cunha
0 siblings, 1 reply; 3+ messages in thread
From: Günter Leonhardt @ 2009-12-11 15:26 UTC (permalink / raw)
To: u-boot
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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] GPIO - MPC8315
2009-12-11 15:26 ` Günter Leonhardt
@ 2009-12-14 13:04 ` Marcos Cunha
0 siblings, 0 replies; 3+ messages in thread
From: Marcos Cunha @ 2009-12-14 13:04 UTC (permalink / raw)
To: u-boot
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?
>>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-14 13:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 23:35 [U-Boot] GPIO - MPC8315 Marcos Cunha
2009-12-11 15:26 ` Günter Leonhardt
2009-12-14 13:04 ` Marcos Cunha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox