Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8CF4C433F5 for ; Sat, 12 Mar 2022 02:43:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5407A83AE7; Sat, 12 Mar 2022 03:43:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TKBcq5/u"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C6908303C; Sat, 12 Mar 2022 03:43:28 +0100 (CET) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DD05083AE6 for ; Sat, 12 Mar 2022 03:43:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.bossman075@gmail.com Received: by mail-qt1-x836.google.com with SMTP id c4so8939009qtx.1 for ; Fri, 11 Mar 2022 18:43:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hlie8ZJeH+qvr9OPinOd0vgBzMeyoHMdPYWQM+TBIeE=; b=TKBcq5/uHELCi39FIMSIG+twg4f+4GCvr+hiWyCsEMGn1tIDOkzvMRQffn9x+QIxCb 93SKEkz7ij84ki+ESyRjbKzL77TWNAIldSC7K6p7lfpgD+MBKfDkorFDi9//v+4rAobo C2B2ZLMJ4YUVOXB8CBY4/fGpBGA6WWGMZtiTnARnzUux65/r+L24sl2H8g8fGr39CR8b v31mW5iu7quv1VOm217f71BQgevBo9g4PYWjD2QzMIoXiB/ipytzzWPgaywlggarzkgk FkdjBsDyhzasGqvsUoGssyemG8JWpO83DONjkJ+LgdOpuyURoaJEVn/65mAX1jFaawHa kyJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hlie8ZJeH+qvr9OPinOd0vgBzMeyoHMdPYWQM+TBIeE=; b=uKprtAuXUcA3CodUSgpMiRUejNS7ddal7Ct8CoOAnB2DqSIK0CFutRSvadQhfx/JA3 vK8u2pO5e4tMfmkyYFiKnDDKUJ/sNk042huEKDzZ/OWDRv9DLRXiULmYMWhoaMWbfTTz oGwqCOIGdfjpU/rSx2Y76PrHn/WsKI5xWTbWsPpfWe9q737ML49eVtPcKRfBp8O8UHEU 04a3Biz+owupcjJ6hVPmzXMQkSmq8Oppz/SZDxsz3hkCjKBSNdSGAUop6BN6yjtE0Puz dZHSykA7lEU8+Wbutg8cKaQbmdug20lRxa1RO4vHXZ6X8/TKNusUGqoqAqliykIJvRwE zCrA== X-Gm-Message-State: AOAM5337jv5T2/4DkFN26/PyT8hlCzdICY2MAvLecGnjHIBDH0cywaLT NKcK9X5P/ncRe3P70yYe0DLuxImauKQ= X-Google-Smtp-Source: ABdhPJwqNb8iaptyt5ZkmwVl8iFokbSxgCPqf1FNEtwdsFdswEtXdEhFdcZoxJ7lM55iqEI273mM1A== X-Received: by 2002:a05:622a:49:b0:2de:4d52:5e76 with SMTP id y9-20020a05622a004900b002de4d525e76mr10600812qtw.633.1647053002364; Fri, 11 Mar 2022 18:43:22 -0800 (PST) Received: from jesse-desktop.jtp-bos.lab (146-115-144-188.s4282.c3-0.nwt-cbr1.sbo-nwt.ma.cable.rcncustomer.com. [146.115.144.188]) by smtp.gmail.com with ESMTPSA id n9-20020a05622a11c900b002e1c508ba41sm1743538qtk.19.2022.03.11.18.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 18:43:21 -0800 (PST) From: Jesse Taube X-Google-Original-From: Jesse Taube To: u-boot@lists.denx.de Cc: sbabic@denx.de, festevam@gmail.com, xypron.glpk@gmx.de, uboot-imx@nxp.com, lukma@denx.de, seanga2@gmail.com, giulio.benetti@benettiengineering.com, Mr.Bossman075@gmail.com, andre.przywara@arm.com Subject: [PATCH v1 1/2] imx: imxrt1050-evk: Add support for SPI flash booting Date: Fri, 11 Mar 2022 21:43:18 -0500 Message-Id: <20220312024319.3224937-1-Mr.Bossman075@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean This add some macros to change addresses to use flexspi. This commit adds support for booting the imxrt1050-evk from spi. It adds imximage config and the ability for SPL to boot from NOR. Signed-off-by: Jesse Taube --- .../freescale/imxrt1050-evk/imximage-nor.cfg | 42 +++++++++++++++++++ board/freescale/imxrt1050-evk/imximage.cfg | 11 ++++- board/freescale/imxrt1050-evk/imxrt1050-evk.c | 8 +++- configs/imxrt1050-evk_defconfig | 6 ++- include/configs/imxrt1050-evk.h | 4 +- 5 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 board/freescale/imxrt1050-evk/imximage-nor.cfg diff --git a/board/freescale/imxrt1050-evk/imximage-nor.cfg b/board/freescale/imxrt1050-evk/imximage-nor.cfg new file mode 100644 index 0000000000..3e1b059075 --- /dev/null +++ b/board/freescale/imxrt1050-evk/imximage-nor.cfg @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2019 + * Author(s): Giulio Benetti + */ + +#define __ASSEMBLY__ +#include + +/* image version */ + +IMAGE_VERSION 2 + +/* + * Boot Device : one of + * spi/sd/nand/onenand, qspi/nor + */ + +BOOT_FROM nor + +/* + * Device Configuration Data (DCD) + * + * Each entry must have the format: + * Addr-type Address Value + * + * where: + * Addr-type register length (1,2 or 4 bytes) + * Address absolute address of the register + * value value to be stored in the register + */ + +/* + * 0x400AC044 is used to configure the flexram. + * Unfortunatly seting all to OCRAM only works for MMC + * and setting all to DTCM only works for FLEXSPI NOR. + * This configureation fortunaly works for both SPI and MMC. +*/ +/* Set first two banks FlexRAM as OCRAM(01b) and the rest to DTCM(10b) */ +DATA 4 0x400AC044 0x55aaaaaa +/* Use FLEXRAM_BANK_CFG to config FlexRAM */ +SET_BIT 4 0x400AC040 0x4 diff --git a/board/freescale/imxrt1050-evk/imximage.cfg b/board/freescale/imxrt1050-evk/imximage.cfg index cf1665be61..dffca91f0a 100644 --- a/board/freescale/imxrt1050-evk/imximage.cfg +++ b/board/freescale/imxrt1050-evk/imximage.cfg @@ -30,7 +30,14 @@ BOOT_FROM sd * value value to be stored in the register */ -/* Set all FlexRAM as OCRAM(01b) */ -DATA 4 0x400AC044 0x55555555 +/* + * 0x400AC044 is used to configure the flexram. + * Unfortunatly seting all to OCRAM only works for MMC + * and setting all to DTCM only works for FLEXSPI NOR. + * This configureation fortunaly works for both SPI and MMC. +*/ +/* Set first two banks FlexRAM as OCRAM(01b) and the rest to DTCM(10b) */ +DATA 4 0x400AC044 0x55aaaaaa /* Use FLEXRAM_BANK_CFG to config FlexRAM */ SET_BIT 4 0x400AC040 0x4 + diff --git a/board/freescale/imxrt1050-evk/imxrt1050-evk.c b/board/freescale/imxrt1050-evk/imxrt1050-evk.c index 6132916578..d4e39fd914 100644 --- a/board/freescale/imxrt1050-evk/imxrt1050-evk.c +++ b/board/freescale/imxrt1050-evk/imxrt1050-evk.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -67,7 +68,12 @@ void spl_board_init(void) u32 spl_boot_device(void) { - return BOOT_DEVICE_MMC1; + /* There is no way to find boot device so look if there is valid IVT in RAM for MMC*/ + u32 nor_ivt = *(u32 *)(CONFIG_SYS_LOAD_ADDR - 0xC00); + + if (nor_ivt == 0x402000d1) + return BOOT_DEVICE_MMC1; + return BOOT_DEVICE_NOR; } #endif diff --git a/configs/imxrt1050-evk_defconfig b/configs/imxrt1050-evk_defconfig index ca3f810e02..eaf46bbeb6 100644 --- a/configs/imxrt1050-evk_defconfig +++ b/configs/imxrt1050-evk_defconfig @@ -12,15 +12,16 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_OFFSET=0x80000 CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="imxrt1050-evk" -CONFIG_SPL_TEXT_BASE=0x20209000 +CONFIG_SPL_TEXT_BASE=0x20002000 CONFIG_TARGET_IMXRT1050_EVK=y CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y CONFIG_SPL_SIZE_LIMIT=0x20000 CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y -CONFIG_SYS_LOAD_ADDR=0x20209000 +CONFIG_SYS_LOAD_ADDR=0x20002000 CONFIG_SD_BOOT=y +CONFIG_SPI_BOOT=y # CONFIG_USE_BOOTCOMMAND is not set CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y # CONFIG_DISPLAY_CPUINFO is not set @@ -30,6 +31,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x100 # CONFIG_SPL_CRC32 is not set +CONFIG_SPL_NOR_SUPPORT=y # CONFIG_BOOTM_NETBSD is not set # CONFIG_BOOTM_PLAN9 is not set # CONFIG_BOOTM_RTEMS is not set diff --git a/include/configs/imxrt1050-evk.h b/include/configs/imxrt1050-evk.h index 99d25c1e6e..f9b80e7b2b 100644 --- a/include/configs/imxrt1050-evk.h +++ b/include/configs/imxrt1050-evk.h @@ -9,7 +9,7 @@ #include -#define CONFIG_SYS_INIT_SP_ADDR 0x20280000 +#define CONFIG_SYS_INIT_SP_ADDR 0x20020000 #define CONFIG_SYS_FSL_ERRATUM_ESDHC135 1 #define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 1 @@ -40,6 +40,8 @@ #define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR #define CONFIG_SYS_SPL_LEN 0x00008000 #define CONFIG_SYS_UBOOT_START 0x800023FD +#define CONFIG_SYS_UBOOT_BASE 0x60010000 +#define CONFIG_SYS_FDT_BASE 0x6008C000 #endif /* For SPL ends */ -- 2.34.1