nwflash.c (87d8a69709d971913e6cc7210450fcb8be963667) nwflash.c (55929332c92e5d34d65a8f784604c92677ea3e15)
1/*
2 * Flash memory interface rev.5 driver for the Intel
3 * Flash chips used on the NetWinder.
4 *
5 * 20/08/2000 RMK use __ioremap to map flash into virtual memory
6 * make a few more places use "volatile"
7 * 22/05/2001 RMK - Lock read against write
8 * - merge printk level changes (with mods) from Alan Cox.

--- 80 unchanged lines hidden (view full) ---

89 *(volatile unsigned char *) (FLASH_BASE + 0x8000) = 0xFF;
90
91 if (c2 == KFLASH_ID4)
92 gbFlashSize = KFLASH_SIZE4;
93
94 return c2;
95}
96
1/*
2 * Flash memory interface rev.5 driver for the Intel
3 * Flash chips used on the NetWinder.
4 *
5 * 20/08/2000 RMK use __ioremap to map flash into virtual memory
6 * make a few more places use "volatile"
7 * 22/05/2001 RMK - Lock read against write
8 * - merge printk level changes (with mods) from Alan Cox.

--- 80 unchanged lines hidden (view full) ---

89 *(volatile unsigned char *) (FLASH_BASE + 0x8000) = 0xFF;
90
91 if (c2 == KFLASH_ID4)
92 gbFlashSize = KFLASH_SIZE4;
93
94 return c2;
95}
96
97static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg)
97static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
98{
98{
99 lock_kernel();
99 switch (cmd) {
100 case CMD_WRITE_DISABLE:
101 gbWriteBase64Enable = 0;
102 gbWriteEnable = 0;
103 break;
104
105 case CMD_WRITE_ENABLE:
106 gbWriteEnable = 1;
107 break;
108
109 case CMD_WRITE_BASE64K_ENABLE:
110 gbWriteBase64Enable = 1;
111 break;
112
113 default:
114 gbWriteBase64Enable = 0;
115 gbWriteEnable = 0;
100 switch (cmd) {
101 case CMD_WRITE_DISABLE:
102 gbWriteBase64Enable = 0;
103 gbWriteEnable = 0;
104 break;
105
106 case CMD_WRITE_ENABLE:
107 gbWriteEnable = 1;
108 break;
109
110 case CMD_WRITE_BASE64K_ENABLE:
111 gbWriteBase64Enable = 1;
112 break;
113
114 default:
115 gbWriteBase64Enable = 0;
116 gbWriteEnable = 0;
117 unlock_kernel();
116 return -EINVAL;
117 }
118 return -EINVAL;
119 }
120 unlock_kernel();
118 return 0;
119}
120
121static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
122 loff_t *ppos)
123{
124 ssize_t ret;
125

--- 500 unchanged lines hidden (view full) ---

626}
627
628static const struct file_operations flash_fops =
629{
630 .owner = THIS_MODULE,
631 .llseek = flash_llseek,
632 .read = flash_read,
633 .write = flash_write,
121 return 0;
122}
123
124static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
125 loff_t *ppos)
126{
127 ssize_t ret;
128

--- 500 unchanged lines hidden (view full) ---

629}
630
631static const struct file_operations flash_fops =
632{
633 .owner = THIS_MODULE,
634 .llseek = flash_llseek,
635 .read = flash_read,
636 .write = flash_write,
634 .ioctl = flash_ioctl,
637 .unlocked_ioctl = flash_ioctl,
635};
636
637static struct miscdevice flash_miscdev =
638{
639 FLASH_MINOR,
640 "nwflash",
641 &flash_fops
642};

--- 44 unchanged lines hidden ---
638};
639
640static struct miscdevice flash_miscdev =
641{
642 FLASH_MINOR,
643 "nwflash",
644 &flash_fops
645};

--- 44 unchanged lines hidden ---