Lines Matching +full:cmd +full:- +full:timeout +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
8 * 22/05/2001 RMK - Lock read against write
9 * - merge printk level changes (with mods) from Alan Cox.
10 * - use *ppos as the file position, not file->f_pos.
11 * - fix check for out of range pos and r/w size
34 #include <asm/mach-types.h>
53 static bool flashdebug; //if set - we will display progress msgs
96 static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) in flash_ioctl() argument
99 switch (cmd) { in flash_ioctl()
117 return -EINVAL; in flash_ioctl()
132 * We now lock against reads and writes. --rmk in flash_read()
135 return -ERESTARTSYS; in flash_read()
157 return -EINVAL; in flash_write()
160 return -EINVAL; in flash_write()
166 return count ? -ENXIO : 0; in flash_write()
168 if (count > gbFlashSize - p) in flash_write()
169 count = gbFlashSize - p; in flash_write()
172 return -EFAULT; in flash_write()
175 * We now lock against reads and writes. --rmk in flash_write()
178 return -ERESTARTSYS; in flash_write()
187 temp = ((int) (p + count) >> 16) - nBlock + 1; in flash_write()
193 temp -= 1; in flash_write()
199 for (; temp; temp--, nBlock++) { in flash_write()
221 count - written); in flash_write()
226 rc = write_block(p, buf, count - written); in flash_write()
242 rc = -1; in flash_write()
270 * it has no meaning, so it returns -EINVAL.
296 unsigned long timeout; in erase_block() local
337 * wait 10 ms in erase_block()
344 timeout = jiffies + 10 * HZ; in erase_block()
346 while (!(c1 & 0x80) && time_before(jiffies, timeout)) { in erase_block()
372 return -2; in erase_block()
376 * just to make sure - verify if erased OK... in erase_block()
386 return -1; in erase_block()
404 unsigned long timeout; in write_block() local
415 count = 0x10000 - offset; in write_block()
420 timeout = jiffies + 30 * HZ; in write_block()
426 return -EFAULT; in write_block()
445 * write cmd in write_block()
473 * if timeout getting status in write_block()
494 * if hardware reports an error writing, and not timeout - in write_block()
505 * before timeout? in write_block()
507 if (time_before(jiffies, timeout)) { in write_block()
510 pWritePtr - FLASH_BASE); in write_block()
513 * wait couple ms in write_block()
519 printk(KERN_ERR "write_block: timeout at 0x%X\n", in write_block()
520 pWritePtr - FLASH_BASE); in write_block()
522 * return error -2 in write_block()
524 return -2; in write_block()
537 return -EFAULT; in write_block()
541 pWritePtr - FLASH_BASE, c1, c); in write_block()
556 * the write gate, which will be open for about the next 2ms. in kick_open()
586 int ret = -ENODEV; in nwflash_init()
597 ret = -ENXIO; in nwflash_init()