summaryrefslogtreecommitdiff
path: root/packages/linux/nslu2-kernel/2.6.14/90-mtd-ixp4xx.patch
blob: 6d93a09a9fe71065c452e0d4237ae9a0a3b97172 (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
--- /tmp/ixp4xx.c	2005-09-24 18:12:25.000000000 +0200
+++ test4/drivers/mtd/maps/ixp4xx.c	2005-09-24 19:02:24.000000000 +0200
@@ -42,6 +42,10 @@
 static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
 {
 	map_word val;
+
+#ifndef __ARMEB__
+	ofs ^= 2;
+#endif
 	val.x[0] = *(__u16 *) (map->map_priv_1 + ofs);
 	return val;
 }
@@ -51,6 +55,21 @@
  * when attached to a 16-bit wide device (such as the 28F128J3A),
  * so we can't just memcpy_fromio().
  */
+
+#if !defined(__ARMEB__) && defined(CONFIG_MTD_REDBOOT_PARTS)
+struct fis_image_desc {
+	unsigned char name[16];      // Null terminated name
+	unsigned long flash_base;    // Address within FLASH of image
+	unsigned long mem_base;      // Address in memory where it executes
+	unsigned long size;          // Length of image
+	unsigned long entry_point;   // Execution entry point
+	unsigned long data_length;   // Length of actual data
+	unsigned char _pad[256-(16+7*sizeof(unsigned long))];
+	unsigned long desc_cksum;    // Checksum over image descriptor
+	unsigned long file_cksum;    // Checksum over image data
+};
+#endif
+
 static void ixp4xx_copy_from(struct map_info *map, void *to,
 			     unsigned long from, ssize_t len)
 {
@@ -71,6 +90,19 @@
 
 	if (len > 0)
 		*dest++ = BYTE0(*(u16 *)src);
+
+#if !defined(__ARMEB__) && defined(CONFIG_MTD_REDBOOT_PARTS)
+        if (from == 0x7e0000) {
+		int i;
+                struct fis_image_desc *desc = (struct fis_image_desc *)to;
+
+                for (i=0; i < (len/sizeof(struct fis_image_desc)); i++) {
+                        desc[i].flash_base = be32_to_cpu(desc[i].flash_base);
+                        desc[i].mem_base   = be32_to_cpu(desc[i].mem_base);
+                        desc[i].size       = be32_to_cpu(desc[i].size);
+                }
+        }
+#endif
 }
 
 /* 
@@ -79,6 +111,9 @@
  */
 static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
 {
+#ifndef __ARMEB__
+	adr ^= 2;
+#endif
 	if (!(adr & 1))
 	       *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
 }
@@ -88,6 +123,9 @@
  */
 static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
 {
+#ifndef __ARMEB__
+	adr ^= 2;
+#endif
        *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
 }