blob: 2584d2e5ddfde02f4a3139642f4aeff47a45a330 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
2
Ladislav Michl87d3be42017-08-17 03:06:45 +02003#include <twl4030.h>
Simon Glass3ba929a2020-10-30 21:38:53 -06004#include <asm/global_data.h>
Ladislav Michl87d3be42017-08-17 03:06:45 +02005#include <asm/io.h>
6#include <asm/omap_mmc.h>
7#include <asm/arch/mux.h>
8#include <asm/arch/sys_proto.h>
9#include <jffs2/load_kernel.h>
Simon Glassdbd79542020-05-10 11:40:11 -060010#include <linux/delay.h>
Masahiro Yamada2b7a8732017-11-30 13:45:24 +090011#include <linux/mtd/rawnand.h>
Ladislav Michl87d3be42017-08-17 03:06:45 +020012#include "igep00x0.h"
13
14DECLARE_GLOBAL_DATA_PTR;
15
16/*
17 * Routine: set_muxconf_regs
18 * Description: Setting up the configuration Mux registers specific to the
19 * hardware. Many pins need to be moved from protect to primary
20 * mode.
21 */
22void set_muxconf_regs(void)
23{
24 MUX_DEFAULT();
Ladislav Michl87d3be42017-08-17 03:06:45 +020025}
26
27/*
28 * Routine: board_init
29 * Description: Early hardware init.
30 */
31int board_init(void)
32{
33 int loops = 100;
34
35 /* find out flash memory type, assume NAND first */
36 gpmc_cs0_flash = MTD_DEV_TYPE_NAND;
37 gpmc_init();
38
39 /* Issue a RESET and then READID */
40 writeb(NAND_CMD_RESET, &gpmc_cfg->cs[0].nand_cmd);
41 writeb(NAND_CMD_STATUS, &gpmc_cfg->cs[0].nand_cmd);
42 while ((readl(&gpmc_cfg->cs[0].nand_dat) & NAND_STATUS_READY)
43 != NAND_STATUS_READY) {
44 udelay(1);
45 if (--loops == 0) {
46 gpmc_cs0_flash = MTD_DEV_TYPE_ONENAND;
47 gpmc_init(); /* reinitialize for OneNAND */
48 break;
49 }
50 }
51
52 /* boot param addr */
53 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
54
Ladislav Michl87d3be42017-08-17 03:06:45 +020055 return 0;
56}
57
58#if defined(CONFIG_MMC)
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +090059int board_mmc_init(struct bd_info *bis)
Ladislav Michl87d3be42017-08-17 03:06:45 +020060{
61 return omap_mmc_init(0, 0, 0, -1, -1);
62}
63
64void board_mmc_power_init(void)
65{
66 twl4030_power_mmc_init(0);
67}
68#endif