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	{	/* Flash bank 0 */
61		.virtual	=  0xe8000000,
62		.pfn		= __phys_to_pfn(0x00000000),
63		.length		= 0x01000000,
64		.type		= MT_DEVICE
65	},
66};
67
68static struct sa1100_port_fns hackkit_port_fns __initdata = {
69	.set_mctrl	= hackkit_set_mctrl,
70	.get_mctrl	= hackkit_get_mctrl,
71	.pm		= hackkit_uart_pm,
72};
73
74/**********************************************************************
75 *  Static functions
76 */
77
78static void __init hackkit_map_io(void)
79{
80	sa1100_map_io();
81	iotable_init(hackkit_io_desc, ARRAY_SIZE(hackkit_io_desc));
82
83	sa1100_register_uart_fns(&hackkit_port_fns);
84	sa1100_register_uart(0, 1);	/* com port */
85	sa1100_register_uart(1, 2);
86	sa1100_register_uart(2, 3);	/* radio module */
87
88	Ser1SDCR0 |= SDCR0_SUS;
89}
90
91/**
92 *	hackkit_uart_pm - powermgmt callback function for system 3 UART
93 *	@port: uart port structure
94 *	@state: pm state
95 *	@oldstate: old pm state
96 *
97 */
98static void hackkit_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
99{
100	/* TODO: switch on/off uart in powersave mode */
101}
102
103static void hackkit_set_mctrl(struct uart_port *port, u_int mctrl)
104{
105}
106
107static u_int hackkit_get_mctrl(struct uart_port *port)
108{
109	u_int ret = 0;
110
111	ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
112
113	return ret;
114}
115
116static struct mtd_partition hackkit_partitions[] = {
117	{
118		.name		= "BLOB",
119		.size		= 0x00040000,
120		.offset		= 0x00000000,
121		.mask_flags	= MTD_WRITEABLE,  /* force read-only */
122	}, {
123		.name		= "config",
124		.size		= 0x00040000,
125		.offset		= MTDPART_OFS_APPEND,
126	}, {
127		.name		= "kernel",
128		.size		= 0x00100000,
129		.offset		= MTDPART_OFS_APPEND,
130	}, {
131		.name		= "initrd",
132		.size		= 0x00180000,
133		.offset		= MTDPART_OFS_APPEND,
134	}, {
135		.name		= "rootfs",
136		.size		= 0x700000,
137		.offset		= MTDPART_OFS_APPEND,
138	}, {
139		.name		= "data",
140		.size		= MTDPART_SIZ_FULL,
141		.offset		= MTDPART_OFS_APPEND,
142	}
143};
144
145static struct flash_platform_data hackkit_flash_data = {
146	.map_name	= "cfi_probe",
147	.parts		= hackkit_partitions,
148	.nr_parts	= ARRAY_SIZE(hackkit_partitions),
149};
150
151static struct resource hackkit_flash_resource = {
152	.start		= SA1100_CS0_PHYS,
153	.end		= SA1100_CS0_PHYS + SZ_32M,
154	.flags		= IORESOURCE_MEM,
155};
156
157static void __init hackkit_init(void)
158{
159	sa11x0_set_flash_data(&hackkit_flash_data, &hackkit_flash_resource, 1);
160}
161
162/**********************************************************************
163 *  Exported Functions
164 */
165
166MACHINE_START(HACKKIT, "HackKit Cpu Board")
167	.phys_io	= 0x80000000,
168	.io_pg_offst	= ((0xf8000000) >> 18) & 0xfffc,
169	.boot_params	= 0xc0000100,
170	.map_io		= hackkit_map_io,
171	.init_irq	= sa1100_init_irq,
172	.timer		= &sa1100_timer,
173	.init_machine	= hackkit_init,
174MACHINE_END
175