public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Access IO register with writel/readl?
@ 2012-10-18  1:47 Dennis Lan
  2012-10-18 12:09 ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Dennis Lan @ 2012-10-18  1:47 UTC (permalink / raw)
  To: u-boot

HI ALL:
   Is it just conventional to access IO register with wriltel, readl?
or is there any specific reason here.
what's the difference with direct access? writel has few arch releated
operation to guarantee hardware access?


  for example:

struct base_gpt {
        unsigned int control;
        unsigned int prescaler;
};

#define GPT1_BASE_ADDR GPTCR_SWR
volatile struct base_gpt *cur_gpt = (struct base_gpt *)GPT1_BASE_ADDR;

A) acess with writel
        __raw_writel(GPTCR_SWR, &cur_gpt->control);

B) direct access
       cur_gpt->control = GPTCR_SWR;

(Note I define the structure with volatile )

Dennis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-22 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18  1:47 [U-Boot] Access IO register with writel/readl? Dennis Lan
2012-10-18 12:09 ` Simon Glass
2012-10-22 19:33   ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox