aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-12-06 22:39:08 +0000
committerFlorian Fainelli <florian@openwrt.org>2012-12-06 22:39:08 +0000
commitf49b81ca588f0ebc2deead91e2181e360369bab7 (patch)
tree56af9408b28a7db0e514db4762d205e1d35d210c /target
parente20634512b0c3945bce92ac79e65212c78ab0cf3 (diff)
downloadmaster-187ad058-f49b81ca588f0ebc2deead91e2181e360369bab7.tar.gz
master-187ad058-f49b81ca588f0ebc2deead91e2181e360369bab7.tar.bz2
master-187ad058-f49b81ca588f0ebc2deead91e2181e360369bab7.zip
[adm8668] move setup-related functions to their own file
Signed-off-by: Florian Fainelli <florian@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34543 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/Makefile4
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/platform.c51
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/setup.c52
3 files changed, 55 insertions, 52 deletions
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/Makefile b/target/linux/adm8668/files/arch/mips/adm8668/Makefile
index 0b31b97d48..ef836bb5db 100644
--- a/target/linux/adm8668/files/arch/mips/adm8668/Makefile
+++ b/target/linux/adm8668/files/arch/mips/adm8668/Makefile
@@ -2,4 +2,6 @@
# something witty --neutronscott
#
-obj-y := irq.o pci.o prom.o platform.o serial.o proc.o net_core.o net_intr.o
+obj-y := irq.o pci.o prom.o platform.o serial.o proc.o \
+ setup.o \
+ net_core.o net_intr.o
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/platform.c b/target/linux/adm8668/files/arch/mips/adm8668/platform.c
index 803af09aab..1b1c0700c1 100644
--- a/target/linux/adm8668/files/arch/mips/adm8668/platform.c
+++ b/target/linux/adm8668/files/arch/mips/adm8668/platform.c
@@ -77,37 +77,8 @@ static struct platform_device adm8668_eth1_device = {
.num_resources = ARRAY_SIZE(eth1_resources),
};
-static void adm8668_restart(char *cmd)
-{
- int i;
-
- /* stop eth0 and eth1 */
- ADM8668_LAN_REG(NETCSR6) = (1 << 13) | (1 << 1);
- ADM8668_LAN_REG(NETCSR7) = 0;
- ADM8668_WAN_REG(NETCSR6) = (1 << 13) | (1 << 1);
- ADM8668_WAN_REG(NETCSR7) = 0;
-
- /* reset PHY */
- ADM8668_WAN_REG(NETCSR37) = 0x20;
- for (i = 0; i < 10000; i++)
- ;
- ADM8668_WAN_REG(NETCSR37) = 0;
- for (i = 0; i < 10000; i++)
- ;
-
- *(volatile unsigned int *)0xB1600000 = 1; /* reset eth0 mac */
- *(volatile unsigned int *)0xB1A00000 = 1; /* reset eth1 mac */
- *(volatile unsigned int *)0xB1800000 = 1; /* reset wlan0 mac */
-
- /* the real deal */
- for (i = 0; i < 1000; i++)
- ;
- ADM8668_CONFIG_REG(ADM8668_CR1) = 1;
-}
-
int __devinit adm8668_devs_register(void)
{
- _machine_restart = adm8668_restart;
platform_device_register(&adm8668_uart_device);
platform_device_register(&adm8668_eth0_device);
platform_device_register(&adm8668_eth1_device);
@@ -126,26 +97,4 @@ void __init plat_time_init(void)
printk("ADM8668 CPU clock: %d MHz\n", 2*mips_hpt_frequency / 1000000);
}
-void __init plat_mem_setup(void)
-{
- /* prom_init seemed like easier place for this. it's tooo simple */
-}
-
-const char *get_system_type(void)
-{
- unsigned long chipid = ADM8668_CONFIG_REG(ADM8668_CR0);
- int adj = (ADM8668_CONFIG_REG(ADM8668_CR3) >> 11) & 0xf;
- int product, revision, mhz;
- static char ret[32];
-
- product = chipid >> 16;
- revision = chipid & 0xffff;
- mhz = (SYS_CLOCK/1000000) + (adj * 5);
-
- /* i getting fancy :\ */
- snprintf(ret, sizeof(ret), "ADM%xr%x %dMHz", product, revision, mhz);
-
- return ret;
-}
-
arch_initcall(adm8668_devs_register);
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/setup.c b/target/linux/adm8668/files/arch/mips/adm8668/setup.c
new file mode 100644
index 0000000000..927d827284
--- /dev/null
+++ b/target/linux/adm8668/files/arch/mips/adm8668/setup.c
@@ -0,0 +1,52 @@
+#include <linux/init.h>
+#include <linux/reboot.h>
+
+#include <asm/reboot.h>
+#include <adm8668.h>
+
+static void adm8668_restart(char *cmd)
+{
+ int i;
+
+ /* stop eth0 and eth1 */
+ ADM8668_LAN_REG(NETCSR6) = (1 << 13) | (1 << 1);
+ ADM8668_LAN_REG(NETCSR7) = 0;
+ ADM8668_WAN_REG(NETCSR6) = (1 << 13) | (1 << 1);
+ ADM8668_WAN_REG(NETCSR7) = 0;
+
+ /* reset PHY */
+ ADM8668_WAN_REG(NETCSR37) = 0x20;
+ for (i = 0; i < 10000; i++)
+ ;
+ ADM8668_WAN_REG(NETCSR37) = 0;
+ for (i = 0; i < 10000; i++)
+ ;
+
+ /* the real deal */
+ for (i = 0; i < 1000; i++)
+ ;
+ ADM8668_CONFIG_REG(ADM8668_CR1) = 1;
+}
+
+void __init plat_mem_setup(void)
+{
+ _machine_restart = adm8668_restart;
+}
+
+const char *get_system_type(void)
+{
+ unsigned long chipid = ADM8668_CONFIG_REG(ADM8668_CR0);
+ int adj = (ADM8668_CONFIG_REG(ADM8668_CR3) >> 11) & 0xf;
+ int product, revision, mhz;
+ static char ret[32];
+
+ product = chipid >> 16;
+ revision = chipid & 0xffff;
+ mhz = (SYS_CLOCK/1000000) + (adj * 5);
+
+ /* i getting fancy :\ */
+ snprintf(ret, sizeof(ret), "ADM%xr%x %dMHz", product, revision, mhz);
+
+ return ret;
+}
+