2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* linux/arch/m68knommu/kernel/setup.c
|
|
|
|
*
|
2007-07-16 10:38:33 +04:00
|
|
|
* Copyright (C) 1999-2007 Greg Ungerer (gerg@snapgear.com)
|
|
|
|
* Copyright (C) 1998,1999 D. Jeff Dionne <jeff@uClinux.org>
|
2005-04-17 02:20:36 +04:00
|
|
|
* Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
|
|
|
|
* Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
|
|
|
|
* Copyright (C) 1995 Hamish Macdonald
|
2005-09-02 04:42:52 +04:00
|
|
|
* Copyright (C) 2000 Lineo Inc. (www.lineo.com)
|
2005-04-17 02:20:36 +04:00
|
|
|
* Copyright (C) 2001 Lineo, Inc. <www.lineo.com>
|
|
|
|
*
|
|
|
|
* 68VZ328 Fixes/support Evan Stawnyczy <e@lineo.ca>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file handles the architecture-dependent parts of system setup
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/fb.h>
|
2005-09-02 04:42:52 +04:00
|
|
|
#include <linux/module.h>
|
2008-07-24 08:28:13 +04:00
|
|
|
#include <linux/mm.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/console.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/bootmem.h>
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/init.h>
|
2009-09-18 21:49:36 +04:00
|
|
|
#include <linux/initrd.h>
|
|
|
|
#include <linux/root_dev.h>
|
2012-01-23 07:25:56 +04:00
|
|
|
#include <linux/rtc.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#include <asm/setup.h>
|
2016-09-05 08:23:50 +03:00
|
|
|
#include <asm/bootinfo.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/machdep.h>
|
|
|
|
#include <asm/pgtable.h>
|
2011-08-22 11:07:40 +04:00
|
|
|
#include <asm/sections.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
unsigned long memory_start;
|
|
|
|
unsigned long memory_end;
|
|
|
|
|
2005-09-02 04:42:52 +04:00
|
|
|
EXPORT_SYMBOL(memory_start);
|
|
|
|
EXPORT_SYMBOL(memory_end);
|
|
|
|
|
2007-02-12 11:54:14 +03:00
|
|
|
char __initdata command_line[COMMAND_LINE_SIZE];
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* machine dependent timer functions */
|
2012-01-23 09:34:58 +04:00
|
|
|
void (*mach_sched_init)(irq_handler_t handler) __initdata = NULL;
|
2007-07-16 10:38:33 +04:00
|
|
|
int (*mach_set_clock_mmss)(unsigned long);
|
2012-01-23 07:25:56 +04:00
|
|
|
int (*mach_hwclk) (int, struct rtc_time*);
|
2007-07-16 10:38:33 +04:00
|
|
|
|
|
|
|
/* machine dependent reboot functions */
|
|
|
|
void (*mach_reset)(void);
|
|
|
|
void (*mach_halt)(void);
|
|
|
|
void (*mach_power_off)(void);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2013-02-15 01:18:34 +04:00
|
|
|
#ifdef CONFIG_M68000
|
2014-04-05 12:05:45 +04:00
|
|
|
#if defined(CONFIG_M68328)
|
2010-11-02 10:13:27 +03:00
|
|
|
#define CPU_NAME "MC68328"
|
2014-04-05 12:05:45 +04:00
|
|
|
#elif defined(CONFIG_M68EZ328)
|
2010-11-02 10:13:27 +03:00
|
|
|
#define CPU_NAME "MC68EZ328"
|
2014-04-05 12:05:45 +04:00
|
|
|
#elif defined(CONFIG_M68VZ328)
|
2010-11-02 10:13:27 +03:00
|
|
|
#define CPU_NAME "MC68VZ328"
|
2014-04-05 12:05:45 +04:00
|
|
|
#else
|
|
|
|
#define CPU_NAME "MC68000"
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
2014-04-05 12:05:45 +04:00
|
|
|
#endif /* CONFIG_M68000 */
|
2010-11-02 10:13:27 +03:00
|
|
|
#ifndef CPU_NAME
|
|
|
|
#define CPU_NAME "UNKNOWN"
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
|
2010-11-02 10:40:37 +03:00
|
|
|
/*
|
|
|
|
* Different cores have different instruction execution timings.
|
|
|
|
* The old/traditional 68000 cores are basically all the same, at 16.
|
|
|
|
* The ColdFire cores vary a little, their values are defined in their
|
|
|
|
* headers. We default to the standard 68000 value here.
|
|
|
|
*/
|
|
|
|
#ifndef CPU_INSTR_PER_JIFFY
|
|
|
|
#define CPU_INSTR_PER_JIFFY 16
|
|
|
|
#endif
|
|
|
|
|
2007-10-24 06:03:41 +04:00
|
|
|
void __init setup_arch(char **cmdline_p)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
|
|
|
int bootmap_size;
|
|
|
|
|
|
|
|
memory_start = PAGE_ALIGN(_ramstart);
|
2007-07-16 10:38:33 +04:00
|
|
|
memory_end = _ramend;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
init_mm.start_code = (unsigned long) &_stext;
|
|
|
|
init_mm.end_code = (unsigned long) &_etext;
|
|
|
|
init_mm.end_data = (unsigned long) &_edata;
|
2005-09-02 04:42:52 +04:00
|
|
|
init_mm.brk = (unsigned long) 0;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
config_BSP(&command_line[0], sizeof(command_line));
|
|
|
|
|
2007-07-25 16:07:20 +04:00
|
|
|
#if defined(CONFIG_BOOTPARAM)
|
|
|
|
strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line));
|
|
|
|
command_line[sizeof(command_line) - 1] = 0;
|
2009-09-18 21:49:36 +04:00
|
|
|
#endif /* CONFIG_BOOTPARAM */
|
|
|
|
|
2016-09-05 08:23:50 +03:00
|
|
|
process_uboot_commandline(&command_line[0], sizeof(command_line));
|
2007-07-25 16:07:20 +04:00
|
|
|
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("uClinux with CPU " CPU_NAME "\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#ifdef CONFIG_UCDIMM
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("uCdimm by Lineo, Inc. <www.lineo.com>\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_M68VZ328
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_COLDFIRE
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#ifdef CONFIG_M5307
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_ELITE
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
|
2005-09-02 04:42:52 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("TRG SuperPilot FLASH card support <info@trgnet.com>\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
#if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_DRAGEN2
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("DragonEngine II board support by Georges Menie\n");
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
2005-09-02 04:42:52 +04:00
|
|
|
#ifdef CONFIG_M5235EVB
|
2016-09-09 10:01:06 +03:00
|
|
|
pr_info("Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n");
|
2005-09-02 04:42:52 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2012-05-31 23:39:13 +04:00
|
|
|
pr_debug("KERNEL -> TEXT=0x%p-0x%p DATA=0x%p-0x%p BSS=0x%p-0x%p\n",
|
2012-05-31 23:46:03 +04:00
|
|
|
_stext, _etext, _sdata, _edata, __bss_start, __bss_stop);
|
2012-05-31 23:39:13 +04:00
|
|
|
pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ",
|
2012-05-31 23:46:03 +04:00
|
|
|
__bss_stop, memory_start, memory_start, memory_end);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* Keep a copy of command line */
|
|
|
|
*cmdline_p = &command_line[0];
|
2007-02-12 11:54:14 +03:00
|
|
|
memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
|
|
|
|
boot_command_line[COMMAND_LINE_SIZE-1] = 0;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
|
|
|
|
conswitchp = &dummy_con;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Give all the memory to the bootmap allocator, tell it to put the
|
|
|
|
* boot mem_map at the start of memory.
|
|
|
|
*/
|
2015-11-15 13:46:55 +03:00
|
|
|
min_low_pfn = PFN_DOWN(memory_start);
|
|
|
|
max_pfn = max_low_pfn = PFN_DOWN(memory_end);
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
bootmap_size = init_bootmem_node(
|
|
|
|
NODE_DATA(0),
|
2015-11-15 13:46:55 +03:00
|
|
|
min_low_pfn, /* map goes here */
|
|
|
|
PFN_DOWN(PAGE_OFFSET),
|
|
|
|
max_pfn);
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Free the usable memory, we have to make sure we do not free
|
|
|
|
* the bootmem bitmap so we then reserve it after freeing it :-)
|
|
|
|
*/
|
|
|
|
free_bootmem(memory_start, memory_end - memory_start);
|
2008-02-07 11:15:17 +03:00
|
|
|
reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2009-09-18 21:49:36 +04:00
|
|
|
#if defined(CONFIG_UBOOT) && defined(CONFIG_BLK_DEV_INITRD)
|
|
|
|
if ((initrd_start > 0) && (initrd_start < initrd_end) &&
|
|
|
|
(initrd_end < memory_end))
|
|
|
|
reserve_bootmem(initrd_start, initrd_end - initrd_start,
|
|
|
|
BOOTMEM_DEFAULT);
|
|
|
|
#endif /* if defined(CONFIG_BLK_DEV_INITRD) */
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Get kmalloc into gear.
|
|
|
|
*/
|
|
|
|
paging_init();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get CPU information for use by the procfs.
|
|
|
|
*/
|
|
|
|
static int show_cpuinfo(struct seq_file *m, void *v)
|
|
|
|
{
|
2007-07-20 11:31:47 +04:00
|
|
|
char *cpu, *mmu, *fpu;
|
|
|
|
u_long clockfreq;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-11-02 10:13:27 +03:00
|
|
|
cpu = CPU_NAME;
|
2007-07-20 11:31:47 +04:00
|
|
|
mmu = "none";
|
|
|
|
fpu = "none";
|
2010-11-02 10:40:37 +03:00
|
|
|
clockfreq = (loops_per_jiffy * HZ) * CPU_INSTR_PER_JIFFY;
|
2007-07-20 11:31:47 +04:00
|
|
|
|
|
|
|
seq_printf(m, "CPU:\t\t%s\n"
|
|
|
|
"MMU:\t\t%s\n"
|
|
|
|
"FPU:\t\t%s\n"
|
|
|
|
"Clocking:\t%lu.%1luMHz\n"
|
|
|
|
"BogoMips:\t%lu.%02lu\n"
|
|
|
|
"Calibration:\t%lu loops\n",
|
|
|
|
cpu, mmu, fpu,
|
|
|
|
clockfreq / 1000000,
|
|
|
|
(clockfreq / 100000) % 10,
|
|
|
|
(loops_per_jiffy * HZ) / 500000,
|
|
|
|
((loops_per_jiffy * HZ) / 5000) % 100,
|
|
|
|
(loops_per_jiffy * HZ));
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *c_start(struct seq_file *m, loff_t *pos)
|
|
|
|
{
|
|
|
|
return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
|
|
|
|
{
|
|
|
|
++*pos;
|
|
|
|
return c_start(m, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void c_stop(struct seq_file *m, void *v)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-02-08 15:21:19 +03:00
|
|
|
const struct seq_operations cpuinfo_op = {
|
2005-04-17 02:20:36 +04:00
|
|
|
.start = c_start,
|
|
|
|
.next = c_next,
|
|
|
|
.stop = c_stop,
|
|
|
|
.show = show_cpuinfo,
|
|
|
|
};
|
|
|
|
|