7093b7f7e3e2ab0269123ff5da4179590235f493
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 <asm/traps.h>
26 #include <asm/bootinfo.h>
27 #include <asm/ifxmips/ifxmips.h>
28 #include <asm/ifxmips/ifxmips_irq.h>
29 #include <asm/ifxmips/ifxmips_pmu.h>
30 #include <asm/ifxmips/ifxmips_prom.h>
32 static unsigned int r4k_offset
;
33 static unsigned int r4k_cur
;
35 extern void ifxmips_reboot_setup(void);
38 ifxmips_get_ddr_hz(void)
40 switch(ifxmips_r32(IFXMIPS_CGU_SYS
) & 0x3)
51 EXPORT_SYMBOL(ifxmips_get_ddr_hz
);
54 ifxmips_get_cpu_hz(void)
56 unsigned int ddr_clock
= ifxmips_get_ddr_hz();
57 switch(ifxmips_r32(IFXMIPS_CGU_SYS
) & 0xc)
64 return ddr_clock
<< 1;
66 EXPORT_SYMBOL(ifxmips_get_cpu_hz
);
69 ifxmips_get_fpi_hz(void)
71 unsigned int ddr_clock
= ifxmips_get_ddr_hz();
72 if(ifxmips_r32(IFXMIPS_CGU_SYS
) & 0x40)
73 return ddr_clock
>> 1;
76 EXPORT_SYMBOL(ifxmips_get_fpi_hz
);
79 ifxmips_get_cpu_ver(void)
81 return ifxmips_r32(IFXMIPS_MCD_CHIPID
) & 0xFFFFF000;
83 EXPORT_SYMBOL(ifxmips_get_cpu_ver
);
86 ifxmips_get_counter_resolution(void)
104 ifxmips_be_handler(struct pt_regs
*regs
, int is_fixup
)
107 printk(KERN_ERR
"TODO: BUS error\n");
109 return MIPS_BE_FATAL
;
115 mips_hpt_frequency
= ifxmips_get_cpu_hz() / ifxmips_get_counter_resolution();
116 r4k_cur
= (read_c0_count() + r4k_offset
);
117 write_c0_compare(r4k_cur
);
118 ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_GPT
| IFXMIPS_PMU_PWDCR_FPI
);
120 ifxmips_w32(0x100, IFXMIPS_GPTU_GPT_CLC
);
122 ifxmips_w32(0xffff, IFXMIPS_GPTU_GPT_CAPREL
);
123 ifxmips_w32(0x80C0, IFXMIPS_GPTU_GPT_T6CON
);
130 prom_printf("This %s has a cpu rev of 0x%X\n", get_system_type(), ifxmips_get_cpu_ver());
132 status
= read_c0_status();
133 status
&= (~(1<<25));
134 write_c0_status(status
);
136 ifxmips_reboot_setup();
137 board_be_handler
= &ifxmips_be_handler
;
139 ioport_resource
.start
= IOPORT_RESOURCE_START
;
140 ioport_resource
.end
= IOPORT_RESOURCE_END
;
141 iomem_resource
.start
= IOMEM_RESOURCE_START
;
142 iomem_resource
.end
= IOMEM_RESOURCE_END
;
This page took 0.043941 seconds and 3 git commands to generate.