Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Ladislav Michl | 87d3be4 | 2017-08-17 03:06:45 +0200 | [diff] [blame] | 3 | #include <common.h> |
| 4 | #include <twl4030.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 5 | #include <asm/global_data.h> |
Ladislav Michl | 87d3be4 | 2017-08-17 03:06:45 +0200 | [diff] [blame] | 6 | #include <asm/io.h> |
| 7 | #include <asm/omap_mmc.h> |
| 8 | #include <asm/arch/mux.h> |
| 9 | #include <asm/arch/sys_proto.h> |
| 10 | #include <jffs2/load_kernel.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 11 | #include <linux/delay.h> |
Masahiro Yamada | 2b7a873 | 2017-11-30 13:45:24 +0900 | [diff] [blame] | 12 | #include <linux/mtd/rawnand.h> |
Ladislav Michl | 87d3be4 | 2017-08-17 03:06:45 +0200 | [diff] [blame] | 13 | #include "igep00x0.h" |
| 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | /* |
| 18 | * Routine: set_muxconf_regs |
| 19 | * Description: Setting up the configuration Mux registers specific to the |
| 20 | * hardware. Many pins need to be moved from protect to primary |
| 21 | * mode. |
| 22 | */ |
| 23 | void set_muxconf_regs(void) |
| 24 | { |
| 25 | MUX_DEFAULT(); |
Ladislav Michl | 87d3be4 | 2017-08-17 03:06:45 +0200 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | /* |
| 29 | * Routine: board_init |
| 30 | * Description: Early hardware init. |
| 31 | */ |
| 32 | int board_init(void) |
| 33 | { |
| 34 | int loops = 100; |
| 35 | |
| 36 | /* find out flash memory type, assume NAND first */ |
| 37 | gpmc_cs0_flash = MTD_DEV_TYPE_NAND; |
| 38 | gpmc_init(); |
| 39 | |
| 40 | /* Issue a RESET and then READID */ |
| 41 | writeb(NAND_CMD_RESET, &gpmc_cfg->cs[0].nand_cmd); |
| 42 | writeb(NAND_CMD_STATUS, &gpmc_cfg->cs[0].nand_cmd); |
| 43 | while ((readl(&gpmc_cfg->cs[0].nand_dat) & NAND_STATUS_READY) |
| 44 | != NAND_STATUS_READY) { |
| 45 | udelay(1); |
| 46 | if (--loops == 0) { |
| 47 | gpmc_cs0_flash = MTD_DEV_TYPE_ONENAND; |
| 48 | gpmc_init(); /* reinitialize for OneNAND */ |
| 49 | break; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /* boot param addr */ |
| 54 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 55 | |
Ladislav Michl | 87d3be4 | 2017-08-17 03:06:45 +0200 | [diff] [blame] | 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | #if defined(CONFIG_MMC) |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 60 | int board_mmc_init(struct bd_info *bis) |
Ladislav Michl | 87d3be4 | 2017-08-17 03:06:45 +0200 | [diff] [blame] | 61 | { |
| 62 | return omap_mmc_init(0, 0, 0, -1, -1); |
| 63 | } |
| 64 | |
| 65 | void board_mmc_power_init(void) |
| 66 | { |
| 67 | twl4030_power_mmc_init(0); |
| 68 | } |
| 69 | #endif |