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 3E1E3C77B75 for ; Tue, 16 May 2023 15:06:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EFAC485D52; Tue, 16 May 2023 17:06:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com header.b="kyizhVH8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B841860CB; Tue, 16 May 2023 17:06:13 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E311C846B8 for ; Tue, 16 May 2023 17:06:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eugen.hristev@collabora.com Received: from [192.168.18.121] (unknown [46.8.172.197]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id 22DEF660298C; Tue, 16 May 2023 16:06:10 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1684249570; bh=QCvSweDjTjRxWsvb8Lx46PUX7zXrN/3lLvfgA8cymlY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=kyizhVH8iftAc5dTVNqe96J1m77IqZQpv6KZ1yDRvJcEO6bbF6o1NzKUisIunPXw0 ptYhl6+n+N+baqRqaChHf0s0pnF9k+yZhbSI6bZqw5ESRbTns3xF6Qn3uQMUGUpLen 0ntlbuKhDPHSY3mfux3T/xVuHO/2eIp/MGHAACrF25CWrofg0Nixt513nrP3bMvLgD JSqvKTdrRqCugMe0AEu++nny2QqMt4jV3aas+Q4XAiLlTww9hvwhUhUXLyP3GBlj88 jjcGdIGT6cJtVQ34UcXy923IgKysdKPPUWzblnyUlEKnlpAamJ8KWPmqm8K0crIgxA 3Q9ANdIkl8OMw== Message-ID: Date: Tue, 16 May 2023 18:06:07 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 13/14] rockchip: rk3588-rock-5b: Enable boot from SPI NOR flash Content-Language: en-US To: Kever Yang , Jonas Karlman , Simon Glass , Philipp Tomsich Cc: u-boot@lists.denx.de References: <20230422012309.402799-1-jonas@kwiboo.se> <20230422012309.402799-14-jonas@kwiboo.se> <26b8beb4-8350-c314-9517-cd1189e47712@rock-chips.com> From: Eugen Hristev In-Reply-To: <26b8beb4-8350-c314-9517-cd1189e47712@rock-chips.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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.8 at phobos.denx.de X-Virus-Status: Clean Hi Jonas, On 5/9/23 14:16, Kever Yang wrote: > > On 2023/4/22 09:23, Jonas Karlman wrote: >> Add sfc and flash node to device tree and config options to enable >> support for booting from SPI NOR flash on Radxa ROCK 5 Model B. >> >> Signed-off-by: Jonas Karlman > Reviewed-by: Kever Yang > > Thanks, > - Kever >> --- >>   arch/arm/dts/rk3588-rock-5b-u-boot.dtsi | 24 ++++++++++++++++++++++++ >>   arch/arm/dts/rk3588s-u-boot.dtsi        | 20 ++++++++++++++++++++ >>   arch/arm/mach-rockchip/rk3588/rk3588.c  |  1 + >>   configs/rock5b-rk3588_defconfig         | 10 ++++++++++ >>   4 files changed, 55 insertions(+) >> >> diff --git a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi >> b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi >> index 4bbc19058c90..b63dd40deb6d 100644 >> --- a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi >> +++ b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi >> @@ -11,6 +11,7 @@ >>   / { >>       aliases { >>           mmc1 = &sdmmc; >> +        spi0 = &sfc; >>       }; >>       chosen { >> @@ -43,6 +44,25 @@ >>       pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_data_strobe >> &emmc_rstnout>; >>   }; >> +&sfc { >> +    bootph-pre-ram; Any reason why the sfc and flash are pre-ram and the pins bootph-all ? >> +    u-boot,spl-sfc-no-dma; >> +    pinctrl-names = "default"; >> +    pinctrl-0 = <&fspim2_pins>; >> +    #address-cells = <1>; >> +    #size-cells = <0>; >> +    status = "okay"; >> + >> +    flash@0 { >> +        bootph-pre-ram; >> +        compatible = "jedec,spi-nor"; >> +        reg = <0>; >> +        spi-max-frequency = <24000000>; >> +        spi-rx-bus-width = <4>; >> +        spi-tx-bus-width = <1>; >> +    }; >> +}; >> + >>   &pinctrl { >>       bootph-all; >> @@ -69,6 +89,10 @@ >>       bootph-all; >>   }; >> +&fspim2_pins { >> +    bootph-all; >> +}; >> + >>   &sdmmc_bus4 { >>       bootph-all; >>   }; >> diff --git a/arch/arm/dts/rk3588s-u-boot.dtsi >> b/arch/arm/dts/rk3588s-u-boot.dtsi >> index cd7e6cb50ee2..d8a471a37fd1 100644 >> --- a/arch/arm/dts/rk3588s-u-boot.dtsi >> +++ b/arch/arm/dts/rk3588s-u-boot.dtsi >> @@ -104,6 +104,15 @@ >>           }; >>       }; >> +    sfc: spi@fe2b0000 { >> +        compatible = "rockchip,sfc"; >> +        reg = <0x0 0xfe2b0000 0x0 0x4000>; >> +        interrupts = ; >> +        clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>; >> +        clock-names = "clk_sfc", "hclk_sfc"; >> +        status = "disabled"; >> +    }; >> + >>       otp: nvmem@fecc0000 { >>           compatible = "rockchip,rk3588-otp"; >>           reg = <0x0 0xfecc0000 0x0 0x400>; >> @@ -164,3 +173,14 @@ >>   &ioc { >>       bootph-pre-ram; >>   }; >> + >> +#ifdef CONFIG_ROCKCHIP_SPI_IMAGE >> +&binman { >> +    simple-bin-spi { >> +        mkimage { >> +            args = "-n", CONFIG_SYS_SOC, "-T", "rksd"; >> +            offset = <0x8000>; What is this offset referring to ? >> +        }; >> +    }; >> +}; >> +#endif >> diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c >> b/arch/arm/mach-rockchip/rk3588/rk3588.c >> index 18e67b5ca9b2..0e85893e0096 100644 >> --- a/arch/arm/mach-rockchip/rk3588/rk3588.c >> +++ b/arch/arm/mach-rockchip/rk3588/rk3588.c >> @@ -41,6 +41,7 @@ const char * const boot_devices[BROM_LAST_BOOTSOURCE >> + 1] = { >>       [BROM_BOOTSOURCE_EMMC] = "/mmc@fe2e0000", >>       [BROM_BOOTSOURCE_SPINOR] = "/spi@fe2b0000/flash@0", >>       [BROM_BOOTSOURCE_SD] = "/mmc@fe2c0000", >> +    [6] = "/spi@fe2b0000/flash@0", Is this '6' meaning something in particular ? or just the next number in line ? >>   }; >>   static struct mm_region rk3588_mem_map[] = { >> diff --git a/configs/rock5b-rk3588_defconfig >> b/configs/rock5b-rk3588_defconfig >> index 2f0a74ee5559..e6a903853fb7 100644 >> --- a/configs/rock5b-rk3588_defconfig >> +++ b/configs/rock5b-rk3588_defconfig >> @@ -8,15 +8,20 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y >>   CONFIG_NR_DRAM_BANKS=2 >>   CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y >>   CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc00000 >> +CONFIG_SF_DEFAULT_SPEED=24000000 >> +CONFIG_SF_DEFAULT_MODE=0x2000 Any reason for changing the default mode ? >>   CONFIG_DEFAULT_DEVICE_TREE="rk3588-rock-5b" >>   CONFIG_ROCKCHIP_RK3588=y >>   CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y >> +CONFIG_ROCKCHIP_SPI_IMAGE=y >>   CONFIG_SPL_SERIAL=y >>   CONFIG_SPL_STACK_R_ADDR=0x600000 >>   CONFIG_TARGET_ROCK5B_RK3588=y >>   CONFIG_SPL_STACK=0x400000 >>   CONFIG_DEBUG_UART_BASE=0xFEB50000 >>   CONFIG_DEBUG_UART_CLOCK=24000000 >> +CONFIG_SPL_SPI_FLASH_SUPPORT=y >> +CONFIG_SPL_SPI=y >>   CONFIG_SYS_LOAD_ADDR=0xc00800 >>   CONFIG_DEBUG_UART=y >>   CONFIG_FIT=y >> @@ -35,6 +40,8 @@ CONFIG_SPL_BSS_MAX_SIZE=0x4000 >>   # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set >>   # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set >>   CONFIG_SPL_STACK_R=y >> +CONFIG_SPL_SPI_LOAD=y >> +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 I have a feeling the default is 0x80000, do you have any reason for the change to 0x60000 ? >>   CONFIG_SPL_ATF=y >>   CONFIG_CMD_GPIO=y >>   CONFIG_CMD_GPT=y >> @@ -59,6 +66,8 @@ CONFIG_MMC_SDHCI=y >>   CONFIG_MMC_SDHCI_SDMA=y >>   # CONFIG_SPL_MMC_SDHCI_SDMA is not set >>   CONFIG_MMC_SDHCI_ROCKCHIP=y >> +CONFIG_SPI_FLASH_MACRONIX=y >> +CONFIG_SPI_FLASH_XTX=y >>   CONFIG_ETH_DESIGNWARE=y >>   CONFIG_GMAC_ROCKCHIP=y >>   CONFIG_PHY_ROCKCHIP_INNO_USB2=y >> @@ -69,6 +78,7 @@ CONFIG_SPL_RAM=y >>   CONFIG_BAUDRATE=1500000 >>   CONFIG_DEBUG_UART_SHIFT=2 >>   CONFIG_SYS_NS16550_MEM32=y >> +CONFIG_ROCKCHIP_SFC=y >>   CONFIG_SYSRESET=y >>   CONFIG_USB=y >>   CONFIG_USB_EHCI_HCD=y