Path: blob/master/arch/mn10300/proc-mn2ws0050/proc-init.c
10819 views
/* MN2WS0050 processor initialisation1*2* Copyright (C) 2005 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 License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/10#include <linux/sched.h>11#include <linux/kernel.h>12#include <linux/init.h>13#include <linux/delay.h>14#include <linux/interrupt.h>1516#include <asm/processor.h>17#include <asm/system.h>18#include <asm/uaccess.h>19#include <asm/io.h>20#include <asm/atomic.h>21#include <asm/smp.h>22#include <asm/pgalloc.h>23#include <asm/busctl-regs.h>24#include <unit/timex.h>25#include <asm/fpu.h>26#include <asm/rtc.h>2728#define MEMCONF __SYSREGC(0xdf800400, u32)2930/*31* initialise the on-silicon processor peripherals32*/33asmlinkage void __init processor_init(void)34{35int loop;3637/* set up the exception table first */38for (loop = 0x000; loop < 0x400; loop += 8)39__set_intr_stub(loop, __common_exception);4041__set_intr_stub(EXCEP_ITLBMISS, itlb_miss);42__set_intr_stub(EXCEP_DTLBMISS, dtlb_miss);43__set_intr_stub(EXCEP_IAERROR, itlb_aerror);44__set_intr_stub(EXCEP_DAERROR, dtlb_aerror);45__set_intr_stub(EXCEP_BUSERROR, raw_bus_error);46__set_intr_stub(EXCEP_DOUBLE_FAULT, double_fault);47__set_intr_stub(EXCEP_FPU_DISABLED, fpu_disabled);48__set_intr_stub(EXCEP_SYSCALL0, system_call);4950__set_intr_stub(EXCEP_NMI, nmi_handler);51__set_intr_stub(EXCEP_WDT, nmi_handler);52__set_intr_stub(EXCEP_IRQ_LEVEL0, irq_handler);53__set_intr_stub(EXCEP_IRQ_LEVEL1, irq_handler);54__set_intr_stub(EXCEP_IRQ_LEVEL2, irq_handler);55__set_intr_stub(EXCEP_IRQ_LEVEL3, irq_handler);56__set_intr_stub(EXCEP_IRQ_LEVEL4, irq_handler);57__set_intr_stub(EXCEP_IRQ_LEVEL5, irq_handler);58__set_intr_stub(EXCEP_IRQ_LEVEL6, irq_handler);5960IVAR0 = EXCEP_IRQ_LEVEL0;61IVAR1 = EXCEP_IRQ_LEVEL1;62IVAR2 = EXCEP_IRQ_LEVEL2;63IVAR3 = EXCEP_IRQ_LEVEL3;64IVAR4 = EXCEP_IRQ_LEVEL4;65IVAR5 = EXCEP_IRQ_LEVEL5;66IVAR6 = EXCEP_IRQ_LEVEL6;6768#ifndef CONFIG_MN10300_HAS_CACHE_SNOOP69mn10300_dcache_flush_inv();70mn10300_icache_inv();71#endif7273/* disable all interrupts and set to priority 6 (lowest) */74#ifdef CONFIG_SMP75for (loop = 0; loop < GxICR_NUM_IRQS; loop++)76GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT;77#else /* !CONFIG_SMP */78for (loop = 0; loop < NR_IRQS; loop++)79GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT;80#endif /* !CONFIG_SMP */8182/* clear the timers */83TM0MD = 0;84TM1MD = 0;85TM2MD = 0;86TM3MD = 0;87TM4MD = 0;88TM5MD = 0;89TM6MD = 0;90TM6MDA = 0;91TM6MDB = 0;92TM7MD = 0;93TM8MD = 0;94TM9MD = 0;95TM10MD = 0;96TM11MD = 0;97TM12MD = 0;98TM13MD = 0;99TM14MD = 0;100TM15MD = 0;101102calibrate_clock();103}104105/*106* determine the memory size and base from the memory controller regs107*/108void __init get_mem_info(unsigned long *mem_base, unsigned long *mem_size)109{110unsigned long memconf = MEMCONF;111unsigned long size = 0; /* order: MByte */112113*mem_base = 0x90000000; /* fixed address */114115switch (memconf & 0x00000003) {116case 0x01:117size = 256 / 8; /* 256 Mbit per chip */118break;119case 0x02:120size = 512 / 8; /* 512 Mbit per chip */121break;122case 0x03:123size = 1024 / 8; /* 1 Gbit per chip */124break;125default:126panic("Invalid SDRAM size");127break;128}129130printk(KERN_INFO "DDR2-SDRAM: %luMB x 2 @%08lx\n", size, *mem_base);131132*mem_size = (size * 2) << 20;133}134135136