From patchwork Mon Jun 17 07:31:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10998079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95ED176 for ; Mon, 17 Jun 2019 07:37:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84641284B3 for ; Mon, 17 Jun 2019 07:37:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78E1328861; Mon, 17 Jun 2019 07:37:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 274B0284B3 for ; Mon, 17 Jun 2019 07:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vzr4lbjuwgBuLNJWQSdD2cBU+AsKx1LC6Y5F5Nv82r0=; b=OukLhNJUWOafrE pLJdZUxlI4ClOtdq116hASD1BXJe5CQEB81KVa5nzy6QaVkOhuQFDu8giwUll6LP9VuRRBa5hSzjp MzIFXQoCYEZXtSUoW/kpETl7MRZcTUd8VaP+yUa7GsG+R33qu/xnxdIo+6fTGCm5kq150/X7HtpjK XmQVinRUzTfrxKKG+w7ss+zHwFR6duQzmmPjByG5k4hEl4+jKfFiY29hOsMolTkNQQf3pySx1u44L u0uVA6WjrdO6y1HLHgF+RVlk4GMPIAk67MkSjjxnUjXlZCBX/rzA95WkLmK1qMDy3W4oXAr7vHvCO c6GLwDsbTWCbSB7Pps9Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hcmCN-0005Wp-Qt; Mon, 17 Jun 2019 07:37:03 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hcmCL-0005UR-9q for linux-rockchip@lists.infradead.org; Mon, 17 Jun 2019 07:37:02 +0000 Received: by mail-pf1-x443.google.com with SMTP id 19so5194719pfa.4 for ; Mon, 17 Jun 2019 00:37:01 -0700 (PDT) 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:content-transfer-encoding; bh=8HB5WFYTdd+2Tu6qdgodEldYX+2xCcnRKLddeyfP/Bc=; b=p+blBiUm4wlnHLcoX7/+DTcSZ88Po/xgSeiMH+bqDkTDuTdyzYU4v68ls8UHSnc5OM e5Oz5cyqSuS5De5YaZt12XXaIs04cJBNwJFADgx1mk5fYyl47eIKTRJpdO7M1Mzq5iti HMffP4Uy+X8kkakKwCKlugaj63bcyliOsGXHY= 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=8HB5WFYTdd+2Tu6qdgodEldYX+2xCcnRKLddeyfP/Bc=; b=Q6jrggpWKgVQZ99Pt6M+eFLk2+Ol3eNa3d4ryan5HjKrG2Ig/XpwTtbn8x99DO2pkN zFGgqt5rjXDguJ41iK+A0JAOCXgeL8nRgQiVpWnJ93uIwv+JD7at/PBy6e0Obo0Hg1Yn QrsIIA9LQjNG2ouWGDrTIOm2XrpnhP4IvWXMuoPyorhs8Fj4hKF++v9LVOgJPWtNP0WU oAMbhd9kLHoHgXxlduYD2763lPaozJkJCUJG7/Op7thzOIIamg6/LRF5bO8QJ4On2bri +OzVpD7X9egWSNx7l/dOJMxeYWj4jF1QNlierripJMeoMW6XDZs/00QNEgoAWrYQc9HL uM7A== X-Gm-Message-State: APjAAAXXRbCjBQoACtkpQDSWtOtNXBsUwhsBSZ6VT37+4hhYEnJ76vrJ LpmgWpnhKuWti8DC41E4dATqiA== X-Google-Smtp-Source: APXvYqzY8bwFrSCPZw6ZBTUghn63BF3FydJ7WFWr55XAkmW80bTEz7XOqHCQ8KvuboRmRk4a+l+REA== X-Received: by 2002:a63:68c5:: with SMTP id d188mr48892444pgc.429.1560757020730; Mon, 17 Jun 2019 00:37:00 -0700 (PDT) Received: from localhost.localdomain ([49.206.203.245]) by smtp.gmail.com with ESMTPSA id m41sm15205998pje.18.2019.06.17.00.36.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 00:37:00 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v2 12/99] ram: rk3399: Add channel number encoder macro Date: Mon, 17 Jun 2019 13:01:25 +0530 Message-Id: <20190617073252.27810-13-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190617073252.27810-1-jagan@amarulasolutions.com> References: <20190617073252.27810-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190617_003701_443048_9FD11DBF X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 2 ++ drivers/ram/rockchip/sdram_rk3399.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index ce1b62982c..a565f8d045 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -35,6 +35,8 @@ #define SYS_REG_ROW_3_4_MASK 1 #define SYS_REG_CHINFO_SHIFT(ch) (28 + (ch)) #define SYS_REG_ENC_DDRTYPE(n) ((n) << SYS_REG_DDRTYPE_SHIFT) +#define SYS_REG_ENC_NUM_CH(n) (((n) - SYS_REG_NUM_CH_MASK) << \ + SYS_REG_NUM_CH_SHIFT) #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 28178f4ee9..ad2d03729d 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1008,7 +1008,7 @@ static void dram_all_config(struct dram_info *dram, unsigned int channel, idx; sys_reg |= SYS_REG_ENC_DDRTYPE(params->base.dramtype); - sys_reg |= (params->base.num_channels - 1) << SYS_REG_NUM_CH_SHIFT; + sys_reg |= SYS_REG_ENC_NUM_CH(params->base.num_channels); for (channel = 0, idx = 0; (idx < params->base.num_channels) && (channel < 2);