cleanup patch
[openwrt.git] / target / linux / aruba-2.6 / patches / 001-flash.patch
1 diff -Nur linux-2.6.15/drivers/mtd/chips/cfi_probe.c linux-2.6.15-openwrt/drivers/mtd/chips/cfi_probe.c
2 --- linux-2.6.15/drivers/mtd/chips/cfi_probe.c 2006-01-03 04:21:10.000000000 +0100
3 +++ linux-2.6.15-openwrt/drivers/mtd/chips/cfi_probe.c 2006-01-10 00:32:32.000000000 +0100
4 @@ -26,6 +26,74 @@
5 static void print_cfi_ident(struct cfi_ident *);
6 #endif
7
8 +#if 1
9 +
10 +#define AMD_AUTOSEL_OFF1 0xAAA
11 +#define AMD_AUTOSEL_OFF2 0x555
12 +#define AMD_MANUF_ID 0x1
13 +#define AMD_DEVICE_ID1 0xF6 /* T */
14 +#define AMD_DEVICE_ID2 0xF9 /* B */
15 +/* Foll. are definitions for Macronix Flash Part */
16 +#define MCX_MANUF_ID 0xC2
17 +#define MCX_DEVICE_ID1 0xA7
18 +#define MCX_DEVICE_ID2 0xA8
19 +/* Foll. common to both AMD and Macronix */
20 +#define FACTORY_LOCKED 0x99
21 +#define USER_LOCKED 0x19
22 +
23 +/* NOTE: AP-70/6x use BYTE mode flash access. Therefore the
24 + * lowest Addr. pin in the flash is not A0 but A-1 (A minus 1).
25 + * CPU's A0 is tied to Flash's A-1, A1 to A0 and so on. This
26 + * gives 4MB of byte-addressable mem. In byte mode, all addr
27 + * need to be multiplied by 2 (i.e compared to word mode).
28 + * NOTE: AMD_AUTOSEL_OFF1 and OFF2 are already mult. by 2
29 + * Just blindly use the addr offsets suggested in the manual
30 + * for byte mode and you'll be OK. Offs. in Table 6 need to
31 + * be mult by 2 (for getting autosel params)
32 + */
33 +void
34 +flash_detect(struct map_info *map, __u32 base, struct cfi_private *cfi)
35 +{
36 + map_word val[3];
37 + int osf = cfi->interleave * cfi->device_type; // =2 for AP70/6x
38 + char *manuf, *part, *lock ;
39 +
40 + if (osf != 1) return ;
41 +
42 + cfi_send_gen_cmd(0xAA, AMD_AUTOSEL_OFF1, base, map, cfi, cfi->device_type, NULL);
43 + cfi_send_gen_cmd(0x55, AMD_AUTOSEL_OFF2, base, map, cfi, cfi->device_type, NULL);
44 + cfi_send_gen_cmd(0x90, AMD_AUTOSEL_OFF1, base, map, cfi, cfi->device_type, NULL);
45 + val[0] = map_read(map, base) ; // manuf ID
46 + val[1] = map_read(map, base+2) ; // device ID
47 + val[2] = map_read(map, base+6) ; // lock indicator
48 +#if 0
49 +printk("v1=0x%x v2=0x%x v3=0x%x\n", val[0], val[1], val[2]) ;
50 +#endif
51 + if (val[0].x[0] == AMD_MANUF_ID) {
52 + manuf = "AMD Flash" ;
53 + if (val[1].x[0] == AMD_DEVICE_ID1)
54 + part = "AM29LV320D (Top)" ;
55 + else if (val[1].x[0] == AMD_DEVICE_ID2)
56 + part = "AM29LV320D (Bot)" ;
57 + else part = "Unknown" ;
58 + } else if (val[0].x[0] == MCX_MANUF_ID) {
59 + manuf = "Macronix Flash" ;
60 + if (val[1].x[0] == MCX_DEVICE_ID1)
61 + part = "MX29LV320A (Top)" ;
62 + else if (val[1].x[0] == MCX_DEVICE_ID2)
63 + part = "MX29LV320A (Bot)" ;
64 + else part = "Unknown" ;
65 + } else
66 + return ;
67 + if (val[2].x[0] == FACTORY_LOCKED)
68 + lock = "Factory Locked" ;
69 + else if (val[2].x[0] == USER_LOCKED)
70 + lock = "User Locked" ;
71 + else lock = "Unknown locking" ;
72 + printk("%s %s (%s)\n", manuf, part, lock) ;
73 +}
74 +#endif
75 +
76 static int cfi_probe_chip(struct map_info *map, __u32 base,
77 unsigned long *chip_map, struct cfi_private *cfi);
78 static int cfi_chip_setup(struct map_info *map, struct cfi_private *cfi);
79 @@ -118,6 +186,10 @@
80 }
81
82 xip_disable();
83 +#if 1
84 + //cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
85 + flash_detect(map, base, cfi) ;
86 +#endif
87 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
88 cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
89 cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
90
This page took 0.055822 seconds and 5 git commands to generate.