Jagan Teki | c5d8681 | 2017-05-07 02:43:14 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 Amarula Solutions B.V. |
| 3 | * Copyright (C) 2016 Engicam S.r.l. |
| 4 | * Author: Jagan Teki <jagan@amarulasolutions.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <mmc.h> |
| 11 | #include <asm/arch/sys_proto.h> |
| 12 | |
| 13 | #include "board.h" |
| 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | #ifdef CONFIG_ENV_IS_IN_MMC |
Jagan Teki | 3ff7b93 | 2017-05-07 02:43:15 +0530 | [diff] [blame] | 18 | static void mmc_late_init(void) |
Jagan Teki | c5d8681 | 2017-05-07 02:43:14 +0530 | [diff] [blame] | 19 | { |
| 20 | char cmd[32]; |
| 21 | char mmcblk[32]; |
| 22 | u32 dev_no = mmc_get_env_dev(); |
| 23 | |
| 24 | setenv_ulong("mmcdev", dev_no); |
| 25 | |
| 26 | /* Set mmcblk env */ |
| 27 | sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no); |
| 28 | setenv("mmcroot", mmcblk); |
| 29 | |
| 30 | sprintf(cmd, "mmc dev %d", dev_no); |
| 31 | run_command(cmd, 0); |
| 32 | } |
| 33 | #endif |
| 34 | |
Jagan Teki | 3ff7b93 | 2017-05-07 02:43:15 +0530 | [diff] [blame] | 35 | int board_late_init(void) |
| 36 | { |
| 37 | switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >> |
| 38 | IMX6_BMODE_SHIFT) { |
| 39 | case IMX6_BMODE_SD: |
| 40 | case IMX6_BMODE_ESD: |
| 41 | case IMX6_BMODE_MMC: |
| 42 | case IMX6_BMODE_EMMC: |
| 43 | #ifdef CONFIG_ENV_IS_IN_MMC |
| 44 | mmc_late_init(); |
| 45 | #endif |
| 46 | setenv("modeboot", "mmcboot"); |
| 47 | break; |
| 48 | case IMX6_BMODE_NAND: |
| 49 | setenv("modeboot", "nandboot"); |
| 50 | break; |
| 51 | default: |
| 52 | setenv("modeboot", ""); |
| 53 | break; |
| 54 | } |
| 55 | |
Jagan Teki | 388a904 | 2017-05-12 17:18:26 +0530 | [diff] [blame^] | 56 | if (is_mx6ul()) |
| 57 | setenv("console", "ttymxc0"); |
| 58 | else |
| 59 | setenv("console", "ttymxc3"); |
| 60 | |
Jagan Teki | 3ff7b93 | 2017-05-07 02:43:15 +0530 | [diff] [blame] | 61 | setenv_fdt_file(); |
| 62 | |
| 63 | return 0; |
| 64 | } |
| 65 | |
Jagan Teki | c5d8681 | 2017-05-07 02:43:14 +0530 | [diff] [blame] | 66 | int board_init(void) |
| 67 | { |
| 68 | /* Address of boot parameters */ |
| 69 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 70 | |
| 71 | #ifdef CONFIG_NAND_MXS |
| 72 | setup_gpmi_nand(); |
| 73 | #endif |
| 74 | |
| 75 | #ifdef CONFIG_VIDEO_IPUV3 |
| 76 | setup_display(); |
| 77 | #endif |
| 78 | |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | int dram_init(void) |
| 83 | { |
| 84 | gd->ram_size = imx_ddr_size(); |
| 85 | |
| 86 | return 0; |
| 87 | } |