-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MIPS: Loongson: Split the implementation of prom and setup parts
This patch split the old initilization and setup implementation to several file, one file one logic function. the other main changes include: 1. as the script/checkpatch.pl suggests, use strict_strtol instead of simple_strtol in arch/mips/lemote/lm2e/cmdline.c 2. use the existed macros in asm/mips-boards/bonito64.h as the arguments of set_io_port_base() and remove the un-needed ones in asm/mach-lemote/pci.h Signed-off-by: Wu Zhangjin <wuzj@lemote.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
- Loading branch information
Wu Zhangjin
authored and
Ralf Baechle
committed
Sep 17, 2009
1 parent
f54a40e
commit bd92aa0
Showing
9 changed files
with
168 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Based on Ocelot Linux port, which is | ||
* Copyright 2001 MontaVista Software Inc. | ||
* Author: jsun@mvista.com or jsun@junsun.net | ||
* | ||
* Copyright 2003 ICT CAS | ||
* Author: Michael Guo <guoyi@ict.ac.cn> | ||
* | ||
* Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | ||
* Author: Fuxin Zhang, zhangfx@lemote.com | ||
* | ||
* Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology | ||
* Author: Wu Zhangjin, wuzj@lemote.com | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
#include <linux/io.h> | ||
#include <linux/init.h> | ||
|
||
#include <asm/bootinfo.h> | ||
|
||
unsigned long bus_clock, cpu_clock_freq; | ||
unsigned long memsize, highmemsize; | ||
|
||
/* pmon passes arguments in 32bit pointers */ | ||
int *_prom_envp; | ||
|
||
#define parse_even_earlier(res, option, p) \ | ||
do { \ | ||
if (strncmp(option, (char *)p, strlen(option)) == 0) \ | ||
strict_strtol((char *)p + strlen(option"="), \ | ||
10, &res); \ | ||
} while (0) | ||
|
||
void __init prom_init_env(void) | ||
{ | ||
long l; | ||
|
||
/* firmware arguments are initialized in head.S */ | ||
_prom_envp = (int *)fw_arg2; | ||
|
||
l = (long)*_prom_envp; | ||
while (l != 0) { | ||
parse_even_earlier(bus_clock, "busclock", l); | ||
parse_even_earlier(cpu_clock_freq, "cpuclock", l); | ||
parse_even_earlier(memsize, "memsize", l); | ||
parse_even_earlier(highmemsize, "highmemsize", l); | ||
_prom_envp++; | ||
l = (long)*_prom_envp; | ||
} | ||
if (memsize == 0) | ||
memsize = 256; | ||
|
||
pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n", | ||
bus_clock, cpu_clock_freq, memsize, highmemsize); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology | ||
* Author: Wu Zhangjin, wuzj@lemote.com | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
#include <linux/init.h> | ||
#include <linux/bootmem.h> | ||
|
||
#include <asm/bootinfo.h> | ||
#include <asm/mips-boards/bonito64.h> | ||
|
||
extern void __init prom_init_cmdline(void); | ||
extern void __init prom_init_env(void); | ||
extern void __init prom_init_memory(void); | ||
|
||
void __init prom_init(void) | ||
{ | ||
/* init base address of io space */ | ||
set_io_port_base((unsigned long) | ||
ioremap(BONITO_PCIIO_BASE, BONITO_PCIIO_SIZE)); | ||
|
||
prom_init_cmdline(); | ||
prom_init_env(); | ||
prom_init_memory(); | ||
} | ||
|
||
void __init prom_free_prom_memory(void) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology | ||
* Author: Wu Zhangjin, wuzj@lemote.com | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
const char *get_system_type(void) | ||
{ | ||
return "lemote-fulong"; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology | ||
* Author: Fuxin Zhang, zhangfx@lemote.com | ||
* | ||
* Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology | ||
* Author: Wu Zhangjin, wuzj@lemote.com | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
#include <linux/init.h> | ||
|
||
#include <asm/mc146818-time.h> | ||
#include <asm/time.h> | ||
|
||
extern unsigned long cpu_clock_freq; | ||
|
||
void __init plat_time_init(void) | ||
{ | ||
/* setup mips r4k timer */ | ||
mips_hpt_frequency = cpu_clock_freq / 2; | ||
} | ||
|
||
unsigned long read_persistent_clock(void) | ||
{ | ||
return mc146818_get_cmos_time(); | ||
} |