1. 17 Dec, 2009 40 commits
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Suspend CS5536 MFGPT Timer · c47a48d8
      Wu Zhangjin authored
      Before putting the Loongson 2F into wait mode, suspend the MFGPT Timer and
      after wake-up resume it.  This may save some power.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/706/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      c47a48d8
    • Uwe Kleine-König's avatar
      MIPS: Excite: move iodev_remove to .devexit.text · 59d4a914
      Uwe Kleine-König authored
      The function iodev_remove is used only wrapped by __devexit_p so define
      it using __devexit.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Ming Lei <tom.leiming@gmail.com>
      Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/710/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      59d4a914
    • Alexey Dobriyan's avatar
      MIPS: Lasat: Convert to proc_fops / seq_file · c0b4abdd
      Alexey Dobriyan authored
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: akpm@linux-foundation.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/725/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      c0b4abdd
    • Ralf Baechle's avatar
      MIPS: Cleanup signal code initialization · 137f6f3e
      Ralf Baechle authored
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/709/
      137f6f3e
    • Ralf Baechle's avatar
      MIPS: Modularize COP2 handling · 69f3a7de
      Ralf Baechle authored
      Away with the daemons of ifdef; get ready for future COP2 users.
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Patchwork: http://patchwork.linux-mips.org/patch/708/
      69f3a7de
    • Ralf Baechle's avatar
      MIPS: Move EARLY_PRINTK to Kconfig.debug · 4dd92e15
      Ralf Baechle authored
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      4dd92e15
    • Wu Zhangjin's avatar
      70ab711d
    • Wu Zhangjin's avatar
      MIPS: Yeeloong 2F: Add LID open event as the wakeup event · cb1ed9e1
      Wu Zhangjin authored
      Yeeloong 2F netbook has an KB3310B embedded controller to manage the LID
      action.  When the LID is closed or opened a SCI interrupt is sent out and
      the corresponding event is saved to an EC register for later query.
      
      Allow the LID open interrupt to wake the processor from wait mode if it is
      in the suspend mode.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/685/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      cb1ed9e1
    • Wu Zhangjin's avatar
      MIPS: Yeeloong 2F: Add basic EC operations · ec614d80
      Wu Zhangjin authored
      YeeLoong2F has a KB3310b embedded controller. Add basic operations for
      future related drivers and board support.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/684/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      ec614d80
    • Dmitri Vorobiev's avatar
      MIPS: Move several variables from .bss to .init.data · 599a8945
      Dmitri Vorobiev authored
      Several static uninitialized variables are used in the scope of __init
      functions but are themselves not marked as __initdata.  This patch is to put
      those variables to where they belong and to reduce the memory footprint a
      little bit.
      
      Also, a couple of lines with spaces instead of tabs were fixed.
      Signed-off-by: default avatarDmitri Vorobiev <dmitri.vorobiev@movial.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/698/Acked-by: default avatarFlorian Fainelli <florian@openwrt.org>
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      599a8945
    • Wu Zhangjin's avatar
      MIPS: Tracing: Make function graph tracer work with -mmcount-ra-address · 7326c4e5
      Wu Zhangjin authored
      That thread "MIPS: Add option to pass return address location to
      _mcount" from "David Daney <ddaney@caviumnetworks.com>" have added a new
      option -mmcount-ra-address to gcc(4.5) for MIPS to transfer the location
      of the return address to _mcount.
      
      Benefit from this new feature, function graph tracer on MIPS will be
      easier and safer to hijack the return address of the kernel function,
      which will save some overhead and make the whole thing more reliable.
      
      In this patch, at first, try to enable the option -mmcount-ra-address in
      arch/mips/Makefile with cc-option, if gcc support it, it will be
      enabled, otherwise, no side effect.
      
      and then, we need to support this new option of gcc 4.5 and also support
      the old gcc versions.
      
      with _mcount in the old gcc versions, it's not easy to get the location
      of return address(tracing: add function graph tracer support for MIPS),
         so, we do it in a C function: ftrace_get_parent_addr(ftrace.c), but
         with -mmcount-ra-address, only several instructions need to get what
         we want, so, I put into asm(mcount.S). and also, as the $12(t0) is
         used by -mmcount-ra-address for transferring the localtion of return
         address to _mcount, we need to save it into the stack and restore it
         when enabled dynamic function tracer, 'Cause we have called
         "ftrace_call" before "ftrace_graph_caller", which may destroy
         $12(t0).
      
      (Thanks to David for providing that -mcount-ra-address and giving the
       idea of KBUILD_MCOUNT_RA_ADDRESS, both of them have made the whole
       thing more beautiful!)
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/681/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      7326c4e5
    • Wu Zhangjin's avatar
      MIPS: Tracing: Reserve $12(t0) for mcount-ra-address of gcc 4.5 · fc49a3be
      Wu Zhangjin authored
      A new option -mmcount-ra-address for gcc 4.5 have been sent by David
      Daney <ddaney@caviumnetworks.com> in the thread "MIPS: Add option to
      pass return address location to _mcount", which help to record the
      location of the return address(ra) for the function graph tracer of MIPS
      to hijack the return address easier and safer. that option used the
      $12(t0) register by default, so, we reserve it for it, and use t1,t2,t3
      instead of t0,t1,t2.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/680/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      fc49a3be
    • Wu Zhangjin's avatar
      MIPS: Tracing: Make ftrace for MIPS work without -fno-omit-frame-pointer · 046199ca
      Wu Zhangjin authored
      When remove the -fno-omit-frame-pointer, gcc will not save the frame
      pointer for us, we need to save one ourselves.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/679/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      046199ca
    • Wu Zhangjin's avatar
      MIPS: Tracing: Add dynamic function graph tracer for MIPS · e17ff5fe
      Wu Zhangjin authored
      This patch make function graph tracer work with dynamic function tracer.
      
      To share the source code of dynamic function tracer(MCOUNT_SAVE_REGS),
      and avoid restoring the whole saved registers, we need to restore the ra
      register from the stack.
      
      (NOTE: This not work with 32bit! need to ensure why!)
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/678/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      e17ff5fe
    • Wu Zhangjin's avatar
      MIPS: Tracing: Add function graph tracer support for MIPS · 29c5d346
      Wu Zhangjin authored
      The implementation of function graph tracer for MIPS is a little
      different from X86.
      
      in MIPS, gcc(with -pg) only transfer the caller's return address(at) and
      the _mcount's return address(ra) to us.
      
      For the kernel part without -mlong-calls:
      
      move at, ra
      jal _mcount
      
      For the module part with -mlong-calls:
      
      lui v1, hi16bit_of_mcount
      addiu v1, v1, low16bit_of_mcount
      move at, ra
      jal _mcount
      
      Without -mlong-calls,
      
      if the function is a leaf, it will not save the return address(ra):
      
      ffffffff80101298 <au1k_wait>:
      ffffffff80101298:       67bdfff0        daddiu  sp,sp,-16
      ffffffff8010129c:       ffbe0008        sd      s8,8(sp)
      ffffffff801012a0:       03a0f02d        move    s8,sp
      ffffffff801012a4:       03e0082d        move    at,ra
      ffffffff801012a8:       0c042930        jal     ffffffff8010a4c0 <_mcount>
      ffffffff801012ac:       00020021        nop
      
      so, we can hijack it directly in _mcount, but if the function is non-leaf, the
      return address is saved in the stack.
      
      ffffffff80133030 <copy_process>:
      ffffffff80133030:       67bdff50        daddiu  sp,sp,-176
      ffffffff80133034:       ffbe00a0        sd      s8,160(sp)
      ffffffff80133038:       03a0f02d        move    s8,sp
      ffffffff8013303c:       ffbf00a8        sd      ra,168(sp)
      ffffffff80133040:       ffb70098        sd      s7,152(sp)
      ffffffff80133044:       ffb60090        sd      s6,144(sp)
      ffffffff80133048:       ffb50088        sd      s5,136(sp)
      ffffffff8013304c:       ffb40080        sd      s4,128(sp)
      ffffffff80133050:       ffb30078        sd      s3,120(sp)
      ffffffff80133054:       ffb20070        sd      s2,112(sp)
      ffffffff80133058:       ffb10068        sd      s1,104(sp)
      ffffffff8013305c:       ffb00060        sd      s0,96(sp)
      ffffffff80133060:       03e0082d        move    at,ra
      ffffffff80133064:       0c042930        jal     ffffffff8010a4c0 <_mcount>
      ffffffff80133068:       00020021        nop
      
      but we can not get the exact stack address(which saved ra) directly in
      _mcount, we need to search the content of at register in the stack space
      or search the "s{d,w} ra, offset(sp)" instruction in the text. 'Cause we
      can not prove there is only a match in the stack space, so, we search
      the text instead.
      
      as we can see, if the first instruction above "move at, ra" is not a
      store instruction, there should be a leaf function, so we hijack the at
      register directly via putting &return_to_handler into it, otherwise, we
      search the "s{d,w} ra, offset(sp)" instruction to get the stack offset,
      and then the stack address. we use the above copy_process() as an
      example, we at last find "ffbf00a8", 0xa8 is the stack offset, we plus
      it with s8(fp), that is the stack address, we hijack the content via
      writing the &return_to_handler in.
      
      If with -mlong-calls, since there are two more instructions above "move
      at, ra", so, we can move the pointer to the position above "lui v1,
      hi16bit_of_mcount".
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/677/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      29c5d346
    • Wu Zhangjin's avatar
      MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS · 8f99a162
      Wu Zhangjin authored
      This patch add a new section for MIPS to record the block of the hardirq
      handling for function graph tracer(print_graph_irq) via adding the
      __irq_entry annotation to the the entrypoints of the hardirqs(the block
      with irq_enter()...irq_exit()).
      
      Thanks goes to Steven & Frederic Weisbecker for their feedbacks.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Patchwork: http://patchwork.linux-mips.org/patch/676/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      8f99a162
    • Wu Zhangjin's avatar
      MIPS: Tracing: Add dynamic function tracer support · 538f1952
      Wu Zhangjin authored
      With dynamic function tracer, by default, _mcount is defined as an
      "empty" function, it returns directly without any more action . When
      enabling it in user-space, it will jump to a real tracing
      function(ftrace_caller), and do the real job for us.
      
      Differ from the static function tracer, dynamic function tracer provides
      two functions ftrace_make_call()/ftrace_make_nop() to enable/disable the
      tracing of some indicated kernel functions(set_ftrace_filter).
      
      In the -v4 version, the implementation of this support is basically the same as
      X86 version does: _mcount is implemented as an empty function and ftrace_caller
      is implemented as a real tracing function respectively.
      
      But in this version, to support module tracing with the help of
      -mlong-calls in arch/mips/Makefile:
      
      MODFLAGS += -mlong-calls.
      
      The stuff becomes a little more complex. We need to cope with two
      different type of calling to _mcount.
      
      For the kernel part, the calling to _mcount(result of "objdump -hdr
      vmlinux"). is like this:
      
      	108:   03e0082d        move    at,ra
      	10c:   0c000000        jal     0 <fpcsr_pending>
                              10c: R_MIPS_26  _mcount
                              10c: R_MIPS_NONE        *ABS*
                              10c: R_MIPS_NONE        *ABS*
      	110:   00020021        nop
      
      For the module with -mlong-calls, it looks like this:
      
      	c:	3c030000 	lui	v1,0x0
      			c: R_MIPS_HI16	_mcount
      			c: R_MIPS_NONE	*ABS*
      			c: R_MIPS_NONE	*ABS*
      	10:	64630000 	daddiu	v1,v1,0
      			10: R_MIPS_LO16	_mcount
      			10: R_MIPS_NONE	*ABS*
      			10: R_MIPS_NONE	*ABS*
      	14:	03e0082d 	move	at,ra
      	18:	0060f809 	jalr	v1
      
      In the kernel version, there is only one "_mcount" string for every
      kernel function, so, we just need to match this one in mcount_regex of
      scripts/recordmcount.pl, but in the module version, we need to choose
      one of the two to match. Herein, I choose the first one with
      "R_MIPS_HI16 _mcount".
      
      and In the kernel verion, without module tracing support, we just need
      to replace "jal _mcount" by "jal ftrace_caller" to do real tracing, and
      filter the tracing of some kernel functions via replacing it by a nop
      instruction.
      
      but as we have described before, the instruction "jal ftrace_caller" only left
      32bit length for the address of ftrace_caller, it will fail when calling from
      the module space. so, herein, we must replace something else.
      
      the basic idea is loading the address of ftrace_caller to v1 via changing these
      two instructions:
      
      	lui	v1,0x0
      	addiu	v1,v1,0
      
      If we want to enable the tracing, we need to replace the above instructions to:
      
      	lui	v1, HI_16BIT_ftrace_caller
      	addiu	v1, v1, LOW_16BIT_ftrace_caller
      
      If we want to stop the tracing of the indicated kernel functions, we
      just need to replace the "jalr v1" to a nop instruction. but we need to
      replace two instructions and encode the above two instructions
      oursevles.
      
      Is there a simpler solution? Yes! Here it is, in this version, we put _mcount
      and ftrace_caller together, which means the address of _mcount and
      ftrace_caller is the same:
      
      _mcount:
      ftrace_caller:
      	j	ftrace_stub
      	 nop
      
      	...(do real tracing here)...
      
      ftrace_stub:
      	jr	ra
      	 move	ra, at
      
      By default, the kernel functions call _mcount, and then jump to ftrace_stub and
      return. and when we want to do real tracing, we just need to remove that "j
      ftrace_stub", and it will run through the two "nop" instructions and then do
      the real tracing job.
      
      what about filtering job? we just need to do this:
      
      	 lui v1, hi_16bit_of_mcount        <--> b 1f (0x10000004)
      	 addiu v1, v1, low_16bit_of_mcount
      	 move at, ra
      	 jalr v1
      	 nop
      	 				     1f: (rec->ip + 12)
      
      In linux-mips64, there will be some local symbols, whose name are
      prefixed by $L, which need to be filtered. thanks goes to Steven for
      writing the mips64-specific function_regex.
      
      In a conclusion, with RISC, things becomes easier with such a "stupid"
      trick, RISC is something like K.I.S.S, and also, there are lots of
      "simple" tricks in the whole ftrace support, thanks goes to Steven and
      the other folks for providing such a wonderful tracing framework!
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/675/Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      538f1952
    • Wu Zhangjin's avatar
      MIPS: Tracing: Add an endian argument to scripts/recordmcount.pl · e6299d26
      Wu Zhangjin authored
      MIPS and some other architectures need this argument to handle
      big/little endian respectively.
      Signed-off-by: default avatarWu Zhangjin <wuzj@lemote.com>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/674/Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      e6299d26
    • Wu Zhangjin's avatar
      MIPS: Tracing: Enable HAVE_FUNCTION_TRACE_MCOUNT_TEST for MIPS · 69a7d1b3
      Wu Zhangjin authored
      There is an exisiting common ftrace_test_stop_func() in
      kernel/trace/ftrace.c, which is used to check the global variable
      ftrace_trace_stop to determine whether stop the function tracing.
      
      This patch implepment the MIPS specific one to speedup the procedure.
      
      Thanks goes to Zhang Le for Cleaning it up.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/673/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      69a7d1b3
    • Wu Zhangjin's avatar
      MIPS: Tracing: Add static function tracer support for MIPS · d2bb0762
      Wu Zhangjin authored
      If -pg of gcc is enabled with CONFIG_FUNCTION_TRACER=y. a calling to
      _mcount will be inserted into each kernel function. so, there is a
      possibility to trace the kernel functions in _mcount.
      
      This patch add the MIPS specific _mcount support for static function
      tracing. by default, ftrace_trace_function is initialized as
      ftrace_stub(an empty function), so, the default _mcount will introduce
      very little overhead. after enabling ftrace in user-space, it will jump
      to a real tracing function and do static function tracing for us.
      
      and -ffunction-sections is incompatible with -pg, so, disable it when
      ftracer is enabled.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Reviewed-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Cc: Nicholas Mc Guire <der.herr@hofr.at>
      Cc: zhangfx@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/672/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      d2bb0762
    • Thomas Gleixner's avatar
      MIPS: Fixup last users of irq_chip->typename · 8922f79e
      Thomas Gleixner authored
      The typename member of struct irq_chip was kept for migration purposes
      and is obsolete since more than 2 years. Fix up the leftovers.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      To: LKML <linux-kernel@vger.kernel.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Patchwork: http://patchwork.linux-mips.org/patch/661/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      8922f79e
    • Wu Zhangjin's avatar
      MIPS: Loongson 2F: Add CPU frequency scaling support · f8ede0f7
      Wu Zhangjin authored
      Loongson 2F supports CPU clock scaling. When put it into wait mode by
      setting the frequency as ZERO it will stay in this mode until an external
      interrupt wakes the CPU again.
      
      To enable clock scaling support, an external timer of a known stable rate
      is required.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: cpufreq@vger.kernel.org,
      Cc: Dave Jones <davej@redhat.com>,
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com,
      Patchwork: http://patchwork.linux-mips.org/patch/660/
      Patchwork: http://patchwork.linux-mips.org/patch/751/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      f8ede0f7
    • Wu Zhangjin's avatar
      MIPS: Add basic CPUFreq options. · 9726b43a
      Wu Zhangjin authored
      This patch adds basic options for MIPS CPUFreq support.
      
      Since the cp0 timer's frequency is based on the processor clockrate it can
      not be used with CPUFReq; an additional external timer is required.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: cpufreq@vger.kernel.org,
      Cc: Dave Jones <davej@redhat.com>,
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com,
      Patchwork: http://patchwork.linux-mips.org/patch/659/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      9726b43a
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add cs5536 MFGPT timer support · 916daba8
      Wu Zhangjin authored
      CPUFreq support for Loongson 2F requires an external timer.
      
      Because the frequency of the MIPS Timer is related to the CPU frequency
      which itself is variable another timer of constant frequency is required.
      
      Export the mfgpt0 counter disable / enable operations for the coming
      suspend support to suspend / resume the timer.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: cpufreq@vger.kernel.org,
      Cc: Dave Jones <davej@redhat.com>,
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>,
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com,
      Patchwork: http://patchwork.linux-mips.org/patch/658/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      916daba8
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add Lynloong support · 6e552c9b
      Wu Zhangjin authored
      Add a new machtype and kernel options for the Lynloong.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/657/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      6e552c9b
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add NAS support · e13fb776
      Wu Zhangjin authored
      Kernel support for this machine is almost the same as Fuloong 2F; the only
      difference is that it uses the serial port provided by Loongson 2F processor
      as Yeeloong 2F does.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/656/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      e13fb776
    • David VomLehn's avatar
      MIPS: PowerTV: Base files for Cisco PowerTV platform · a3a0f8c8
      David VomLehn authored
      Add the Cisco Powertv cable settop box to the MIPS tree. This platform is
      based on a MIPS 24Kc processor with various devices integrated on the same
      ASIC. There are multiple models of this box, with differing configuration
      but the same kernel runs across the product line.
      Signed-off-by: default avatarDavid VomLehn <dvomlehn@cisco.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/132/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      a3a0f8c8
    • Akinobu Mita's avatar
      MIPS: Sibyte: Use hweight8 instead of counting bits · 13e79b46
      Akinobu Mita authored
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/637/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      13e79b46
    • Wu Zhangjin's avatar
      MIPS: Yeeloong 2F: Add board specific suspend support · a9e8641f
      Wu Zhangjin authored
      Lemote Loongson 2F family machines need an external interrupt to wake the
      system from the suspend mode.
      
      For YeeLoong 2F and Mengloong 2F setup the keyboard interrupt as the wakeup
      interrupt.
      
      The new Fuloong 2F and LingLoong 2F have a button to directly send an
      interrupt to the CPU so there is no need to setup an interrupt.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: linux-pm@lists.linux-foundation.org
      Patchwork: http://patchwork.linux-mips.org/patch/630/Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      a9e8641f
    • Wu Zhangjin's avatar
      MIPS: Loongson 2F: Add suspend support framework · f181bf60
      Wu Zhangjin authored
      This patch add basic suspend support for loongson2f family machines,
      loongson2f have a specific feature: when we set it's frequency to ZERO,
      it will go into a wait mode, and then can be waked up by the external
      interrupt. so, if we setup suitable interrupts before putting it into
      wait mode, we will be able wake it up whenever we want via sending the
      relative interrupts to it.
      
      These interrupts are board-specific, Yeeloong2F use the keyboard
      interrupt and SCI interrupt, but LingLoong and Fuloong2F use the
      interrupts connected to the processors directly. and BTW: some old
      LingLoong and FuLoong2F have no such interrupts connected, so, there is
      no way to wake them up from suspend mode. and therefore, please do not
      enable the kernel support for them.
      
      The board-specific support will be added in the coming patches.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: linux-pm@lists.linux-foundation.org
      Patchwork: http://patchwork.linux-mips.org/patch/629/Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      f181bf60
    • Wu Zhangjin's avatar
      MIPS: Add support for uncached accelerated mappings. · 22f1fdfd
      Wu Zhangjin authored
      Loongson2f support video acceleration.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/624/
      Patchwork: http://patchwork.linux-mips.org/patch/625/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      22f1fdfd
    • Wu Zhangjin's avatar
      MIPS: Loongson 2F: Cleanup the #if clauses · 55045ff5
      Wu Zhangjin authored
      This patch adds two new kernel options: CPU_SUPPORTS_CPUFREQ and
      CPU_SUPPORTS_ADDRWINCFG to describe the new features of Loongons 2F and
      replaces the several ugly #if clauses by them.
      
      These two options will be utilized by the future loongson revisions and
      related drivers such as the coming Loongson 2F CPUFreq driver.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: Wu Zhangjin <wuzhangjin@gmail.com>
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      55045ff5
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add defconfig file · 6e34358e
      Wu Zhangjin authored
      Add default config file for Lemote Loongson 2F family machines.  The
      resulting kernel image can be shared between Fuloong 2F, Yeeloong 2F and
      other Lemote Loongson 2F family machines.
      
      If you are using an old PMON, and not using a 2f box, please add a new
      command line argument in the boot.cfg.
      
      For example, add this argument for 8.9inches notebook:
      
          machtype=lemote-yeeloong-2f-8.9inches
      
      or
      
          machtype=8.9
      
      More information from arch/mips/loongson/common/machtype.c.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      6e34358e
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add reset support · 2ee98e0f
      Wu Zhangjin authored
      Fuloong 2F, Yeeloong 2F and Menglong 2F have different reset / shutdown
      logic.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      2ee98e0f
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add IRQ support · 6616db78
      Wu Zhangjin authored
      The generic i8259_irq() will make kernel hang on booting, so Loongson 2F
      needs its own polling method.
      
      IP6 is shared by the bonito interrupt and perfcounter interrupts.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      6616db78
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add PCI support · 1032bce3
      Wu Zhangjin authored
      PCI support for the Fuloong 2E and Lemote Loongson 2F family machines is
      mostly identical with the exception of CS5536 support.
      
      Rename ops-fuloong2e.c to ops-loongson2.c then add the CS5536 support to
      share most of the source code among Loongson machines.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      1032bce3
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add basic CS5536 VSM support · 22c21003
      Wu Zhangjin authored
      Lemote Loongson 2F family machines use CS5536 as their south bridge and need
      these lowlevel interfaces to access the devices on CS5536.
      
      Virtualize the legacy devices on CS5536 as PCI devices.  This way users can
      access the CS5536 PCI config space directly as a normal multi-function
      PCI 2.2 device.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      22c21003
    • Wu Zhangjin's avatar
      MIPS: Lemote 2f: Enable legacy RTC driver · 21a41faa
      Wu Zhangjin authored
      Currently rtclib is not available on Loongson family machines but the
      legacy RTC driver works well on them.  Deselect RTC_LIB to allow the legacy
      RTC driver to be selected.
      
      The rtclib patch series
      
         http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=a91e34bf2595157830d599cb66becd52247b1819.1257383766.git.wuzhangjin%40gmail.com
      
      or, in patchworks:
      
         http://patchwork.linux-mips.org/patch/570/
         http://patchwork.linux-mips.org/patch/571/
         http://patchwork.linux-mips.org/patch/572/
      
      is eventually going to switch Lemote platforms to rtclib.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com 
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      21a41faa
    • Wu Zhangjin's avatar
      MIPS: Lemote 2F: Add a LEMOTE_MACH2F kernel option · 7d32c6dd
      Wu Zhangjin authored
      Add a new kernel option for Lemote Loongson 2F family machines.
      
      Lemote loongson2f family machines utilize the 2f revision of loongson
      processor and the AMD CS5536 south bridge.
      
      Family members include Fuloong 2F mini PC, Yeeloong 2F notebook, LingLoong
      all-in-one PC and others.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: zhangfx@lemote.com
      Cc: yanh@lemote.com
      Cc: huhb@lemote.com
      Cc: Nicholas Mc Guire <hofrat@hofr.at>
      Cc: Arnaud Patard <apatard@mandriva.com>
      Cc: loongson-dev@googlegroups.com
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      7d32c6dd
    • Wu Zhangjin's avatar
      MIPS: Loongson: Add basic Loongson 2F support · 6f7a251a
      Wu Zhangjin authored
      Loongson 2F has built-in DDR2 and PCI-X controller. The PCI-X controller
      has a programming interface similiar to the the FPGA northbridge used on
      Loongson 2E.
      
      The main differences between Loongson 2E and Loongson 2F include:
      
      1. Loongson 2F has an extra address window configuration module, which
         is used to map CPU address space to DDR or PCI address space, or map
         the PCI-DMA address space to DDR or LIO address space.
      
      2. Loongson 2F supports 8 levels of software configurable CPu frequency
         which can be configured in the LOONGSON_CHIPCFG0 register.  The coming
         cpufreq and standby support are based on this feature.
      
      Loongson.h abstracts the modules and corresponding methods are abstracted.
      
      Add other Loongson-2F-specific source code including gcc 4.4 support, PCI
      memory space, PCI IO space, DMA address.
      Signed-off-by: default avatarWu Zhangjin <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      6f7a251a