Merge "mmc: Added device tree entry for sdhci"
diff --git a/arch/arm/include/asm/arch-qca-common/qca_common.h b/arch/arm/include/asm/arch-qca-common/qca_common.h
index 0d2fca2..f8a6255 100644
--- a/arch/arm/include/asm/arch-qca-common/qca_common.h
+++ b/arch/arm/include/asm/arch-qca-common/qca_common.h
@@ -53,6 +53,7 @@
void dump_func(void);
int do_dumpqca_flash_data(const char *);
int apps_iscrashed(void);
+int set_uuid_bootargs(char *boot_args, char *part_name, int buflen, bool gpt_flag);
struct dumpinfo_t{
char name[16]; /* use only file name in 8.3 format */
@@ -80,4 +81,6 @@
#define SPI_DEFAULT_ADDR_LEN 3
#define SPI_MAX_ADDR_LEN 4
+
+#define MAX_BOOT_ARGS_SIZE 64
#endif /* __QCA_COMMON_H_ */
diff --git a/board/qca/arm/common/cmd_bootqca.c b/board/qca/arm/common/cmd_bootqca.c
index 8166544..07feff1 100644
--- a/board/qca/arm/common/cmd_bootqca.c
+++ b/board/qca/arm/common/cmd_bootqca.c
@@ -38,7 +38,6 @@
static int debug = 0;
static char mtdids[256];
-
DECLARE_GLOBAL_DATA_PTR;
static qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
int ipq_fs_on_nand ;
@@ -272,6 +271,8 @@
{
char *bootargs;
unsigned int active_part = 0;
+ int ret = 0;
+ char boot_args[MAX_BOOT_ARGS_SIZE] = {'\0'};
#define nand_rootfs "ubi.mtd=" QCA_ROOT_FS_PART_NAME " root=mtd:ubi_rootfs rootfstype=squashfs"
@@ -301,15 +302,23 @@
setenv("fsbootargs", bootargs);
} else {
if (smem_bootconfig_info() == 0) {
+ bootargs = boot_args;
active_part = get_rootfs_active_partition();
if (active_part) {
bootargs = "rootfsname=rootfs_1";
+ ret = set_uuid_bootargs(bootargs, "rootfs_1", sizeof(boot_args), false);
} else {
bootargs = "rootfsname=rootfs";
+ ret = set_uuid_bootargs(bootargs, "rootfs", sizeof(boot_args), false);
}
} else {
bootargs = "rootfsname=rootfs";
+ ret = set_uuid_bootargs(bootargs, "rootfs", sizeof(boot_args), false);
}
+
+ if (ret)
+ return ret;
+
*fs_on_nand = 0;
snprintf(mtdids, sizeof(mtdids), "nand%d="
@@ -329,16 +338,23 @@
#ifdef CONFIG_QCA_MMC
} else if (sfi->flash_type == SMEM_BOOT_MMC_FLASH) {
if (smem_bootconfig_info() == 0) {
+ bootargs = boot_args;
active_part = get_rootfs_active_partition();
if (active_part) {
bootargs = "rootfsname=rootfs_1 gpt";
+ ret = set_uuid_bootargs(bootargs, "rootfs_1", sizeof(boot_args), true);
} else {
bootargs = "rootfsname=rootfs gpt";
+ ret = set_uuid_bootargs(bootargs, "rootfs", sizeof(boot_args), true);
}
} else {
bootargs = "rootfsname=rootfs gpt";
+ ret = set_uuid_bootargs(bootargs, "rootfs", sizeof(boot_args), true);
}
+ if (ret)
+ return ret;
+
*fs_on_nand = 0;
if (getenv("fsbootargs") == NULL)
setenv("fsbootargs", bootargs);
diff --git a/board/qca/arm/ipq40xx/ipq40xx.c b/board/qca/arm/ipq40xx/ipq40xx.c
index 1de6e0f..7851285 100644
--- a/board/qca/arm/ipq40xx/ipq40xx.c
+++ b/board/qca/arm/ipq40xx/ipq40xx.c
@@ -503,3 +503,11 @@
return machid;
}
}
+
+/**
+ * Set the uuid in bootargs variable for mounting rootfilesystem
+ */
+int set_uuid_bootargs(char *boot_args, char *part_name, int buflen, bool gpt_flag)
+{
+ return 0;
+}
diff --git a/board/qca/arm/ipq806x/ipq806x.c b/board/qca/arm/ipq806x/ipq806x.c
index 4e82e7c..aa9ddb2 100644
--- a/board/qca/arm/ipq806x/ipq806x.c
+++ b/board/qca/arm/ipq806x/ipq806x.c
@@ -971,3 +971,11 @@
icache_disable();
dcache_disable();
}
+
+/**
+ * Set the uuid in bootargs variable for mounting rootfilesystem
+ */
+int set_uuid_bootargs(char *boot_args, char *part_name, int buflen, bool gpt_flag)
+{
+ return 0;
+}
diff --git a/board/qca/arm/ipq807x/ipq807x.c b/board/qca/arm/ipq807x/ipq807x.c
index 67fba4a..e11985d 100644
--- a/board/qca/arm/ipq807x/ipq807x.c
+++ b/board/qca/arm/ipq807x/ipq807x.c
@@ -1040,3 +1040,53 @@
return 0;
}
+
+/**
+ * Set the uuid in bootargs variable for mounting rootfilesystem
+ */
+int set_uuid_bootargs(char *boot_args, char *part_name, int buflen, bool gpt_flag)
+{
+ int ret, len;
+ block_dev_desc_t *blk_dev;
+ disk_partition_t disk_info;
+
+ blk_dev = mmc_get_dev(mmc_host.dev_num);
+ if (!blk_dev) {
+ printf("Invalid block device name\n");
+ return -EINVAL;
+ }
+
+ if (buflen <= 0 || buflen > MAX_BOOT_ARGS_SIZE)
+ return -EINVAL;
+
+#ifdef CONFIG_PARTITION_UUIDS
+ ret = get_partition_info_efi_by_name(blk_dev,
+ part_name, &disk_info);
+ if (ret) {
+ printf("bootipq: unsupported partition name %s\n",part_name);
+ return -EINVAL;
+ }
+ if ((len = strlcpy(boot_args, "root=PARTUUID=", buflen)) >= buflen)
+ return -EINVAL;
+#else
+ if ((len = strlcpy(boot_args, "rootfsname=", buflen)) >= buflen)
+ return -EINVAL;
+#endif
+ boot_args += len;
+ buflen -= len;
+
+#ifdef CONFIG_PARTITION_UUIDS
+ if ((len = strlcpy(boot_args, disk_info.uuid, buflen)) >= buflen)
+ return -EINVAL;
+#else
+ if ((len = strlcpy(boot_args, part_name, buflen)) >= buflen)
+ return -EINVAL;
+#endif
+ boot_args += len;
+ buflen -= len;
+
+ if (gpt_flag && strlcpy(boot_args, " gpt", buflen) >= buflen)
+ return -EINVAL;
+
+ return 0;
+}
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
index fdd0074..5e7642a 100644
--- a/drivers/mtd/nand/nand_ids.c
+++ b/drivers/mtd/nand/nand_ids.c
@@ -60,6 +60,9 @@
{ .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} },
SZ_8K, SZ_8K, SZ_2M, 0, 6, 640, NAND_ECC_INFO(40, SZ_1K),
4 },
+ {"TH58NYG3S0H 8G 1.8V 8-bit",
+ { .id = {0x98, 0xa3, 0x91, 0x26} },
+ SZ_4K, SZ_1K, SZ_256K, 0, 4, 256, NAND_ECC_INFO(8, SZ_512) },
LEGACY_ID_NAND("NAND 4MiB 5V 8-bit", 0x6B, 4, SZ_8K, SP_OPTIONS),
LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS),