share machine registration code
authorGabor Juhos <juhosg@openwrt.org>
Mon, 31 Aug 2009 18:53:34 +0000 (18:53 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Mon, 31 Aug 2009 18:53:34 +0000 (18:53 +0000)
SVN-Revision: 17456

13 files changed:
target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h [new file with mode: 0644]
target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt288x.h
target/linux/ramips/files/arch/mips/ralink/common/setup.c
target/linux/ramips/files/arch/mips/ralink/rt288x/Makefile
target/linux/ramips/files/arch/mips/ralink/rt288x/mach-generic.c [deleted file]
target/linux/ramips/files/arch/mips/ralink/rt288x/prom.c
target/linux/ramips/files/arch/mips/ralink/rt288x/setup.c
target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
target/linux/ramips/files/arch/mips/ralink/rt305x/mach-generic.c [deleted file]
target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c
target/linux/ramips/files/arch/mips/ralink/rt305x/machine.h [deleted file]
target/linux/ramips/files/arch/mips/ralink/rt305x/prom.c
target/linux/ramips/files/arch/mips/ralink/rt305x/setup.c

diff --git a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
new file mode 100644 (file)
index 0000000..267d9f3
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Ralink machine types
+ *
+ * Copyright (C) 2009 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.
+ */
+
+enum ramips_mach_type {
+       RAMIPS_MACH_GENERIC,
+       RAMIPS_MACH_WHR_G300N,          /* Buffalo WHR-G300N */
+};
+
+extern enum ramips_mach_type ramips_mach;
index 85331a5..445bafa 100644 (file)
@@ -23,9 +23,6 @@ void rt288x_detect_sys_freq(void) __init;
 extern unsigned long rt288x_cpu_freq;
 extern unsigned long rt288x_sys_freq;
 
-extern unsigned long rt288x_mach_type;
-#define RT288X_MACH_GENERIC    0
-
 #define RT288X_CPU_IRQ_BASE    0
 #define RT288X_INTC_IRQ_BASE   8
 #define RT288X_INTC_IRQ_COUNT  32
index 988965b..81a1ba4 100644 (file)
 
 #include <asm/bootinfo.h>
 #include <asm/addrspace.h>
+#include <asm/mips_machine.h>
 
 #include <asm/mach-ralink/common.h>
+#include <asm/mach-ralink/machine.h>
 #include <ralink_soc.h>
 
 unsigned char ramips_sys_type[RAMIPS_SYS_TYPE_LEN];
+enum ramips_mach_type ramips_mach = RAMIPS_MACH_GENERIC;
 
 const char *get_system_type(void)
 {
@@ -47,3 +50,17 @@ void __init plat_mem_setup(void)
        detect_mem_size();
        ramips_soc_setup();
 }
+
+static int __init ramips_machine_setup(void)
+{
+       mips_machine_setup(ramips_mach);
+       return 0;
+}
+
+arch_initcall(ramips_machine_setup);
+
+static void __init ramips_generic_init(void)
+{
+}
+
+MIPS_MACHINE(RAMIPS_MACH_GENERIC, "Generic Ralink board", ramips_generic_init);
index c8c9712..fc06fa4 100644 (file)
@@ -11,5 +11,3 @@
 obj-y  := prom.o irq.o setup.o rt288x.o devices.o
 
 obj-$(CONFIG_EARLY_PRINTK)             += early_printk.o
-
-obj-$(CONFIG_RT288X_MACH_GENERIC)      += mach-generic.o
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-generic.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-generic.c
deleted file mode 100644 (file)
index e4f3830..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- *  Generic RT288x machine setup
- *
- *  Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
- *  Copyright (C) 2008 Imre Kaloz <kaloz@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 <asm/mach-ralink/rt288x.h>
-#include <asm/mips_machine.h>
-
-static void __init rt288x_generic_init(void)
-{
-}
-
-MIPS_MACHINE(RT288X_MACH_GENERIC, "Generic RT288x board", rt288x_generic_init);
index 80ef719..8becfc9 100644 (file)
@@ -26,8 +26,6 @@ void __init prom_init(void)
                        "fw_arg2=%08x, fw_arg3=%08x\n",
                        (unsigned int)fw_arg0, (unsigned int)fw_arg1,
                        (unsigned int)fw_arg2, (unsigned int)fw_arg3);
-
-       rt288x_mach_type = RT288X_MACH_GENERIC;
 }
 
 void __init prom_free_prom_memory(void)
index 05184f0..8dc4b3c 100644 (file)
@@ -24,8 +24,6 @@
 #include <asm/mach-ralink/rt288x.h>
 #include <asm/mach-ralink/rt288x_regs.h>
 
-unsigned long rt288x_mach_type;
-
 static void rt288x_restart(char *command)
 {
        rt288x_sysc_wr(RT2880_RESET_SYSTEM, SYSC_REG_RESET_CTRL);
@@ -101,12 +99,3 @@ void __init plat_time_init(void)
 {
        mips_hpt_frequency = rt288x_cpu_freq / 2;
 }
-
-static int __init rt288x_machine_setup(void)
-{
-       mips_machine_setup(rt288x_mach_type);
-
-       return 0;
-}
-
-arch_initcall(rt288x_machine_setup);
index 981498e..52231fd 100644 (file)
@@ -11,5 +11,4 @@ obj-y := prom.o irq.o setup.o devices.o rt305x.o
 
 obj-$(CONFIG_EARLY_PRINTK)             += early_printk.o
 
-obj-$(CONFIG_RT305X_MACH_GENERIC)      += mach-generic.o
 obj-$(CONFIG_RT305X_MACH_WHR_G300N)    += mach-whr-g300n.o
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-generic.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-generic.c
deleted file mode 100644 (file)
index 3b2b702..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- *  Generic RT305x machine setup
- *
- *  Copyright (C) 2009 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 <asm/mips_machine.h>
-
-#include "machine.h"
-
-static void __init rt305x_generic_init(void)
-{
-}
-
-MIPS_MACHINE(RT305X_MACH_GENERIC, "Generic RT305x board", rt305x_generic_init);
index a31fbea..97fe857 100644 (file)
@@ -16,9 +16,9 @@
 #include <linux/leds.h>
 
 #include <asm/mips_machine.h>
+#include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev_gpio_leds.h>
 
-#include "machine.h"
 #include "devices.h"
 
 #define WHR_G300N_GPIO_LED_DIAG                7
@@ -93,4 +93,4 @@ static void __init whr_g300n_init(void)
                                  whr_g300n_leds_gpio);
 }
 
-MIPS_MACHINE(RT305X_MACH_WHR_G300N, "Buffalo WHR-G300N", whr_g300n_init);
+MIPS_MACHINE(RAMIPS_MACH_WHR_G300N, "Buffalo WHR-G300N", whr_g300n_init);
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/machine.h b/target/linux/ramips/files/arch/mips/ralink/rt305x/machine.h
deleted file mode 100644 (file)
index 4ce0fde..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Ralink RT305x SoC specific setup
- *
- * Copyright (C) 2009 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.
- */
-
-enum rt305x_mach_type {
-       RT305X_MACH_GENERIC,
-       RT305X_MACH_WHR_G300N,          /* Buffalo WHR-G300N */
-};
-
-extern enum rt305x_mach_type rt305x_mach;
index 8f5ddf2..774291a 100644 (file)
 #include <asm/bootinfo.h>
 
 #include <asm/mach-ralink/common.h>
+#include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/rt305x.h>
 #include <asm/mach-ralink/rt305x_regs.h>
 
-#include "machine.h"
-
 struct board_rec {
        char                    *name;
-       enum rt305x_mach_type   mach_type;
+       enum ramips_mach_type   mach_type;
 };
 
 static int rt305x_prom_argc __initdata;
@@ -31,7 +30,7 @@ static char **rt305x_prom_envp __initdata;
 static struct board_rec boards[] __initdata = {
        {
                .name           = "WHR-G300N",
-               .mach_type      = RT305X_MACH_WHR_G300N,
+               .mach_type      = RAMIPS_MACH_WHR_G300N,
        }
 };
 
@@ -113,11 +112,9 @@ static __init void find_board_byname(char *name)
 {
        int i;
 
-       rt305x_mach = RT305X_MACH_GENERIC;
-
        for (i = 0; i < ARRAY_SIZE(boards); i++)
                if (strcmp(name, boards[i].name) == 0) {
-                       rt305x_mach = boards[i].mach_type;
+                       ramips_mach = boards[i].mach_type;
                        break;
                }
 }
index ac945b8..50a8be8 100644 (file)
 #include <asm/mach-ralink/rt305x.h>
 #include <asm/mach-ralink/rt305x_regs.h>
 
-#include "machine.h"
-
-enum rt305x_mach_type rt305x_mach;
-
 static void rt305x_restart(char *command)
 {
        rt305x_sysc_wr(RT305X_RESET_SYSTEM, SYSC_REG_RESET_CTRL);
@@ -103,12 +99,3 @@ void __init plat_time_init(void)
 {
        mips_hpt_frequency = rt305x_cpu_freq / 2;
 }
-
-static int __init rt305x_machine_setup(void)
-{
-       mips_machine_setup(rt305x_mach);
-
-       return 0;
-}
-
-arch_initcall(rt305x_machine_setup);