From patchwork Tue Jun 11 14:50:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 462 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 720463F08F for ; Tue, 11 Jun 2019 16:52:37 +0200 (CEST) Received: by mail-pg1-f197.google.com with SMTP id a21sf9254823pgh.11 for ; Tue, 11 Jun 2019 07:52:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560264756; cv=pass; d=google.com; s=arc-20160816; b=Ujv1L7xtZNDVTo1v4OXcnbdiIEhKHZ4h5sOhWCVQXt+AuuzWZiZnoBvybeF2nKJBrX sk4f8+Nd2dLrMbz/bZGp9ekoa5cF+mYus+Lwx3DvstvlWXIlGiUfHBSlhUvHbR+Pey+a K4vAPbmWfN/yFNtaH8slBcwQW9wKXuyr2QdGy1jbActqb45F4lxkiH3WsCiY8g9Dp2Ov ZZox/UqDIMR68UCjWNU5XEvsPZryGvR9f98AP8L0hKqsNTBnskl9sxx1gWomx9IGF2q+ hdhsKjKk22bZTVRQAB6uJ4SMnbtp43pLPE/8YyQfPR6jPJ7ZBvoOqK3C8JIRHcEcwSln kDOA== 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=/eBT5vpW/POMKkFlFJhMV83j//BLA7j6g+6bAYDmwqA=; b=qit2Su7FhxHPJapPRBQkzMhx6+XNF1/zlAc97v0DLdh4l+0z9QZxFiuSpscohlL6rG dDbPv8oeFcvHATnuc55oYaVuLjOnAUK/o2GUptg5ZvAbza3UUMP4y3nofvn+q0yVudOc T5jeN2aT1bOS2DUChbgpBJVrM832DAYOjOKIRh2Y67SaxDC/6y3OxB01ntuh1cxeFe9q xIQnp6PlokOPALSwTmQI9gHxDXw+B6EIhDkGqrOKByEiZFVMQP7mIUdaXAGAeF67+TpH Vl/izI9wXQ5+f97/ZCZg+26wLUCGTMlXtVjkNk5b2LUDOAueAxaZQCSIApC360nScN3u mGOA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=j7GcbOlC; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 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=/eBT5vpW/POMKkFlFJhMV83j//BLA7j6g+6bAYDmwqA=; b=X4ZE8rsKvP3E4pK6FaZSpsbKrDEU3YIVsRHCUVgDLAlFsnS2IK2+6tEZvL6uIlVcS7 3yOhxaak6pMDNJaN8s1+4+2dv09W48GuiAl12HCgZOyz4hXILZ/H1ycwgN0ZGSiZe5dh iG6aut/lBkl1Z0KnFy34YJi0/rCCK/xJZWvbY= 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=/eBT5vpW/POMKkFlFJhMV83j//BLA7j6g+6bAYDmwqA=; b=Oh1Er6PGGwiEbT7Bv0JX4u6hOIzfBsHu3S8GHgzYkGfKKa0VVZ8/W3L9sj/FNVxpHX 3WlRcY1sxmd0lXFlcLntM7CCTGQeM4JICYHJZU3wCYv04Ib5NvBpjj51ptn7oExh9RL0 vXJtmCE8AXl7jyxYrW05H/z1A5KN90iHDrV011p2AiEJ10msUoQYymWOC/SJBN5xMmRS kjAIEWR1QHclT9wjLVotaKhJPkrM73RsxcJSxWn4HJZvGlhizt4lj80+wV57TF4GDs05 D+UjVqAgbz4pGuvVAEaxGMSINmi3usia2Yb3IkTVxPnnbNFXzK5hiOql+af5z2VTyU1/ tUgw== X-Gm-Message-State: APjAAAXZ0+zngEaZ6MA4ovKpqjlbwT9yhx4r7Qw2aXAYGXuwDQwJxG9B 4azBMECqQP3znin1jlGiQH2YGefB X-Google-Smtp-Source: APXvYqxHH9Rh5HSwKjVOVlpyglazxnBDnBMaIlwulKoKL/Kg+qWRiVaYI3uwf9bYUMgu3KY3a74THw== X-Received: by 2002:a17:90a:9385:: with SMTP id q5mr26787953pjo.126.1560264756255; Tue, 11 Jun 2019 07:52:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:35c5:: with SMTP id r63ls864067pjb.0.gmail; Tue, 11 Jun 2019 07:52:35 -0700 (PDT) X-Received: by 2002:a17:90a:23ce:: with SMTP id g72mr27461579pje.77.1560264755792; Tue, 11 Jun 2019 07:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560264755; cv=none; d=google.com; s=arc-20160816; b=JtANYKaXhUQdqPTn5ho7CIxBzDs6MxmufT5d1QypVC0bgweK/g0Ikp8zWvHB40X1FE WhLd+zWeS62muLI8zPxOakTly/LitbS430oxovGSMkrRarDfnAox+tCBXYm4heSHX9xu bgR9Nv0vUU9X4PWIVgjmbPVWjGPbLkF2xBCoU4Bfgv3tFA81pTSttwJcswd1HxepswEh cB+03jH56wNwbkbIyuFq4oSpE+ux+ADcUc4LOYNDoJ/V4Nem4DDYW8AL7V9hJr8/rGsD 8jTQAdE2c/i6rz0ufX9JLoU5+tfeDUg3iSdSuTHXUFpudX0uzjXzSvcha7Guz39j5S9b NrUw== 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=k8hPse+eLaJV7/L49iRCuWgFHm8RJPmX47usVOlkDFw=; b=zARs9CLMSWa4xK2PGj4amA0S0DbQUsdNQaJ1LF0nzGWLVpP2RWUIY7g+4wHZVovm63 +TXtMLi6b+9OM4s64VSaHSf5aBmVCagh8bSN9SB919CqT9aC0ybskdam42Xbqo6Mn4jL yLO2diX6uYN5rdul8cWWPbA1CPd4OVs0zlsoCskqHKhpphzFziK8KOpZaIZr3Gs2Al/l WHvoAqHeShJKM1Ma0MJcYYPR+qxRoyjn3xJDz0hlC5wklTwLM/duf1y0d2zKLYpTwrgt 5yIiNVdkDBKVRuHyk1EQ0HDPjPhhlBGLgG00RWGB3PF2JOB9ocsTwoOCZSUUHT8RWz5z 7ONQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=j7GcbOlC; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id c138sor13386381pfc.38.2019.06.11.07.52.35 for (Google Transport Security); Tue, 11 Jun 2019 07:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:aa7:90d3:: with SMTP id k19mr78440161pfk.1.1560264755423; Tue, 11 Jun 2019 07:52:35 -0700 (PDT) Received: from localhost.localdomain ([115.97.180.18]) by smtp.gmail.com with ESMTPSA id e9sm16206208pfn.154.2019.06.11.07.52.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 07:52:34 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Cc: gajjar04akash@gmail.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 11/92] ram: rk3399: Add channel number encoder macro Date: Tue, 11 Jun 2019 20:20:14 +0530 Message-Id: <20190611145135.21399-12-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190611145135.21399-1-jagan@amarulasolutions.com> References: <20190611145135.21399-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=j7GcbOlC; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 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 channel number. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen --- arch/arm/include/asm/arch-rockchip/sdram_common.h | 1 + drivers/ram/rockchip/sdram_rk3399.c | 3 +-- 2 files changed, 2 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 83936d3679..38a8bb8642 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -35,6 +35,7 @@ #define SYS_REG_ROW_3_4_MASK 1 #define SYS_REG_CHINFO_SHIFT(ch) (28 + (ch)) #define SYS_REG_ENC_DDRTYPE(n) ((n) << 13) +#define SYS_REG_ENC_NUM_CH(n) (((n) - 1) << 12) #define SYS_REG_RANK_SHIFT(ch) (11 + (ch) * 16) #define SYS_REG_RANK_MASK 1 #define SYS_REG_COL_SHIFT(ch) (9 + (ch) * 16) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 69c8d53314..3d2447a24e 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1009,8 +1009,7 @@ static void dram_all_config(struct dram_info *dram, unsigned int channel, idx; sys_reg |= SYS_REG_ENC_DDRTYPE(sdram_params->base.dramtype); - sys_reg |= (sdram_params->base.num_channels - 1) - << SYS_REG_NUM_CH_SHIFT; + sys_reg |= SYS_REG_ENC_NUM_CH(sdram_params->base.num_channels); for (channel = 0, idx = 0; (idx < sdram_params->base.num_channels) && (channel < 2); channel++) {