[U-Boot] Access IO register with writel/readl?

Dennis Lan (dlan) dennis.yxun at gmail.com
Thu Oct 18 03:47:11 CEST 2012


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


More information about the U-Boot mailing list