how to access structured registers correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello experts,

I am wondering how to access registers correctly by usging structured 
register definitions in TX4938 particularly.

Some time ago, Linus told "volatile" on a data structure as described 
below,

	http://www.ussg.iu.edu/hypermail/linux/kernel/0401.0/1387.html


In tx4938, every register access is done by using "volatile" like below.

 
    include/asm-mips/tx4938/tx4938.h:
    
       313  struct tx4938_ccfg_reg {
       314          volatile unsigned long long ccfg;
                    ^^^^^^^^
       315          volatile unsigned long long crir;
       316          volatile unsigned long long pcfg;
       317          volatile unsigned long long tear;

    
    arch/mips/tx4938/toshiba_rbtx4938/setup.c:
    
       410  int __init tx4938_pciclk66_setup(void)
       411  {
       412          int pciclk;
       413  
       414          /* Assert M66EN */
       415          tx4938_ccfgptr->ccfg |= TX4938_CCFG_PCI66;
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


In order to remove "volatile" on data structure and fix the above situation, I gues, 
some functions are provided in header files:

	1. "reg_rd08(r)" family
	2. "TX4938_RD08(r)" family
	3. "readb(r)" family

Could you tell me which is suitable for this situation?

For exmaple, if #"2" is applied, the code would become like below:

    arch/mips/tx4938/toshiba_rbtx4938/setup.c:

       433  int __init tx4938_pciclk66_setup(void)
       434  {
       435          int pciclk;
       436          unsigned long long v;
       437          /* Assert M66EN */
       438          v = TX4938_RD64(&tx4938_ccfgptr->ccfg);
       439          TX4938_WR64(&tx4938_ccfgptr->ccfg, v | TX4938_CCFG_PCI66);
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Any information would be appreciated.

	Hiroshi DOYU









[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux