diff options
author | Brian Murphy <brm@murphy.dk> | 2007-08-21 16:34:16 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-10-11 18:46:00 -0400 |
commit | 1f21d2bde0046e959b53756f74d96dfd040a803b (patch) | |
tree | 5ca1a0319982f1e665e57f22bd1dae1d90b07e35 /arch/mips/lasat/prom.c | |
parent | 0caf583398309398ec05fc76bff15c711e9f936d (diff) |
[MIPS] Add back support for LASAT platforms
Signed-off-by: Brian Murphy <brian@murphy.dk>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lasat/prom.c')
-rw-r--r-- | arch/mips/lasat/prom.c | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c new file mode 100644 index 000000000000..4b80fffcf262 --- /dev/null +++ b/arch/mips/lasat/prom.c | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * PROM interface routines. | ||
3 | */ | ||
4 | #include <linux/types.h> | ||
5 | #include <linux/init.h> | ||
6 | #include <linux/string.h> | ||
7 | #include <linux/ctype.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/mm.h> | ||
10 | #include <linux/bootmem.h> | ||
11 | #include <linux/ioport.h> | ||
12 | #include <asm/bootinfo.h> | ||
13 | #include <asm/lasat/lasat.h> | ||
14 | #include <asm/cpu.h> | ||
15 | |||
16 | #include "at93c.h" | ||
17 | #include <asm/lasat/eeprom.h> | ||
18 | #include "prom.h" | ||
19 | |||
20 | #define RESET_VECTOR 0xbfc00000 | ||
21 | #define PROM_JUMP_TABLE_ENTRY(n) (*((u32 *)(RESET_VECTOR + 0x20) + n)) | ||
22 | #define PROM_DISPLAY_ADDR PROM_JUMP_TABLE_ENTRY(0) | ||
23 | #define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1) | ||
24 | #define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2) | ||
25 | |||
26 | static void null_prom_display(const char *string, int pos, int clear) | ||
27 | { | ||
28 | } | ||
29 | |||
30 | static void null_prom_monitor(void) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | static void null_prom_putc(char c) | ||
35 | { | ||
36 | } | ||
37 | |||
38 | /* these are functions provided by the bootloader */ | ||
39 | static void (*__prom_putc)(char c) = null_prom_putc; | ||
40 | |||
41 | void prom_putchar(char c) | ||
42 | { | ||
43 | __prom_putc(c); | ||
44 | } | ||
45 | |||
46 | void (*prom_display)(const char *string, int pos, int clear) = | ||
47 | null_prom_display; | ||
48 | void (*prom_monitor)(void) = null_prom_monitor; | ||
49 | |||
50 | unsigned int lasat_ndelay_divider; | ||
51 | |||
52 | static void setup_prom_vectors(void) | ||
53 | { | ||
54 | u32 version = *(u32 *)(RESET_VECTOR + 0x90); | ||
55 | |||
56 | if (version >= 307) { | ||
57 | prom_display = (void *)PROM_DISPLAY_ADDR; | ||
58 | __prom_putc = (void *)PROM_PUTC_ADDR; | ||
59 | prom_monitor = (void *)PROM_MONITOR_ADDR; | ||
60 | } | ||
61 | printk(KERN_DEBUG "prom vectors set up\n"); | ||
62 | } | ||
63 | |||
64 | static struct at93c_defs at93c_defs[N_MACHTYPES] = { | ||
65 | { | ||
66 | .reg = (void *)AT93C_REG_100, | ||
67 | .rdata_reg = (void *)AT93C_RDATA_REG_100, | ||
68 | .rdata_shift = AT93C_RDATA_SHIFT_100, | ||
69 | .wdata_shift = AT93C_WDATA_SHIFT_100, | ||
70 | .cs = AT93C_CS_M_100, | ||
71 | .clk = AT93C_CLK_M_100 | ||
72 | }, { | ||
73 | .reg = (void *)AT93C_REG_200, | ||
74 | .rdata_reg = (void *)AT93C_RDATA_REG_200, | ||
75 | .rdata_shift = AT93C_RDATA_SHIFT_200, | ||
76 | .wdata_shift = AT93C_WDATA_SHIFT_200, | ||
77 | .cs = AT93C_CS_M_200, | ||
78 | .clk = AT93C_CLK_M_200 | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | void __init prom_init(void) | ||
83 | { | ||
84 | int argc = fw_arg0; | ||
85 | char **argv = (char **) fw_arg1; | ||
86 | |||
87 | setup_prom_vectors(); | ||
88 | |||
89 | if (current_cpu_data.cputype == CPU_R5000) { | ||
90 | printk(KERN_INFO "LASAT 200 board\n"); | ||
91 | mips_machtype = MACH_LASAT_200; | ||
92 | lasat_ndelay_divider = LASAT_200_DIVIDER; | ||
93 | } else { | ||
94 | printk(KERN_INFO "LASAT 100 board\n"); | ||
95 | mips_machtype = MACH_LASAT_100; | ||
96 | lasat_ndelay_divider = LASAT_100_DIVIDER; | ||
97 | } | ||
98 | |||
99 | at93c = &at93c_defs[mips_machtype]; | ||
100 | |||
101 | lasat_init_board_info(); /* Read info from EEPROM */ | ||
102 | |||
103 | mips_machgroup = MACH_GROUP_LASAT; | ||
104 | |||
105 | /* Get the command line */ | ||
106 | if (argc > 0) { | ||
107 | strncpy(arcs_cmdline, argv[0], CL_SIZE-1); | ||
108 | arcs_cmdline[CL_SIZE-1] = '\0'; | ||
109 | } | ||
110 | |||
111 | /* Set the I/O base address */ | ||
112 | set_io_port_base(KSEG1); | ||
113 | |||
114 | /* Set memory regions */ | ||
115 | ioport_resource.start = 0; | ||
116 | ioport_resource.end = 0xffffffff; /* Wrong, fixme. */ | ||
117 | |||
118 | add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM); | ||
119 | } | ||
120 | |||
121 | void __init prom_free_prom_memory(void) | ||
122 | { | ||
123 | } | ||
124 | |||
125 | const char *get_system_type(void) | ||
126 | { | ||
127 | return lasat_board_info.li_bmstr; | ||
128 | } | ||