aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/loongson/common
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2009-07-02 11:26:45 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-09-17 14:07:47 -0400
commit85749d24bcf90440b10394312e5b1c96d1a62cdb (patch)
treee244d0d79d24e066871ae207a851d38973d57345 /arch/mips/loongson/common
parent8e4971175acc910eb4258df82a6bd8f2c4e4e5b5 (diff)
MIPS: Loongson: Split common loongson source code out
To share common loongson source code between all of the loongson-based machines. there is a need to split it out of the fuloong-2e/ directory. at the same time, other according tuning is needed. the machine-specific parts are defined as macros in relative header file, pci.h, mem.h, machine.h. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/loongson/common')
-rw-r--r--arch/mips/loongson/common/Makefile11
-rw-r--r--arch/mips/loongson/common/bonito-irq.c51
-rw-r--r--arch/mips/loongson/common/cmdline.c52
-rw-r--r--arch/mips/loongson/common/early_printk.c38
-rw-r--r--arch/mips/loongson/common/env.c58
-rw-r--r--arch/mips/loongson/common/init.c30
-rw-r--r--arch/mips/loongson/common/irq.c74
-rw-r--r--arch/mips/loongson/common/machtype.c17
-rw-r--r--arch/mips/loongson/common/mem.c35
-rw-r--r--arch/mips/loongson/common/pci.c83
-rw-r--r--arch/mips/loongson/common/reset.c44
-rw-r--r--arch/mips/loongson/common/setup.c58
-rw-r--r--arch/mips/loongson/common/time.c27
13 files changed, 578 insertions, 0 deletions
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
new file mode 100644
index 000000000000..4e3889dec39e
--- /dev/null
+++ b/arch/mips/loongson/common/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for loongson based machines.
3#
4
5obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \
6 pci.o bonito-irq.o mem.o
7
8#
9# Early printk support
10#
11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
diff --git a/arch/mips/loongson/common/bonito-irq.c b/arch/mips/loongson/common/bonito-irq.c
new file mode 100644
index 000000000000..3e31e7ad713e
--- /dev/null
+++ b/arch/mips/loongson/common/bonito-irq.c
@@ -0,0 +1,51 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org)
5 *
6 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
7 * Author: Fuxin Zhang, zhangfx@lemote.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#include <linux/interrupt.h>
15
16#include <loongson.h>
17
18static inline void bonito_irq_enable(unsigned int irq)
19{
20 BONITO_INTENSET = (1 << (irq - BONITO_IRQ_BASE));
21 mmiowb();
22}
23
24static inline void bonito_irq_disable(unsigned int irq)
25{
26 BONITO_INTENCLR = (1 << (irq - BONITO_IRQ_BASE));
27 mmiowb();
28}
29
30static struct irq_chip bonito_irq_type = {
31 .name = "bonito_irq",
32 .ack = bonito_irq_disable,
33 .mask = bonito_irq_disable,
34 .mask_ack = bonito_irq_disable,
35 .unmask = bonito_irq_enable,
36};
37
38static struct irqaction dma_timeout_irqaction = {
39 .handler = no_action,
40 .name = "dma_timeout",
41};
42
43void bonito_irq_init(void)
44{
45 u32 i;
46
47 for (i = BONITO_IRQ_BASE; i < BONITO_IRQ_BASE + 32; i++)
48 set_irq_chip_and_handler(i, &bonito_irq_type, handle_level_irq);
49
50 setup_irq(BONITO_IRQ_BASE + 10, &dma_timeout_irqaction);
51}
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson/common/cmdline.c
new file mode 100644
index 000000000000..75f1b243ee4e
--- /dev/null
+++ b/arch/mips/loongson/common/cmdline.c
@@ -0,0 +1,52 @@
1/*
2 * Based on Ocelot Linux port, which is
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: jsun@mvista.com or jsun@junsun.net
5 *
6 * Copyright 2003 ICT CAS
7 * Author: Michael Guo <guoyi@ict.ac.cn>
8 *
9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
10 * Author: Fuxin Zhang, zhangfx@lemote.com
11 *
12 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
13 * Author: Wu Zhangjin, wuzj@lemote.com
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20#include <asm/bootinfo.h>
21
22#include <loongson.h>
23
24int prom_argc;
25/* pmon passes arguments in 32bit pointers */
26int *_prom_argv;
27
28void __init prom_init_cmdline(void)
29{
30 int i;
31 long l;
32
33 /* firmware arguments are initialized in head.S */
34 prom_argc = fw_arg0;
35 _prom_argv = (int *)fw_arg1;
36
37 /* arg[0] is "g", the rest is boot parameters */
38 arcs_cmdline[0] = '\0';
39 for (i = 1; i < prom_argc; i++) {
40 l = (long)_prom_argv[i];
41 if (strlen(arcs_cmdline) + strlen(((char *)l) + 1)
42 >= sizeof(arcs_cmdline))
43 break;
44 strcat(arcs_cmdline, ((char *)l));
45 strcat(arcs_cmdline, " ");
46 }
47
48 if ((strstr(arcs_cmdline, "console=")) == NULL)
49 strcat(arcs_cmdline, " console=ttyS0,115200");
50 if ((strstr(arcs_cmdline, "root=")) == NULL)
51 strcat(arcs_cmdline, " root=/dev/hda1");
52}
diff --git a/arch/mips/loongson/common/early_printk.c b/arch/mips/loongson/common/early_printk.c
new file mode 100644
index 000000000000..bc73edc0cfd8
--- /dev/null
+++ b/arch/mips/loongson/common/early_printk.c
@@ -0,0 +1,38 @@
1/* early printk support
2 *
3 * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
4 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
5 * Author: Wu Zhangjin, wuzj@lemote.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <linux/serial_reg.h>
13
14#include <loongson.h>
15#include <machine.h>
16
17#define PORT(base, offset) (u8 *)(base + offset)
18
19static inline unsigned int serial_in(phys_addr_t base, int offset)
20{
21 return readb(PORT(base, offset));
22}
23
24static inline void serial_out(phys_addr_t base, int offset, int value)
25{
26 writeb(value, PORT(base, offset));
27}
28
29void prom_putchar(char c)
30{
31 phys_addr_t uart_base =
32 (phys_addr_t) ioremap_nocache(LOONGSON_UART_BASE, 8);
33
34 while ((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0)
35 ;
36
37 serial_out(uart_base, UART_TX, c);
38}
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c
new file mode 100644
index 000000000000..b9ef50385541
--- /dev/null
+++ b/arch/mips/loongson/common/env.c
@@ -0,0 +1,58 @@
1/*
2 * Based on Ocelot Linux port, which is
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: jsun@mvista.com or jsun@junsun.net
5 *
6 * Copyright 2003 ICT CAS
7 * Author: Michael Guo <guoyi@ict.ac.cn>
8 *
9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
10 * Author: Fuxin Zhang, zhangfx@lemote.com
11 *
12 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
13 * Author: Wu Zhangjin, wuzj@lemote.com
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20#include <asm/bootinfo.h>
21
22#include <loongson.h>
23
24unsigned long bus_clock, cpu_clock_freq;
25unsigned long memsize, highmemsize;
26
27/* pmon passes arguments in 32bit pointers */
28int *_prom_envp;
29
30#define parse_even_earlier(res, option, p) \
31do { \
32 if (strncmp(option, (char *)p, strlen(option)) == 0) \
33 strict_strtol((char *)p + strlen(option"="), \
34 10, &res); \
35} while (0)
36
37void __init prom_init_env(void)
38{
39 long l;
40
41 /* firmware arguments are initialized in head.S */
42 _prom_envp = (int *)fw_arg2;
43
44 l = (long)*_prom_envp;
45 while (l != 0) {
46 parse_even_earlier(bus_clock, "busclock", l);
47 parse_even_earlier(cpu_clock_freq, "cpuclock", l);
48 parse_even_earlier(memsize, "memsize", l);
49 parse_even_earlier(highmemsize, "highmemsize", l);
50 _prom_envp++;
51 l = (long)*_prom_envp;
52 }
53 if (memsize == 0)
54 memsize = 256;
55
56 pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n",
57 bus_clock, cpu_clock_freq, memsize, highmemsize);
58}
diff --git a/arch/mips/loongson/common/init.c b/arch/mips/loongson/common/init.c
new file mode 100644
index 000000000000..3abe927422a3
--- /dev/null
+++ b/arch/mips/loongson/common/init.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
3 * Author: Wu Zhangjin, wuzj@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/bootmem.h>
12
13#include <asm/bootinfo.h>
14
15#include <loongson.h>
16
17void __init prom_init(void)
18{
19 /* init base address of io space */
20 set_io_port_base((unsigned long)
21 ioremap(BONITO_PCIIO_BASE, BONITO_PCIIO_SIZE));
22
23 prom_init_cmdline();
24 prom_init_env();
25 prom_init_memory();
26}
27
28void __init prom_free_prom_memory(void)
29{
30}
diff --git a/arch/mips/loongson/common/irq.c b/arch/mips/loongson/common/irq.c
new file mode 100644
index 000000000000..f368c735cbd3
--- /dev/null
+++ b/arch/mips/loongson/common/irq.c
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#include <linux/delay.h>
11#include <linux/interrupt.h>
12
13#include <loongson.h>
14/*
15 * the first level int-handler will jump here if it is a bonito irq
16 */
17void bonito_irqdispatch(void)
18{
19 u32 int_status;
20 int i;
21
22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */
23 int_status = BONITO_INTISR;
24 if (int_status & (1 << 10)) {
25 while (int_status & (1 << 10)) {
26 udelay(1);
27 int_status = BONITO_INTISR;
28 }
29 }
30
31 /* Get pending sources, masked by current enables */
32 int_status = BONITO_INTISR & BONITO_INTEN;
33
34 if (int_status != 0) {
35 i = __ffs(int_status);
36 int_status &= ~(1 << i);
37 do_IRQ(BONITO_IRQ_BASE + i);
38 }
39}
40
41asmlinkage void plat_irq_dispatch(void)
42{
43 unsigned int pending;
44
45 pending = read_c0_cause() & read_c0_status() & ST0_IM;
46
47 /* machine-specific plat_irq_dispatch */
48 mach_irq_dispatch(pending);
49}
50
51void __init arch_init_irq(void)
52{
53 /*
54 * Clear all of the interrupts while we change the able around a bit.
55 * int-handler is not on bootstrap
56 */
57 clear_c0_status(ST0_IM | ST0_BEV);
58 local_irq_disable();
59
60 /* setting irq trigger mode */
61 set_irq_trigger_mode();
62
63 /* no steer */
64 BONITO_INTSTEER = 0;
65
66 /*
67 * Mask out all interrupt by writing "1" to all bit position in
68 * the interrupt reset reg.
69 */
70 BONITO_INTENCLR = ~0;
71
72 /* machine specific irq init */
73 mach_init_irq();
74}
diff --git a/arch/mips/loongson/common/machtype.c b/arch/mips/loongson/common/machtype.c
new file mode 100644
index 000000000000..845b3fb47e0f
--- /dev/null
+++ b/arch/mips/loongson/common/machtype.c
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
3 * Author: Wu Zhangjin, wuzj@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <machine.h>
12
13const char *get_system_type(void)
14{
15 return LOONGSON_MACHNAME;
16}
17
diff --git a/arch/mips/loongson/common/mem.c b/arch/mips/loongson/common/mem.c
new file mode 100644
index 000000000000..7c92f79b6480
--- /dev/null
+++ b/arch/mips/loongson/common/mem.c
@@ -0,0 +1,35 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 */
7#include <linux/fs.h>
8#include <linux/fcntl.h>
9#include <linux/mm.h>
10
11#include <asm/bootinfo.h>
12
13#include <loongson.h>
14#include <mem.h>
15
16void __init prom_init_memory(void)
17{
18 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
19#ifdef CONFIG_64BIT
20 if (highmemsize > 0)
21 add_memory_region(LOONGSON_HIGHMEM_START,
22 highmemsize << 20, BOOT_MEM_RAM);
23#endif /* CONFIG_64BIT */
24}
25
26/* override of arch/mips/mm/cache.c: __uncached_access */
27int __uncached_access(struct file *file, unsigned long addr)
28{
29 if (file->f_flags & O_SYNC)
30 return 1;
31
32 return addr >= __pa(high_memory) ||
33 ((addr >= LOONGSON_MMIO_MEM_START) &&
34 (addr < LOONGSON_MMIO_MEM_END));
35}
diff --git a/arch/mips/loongson/common/pci.c b/arch/mips/loongson/common/pci.c
new file mode 100644
index 000000000000..a3a4abfb6c9a
--- /dev/null
+++ b/arch/mips/loongson/common/pci.c
@@ -0,0 +1,83 @@
1/*
2 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#include <linux/pci.h>
11
12#include <pci.h>
13#include <loongson.h>
14
15static struct resource loongson_pci_mem_resource = {
16 .name = "pci memory space",
17 .start = LOONGSON_PCI_MEM_START,
18 .end = LOONGSON_PCI_MEM_END,
19 .flags = IORESOURCE_MEM,
20};
21
22static struct resource loongson_pci_io_resource = {
23 .name = "pci io space",
24 .start = LOONGSON_PCI_IO_START,
25 .end = IO_SPACE_LIMIT,
26 .flags = IORESOURCE_IO,
27};
28
29static struct pci_controller loongson_pci_controller = {
30 .pci_ops = &bonito64_pci_ops,
31 .io_resource = &loongson_pci_io_resource,
32 .mem_resource = &loongson_pci_mem_resource,
33 .mem_offset = 0x00000000UL,
34 .io_offset = 0x00000000UL,
35};
36
37static void __init setup_pcimap(void)
38{
39 /*
40 * local to PCI mapping for CPU accessing PCI space
41 * CPU address space [256M,448M] is window for accessing pci space
42 * we set pcimap_lo[0,1,2] to map it to pci space[0M,64M], [320M,448M]
43 *
44 * pcimap: PCI_MAP2 PCI_Mem_Lo2 PCI_Mem_Lo1 PCI_Mem_Lo0
45 * [<2G] [384M,448M] [320M,384M] [0M,64M]
46 */
47 BONITO_PCIMAP = BONITO_PCIMAP_PCIMAP_2 |
48 BONITO_PCIMAP_WIN(2, BONITO_PCILO2_BASE) |
49 BONITO_PCIMAP_WIN(1, BONITO_PCILO1_BASE) |
50 BONITO_PCIMAP_WIN(0, 0);
51
52 /*
53 * PCI-DMA to local mapping: [2G,2G+256M] -> [0M,256M]
54 */
55 BONITO_PCIBASE0 = 0x80000000ul; /* base: 2G -> mmap: 0M */
56 /* size: 256M, burst transmission, pre-fetch enable, 64bit */
57 LOONGSON_PCI_HIT0_SEL_L = 0xc000000cul;
58 LOONGSON_PCI_HIT0_SEL_H = 0xfffffffful;
59 LOONGSON_PCI_HIT1_SEL_L = 0x00000006ul; /* set this BAR as invalid */
60 LOONGSON_PCI_HIT1_SEL_H = 0x00000000ul;
61 LOONGSON_PCI_HIT2_SEL_L = 0x00000006ul; /* set this BAR as invalid */
62 LOONGSON_PCI_HIT2_SEL_H = 0x00000000ul;
63
64 /* avoid deadlock of PCI reading/writing lock operation */
65 LOONGSON_PCI_ISR4C = 0xd2000001ul;
66
67 /* can not change gnt to break pci transfer when device's gnt not
68 deassert for some broken device */
69 LOONGSON_PXARB_CFG = 0x00fe0105ul;
70}
71
72static int __init pcibios_init(void)
73{
74 setup_pcimap();
75
76 loongson_pci_controller.io_map_base = mips_io_port_base;
77
78 register_pci_controller(&loongson_pci_controller);
79
80 return 0;
81}
82
83arch_initcall(pcibios_init);
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson/common/reset.c
new file mode 100644
index 000000000000..97e918251edd
--- /dev/null
+++ b/arch/mips/loongson/common/reset.c
@@ -0,0 +1,44 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
8 * Author: Fuxin Zhang, zhangfx@lemote.com
9 * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
10 * Author: Zhangjin Wu, wuzj@lemote.com
11 */
12#include <linux/init.h>
13#include <linux/pm.h>
14
15#include <asm/reboot.h>
16
17#include <loongson.h>
18
19static void loongson_restart(char *command)
20{
21 /* do preparation for reboot */
22 mach_prepare_reboot();
23
24 /* reboot via jumping to boot base address */
25 ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) ();
26}
27
28static void loongson_halt(void)
29{
30 mach_prepare_shutdown();
31 while (1)
32 ;
33}
34
35static int __init mips_reboot_setup(void)
36{
37 _machine_restart = loongson_restart;
38 _machine_halt = loongson_halt;
39 pm_power_off = loongson_halt;
40
41 return 0;
42}
43
44arch_initcall(mips_reboot_setup);
diff --git a/arch/mips/loongson/common/setup.c b/arch/mips/loongson/common/setup.c
new file mode 100644
index 000000000000..4cd2aa9a342c
--- /dev/null
+++ b/arch/mips/loongson/common/setup.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#include <linux/module.h>
11
12#include <asm/wbflush.h>
13
14#include <loongson.h>
15
16#ifdef CONFIG_VT
17#include <linux/console.h>
18#include <linux/screen_info.h>
19#endif
20
21void (*__wbflush)(void);
22EXPORT_SYMBOL(__wbflush);
23
24static void wbflush_loongson(void)
25{
26 asm(".set\tpush\n\t"
27 ".set\tnoreorder\n\t"
28 ".set mips3\n\t"
29 "sync\n\t"
30 "nop\n\t"
31 ".set\tpop\n\t"
32 ".set mips0\n\t");
33}
34
35void __init plat_mem_setup(void)
36{
37 __wbflush = wbflush_loongson;
38
39#ifdef CONFIG_VT
40#if defined(CONFIG_VGA_CONSOLE)
41 conswitchp = &vga_con;
42
43 screen_info = (struct screen_info) {
44 0, 25, /* orig-x, orig-y */
45 0, /* unused */
46 0, /* orig-video-page */
47 0, /* orig-video-mode */
48 80, /* orig-video-cols */
49 0, 0, 0, /* ega_ax, ega_bx, ega_cx */
50 25, /* orig-video-lines */
51 VIDEO_TYPE_VGAC, /* orig-video-isVGA */
52 16 /* orig-video-points */
53 };
54#elif defined(CONFIG_DUMMY_CONSOLE)
55 conswitchp = &dummy_con;
56#endif
57#endif
58}
diff --git a/arch/mips/loongson/common/time.c b/arch/mips/loongson/common/time.c
new file mode 100644
index 000000000000..b13d17174654
--- /dev/null
+++ b/arch/mips/loongson/common/time.c
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 *
5 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
6 * Author: Wu Zhangjin, wuzj@lemote.com
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <asm/mc146818-time.h>
14#include <asm/time.h>
15
16#include <loongson.h>
17
18void __init plat_time_init(void)
19{
20 /* setup mips r4k timer */
21 mips_hpt_frequency = cpu_clock_freq / 2;
22}
23
24unsigned long read_persistent_clock(void)
25{
26 return mc146818_get_cmos_time();
27}