3 * Texas Instruments, <www.ti.com>
6 * Mansoor Ahamed <mansoor.ahamed@ti.com>
9 * Manikandan Pillai <mani.pillai@ti.com>
10 * Richard Woodruff <r-woodruff2@ti.com>
11 * Syed Mohammed Khasim <khasim@ti.com>
13 * SPDX-License-Identifier: GPL-2.0+
18 #include <asm/arch/cpu.h>
19 #include <asm/arch/mem.h>
20 #include <asm/arch/sys_proto.h>
23 #if defined(CONFIG_CMD_NAND)
24 static const u32 gpmc_m_nand[GPMC_MAX_REG] = {
30 M_NAND_GPMC_CONFIG6, 0
35 void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,
38 writel(0, &cs->config7);
40 /* Delay for settling */
41 writel(gpmc_config[0], &cs->config1);
42 writel(gpmc_config[1], &cs->config2);
43 writel(gpmc_config[2], &cs->config3);
44 writel(gpmc_config[3], &cs->config4);
45 writel(gpmc_config[4], &cs->config5);
46 writel(gpmc_config[5], &cs->config6);
47 /* Enable the config */
48 writel((((size & 0xF) << 8) | ((base >> 24) & 0x3F) |
49 (1 << 6)), &cs->config7);
53 /*****************************************************
54 * gpmc_init(): init gpmc bus
55 * Init GPMC for x16, MuxMode (SDRAM in x32).
56 * This code can only be executed from SRAM or SDRAM.
57 *****************************************************/
60 /* putting a blanket check on GPMC based on ZeBu for now */
61 struct gpmc *gpmc_cfg = (struct gpmc *)GPMC_BASE;
62 #ifdef CONFIG_CMD_NAND
63 const u32 *gpmc_config = NULL;
68 writel(0x00000008, &gpmc_cfg->sysconfig);
69 writel(0x00000100, &gpmc_cfg->irqstatus);
70 writel(0x00000100, &gpmc_cfg->irqenable);
71 writel(0x00000012, &gpmc_cfg->config);
73 * Disable the GPMC0 config set by ROM code
75 writel(0, &gpmc_cfg->cs[0].config7);
78 #ifdef CONFIG_CMD_NAND
79 gpmc_config = gpmc_m_nand;
81 base = PISMO1_NAND_BASE;
82 size = PISMO1_NAND_SIZE;
83 enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[0], base, size);