Merge "board: arm: devsoc: Enable flash based on boot type"

This commit is contained in:
Linux Build Service Account 2022-08-17 17:39:30 -07:00 committed by Gerrit - the friendly Code Review server
commit 63c4ff2ed5
4 changed files with 75 additions and 0 deletions

View file

@ -71,6 +71,7 @@ int ipq_smem_get_boot_version(char *version_name, int buf_size);
int get_current_flash_type(uint32_t *flash_type);
void ipq_fdt_fixup_usb_device_mode(void *blob);
void fdt_fixup_auto_restart(void *blob);
void fdt_fixup_flash(void *blob);
int get_soc_version(uint32_t *soc_ver_major, uint32_t *soc_ver_minor);
unsigned int get_dts_machid(unsigned int machid);
#ifdef IPQ_UBI_VOL_WRITE_SUPPORT

View file

@ -1174,6 +1174,7 @@ extern unsigned int __machine_arch_type;
#define MACH_TYPE_IPQ9574_AP_AL02_C16 0x8050F01
#define MACH_TYPE_IPQ9574_AP_AL03_C1 0x8050002
#define MACH_TYPE_IPQ9574_AP_AL03_C2 0x8050102
#define MACH_TYPE_DEVSOC_EMULATION 0xF060000
#ifdef CONFIG_ARCH_EBSA110
# ifdef machine_arch_type

View file

@ -884,6 +884,10 @@ __weak void fdt_fixup_bt_debug(void *blob)
{
return;
}
__weak void fdt_fixup_flash(void *blob)
{
return;
}
__weak void fdt_fixup_qpic(void *blob)
{
@ -1154,6 +1158,7 @@ int ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_IPQ_FDT_FIXUP
ipq_fdt_fixup(blob);
#endif
fdt_fixup_flash(blob);
fdt_fixup_ethernet(blob);
ipq_fdt_fixup_usb_device_mode(blob);
fdt_fixup_auto_restart(blob);

View file

@ -36,6 +36,7 @@
#include <usb.h>
#endif
#define FLASH_SEL_BIT 7
DECLARE_GLOBAL_DATA_PTR;
extern int devsoc_edma_init(void *cfg);
@ -116,6 +117,56 @@ struct dumpinfo_t dumpinfo_s[] = {
};
int dump_entries_s = ARRAY_SIZE(dumpinfo_s);
void fdt_fixup_flash(void *blob)
{
int node_off, ret;
char *flash = "/soc/nand@79b0000";
if (gd->bd->bi_arch_number == MACH_TYPE_DEVSOC_EMULATION)
return;
node_off = fdt_path_offset(gd->fdt_blob, "nand");
if (!fdtdec_get_is_enabled(gd->fdt_blob, node_off))
flash = "/soc/sdhci@7804000";
node_off = fdt_path_offset(blob, flash);
if (node_off >= 0) {
ret = fdt_setprop_string(blob, node_off, "status", "okay");
if (ret < 0)
printf("Unable to set status of %s\n", flash);
} else {
printf("%s: unable to find node %d\n", __func__, node_off);
}
return;
}
void ipq_uboot_fdt_fixup(void)
{
int node, ret = 0;
char *flash;
void *blob = (void *)gd->fdt_blob;
ulong machid = gd->bd->bi_arch_number;
if (machid == MACH_TYPE_DEVSOC_EMULATION)
return;
/* fix peripherals required for basic board bring up
* like flash etc.
*/
flash = ((machid >> FLASH_SEL_BIT) & 0x1) ? "mmc" : "nand";
node = fdt_path_offset(gd->fdt_blob, flash);
if (node >= 0) {
ret = fdt_setprop_string(blob, node, "status", "okay");
if (ret < 0 && ret != -FDT_ERR_NOSPACE)
printf("Unable to set status of %s\n", flash);
} else {
printf("%s node not available\n", flash);
}
return;
}
void qca_serial_init(struct ipq_serial_platdata *plat)
{
int ret;
@ -233,6 +284,11 @@ int board_mmc_init(bd_t *bis)
return -1;
}
if (!fdtdec_get_is_enabled(gd->fdt_blob, node)) {
printf("MMC: disabled, skipping initialization\n");
return ret;
}
gpio_node = fdt_subnode_offset(gd->fdt_blob, node, "mmc_gpio");
if (node >= 0)
qca_gpio_init(gpio_node);
@ -577,6 +633,18 @@ int ipq_board_usb_init(void)
}
#endif
unsigned int get_dts_machid(unsigned int machid)
{
/* By default nand flash enabled, so flash
* selection bit in mach id in dts is zero.
* For emmc flash this bit will be setted,
* so clear this bit to make machid similar
* to dts mach id.
*/
machid &= ~(1 << FLASH_SEL_BIT);
return machid;
}
__weak int ipq_get_tz_version(char *version_name, int buf_size)
{
return 1;