static int flash_toggle(struct flash_info *info, flash_sect_t sect, unsigned int offset, u8 cmd) { void *addr; cfiword_t cword; int retval; addr = flash_make_addr (info, sect, offset); flash_make_cmd (info, cmd, &cword); if (bankwidth_is_1(info)) { retval = flash_read8(addr) != flash_read8(addr); } else if (bankwidth_is_2(info)) { retval = flash_read16(addr) != flash_read16(addr); } else if (bankwidth_is_4(info)) { retval = flash_read32(addr) != flash_read32(addr); } else if (bankwidth_is_8(info)) { retval = ( (flash_read32( addr ) != flash_read32( addr )) || (flash_read32(addr+4) != flash_read32(addr+4)) ); } else { retval = 0; } return retval; }
static int flash_toggle (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd) { cfiptr_t cptr; cfiword_t cword; int retval; cptr.cp = flash_make_addr (info, sect, offset); flash_make_cmd (info, cmd, &cword); if (bankwidth_is_1(info)) { retval = ((cptr.cp[0] & cword.c) != (cptr.cp[0] & cword.c)); } else if (bankwidth_is_2(info)) { retval = ((cptr.wp[0] & cword.w) != (cptr.wp[0] & cword.w)); } else if (bankwidth_is_4(info)) { retval = ((cptr.lp[0] & cword.l) != (cptr.lp[0] & cword.l)); } else if (bankwidth_is_8(info)) { retval = ((cptr.llp[0] & cword.ll) != (cptr.llp[0] & cword.ll)); } else retval = 0; return retval; }