2 * Ralink RT305x SoC specific setup
4 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
6 * Parts of this file are based on Ralink's 2.6.21 BSP
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/init.h>
17 #include <asm/mips_machine.h>
18 #include <asm/reboot.h>
21 #include <asm/mach-ralink/common.h>
22 #include <asm/mach-ralink/rt305x.h>
23 #include <asm/mach-ralink/rt305x_regs.h>
25 static void rt305x_restart(char *command)
27 rt305x_sysc_wr(RT305X_RESET_SYSTEM, SYSC_REG_RESET_CTRL);
33 static void rt305x_halt(void)
40 unsigned int __cpuinit get_c0_compare_irq(void)
42 return CP0_LEGACY_COMPARE_IRQ;
45 void __init ramips_soc_setup(void)
47 rt305x_sysc_base = ioremap_nocache(RT305X_SYSC_BASE, PAGE_SIZE);
48 rt305x_memc_base = ioremap_nocache(RT305X_MEMC_BASE, PAGE_SIZE);
50 rt305x_detect_sys_type();
51 rt305x_detect_sys_freq();
53 printk(KERN_INFO "%s running at %lu.%02lu MHz\n", ramips_sys_type,
54 rt305x_cpu_freq / 1000000,
55 (rt305x_cpu_freq % 1000000) * 100 / 1000000);
57 _machine_restart = rt305x_restart;
58 _machine_halt = rt305x_halt;
59 pm_power_off = rt305x_halt;
61 ramips_early_serial_setup(0, RT305X_UART0_BASE, rt305x_sys_freq,
62 RT305X_INTC_IRQ_UART0);
63 ramips_early_serial_setup(1, RT305X_UART1_BASE, rt305x_sys_freq,
64 RT305X_INTC_IRQ_UART1);
67 void __init plat_time_init(void)
69 mips_hpt_frequency = rt305x_cpu_freq / 2;