summaryrefslogtreecommitdiff
path: root/target/ag241/patches/ar7.patch
blob: ef48019d4b6e9d25ea5929a710f9d1a2f89403a4 (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
diff -Nur linux-2.6.32.orig/arch/mips/ar7/platform.c linux-2.6.32/arch/mips/ar7/platform.c
--- linux-2.6.32.orig/arch/mips/ar7/platform.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/arch/mips/ar7/platform.c	2009-12-16 20:10:47.564817191 +0100
@@ -509,7 +509,7 @@
 
 	memset(uart_port, 0, sizeof(struct uart_port) * 2);
 
-	uart_port[0].type = PORT_16550A;
+	uart_port[0].type = PORT_AR7;
 	uart_port[0].line = 0;
 	uart_port[0].irq = AR7_IRQ_UART0;
 	uart_port[0].uartclk = ar7_bus_freq() / 2;
@@ -524,7 +524,7 @@
 
 	/* Only TNETD73xx have a second serial port */
 	if (ar7_has_second_uart()) {
-		uart_port[1].type = PORT_16550A;
+		uart_port[1].type = PORT_AR7;
 		uart_port[1].line = 1;
 		uart_port[1].irq = AR7_IRQ_UART1;
 		uart_port[1].uartclk = ar7_bus_freq() / 2;
diff -Nur linux-2.6.32.orig/arch/mips/include/asm/page.h linux-2.6.32/arch/mips/include/asm/page.h
--- linux-2.6.32.orig/arch/mips/include/asm/page.h	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/arch/mips/include/asm/page.h	2009-12-16 20:10:47.576432079 +0100
@@ -200,8 +200,11 @@
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
-#define UNCAC_ADDR(addr)	((addr) - PAGE_OFFSET + UNCAC_BASE)
-#define CAC_ADDR(addr)		((addr) - UNCAC_BASE + PAGE_OFFSET)
+#define UNCAC_ADDR(addr)       ((addr) - PAGE_OFFSET + UNCAC_BASE +    \
+                                PHYS_OFFSET)
+#define CAC_ADDR(addr)         ((addr) - UNCAC_BASE + PAGE_OFFSET -    \
+                                PHYS_OFFSET)
+
 
 #include <asm-generic/memory_model.h>
 #include <asm-generic/getorder.h>
diff -Nur linux-2.6.32.orig/arch/mips/Kconfig linux-2.6.32/arch/mips/Kconfig
--- linux-2.6.32.orig/arch/mips/Kconfig	2009-12-14 21:11:40.737752912 +0100
+++ linux-2.6.32/arch/mips/Kconfig	2009-12-16 20:10:47.592420151 +0100
@@ -30,7 +30,6 @@
 	select CEVT_R4K
 	select CSRC_R4K
 	select IRQ_CPU
-	select NO_EXCEPT_FILL
 	select SWAP_IO_SPACE
 	select SYS_HAS_CPU_MIPS32_R1
 	select SYS_HAS_EARLY_PRINTK
diff -Nur linux-2.6.32.orig/arch/mips/kernel/traps.c linux-2.6.32/arch/mips/kernel/traps.c
--- linux-2.6.32.orig/arch/mips/kernel/traps.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/arch/mips/kernel/traps.c	2009-12-16 20:10:47.596422057 +0100
@@ -1255,9 +1255,22 @@
 
 	exception_handlers[n] = handler;
 	if (n == 0 && cpu_has_divec) {
-		*(u32 *)(ebase + 0x200) = 0x08000000 |
-					  (0x03ffffff & (handler >> 2));
-		local_flush_icache_range(ebase + 0x200, ebase + 0x204);
+              if ((handler ^ (ebase + 4)) & 0xfc000000) {
+                      /* lui k0, 0x0000 */
+                      *(u32 *)(ebase + 0x200) = 0x3c1a0000 | (handler >> 16);
+                      /* ori k0, 0x0000 */
+                      *(u32 *)(ebase + 0x204) =
+                                      0x375a0000 | (handler & 0xffff);
+                      /* jr k0 */
+                      *(u32 *)(ebase + 0x208) = 0x03400008;
+                      /* nop */
+                      *(u32 *)(ebase + 0x20C) = 0x00000000;
+                      flush_icache_range(ebase + 0x200, ebase + 0x210);
+              } else {
+                      *(u32 *)(ebase + 0x200) =
+                              0x08000000 | (0x03ffffff & (handler >> 2));
+                      flush_icache_range(ebase + 0x200, ebase + 0x204);
+              }
 	}
 	return (void *)old_handler;
 }
diff -Nur linux-2.6.32.orig/drivers/mtd/ar7part.c linux-2.6.32/drivers/mtd/ar7part.c
--- linux-2.6.32.orig/drivers/mtd/ar7part.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/drivers/mtd/ar7part.c	2009-12-17 10:51:32.044434005 +0100
@@ -28,7 +28,7 @@
 #include <linux/bootmem.h>
 #include <linux/magic.h>
 
-#define AR7_PARTS	4
+#define AR7_PARTS	5
 #define ROOT_OFFSET	0xe0000
 
 #define LOADER_MAGIC1	le32_to_cpu(0xfeedfa42)
@@ -122,14 +122,19 @@
 
 	ar7_parts[2].name = "linux";
 	ar7_parts[2].offset = pre_size;
-	ar7_parts[2].size = master->size - pre_size - post_size;
+	ar7_parts[2].size = master->size - pre_size - post_size - 2*master->erasesize;
 	ar7_parts[2].mask_flags = 0;
 
 	ar7_parts[3].name = "rootfs";
 	ar7_parts[3].offset = root_offset;
-	ar7_parts[3].size = master->size - root_offset - post_size;
+	ar7_parts[3].size = master->size - root_offset - post_size - 2*master->erasesize;
 	ar7_parts[3].mask_flags = 0;
 
+	ar7_parts[4].name = "cfgfs";
+	ar7_parts[4].offset = master->size - 2*master->erasesize;
+	ar7_parts[4].size = 2*master->erasesize;
+	ar7_parts[4].mask_flags = 0;
+
 	*pparts = ar7_parts;
 	return AR7_PARTS;
 }
diff -Nur linux-2.6.32.orig/drivers/mtd/maps/physmap.c linux-2.6.32/drivers/mtd/maps/physmap.c
--- linux-2.6.32.orig/drivers/mtd/maps/physmap.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/drivers/mtd/maps/physmap.c	2009-12-16 20:12:01.388510102 +0100
@@ -80,7 +80,7 @@
 					"map_rom",
 					NULL };
 #ifdef CONFIG_MTD_PARTITIONS
-static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
+static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "ar7part", NULL };
 #endif
 
 static int physmap_flash_probe(struct platform_device *dev)
diff -Nur linux-2.6.32.orig/drivers/net/cpmac.c linux-2.6.32/drivers/net/cpmac.c
--- linux-2.6.32.orig/drivers/net/cpmac.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/drivers/net/cpmac.c	2009-12-16 21:24:20.356422767 +0100
@@ -1165,7 +1165,7 @@
 	priv->dev = dev;
 	priv->ring_size = 64;
 	priv->msg_enable = netif_msg_init(debug_level, 0xff);
-	memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
+	memcpy(dev->dev_addr, pdata->dev_addr, ETH_ALEN);
 
 	snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
 
diff -Nur linux-2.6.32.orig/drivers/serial/8250.c linux-2.6.32/drivers/serial/8250.c
--- linux-2.6.32.orig/drivers/serial/8250.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/drivers/serial/8250.c	2009-12-16 20:10:58.820421544 +0100
@@ -2714,7 +2714,11 @@
 {
 	struct uart_8250_port *up = (struct uart_8250_port *)port;
 
+#ifdef CONFIG_AR7
+	wait_for_xmitr(up, BOTH_EMPTY);
+#else
 	wait_for_xmitr(up, UART_LSR_THRE);
+#endif
 	serial_out(up, UART_TX, ch);
 }
 
diff -Nur linux-2.6.32.orig/arch/mips/ar7/prom.c linux-2.6.32/arch/mips/ar7/prom.c
--- linux-2.6.32.orig/arch/mips/ar7/prom.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-2.6.32/arch/mips/ar7/prom.c	2010-01-05 20:39:11.000000000 +0100
@@ -219,14 +219,6 @@
 	if (strstr(prom_getcmdline(), "console="))
 		return;
 
-#ifdef CONFIG_KGDB
-	if (!strstr(prom_getcmdline(), "nokgdb")) {
-		strcat(prom_getcmdline(), " console=kgdb");
-		kgdb_enabled = 1;
-		return;
-	}
-#endif
-
 	s = prom_getenv("modetty0");
 	if (s) {
 		baud = simple_strtoul(s, &p, 10);