Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / arch / ppc / platforms / 4xx / redwood5.c
1 /*
2  * arch/ppc/platforms/4xx/redwood5.c
3  *
4  * Support for the IBM redwood5 eval board file
5  *
6  * Author: Armin Kuster <akuster@mvista.com>
7  *
8  * 2000-2001 (c) MontaVista, Software, Inc.  This file is licensed under
9  * the terms of the GNU General Public License version 2.  This program
10  * is licensed "as is" without any warranty of any kind, whether express
11  * or implied.
12  */
13
14 #include <linux/config.h>
15 #include <linux/init.h>
16 #include <linux/pagemap.h>
17 #include <linux/device.h>
18 #include <linux/ioport.h>
19 #include <asm/io.h>
20 #include <asm/machdep.h>
21
22 static struct resource smc91x_resources[] = {
23         [0] = {
24                 .start  = SMC91111_BASE_ADDR,
25                 .end    = SMC91111_BASE_ADDR + SMC91111_REG_SIZE - 1,
26                 .flags  = IORESOURCE_MEM,
27         },
28         [1] = {
29                 .start  = SMC91111_IRQ,
30                 .end    = SMC91111_IRQ,
31                 .flags  = IORESOURCE_IRQ,
32         },
33 };
34
35 static struct platform_device smc91x_device = {
36         .name           = "smc91x",
37         .id             = 0,
38         .num_resources  = ARRAY_SIZE(smc91x_resources),
39         .resource       = smc91x_resources,
40 };
41
42 static struct platform_device *redwood5_devs[] __initdata = {
43         &smc91x_device,
44 };
45
46 static int __init
47 redwood5_platform_add_devices(void)
48 {
49         return platform_add_devices(redwood5_devs, ARRAY_SIZE(redwood5_devs));
50 }
51
52 void __init
53 redwood5_setup_arch(void)
54 {
55         ppc4xx_setup_arch();
56
57 #ifdef CONFIG_DEBUG_BRINGUP
58         printk("\n");
59         printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);
60         printk("\n");
61         printk("bi_s_version\t %s\n",      bip->bi_s_version);
62         printk("bi_r_version\t %s\n",      bip->bi_r_version);
63         printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize,bip->bi_memsize/(1024*1000));
64         printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0,
65         bip->bi_enetaddr[0], bip->bi_enetaddr[1],
66         bip->bi_enetaddr[2], bip->bi_enetaddr[3],
67         bip->bi_enetaddr[4], bip->bi_enetaddr[5]);
68
69         printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n",
70                bip->bi_intfreq, bip->bi_intfreq/ 1000000);
71
72         printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n",
73                 bip->bi_busfreq, bip->bi_busfreq / 1000000 );
74         printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n",
75                bip->bi_tbfreq, bip->bi_tbfreq/1000000);
76
77         printk("\n");
78 #endif
79         device_initcall(redwood5_platform_add_devices);
80 }
81
82 void __init
83 redwood5_map_io(void)
84 {
85         int i;
86
87         ppc4xx_map_io();
88         for (i = 0; i < 16; i++) {
89          unsigned long v, p;
90
91         /* 0x400x0000 -> 0xe00x0000 */
92         p = 0x40000000 | (i << 16);
93         v = STB04xxx_IO_BASE | (i << 16);
94
95         io_block_mapping(v, p, PAGE_SIZE,
96                  _PAGE_NO_CACHE | pgprot_val(PAGE_KERNEL) | _PAGE_GUARDED);
97         }
98
99
100 }
101
102 void __init
103 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
104               unsigned long r6, unsigned long r7)
105 {
106         ppc4xx_init(r3, r4, r5, r6, r7);
107
108         ppc_md.setup_arch = redwood5_setup_arch;
109         ppc_md.setup_io_mappings = redwood5_map_io;
110 }