ambapp_dev_irqmp *irqmp = NULL;
ambapp_dev_gptimer *gptimer = NULL;
unsigned int gptimer_irq = 0;
-int leon3_snooping_avail = 0;
/*
* Breath some life into the CPU...
#endif
}
-/* Routine called from start.S,
- *
- * Run from FLASH/PROM:
- * - memory controller has already been setup up, stack can be used
- * - global variables available for read/writing
- * - constants avaiable
- */
-void cpu_init_f2(void)
+/* If cache snooping is available in hardware the result will be set
+ * to 0x800000, otherwise 0.
+ */
+static unsigned int snoop_detect(void)
{
- /* Initialize the AMBA Plug & Play bus structure, the bus
- * structure represents the AMBA bus that the CPU is located at.
- */
- ambapp_bus_init(CONFIG_AMBAPP_IOAREA, CONFIG_SYS_CLK_FREQ, &ambapp_plb);
+ unsigned int result;
+ asm("lda [%%g0] 2, %0" : "=r"(result));
+ return result & 0x00800000;
}
int arch_cpu_init(void)
gd->bus_clk = CONFIG_SYS_CLK_FREQ;
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+ gd->arch.snooping_available = snoop_detect();
+
+ /* Initialize the AMBA Plug & Play bus structure, the bus
+ * structure represents the AMBA bus that the CPU is located at.
+ */
+ ambapp_bus_init(CONFIG_AMBAPP_IOAREA, CONFIG_SYS_CLK_FREQ, &ambapp_plb);
+
return 0;
}
int cpu_init_r(void)
{
ambapp_apbdev apbdev;
- int index, cpu;
+ int index, cpu, ntimers, i;
ambapp_dev_gptimer *timer = NULL;
unsigned int bus_freq;
timer->scalar = timer->scalar_reload =
(((bus_freq / 1000) + 500) / 1000) - 1;
+ /* Clear All Timers */
+ ntimers = timer->config & 0x7;
+ for (i = 0; i < ntimers; i++) {
+ timer->e[i].ctrl = GPTIMER_CTRL_IP;
+ timer->e[i].rld = 0;
+ timer->e[i].ctrl = GPTIMER_CTRL_LD;
+ }
+
index++;
}
if (!gptimer) {