All of lore.kernel.org
 help / color / mirror / Atom feed
From: peng.fan at nxp.com <peng.fan@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 44/52] imx8mn: add get_boot_device
Date: Tue,  2 Jul 2019 10:31:58 +0800	[thread overview]
Message-ID: <20190702023206.48995-45-peng.fan@nxp.com> (raw)
In-Reply-To: <20190702023206.48995-1-peng.fan@nxp.com>

From: Peng Fan <peng.fan@nxp.com>

No ROM INFO structure on iMX8MN, use new ROM API to get boot device
from ROM.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/imx8m/soc.c | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 98896893c9..4d3a67fdd1 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -263,6 +263,54 @@ int arch_cpu_init(void)
 	return 0;
 }
 
+#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP)
+struct rom_api *g_rom_api = (struct rom_api *)0x980;
+
+enum boot_device get_boot_device(void)
+{
+	gd_t *pgd = gd;
+	int ret;
+	u32 boot;
+	u16 boot_type;
+	u8 boot_instance;
+	enum boot_device boot_dev = SD1_BOOT;
+
+	ret = g_rom_api->query_boot_infor(QUERY_BT_DEV, &boot,
+					  ((uintptr_t)&boot) ^ QUERY_BT_DEV);
+	gd = pgd;
+
+	if (ret != ROM_API_OKAY) {
+		puts("ROMAPI: failure at query_boot_info\n");
+		return -1;
+	}
+
+	boot_type = boot >> 16;
+	boot_instance = (boot >> 8) & 0xff;
+
+	switch (boot_type) {
+	case BT_DEV_TYPE_SD:
+		boot_dev = boot_instance + SD1_BOOT;
+		break;
+	case BT_DEV_TYPE_MMC:
+		boot_dev = boot_instance + MMC1_BOOT;
+		break;
+	case BT_DEV_TYPE_NAND:
+		boot_dev = NAND_BOOT;
+		break;
+	case BT_DEV_TYPE_FLEXSPINOR:
+		boot_dev = QSPI_BOOT;
+		break;
+	case BT_DEV_TYPE_USB:
+		boot_dev = USB_BOOT;
+		break;
+	default:
+		break;
+	}
+
+	return boot_dev;
+}
+#endif
+
 bool is_usb_boot(void)
 {
 	return get_boot_device() == USB_BOOT;
-- 
2.16.4

  parent reply	other threads:[~2019-07-02  2:31 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02  2:31 [U-Boot] [PATCH 00/52] Support i.MX8MM/N peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 01/52] linux: compat: guard PAGE_SIZE peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 02/52] dm: clk: ignore default settings when node not valid peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 03/52] pinctrl: imx: use devfdt_get_addr_size_index peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 04/52] i2c: mxc: add CONFIG_CLK support peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 05/52] tools: imx8m_image: align spl bin image size peng.fan at nxp.com
2019-07-04 15:33   ` Schrempf Frieder
2019-07-05  2:06     ` Peng Fan
2019-07-02  2:31 ` [U-Boot] [PATCH 06/52] ddr: imx8m: fix ddr firmware location when enable SPL OF peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 07/52] tools: imx8mimage: fix HDMI/FIT parsing peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 08/52] imx8m: add image cfg for i.MX8MM lpddr4 peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 09/52] imx: add IMX8MQ kconfig entry peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 10/52] imx: add IMX8MM " peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 11/52] imx: imx8mm: add clock bindings header peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 12/52] imx: add i.MX8MM cpu type peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 13/52] imx: spl: add spl_board_boot_device for i.MX8MM peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 14/52] imx8m: update imx-regs " peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 15/52] imx: add get_cpu_rev support " peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 16/52] imx8m: rename clock to clock_imx8mq peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 17/52] imx8m: restructure clock.h peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 18/52] imx8m: add clk support for i.MX8MM peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 19/52] imx8m: soc: probe clk before relocation peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 20/52] imx8m: add pin header for i.MX8MM peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 21/52] imx: add i.MX8MM PE property peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 22/52] imx8m: Fix MMU table issue for OPTEE memory peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 23/52] imx8m: set BYPASS ID SWAP to avoid AXI bus errors peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 24/52] imx8m: Configure trustzone region 0 for non-secure access peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 25/52] imx8m: soc: enable SCTR clock before timer init peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 26/52] serial: Kconfig: make MXC_UART usable for MX7 and IMX8M peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 27/52] clk: imx: add Kconfig entry for i.MX8MM peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 28/52] clk: imx: add i.MX8MM clk driver peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 29/52] imx: add i.MX8MM EVK board support peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 30/52] ddr: imx8m: Fix ddr4 driver build issue peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 31/52] imx8mq: Update the ddrc QoS setting for B1 chip peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 32/52] driver: ddr: Refine the ddr init driver on imx8m peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 33/52] ddr: imx8m: Fix the ddr init hang on imx8mq peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 34/52] imx: add i.MX8MN kconfig entry peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 35/52] imx8mn: support get_cpu_rev peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 36/52] imx8m: add clk support for i.MX8MN peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 37/52] imx8mn: set BYPASS ID SWAP to avoid AXI bus errors peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 38/52] imx: add i.MX8MN PE property peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 39/52] imx8mn: add pin header peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 40/52] imx: spl: use spl_board_boot_device for i.MX8MN peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 41/52] spl: pass args to board_return_to_bootrom peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 42/52] imx: add rom api support peng.fan at nxp.com
2019-07-02  2:31 ` [U-Boot] [PATCH 43/52] imx: cpu: restrict get_boot_device peng.fan at nxp.com
2019-07-02  2:31 ` peng.fan at nxp.com [this message]
2019-07-02  2:31 ` [U-Boot] [PATCH 45/52] power: pmic: add SPL_DM_PMIC peng.fan at nxp.com
2019-07-02  2:32 ` [U-Boot] [PATCH 46/52] tools: imx8mimage: add ROM VERSION peng.fan at nxp.com
2019-07-02  2:32 ` [U-Boot] [PATCH 47/52] pinctrl: imx8m: support i.MX8MN peng.fan at nxp.com
2019-07-02  2:32 ` [U-Boot] [PATCH 48/52] tools: imx8m_image: support ddr4 firmware peng.fan at nxp.com
2019-07-02  2:32 ` [U-Boot] [PATCH 49/52] clk: imx: add i.MX8MN clk support peng.fan at nxp.com
2019-07-02  2:32 ` [U-Boot] [PATCH 50/52] imx8m: add i.MX8MN ddr4 image cfg file peng.fan at nxp.com
2019-07-02  2:32 ` [U-Boot] [PATCH 51/52] imx: add dtsi for i.MX8MN peng.fan at nxp.com
2019-07-02  2:32 ` [U-Boot] [PATCH 52/52] imx: add i.MX8MN DDR4 board support peng.fan at nxp.com
2019-07-06 22:45 ` [U-Boot] [PATCH 00/52] Support i.MX8MM/N Lukasz Majewski
2019-07-08  1:28   ` Peng Fan
2019-07-08  7:24     ` Lukasz Majewski
2019-07-08  7:47       ` Peng Fan
2019-07-08  8:15         ` Lukasz Majewski
2019-07-08  8:37           ` Peng Fan
2019-07-17  8:37           ` Peng Fan
2019-07-18  7:12             ` Lukasz Majewski
2019-07-22 21:55               ` Lukasz Majewski
2019-07-23  2:39                 ` Peng Fan
2019-07-23  3:16                   ` Peng Fan
2019-07-18 14:34             ` Schrempf Frieder
2019-07-19  1:51               ` Peng Fan
2019-07-08  8:41         ` Schrempf Frieder
2019-07-08  8:53           ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190702023206.48995-45-peng.fan@nxp.com \
    --to=peng.fan@nxp.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.