import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / mach-sa1100 / cep.c
1 /*
2  * linux/arch/arm/mach-sa1100/cep.c
3  *
4  * Author: Matthias Gorjup
5  *
6  * This file contains all Cep - specific tweaks.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #include <linux/config.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/sched.h>
17 #include <linux/tty.h>
18 #include <linux/module.h>
19 #include <linux/errno.h>
20 #include <linux/serial_core.h>
21
22 #include <asm/hardware.h>
23 #include <asm/setup.h>
24 #include <asm/page.h>
25 #include <asm/pgtable.h>
26
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29 #include <asm/mach/serial_sa1100.h>
30
31 #include "generic.h"
32
33
34 extern void convert_to_tag_list(struct param_struct *params, int mem_init);
35
36 static void __init
37 fixup_cep(struct machine_desc *desc, struct param_struct *params,
38               char **cmdline, struct meminfo *mi)
39 {
40         struct tag *t = (struct tag *)params;
41
42
43         /*
44          * Apparantly bootldr uses a param_struct.  Groan.
45          */
46         if (t->hdr.tag != ATAG_CORE)
47                 convert_to_tag_list(params, 1);
48
49         if (t->hdr.tag != ATAG_CORE) {
50                 t->hdr.tag = ATAG_CORE;
51                 t->hdr.size = tag_size(tag_core);
52                 t->u.core.flags = 0;
53                 t->u.core.pagesize = PAGE_SIZE;
54                 t->u.core.rootdev = RAMDISK_MAJOR << 8 | 0;
55                 t = tag_next(t);
56
57                 t->hdr.tag = ATAG_MEM;
58                 t->hdr.size = tag_size(tag_mem32);
59                 t->u.mem.start = 0xc0000000;
60                 t->u.mem.size  = 32 * 1024 * 1024;
61                 t = tag_next(t);
62
63
64                 t->hdr.tag = ATAG_RAMDISK;
65                 t->hdr.size = tag_size(tag_ramdisk);
66                 t->u.ramdisk.flags = 1;
67                 t->u.ramdisk.size = 8192;
68                 t->u.ramdisk.start = 0;
69                 t = tag_next(t);
70
71                 t->hdr.tag = ATAG_INITRD;
72                 t->hdr.size = tag_size(tag_initrd);
73                 t->u.initrd.start = 0xc0800000;
74                 t->u.initrd.size = 3 * 1024 * 1024;
75                 t = tag_next(t);
76
77                 t->hdr.tag = ATAG_NONE;
78                 t->hdr.size = 0;
79         }
80 }
81
82
83 static struct map_desc cep_io_desc[] __initdata = {
84  /* virtual     physical    length      domain     r  w  c  b */
85   { 0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Flash bank 0 */
86   LAST_DESC
87 };
88
89 static void __init cep_map_io(void)
90 {
91
92         sa1100_map_io();
93         iotable_init(cep_io_desc);
94
95         sa1100_register_uart(0, 1);     /* com port */
96         sa1100_register_uart(2, 3);     /* radio module */
97
98         /*
99          * Ensure that these pins are set as outputs and are driving
100          * logic 0.  This ensures that we won't inadvertently toggle
101          * the WS latch in the CPLD, and we don't float causing
102          * excessive power drain.  --rmk
103          */
104         GPDR |= GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM;
105         GPCR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM;
106
107         /*
108          * Set up registers for sleep mode.
109          */
110         PWER = PWER_GPIO0;
111         PGSR = 0;
112         PCFR = 0;
113         PSDR = 0;
114 }
115
116
117 MACHINE_START(CEP, "Iskratel Cep")
118         BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
119         BOOT_PARAMS(0xc0000100)
120         FIXUP(fixup_cep)
121         MAPIO(cep_map_io)
122         INITIRQ(sa1100_init_irq)
123 MACHINE_END