qca: ipq40xx: Enabled full boot chain for eMMC

Change-Id: I5e795ff87d2c7a28ef5bd6cf2bbaabdc26cd48e7
Signed-off-by: Gowtham Siddarth Dhandapani <gdhandap@codeaurora.org>
This commit is contained in:
Gowtham Siddarth Dhandapani 2016-07-27 14:05:09 +05:30
parent 77a3314d88
commit 2a12ef637f
8 changed files with 91 additions and 26 deletions

View file

@ -21,6 +21,7 @@
#include <linux/mtd/ubi.h> #include <linux/mtd/ubi.h>
#include <asm/arch-qcom-common/smem.h> #include <asm/arch-qcom-common/smem.h>
#include <mmc.h> #include <mmc.h>
#include <part_efi.h>
#define DLOAD_MAGIC_COOKIE0x10 #define DLOAD_MAGIC_COOKIE0x10
#define XMK_STR(x)#x #define XMK_STR(x)#x
@ -301,15 +302,18 @@ static int do_boot_signedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const a
if (smem_bootconfig_info() == 0) { if (smem_bootconfig_info() == 0) {
active_part = get_rootfs_active_partition(); active_part = get_rootfs_active_partition();
if (active_part) { if (active_part) {
ret = find_part_efi(blk_dev, "0:HLOS_1", &disk_info); ret = get_partition_info_efi_by_name(blk_dev,
"0:HLOS_1", &disk_info);
} else { } else {
ret = find_part_efi(blk_dev, "0:HLOS", &disk_info); ret = get_partition_info_efi_by_name(blk_dev,
"0:HLOS", &disk_info);
} }
} else { } else {
ret = find_part_efi(blk_dev, "0:HLOS", &disk_info); ret = get_partition_info_efi_by_name(blk_dev,
"0:HLOS", &disk_info);
} }
if (ret > 0) { if (ret == 0) {
snprintf(runcmd, sizeof(runcmd), "mmc read 0x%x 0x%X 0x%X", snprintf(runcmd, sizeof(runcmd), "mmc read 0x%x 0x%X 0x%X",
CONFIG_SYS_LOAD_ADDR, CONFIG_SYS_LOAD_ADDR,
(uint)disk_info.start, (uint)disk_info.size); (uint)disk_info.start, (uint)disk_info.size);
@ -484,15 +488,18 @@ static int do_boot_unsignedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const
if (smem_bootconfig_info() == 0) { if (smem_bootconfig_info() == 0) {
active_part = get_rootfs_active_partition(); active_part = get_rootfs_active_partition();
if (active_part) { if (active_part) {
ret = find_part_efi(blk_dev, "0:HLOS_1", &disk_info); ret = get_partition_info_efi_by_name(blk_dev,
"0:HLOS_1", &disk_info);
} else { } else {
ret = find_part_efi(blk_dev, "0:HLOS", &disk_info); ret = get_partition_info_efi_by_name(blk_dev,
"0:HLOS", &disk_info);
} }
} else { } else {
ret = find_part_efi(blk_dev, "0:HLOS", &disk_info); ret = get_partition_info_efi_by_name(blk_dev,
"0:HLOS", &disk_info);
} }
if (ret > 0) { if (ret == 0) {
snprintf(runcmd, sizeof(runcmd), "mmc read 0x%x 0x%x 0x%x", snprintf(runcmd, sizeof(runcmd), "mmc read 0x%x 0x%x 0x%x",
CONFIG_SYS_LOAD_ADDR, CONFIG_SYS_LOAD_ADDR,
(uint)disk_info.start, (uint)disk_info.size); (uint)disk_info.start, (uint)disk_info.size);

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef ___QCA_COMMON_H_
#define ___QCA_COMMON_H_
#include <asm/u-boot.h>
typedef struct {
uint base;
uint clk_mode;
struct mmc *mmc;
int dev_num;
} qca_mmc;
int qca_mmc_init(bd_t *, qca_mmc *);
void board_mmc_deinit(void);
#define MSM_SDC1_BASE 0x7824000
#define MMC_IDENTIFY_MODE 0
#define MMC_DATA_TRANSFER_MODE 1
#define MMC_MODE_HC 0x800
#endif /* __QCA_COMMON_H_ */

View file

@ -29,6 +29,8 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
qca_mmc mmc_host;
loff_t board_env_offset; loff_t board_env_offset;
loff_t board_env_range; loff_t board_env_range;
loff_t board_env_size; loff_t board_env_size;
@ -44,6 +46,12 @@ extern void nand_env_relocate_spec(void);
extern int ipq_spi_init(u16); extern int ipq_spi_init(u16);
extern int fdt_node_set_part_info(void *blob, int parent_offset, extern int fdt_node_set_part_info(void *blob, int parent_offset,
struct mtd_device *dev); struct mtd_device *dev);
extern int mmc_env_init(void);
extern void mmc_env_relocate_spec(void);
extern int mmc_saveenv(void);
extern env_t *mmc_env_ptr;
extern char *mmc_env_name_spec;
/* /*
* Don't have this as a '.bss' variable. The '.bss' and '.rel.dyn' * Don't have this as a '.bss' variable. The '.bss' and '.rel.dyn'
* sections seem to overlap. * sections seem to overlap.
@ -650,9 +658,10 @@ int board_mmc_env_init(void)
} }
} }
blk_dev = mmc_get_dev(mmc_host.dev_num); blk_dev = mmc_get_dev(mmc_host.dev_num);
ret = find_part_efi(blk_dev, "0:APPSBLENV", &disk_info); ret = get_partition_info_efi_by_name(blk_dev,
"0:APPSBLENV", &disk_info);
if (ret > 0) { if (ret == 0) {
board_env_offset = disk_info.start * disk_info.blksz; board_env_offset = disk_info.start * disk_info.blksz;
board_env_size = disk_info.size * disk_info.blksz; board_env_size = disk_info.size * disk_info.blksz;
board_env_range = board_env_size; board_env_range = board_env_size;

View file

@ -16,6 +16,7 @@
#include <configs/ipq40xx.h> #include <configs/ipq40xx.h>
#include <asm/arch-qcom-common/gpio.h> #include <asm/arch-qcom-common/gpio.h>
#include <asm/arch-qcom-common/qca_common.h>
#include <asm/u-boot.h> #include <asm/u-boot.h>
#include <phy.h> #include <phy.h>
@ -26,6 +27,7 @@
#define MAX_CONF_NAME 5 #define MAX_CONF_NAME 5
unsigned int smem_get_board_machtype(void); unsigned int smem_get_board_machtype(void);
extern qca_mmc mmc_host;
#define IPQ40XX_EDMA_DEV 1 #define IPQ40XX_EDMA_DEV 1
typedef struct { typedef struct {

View file

@ -1003,8 +1003,8 @@ board_ipq40xx_params_t board_params[] = {
#ifdef CONFIG_IPQ40XX_I2C #ifdef CONFIG_IPQ40XX_I2C
.i2c_cfg = &i2c0, .i2c_cfg = &i2c0,
#endif #endif
//.mmc_gpio = mmc_ap_dk04, .mmc_gpio = mmc_ap_dk04,
//.mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04), .mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04),
.spi_nand_available = 0, .spi_nand_available = 0,
.nor_nand_available = 0, .nor_nand_available = 0,
.nor_emmc_available = 0, .nor_emmc_available = 0,
@ -1035,8 +1035,8 @@ board_ipq40xx_params_t board_params[] = {
#ifdef CONFIG_IPQ40XX_I2C #ifdef CONFIG_IPQ40XX_I2C
.i2c_cfg = &i2c0, .i2c_cfg = &i2c0,
#endif #endif
//.mmc_gpio = mmc_ap_dk04, .mmc_gpio = mmc_ap_dk04,
//.mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04), .mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04),
.spi_nand_available = 0, .spi_nand_available = 0,
.nor_nand_available = 0, .nor_nand_available = 0,
.nor_emmc_available = 0, .nor_emmc_available = 0,
@ -1065,8 +1065,8 @@ board_ipq40xx_params_t board_params[] = {
0, 1, 2, 3, 4) 0, 1, 2, 3, 4)
}, },
#endif #endif
//.mmc_gpio = mmc_ap_dk04, .mmc_gpio = mmc_ap_dk04,
//.mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04), .mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04),
.spi_nand_available = 0, .spi_nand_available = 0,
.nor_nand_available = 0, .nor_nand_available = 0,
.nor_emmc_available = 0, .nor_emmc_available = 0,
@ -1088,8 +1088,8 @@ board_ipq40xx_params_t board_params[] = {
0, 1, 2, 3, 4) 0, 1, 2, 3, 4)
}, },
#endif #endif
//.mmc_gpio = mmc_ap_dk04, .mmc_gpio = mmc_ap_dk04,
//.mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04), .mmc_gpio_count = ARRAY_SIZE(mmc_ap_dk04),
.spi_nand_available = 0, .spi_nand_available = 0,
.nor_nand_available = 0, .nor_nand_available = 0,
.nor_emmc_available = 1, .nor_emmc_available = 1,

View file

@ -17,7 +17,7 @@
#include <environment.h> #include <environment.h>
#include "ipq807x.h" #include "ipq807x.h"
#include "../common/qca_common.h" #include <asm/arch-qcom-common/qca_common.h>
#include <asm/arch-qcom-common/qpic_nand.h> #include <asm/arch-qcom-common/qpic_nand.h>
#include <fdtdec.h> #include <fdtdec.h>

View file

@ -22,12 +22,12 @@
#error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE #error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE
#endif #endif
char *env_name_spec = "MMC"; char *mmc_env_name_spec = "MMC";
#ifdef ENV_IS_EMBEDDED #ifdef ENV_IS_EMBEDDED
env_t *env_ptr = &environment; env_t *mmc_env_ptr = &environment;
#else /* ! ENV_IS_EMBEDDED */ #else /* ! ENV_IS_EMBEDDED */
env_t *env_ptr; env_t *mmc_env_ptr;
#endif /* ENV_IS_EMBEDDED */ #endif /* ENV_IS_EMBEDDED */
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
@ -54,7 +54,7 @@ __weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
return 0; return 0;
} }
int env_init(void) int mmc_env_init(void)
{ {
/* use default */ /* use default */
gd->env_addr = (ulong)&default_environment[0]; gd->env_addr = (ulong)&default_environment[0];
@ -137,7 +137,7 @@ static inline int write_env(struct mmc *mmc, unsigned long size,
static unsigned char env_flags; static unsigned char env_flags;
#endif #endif
int saveenv(void) int mmc_saveenv(void)
{ {
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1); ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV); struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
@ -207,7 +207,7 @@ static inline int read_env(struct mmc *mmc, unsigned long size,
} }
#ifdef CONFIG_ENV_OFFSET_REDUND #ifdef CONFIG_ENV_OFFSET_REDUND
void env_relocate_spec(void) void mmc_env_relocate_spec(void)
{ {
#if !defined(ENV_IS_EMBEDDED) #if !defined(ENV_IS_EMBEDDED)
struct mmc *mmc; struct mmc *mmc;
@ -295,7 +295,7 @@ err:
#endif #endif
} }
#else /* ! CONFIG_ENV_OFFSET_REDUND */ #else /* ! CONFIG_ENV_OFFSET_REDUND */
void env_relocate_spec(void) void mmc_env_relocate_spec(void)
{ {
#if !defined(ENV_IS_EMBEDDED) #if !defined(ENV_IS_EMBEDDED)
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);

View file

@ -213,4 +213,18 @@ typedef struct {
#define CONFIG_BOOTDELAY 2 #define CONFIG_BOOTDELAY 2
#define CONFIG_LIB_UUID
#define CONFIG_QCA_MMC 1
#ifdef CONFIG_QCA_MMC
#define CONFIG_MMC
#define CONFIG_ENV_IS_IN_MMC
#define CONFIG_CMD_MMC
#define CONFIG_SDHCI_QCOM
#define CONFIG_GENERIC_MMC
#define CONFIG_EFI_PARTITION
#define CONFIG_SYS_MMC_ENV_DEV 0
#endif
#endif /* _IPQ40XX_H */ #endif /* _IPQ40XX_H */