blob: 2c269773a85cc30c08b82764f1f08a7f517f7713 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
2
Ladislav Michl4c699a42017-08-17 03:06:45 +02003#include <common.h>
4#include <twl4030.h>
5#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 Glassc05ed002020-05-10 11:40:11 -060010#include <linux/delay.h>
Masahiro Yamada6ae39002017-11-30 13:45:24 +090011#include <linux/mtd/rawnand.h>
Ladislav Michl4c699a42017-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 Michl4c699a42017-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 Michl4c699a42017-08-17 03:06:45 +020055 return 0;
56}
57
58#if defined(CONFIG_MMC)
59int board_mmc_init(bd_t *bis)
60{
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