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.
15 #include <linux/config.h>
16 #include <linux/init.h>
17 #include <linux/kernel.h>
18 #include <linux/sched.h>
19 #include <linux/tty.h>
20 #include <linux/module.h>
21 #include <linux/errno.h>
22 #include <linux/cpufreq.h>
23 #include <linux/list.h>
24 #include <linux/timer.h>
26 #include <asm/hardware.h>
27 #include <asm/setup.h>
29 #include <asm/pgtable.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34 #include <asm/mach/irq.h>
35 #include <asm/mach/serial_sa1100.h>
37 #include <asm/arch/irq.h>
39 #include <linux/serial_core.h>
46 # define DPRINTK( x, args... ) printk( "%s: line %d: "x, __FUNCTION__, __LINE__, ## args );
48 # define DPRINTK( x, args... ) /* nix */
51 /**********************************************************************
56 static void __init fixup_hackkit(struct machine_desc *desc,
57 struct param_struct *params, char **cmdline, struct meminfo *mi);
58 static void __init get_hackkit_scr(void);
59 static int __init hackkit_init(void);
60 static void __init hackkit_init_irq(void);
61 static void __init hackkit_map_io(void);
63 static int hackkit_get_mctrl(struct uart_port *port);
64 static void hackkit_set_mctrl(struct uart_port *port, u_int mctrl);
65 static void hackkit_uart_pm(struct uart_port *port, u_int state, u_int oldstate);
67 extern void convert_to_tag_list(struct param_struct *params, int mem_init);
70 /**********************************************************************
74 /**********************************************************************
78 static struct map_desc hackkit_io_desc[] __initdata = {
79 /* virtual physical length domain r w c b */
80 { 0xe8000000, 0x00000000, 0x01000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Flash bank 0 */
84 static struct sa1100_port_fns hackkit_port_fns __initdata = {
85 .set_mctrl = hackkit_set_mctrl,
86 .get_mctrl = hackkit_get_mctrl,
87 .pm = hackkit_uart_pm,
90 /**********************************************************************
94 static void __init hackkit_map_io(void)
96 DPRINTK( "%s\n", "START" );
98 iotable_init(hackkit_io_desc);
100 sa1100_register_uart_fns(&hackkit_port_fns);
101 sa1100_register_uart(0, 1); /* com port */
102 sa1100_register_uart(1, 2);
103 sa1100_register_uart(2, 3); /* radio module */
105 Ser1SDCR0 |= SDCR0_SUS;
108 static void __init hackkit_init_irq(void)
114 * fixup_hackkit - fixup function for system 3 board
115 * @desc: machine description
116 * @param: kernel params
117 * @cmdline: kernel cmdline
118 * @mi: memory info struct
121 static void __init fixup_hackkit(struct machine_desc *desc,
122 struct param_struct *params, char **cmdline, struct meminfo *mi)
124 DPRINTK( "%s\n", "START" );
126 ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
127 setup_ramdisk( 1, 0, 0, 8192 );
128 setup_initrd( 0xc0800000, 8*1024*1024 );
133 * hackkit_uart_pm - powermgmt callback function for system 3 UART
134 * @port: uart port structure
136 * @oldstate: old pm state
139 static void hackkit_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
141 /* TODO: switch on/off uart in powersave mode */
145 * Note! this can be called from IRQ context.
146 * FIXME: No modem ctrl lines yet.
148 static void hackkit_set_mctrl(struct uart_port *port, u_int mctrl)
151 if (port->mapbase == _Ser1UTCR0) {
152 u_int set = 0, clear = 0;
154 if (mctrl & TIOCM_RTS)
155 set |= PT_CTRL2_RS1_RTS;
157 clear |= PT_CTRL2_RS1_RTS;
159 if (mctrl & TIOCM_DTR)
160 set |= PT_CTRL2_RS1_DTR;
162 clear |= PT_CTRL2_RS1_DTR;
164 PTCTRL2_clear(clear);
170 static int hackkit_get_mctrl(struct uart_port *port)
174 u_int irqsr = PT_IRQSR;
176 /* need 2 reads to read current value */
179 /* TODO: check IRQ source register for modem/com
180 status lines and set them correctly. */
183 ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
188 static int __init hackkit_init(void)
191 DPRINTK( "%s\n", "START" );
193 if ( !machine_is_hackkit() ) {
202 DPRINTK( "ret=%d\n", ret );
206 /**********************************************************************
210 /**********************************************************************
211 * kernel magic macros
213 __initcall(hackkit_init);
215 MACHINE_START(HACKKIT, "HackKit Cpu Board")
216 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
217 BOOT_PARAMS(0xc0000100)
219 MAPIO(hackkit_map_io)
220 INITIRQ(sa1100_init_irq)