Path: blob/master/arch/mn10300/proc-mn103e010/proc-init.c
10817 views
/* MN103E010 Processor initialisation1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public Licence7* as published by the Free Software Foundation; either version8* 2 of the Licence, or (at your option) any later version.9*/10#include <linux/kernel.h>11#include <asm/fpu.h>12#include <asm/rtc.h>13#include <asm/busctl-regs.h>1415/*16* initialise the on-silicon processor peripherals17*/18asmlinkage void __init processor_init(void)19{20int loop;2122/* set up the exception table first */23for (loop = 0x000; loop < 0x400; loop += 8)24__set_intr_stub(loop, __common_exception);2526__set_intr_stub(EXCEP_ITLBMISS, itlb_miss);27__set_intr_stub(EXCEP_DTLBMISS, dtlb_miss);28__set_intr_stub(EXCEP_IAERROR, itlb_aerror);29__set_intr_stub(EXCEP_DAERROR, dtlb_aerror);30__set_intr_stub(EXCEP_BUSERROR, raw_bus_error);31__set_intr_stub(EXCEP_DOUBLE_FAULT, double_fault);32__set_intr_stub(EXCEP_FPU_DISABLED, fpu_disabled);33__set_intr_stub(EXCEP_SYSCALL0, system_call);3435__set_intr_stub(EXCEP_NMI, nmi_handler);36__set_intr_stub(EXCEP_WDT, nmi_handler);37__set_intr_stub(EXCEP_IRQ_LEVEL0, irq_handler);38__set_intr_stub(EXCEP_IRQ_LEVEL1, irq_handler);39__set_intr_stub(EXCEP_IRQ_LEVEL2, irq_handler);40__set_intr_stub(EXCEP_IRQ_LEVEL3, irq_handler);41__set_intr_stub(EXCEP_IRQ_LEVEL4, irq_handler);42__set_intr_stub(EXCEP_IRQ_LEVEL5, irq_handler);43__set_intr_stub(EXCEP_IRQ_LEVEL6, irq_handler);4445IVAR0 = EXCEP_IRQ_LEVEL0;46IVAR1 = EXCEP_IRQ_LEVEL1;47IVAR2 = EXCEP_IRQ_LEVEL2;48IVAR3 = EXCEP_IRQ_LEVEL3;49IVAR4 = EXCEP_IRQ_LEVEL4;50IVAR5 = EXCEP_IRQ_LEVEL5;51IVAR6 = EXCEP_IRQ_LEVEL6;5253mn10300_dcache_flush_inv();54mn10300_icache_inv();5556/* disable all interrupts and set to priority 6 (lowest) */57for (loop = 0; loop < NR_IRQS; loop++)58GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT;5960/* clear the timers */61TM0MD = 0;62TM1MD = 0;63TM2MD = 0;64TM3MD = 0;65TM4MD = 0;66TM5MD = 0;67TM6MD = 0;68TM6MDA = 0;69TM6MDB = 0;70TM7MD = 0;71TM8MD = 0;72TM9MD = 0;73TM10MD = 0;74TM11MD = 0;7576calibrate_clock();77}7879/*80* determine the memory size and base from the memory controller regs81*/82void __init get_mem_info(unsigned long *mem_base, unsigned long *mem_size)83{84unsigned long base, size;8586*mem_base = 0;87*mem_size = 0;8889base = SDBASE(0);90if (base & SDBASE_CE) {91size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT;92size = ~size + 1;93base &= SDBASE_CBA;9495printk(KERN_INFO "SDRAM[0]: %luMb @%08lx\n", size >> 20, base);96*mem_size += size;97*mem_base = base;98}99100base = SDBASE(1);101if (base & SDBASE_CE) {102size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT;103size = ~size + 1;104base &= SDBASE_CBA;105106printk(KERN_INFO "SDRAM[1]: %luMb @%08lx\n", size >> 20, base);107*mem_size += size;108if (*mem_base == 0)109*mem_base = base;110}111}112113114