aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100/hackkit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-sa1100/hackkit.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/arm/mach-sa1100/hackkit.c')
-rw-r--r--arch/arm/mach-sa1100/hackkit.c200
1 files changed, 200 insertions, 0 deletions
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
new file mode 100644
index 000000000000..570841779714
--- /dev/null
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -0,0 +1,200 @@
1/*
2 * linux/arch/arm/mach-sa1100/hackkit.c
3 *
4 * Copyright (C) 2002 Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
5 *
6 * This file contains all HackKit tweaks. Based on original work from
7 * Nicolas Pitre's assabet fixes
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
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/cpufreq.h>
21#include <linux/serial_core.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
24
25#include <asm/hardware.h>
26#include <asm/mach-types.h>
27#include <asm/setup.h>
28#include <asm/page.h>
29#include <asm/pgtable.h>
30#include <asm/irq.h>
31
32#include <asm/mach/arch.h>
33#include <asm/mach/flash.h>
34#include <asm/mach/map.h>
35#include <asm/mach/irq.h>
36#include <asm/mach/serial_sa1100.h>
37
38#include "generic.h"
39
40/**********************************************************************
41 * prototypes
42 */
43
44/* init funcs */
45static void __init hackkit_map_io(void);
46
47static u_int hackkit_get_mctrl(struct uart_port *port);
48static void hackkit_set_mctrl(struct uart_port *port, u_int mctrl);
49static void hackkit_uart_pm(struct uart_port *port, u_int state, u_int oldstate);
50
51/**********************************************************************
52 * global data
53 */
54
55/**********************************************************************
56 * static data
57 */
58
59static struct map_desc hackkit_io_desc[] __initdata = {
60 /* virtual physical length type */
61 { 0xe8000000, 0x00000000, 0x01000000, MT_DEVICE } /* Flash bank 0 */
62};
63
64static struct sa1100_port_fns hackkit_port_fns __initdata = {
65 .set_mctrl = hackkit_set_mctrl,
66 .get_mctrl = hackkit_get_mctrl,
67 .pm = hackkit_uart_pm,
68};
69
70/**********************************************************************
71 * Static functions
72 */
73
74static void __init hackkit_map_io(void)
75{
76 sa1100_map_io();
77 iotable_init(hackkit_io_desc, ARRAY_SIZE(hackkit_io_desc));
78
79 sa1100_register_uart_fns(&hackkit_port_fns);
80 sa1100_register_uart(0, 1); /* com port */
81 sa1100_register_uart(1, 2);
82 sa1100_register_uart(2, 3); /* radio module */
83
84 Ser1SDCR0 |= SDCR0_SUS;
85}
86
87/**
88 * hackkit_uart_pm - powermgmt callback function for system 3 UART
89 * @port: uart port structure
90 * @state: pm state
91 * @oldstate: old pm state
92 *
93 */
94static void hackkit_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
95{
96 /* TODO: switch on/off uart in powersave mode */
97}
98
99/*
100 * Note! this can be called from IRQ context.
101 * FIXME: No modem ctrl lines yet.
102 */
103static void hackkit_set_mctrl(struct uart_port *port, u_int mctrl)
104{
105#if 0
106 if (port->mapbase == _Ser1UTCR0) {
107 u_int set = 0, clear = 0;
108
109 if (mctrl & TIOCM_RTS)
110 set |= PT_CTRL2_RS1_RTS;
111 else
112 clear |= PT_CTRL2_RS1_RTS;
113
114 if (mctrl & TIOCM_DTR)
115 set |= PT_CTRL2_RS1_DTR;
116 else
117 clear |= PT_CTRL2_RS1_DTR;
118
119 PTCTRL2_clear(clear);
120 PTCTRL2_set(set);
121 }
122#endif
123}
124
125static u_int hackkit_get_mctrl(struct uart_port *port)
126{
127 u_int ret = 0;
128#if 0
129 u_int irqsr = PT_IRQSR;
130
131 /* need 2 reads to read current value */
132 irqsr = PT_IRQSR;
133
134 /* TODO: check IRQ source register for modem/com
135 status lines and set them correctly. */
136#endif
137
138 ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
139
140 return ret;
141}
142
143static struct mtd_partition hackkit_partitions[] = {
144 {
145 .name = "BLOB",
146 .size = 0x00040000,
147 .offset = 0x00000000,
148 .mask_flags = MTD_WRITEABLE, /* force read-only */
149 }, {
150 .name = "config",
151 .size = 0x00040000,
152 .offset = MTDPART_OFS_APPEND,
153 }, {
154 .name = "kernel",
155 .size = 0x00100000,
156 .offset = MTDPART_OFS_APPEND,
157 }, {
158 .name = "initrd",
159 .size = 0x00180000,
160 .offset = MTDPART_OFS_APPEND,
161 }, {
162 .name = "rootfs",
163 .size = 0x700000,
164 .offset = MTDPART_OFS_APPEND,
165 }, {
166 .name = "data",
167 .size = MTDPART_SIZ_FULL,
168 .offset = MTDPART_OFS_APPEND,
169 }
170};
171
172static struct flash_platform_data hackkit_flash_data = {
173 .map_name = "cfi_probe",
174 .parts = hackkit_partitions,
175 .nr_parts = ARRAY_SIZE(hackkit_partitions),
176};
177
178static struct resource hackkit_flash_resource = {
179 .start = SA1100_CS0_PHYS,
180 .end = SA1100_CS0_PHYS + SZ_32M,
181 .flags = IORESOURCE_MEM,
182};
183
184static void __init hackkit_init(void)
185{
186 sa11x0_set_flash_data(&hackkit_flash_data, &hackkit_flash_resource, 1);
187}
188
189/**********************************************************************
190 * Exported Functions
191 */
192
193MACHINE_START(HACKKIT, "HackKit Cpu Board")
194 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
195 BOOT_PARAMS(0xc0000100)
196 MAPIO(hackkit_map_io)
197 INITIRQ(sa1100_init_irq)
198 .timer = &sa1100_timer,
199 .init_machine = hackkit_init,
200MACHINE_END