1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

[adm5120] use mips_machine code

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13532 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg
2008-12-06 19:25:05 +00:00
parent 57a811ea66
commit a3945d7bcf
41 changed files with 132 additions and 308 deletions

View File

@@ -2,5 +2,5 @@
# Makefile for the Infineon/ADMtek ADM5120 SoC specific parts of the kernel
#
obj-y := adm5120.o setup.o prom.o irq.o memory.o board.o clock.o \
obj-y := adm5120.o setup.o prom.o irq.o memory.o clock.o \
gpio.o platform.o

View File

@@ -12,7 +12,7 @@
#include <linux/init.h>
#include <linux/io.h>
#include <asm/bootinfo.h>
//#include <asm/bootinfo.h>
#include <asm/addrspace.h>
#include <asm/mach-adm5120/adm5120_info.h>
@@ -24,6 +24,7 @@ unsigned int adm5120_revision;
unsigned int adm5120_package;
unsigned int adm5120_nand_boot;
unsigned long adm5120_speed;
unsigned long adm5120_mach_type;
/*
* CPU settings detection

View File

@@ -1,91 +0,0 @@
/*
* ADM5120 generic board code
*
* Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <asm/bootinfo.h>
#include <asm/mach-adm5120/adm5120_info.h>
#include <asm/mach-adm5120/adm5120_defs.h>
#include <asm/mach-adm5120/adm5120_board.h>
#include <asm/mach-adm5120/adm5120_platform.h>
#define PFX "ADM5120: "
static struct list_head adm5120_boards __initdata =
LIST_HEAD_INIT(adm5120_boards);
static char adm5120_board_name[ADM5120_BOARD_NAMELEN] = "Unknown board";
const char *get_system_type(void)
{
return adm5120_board_name;
}
static struct adm5120_board * __init adm5120_board_find(unsigned long machtype)
{
struct list_head *this;
list_for_each(this, &adm5120_boards) {
struct adm5120_board *board;
board = list_entry(this, struct adm5120_board, list);
if (board->mach_type == machtype)
return board;
}
return NULL;
}
static int __init adm5120_board_setup(void)
{
struct adm5120_board *board;
board = adm5120_board_find(mips_machtype);
if (board == NULL)
panic(PFX "no board registered for machtype %lu\n",
mips_machtype);
if (board->name[0])
strlcpy(adm5120_board_name, board->name, ADM5120_BOARD_NAMELEN);
printk(KERN_INFO PFX "board is '%s'\n", adm5120_board_name);
adm5120_gpio_init();
if (board->board_setup)
board->board_setup();
return 0;
}
arch_initcall(adm5120_board_setup);
void __init adm5120_board_register(struct adm5120_board *board)
{
list_add_tail(&board->list, &adm5120_boards);
}
static void __init adm5120_generic_board_setup(void)
{
adm5120_add_device_uart(0);
adm5120_add_device_uart(1);
adm5120_add_device_flash(0);
adm5120_add_device_switch(6, NULL);
}
ADM5120_BOARD(MACH_ADM5120_GENERIC, "Generic ADM5120 board",
adm5120_generic_board_setup);

View File

@@ -15,8 +15,9 @@
#include <linux/mm.h>
#include <linux/io.h>
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
#include <asm/bootinfo.h>
#include <asm/mips_machine.h>
#include <asm/mach-adm5120/adm5120_info.h>
#include <asm/mach-adm5120/adm5120_defs.h>
@@ -203,35 +204,35 @@ static void __init prom_detect_machtype(void)
{
if (bootbase_present()) {
adm5120_prom_type = ADM5120_PROM_BOOTBASE;
mips_machtype = detect_machtype_bootbase();
adm5120_mach_type = detect_machtype_bootbase();
return;
}
if (cfe_present()) {
adm5120_prom_type = ADM5120_PROM_CFE;
mips_machtype = detect_machtype_cfe();
adm5120_mach_type = detect_machtype_cfe();
return;
}
if (myloader_present()) {
adm5120_prom_type = ADM5120_PROM_MYLOADER;
mips_machtype = detect_machtype_myloader();
adm5120_mach_type = detect_machtype_myloader();
return;
}
if (routerboot_present()) {
adm5120_prom_type = ADM5120_PROM_ROUTERBOOT;
mips_machtype = detect_machtype_routerboot();
adm5120_mach_type = detect_machtype_routerboot();
return;
}
if (generic_prom_present()) {
adm5120_prom_type = ADM5120_PROM_GENERIC;
mips_machtype = detect_machtype_generic();
adm5120_mach_type = detect_machtype_generic();
return;
}
mips_machtype = MACH_ADM5120_GENERIC;
adm5120_mach_type = MACH_ADM5120_GENERIC;
}
/* TODO: this is an ugly hack for RouterBOARDS */

View File

@@ -23,11 +23,12 @@
#include <asm/reboot.h>
#include <asm/time.h>
#include <asm/mips_machine.h>
#include <asm/mach-adm5120/adm5120_info.h>
#include <asm/mach-adm5120/adm5120_defs.h>
#include <asm/mach-adm5120/adm5120_switch.h>
#include <asm/mach-adm5120/adm5120_board.h>
#include <asm/mach-adm5120/adm5120_platform.h>
void (*adm5120_board_reset)(void);
@@ -52,6 +53,11 @@ static void __init adm5120_report(void)
printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]);
}
const char *get_system_type(void)
{
return mips_machine_name;
}
static void adm5120_restart(char *command)
{
/* TODO: stop switch before reset */
@@ -89,3 +95,25 @@ void __init plat_mem_setup(void)
set_io_port_base(KSEG1);
}
static int __init adm5120_board_setup(void)
{
adm5120_gpio_init();
mips_machine_setup(adm5120_mach_type);
return 0;
}
arch_initcall(adm5120_board_setup);
static void __init adm5120_generic_board_setup(void)
{
adm5120_add_device_uart(0);
adm5120_add_device_uart(1);
adm5120_add_device_flash(0);
adm5120_add_device_switch(6, NULL);
}
MIPS_MACHINE(MACH_ADM5120_GENERIC, "Generic ADM5120 board",
adm5120_generic_board_setup);