2 * Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/platform_device.h>
12 #include <linux/mtd/physmap.h>
13 #include <linux/pci.h>
14 #include <linux/slab.h>
15 #include <linux/ioport.h>
16 #include <asm/reboot.h>
18 #include <asm/addrspace.h>
19 #include <asm/bootinfo.h>
23 static struct resource uart_resources
[] = {
25 .start
= ADM8668_UART0_BASE
,
26 .end
= ADM8668_UART0_BASE
+ 0xF,
27 .flags
= IORESOURCE_MEM
,
30 .start
= INT_LVL_UART0
,
31 .flags
= IORESOURCE_IRQ
,
35 static struct platform_device adm8668_uart_device
= {
36 .name
= "adm8668_uart",
38 .resource
= uart_resources
,
39 .num_resources
= ARRAY_SIZE(uart_resources
),
42 static struct resource eth0_resources
[] = {
44 .start
= ADM8668_LAN_BASE
,
45 .end
= ADM8668_LAN_BASE
+ 256,
46 .flags
= IORESOURCE_MEM
,
50 .flags
= IORESOURCE_IRQ
,
54 static struct platform_device adm8668_eth0_device
= {
55 .name
= "adm8668_eth",
57 .resource
= eth0_resources
,
58 .num_resources
= ARRAY_SIZE(eth0_resources
),
61 static struct resource eth1_resources
[] = {
63 .start
= ADM8668_WAN_BASE
,
64 .end
= ADM8668_WAN_BASE
+ 256,
65 .flags
= IORESOURCE_MEM
,
69 .flags
= IORESOURCE_IRQ
,
73 static struct platform_device adm8668_eth1_device
= {
74 .name
= "adm8668_eth",
76 .resource
= eth1_resources
,
77 .num_resources
= ARRAY_SIZE(eth1_resources
),
80 int __devinit
adm8668_devs_register(void)
82 platform_device_register(&adm8668_uart_device
);
83 platform_device_register(&adm8668_eth0_device
);
84 platform_device_register(&adm8668_eth1_device
);
89 void __init
plat_time_init(void)
91 int adj
= (ADM8668_CONFIG_REG(ADM8668_CR3
) >> 11) & 0xf;
93 /* adjustable clock selection
94 CR3 bit 14~11, 0000 -> 175MHz, 0001 -> 180MHz, etc... */
96 mips_hpt_frequency
= (SYS_CLOCK
+ adj
* 5000000) / 2;
97 printk("ADM8668 CPU clock: %d MHz\n", 2*mips_hpt_frequency
/ 1000000);
100 arch_initcall(adm8668_devs_register
);