/* Check, if the device is write protected. The function expects, that the device is already selected.  */
static int nand_check_wp(struct mtd_info *mtd)
/* Check, if the device is write protected. The function expects, that the device is already selected.  */
static int nand_check_wp(struct mtd_info *mtd)
{
	struct nand_chip *chip = mtd_to_nand(mtd);
	u8 status;
	int ret;
	if (chip->options & NAND_BROKEN_XD)
		return 0;
	ret = nand_status_op(chip, &status);
	if (ret)
		return ret;
	return status & NAND_STATUS_WP ? 0 : 1;
}