Skip to content
Snippets Groups Projects
Commit 1fb61cd8 authored by Ye Li's avatar Ye Li
Browse files

MLK-14312 mx7ulp: Fix incorrect DTB modification after using USB


u-boot has feature that when booting for mfgtool, the u-boot will modify the DTB
to disable SD 1.8v switch. But the judgement for mfgtool boot has a problem, it
only checks whether the USB PHY power status is enabled. When a USB device
(for example a USB ethernet) is used in u-boot, the power status is also enabled.
So the u-boot incorrectly disable the SD 1.8v switch.

The patch changes the get_boot_device to use the boot SW info provided by ROM. Only if
it is a USB boot, we will start the DTB modification for SD.

Signed-off-by: default avatarYe Li <ye.li@nxp.com>
parent da0ce278
No related branches found
No related tags found
No related merge requests found
...@@ -11,9 +11,7 @@ ...@@ -11,9 +11,7 @@
#include <asm/arch/sys_proto.h> #include <asm/arch/sys_proto.h>
#include <dm.h> #include <dm.h>
#include <asm/imx-common/hab.h> #include <asm/imx-common/hab.h>
#ifdef CONFIG_FSL_FASTBOOT
#include <asm/imx-common/boot_mode.h> #include <asm/imx-common/boot_mode.h>
#endif
#include <fdt_support.h> #include <fdt_support.h>
struct lpuart_serial_platdata { struct lpuart_serial_platdata {
...@@ -360,8 +358,7 @@ int mmc_get_env_dev(void) ...@@ -360,8 +358,7 @@ int mmc_get_env_dev(void)
#ifdef CONFIG_OF_SYSTEM_SETUP #ifdef CONFIG_OF_SYSTEM_SETUP
int ft_system_setup(void *blob, bd_t *bd) int ft_system_setup(void *blob, bd_t *bd)
{ {
#if !defined(CONFIG_FSL_FASTBOOT) && defined(is_boot_from_usb) if (get_boot_device() == USB_BOOT) {
if (is_boot_from_usb()) {
int rc; int rc;
int nodeoff = fdt_path_offset(blob, "/ahb-bridge0@40000000/usdhc@40370000"); int nodeoff = fdt_path_offset(blob, "/ahb-bridge0@40000000/usdhc@40370000");
if (nodeoff < 0) if (nodeoff < 0)
...@@ -389,28 +386,37 @@ add: ...@@ -389,28 +386,37 @@ add:
} }
} }
} }
#endif
return 0; return 0;
} }
#endif #endif
#ifdef CONFIG_FSL_FASTBOOT
enum boot_device get_boot_device(void) enum boot_device get_boot_device(void)
{ {
bool type; struct bootrom_sw_info **p =
u32 bt1_cfg = 0; (struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
enum boot_device boot_dev = UNKNOWN_BOOT;
bt1_cfg = readl(CMC1_RBASE + 0x40); enum boot_device boot_dev = SD1_BOOT;
type = (bt1_cfg >> 8) & 0x1; u8 boot_type = (*p)->boot_dev_type;
u8 boot_instance = (*p)->boot_dev_instance;
switch (boot_type) {
case BOOT_TYPE_SD:
boot_dev = boot_instance + SD1_BOOT;
break;
case BOOT_TYPE_MMC:
boot_dev = boot_instance + MMC1_BOOT;
break;
case BOOT_TYPE_USB:
boot_dev = USB_BOOT;
break;
default:
break;
}
if (type)
boot_dev = SD1_BOOT;
else
boot_dev = MMC1_BOOT;
return boot_dev; return boot_dev;
} }
#ifdef CONFIG_FSL_FASTBOOT
#ifdef CONFIG_SERIAL_TAG #ifdef CONFIG_SERIAL_TAG
void get_board_serial(struct tag_serialnr *serialnr) void get_board_serial(struct tag_serialnr *serialnr)
{ {
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <linux/sizes.h> #include <linux/sizes.h>
#define ROM_SW_INFO_ADDR 0x000001E8
#define CAAM_SEC_SRAM_BASE (0x26000000) #define CAAM_SEC_SRAM_BASE (0x26000000)
#define CAAM_SEC_SRAM_SIZE (SZ_32K) #define CAAM_SEC_SRAM_SIZE (SZ_32K)
#define CAAM_SEC_SRAM_END (CAAM_SEC_SRAM_BASE + CAAM_SEC_SRAM_SIZE - 1) #define CAAM_SEC_SRAM_END (CAAM_SEC_SRAM_BASE + CAAM_SEC_SRAM_SIZE - 1)
...@@ -1205,6 +1207,23 @@ struct lpuart_fsl { ...@@ -1205,6 +1207,23 @@ struct lpuart_fsl {
#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20))) #define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
#define disconnect_from_pc(void) writel(0x0, USBOTG0_RBASE + 0x140) #define disconnect_from_pc(void) writel(0x0, USBOTG0_RBASE + 0x140)
/* Boot device type */
#define BOOT_TYPE_SD 0x1
#define BOOT_TYPE_MMC 0x2
#define BOOT_TYPE_USB 0xf
struct bootrom_sw_info {
u8 reserved_1;
u8 boot_dev_instance;
u8 boot_dev_type;
u8 reserved_2;
u32 core_freq;
u32 axi_freq;
u32 ddr_freq;
u32 rom_tick_freq;
u32 reserved_3[3];
};
#endif #endif
#endif /* _MX7ULP_REGS_H_*/ #endif /* _MX7ULP_REGS_H_*/
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Copyright (C) 2012 Boundary Devices Inc. * Copyright (C) 2012 Boundary Devices Inc.
* *
* Copyright (C) 2015-2016 Freescale Semiconductor, Inc. * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
* Copyright 2017 NXP
* *
* SPDX-License-Identifier: GPL-2.0+ * SPDX-License-Identifier: GPL-2.0+
*/ */
...@@ -28,6 +29,7 @@ enum boot_device { ...@@ -28,6 +29,7 @@ enum boot_device {
MMC4_BOOT, MMC4_BOOT,
NAND_BOOT, NAND_BOOT,
QSPI_BOOT, QSPI_BOOT,
USB_BOOT,
UNKNOWN_BOOT, UNKNOWN_BOOT,
BOOT_DEV_NUM = UNKNOWN_BOOT, BOOT_DEV_NUM = UNKNOWN_BOOT,
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment