Commit Graph

58 Commits

Author SHA1 Message Date
Wu Zhangjin e608aadd17 MIPS: Loongson: Remove unused macro LOONGSON_PERFCNT_IRQ
LOONGSON2_PERFCNT_IRQ is used for the irq number of the performance
overflow interrupts; LOONGSON_PERFCNT_IRQ is unused so remove it.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/1494/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-08-05 13:26:26 +01:00
Wu Zhangjin de3bc0e7ba MIPS: Loongson: Oprofile: add a new do_perfcnt_IRQ()
On FuLoong-2F IP6 is shared by the performance counter overflow interrupt
and the Bonito northbridge interrupt.  To reduce overhead only call
do_IRQ() when oprofile is enabled to reduce overhead.

This patch adds an inline function do_perfcnt_IRQ() to hide the #if's ,
which can be shared by the other Loongson machines, i.e. gdium.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/1492/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-08-05 13:26:24 +01:00
Wu Zhangjin b8c7428af0 MIPS: Loongson: Remove set_irq_trigger_mode()
set_irq_trigger_mode() is not needed on all platforms so remove it
and move the related source code to mach_init_irq().

This will allow gdium to share the common irq.c without adding an empty
set_irq_trigger_mode().

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/1493/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-08-05 13:26:23 +01:00
Shinya Kuribayashi f5c1ca77a3 MIPS: Loongson: irq.c: Misc cleanups
* Remove unnecessary 'if (int_status & (1 <<10))' statement
* s/if (foo != 0)/if (foo)/
* Remove unused 'inst_status &= ~(1 << i);' line

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
To: wuzhangjin@gmail.com
CC: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/1433/
Acked-by: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-08-05 13:26:05 +01:00
Wu Zhangjin 28c945c886 MIPS: Loongson: Migrate makefile to new Platform file
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
To: linux-mips <linux-mips@linux-mips.org>
Cc: Alexander Clouter <alex@digriz.org.uk>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>,
Patchwork: https://patchwork.linux-mips.org/patch/1313/
Patchwork: https://patchwork.linux-mips.org/patch/1326/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-08-05 13:25:45 +01:00
Arnaud Patard 5df7435287 MIPS: Loongson: Define rtc device on MC146818-equipped systems
This patch declare the rtc device present on systems with clock compatible
with the mc146818 and handled by rtc-cmos.  Introduce a new Kconfig entry
because there are some systems without rtc_cmos compatible clock.

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
To: linux-mips@linux-mips.org
Cc: aba@not.so.argh.org
Patchwork: http://patchwork.linux-mips.org/patch/1320/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-07-05 17:17:32 +01:00
Wu Zhangjin 4085467060 MIPS: Loongson: CS5536: Fix ISA support
The function _wrmsr() called by divil_lbar_disable()/enable() should be
called with the offset as the argument.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Zhang Le <r0bertz@gentoo.org>
Patchwork: http://patchwork.linux-mips.org/patch/1252/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-07-05 17:17:22 +01:00
Wu Zhangjin aa5f858b16 MIPS: Loongson: Add a missing break statement in CS5536 IDE code
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Zhang Le <r0bertz@gentoo.org>
Cc: Hu Hongbing <huhb@lemote.com>
Patchwork: http://patchwork.linux-mips.org/patch/1251/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-07-05 17:17:21 +01:00
Wu Zhangjin f18b2f67ea MIPS: Loongson: CS5536: Add missing RDMSRs for IDE and USB
Add several missing RDMSRs for IDE and USB are missing to avoid the
agressive modification of the high 32 bits of the MSR.

Without this patch some usb devices may fail after printing "reset ehci
host ....." when reading the partition information.

Signed-off-by: Hu Hongbing <huhb@lemote.com>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Zhang Le <r0bertz@gentoo.org>
Cc: Hu Hongbing <huhb@lemote.com>
Patchwork: http://patchwork.linux-mips.org/patch/1250/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-07-05 17:17:20 +01:00
Arnaud Patard c197da9163 MIPS: Loongson 2F: Add gpio/gpioilb support
Signed-off-by: Arnaud Patard <apatard@mandriva.com>
To: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/1163/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-05-21 21:31:16 +01:00
Wu Zhangjin 64fc74f5f6 MIPS: Loongson 2F: Fix of problems introduced by -mfix-loongson2f-jump
The -mfix-loongson2f-jump option provided by latest CVS binutils have fixed
the out-of-order issue of Loongson-2F described in chapter 15 of the
Loongson2F User Manual [1, 2], but introduced some problems.

The option changes all of the jump target to "addr & 0xcfffffff" through the
at($1) register, but for the reboot address of Loongson 2F 0xbfc00000 this is
wrong.  Avoids the problem via telling the assembler to not use the $at
register.

[1] Loongson2F User Manual (Chinese Version)
    http://www.loongson.cn/uploadfile/file/200808211
[2] English Version of Chapter 15:
    http://groups.google.com.hk/group/loongson-dev/msg/e0d2e220958f10a6?dmode=source

Reported-and-tested-by: Liu Shiwei <liushiwei@gmail.com>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips <linux-mips@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/1109/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-04-30 20:52:58 +01:00
Wu Zhangjin 922010ff7b MIPS: oprofile: Fix breakage when CONFIG_OPROFILE=m
When the oprofile is compiled as a module do_IRQ() is not called in
arch/mips/loongson/lemote-2f/irq.c due to a wrong #ifdef there.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/1143/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-04-30 20:52:54 +01:00
Arnaud Patard 514b6d0c06 MIPS: Loongson: Fix phys_mem_access_prot() check
The check used to determine if uncached accelerated should be used or not
is wrong. The parenthesis are misplaced and making the test fail.

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
To: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/1161/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-04-30 20:52:51 +01:00
Richard LIU ff40ad72ad MIPS: Loongson: Fix find_vga_mem_init()
This allows to use all display device for instance DISPLAY_OTHER like SM501.

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
To: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/1160/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-04-30 20:52:50 +01:00
Arnaud Patard 1c6d541c23 MIPS: Loongson: Fix typo in gdium mach type string.
It's not "gidum" but "gdium".

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/1159/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-04-30 20:52:49 +01:00
Sebastian Andrzej Siewior b20947aaa0 MIPS: Fixup screen_info struct initializations
|arch/mips/sibyte/swarm/setup.c:153:
| warning: large integer implicitly truncated to unsigned type

The field was changed in d9b26352 aka ("x86, setup: Store the boot
cursor state").  This patch changes the values back they way they were
before this extra field got introduced.

While here, the other two boards are also converted to C99 initializer.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/1137/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-04-30 20:52:42 +01:00
Ralf Baechle 3b439470e3 MIPS: Lemote 2F: Move printks out of port_access_lock.
No point in protecting them and printks are sloow.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:41 +01:00
Ralf Baechle 8965087055 MIPS: i8259: Convert IRQ controller lock to raw spinlock.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:38 +01:00
Wu Zhangjin fc48c41af8 MIPS: Loongson: Cleanup the halt and poweroff action
In the old source code, I have let halt and poweroff do the same action,
but in reality, they have different meanings.

As the manpage of shutdown shows:

-r     Reboot after shutdown.
-H     Halt action is to halt or drop into boot monitor on systems that support it.
-P     Halt action is to turn off the power.

and in the real world, some machines(e.g. NAS) did not provide a power
button and the shutdown works as reset, so, we need to provide a
mechanism to let the users turn off the power safely without breaking
the system, such a mechanism is "halt", which only put the system into a
dead loop or a power-save mode and print some information to the screen
to tell the users to turn off the power safely.

$ shutdown -hH now /* loongson_halt, not turn off the power */
$ shutdown -hP now /* loongson_poweroff, work as poweroff */

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Tested-by: Liu Shiwei <liushiwei@gmail.com>
Cc: Liu Shiwei <liushiwei@gmail.com>
Cc: linux-mips <linux-mips@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/883/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:17 +01:00
Wu Zhangjin f7a904dffe MIPS: Loongson: Change the Email address of Wu Zhangjin
Currently wuzj@lemote.com is not usable; change it to wuzhangjin@gmail.com.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: zhangfx@lemote.com
Patchwork: http://patchwork.linux-mips.org/patch/829/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:12 +01:00
Wu Zhangjin 50549bda2d MIPS: Loongson: Fixup mem.c indentation
Replace whitespace by tabs.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: zhangfx@lemote.com
Patchwork: http://patchwork.linux-mips.org/patch/828/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:11 +01:00
Wu Zhangjin eb11df472d MIPS: Loongson: Cleanup of the environment variables
Changes:

	o Move bus_clock into prom_init_env()
	o Initialize the cpu_clock_freq to the default values for the
	correspoding processor revisions if no such environment variable
	passed by BIOS/Bootloader.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: zhangfx@lemote.com
Patchwork: http://patchwork.linux-mips.org/patch/826/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:11 +01:00
Wu Zhangjin 97e6a89634 MIPS: Loongson: Move prom_argc and prom_argv into prom_init_cmdline()
prom_argc and prom_argv are only used by prom_init_cmdline(), move them
into the function.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: zhangfx@lemote.com
Patchwork: http://patchwork.linux-mips.org/patch/825/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:10 +01:00
Wu Zhangjin 6f32096598 MIPS: Loongson: Convert loongson_halt() to use unreachable()
Use the new unreachable() macro instead of while(1);

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: zhangfx@lemote.com
Patchwork: http://patchwork.linux-mips.org/patch/823/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:10 +01:00
Wu Zhangjin 1b39a0bad5 MIPS: Loongson: Lemote-2F: Get the machine type from PMON_VER
Lemote have used the PMON_VER strings to indicate the loongson-2f
machine series:

 	PMON_VER=LM8089		Lemote 8.9'' netbook
 	         LM8101		Lemote 10.1'' netbook
 	(The above two netbooks have the same kernel support)
	         LM6XXX		Lemote FuLoong(2F) box series
	         LM9XXX		Lemote LynLoong PC series

Before the machtype is supported by the PMON, we can get the machine
type from the PMON_VER for these machines, this will help the users a
lot.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: zhangfx@lemote.com
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/821/
Patchwork: http://patchwork.linux-mips.org/patch/908/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:53:09 +01:00
Wu Zhangjin c3d8d85019 MIPS: Loongson: Cleanups of serial port support
This patchs uses a loongson_uart_base variable instead of the
uart_base[] array and adds a new kernel option to avoid to compile
uart_base.c all the time, which will save a little bit of memory for us.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
http://patchwork.linux-mips.org/patch/727/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:34 +00:00
Wu Zhangjin c47a48d83a MIPS: Lemote 2F: Suspend CS5536 MFGPT Timer
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: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/706/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:33 +00:00
Wu Zhangjin 70ab711df4 MIPS: Yeeloong 2F: Cleanup reset logic using the new ec_write function
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/683/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:29 +00:00
Wu Zhangjin cb1ed9e117 MIPS: Yeeloong 2F: Add LID open event as the wakeup event
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: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/685/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:28 +00:00
Wu Zhangjin ec614d80b5 MIPS: Yeeloong 2F: Add basic EC operations
YeeLoong2F has a KB3310b embedded controller. Add basic operations for
future related drivers and board support.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/684/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:27 +00:00
Wu Zhangjin f8ede0f700 MIPS: Loongson 2F: Add CPU frequency scaling support
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: Wu 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: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:20 +00:00
Wu Zhangjin 916daba8a9 MIPS: Lemote 2F: Add cs5536 MFGPT timer support
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: Wu 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: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:19 +00:00
Wu Zhangjin 6e552c9b3a MIPS: Lemote 2F: Add Lynloong support
Add a new machtype and kernel options for the Lynloong.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/657/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:18 +00:00
Wu Zhangjin e13fb77661 MIPS: Lemote 2F: Add NAS support
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: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/656/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:18 +00:00
Wu Zhangjin a9e8641f4c MIPS: Yeeloong 2F: Add board specific suspend support
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: Wu 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: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:16 +00:00
Wu Zhangjin f181bf60e3 MIPS: Loongson 2F: Add suspend support framework
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: Wu 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: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:16 +00:00
Wu Zhangjin 22f1fdfd62 MIPS: Add support for uncached accelerated mappings.
Loongson2f support video acceleration.

Signed-off-by: Wu 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: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:15 +00:00
Wu Zhangjin 55045ff555 MIPS: Loongson 2F: Cleanup the #if clauses
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: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:15 +00:00
Wu Zhangjin 2ee98e0f46 MIPS: Lemote 2F: Add reset support
Fuloong 2F, Yeeloong 2F and Menglong 2F have different reset / shutdown
logic.

Signed-off-by: Wu 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: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:14 +00:00
Wu Zhangjin 6616db78ee MIPS: Lemote 2F: Add IRQ support
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: Wu 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: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:13 +00:00
Wu Zhangjin 22c21003a9 MIPS: Lemote 2F: Add basic CS5536 VSM support
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: Wu 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: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:12 +00:00
Wu Zhangjin 7d32c6dd81 MIPS: Lemote 2F: Add a LEMOTE_MACH2F kernel option
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: Wu 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: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:11 +00:00
Wu Zhangjin 6f7a251a25 MIPS: Loongson: Add basic Loongson 2F support
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: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:10 +00:00
Wu Zhangjin a3ed495190 MIPS: Loongson: Cleanup the serial port support
To share the same kernel image amon different machines we have added the
machtype command line support.

In the old serial port implementation the UART base address is hardcoded as
a macro in machine.h which breaks with machtype, so change that to discover
the address dynamically.  Also move the initialization of the UART base
address to uart_base.c to avoid remapping twice for early_printk.c and
serial.c.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/581/
Patchwork: http://patchwork.linux-mips.org/patch/682/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:09 +00:00
Wu Zhangjin 04cfb90a92 MIPS: Loongson: Cleanup machtype support
To choose code for different machines by the value of machtype it needs to
be initialized as early as possible.  So move initialization of
mips_machtype to prom_init().

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:08 +00:00
Wu Zhangjin e2fee5723b MIPS: Bonito64: Make Loongson independent from Bonito64 code.
The built-in Loongson 2E/2F northbridge in is bonito64-compatible but not
identical with it.  To avoid influencing the original bonito64 support and
make the loongson support more maintainable, it's better to separate the
Bonito64 code from the Loongson code.

This also prepares the kernel for the coming Loongson 2f machines family
support.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: Zhang Le <r0bertz@gentoo.org>
Cc: zhangfx@lemote.com,
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:06 +00:00
Wu Zhangjin e8be528388 MIPS: Loongson: Add serial port support
This patch add serial port support for all of the existing loongson
family machines. most of the board specific part are put in serial.c,
and the base address of the serial ports are defined as macros in
machine.h for sharing it between serial.c and early_printk.c

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: Zhang Le <r0bertz@gentoo.org>
Cc: zhangfx@lemote.com
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:04 +00:00
Wu Zhangjin db54ff246e MIPS: Loongson early_printk: Fix variable type of uart_base
The uart_base variable here is not a physical address, so, we replace it
by unsigned char *.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: Zhang Le <r0bertz@gentoo.org>
Cc: zhangfx@lemote.com
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:03 +00:00
Wu Zhangjin f6d4ff02c6 MIPS: Fuloong2e: Cleanup Kconfig
Changes indention from whitespace to tabs in arch/mips/loongson/Kconfig.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: Zhang Le <r0bertz@gentoo.org>
Cc: zhangfx@lemote.com
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:03 +00:00
Wu Zhangjin 659da2ba3e MIPS: Loongson: Register reserved memory pages
Register reserved pages for Loongson family machines.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Cc: yanh@lemote.com,
Cc: huhb@lemote.com
Cc: Zhang Le <r0bertz@gentoo.org>
Cc: zhangfx@lemote.com,
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:02 +00:00