diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-08-15 11:55:26 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2015-08-31 08:43:41 +0200 |
commit | f62bfa56daf17e3e8fac85795196c0ffad42e444 (patch) | |
tree | a91ef11f810c5361252433fc588eada6087d4a3e | |
parent | 9da5fca55cbf9465052256346f6e61968acedf2f (diff) | |
download | u-boot-imx-f62bfa56daf17e3e8fac85795196c0ffad42e444.zip u-boot-imx-f62bfa56daf17e3e8fac85795196c0ffad42e444.tar.gz u-boot-imx-f62bfa56daf17e3e8fac85795196c0ffad42e444.tar.bz2 |
sunxi_nand_spl: Use SYS_NAND_SELF_INIT and only do nand init when necessary
Use SYS_NAND_SELF_INIT and only setup the pinmux and clocks when we are
actually using the nand.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
-rw-r--r-- | board/sunxi/board.c | 12 | ||||
-rw-r--r-- | drivers/mtd/nand/Kconfig | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/sunxi_nand_spl.c | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 680523a..b76bb83 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -31,6 +31,7 @@ #include <asm/arch/usb_phy.h> #include <asm/gpio.h> #include <asm/io.h> +#include <nand.h> #include <net.h> #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) @@ -127,6 +128,12 @@ static void nand_clock_setup(void) setbits_le32(&ccm->ahb_gate0, (CLK_GATE_OPEN << AHB_GATE_OFFSET_NAND0)); setbits_le32(&ccm->nand0_clk_cfg, CCM_NAND_CTRL_ENABLE | AHB_DIV_1); } + +void board_nand_init(void) +{ + nand_pinmux_setup(); + nand_clock_setup(); +} #endif #ifdef CONFIG_GENERIC_MMC @@ -453,11 +460,6 @@ void sunxi_board_init(void) power_failed |= axp221_set_eldo(3, CONFIG_AXP221_ELDO3_VOLT); #endif -#ifdef CONFIG_SPL_NAND_SUNXI - nand_pinmux_setup(); - nand_clock_setup(); -#endif - printf("DRAM:"); ramsize = sunxi_dram_init(); printf(" %lu MiB\n", ramsize >> 20); diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index b6dfb0e..28597f0 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -95,6 +95,7 @@ config SPL_NAND_DENALI config SPL_NAND_SUNXI bool "Support for NAND on Allwinner A20 in SPL" depends on MACH_SUN7I + select SYS_NAND_SELF_INIT ---help--- Enable support for NAND. This option allows SPL to read from sunxi NAND using DMA transfers. diff --git a/drivers/mtd/nand/sunxi_nand_spl.c b/drivers/mtd/nand/sunxi_nand_spl.c index f6f4928..9efe904 100644 --- a/drivers/mtd/nand/sunxi_nand_spl.c +++ b/drivers/mtd/nand/sunxi_nand_spl.c @@ -153,6 +153,8 @@ void nand_init(void) { uint32_t val; + board_nand_init(); + val = readl(SUNXI_NFC_BASE + NFC_CTL); /* enable and reset CTL */ writel(val | NFC_CTL_EN | NFC_CTL_RESET, |