From patchwork Tue Jul 16 11:56:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 754 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 574A13F08F for ; Tue, 16 Jul 2019 13:58:16 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id g21sf12219195pfb.13 for ; Tue, 16 Jul 2019 04:58:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563278295; cv=pass; d=google.com; s=arc-20160816; b=pzQ81JOVyZHyi3ZOQHPGURsq+FtH0VXf4Pa8WNFmFiWbQPMWeI3DEuhxk9U9o0Vydv IPH6k2bvDOwXyEfEFnLQUzaiYlM0AYqDkAT2LjfChA8U0XAGLCNQgBgX9cZvaRnrtrWV crMmehV0WVR2Q+SbYYb03LdoHVQ6R6+W3MgoZhd5dNMaeEG0IIFJM3SMOheXTWb2SpLG FGeDsbVsuxSqG0dqlFpjJmdSIqBrq2+eJGf1I9muVPnOEbChKktYId4iWrnWOL3FTIvX ENNocq0rg3mMaow2uBA6gLHv2Dy2IoGM73zr96cOrdv6iWG7gDIF5hidJux+vhpDhwU2 MJyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=q0PCbqvjUrLOYkmo27J7A13X4EmtpiPHr7wm5UXUROM=; b=UKMh3i7fg6NJ6aTcgOr36RcJ20B7wXiCw0rxl2SdYV8OP1TcST/ELJ/WjM/ntEvyM/ 3UP5/6iTeyzDdLqZr9QNRIdgh4t0lFnZKmXHZRS1ezKnAGCVIC+mmyYv8cror5Iyew3t kbsLcoRKyL5oq9j3hKrN+O0iMuD8TUfp+2yZYaiP61S7QP7pd+JD9QQXvRomc7l5g2gH r/DqSCepttLp+7QB9s6/r8yHkQtjTWud1sk+dNtXMwDZBPjAhYoO0BuynxI8VbFHMtcP SFRShs6LsfxFE/mQZCtOPCG4E1w2AHrVju08RGTocFIqylrW1MZ/f2+jOsXl3fkNfEwU MG8Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kfFDM4CU; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=q0PCbqvjUrLOYkmo27J7A13X4EmtpiPHr7wm5UXUROM=; b=cDpPsYbylgp0wB4oAOPzdH0XFIsYy4ZADHBMbNHio8dElEH16x5T+Y1YQgtceWQh97 WNTSdMubnIaxOcGkN0ib4q93h0SZQtBm/3rR7sHMenhTK2gg9QbvHP9Jc/J2B4imAWtO +MImyIUUVlcAL5+Qm5T+4QlXKAKg9p2vo2hCE= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=q0PCbqvjUrLOYkmo27J7A13X4EmtpiPHr7wm5UXUROM=; b=aGB4sgtqL60dwp1SjRUl6MP/6uTevaKd3qRv/e+t6Y7oTt3L3aYdLkneutUSD5ipDO B+TP7fyVlK0D52Yk+uT3OPU/D90oST3Z3uIz1sRcj4VZ8WPmhORbcCy2tWu5kuH+3pSP JfLLh8uOt69KilM3gy3I8kFgfsaGbZAjT0wbgZWc0MZ/ukIJ9KVigPhpXaCOuerd8FCk biGZqQuWTj/mo9pSuC5oJiqYonjtFaVMrHpl82Y0hyk2b4gZBoB6ojGU1e5WPpAUJdkg f+oYWPy29T/j3vDt3pBEbrc//5C1duTZHPE0ZmOoNx98/lOQWrprQhV112IP3WZr/V+n BMEQ== X-Gm-Message-State: APjAAAV58TIMSg6D//Ua7Kcg9n/rJlChTmJgkp4Q6SvEmEu38uudPb+J QLu1AYpdLqSFTeDVGIkhhiC2jbRV X-Google-Smtp-Source: APXvYqwEMIajlDLKSP7GkVPU8jXh0Dqn5LyxKn60CMasHwfddEgeJJ1fw431K1QLWNnHfdbDKw6oFw== X-Received: by 2002:a65:6081:: with SMTP id t1mr33497530pgu.9.1563278295063; Tue, 16 Jul 2019 04:58:15 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:9895:: with SMTP id s21ls4340242plp.3.gmail; Tue, 16 Jul 2019 04:58:14 -0700 (PDT) X-Received: by 2002:a17:902:7448:: with SMTP id e8mr34829040plt.85.1563278294780; Tue, 16 Jul 2019 04:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563278294; cv=none; d=google.com; s=arc-20160816; b=BuroH4Pikys+77GJBoEJ9Fzo6dtyTLwxMEEB9o87rxHaHkvGkXHvEpHbia7Z566gU4 r0B5eHu4hY9rm0E9ODPLD9Qf0PQvEmVj40SAWcvU0NuWpb0GsbbWKxdYaiXCqfBzCCeJ 6lHOWlhI95mddsnYI7l+Xb1+jQsf5/a3/mHVox9mU/rXGub/DGFPW8WxHHKoNn/d/zdw k8YKi0FfIpnCbmtX6l4b+oc23VTxr9BV4so26AyXj+WIjDO0iKRPvrSijWYUwVBJhfkv Lb8RcwokxcJY9V4lcOY7+4DXazmIAMGFvgfhtopMUrBuDZbyzeY7buINQVhdULH4DYMH YshA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=z3Lk8qTZYKqG9EuBV9bI00XJEHWQHcKKp+DGT0GYOXk=; b=NmarUBNSS3M45Otp8UgWneUR4dl2upZXf0I4lXEqVSqQAAdy8gPVNuDBytJC84eG11 YyKXw5VCF0bQhUC7qADIsiewxXD6VERC3CA7E9g/mCA8E1nDJ1nEdWkQiOsT0Ks/JhqB 6qAZ5Lgp38HInRDKPdGjnYGqsNeo/c3Vk9eRwWbuVGNfsW707RqMAwuDTq79iLHJrKRP xNSTbY8af6SJty1BauYsxsN/07xZT6EGIQ6EJbK0V778aZhYL0mdPIGNP5TNyptgna+t cgNhI1ZZuBJS98DooofA5xE2Gf30tqkO1m1oF9uLcsNJTjd8CnoijQuzfbYu9ah2/+NR 7PjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kfFDM4CU; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o2sor25037966pjp.26.2019.07.16.04.58.14 for (Google Transport Security); Tue, 16 Jul 2019 04:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:90a:380d:: with SMTP id w13mr35059640pjb.138.1563278294439; Tue, 16 Jul 2019 04:58:14 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id z24sm36269566pfr.51.2019.07.16.04.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 04:58:14 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Cc: Manivannan Sadhasivam , gajjar04akash@gmail.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v3 05/57] ram: rk3399: Add rank enc macro Date: Tue, 16 Jul 2019 17:26:53 +0530 Message-Id: <20190716115745.12585-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190716115745.12585-1-jagan@amarulasolutions.com> References: <20190716115745.12585-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kfFDM4CU; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add simplified and meaningful macro for rank. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- arch/arm/include/asm/arch-rockchip/sdram_common.h | 2 ++ drivers/ram/rockchip/sdram_rk3399.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index 2d0be920d9..db9e30126f 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -79,6 +79,8 @@ struct sdram_base_params { SYS_REG_NUM_CH_SHIFT) #define SYS_REG_RANK_SHIFT(ch) (11 + (ch) * 16) #define SYS_REG_RANK_MASK 1 +#define SYS_REG_ENC_RANK(n, ch) (((n) - SYS_REG_RANK_MASK) << \ + SYS_REG_RANK_SHIFT(ch)) #define SYS_REG_COL_SHIFT(ch) (9 + (ch) * 16) #define SYS_REG_COL_MASK 3 #define SYS_REG_BK_SHIFT(ch) (8 + (ch) * 16) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 874e896369..c2390a771c 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1091,8 +1091,7 @@ static void dram_all_config(struct dram_info *dram, idx++; sys_reg |= SYS_REG_ENC_ROW_3_4(info->cap_info.row_3_4, channel); sys_reg |= SYS_REG_ENC_CHINFO(channel); - sys_reg |= (info->cap_info.rank - 1) << - SYS_REG_RANK_SHIFT(channel); + sys_reg |= SYS_REG_ENC_RANK(info->cap_info.rank, channel); sys_reg |= (info->cap_info.col - 9) << SYS_REG_COL_SHIFT(channel); sys_reg |= info->cap_info.bk == 3 ? 0 : 1 <<