2 * Copyright (C) 2014 Panasonic Corporation
5 * SPDX-License-Identifier: GPL-2.0+
12 #include <../drivers/mtd/nand/denali.h>
14 static void nand_denali_wp_disable(void)
16 #ifdef CONFIG_NAND_DENALI
18 * Since the boot rom enables the write protection for NAND boot mode,
19 * it must be disabled somewhere for "nand write", "nand erase", etc.
20 * The workaround is here to not disturb the Denali NAND controller
21 * driver just for a really SoC-specific thing.
23 void __iomem *denali_reg = (void __iomem *)CONFIG_SYS_NAND_REGS_BASE;
25 writel(WRITE_PROTECT__FLAG, denali_reg + WRITE_PROTECT);
29 int board_late_init(void)
33 switch (spl_boot_device()) {
34 case BOOT_DEVICE_MMC1:
35 printf("eMMC Boot\n");
36 setenv("bootmode", "emmcboot");
38 case BOOT_DEVICE_NAND:
39 printf("NAND Boot\n");
40 setenv("bootmode", "nandboot");
41 nand_denali_wp_disable();
45 setenv("bootmode", "norboot");
48 printf("Unsupported Boot Mode\n");