From patchwork Mon Aug 23 02:49:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying-Chun Liu X-Patchwork-Id: 501537 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1791370jab; Sun, 22 Aug 2021 19:50:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/qJUU814o9sMLF7Z4/6zK3dH5wfP3UNF95Sllk5+vBMRiVFrykry2jIvQBtdcr+q6gEb6 X-Received: by 2002:a17:906:3bc3:: with SMTP id v3mr33216652ejf.482.1629687019959; Sun, 22 Aug 2021 19:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629687019; cv=none; d=google.com; s=arc-20160816; b=N8ZNGE2BOoczMtnFE8gyTHWqTcdM/GnQs8InIxe8Q325edqMp4NJUutwPhE0ot/Lmy POtx6+1Dz0+e71O0jVL0h7avmUGjYq86JGvxTVokVHtZJt2JG+N8/ySjwtPxUIM1Fr5K /cRkCa+l5y0BiKMtXQ3yXT+4S7wAT5W7Yg+NBY9f8EW+WWlgKDx6sLrzT5T49L9qTeRe wY6VNcoOvDetdXZQdFxbq2lYfFoQ3cFcjM65wX/AHBukil6fyMwct2UNFK45UJjO/+DL 6UohYCVhemu8i1nW+JyyM0JHUgJDntNLta7zofak90+5zUA2cCCTAKHJzQ40wd9NsXZw 9+pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SOZxdLXxJE7STSmMMbNVbnULv2nx/vTF7r0hj9mdSkc=; b=YCpuHQ9key24Vs2yMK0Q/hJ7hd4VFww5jrodutFPhiXelfqpBfD6miF0rjLa5EDE0b WIk8OvFephYL5ETcNPWB+o+0g9pUl7ZXJRwIrhlvKQk1Q1QxxLwRiSAQzPWdmTdZgAjr SJVbtP1wiWW9iRRs2UzRJVT8HARjatbkJ9SE26rOsHs02uBLhsYqlJmLraxCpW764Yhb mo8T1CNexfq9ieFrSGT4/jXzA5kHzLyHV3/z78i2lVDmAQqfKNhZDz+n5w15jRzLJADg V4ZWKLeoYsnRaZnNv/w+E81rXH0vkCcdOVfv7BKAeErwIh/c7pZ6zO7VCIxOUKkE0ZuD TZ1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cVa+UdQV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id j4si12891303eje.704.2021.08.22.19.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Aug 2021 19:50:19 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cVa+UdQV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 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-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 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(-) -- 2.32.0 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