2 * linux/arch/arm/mach-sa1100/hackkit.c
4 * Copyright (C) 2002 Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
6 * This file contains all HackKit tweaks. Based on original work from
7 * Nicolas Pitre's assabet fixes
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.
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>
25 #include <asm/hardware.h>
26 #include <asm/mach-types.h>
27 #include <asm/setup.h>
29 #include <asm/pgtable.h>
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>
40 /**********************************************************************
45 static void __init hackkit_map_io(void);
47 static u_int hackkit_get_mctrl(struct uart_port *port);
48 static void hackkit_set_mctrl(struct uart_port *port, u_int mctrl);
49 static void hackkit_uart_pm(struct uart_port *port, u_int state, u_int oldstate);
51 /**********************************************************************
55 /**********************************************************************
59 static struct map_desc hackkit_io_desc[] __initdata = {
60 /* virtual physical length type */
61 { 0xe8000000, 0x00000000, 0x01000000, MT_DEVICE } /* Flash bank 0 */
64 static 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,
70 /**********************************************************************
74 static void __init hackkit_map_io(void)
77 iotable_init(hackkit_io_desc, ARRAY_SIZE(hackkit_io_desc));
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 */
84 Ser1SDCR0 |= SDCR0_SUS;
88 * hackkit_uart_pm - powermgmt callback function for system 3 UART
89 * @port: uart port structure
91 * @oldstate: old pm state
94 static void hackkit_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
96 /* TODO: switch on/off uart in powersave mode */
100 * Note! this can be called from IRQ context.
101 * FIXME: No modem ctrl lines yet.
103 static void hackkit_set_mctrl(struct uart_port *port, u_int mctrl)
106 if (port->mapbase == _Ser1UTCR0) {
107 u_int set = 0, clear = 0;
109 if (mctrl & TIOCM_RTS)
110 set |= PT_CTRL2_RS1_RTS;
112 clear |= PT_CTRL2_RS1_RTS;
114 if (mctrl & TIOCM_DTR)
115 set |= PT_CTRL2_RS1_DTR;
117 clear |= PT_CTRL2_RS1_DTR;
119 PTCTRL2_clear(clear);
125 static u_int hackkit_get_mctrl(struct uart_port *port)
129 u_int irqsr = PT_IRQSR;
131 /* need 2 reads to read current value */
134 /* TODO: check IRQ source register for modem/com
135 status lines and set them correctly. */
138 ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
143 static struct mtd_partition hackkit_partitions[] = {
147 .offset = 0x00000000,
148 .mask_flags = MTD_WRITEABLE, /* force read-only */
152 .offset = MTDPART_OFS_APPEND,
156 .offset = MTDPART_OFS_APPEND,
160 .offset = MTDPART_OFS_APPEND,
164 .offset = MTDPART_OFS_APPEND,
167 .size = MTDPART_SIZ_FULL,
168 .offset = MTDPART_OFS_APPEND,
172 static struct flash_platform_data hackkit_flash_data = {
173 .map_name = "cfi_probe",
174 .parts = hackkit_partitions,
175 .nr_parts = ARRAY_SIZE(hackkit_partitions),
178 static struct resource hackkit_flash_resource = {
179 .start = SA1100_CS0_PHYS,
180 .end = SA1100_CS0_PHYS + SZ_32M,
181 .flags = IORESOURCE_MEM,
184 static void __init hackkit_init(void)
186 sa11x0_set_flash_data(&hackkit_flash_data, &hackkit_flash_resource, 1);
189 /**********************************************************************
193 MACHINE_START(HACKKIT, "HackKit Cpu Board")
194 .phys_ram = 0xc0000000,
195 .phys_io = 0x80000000,
196 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
197 .boot_params = 0xc0000100,
198 .map_io = hackkit_map_io,
199 .init_irq = sa1100_init_irq,
200 .timer = &sa1100_timer,
201 .init_machine = hackkit_init,