From patchwork Tue Jul 16 11:56:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 751 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 E844A3F08F for ; Tue, 16 Jul 2019 13:58:05 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id q14sf12247650pff.8 for ; Tue, 16 Jul 2019 04:58:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563278284; cv=pass; d=google.com; s=arc-20160816; b=dEgGIl0VB/phfhWUqAI6kHtIzBi7RhX2ICjR/OCDFVZrzH3P1OSN8RYVGLqd//Fnv3 aUbp9SlgFlGOE3lkKM4/UP4MOeEETZCs+GDmzv6u9NjyA3jnQWbaLs796DX4tWoswqgb jatJZGyHBD08CduIjBs615ejt5m77wMaYthDGUODEtuHrB19s/KlagU6mhsiGRuurHyu X+16piuzhsfcgTH/k2Z5fKxPwIdWS4hbB58W/2a0FtR/www7jDj6f1YGxQLmFNoWE9KE JedPl+ZQB4EOeYfqYjbcpJWszBkwowhjzw+XHSJ82rePZKmjXnFVDjQ7yMq2H+j/FjSH XZ3w== 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=BVgLA0d8XBpd7bokOkuqioYsSU5nu8dA87XtA3bv9uw=; b=KE8EBknvcofZfndL9ioUSWWHXhDz5x0/pvjauVEnyLMzmneoAOrQ1CfdaI4cMCcnEA D9IGaVn6X9UE4JrXUaegx7NkujAhOAt+206+SQdkY5JwfbyIIFcvKklOSSvksvLdoddF x/ruq+I/ICqwpJlBur+2ZLDFy6OicNL8qAyxC5N895DhIDxCxVvWiMX5+hxhQM4M7GJF S1xbgnt8v6te3/X1aMpjtWfIfZBo4aEflkrTuub8wlCPCKa3S1qEefkWlc75XYjMj3xu RrsdrAG89fg+gBDgZt4U0XU3sYB0kXt28liSSrOuixPjzhbDVzfnJc5zOSmuTGrJjAQQ gY0w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=P4sArob+; 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=BVgLA0d8XBpd7bokOkuqioYsSU5nu8dA87XtA3bv9uw=; b=BEE38grOjKAQKBWXax4H42nOrVU2bd+z4Pai7rWQasPmozp6d+H9S21K75OO3LLC9S fyj+oQ+m+5e4cCstguV31zB5h3yEh63eQA2j2ohKWXk7bxnTaAJ26Hv3OT+bBNQLih7w E2HCRYf7uXc0oJB/xOqWpVuCVQ/HGrKouNJRI= 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=BVgLA0d8XBpd7bokOkuqioYsSU5nu8dA87XtA3bv9uw=; b=Zfs+PCU4EfGMj289cPUyTzxCwAfAEduyYViQccuZ04y5sz4HXWydmCP9kiu1YtS4I+ MC7/oVQ7P5b/fRG9s2AB6LVWplzd4qXA1EHmPOCXJvpMAEnamFsxZUv7i+kEHf2r1qXG 7AmY8cgvRfWsl7nH3aSr1xLv5hgXgPpFW16Z5DGVL+uTzFf/WBeSi9itEXyzq3SAOh8W vv6NiXugw8cICAqx+KYXMvW5GtAS67AFquD5VaAhU7guGOJelUl+P6q+kEYSSGYP4h8B o/TWOR7UzHzAEuPogxpXB/u/lpQ97h8zALo69BaLUtQSNC1ldCdmHUoaOPG5Fic0iVQr ckMQ== X-Gm-Message-State: APjAAAWmF6yXvITS1l1FtqUVBE9zS8DR1QAQaR1VVypYY3QlpX6eOTOi uPDWfDodZhmgi4uiwG4SjXrIqp0d X-Google-Smtp-Source: APXvYqw+oKK9Qcm96do3a/j04TSiD99dDt0EsGosWWeRUno0YYMnhIebV+eguJ2uZFHy/lnbxWAC4w== X-Received: by 2002:a63:b1d:: with SMTP id 29mr33099446pgl.103.1563278284721; Tue, 16 Jul 2019 04:58:04 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:9895:: with SMTP id s21ls4340123plp.3.gmail; Tue, 16 Jul 2019 04:58:04 -0700 (PDT) X-Received: by 2002:a17:902:aa41:: with SMTP id c1mr34471804plr.201.1563278284414; Tue, 16 Jul 2019 04:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563278284; cv=none; d=google.com; s=arc-20160816; b=nApNveXa5C0UQMJuNVKLQkNMHxAOUJHTP1WNfXyXylJ0MoS9yF9Zr0RVPq2ROwNF/k QdYe+3JZryiaos+pKb1J6abu7j+l6NvxGHJFbTjpH+xq1YvLNX/K0/3mIxyNqWxfB+SX jxYcbPbqF0w2E/DfLDouUTqUmxMciaKaE/wL6QwEO8vqP8U6zVbSdpC8NpcyZTS/lqK9 ORx86YMzq7Za/nIkNKiqJKee7FC1yjv96wRF7zIS50kTqc47kxhpwXiYKhD7uv92zFFb LQKzvUPBVp1Rm1jtxb7k9HtvNzdmHk0OlpOFntQCuGNancafXoHIPKpKlrT3DUoZZ1pc Vq0w== 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=DSJh4I00v6P/DYPfUgYi8SFwSbharXXL/nmePhcC06o=; b=B6Xr0+CQfWRynobEEef48qYw5TA3B9jB5o6bq4aFruUocPaxTofdJPpduG2kH89qNR AKx60r5HtIhBRh/QH3hse/yguyyftMLrabbPO3GZB+geDZ4tWg2G4Scn9XFJdeu2SZv9 ohofbVeMnjrgkPIs4J+YPCxkFIMN0+Ag+Xe2IKeQ5mTQQjw3s3DYLKR7seeMlsvLWQLT 5a0J9JGC7XZFzsEFljn4sUEZBiYwb11twC0OnO54tAbGzNelMLyE6+QvL5q7tFvWNgZO 0ocEEVKe6DyRrlHWWLTXWnh/giCNiOD7IXs5WVyYcWXWYYRW2HFZIipt+YJMYJIEcO9e J82w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=P4sArob+; 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 b59sor24867015pjc.19.2019.07.16.04.58.04 for (Google Transport Security); Tue, 16 Jul 2019 04:58:04 -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:2228:: with SMTP id c37mr36120778pje.9.1563278283835; Tue, 16 Jul 2019 04:58:03 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id z24sm36269566pfr.51.2019.07.16.04.58.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 04:58:03 -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 02/57] ram: rk3399: Add channel number encoder macro Date: Tue, 16 Jul 2019 17:26:50 +0530 Message-Id: <20190716115745.12585-3-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=P4sArob+; 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 channel number. 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 | 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 92a4c485c2..076afe2ae3 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -73,6 +73,8 @@ struct sdram_base_params { #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 f58836c037..830311ffa9 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1077,7 +1077,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);