#include <log.h>
#include <nand.h>
#include <reset.h>
+#include <asm/gpio.h>
#include <dm/device_compat.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
struct stm32_fmc2_nand {
struct nand_chip chip;
struct stm32_fmc2_timings timings;
+ struct gpio_desc wp_gpio;
int ncs;
int cs_used[FMC2_MAX_CE];
};
nand->cs_used[i] = cs[i];
}
+ gpio_request_by_name_nodev(node, "wp-gpios", 0, &nand->wp_gpio,
+ GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
+
nand->chip.flash_node = node;
return 0;
chip->ecc.size = FMC2_ECC_STEP_SIZE;
chip->ecc.strength = FMC2_ECC_BCH8;
+ /* Disable Write Protect */
+ if (dm_gpio_is_valid(&nand->wp_gpio))
+ dm_gpio_set_value(&nand->wp_gpio, 0);
+
ret = nand_scan_ident(mtd, nand->ncs, NULL);
if (ret)
return ret;