2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) 2004 peng.liu@infineon.com
17 * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
20 #include <linux/init.h>
23 #include <linux/cpu.h>
26 #include <asm/traps.h>
28 #include <asm/bootinfo.h>
30 #include <asm/ifxmips/ifxmips.h>
31 #include <asm/ifxmips/ifxmips_irq.h>
32 #include <asm/ifxmips/ifxmips_pmu.h>
33 #include <asm/ifxmips/ifxmips_cgu.h>
34 #include <asm/ifxmips/ifxmips_prom.h>
36 static unsigned int r4k_offset
;
37 static unsigned int r4k_cur
;
39 /* required in arch/mips/kernel/kspd.c */
40 unsigned long cpu_khz
;
42 extern void ifxmips_reboot_setup(void);
44 unsigned int ifxmips_get_cpu_ver(void)
46 return (ifxmips_r32(IFXMIPS_MPS_CHIPID
) & 0xF0000000) >> 28;
48 EXPORT_SYMBOL(ifxmips_get_cpu_ver
);
50 static inline u32
ifxmips_get_counter_resolution(void)
67 void __init
plat_time_init(void)
69 mips_hpt_frequency
= ifxmips_get_cpu_hz() / ifxmips_get_counter_resolution();
70 r4k_cur
= (read_c0_count() + r4k_offset
);
71 write_c0_compare(r4k_cur
);
73 ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_GPT
| IFXMIPS_PMU_PWDCR_FPI
);
74 ifxmips_w32(0x100, IFXMIPS_GPTU_GPT_CLC
); /* set clock divider to 1 */
75 cpu_khz
= ifxmips_get_cpu_hz();
78 void __init
plat_mem_setup(void)
81 prom_printf("This %s system has a cpu rev of %d\n", get_system_type(), ifxmips_get_cpu_ver());
83 /* make sure to have no "reverse endian" for user mode! */
84 status
= read_c0_status();
86 write_c0_status(status
);
88 ifxmips_reboot_setup();
90 ioport_resource
.start
= IOPORT_RESOURCE_START
;
91 ioport_resource
.end
= IOPORT_RESOURCE_END
;
92 iomem_resource
.start
= IOMEM_RESOURCE_START
;
93 iomem_resource
.end
= IOMEM_RESOURCE_END
;
This page took 0.05161 seconds and 5 git commands to generate.