]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/linux/mtd/blktrans.h
imported Ka-Ro specific additions to U-Boot 2009.08 for TX28
[karo-tx-uboot.git] / include / linux / mtd / blktrans.h
1 /*
2  * (C) 2003 David Woodhouse <dwmw2@infradead.org>
3  *
4  * Interface to Linux block layer for MTD 'translation layers'.
5  *
6  */
7
8 #ifndef __MTD_TRANS_H__
9 #define __MTD_TRANS_H__
10
11 /* XXX U-BOOT XXX */
12 #if 0
13 #include <linux/mutex.h>
14 #else
15 #include <linux/list.h>
16 #endif
17
18 struct hd_geometry;
19 struct mtd_info;
20 struct mtd_blktrans_ops;
21 struct file;
22 struct inode;
23
24 struct mtd_blktrans_dev {
25         struct mtd_blktrans_ops *tr;
26         struct list_head list;
27         struct mtd_info *mtd;
28 /* XXX U-BOOT XXX */
29 #if 0
30         struct mutex lock;
31 #endif
32         int devnum;
33         unsigned long size;
34         int readonly;
35         void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */
36 };
37
38 struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
39
40 struct mtd_blktrans_ops {
41         char *name;
42         int major;
43         int part_bits;
44         int blksize;
45         int blkshift;
46
47         /* Access functions */
48         int (*readsect)(struct mtd_blktrans_dev *dev,
49                     unsigned long block, char *buffer);
50         int (*writesect)(struct mtd_blktrans_dev *dev,
51                      unsigned long block, char *buffer);
52
53         /* Block layer ioctls */
54         int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
55         int (*flush)(struct mtd_blktrans_dev *dev);
56
57         /* Called with mtd_table_mutex held; no race with add/remove */
58         int (*open)(struct mtd_blktrans_dev *dev);
59         int (*release)(struct mtd_blktrans_dev *dev);
60
61         /* Called on {de,}registration and on subsequent addition/removal
62            of devices, with mtd_table_mutex held. */
63         void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd);
64         void (*remove_dev)(struct mtd_blktrans_dev *dev);
65
66         struct list_head devs;
67         struct list_head list;
68         struct module *owner;
69
70         struct mtd_blkcore_priv *blkcore_priv;
71 };
72
73 extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
74 extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
75 extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
76 extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
77
78
79 #endif /* __MTD_TRANS_H__ */