lkml.org 
[lkml]   [2011]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 1/2] MIPS: Add basic support for Loongson1B (UPDATED)
    From
    I have noticed this.
    And all register accesses in my patch are done through __raw_readl/__raw_writel.

    2011/9/26, wu zhangjin <wuzhangjin@gmail.com>:
    > On Sun, Sep 25, 2011 at 9:40 PM, Shane McDonald
    > <mcdonald.shane@gmail.com> wrote:
    >>>> diff --git a/arch/mips/include/asm/mach-loongson1/regs-clk.h
    >>>> b/arch/mips/include/asm/mach-loongson1/regs-clk.h
    >>>> new file mode 100644
    >>>> index 0000000..7a09d6a
    >>>> --- /dev/null
    >>>> +++ b/arch/mips/include/asm/mach-loongson1/regs-clk.h
    >>>> @@ -0,0 +1,32 @@
    >>>> +/*
    >>>> + * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
    >>>> + *
    >>>> + * Loongson1 Clock Register Definitions.
    >>>> + *
    >>>> + * This program is free software; you can redistribute it and/or
    >>>> modify it
    >>>> + * under the terms of the GNU General Public License as published by
    >>>> the
    >>>> + * Free Software Foundation; either version 2 of the License, or (at
    >>>> your
    >>>> + * option) any later version.
    >>>> + */
    >>>> +
    >>>> +#ifndef __ASM_MACH_LOONGSON1_REGS_CLK_H
    >>>> +#define __ASM_MACH_LOONGSON1_REGS_CLK_H
    >>>> +
    >>>> +#define LS1_CLK_REG(x) ((void __iomem *)(LOONGSON1_CLK_BASE +
    >>>> (x)))
    >>>
    >>> "volatile" keyword may be required for __iomem access, the same to the
    >>> following similar usage.
    >>>
    >>> Considering a scene is(LS1_XXX_REG(X) doesn't really exist):
    >>>
    >>> LS1_XXX_REG(X) = 0; /* put cpu into idle and wait interrupt
    >>> */
    >>> LS1_XXX_REG(X) = 7; /* recover the cpu frequency to the
    >>> highest */
    >>>
    >>> If no "volatile" keyword indicated, the first line will be
    >>> intelligently but wrongly removed by compiler.
    >>
    >> No -- please see Documentation/volatile-considered-harmful.txt,
    >> particularly the paragraph starting at line 49. This macro
    >> is only being used as an argument to __raw_readl,
    >> as it should be.
    >
    > Yeah, __raw_readl/writel() will use volatile to prevent it from
    > optimization, thanks ;)
    >
    > "within the kernel, I/O memory accesses are always done through
    > accessor functions;
    > accessing I/O memory directly through pointers is frowned upon and
    > does not work on all
    > architectures. Those accessors are written to prevent unwanted
    > optimization,
    > ....
    > - The above-mentioned accessor functions might use volatile on
    > architectures where direct I/O memory access does work. Essentially,
    > each accessor call becomes a little critical section on its own and
    > ensures that the access happens as expected by the programmer.
    > ...
    > Patches to remove volatile variables are generally welcome - as long as
    > they come with a justification which shows that the concurrency issues have
    > been properly thought through.
    > "
    >
    > Thanks & Regards,
    > Wu Zhangjin
    >
    >>
    >> Shane
    >>
    >


    --
    Best Regards!
    Kelvin


    \
     
     \ /
      Last update: 2011-09-26 11:03    [W:0.027 / U:391.692 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site