6 #include <linux/module.h>
7 #include <linux/types.h>
8 #include <linux/errno.h>
10 #include <linux/fcntl.h>
11 #include <linux/poll.h>
19 #include <asm/uaccess.h>
20 #include <asm/pgtable.h>
34 #define FLASH_MINOR 152
42 spin_lock(&flash_lock);
44 addr =
flash.read_base;
45 size =
flash.read_size;
49 spin_unlock(&flash_lock);
53 addr =
flash.read_base;
54 size =
flash.read_size;
55 }
else if (vma->
vm_flags & VM_WRITE) {
56 addr =
flash.write_base;
57 size =
flash.write_size;
59 spin_unlock(&flash_lock);
63 spin_unlock(&flash_lock);
105 flash_read(
struct file * file,
char __user *
buf,
106 size_t count, loff_t *ppos)
111 if (count >
flash.read_size - p)
112 count =
flash.read_size -
p;
114 for (i = 0; i <
count; i++) {
126 flash_open(
struct inode *
inode,
struct file *file)
139 flash_release(
struct inode *inode,
struct file *file)
141 spin_lock(&flash_lock);
143 spin_unlock(&flash_lock);
153 .llseek = flash_llseek,
157 .release = flash_release,
186 op->
dev.of_node->full_name,
212 .of_match_table = flash_match,
214 .probe = flash_probe,