update madwifi
[openwrt.git] / target / linux / generic-2.4 / patches / 008-intel_flashchip_fix.patch
1 diff -urN linux.old/drivers/mtd/chips/cfi_cmdset_0001.c linux.dev/drivers/mtd/chips/cfi_cmdset_0001.c
2 --- linux.old/drivers/mtd/chips/cfi_cmdset_0001.c 2004-11-17 12:54:21.000000000 +0100
3 +++ linux.dev/drivers/mtd/chips/cfi_cmdset_0001.c 2006-03-16 17:25:04.000000000 +0100
4 @@ -28,10 +28,18 @@
5 #include <linux/slab.h>
6 #include <linux/delay.h>
7 #include <linux/interrupt.h>
8 +#include <linux/notifier.h>
9 +#include <linux/reboot.h>
10 #include <linux/mtd/map.h>
11 #include <linux/mtd/cfi.h>
12 #include <linux/mtd/compatmac.h>
13
14 +#ifndef container_of
15 +#define container_of(ptr, type, member) ({ \
16 + const typeof( ((type *)0)->member ) *__mptr = (ptr); \
17 + (type *)( (char *)__mptr - offsetof(type,member) );})
18 +#endif
19 +
20 // debugging, turns off buffer write mode #define FORCE_WORD_WRITE
21
22 static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
23 @@ -45,6 +53,7 @@
24 static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len);
25 static int cfi_intelext_suspend (struct mtd_info *);
26 static void cfi_intelext_resume (struct mtd_info *);
27 +static int cfi_intelext_reboot(struct notifier_block *nb, unsigned long val, void *v);
28
29 static void cfi_intelext_destroy(struct mtd_info *);
30
31 @@ -288,6 +297,9 @@
32 map->fldrv = &cfi_intelext_chipdrv;
33 MOD_INC_USE_COUNT;
34 mtd->name = map->name;
35 + mtd->reboot_notifier.notifier_call = cfi_intelext_reboot;
36 + register_reboot_notifier(&mtd->reboot_notifier);
37 +
38 return mtd;
39
40 setup_err:
41 @@ -1960,10 +1972,40 @@
42 }
43 }
44
45 +
46 +static void cfi_intelext_reset(struct mtd_info *mtd)
47 +{
48 + struct map_info *map = mtd->priv;
49 + struct cfi_private *cfi = map->fldrv_priv;
50 + int i;
51 + struct flchip *chip;
52 +
53 + cfi_intelext_sync(mtd);
54 + for (i=0; i<cfi->numchips; i++) {
55 + chip = &cfi->chips[i];
56 +
57 + spin_lock(chip->mutex);
58 + cfi_write(map, CMD(0xFF), 0);
59 + chip->state = FL_READY;
60 + spin_unlock(chip->mutex);
61 + }
62 +}
63 +
64 +static int cfi_intelext_reboot(struct notifier_block *nb, unsigned long val, void *v)
65 +{
66 + struct mtd_info *mtd;
67 +
68 + mtd = container_of(nb, struct mtd_info, reboot_notifier);
69 + cfi_intelext_reset(mtd);
70 + return NOTIFY_DONE;
71 +}
72 +
73 static void cfi_intelext_destroy(struct mtd_info *mtd)
74 {
75 struct map_info *map = mtd->priv;
76 struct cfi_private *cfi = map->fldrv_priv;
77 + cfi_intelext_reset(mtd);
78 + unregister_reboot_notifier(&mtd->reboot_notifier);
79 kfree(cfi->cmdset_priv);
80 kfree(cfi->cfiq);
81 kfree(cfi);
82 diff -urN linux.old/include/linux/mtd/mtd.h linux.dev/include/linux/mtd/mtd.h
83 --- linux.old/include/linux/mtd/mtd.h 2003-08-25 13:44:44.000000000 +0200
84 +++ linux.dev/include/linux/mtd/mtd.h 2006-03-16 17:00:10.000000000 +0100
85 @@ -10,6 +10,7 @@
86 #include <linux/version.h>
87 #include <linux/types.h>
88 #include <linux/mtd/compatmac.h>
89 +#include <linux/notifier.h>
90 #include <linux/module.h>
91 #include <linux/uio.h>
92
93 @@ -217,6 +218,8 @@
94 int (*suspend) (struct mtd_info *mtd);
95 void (*resume) (struct mtd_info *mtd);
96
97 + struct notifier_block reboot_notifier;
98 +
99 void *priv;
100 };
101
This page took 0.044286 seconds and 5 git commands to generate.