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: 583 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AE71F3F072 for ; Mon, 17 Jun 2019 09:37:02 +0200 (CEST) Received: by mail-pf1-f200.google.com with SMTP id y7sf6561199pfy.9 for ; Mon, 17 Jun 2019 00:37:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560757021; cv=pass; d=google.com; s=arc-20160816; b=AX+V++5CVDnrRXiz/iI4+OuAdqTeCM1xuxIgTkkLvoP+BwJLDDCLIqfSmgPbDojEKg 5QRrciHiPNnwdgkqT/a2zsU7TytCdcXO3BKFisSJEosgdN9PjZMRkfIp9RfqaFyR83Xe K51xgYlVKqKs3ZPxaBVg5igQN/IG+i6ifrlvjcwm4IOSYZvgSdECFqW4ZLYKpStXwIe0 5heR68jpP+tuh3HZ0UgRdrRUZOA/oXX8SdGwUWussc4qk2mVuXdbN+9esYnbHCRTPcIT HJOuDTaHQuQojdMVF+H6mS/hbnJjBwJJ6DeLy/49PPoR5TNVjccv2C6y1LrVYpdLJLl2 B0Fw== 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=WUbEPJxFiqt/qOaoDHtFgpdRzNfURTH637hDs99VyWg=; b=XG5HDNnVNIjc127evuKOqM76v2DqPau+ZnXo6+jlgm4sz4kNdjYRmNLBe/UL8TdUo+ FXIXMluHwCMMLAMRA4HhURXaoWnkIS22yJBmUfozAVqnLLhEkN2Ts2furbb66SCt0RhP bRiSSEwxXtuzbUVpAMbhMZtvyq9GpbvmkEwKoXS100zNJ2EBCIvXv9ZOq1EjGQ9/WbFM mMubdrsFT02qDAM1aDfxiBgfMvc1tV/n8GE975LcMC2VzDW0k2+c+FHhAu+tSH3T8mx6 mj4oRLZkN8QppzjLvWTeeDyRmHwf/51UbaUIdMfLw9q6BKW1K1aciFrOztgZ4KMp8n9G 3H+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p+blBiUm; 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=WUbEPJxFiqt/qOaoDHtFgpdRzNfURTH637hDs99VyWg=; b=C7vWiKpINJSpinjtQAyLgFJGgbwq3sZUU9r28+4BUBykXuYu/JkGVydVKXkI3sSHX2 sW47V6rwI+Fqz2pJ0XssA89qOG4lW45wuft/FRF2TcyQ9wpX4Cjyjx0SPSWAzvKgiL2C iEjXawwb/tbHb/N11YCA44ytnoj/k9eEVQ5b0= 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=WUbEPJxFiqt/qOaoDHtFgpdRzNfURTH637hDs99VyWg=; b=lQ6w4rwEE8+0RIrYK3MfQ2CXaiGkzMKot7gH89wNrvZgfXJk8qCdJK4gw77apR749H ZHLauUqIGLT95isA/GoI6MQfS88HzkDNmAfX+X7DG01UWunSVBNR36DynnGlf1tcDXi8 tICiG60RyB4gRwcUouUsjj858IE7fuF64N2YPKNqQzi/ltT42ZvHyShDz1U5qoB9rU1v gUAXNjjNmsGLJTESmfkMcAESqN7TPxLorPmBnpHJEALJqiHvx6LZ1kMBY/DpxwiRCK8r tMikvYuQaMO6M1nNG4acVh/grQxkaTBgBtVr+Zt1cOO2l3CA+lCf76eswgPZm4WjPXtN xsRg== X-Gm-Message-State: APjAAAUpCUJXV+ofoo4Sa/WhrmLgN8G7US8q5D1Kuk6P7ryK695nKeud CV1MkjxXp5h3uv1iuC8CtsnY+XwQ X-Google-Smtp-Source: APXvYqxD8lOmbICRAIG+yud7+ZzWQ2iC9KytRlVhIbLW1IaIDasdKmnVGQ8nl17bPJHQo3p7CJdLXw== X-Received: by 2002:a63:231c:: with SMTP id j28mr47242858pgj.430.1560757021478; Mon, 17 Jun 2019 00:37:01 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:3483:: with SMTP id b125ls3367344pfa.11.gmail; Mon, 17 Jun 2019 00:37:01 -0700 (PDT) X-Received: by 2002:a65:654f:: with SMTP id a15mr10134646pgw.73.1560757021107; Mon, 17 Jun 2019 00:37:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560757021; cv=none; d=google.com; s=arc-20160816; b=cHdhPgLXU9BhlDeDKMNxWx2s8ScJ1TvjDm8jEap4rVhmzhkFbKgA7RDboGpgmzlRam nypR3kVnGJCaqsz4JrPK46MJ9sLCwQN0f8aluZvT8exdJTevpSbY6nT1xzMikRn4AAct XzBPzGqpnd/VlSwjv+xNwdk1KGuyfol56yRRM6Opms7gUTcNF3okMag+ZOfbkDnIIw9F GgJU1rDRaiDb1n25hpkUFwgD9uvEKCYmAEewmr45pov0+k/CQcPRH2TklpSalTzvuMln zIeCANEwFlhFQ3ilnqKkUeclRNJewrr/NrlpE4Eo9YGctjE1u+QyfsmmR2uHZxtlv57R CXJQ== 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=8HB5WFYTdd+2Tu6qdgodEldYX+2xCcnRKLddeyfP/Bc=; b=R4+oFDa1fPnpCENZdE7F5D8KxqIgfNnzZiqlMbnz/tulo0tT2rzDV//G6DQAEPGx/m tIpAVyt1gtCMFIVZ3G86cPntN1kmJeHwWYKyvsC7GWzBrew/UYSvdLhmngyndR+So7E3 nDBB0CGIfEBl1zo+r6IJGotOk1wwQw6/0Pa4rzc3/fEnE7Bf+d5GHWSE2CMrMq0a59WY H6YedIGDozynx+FdA8oDAew9tQrQqfdhvsclcWWzKZGTSCzW/Npn89WJblgqDtV+hAmH q9DAqSIiM5Ps7R3pHzldfysnsDthoPD3YTryjQDg5cuSoSAdqM/7r0zZn/bPnWSFOdr/ ztmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p+blBiUm; 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 r3sor10257706pgv.46.2019.06.17.00.37.01 for (Google Transport Security); Mon, 17 Jun 2019 00:37:01 -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: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 Cc: Manivannan Sadhasivam , gajjar04akash@gmail.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki 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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p+blBiUm; 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 --- 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);