diff options
author | Shinya Kuribayashi <skuribay@ruby.dti.ne.jp> | 2008-10-23 12:29:16 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-10-27 12:18:29 -0400 |
commit | f27655e34171b0ae9ea5a0aadae894e817f0f875 (patch) | |
tree | 3375121c5b9db911d5b16e56e47c1871bd9db9c1 /arch/mips/emma/markeins/setup.c | |
parent | cd741b604b94a4d5bebf2672626ffec7de44652c (diff) |
MIPS: EMMA: Move arch/mips/emma2rh/ into arch/mips/emma/
git mv arch/mips/{emma2rh,emma} and fixups Makefiles. We'll put all NEC
EMMA series based machines there in the future.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/emma/markeins/setup.c')
-rw-r--r-- | arch/mips/emma/markeins/setup.c | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/arch/mips/emma/markeins/setup.c b/arch/mips/emma/markeins/setup.c new file mode 100644 index 000000000000..b6a23ad539f8 --- /dev/null +++ b/arch/mips/emma/markeins/setup.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/markeins/setup.c | ||
3 | * This file is setup for EMMA2RH Mark-eins. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-2006 | ||
6 | * | ||
7 | * This file is based on the arch/mips/ddb5xxx/ddb5477/setup.c. | ||
8 | * | ||
9 | * Copyright 2001 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/types.h> | ||
28 | |||
29 | #include <asm/time.h> | ||
30 | #include <asm/reboot.h> | ||
31 | |||
32 | #include <asm/emma2rh/emma2rh.h> | ||
33 | |||
34 | #define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */ | ||
35 | |||
36 | extern void markeins_led(const char *); | ||
37 | |||
38 | static int bus_frequency = 0; | ||
39 | |||
40 | static void markeins_machine_restart(char *command) | ||
41 | { | ||
42 | static void (*back_to_prom) (void) = (void (*)(void))0xbfc00000; | ||
43 | |||
44 | printk("cannot EMMA2RH Mark-eins restart.\n"); | ||
45 | markeins_led("restart."); | ||
46 | back_to_prom(); | ||
47 | } | ||
48 | |||
49 | static void markeins_machine_halt(void) | ||
50 | { | ||
51 | printk("EMMA2RH Mark-eins halted.\n"); | ||
52 | markeins_led("halted."); | ||
53 | while (1) ; | ||
54 | } | ||
55 | |||
56 | static void markeins_machine_power_off(void) | ||
57 | { | ||
58 | printk("EMMA2RH Mark-eins halted. Please turn off the power.\n"); | ||
59 | markeins_led("poweroff."); | ||
60 | while (1) ; | ||
61 | } | ||
62 | |||
63 | static unsigned long __initdata emma2rh_clock[4] = { | ||
64 | 166500000, 187312500, 199800000, 210600000 | ||
65 | }; | ||
66 | |||
67 | static unsigned int __init detect_bus_frequency(unsigned long rtc_base) | ||
68 | { | ||
69 | u32 reg; | ||
70 | |||
71 | /* detect from boot strap */ | ||
72 | reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0); | ||
73 | reg = (reg >> 4) & 0x3; | ||
74 | |||
75 | return emma2rh_clock[reg]; | ||
76 | } | ||
77 | |||
78 | void __init plat_time_init(void) | ||
79 | { | ||
80 | u32 reg; | ||
81 | if (bus_frequency == 0) | ||
82 | bus_frequency = detect_bus_frequency(0); | ||
83 | |||
84 | reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0); | ||
85 | if ((reg & 0x3) == 0) | ||
86 | reg = (reg >> 6) & 0x3; | ||
87 | else { | ||
88 | reg = emma2rh_in32(EMMA2RH_BHIF_MAIN_CTRL); | ||
89 | reg = (reg >> 4) & 0x3; | ||
90 | } | ||
91 | mips_hpt_frequency = (bus_frequency * (4 + reg)) / 4 / 2; | ||
92 | } | ||
93 | |||
94 | static void markeins_board_init(void); | ||
95 | extern void markeins_irq_setup(void); | ||
96 | |||
97 | static void inline __init markeins_sio_setup(void) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | void __init plat_mem_setup(void) | ||
102 | { | ||
103 | /* initialize board - we don't trust the loader */ | ||
104 | markeins_board_init(); | ||
105 | |||
106 | set_io_port_base(KSEG1ADDR(EMMA2RH_PCI_IO_BASE)); | ||
107 | |||
108 | _machine_restart = markeins_machine_restart; | ||
109 | _machine_halt = markeins_machine_halt; | ||
110 | pm_power_off = markeins_machine_power_off; | ||
111 | |||
112 | /* setup resource limits */ | ||
113 | ioport_resource.start = EMMA2RH_PCI_IO_BASE; | ||
114 | ioport_resource.end = EMMA2RH_PCI_IO_BASE + EMMA2RH_PCI_IO_SIZE - 1; | ||
115 | iomem_resource.start = EMMA2RH_IO_BASE; | ||
116 | iomem_resource.end = EMMA2RH_ROM_BASE - 1; | ||
117 | |||
118 | /* Reboot on panic */ | ||
119 | panic_timeout = 180; | ||
120 | |||
121 | markeins_sio_setup(); | ||
122 | } | ||
123 | |||
124 | static void __init markeins_board_init(void) | ||
125 | { | ||
126 | u32 val; | ||
127 | |||
128 | val = emma2rh_in32(EMMA2RH_PBRD_INT_EN); /* open serial interrupts. */ | ||
129 | emma2rh_out32(EMMA2RH_PBRD_INT_EN, val | 0xaa); | ||
130 | val = emma2rh_in32(EMMA2RH_PBRD_CLKSEL); /* set serial clocks. */ | ||
131 | emma2rh_out32(EMMA2RH_PBRD_CLKSEL, val | 0x5); /* 18MHz */ | ||
132 | emma2rh_out32(EMMA2RH_PCI_CONTROL, 0); | ||
133 | |||
134 | markeins_led("MVL E2RH"); | ||
135 | } | ||