Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFEBEC4338F for ; Mon, 23 Aug 2021 02:50:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 219C06135D for ; Mon, 23 Aug 2021 02:50:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 219C06135D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 34E6F82EBB; Mon, 23 Aug 2021 04:50:12 +0200 (CEST) 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="cVa+UdQV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D25182EEC; Mon, 23 Aug 2021 04:50:07 +0200 (CEST) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 0D52082E8E for ; Mon, 23 Aug 2021 04:50:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=grandpaul@gmail.com Received: by mail-pj1-x1030.google.com with SMTP id ml14-20020a17090b360e00b0018de39d40bcso884469pjb.1 for ; Sun, 22 Aug 2021 19:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SOZxdLXxJE7STSmMMbNVbnULv2nx/vTF7r0hj9mdSkc=; b=cVa+UdQVn+5fjiK4sitaF7RSih9rne47RufA8O9CJp8pbNtVr3qMDHEDUc07cOlw8v hplauutaahGSNq0spjIim1497STlpmcR7Uk/gbv0KklNJQ+c/m0jOSvcd3aeyEp95XyB Os+QAcvL6OalPFo2/s7oc9jncfoP/uKpfvbkME4mklSiTJROaVdNllsTLwLEFlTAMnLt tpY8bjJia42DKr6g3R0HhigtoPhKVOX3uU+pWY77og9Qu2ROZ7/ckDdAapCRwHpCnu/S LaqNhg+Xz1PyvdUi7gZMIR1KZMMZ9HPSYFKc5LLwxwceRyyjMKyhLEuU1WlAZ7blj8I5 t1Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SOZxdLXxJE7STSmMMbNVbnULv2nx/vTF7r0hj9mdSkc=; b=C80X/sF40J5zPVdO0VOGa9tgQ9IBAaQkdMwMglOEjPsnbwitO5wGXyaHk904Jz/FHz OPidP7tIH+fb5PzQn2KtI+wCmcnzxGifkZ+ryQWqWpSXFp16u+JOjT4AUE2kDD2mukSp Ayb8NsVOF0VSNO6AgK3OajYlb1ng/g/xsN3kJMG1RXtNRJVnj3xdvWMdal5gpDsBbLQP LFun1PODkkNjHNUpSB961bUisp4U6WAEG+exkktLOgFY84tewivSWRNyx1pUrwH1jxF7 MB/WLjalQ5M+zhd3OrRLmuG6zRf4MYOLnNkqZxHrRTjS6bD7FCGFwavxiq3CkYBJIIEJ wAUg== X-Gm-Message-State: AOAM530YV/kYQt19T8w6Z5Ne9zQlNyJThHFqaEkOXIpFtG6ZIuLLBXbI Ovr3bLjEWUCjHGepvGBAljDIeMpr+m8= X-Google-Smtp-Source: ABdhPJwe/0w/fmF649YOFyZPkT3VfHMtH53e0P3dKYAMQDeNxExpWV5A9TBXdHykqw6fmG+L6AGS9A== X-Received: by 2002:a17:90a:4584:: with SMTP id v4mr17559485pjg.169.1629686998242; Sun, 22 Aug 2021 19:49:58 -0700 (PDT) Received: from localhost (host-111-184-129-17.dynamic.kbtelecom.net. [111.184.129.17]) by smtp.gmail.com with ESMTPSA id g14sm14003425pfr.31.2021.08.22.19.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Aug 2021 19:49:57 -0700 (PDT) From: Ying-Chun Liu To: u-boot@lists.denx.de Cc: "Ying-Chun Liu (PaulLiu)" , Fabio Estevam , Frieder Schrempf , uboot-imx Subject: [PATCH 1/1] arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size Date: Mon, 23 Aug 2021 10:49:52 +0800 Message-Id: <20210823024952.2047237-2-grandpaul@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210823024952.2047237-1-grandpaul@gmail.com> References: <20210823024952.2047237-1-grandpaul@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean From: "Ying-Chun Liu (PaulLiu)" When purchasing imx8mm-cl-iot-gate it is able to customize the memory size. It could be 1GB, 2GB and 4GB. We implement board_phys_sdram_size() to detect the memory size for usage. Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Fabio Estevam Cc: Frieder Schrempf Cc: uboot-imx --- .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 25 +++++++++++++++++++ include/configs/imx8mm-cl-iot-gate.h | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c index eabcc842a4..01c6011b75 100644 --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c @@ -14,8 +14,33 @@ #include #include +#include "ddr/ddr.h" + DECLARE_GLOBAL_DATA_PTR; +int board_phys_sdram_size(phys_size_t *size) +{ + struct lpddr4_tcm_desc *lpddr4_tcm_desc = + (struct lpddr4_tcm_desc *)TCM_DATA_CFG; + + switch (lpddr4_tcm_desc->size) { + case 4096: + case 2048: + case 1024: + *size = (1L << 20) * lpddr4_tcm_desc->size; + break; + default: + printf("%s: DRAM size %uM is not supported\n", + __func__, + lpddr4_tcm_desc->size); + while (1) + ; + break; + }; + + return 0; +} + static int setup_fec(void) { if (IS_ENABLED(CONFIG_FEC_MXC)) { diff --git a/include/configs/imx8mm-cl-iot-gate.h b/include/configs/imx8mm-cl-iot-gate.h index faeee2178c..1e835563d6 100644 --- a/include/configs/imx8mm-cl-iot-gate.h +++ b/include/configs/imx8mm-cl-iot-gate.h @@ -158,7 +158,7 @@ #define CONFIG_SYS_SDRAM_BASE 0x40000000 #define PHYS_SDRAM 0x40000000 -#define PHYS_SDRAM_SIZE 0x80000000 /* 2GB DDR */ +#define PHYS_SDRAM_SIZE 0x40000000 /* 1GB DDR */ #define CONFIG_MXC_UART_BASE UART3_BASE_ADDR -- 2.32.0