Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/mips/txx9/generic/setup.c |
| 3 | * |
| 4 | * Based on linux/arch/mips/txx9/rbtx4938/setup.c, |
| 5 | * and RBTX49xx patch from CELF patch archive. |
| 6 | * |
| 7 | * 2003-2005 (c) MontaVista Software, Inc. |
| 8 | * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 |
| 9 | * |
| 10 | * This file is subject to the terms and conditions of the GNU General Public |
| 11 | * License. See the file "COPYING" in the main directory of this archive |
| 12 | * for more details. |
| 13 | */ |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/types.h> |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/string.h> |
| 19 | #include <linux/module.h> |
| 20 | #include <linux/clk.h> |
| 21 | #include <linux/err.h> |
Atsushi Nemoto | e0eb730 | 2008-07-19 01:51:52 +0900 | [diff] [blame] | 22 | #include <linux/gpio.h> |
Atsushi Nemoto | 6831472 | 2008-07-24 00:25:18 +0900 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
Atsushi Nemoto | 7779a5e | 2008-07-25 23:08:06 +0900 | [diff] [blame] | 24 | #include <linux/serial_core.h> |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 25 | #include <asm/bootinfo.h> |
Atsushi Nemoto | e0eb730 | 2008-07-19 01:51:52 +0900 | [diff] [blame] | 26 | #include <asm/time.h> |
Atsushi Nemoto | a49297e | 2008-07-24 00:25:17 +0900 | [diff] [blame] | 27 | #include <asm/reboot.h> |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 28 | #include <asm/txx9/generic.h> |
Atsushi Nemoto | 0751752 | 2008-07-24 00:25:15 +0900 | [diff] [blame] | 29 | #include <asm/txx9/pci.h> |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 30 | #ifdef CONFIG_CPU_TX49XX |
| 31 | #include <asm/txx9/tx4938.h> |
| 32 | #endif |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 33 | |
| 34 | /* EBUSC settings of TX4927, etc. */ |
| 35 | struct resource txx9_ce_res[8]; |
| 36 | static char txx9_ce_res_name[8][4]; /* "CEn" */ |
| 37 | |
| 38 | /* pcode, internal register */ |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 39 | unsigned int txx9_pcode; |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 40 | char txx9_pcode_str[8]; |
| 41 | static struct resource txx9_reg_res = { |
| 42 | .name = txx9_pcode_str, |
| 43 | .flags = IORESOURCE_MEM, |
| 44 | }; |
| 45 | void __init |
| 46 | txx9_reg_res_init(unsigned int pcode, unsigned long base, unsigned long size) |
| 47 | { |
| 48 | int i; |
| 49 | |
| 50 | for (i = 0; i < ARRAY_SIZE(txx9_ce_res); i++) { |
| 51 | sprintf(txx9_ce_res_name[i], "CE%d", i); |
| 52 | txx9_ce_res[i].flags = IORESOURCE_MEM; |
| 53 | txx9_ce_res[i].name = txx9_ce_res_name[i]; |
| 54 | } |
| 55 | |
Atsushi Nemoto | 073828d | 2008-08-26 21:29:58 +0900 | [diff] [blame] | 56 | txx9_pcode = pcode; |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 57 | sprintf(txx9_pcode_str, "TX%x", pcode); |
| 58 | if (base) { |
| 59 | txx9_reg_res.start = base & 0xfffffffffULL; |
| 60 | txx9_reg_res.end = (base & 0xfffffffffULL) + (size - 1); |
| 61 | request_resource(&iomem_resource, &txx9_reg_res); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /* clocks */ |
| 66 | unsigned int txx9_master_clock; |
| 67 | unsigned int txx9_cpu_clock; |
| 68 | unsigned int txx9_gbus_clock; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 69 | |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 70 | int txx9_ccfg_toeon __initdata = 1; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 71 | |
| 72 | /* Minimum CLK support */ |
| 73 | |
| 74 | struct clk *clk_get(struct device *dev, const char *id) |
| 75 | { |
| 76 | if (!strcmp(id, "spi-baseclk")) |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 77 | return (struct clk *)((unsigned long)txx9_gbus_clock / 2 / 4); |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 78 | if (!strcmp(id, "imbus_clk")) |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 79 | return (struct clk *)((unsigned long)txx9_gbus_clock / 2); |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 80 | return ERR_PTR(-ENOENT); |
| 81 | } |
| 82 | EXPORT_SYMBOL(clk_get); |
| 83 | |
| 84 | int clk_enable(struct clk *clk) |
| 85 | { |
| 86 | return 0; |
| 87 | } |
| 88 | EXPORT_SYMBOL(clk_enable); |
| 89 | |
| 90 | void clk_disable(struct clk *clk) |
| 91 | { |
| 92 | } |
| 93 | EXPORT_SYMBOL(clk_disable); |
| 94 | |
| 95 | unsigned long clk_get_rate(struct clk *clk) |
| 96 | { |
| 97 | return (unsigned long)clk; |
| 98 | } |
| 99 | EXPORT_SYMBOL(clk_get_rate); |
| 100 | |
| 101 | void clk_put(struct clk *clk) |
| 102 | { |
| 103 | } |
| 104 | EXPORT_SYMBOL(clk_put); |
| 105 | |
Atsushi Nemoto | 8d795f2 | 2008-07-18 00:43:48 +0900 | [diff] [blame] | 106 | /* GPIO support */ |
| 107 | |
| 108 | #ifdef CONFIG_GENERIC_GPIO |
| 109 | int gpio_to_irq(unsigned gpio) |
| 110 | { |
| 111 | return -EINVAL; |
| 112 | } |
| 113 | EXPORT_SYMBOL(gpio_to_irq); |
| 114 | |
| 115 | int irq_to_gpio(unsigned irq) |
| 116 | { |
| 117 | return -EINVAL; |
| 118 | } |
| 119 | EXPORT_SYMBOL(irq_to_gpio); |
| 120 | #endif |
| 121 | |
Atsushi Nemoto | 860e546 | 2008-08-19 22:55:08 +0900 | [diff] [blame^] | 122 | #define BOARD_VEC(board) extern struct txx9_board_vec board; |
| 123 | #include <asm/txx9/boards.h> |
| 124 | #undef BOARD_VEC |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 125 | |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 126 | struct txx9_board_vec *txx9_board_vec __initdata; |
| 127 | static char txx9_system_type[32]; |
| 128 | |
Atsushi Nemoto | 860e546 | 2008-08-19 22:55:08 +0900 | [diff] [blame^] | 129 | static struct txx9_board_vec *board_vecs[] __initdata = { |
| 130 | #define BOARD_VEC(board) &board, |
| 131 | #include <asm/txx9/boards.h> |
| 132 | #undef BOARD_VEC |
| 133 | }; |
| 134 | |
| 135 | static struct txx9_board_vec *__init find_board_byname(const char *name) |
| 136 | { |
| 137 | int i; |
| 138 | |
| 139 | /* search board_vecs table */ |
| 140 | for (i = 0; i < ARRAY_SIZE(board_vecs); i++) { |
| 141 | if (strstr(board_vecs[i]->system, name)) |
| 142 | return board_vecs[i]; |
| 143 | } |
| 144 | return NULL; |
| 145 | } |
| 146 | |
Atsushi Nemoto | e0dfb20 | 2008-08-19 22:55:06 +0900 | [diff] [blame] | 147 | static void __init prom_init_cmdline(void) |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 148 | { |
| 149 | int argc = (int)fw_arg0; |
Atsushi Nemoto | e0dfb20 | 2008-08-19 22:55:06 +0900 | [diff] [blame] | 150 | int *argv32 = (int *)fw_arg1; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 151 | int i; /* Always ignore the "-c" at argv[0] */ |
Atsushi Nemoto | e0dfb20 | 2008-08-19 22:55:06 +0900 | [diff] [blame] | 152 | char builtin[CL_SIZE]; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 153 | |
| 154 | /* ignore all built-in args if any f/w args given */ |
Atsushi Nemoto | e0dfb20 | 2008-08-19 22:55:06 +0900 | [diff] [blame] | 155 | /* |
| 156 | * But if built-in strings was started with '+', append them |
| 157 | * to command line args. If built-in was started with '-', |
| 158 | * ignore all f/w args. |
| 159 | */ |
| 160 | builtin[0] = '\0'; |
| 161 | if (arcs_cmdline[0] == '+') |
| 162 | strcpy(builtin, arcs_cmdline + 1); |
| 163 | else if (arcs_cmdline[0] == '-') { |
| 164 | strcpy(builtin, arcs_cmdline + 1); |
| 165 | argc = 0; |
| 166 | } else if (argc <= 1) |
| 167 | strcpy(builtin, arcs_cmdline); |
| 168 | arcs_cmdline[0] = '\0'; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 169 | |
| 170 | for (i = 1; i < argc; i++) { |
Atsushi Nemoto | e0dfb20 | 2008-08-19 22:55:06 +0900 | [diff] [blame] | 171 | char *str = (char *)(long)argv32[i]; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 172 | if (i != 1) |
| 173 | strcat(arcs_cmdline, " "); |
Atsushi Nemoto | e0dfb20 | 2008-08-19 22:55:06 +0900 | [diff] [blame] | 174 | if (strchr(str, ' ')) { |
| 175 | strcat(arcs_cmdline, "\""); |
| 176 | strcat(arcs_cmdline, str); |
| 177 | strcat(arcs_cmdline, "\""); |
| 178 | } else |
| 179 | strcat(arcs_cmdline, str); |
| 180 | } |
| 181 | /* append saved builtin args */ |
| 182 | if (builtin[0]) { |
| 183 | if (arcs_cmdline[0]) |
| 184 | strcat(arcs_cmdline, " "); |
| 185 | strcat(arcs_cmdline, builtin); |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
Atsushi Nemoto | 860e546 | 2008-08-19 22:55:08 +0900 | [diff] [blame^] | 189 | static void __init preprocess_cmdline(void) |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 190 | { |
Atsushi Nemoto | 860e546 | 2008-08-19 22:55:08 +0900 | [diff] [blame^] | 191 | char cmdline[CL_SIZE]; |
| 192 | char *s; |
| 193 | |
| 194 | strcpy(cmdline, arcs_cmdline); |
| 195 | s = cmdline; |
| 196 | arcs_cmdline[0] = '\0'; |
| 197 | while (s && *s) { |
| 198 | char *str = strsep(&s, " "); |
| 199 | if (strncmp(str, "board=", 6) == 0) { |
| 200 | txx9_board_vec = find_board_byname(str + 6); |
| 201 | continue; |
| 202 | } else if (strncmp(str, "masterclk=", 10) == 0) { |
| 203 | unsigned long val; |
| 204 | if (strict_strtoul(str + 10, 10, &val) == 0) |
| 205 | txx9_master_clock = val; |
| 206 | continue; |
| 207 | } |
| 208 | if (arcs_cmdline[0]) |
| 209 | strcat(arcs_cmdline, " "); |
| 210 | strcat(arcs_cmdline, str); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | static void __init select_board(void) |
| 215 | { |
| 216 | const char *envstr; |
| 217 | |
| 218 | /* first, determine by "board=" argument in preprocess_cmdline() */ |
| 219 | if (txx9_board_vec) |
| 220 | return; |
| 221 | /* next, determine by "board" envvar */ |
| 222 | envstr = prom_getenv("board"); |
| 223 | if (envstr) { |
| 224 | txx9_board_vec = find_board_byname(envstr); |
| 225 | if (txx9_board_vec) |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | /* select "default" board */ |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 230 | #ifdef CONFIG_CPU_TX39XX |
Yoichi Yuasa | 7a1fdf1 | 2008-07-13 19:51:55 +0900 | [diff] [blame] | 231 | txx9_board_vec = &jmr3927_vec; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 232 | #endif |
| 233 | #ifdef CONFIG_CPU_TX49XX |
| 234 | switch (TX4938_REV_PCODE()) { |
Atsushi Nemoto | 8d795f2 | 2008-07-18 00:43:48 +0900 | [diff] [blame] | 235 | #ifdef CONFIG_TOSHIBA_RBTX4927 |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 236 | case 0x4927: |
Yoichi Yuasa | 7a1fdf1 | 2008-07-13 19:51:55 +0900 | [diff] [blame] | 237 | txx9_board_vec = &rbtx4927_vec; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 238 | break; |
| 239 | case 0x4937: |
Yoichi Yuasa | 7a1fdf1 | 2008-07-13 19:51:55 +0900 | [diff] [blame] | 240 | txx9_board_vec = &rbtx4937_vec; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 241 | break; |
Atsushi Nemoto | 8d795f2 | 2008-07-18 00:43:48 +0900 | [diff] [blame] | 242 | #endif |
| 243 | #ifdef CONFIG_TOSHIBA_RBTX4938 |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 244 | case 0x4938: |
Yoichi Yuasa | 7a1fdf1 | 2008-07-13 19:51:55 +0900 | [diff] [blame] | 245 | txx9_board_vec = &rbtx4938_vec; |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 246 | break; |
Atsushi Nemoto | 8d795f2 | 2008-07-18 00:43:48 +0900 | [diff] [blame] | 247 | #endif |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 248 | } |
| 249 | #endif |
Atsushi Nemoto | 860e546 | 2008-08-19 22:55:08 +0900 | [diff] [blame^] | 250 | } |
| 251 | |
| 252 | void __init prom_init(void) |
| 253 | { |
| 254 | prom_init_cmdline(); |
| 255 | preprocess_cmdline(); |
| 256 | select_board(); |
Yoichi Yuasa | 7a1fdf1 | 2008-07-13 19:51:55 +0900 | [diff] [blame] | 257 | |
| 258 | strcpy(txx9_system_type, txx9_board_vec->system); |
| 259 | |
Atsushi Nemoto | 7b22609 | 2008-07-14 00:15:04 +0900 | [diff] [blame] | 260 | txx9_board_vec->prom_init(); |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | void __init prom_free_prom_memory(void) |
| 264 | { |
| 265 | } |
| 266 | |
| 267 | const char *get_system_type(void) |
| 268 | { |
| 269 | return txx9_system_type; |
| 270 | } |
| 271 | |
| 272 | char * __init prom_getcmdline(void) |
| 273 | { |
| 274 | return &(arcs_cmdline[0]); |
| 275 | } |
| 276 | |
Atsushi Nemoto | 265b89d | 2008-08-19 22:55:07 +0900 | [diff] [blame] | 277 | const char *__init prom_getenv(const char *name) |
| 278 | { |
| 279 | const s32 *str = (const s32 *)fw_arg2; |
| 280 | |
| 281 | if (!str) |
| 282 | return NULL; |
| 283 | /* YAMON style ("name", "value" pairs) */ |
| 284 | while (str[0] && str[1]) { |
| 285 | if (!strcmp((const char *)(unsigned long)str[0], name)) |
| 286 | return (const char *)(unsigned long)str[1]; |
| 287 | str += 2; |
| 288 | } |
| 289 | return NULL; |
| 290 | } |
| 291 | |
Atsushi Nemoto | a49297e | 2008-07-24 00:25:17 +0900 | [diff] [blame] | 292 | static void __noreturn txx9_machine_halt(void) |
| 293 | { |
| 294 | local_irq_disable(); |
| 295 | clear_c0_status(ST0_IM); |
| 296 | while (1) { |
| 297 | if (cpu_wait) { |
| 298 | (*cpu_wait)(); |
| 299 | if (cpu_has_counter) { |
| 300 | /* |
| 301 | * Clear counter interrupt while it |
| 302 | * breaks WAIT instruction even if |
| 303 | * masked. |
| 304 | */ |
| 305 | write_c0_compare(0); |
| 306 | } |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
Atsushi Nemoto | 6831472 | 2008-07-24 00:25:18 +0900 | [diff] [blame] | 311 | /* Watchdog support */ |
| 312 | void __init txx9_wdt_init(unsigned long base) |
| 313 | { |
| 314 | struct resource res = { |
| 315 | .start = base, |
| 316 | .end = base + 0x100 - 1, |
| 317 | .flags = IORESOURCE_MEM, |
| 318 | }; |
| 319 | platform_device_register_simple("txx9wdt", -1, &res, 1); |
| 320 | } |
| 321 | |
Atsushi Nemoto | c49f91f | 2008-07-24 00:25:20 +0900 | [diff] [blame] | 322 | /* SPI support */ |
| 323 | void __init txx9_spi_init(int busid, unsigned long base, int irq) |
| 324 | { |
| 325 | struct resource res[] = { |
| 326 | { |
| 327 | .start = base, |
| 328 | .end = base + 0x20 - 1, |
| 329 | .flags = IORESOURCE_MEM, |
| 330 | }, { |
| 331 | .start = irq, |
| 332 | .flags = IORESOURCE_IRQ, |
| 333 | }, |
| 334 | }; |
| 335 | platform_device_register_simple("spi_txx9", busid, |
| 336 | res, ARRAY_SIZE(res)); |
| 337 | } |
| 338 | |
| 339 | void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr) |
| 340 | { |
| 341 | struct platform_device *pdev = |
| 342 | platform_device_alloc("tc35815-mac", id); |
| 343 | if (!pdev || |
| 344 | platform_device_add_data(pdev, ethaddr, 6) || |
| 345 | platform_device_add(pdev)) |
| 346 | platform_device_put(pdev); |
| 347 | } |
| 348 | |
Atsushi Nemoto | 7779a5e | 2008-07-25 23:08:06 +0900 | [diff] [blame] | 349 | void __init txx9_sio_init(unsigned long baseaddr, int irq, |
| 350 | unsigned int line, unsigned int sclk, int nocts) |
| 351 | { |
| 352 | #ifdef CONFIG_SERIAL_TXX9 |
| 353 | struct uart_port req; |
| 354 | |
| 355 | memset(&req, 0, sizeof(req)); |
| 356 | req.line = line; |
| 357 | req.iotype = UPIO_MEM; |
| 358 | req.membase = ioremap(baseaddr, 0x24); |
| 359 | req.mapbase = baseaddr; |
| 360 | req.irq = irq; |
| 361 | if (!nocts) |
| 362 | req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/; |
| 363 | if (sclk) { |
| 364 | req.flags |= UPF_MAGIC_MULTIPLIER /*USE_SCLK*/; |
| 365 | req.uartclk = sclk; |
| 366 | } else |
| 367 | req.uartclk = TXX9_IMCLK; |
| 368 | early_serial_txx9_setup(&req); |
| 369 | #endif /* CONFIG_SERIAL_TXX9 */ |
| 370 | } |
| 371 | |
Atsushi Nemoto | e352953 | 2008-07-29 22:10:08 +0900 | [diff] [blame] | 372 | #ifdef CONFIG_EARLY_PRINTK |
| 373 | static void __init null_prom_putchar(char c) |
| 374 | { |
| 375 | } |
| 376 | void (*txx9_prom_putchar)(char c) __initdata = null_prom_putchar; |
| 377 | |
| 378 | void __init prom_putchar(char c) |
| 379 | { |
| 380 | txx9_prom_putchar(c); |
| 381 | } |
| 382 | |
| 383 | static void __iomem *early_txx9_sio_port; |
| 384 | |
| 385 | static void __init early_txx9_sio_putchar(char c) |
| 386 | { |
| 387 | #define TXX9_SICISR 0x0c |
| 388 | #define TXX9_SITFIFO 0x1c |
| 389 | #define TXX9_SICISR_TXALS 0x00000002 |
| 390 | while (!(__raw_readl(early_txx9_sio_port + TXX9_SICISR) & |
| 391 | TXX9_SICISR_TXALS)) |
| 392 | ; |
| 393 | __raw_writel(c, early_txx9_sio_port + TXX9_SITFIFO); |
| 394 | } |
| 395 | |
| 396 | void __init txx9_sio_putchar_init(unsigned long baseaddr) |
| 397 | { |
| 398 | early_txx9_sio_port = ioremap(baseaddr, 0x24); |
| 399 | txx9_prom_putchar = early_txx9_sio_putchar; |
| 400 | } |
| 401 | #endif /* CONFIG_EARLY_PRINTK */ |
| 402 | |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 403 | /* wrappers */ |
| 404 | void __init plat_mem_setup(void) |
| 405 | { |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 406 | ioport_resource.start = 0; |
| 407 | ioport_resource.end = ~0UL; /* no limit */ |
| 408 | iomem_resource.start = 0; |
| 409 | iomem_resource.end = ~0UL; /* no limit */ |
Atsushi Nemoto | a49297e | 2008-07-24 00:25:17 +0900 | [diff] [blame] | 410 | |
| 411 | /* fallback restart/halt routines */ |
| 412 | _machine_restart = (void (*)(char *))txx9_machine_halt; |
| 413 | _machine_halt = txx9_machine_halt; |
| 414 | pm_power_off = txx9_machine_halt; |
| 415 | |
Atsushi Nemoto | 0751752 | 2008-07-24 00:25:15 +0900 | [diff] [blame] | 416 | #ifdef CONFIG_PCI |
| 417 | pcibios_plat_setup = txx9_pcibios_setup; |
| 418 | #endif |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 419 | txx9_board_vec->mem_setup(); |
| 420 | } |
| 421 | |
| 422 | void __init arch_init_irq(void) |
| 423 | { |
| 424 | txx9_board_vec->irq_setup(); |
| 425 | } |
| 426 | |
| 427 | void __init plat_time_init(void) |
| 428 | { |
Atsushi Nemoto | 1374d08 | 2008-07-31 22:29:53 +0900 | [diff] [blame] | 429 | #ifdef CONFIG_CPU_TX49XX |
| 430 | mips_hpt_frequency = txx9_cpu_clock / 2; |
| 431 | #endif |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 432 | txx9_board_vec->time_init(); |
| 433 | } |
| 434 | |
| 435 | static int __init _txx9_arch_init(void) |
| 436 | { |
| 437 | if (txx9_board_vec->arch_init) |
| 438 | txx9_board_vec->arch_init(); |
| 439 | return 0; |
| 440 | } |
| 441 | arch_initcall(_txx9_arch_init); |
| 442 | |
| 443 | static int __init _txx9_device_init(void) |
| 444 | { |
| 445 | if (txx9_board_vec->device_init) |
| 446 | txx9_board_vec->device_init(); |
| 447 | return 0; |
| 448 | } |
| 449 | device_initcall(_txx9_device_init); |
| 450 | |
| 451 | int (*txx9_irq_dispatch)(int pending); |
| 452 | asmlinkage void plat_irq_dispatch(void) |
| 453 | { |
| 454 | int pending = read_c0_status() & read_c0_cause() & ST0_IM; |
| 455 | int irq = txx9_irq_dispatch(pending); |
| 456 | |
| 457 | if (likely(irq >= 0)) |
| 458 | do_IRQ(irq); |
| 459 | else |
| 460 | spurious_interrupt(); |
| 461 | } |
Atsushi Nemoto | 4c642f3 | 2008-07-13 23:37:56 +0900 | [diff] [blame] | 462 | |
| 463 | /* see include/asm-mips/mach-tx39xx/mangle-port.h, for example. */ |
| 464 | #ifdef NEEDS_TXX9_SWIZZLE_ADDR_B |
| 465 | static unsigned long __swizzle_addr_none(unsigned long port) |
| 466 | { |
| 467 | return port; |
| 468 | } |
| 469 | unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; |
| 470 | EXPORT_SYMBOL(__swizzle_addr_b); |
| 471 | #endif |