source: svn/trunk/newcon3bcm2_21bu/toolchain/mipsel-linux-uclibc/include/linux/mtd/flashchip.h

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1
2/*
3 * struct flchip definition
4 *
5 * Contains information about the location and state of a given flash device
6 *
7 * (C) 2000 Red Hat. GPLd.
8 *
9 *
10 */
11
12#ifndef __MTD_FLASHCHIP_H__
13#define __MTD_FLASHCHIP_H__
14
15/* For spinlocks. sched.h includes spinlock.h from whichever directory it
16 * happens to be in - so we don't have to care whether we're on 2.2, which
17 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
18 */
19#include <linux/sched.h>
20
21typedef enum { 
22        FL_READY,
23        FL_STATUS,
24        FL_CFI_QUERY,
25        FL_JEDEC_QUERY,
26        FL_ERASING,
27        FL_ERASE_SUSPENDING,
28        FL_ERASE_SUSPENDED,
29        FL_WRITING,
30        FL_WRITING_TO_BUFFER,
31        FL_WRITE_SUSPENDING,
32        FL_WRITE_SUSPENDED,
33        FL_PM_SUSPENDED,
34        FL_SYNCING,
35        FL_UNLOADING,
36        FL_LOCKING,
37        FL_UNLOCKING,
38        FL_POINT,
39        FL_XIP_WHILE_ERASING,
40        FL_XIP_WHILE_WRITING,
41        FL_UNKNOWN
42} flstate_t;
43
44
45
46/* NOTE: confusingly, this can be used to refer to more than one chip at a time,
47   if they're interleaved.  This can even refer to individual partitions on
48   the same physical chip when present. */
49
50struct flchip {
51        unsigned long start; /* Offset within the map */
52        //      unsigned long len;
53        /* We omit len for now, because when we group them together
54           we insist that they're all of the same size, and the chip size
55           is held in the next level up. If we get more versatile later,
56           it'll make it a damn sight harder to find which chip we want from
57           a given offset, and we'll want to add the per-chip length field
58           back in.
59        */
60        int ref_point_counter;
61        flstate_t state;
62        flstate_t oldstate;
63
64        int write_suspended:1;
65        int erase_suspended:1;
66        unsigned long in_progress_block_addr;
67
68        spinlock_t *mutex;
69        spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
70        wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
71                             to be ready */
72        int word_write_time;
73        int buffer_write_time;
74        int erase_time;
75
76        void *priv;
77};
78
79/* This is used to handle contention on write/erase operations
80   between partitions of the same physical chip. */
81struct flchip_shared {
82        spinlock_t lock;
83        struct flchip *writing;
84        struct flchip *erasing;
85};
86
87
88#endif /* __MTD_FLASHCHIP_H__ */
Note: See TracBrowser for help on using the repository browser.