189d63fe1SAtsushi Nemoto /* 289d63fe1SAtsushi Nemoto * linux/arch/mips/txx9/generic/setup.c 389d63fe1SAtsushi Nemoto * 489d63fe1SAtsushi Nemoto * Based on linux/arch/mips/txx9/rbtx4938/setup.c, 589d63fe1SAtsushi Nemoto * and RBTX49xx patch from CELF patch archive. 689d63fe1SAtsushi Nemoto * 789d63fe1SAtsushi Nemoto * 2003-2005 (c) MontaVista Software, Inc. 889d63fe1SAtsushi Nemoto * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 989d63fe1SAtsushi Nemoto * 1089d63fe1SAtsushi Nemoto * This file is subject to the terms and conditions of the GNU General Public 1189d63fe1SAtsushi Nemoto * License. See the file "COPYING" in the main directory of this archive 1289d63fe1SAtsushi Nemoto * for more details. 1389d63fe1SAtsushi Nemoto */ 1489d63fe1SAtsushi Nemoto #include <linux/init.h> 1589d63fe1SAtsushi Nemoto #include <linux/kernel.h> 1689d63fe1SAtsushi Nemoto #include <linux/types.h> 17edcaf1a6SAtsushi Nemoto #include <linux/interrupt.h> 18edcaf1a6SAtsushi Nemoto #include <linux/string.h> 19edcaf1a6SAtsushi Nemoto #include <linux/module.h> 20edcaf1a6SAtsushi Nemoto #include <linux/clk.h> 21edcaf1a6SAtsushi Nemoto #include <linux/err.h> 22e0eb7307SAtsushi Nemoto #include <linux/gpio.h> 2368314725SAtsushi Nemoto #include <linux/platform_device.h> 247779a5e0SAtsushi Nemoto #include <linux/serial_core.h> 25edcaf1a6SAtsushi Nemoto #include <asm/bootinfo.h> 26e0eb7307SAtsushi Nemoto #include <asm/time.h> 27a49297e8SAtsushi Nemoto #include <asm/reboot.h> 2889d63fe1SAtsushi Nemoto #include <asm/txx9/generic.h> 2907517529SAtsushi Nemoto #include <asm/txx9/pci.h> 30edcaf1a6SAtsushi Nemoto #ifdef CONFIG_CPU_TX49XX 31edcaf1a6SAtsushi Nemoto #include <asm/txx9/tx4938.h> 32edcaf1a6SAtsushi Nemoto #endif 3389d63fe1SAtsushi Nemoto 3489d63fe1SAtsushi Nemoto /* EBUSC settings of TX4927, etc. */ 3589d63fe1SAtsushi Nemoto struct resource txx9_ce_res[8]; 3689d63fe1SAtsushi Nemoto static char txx9_ce_res_name[8][4]; /* "CEn" */ 3789d63fe1SAtsushi Nemoto 3889d63fe1SAtsushi Nemoto /* pcode, internal register */ 3994a4c329SAtsushi Nemoto unsigned int txx9_pcode; 4089d63fe1SAtsushi Nemoto char txx9_pcode_str[8]; 4189d63fe1SAtsushi Nemoto static struct resource txx9_reg_res = { 4289d63fe1SAtsushi Nemoto .name = txx9_pcode_str, 4389d63fe1SAtsushi Nemoto .flags = IORESOURCE_MEM, 4489d63fe1SAtsushi Nemoto }; 4589d63fe1SAtsushi Nemoto void __init 4689d63fe1SAtsushi Nemoto txx9_reg_res_init(unsigned int pcode, unsigned long base, unsigned long size) 4789d63fe1SAtsushi Nemoto { 4889d63fe1SAtsushi Nemoto int i; 4989d63fe1SAtsushi Nemoto 5089d63fe1SAtsushi Nemoto for (i = 0; i < ARRAY_SIZE(txx9_ce_res); i++) { 5189d63fe1SAtsushi Nemoto sprintf(txx9_ce_res_name[i], "CE%d", i); 5289d63fe1SAtsushi Nemoto txx9_ce_res[i].flags = IORESOURCE_MEM; 5389d63fe1SAtsushi Nemoto txx9_ce_res[i].name = txx9_ce_res_name[i]; 5489d63fe1SAtsushi Nemoto } 5589d63fe1SAtsushi Nemoto 56073828d0SAtsushi Nemoto txx9_pcode = pcode; 5789d63fe1SAtsushi Nemoto sprintf(txx9_pcode_str, "TX%x", pcode); 5889d63fe1SAtsushi Nemoto if (base) { 5989d63fe1SAtsushi Nemoto txx9_reg_res.start = base & 0xfffffffffULL; 6089d63fe1SAtsushi Nemoto txx9_reg_res.end = (base & 0xfffffffffULL) + (size - 1); 6189d63fe1SAtsushi Nemoto request_resource(&iomem_resource, &txx9_reg_res); 6289d63fe1SAtsushi Nemoto } 6389d63fe1SAtsushi Nemoto } 6489d63fe1SAtsushi Nemoto 6589d63fe1SAtsushi Nemoto /* clocks */ 6689d63fe1SAtsushi Nemoto unsigned int txx9_master_clock; 6789d63fe1SAtsushi Nemoto unsigned int txx9_cpu_clock; 6889d63fe1SAtsushi Nemoto unsigned int txx9_gbus_clock; 69edcaf1a6SAtsushi Nemoto 7094a4c329SAtsushi Nemoto int txx9_ccfg_toeon __initdata = 1; 71edcaf1a6SAtsushi Nemoto 72edcaf1a6SAtsushi Nemoto /* Minimum CLK support */ 73edcaf1a6SAtsushi Nemoto 74edcaf1a6SAtsushi Nemoto struct clk *clk_get(struct device *dev, const char *id) 75edcaf1a6SAtsushi Nemoto { 76edcaf1a6SAtsushi Nemoto if (!strcmp(id, "spi-baseclk")) 7794a4c329SAtsushi Nemoto return (struct clk *)((unsigned long)txx9_gbus_clock / 2 / 4); 78edcaf1a6SAtsushi Nemoto if (!strcmp(id, "imbus_clk")) 7994a4c329SAtsushi Nemoto return (struct clk *)((unsigned long)txx9_gbus_clock / 2); 80edcaf1a6SAtsushi Nemoto return ERR_PTR(-ENOENT); 81edcaf1a6SAtsushi Nemoto } 82edcaf1a6SAtsushi Nemoto EXPORT_SYMBOL(clk_get); 83edcaf1a6SAtsushi Nemoto 84edcaf1a6SAtsushi Nemoto int clk_enable(struct clk *clk) 85edcaf1a6SAtsushi Nemoto { 86edcaf1a6SAtsushi Nemoto return 0; 87edcaf1a6SAtsushi Nemoto } 88edcaf1a6SAtsushi Nemoto EXPORT_SYMBOL(clk_enable); 89edcaf1a6SAtsushi Nemoto 90edcaf1a6SAtsushi Nemoto void clk_disable(struct clk *clk) 91edcaf1a6SAtsushi Nemoto { 92edcaf1a6SAtsushi Nemoto } 93edcaf1a6SAtsushi Nemoto EXPORT_SYMBOL(clk_disable); 94edcaf1a6SAtsushi Nemoto 95edcaf1a6SAtsushi Nemoto unsigned long clk_get_rate(struct clk *clk) 96edcaf1a6SAtsushi Nemoto { 97edcaf1a6SAtsushi Nemoto return (unsigned long)clk; 98edcaf1a6SAtsushi Nemoto } 99edcaf1a6SAtsushi Nemoto EXPORT_SYMBOL(clk_get_rate); 100edcaf1a6SAtsushi Nemoto 101edcaf1a6SAtsushi Nemoto void clk_put(struct clk *clk) 102edcaf1a6SAtsushi Nemoto { 103edcaf1a6SAtsushi Nemoto } 104edcaf1a6SAtsushi Nemoto EXPORT_SYMBOL(clk_put); 105edcaf1a6SAtsushi Nemoto 1068d795f2aSAtsushi Nemoto /* GPIO support */ 1078d795f2aSAtsushi Nemoto 1088d795f2aSAtsushi Nemoto #ifdef CONFIG_GENERIC_GPIO 1098d795f2aSAtsushi Nemoto int gpio_to_irq(unsigned gpio) 1108d795f2aSAtsushi Nemoto { 1118d795f2aSAtsushi Nemoto return -EINVAL; 1128d795f2aSAtsushi Nemoto } 1138d795f2aSAtsushi Nemoto EXPORT_SYMBOL(gpio_to_irq); 1148d795f2aSAtsushi Nemoto 1158d795f2aSAtsushi Nemoto int irq_to_gpio(unsigned irq) 1168d795f2aSAtsushi Nemoto { 1178d795f2aSAtsushi Nemoto return -EINVAL; 1188d795f2aSAtsushi Nemoto } 1198d795f2aSAtsushi Nemoto EXPORT_SYMBOL(irq_to_gpio); 1208d795f2aSAtsushi Nemoto #endif 1218d795f2aSAtsushi Nemoto 122edcaf1a6SAtsushi Nemoto extern struct txx9_board_vec jmr3927_vec; 123edcaf1a6SAtsushi Nemoto extern struct txx9_board_vec rbtx4927_vec; 124edcaf1a6SAtsushi Nemoto extern struct txx9_board_vec rbtx4937_vec; 125edcaf1a6SAtsushi Nemoto extern struct txx9_board_vec rbtx4938_vec; 126edcaf1a6SAtsushi Nemoto 127edcaf1a6SAtsushi Nemoto struct txx9_board_vec *txx9_board_vec __initdata; 128edcaf1a6SAtsushi Nemoto static char txx9_system_type[32]; 129edcaf1a6SAtsushi Nemoto 130e0dfb20cSAtsushi Nemoto static void __init prom_init_cmdline(void) 131edcaf1a6SAtsushi Nemoto { 132edcaf1a6SAtsushi Nemoto int argc = (int)fw_arg0; 133e0dfb20cSAtsushi Nemoto int *argv32 = (int *)fw_arg1; 134edcaf1a6SAtsushi Nemoto int i; /* Always ignore the "-c" at argv[0] */ 135e0dfb20cSAtsushi Nemoto char builtin[CL_SIZE]; 136edcaf1a6SAtsushi Nemoto 137edcaf1a6SAtsushi Nemoto /* ignore all built-in args if any f/w args given */ 138e0dfb20cSAtsushi Nemoto /* 139e0dfb20cSAtsushi Nemoto * But if built-in strings was started with '+', append them 140e0dfb20cSAtsushi Nemoto * to command line args. If built-in was started with '-', 141e0dfb20cSAtsushi Nemoto * ignore all f/w args. 142e0dfb20cSAtsushi Nemoto */ 143e0dfb20cSAtsushi Nemoto builtin[0] = '\0'; 144e0dfb20cSAtsushi Nemoto if (arcs_cmdline[0] == '+') 145e0dfb20cSAtsushi Nemoto strcpy(builtin, arcs_cmdline + 1); 146e0dfb20cSAtsushi Nemoto else if (arcs_cmdline[0] == '-') { 147e0dfb20cSAtsushi Nemoto strcpy(builtin, arcs_cmdline + 1); 148e0dfb20cSAtsushi Nemoto argc = 0; 149e0dfb20cSAtsushi Nemoto } else if (argc <= 1) 150e0dfb20cSAtsushi Nemoto strcpy(builtin, arcs_cmdline); 151e0dfb20cSAtsushi Nemoto arcs_cmdline[0] = '\0'; 152edcaf1a6SAtsushi Nemoto 153edcaf1a6SAtsushi Nemoto for (i = 1; i < argc; i++) { 154e0dfb20cSAtsushi Nemoto char *str = (char *)(long)argv32[i]; 155edcaf1a6SAtsushi Nemoto if (i != 1) 156edcaf1a6SAtsushi Nemoto strcat(arcs_cmdline, " "); 157e0dfb20cSAtsushi Nemoto if (strchr(str, ' ')) { 158e0dfb20cSAtsushi Nemoto strcat(arcs_cmdline, "\""); 159e0dfb20cSAtsushi Nemoto strcat(arcs_cmdline, str); 160e0dfb20cSAtsushi Nemoto strcat(arcs_cmdline, "\""); 161e0dfb20cSAtsushi Nemoto } else 162e0dfb20cSAtsushi Nemoto strcat(arcs_cmdline, str); 163e0dfb20cSAtsushi Nemoto } 164e0dfb20cSAtsushi Nemoto /* append saved builtin args */ 165e0dfb20cSAtsushi Nemoto if (builtin[0]) { 166e0dfb20cSAtsushi Nemoto if (arcs_cmdline[0]) 167e0dfb20cSAtsushi Nemoto strcat(arcs_cmdline, " "); 168e0dfb20cSAtsushi Nemoto strcat(arcs_cmdline, builtin); 169edcaf1a6SAtsushi Nemoto } 170edcaf1a6SAtsushi Nemoto } 171edcaf1a6SAtsushi Nemoto 172edcaf1a6SAtsushi Nemoto void __init prom_init(void) 173edcaf1a6SAtsushi Nemoto { 174e0dfb20cSAtsushi Nemoto prom_init_cmdline(); 175edcaf1a6SAtsushi Nemoto #ifdef CONFIG_CPU_TX39XX 1767a1fdf19SYoichi Yuasa txx9_board_vec = &jmr3927_vec; 177edcaf1a6SAtsushi Nemoto #endif 178edcaf1a6SAtsushi Nemoto #ifdef CONFIG_CPU_TX49XX 179edcaf1a6SAtsushi Nemoto switch (TX4938_REV_PCODE()) { 1808d795f2aSAtsushi Nemoto #ifdef CONFIG_TOSHIBA_RBTX4927 181edcaf1a6SAtsushi Nemoto case 0x4927: 1827a1fdf19SYoichi Yuasa txx9_board_vec = &rbtx4927_vec; 183edcaf1a6SAtsushi Nemoto break; 184edcaf1a6SAtsushi Nemoto case 0x4937: 1857a1fdf19SYoichi Yuasa txx9_board_vec = &rbtx4937_vec; 186edcaf1a6SAtsushi Nemoto break; 1878d795f2aSAtsushi Nemoto #endif 1888d795f2aSAtsushi Nemoto #ifdef CONFIG_TOSHIBA_RBTX4938 189edcaf1a6SAtsushi Nemoto case 0x4938: 1907a1fdf19SYoichi Yuasa txx9_board_vec = &rbtx4938_vec; 191edcaf1a6SAtsushi Nemoto break; 1928d795f2aSAtsushi Nemoto #endif 193edcaf1a6SAtsushi Nemoto } 194edcaf1a6SAtsushi Nemoto #endif 1957a1fdf19SYoichi Yuasa 196edcaf1a6SAtsushi Nemoto strcpy(txx9_system_type, txx9_board_vec->system); 1977a1fdf19SYoichi Yuasa 1987b226094SAtsushi Nemoto txx9_board_vec->prom_init(); 199edcaf1a6SAtsushi Nemoto } 200edcaf1a6SAtsushi Nemoto 201edcaf1a6SAtsushi Nemoto void __init prom_free_prom_memory(void) 202edcaf1a6SAtsushi Nemoto { 203edcaf1a6SAtsushi Nemoto } 204edcaf1a6SAtsushi Nemoto 205edcaf1a6SAtsushi Nemoto const char *get_system_type(void) 206edcaf1a6SAtsushi Nemoto { 207edcaf1a6SAtsushi Nemoto return txx9_system_type; 208edcaf1a6SAtsushi Nemoto } 209edcaf1a6SAtsushi Nemoto 210edcaf1a6SAtsushi Nemoto char * __init prom_getcmdline(void) 211edcaf1a6SAtsushi Nemoto { 212edcaf1a6SAtsushi Nemoto return &(arcs_cmdline[0]); 213edcaf1a6SAtsushi Nemoto } 214edcaf1a6SAtsushi Nemoto 215*265b89dbSAtsushi Nemoto const char *__init prom_getenv(const char *name) 216*265b89dbSAtsushi Nemoto { 217*265b89dbSAtsushi Nemoto const s32 *str = (const s32 *)fw_arg2; 218*265b89dbSAtsushi Nemoto 219*265b89dbSAtsushi Nemoto if (!str) 220*265b89dbSAtsushi Nemoto return NULL; 221*265b89dbSAtsushi Nemoto /* YAMON style ("name", "value" pairs) */ 222*265b89dbSAtsushi Nemoto while (str[0] && str[1]) { 223*265b89dbSAtsushi Nemoto if (!strcmp((const char *)(unsigned long)str[0], name)) 224*265b89dbSAtsushi Nemoto return (const char *)(unsigned long)str[1]; 225*265b89dbSAtsushi Nemoto str += 2; 226*265b89dbSAtsushi Nemoto } 227*265b89dbSAtsushi Nemoto return NULL; 228*265b89dbSAtsushi Nemoto } 229*265b89dbSAtsushi Nemoto 230a49297e8SAtsushi Nemoto static void __noreturn txx9_machine_halt(void) 231a49297e8SAtsushi Nemoto { 232a49297e8SAtsushi Nemoto local_irq_disable(); 233a49297e8SAtsushi Nemoto clear_c0_status(ST0_IM); 234a49297e8SAtsushi Nemoto while (1) { 235a49297e8SAtsushi Nemoto if (cpu_wait) { 236a49297e8SAtsushi Nemoto (*cpu_wait)(); 237a49297e8SAtsushi Nemoto if (cpu_has_counter) { 238a49297e8SAtsushi Nemoto /* 239a49297e8SAtsushi Nemoto * Clear counter interrupt while it 240a49297e8SAtsushi Nemoto * breaks WAIT instruction even if 241a49297e8SAtsushi Nemoto * masked. 242a49297e8SAtsushi Nemoto */ 243a49297e8SAtsushi Nemoto write_c0_compare(0); 244a49297e8SAtsushi Nemoto } 245a49297e8SAtsushi Nemoto } 246a49297e8SAtsushi Nemoto } 247a49297e8SAtsushi Nemoto } 248a49297e8SAtsushi Nemoto 24968314725SAtsushi Nemoto /* Watchdog support */ 25068314725SAtsushi Nemoto void __init txx9_wdt_init(unsigned long base) 25168314725SAtsushi Nemoto { 25268314725SAtsushi Nemoto struct resource res = { 25368314725SAtsushi Nemoto .start = base, 25468314725SAtsushi Nemoto .end = base + 0x100 - 1, 25568314725SAtsushi Nemoto .flags = IORESOURCE_MEM, 25668314725SAtsushi Nemoto }; 25768314725SAtsushi Nemoto platform_device_register_simple("txx9wdt", -1, &res, 1); 25868314725SAtsushi Nemoto } 25968314725SAtsushi Nemoto 260c49f91f5SAtsushi Nemoto /* SPI support */ 261c49f91f5SAtsushi Nemoto void __init txx9_spi_init(int busid, unsigned long base, int irq) 262c49f91f5SAtsushi Nemoto { 263c49f91f5SAtsushi Nemoto struct resource res[] = { 264c49f91f5SAtsushi Nemoto { 265c49f91f5SAtsushi Nemoto .start = base, 266c49f91f5SAtsushi Nemoto .end = base + 0x20 - 1, 267c49f91f5SAtsushi Nemoto .flags = IORESOURCE_MEM, 268c49f91f5SAtsushi Nemoto }, { 269c49f91f5SAtsushi Nemoto .start = irq, 270c49f91f5SAtsushi Nemoto .flags = IORESOURCE_IRQ, 271c49f91f5SAtsushi Nemoto }, 272c49f91f5SAtsushi Nemoto }; 273c49f91f5SAtsushi Nemoto platform_device_register_simple("spi_txx9", busid, 274c49f91f5SAtsushi Nemoto res, ARRAY_SIZE(res)); 275c49f91f5SAtsushi Nemoto } 276c49f91f5SAtsushi Nemoto 277c49f91f5SAtsushi Nemoto void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr) 278c49f91f5SAtsushi Nemoto { 279c49f91f5SAtsushi Nemoto struct platform_device *pdev = 280c49f91f5SAtsushi Nemoto platform_device_alloc("tc35815-mac", id); 281c49f91f5SAtsushi Nemoto if (!pdev || 282c49f91f5SAtsushi Nemoto platform_device_add_data(pdev, ethaddr, 6) || 283c49f91f5SAtsushi Nemoto platform_device_add(pdev)) 284c49f91f5SAtsushi Nemoto platform_device_put(pdev); 285c49f91f5SAtsushi Nemoto } 286c49f91f5SAtsushi Nemoto 2877779a5e0SAtsushi Nemoto void __init txx9_sio_init(unsigned long baseaddr, int irq, 2887779a5e0SAtsushi Nemoto unsigned int line, unsigned int sclk, int nocts) 2897779a5e0SAtsushi Nemoto { 2907779a5e0SAtsushi Nemoto #ifdef CONFIG_SERIAL_TXX9 2917779a5e0SAtsushi Nemoto struct uart_port req; 2927779a5e0SAtsushi Nemoto 2937779a5e0SAtsushi Nemoto memset(&req, 0, sizeof(req)); 2947779a5e0SAtsushi Nemoto req.line = line; 2957779a5e0SAtsushi Nemoto req.iotype = UPIO_MEM; 2967779a5e0SAtsushi Nemoto req.membase = ioremap(baseaddr, 0x24); 2977779a5e0SAtsushi Nemoto req.mapbase = baseaddr; 2987779a5e0SAtsushi Nemoto req.irq = irq; 2997779a5e0SAtsushi Nemoto if (!nocts) 3007779a5e0SAtsushi Nemoto req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/; 3017779a5e0SAtsushi Nemoto if (sclk) { 3027779a5e0SAtsushi Nemoto req.flags |= UPF_MAGIC_MULTIPLIER /*USE_SCLK*/; 3037779a5e0SAtsushi Nemoto req.uartclk = sclk; 3047779a5e0SAtsushi Nemoto } else 3057779a5e0SAtsushi Nemoto req.uartclk = TXX9_IMCLK; 3067779a5e0SAtsushi Nemoto early_serial_txx9_setup(&req); 3077779a5e0SAtsushi Nemoto #endif /* CONFIG_SERIAL_TXX9 */ 3087779a5e0SAtsushi Nemoto } 3097779a5e0SAtsushi Nemoto 310e352953cSAtsushi Nemoto #ifdef CONFIG_EARLY_PRINTK 311e352953cSAtsushi Nemoto static void __init null_prom_putchar(char c) 312e352953cSAtsushi Nemoto { 313e352953cSAtsushi Nemoto } 314e352953cSAtsushi Nemoto void (*txx9_prom_putchar)(char c) __initdata = null_prom_putchar; 315e352953cSAtsushi Nemoto 316e352953cSAtsushi Nemoto void __init prom_putchar(char c) 317e352953cSAtsushi Nemoto { 318e352953cSAtsushi Nemoto txx9_prom_putchar(c); 319e352953cSAtsushi Nemoto } 320e352953cSAtsushi Nemoto 321e352953cSAtsushi Nemoto static void __iomem *early_txx9_sio_port; 322e352953cSAtsushi Nemoto 323e352953cSAtsushi Nemoto static void __init early_txx9_sio_putchar(char c) 324e352953cSAtsushi Nemoto { 325e352953cSAtsushi Nemoto #define TXX9_SICISR 0x0c 326e352953cSAtsushi Nemoto #define TXX9_SITFIFO 0x1c 327e352953cSAtsushi Nemoto #define TXX9_SICISR_TXALS 0x00000002 328e352953cSAtsushi Nemoto while (!(__raw_readl(early_txx9_sio_port + TXX9_SICISR) & 329e352953cSAtsushi Nemoto TXX9_SICISR_TXALS)) 330e352953cSAtsushi Nemoto ; 331e352953cSAtsushi Nemoto __raw_writel(c, early_txx9_sio_port + TXX9_SITFIFO); 332e352953cSAtsushi Nemoto } 333e352953cSAtsushi Nemoto 334e352953cSAtsushi Nemoto void __init txx9_sio_putchar_init(unsigned long baseaddr) 335e352953cSAtsushi Nemoto { 336e352953cSAtsushi Nemoto early_txx9_sio_port = ioremap(baseaddr, 0x24); 337e352953cSAtsushi Nemoto txx9_prom_putchar = early_txx9_sio_putchar; 338e352953cSAtsushi Nemoto } 339e352953cSAtsushi Nemoto #endif /* CONFIG_EARLY_PRINTK */ 340e352953cSAtsushi Nemoto 341edcaf1a6SAtsushi Nemoto /* wrappers */ 342edcaf1a6SAtsushi Nemoto void __init plat_mem_setup(void) 343edcaf1a6SAtsushi Nemoto { 34494a4c329SAtsushi Nemoto ioport_resource.start = 0; 34594a4c329SAtsushi Nemoto ioport_resource.end = ~0UL; /* no limit */ 34694a4c329SAtsushi Nemoto iomem_resource.start = 0; 34794a4c329SAtsushi Nemoto iomem_resource.end = ~0UL; /* no limit */ 348a49297e8SAtsushi Nemoto 349a49297e8SAtsushi Nemoto /* fallback restart/halt routines */ 350a49297e8SAtsushi Nemoto _machine_restart = (void (*)(char *))txx9_machine_halt; 351a49297e8SAtsushi Nemoto _machine_halt = txx9_machine_halt; 352a49297e8SAtsushi Nemoto pm_power_off = txx9_machine_halt; 353a49297e8SAtsushi Nemoto 35407517529SAtsushi Nemoto #ifdef CONFIG_PCI 35507517529SAtsushi Nemoto pcibios_plat_setup = txx9_pcibios_setup; 35607517529SAtsushi Nemoto #endif 357edcaf1a6SAtsushi Nemoto txx9_board_vec->mem_setup(); 358edcaf1a6SAtsushi Nemoto } 359edcaf1a6SAtsushi Nemoto 360edcaf1a6SAtsushi Nemoto void __init arch_init_irq(void) 361edcaf1a6SAtsushi Nemoto { 362edcaf1a6SAtsushi Nemoto txx9_board_vec->irq_setup(); 363edcaf1a6SAtsushi Nemoto } 364edcaf1a6SAtsushi Nemoto 365edcaf1a6SAtsushi Nemoto void __init plat_time_init(void) 366edcaf1a6SAtsushi Nemoto { 3671374d084SAtsushi Nemoto #ifdef CONFIG_CPU_TX49XX 3681374d084SAtsushi Nemoto mips_hpt_frequency = txx9_cpu_clock / 2; 3691374d084SAtsushi Nemoto #endif 370edcaf1a6SAtsushi Nemoto txx9_board_vec->time_init(); 371edcaf1a6SAtsushi Nemoto } 372edcaf1a6SAtsushi Nemoto 373edcaf1a6SAtsushi Nemoto static int __init _txx9_arch_init(void) 374edcaf1a6SAtsushi Nemoto { 375edcaf1a6SAtsushi Nemoto if (txx9_board_vec->arch_init) 376edcaf1a6SAtsushi Nemoto txx9_board_vec->arch_init(); 377edcaf1a6SAtsushi Nemoto return 0; 378edcaf1a6SAtsushi Nemoto } 379edcaf1a6SAtsushi Nemoto arch_initcall(_txx9_arch_init); 380edcaf1a6SAtsushi Nemoto 381edcaf1a6SAtsushi Nemoto static int __init _txx9_device_init(void) 382edcaf1a6SAtsushi Nemoto { 383edcaf1a6SAtsushi Nemoto if (txx9_board_vec->device_init) 384edcaf1a6SAtsushi Nemoto txx9_board_vec->device_init(); 385edcaf1a6SAtsushi Nemoto return 0; 386edcaf1a6SAtsushi Nemoto } 387edcaf1a6SAtsushi Nemoto device_initcall(_txx9_device_init); 388edcaf1a6SAtsushi Nemoto 389edcaf1a6SAtsushi Nemoto int (*txx9_irq_dispatch)(int pending); 390edcaf1a6SAtsushi Nemoto asmlinkage void plat_irq_dispatch(void) 391edcaf1a6SAtsushi Nemoto { 392edcaf1a6SAtsushi Nemoto int pending = read_c0_status() & read_c0_cause() & ST0_IM; 393edcaf1a6SAtsushi Nemoto int irq = txx9_irq_dispatch(pending); 394edcaf1a6SAtsushi Nemoto 395edcaf1a6SAtsushi Nemoto if (likely(irq >= 0)) 396edcaf1a6SAtsushi Nemoto do_IRQ(irq); 397edcaf1a6SAtsushi Nemoto else 398edcaf1a6SAtsushi Nemoto spurious_interrupt(); 399edcaf1a6SAtsushi Nemoto } 4004c642f3fSAtsushi Nemoto 4014c642f3fSAtsushi Nemoto /* see include/asm-mips/mach-tx39xx/mangle-port.h, for example. */ 4024c642f3fSAtsushi Nemoto #ifdef NEEDS_TXX9_SWIZZLE_ADDR_B 4034c642f3fSAtsushi Nemoto static unsigned long __swizzle_addr_none(unsigned long port) 4044c642f3fSAtsushi Nemoto { 4054c642f3fSAtsushi Nemoto return port; 4064c642f3fSAtsushi Nemoto } 4074c642f3fSAtsushi Nemoto unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; 4084c642f3fSAtsushi Nemoto EXPORT_SYMBOL(__swizzle_addr_b); 4094c642f3fSAtsushi Nemoto #endif 410