public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marcos Cunha <marcos@atlantico.com.br>
To: u-boot@lists.denx.de
Subject: [U-Boot] GPIO - MPC8315
Date: Thu, 10 Dec 2009 20:35:12 -0300	[thread overview]
Message-ID: <4B2185B0.70700@atlantico.com.br> (raw)

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

             reply	other threads:[~2009-12-10 23:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-10 23:35 Marcos Cunha [this message]
2009-12-11 15:26 ` [U-Boot] GPIO - MPC8315 Günter Leonhardt
2009-12-14 13:04   ` Marcos Cunha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B2185B0.70700@atlantico.com.br \
    --to=marcos@atlantico.com.br \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox