summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.18/avr32-network-gateway-support.patch
blob: 420e859bd4185fd3d4943f9459017c9fd54029c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
From 16655aecb1a151c1f1707c64a571cd06e6a194af Mon Sep 17 00:00:00 2001
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
Date: Mon, 30 Oct 2006 09:35:44 +0100
Subject: [PATCH] Add support for the AVR32 Network Gateway
---
 arch/avr32/Kconfig               |    3 +
 arch/avr32/Makefile              |    1 
 arch/avr32/boards/atngw/Makefile |    1 
 arch/avr32/boards/atngw/flash.c  |   95 +++++++++++++++++++++++++++++++++++++++
 arch/avr32/boards/atngw/setup.c  |   81 +++++++++++++++++++++++++++++++++
 5 files changed, 181 insertions(+)

Index: linux-2.6.18/arch/avr32/Kconfig
===================================================================
--- linux-2.6.18.orig/arch/avr32/Kconfig	2006-12-13 09:45:34.000000000 +0100
+++ linux-2.6.18/arch/avr32/Kconfig	2006-12-13 09:45:34.000000000 +0100
@@ -97,6 +97,9 @@
 config BOARD_ATSTK1000
 	bool "ATSTK1000 evaluation board"
 	select BOARD_ATSTK1002 if CPU_AT32AP7000
+
+config BOARD_ATNGW
+	bool "AVR32 Network Gateway"
 endchoice
 
 choice
Index: linux-2.6.18/arch/avr32/Makefile
===================================================================
--- linux-2.6.18.orig/arch/avr32/Makefile	2006-12-13 09:45:34.000000000 +0100
+++ linux-2.6.18/arch/avr32/Makefile	2006-12-13 09:45:34.000000000 +0100
@@ -27,6 +27,7 @@
 head-y					+= arch/avr32/kernel/head.o
 core-$(CONFIG_PLATFORM_AT32AP)		+= arch/avr32/mach-at32ap/
 core-$(CONFIG_BOARD_ATSTK1000)		+= arch/avr32/boards/atstk1000/
+core-$(CONFIG_BOARD_ATNGW)		+= arch/avr32/boards/atngw/
 core-$(CONFIG_LOADER_U_BOOT)		+= arch/avr32/boot/u-boot/
 core-y					+= arch/avr32/kernel/
 core-y					+= arch/avr32/mm/
Index: linux-2.6.18/arch/avr32/boards/atngw/Makefile
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.18/arch/avr32/boards/atngw/Makefile	2006-12-13 09:45:34.000000000 +0100
@@ -0,0 +1 @@
+obj-y				+= setup.o flash.o
Index: linux-2.6.18/arch/avr32/boards/atngw/flash.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.18/arch/avr32/boards/atngw/flash.c	2006-12-13 09:45:34.000000000 +0100
@@ -0,0 +1,95 @@
+/*
+ * ATNGW board-specific flash initialization
+ *
+ * Copyright (C) 2005-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+#include <asm/arch/smc.h>
+
+static struct smc_config flash_config __initdata = {
+	.ncs_read_setup		= 0,
+	.nrd_setup		= 40,
+	.ncs_write_setup	= 0,
+	.nwe_setup		= 10,
+
+	.ncs_read_pulse		= 80,
+	.nrd_pulse		= 40,
+	.ncs_write_pulse	= 65,
+	.nwe_pulse		= 55,
+
+	.read_cycle		= 120,
+	.write_cycle		= 120,
+
+	.bus_width		= 2,
+	.nrd_controlled		= 1,
+	.nwe_controlled		= 1,
+	.byte_write		= 1,
+};
+
+static struct mtd_partition flash_parts[] = {
+	{
+		.name           = "u-boot",
+		.offset         = 0x00000000,
+		.size           = 0x00020000,           /* 128 KiB */
+		.mask_flags     = MTD_WRITEABLE,
+	},
+	{
+		.name           = "root",
+		.offset         = 0x00020000,
+		.size           = 0x007d0000,
+	},
+	{
+		.name           = "env",
+		.offset         = 0x007f0000,
+		.size           = 0x00010000,
+		.mask_flags     = MTD_WRITEABLE,
+	},
+};
+
+static struct physmap_flash_data flash_data = {
+	.width		= 2,
+	.nr_parts	= ARRAY_SIZE(flash_parts),
+	.parts		= flash_parts,
+};
+
+static struct resource flash_resource = {
+	.start		= 0x00000000,
+	.end		= 0x007fffff,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device flash_device = {
+	.name		= "physmap-flash",
+	.id		= 0,
+	.resource	= &flash_resource,
+	.num_resources	= 1,
+	.dev		= {
+		.platform_data = &flash_data,
+	},
+};
+
+/* This needs to be called after the SMC has been initialized */
+static int __init atngw_flash_init(void)
+{
+	int ret;
+
+	ret = smc_set_configuration(0, &flash_config);
+	if (ret < 0) {
+		printk(KERN_ERR "atngw: failed to set NOR flash timing\n");
+		return ret;
+	}
+
+	platform_device_register(&flash_device);
+
+	return 0;
+}
+device_initcall(atngw_flash_init);
Index: linux-2.6.18/arch/avr32/boards/atngw/setup.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.18/arch/avr32/boards/atngw/setup.c	2006-12-13 09:59:44.000000000 +0100
@@ -0,0 +1,84 @@
+/*
+ * Board-specific setup code for the Atmel Network Gateway
+ *
+ * Copyright (C) 2005-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/bootmem.h>
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/linkage.h>
+#include <linux/spi/spi.h>
+
+#include <asm/setup.h>
+
+#include <asm/arch/at32ap7000.h>
+#include <asm/arch/board.h>
+#include <asm/arch/init.h>
+
+/* Initialized by bootloader-specific startup code. */
+struct tag *bootloader_tags __initdata;
+
+static struct eth_platform_data __initdata eth_data[2];
+
+static struct spi_board_info spi_board_info[] __initdata = {
+	{
+		.modalias	= "mtd_dataflash",
+		.controller_data = (void *)GPIO_PIN_PA(3),
+		.max_speed_hz	= 66000000,
+		.bus_num	= 0,
+		.chip_select	= 0,
+	},
+};
+
+static int __init parse_tag_ethernet(struct tag *tag)
+{
+	int i;
+
+	i = tag->u.ethernet.mac_index;
+	if (i < ARRAY_SIZE(eth_data)) {
+		eth_data[i].mii_phy_addr = tag->u.ethernet.mii_phy_addr;
+		memcpy(&eth_data[i].hw_addr, tag->u.ethernet.hw_address,
+		       sizeof(eth_data[i].hw_addr));
+		eth_data[i].valid = 1;
+	}
+	return 0;
+}
+__tagtable(ATAG_ETHERNET, parse_tag_ethernet);
+
+void __init setup_board(void)
+{
+	at32_map_usart(1, 0);	/* /dev/ttyS0 */
+
+	at32_setup_serial_console(0);
+}
+
+static int __init atngw_init(void)
+{
+	at32_add_system_devices();
+
+	at32_add_device_usart(0);
+
+	if (eth_data[0].valid)
+		at32_add_device_eth(0, &eth_data[0]);
+	if (eth_data[1].valid)
+		at32_add_device_eth(1, &eth_data[1]);
+
+	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
+
+	at32_add_device_spi(0);
+	at32_add_device_mmci(0);
+	at32_add_device_usb(0);
+
+	return 0;
+}
+postcore_initcall(atngw_init);
+
+void board_setup_fbmem(unsigned long fbmem_start, unsigned long fbmem_size)
+{
+
+}