From patchwork Tue Aug 24 09:44:19 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: 501796 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2981128jab; Tue, 24 Aug 2021 02:44:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUaV5mbJio64BpylJwwfBbb13jYDvsaK6/9UnKe6J9vq2XVpFplTnfBq3ZxKcWWSJEgRw1 X-Received: by 2002:a17:906:7154:: with SMTP id z20mr19457094ejj.547.1629798290321; Tue, 24 Aug 2021 02:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629798290; cv=none; d=google.com; s=arc-20160816; b=HXfjm3byZ7OTstxuC0KiRzQtqH+N2CT+Qy2vyItz+BOLQE/rAzhOpbO/WZDRipV1Y/ 1AIF7DEwoJMEelQ6ZzFCMxc8W5rdonP4nFSXGWmBfKOdbSUPiOLqyE0+obrbHdKf05ZY J41wKkVFzuNDNlyxTlGGo9Cv3HMdckJ3eAGYxjEePAzQi0q7/kXrgbWALUL/0FDePwLH 5jFyRcYgZzf2qucUqduMju+VqzffPRCzATvtCQltqMBG+W1dUKbotMTHxLTCit1iVZtG WMEaJ37WOL0dhf7WqmQfLqVlUFCoEfg4DkLSFsNQ6ySXydsRT0ajdjAenMA0xwNNGgyY hTcg== 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=Ern7WI8XVVZfEK8jbSrVCp8Vv7jAYOqP3aTaj7p+PN8=; b=wYeESrjBeZBlHhmUvhgItPVwXG6/S7mPNnbSLUn6QCxa5ynCi7AjOdDNmCn2bM7r71 MCwvRK1mAILxi4Qqz4v+ZfVg3YhBPxEeKWZoWFY9dCXLYZMWI25MHV1v00ZVfJZCe/tR rsmq8sU64P/6SyJSL+atdEZ65C8LcXxw4AfDVoa7x7pnMKrx2kGlmIKFjgzvQdJr2FeN sTFOKUwvzkLiXXQKosh4Z77yoaHnR/y8ECWG6i4aUHQRS+MpKmUMasOaf7CcH9choNSu lXsIbEtj8ezQyfgVMTKQzmTe/usqVhIpw6d6C9n/sfVYO7geEgwx2ZudvjHdjnlYr+Mz E4lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E5ceURrI; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id h15si17335574edb.263.2021.08.24.02.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 02:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E5ceURrI; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 031DE82CDE; Tue, 24 Aug 2021 11:44:45 +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="E5ceURrI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BDCAF82DBA; Tue, 24 Aug 2021 11:44:35 +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=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 1739A82DB0 for ; Tue, 24 Aug 2021 11:44:30 +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-x1029.google.com with SMTP id j10-20020a17090a94ca00b00181f17b7ef7so1401359pjw.2 for ; Tue, 24 Aug 2021 02:44:29 -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=Ern7WI8XVVZfEK8jbSrVCp8Vv7jAYOqP3aTaj7p+PN8=; b=E5ceURrIuSf87hBS0I6uMbK0IsKskIv4l4JbiTrfYO+zOp2UpSJkjRlCg+1kkbEFgY moxM1Xvl/pkz8EgceJNgNDN8O808CqYOKbncbIJGEecqzqxDHY54cRjmmhkOOW16xqPY ilallTnugT8oGVI5ZFH8TKhCst1jXEvwTZuVp3OE/jT6w0gxHKRlVNS5r2442OgsDttd BhTRjk2z52w6NLbDf9lc24XyLdqV4GspHbAzDHbQqhbxIXVL/xbMjcVzDwqiY95tbW59 Bga0tf6t1mDyaaVoYs0Isgx0DTZOHJYqhitYTe/9E1UoVsSQVCrCo/Ofbrz4X28Jtmoa eUiA== 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=Ern7WI8XVVZfEK8jbSrVCp8Vv7jAYOqP3aTaj7p+PN8=; b=uBv9usMmeix7xw2SpCtxVnDv4t3paDcecJDWBgl51y6pQE2HDIZwbhf4UDz1DtV+L4 33cdvCfJRRWII6/efYPLqNnGWdHjXBCeLDkOqR/hvYlYsSkfe3jOjAvWzZ9M57gJoJGB +ZlD8zDRHA8njxmcqSVeTcqHHtpkFpwn0CSDvvJEICT9C54M3NSh2h/4TXcb1tb5B+h6 CKlKBRugCAjrb933xqK38culk+nZntdUK5zO3DemcSjhGMGnq7glNR2Rnv19D7b8vxaM yN9XG3FJRq8LJMPArB2tvhfEshjE3/lE7fZk9YHXBIsjZB0y98mInHbXZCKOnzzbYoAm ZwSQ== X-Gm-Message-State: AOAM531e+JlIR42hD6RQcXkWKW6Ag4+amU+IdlvUktqaZHw9EDX+PdE3 nhFVPZ1dxn4nwSZyOgN6HQlY5GLkyxWGdA== X-Received: by 2002:a17:902:6b49:b0:136:3f21:7a9 with SMTP id g9-20020a1709026b4900b001363f2107a9mr2276457plt.81.1629798268271; Tue, 24 Aug 2021 02:44:28 -0700 (PDT) Received: from localhost (host-111-184-129-17.dynamic.kbtelecom.net. [111.184.129.17]) by smtp.gmail.com with ESMTPSA id e6sm5045578pfj.183.2021.08.24.02.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 02:44:27 -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 v2 1/1] arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size Date: Tue, 24 Aug 2021 17:44:19 +0800 Message-Id: <20210824094419.2199534-2-grandpaul@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210824094419.2199534-1-grandpaul@gmail.com> References: <20210824094419.2199534-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 --- v2: use hang() instead of while(1) --- .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.32.0 Reviewed-by: Fabio Estevam 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..cd15410978 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 @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -14,8 +15,32 @@ #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); + hang(); + break; + }; + + return 0; +} + static int setup_fec(void) { if (IS_ENABLED(CONFIG_FEC_MXC)) {