/* Check for program or erase operation is completed.  */
static uint32_t check_status(const struct nand_flash_raw *raw)
/* Check for program or erase operation is completed.  */
static uint32_t check_status(const struct nand_flash_raw *raw)
{
	uint32_t status;
	WRITE_COMMAND(raw, NAND_COMMAND_STATUS);
	status = READ_DATA8(raw);
	if (((status & NAND_STATUS_READY) != NAND_STATUS_READY) ||
			((status & NAND_STATUS_ERROR) != 0)) {
		return 0;
	}
	return 1;
}