aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lemote/lm2e
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lemote/lm2e')
-rw-r--r--arch/mips/lemote/lm2e/Makefile13
-rw-r--r--arch/mips/lemote/lm2e/bonito-irq.c51
-rw-r--r--arch/mips/lemote/lm2e/cmdline.c52
-rw-r--r--arch/mips/lemote/lm2e/early_printk.c39
-rw-r--r--arch/mips/lemote/lm2e/env.c58
-rw-r--r--arch/mips/lemote/lm2e/init.c30
-rw-r--r--arch/mips/lemote/lm2e/irq.c111
-rw-r--r--arch/mips/lemote/lm2e/machtype.c15
-rw-r--r--arch/mips/lemote/lm2e/mem.c36
-rw-r--r--arch/mips/lemote/lm2e/pci.c83
-rw-r--r--arch/mips/lemote/lm2e/setup.c58
-rw-r--r--arch/mips/lemote/lm2e/time.c27
12 files changed, 0 insertions, 573 deletions
diff --git a/arch/mips/lemote/lm2e/Makefile b/arch/mips/lemote/lm2e/Makefile
deleted file mode 100644
index a5bc1efc362a..000000000000
--- a/arch/mips/lemote/lm2e/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
1#
2# Makefile for Lemote Fulong mini-PC board.
3#
4
5obj-y += setup.o init.o reset.o irq.o pci.o bonito-irq.o mem.o \
6 env.o cmdline.o time.o machtype.o
7
8#
9# Early printk support
10#
11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/lemote/lm2e/bonito-irq.c b/arch/mips/lemote/lm2e/bonito-irq.c
deleted file mode 100644
index 3e31e7ad713e..000000000000
--- a/arch/mips/lemote/lm2e/bonito-irq.c
+++ /dev/null
@@ -1,51 +0,0 @@
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/lemote/lm2e/cmdline.c b/arch/mips/lemote/lm2e/cmdline.c
deleted file mode 100644
index 75f1b243ee4e..000000000000
--- a/arch/mips/lemote/lm2e/cmdline.c
+++ /dev/null
@@ -1,52 +0,0 @@
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/lemote/lm2e/early_printk.c b/arch/mips/lemote/lm2e/early_printk.c
deleted file mode 100644
index 3e0a6eaa4041..000000000000
--- a/arch/mips/lemote/lm2e/early_printk.c
+++ /dev/null
@@ -1,39 +0,0 @@
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
16#define UART_BASE (BONITO_PCIIO_BASE + 0x3f8)
17
18#define PORT(base, offset) (u8 *)(base + offset)
19
20static inline unsigned int serial_in(phys_addr_t base, int offset)
21{
22 return readb(PORT(base, offset));
23}
24
25static inline void serial_out(phys_addr_t base, int offset, int value)
26{
27 writeb(value, PORT(base, offset));
28}
29
30void prom_putchar(char c)
31{
32 phys_addr_t uart_base =
33 (phys_addr_t) ioremap_nocache(UART_BASE, 8);
34
35 while ((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0)
36 ;
37
38 serial_out(uart_base, UART_TX, c);
39}
diff --git a/arch/mips/lemote/lm2e/env.c b/arch/mips/lemote/lm2e/env.c
deleted file mode 100644
index b9ef50385541..000000000000
--- a/arch/mips/lemote/lm2e/env.c
+++ /dev/null
@@ -1,58 +0,0 @@
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/lemote/lm2e/init.c b/arch/mips/lemote/lm2e/init.c
deleted file mode 100644
index 3abe927422a3..000000000000
--- a/arch/mips/lemote/lm2e/init.c
+++ /dev/null
@@ -1,30 +0,0 @@
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/lemote/lm2e/irq.c b/arch/mips/lemote/lm2e/irq.c
deleted file mode 100644
index 9585f5aa7cce..000000000000
--- a/arch/mips/lemote/lm2e/irq.c
+++ /dev/null
@@ -1,111 +0,0 @@
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 <asm/irq_cpu.h>
14#include <asm/i8259.h>
15
16#include <loongson.h>
17/*
18 * the first level int-handler will jump here if it is a bonito irq
19 */
20static void bonito_irqdispatch(void)
21{
22 u32 int_status;
23 int i;
24
25 /* workaround the IO dma problem: let cpu looping to allow DMA finish */
26 int_status = BONITO_INTISR;
27 if (int_status & (1 << 10)) {
28 while (int_status & (1 << 10)) {
29 udelay(1);
30 int_status = BONITO_INTISR;
31 }
32 }
33
34 /* Get pending sources, masked by current enables */
35 int_status = BONITO_INTISR & BONITO_INTEN;
36
37 if (int_status != 0) {
38 i = __ffs(int_status);
39 int_status &= ~(1 << i);
40 do_IRQ(BONITO_IRQ_BASE + i);
41 }
42}
43
44static void i8259_irqdispatch(void)
45{
46 int irq;
47
48 irq = i8259_irq();
49 if (irq >= 0)
50 do_IRQ(irq);
51 else
52 spurious_interrupt();
53}
54
55asmlinkage void plat_irq_dispatch(void)
56{
57 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
58
59 if (pending & CAUSEF_IP7)
60 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
61 else if (pending & CAUSEF_IP6) /* perf counter loverflow */
62 do_IRQ(LOONGSON2_PERFCNT_IRQ);
63 else if (pending & CAUSEF_IP5)
64 i8259_irqdispatch();
65 else if (pending & CAUSEF_IP2)
66 bonito_irqdispatch();
67 else
68 spurious_interrupt();
69}
70
71static struct irqaction cascade_irqaction = {
72 .handler = no_action,
73 .name = "cascade",
74};
75
76void __init arch_init_irq(void)
77{
78 /*
79 * Clear all of the interrupts while we change the able around a bit.
80 * int-handler is not on bootstrap
81 */
82 clear_c0_status(ST0_IM | ST0_BEV);
83 local_irq_disable();
84
85 /* most bonito irq should be level triggered */
86 BONITO_INTEDGE = BONITO_ICU_SYSTEMERR | BONITO_ICU_MASTERERR |
87 BONITO_ICU_RETRYERR | BONITO_ICU_MBOXES;
88 BONITO_INTSTEER = 0;
89
90 /*
91 * Mask out all interrupt by writing "1" to all bit position in
92 * the interrupt reset reg.
93 */
94 BONITO_INTENCLR = ~0;
95
96 /* init all controller
97 * 0-15 ------> i8259 interrupt
98 * 16-23 ------> mips cpu interrupt
99 * 32-63 ------> bonito irq
100 */
101
102 /* Sets the first-level interrupt dispatcher. */
103 mips_cpu_irq_init();
104 init_i8259_irqs();
105 bonito_irq_init();
106
107 /* bonito irq at IP2 */
108 setup_irq(MIPS_CPU_IRQ_BASE + 2, &cascade_irqaction);
109 /* 8259 irq at IP5 */
110 setup_irq(MIPS_CPU_IRQ_BASE + 5, &cascade_irqaction);
111}
diff --git a/arch/mips/lemote/lm2e/machtype.c b/arch/mips/lemote/lm2e/machtype.c
deleted file mode 100644
index 8d803eea7872..000000000000
--- a/arch/mips/lemote/lm2e/machtype.c
+++ /dev/null
@@ -1,15 +0,0 @@
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
11const char *get_system_type(void)
12{
13 return "lemote-fulong";
14}
15
diff --git a/arch/mips/lemote/lm2e/mem.c b/arch/mips/lemote/lm2e/mem.c
deleted file mode 100644
index 6a7feb178fa5..000000000000
--- a/arch/mips/lemote/lm2e/mem.c
+++ /dev/null
@@ -1,36 +0,0 @@
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
15void __init prom_init_memory(void)
16{
17 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
18#ifdef CONFIG_64BIT
19 if (highmemsize > 0)
20 add_memory_region(0x20000000, highmemsize << 20, BOOT_MEM_RAM);
21#endif /* CONFIG_64BIT */
22}
23
24/* override of arch/mips/mm/cache.c: __uncached_access */
25int __uncached_access(struct file *file, unsigned long addr)
26{
27 if (file->f_flags & O_SYNC)
28 return 1;
29
30 /*
31 * On the Lemote Loongson 2e system, the peripheral registers
32 * reside between 0x1000:0000 and 0x2000:0000.
33 */
34 return addr >= __pa(high_memory) ||
35 ((addr >= 0x10000000) && (addr < 0x20000000));
36}
diff --git a/arch/mips/lemote/lm2e/pci.c b/arch/mips/lemote/lm2e/pci.c
deleted file mode 100644
index 9812c30cc6eb..000000000000
--- a/arch/mips/lemote/lm2e/pci.c
+++ /dev/null
@@ -1,83 +0,0 @@
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 loongson2e_pci_mem_resource = {
16 .name = "LOONGSON2E PCI MEM",
17 .start = LOONGSON2E_PCI_MEM_START,
18 .end = LOONGSON2E_PCI_MEM_END,
19 .flags = IORESOURCE_MEM,
20};
21
22static struct resource loongson2e_pci_io_resource = {
23 .name = "LOONGSON2E PCI IO MEM",
24 .start = LOONGSON2E_PCI_IO_START,
25 .end = IO_SPACE_LIMIT,
26 .flags = IORESOURCE_IO,
27};
28
29static struct pci_controller loongson2e_pci_controller = {
30 .pci_ops = &bonito64_pci_ops,
31 .io_resource = &loongson2e_pci_io_resource,
32 .mem_resource = &loongson2e_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 loongson2e_pci_controller.io_map_base = mips_io_port_base;
77
78 register_pci_controller(&loongson2e_pci_controller);
79
80 return 0;
81}
82
83arch_initcall(pcibios_init);
diff --git a/arch/mips/lemote/lm2e/setup.c b/arch/mips/lemote/lm2e/setup.c
deleted file mode 100644
index 663902159730..000000000000
--- a/arch/mips/lemote/lm2e/setup.c
+++ /dev/null
@@ -1,58 +0,0 @@
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_loongson2e(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_loongson2e;
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/lemote/lm2e/time.c b/arch/mips/lemote/lm2e/time.c
deleted file mode 100644
index b13d17174654..000000000000
--- a/arch/mips/lemote/lm2e/time.c
+++ /dev/null
@@ -1,27 +0,0 @@
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}