1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright © 2000 Red Hat UK Limited
4 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
7 #ifndef __MTD_FLASHCHIP_H__
8 #define __MTD_FLASHCHIP_H__
10 /* For spinlocks. sched.h includes spinlock.h from whichever directory it
11 * happens to be in - so we don't have to care whether we're on 2.2, which
12 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
14 #include <linux/sched.h>
15 #include <linux/mutex.h>
39 /* These 2 come from nand_state_t, which has been unified here */
42 /* These 4 come from onenand_state_t, which has been unified here */
53 /* NOTE: confusingly, this can be used to refer to more than one chip at a time,
54 if they're interleaved. This can even refer to individual partitions on
55 the same physical chip when present. */
58 unsigned long start; /* Offset within the map */
60 /* We omit len for now, because when we group them together
61 we insist that they're all of the same size, and the chip size
62 is held in the next level up. If we get more versatile later,
63 it'll make it a damn sight harder to find which chip we want from
64 a given offset, and we'll want to add the per-chip length field
67 int ref_point_counter;
71 unsigned int write_suspended:1;
72 unsigned int erase_suspended:1;
73 unsigned long in_progress_block_addr;
74 unsigned long in_progress_block_mask;
77 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
80 int buffer_write_time;
83 int word_write_time_max;
84 int buffer_write_time_max;
90 /* This is used to handle contention on write/erase operations
91 between partitions of the same physical chip. */
92 struct flchip_shared {
94 struct flchip *writing;
95 struct flchip *erasing;
99 #endif /* __MTD_FLASHCHIP_H__ */