From patchwork Tue Jul 16 11:57:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 763 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3EB053F08F for ; Tue, 16 Jul 2019 13:58:48 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id u10sf10055391plq.21 for ; Tue, 16 Jul 2019 04:58:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563278327; cv=pass; d=google.com; s=arc-20160816; b=Zn3n1ulAddRyNSZ4+rIxnJeCns+k9JiDvuQORI0N15n9HPISLbdwFaClGwngQ4uw90 ikA9t6zkwMpfJjee44B+byGfsvkaYG891crTSouM6Vjl6gThrqz/Fv0r7E8C964ZyKVy Bovx5Cf7XZJJ2Y6vpDfMLXydQ6PHgD5jvlNiYDhSHKK9BV2DoPqQAo9Zqav4knpqzCLq jD/o52N3jhCe4/RhskMXM19ljs4kjvD5LUMGpiB65m2DIFnT6P1Az9JP+ekrF+uyxODe ThboPX26OnVHVWlhZhz0zuPBjRfGvVH0UafLC1YFBrMv1uEuIkjf6kgJP/+bDh4xh7SX oXMw== 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=Ot4ICm56lvx6YSD925zQE+w9BYiyNnQKA0VrFHDJHzQ=; b=JsVtKjGTuKqTvFz/m0MgYSiSG4C61qlRmA1UR4xb2w/UYAEKN2POgwwBg3hmKXXj+U SsFoj9hv2Lvrj/ZpoAzjQI8u4iVE4fqs20w41SdL1PzaeIMp/5Yt08DPM1sQlIpm7QUA 4fRr499MUgqCD/97geWyFzSGgpb6YIfY68iw0yt5N8KeSPk14pOT/ZaH5twgLeaL+qpT nbLQwSiaG5IY4j11Lt73BuuYVzsgrqMuFN/4ujLDEBmhPVDloQ8vFx+qCnvSYJ5HUAye EQFvx/jb/DCSTdaR34yW6mJ3kQ7YjQFWOIBCaQ3DtfgKEyxcaFsQUs3MTVft49lCQAI9 +/bQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kZ+O8VoQ; 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=Ot4ICm56lvx6YSD925zQE+w9BYiyNnQKA0VrFHDJHzQ=; b=YvSOhO5uMz6+ZSRUI7vziqLzqKiKS2tTfmgWYL6q3IHre4z5fuD07HKhel+xswAlCm L9c3lDbrzuzOHb9FSydCqu3cSHvs74T1R6oeF1pC26fs0aSNRo6YakTHOlr1jRyDVe9j FCczKSmBzIXXosO5+jUEohz8PMZspBkBWBXIY= 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=Ot4ICm56lvx6YSD925zQE+w9BYiyNnQKA0VrFHDJHzQ=; b=doKuZU6OZQpDNPG9a6kZtR8CdTn7YpcCrMHZGTnCoAhtJbYdNHDkbGxQM9G7vw32Yv 1GExKzb5wyPQdAL9E9Y1p9dZOAK+r8wkUiZyL1YUBhrHGRldFvA1FJ9Vv/zmxFIWPjkV iMJhgZ8T1KeDm7jBo4CDi7WejkquEmMkWxSQbNYD47LklRaCrDBplURq7dVa5IOwEb6x X2VCwzXNqDaCYUsjswEdzXaWvcxqCMjLCL1wWql9d7K6QKHjofO1E4IVriZocZ1GWIpf 1kBJ3sq3PIj1uQqbIKejsjbcxWHqjnt0ZZdXOxu1BbpH78YIkNe12BItjUDjdHBoszF/ ARBA== X-Gm-Message-State: APjAAAWPe63GSICfIPddAmmwyjNPfkgVvq0J1VHpAeufDC05VZjurD0a 9R2VTERmoOGA+eGLZWtpcLSYSdf+ X-Google-Smtp-Source: APXvYqwtpQ2KA3VJDRQFyPaw235o0vgS2vGetSOZppVQ8D99t7g2elTEt48uU6ZXXFPVRMVSI/COxA== X-Received: by 2002:a17:902:f087:: with SMTP id go7mr34693676plb.330.1563278327038; Tue, 16 Jul 2019 04:58:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:26ae:: with SMTP id m43ls7077038pje.2.canary-gmail; Tue, 16 Jul 2019 04:58:46 -0700 (PDT) X-Received: by 2002:a17:90a:8a0b:: with SMTP id w11mr35483182pjn.125.1563278326745; Tue, 16 Jul 2019 04:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563278326; cv=none; d=google.com; s=arc-20160816; b=z/JG9oyo5z+26emQYjagMOU26s16ku7u/sT/rQhTV+I3cGuahzwJm4YC1m3WIHQlTk Gdj41FDQtGXEbwycVCE2ju0/62MzuGBEn2AfYJ3hi/QMnxiyT/lQ2FLy13MBFLqWG9EL b8/gV8Qmb6uzBFIE4Viban6Ur5I6XkU2dnyxbQa4D6brBKvyeJfzPM3qRPiZvWEEfWaU hYY3Z3WqDA20IhxL6+Rx/r/RZbHql68BoneH74LzL9CVFS6YgMAtq/SkwF8cfYIRXa0F NCYw8CTouEIG+IpSYxHqcJbm5Uuj6jvAscfikCsPMMHlG4SYtMM/fvKE6m0HK9oGvG+M 5lDg== 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=MG4eQXtYLyg/bIVFfwfDOqnsbO9ZxzwLez61zLxFaqQ=; b=O6RkGcaGqcDvVyQ1tPPH9rwWHVfqhyTGw2OfJuqkEIcEilERB81QxDOGPJedcAtMTE VDfglWrqgP4J8BB/Z6wh6Alee+U+B++mj0WGGVKM40S6J3HMVJssIAmgsRdjZUdeAjBX 5d2YpWXDOb3i41881RTi8orpsvdZD/RhLjU/Fc8a/O3TcPrpmd4iRP469rMebNsen35Z TuFis6rTYx5CpMBvHfkgFfv/QyvH05aJM67vT/uVJRShGvG75ahDHe57t7V+rsJmNaS4 XzmqrUFRjQAaQbJwydS1h+I63+LmXTEDKB3StlSQ4P/rmO2rgMgrLV6fVBlAznVe7I7n 8IVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kZ+O8VoQ; 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 p1sor25509965pjr.9.2019.07.16.04.58.46 for (Google Transport Security); Tue, 16 Jul 2019 04:58:46 -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:30e4:: with SMTP id h91mr34302115pjb.37.1563278326416; Tue, 16 Jul 2019 04:58:46 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id z24sm36269566pfr.51.2019.07.16.04.58.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 04:58:46 -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 14/57] ram: rk3399: Update cs1_row to use sys_reg3 Date: Tue, 16 Jul 2019 17:27:02 +0530 Message-Id: <20190716115745.12585-15-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=kZ+O8VoQ; 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: , cs1_row can handle the pmu via sys_reg2 and sys_reg3 while configuring the dram instead of just sys_reg2. So, update cs1_row macro to make use of both sys_reg2, sys_reg3. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- arch/arm/include/asm/arch-rockchip/sdram_common.h | 10 ++++++++-- drivers/ram/rockchip/sdram_rk3399.c | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index f74377225c..9cd9f3b969 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -92,8 +92,6 @@ struct sdram_base_params { #define SYS_REG_CS0_ROW_MASK 3 #define SYS_REG_CS1_ROW_SHIFT(ch) (4 + (ch) * 16) #define SYS_REG_CS1_ROW_MASK 3 -#define SYS_REG_ENC_CS1_ROW(n, ch) (((n) - 13) << \ - SYS_REG_CS1_ROW_SHIFT(ch)) #define SYS_REG_BW_SHIFT(ch) (2 + (ch) * 16) #define SYS_REG_BW_MASK 3 #define SYS_REG_ENC_BW(n, ch) ((2 >> (n)) << SYS_REG_BW_SHIFT(ch)) @@ -107,6 +105,14 @@ struct sdram_base_params { (5 + 2 * (ch)); \ } while (0) +#define SYS_REG_ENC_CS1_ROW(n, os_reg2, os_reg3, ch) do { \ + (os_reg2) &= (~(0x3 << (4 + 16 * (ch)))); \ + (os_reg3) &= (~(0x1 << (4 + 2 * (ch)))); \ + (os_reg2) |= (((n) - 13) & 0x3) << (4 + 16 * (ch)); \ + (os_reg3) |= ((((n) - 13) & 0x4) >> 2) << \ + (4 + 2 * (ch)); \ + } while (0) + /* Get sdram size decode from reg */ size_t rockchip_sdram_size(phys_addr_t reg); diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 70867cbd5f..1222da39c2 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1095,10 +1095,12 @@ static void dram_all_config(struct dram_info *dram, sys_reg2 |= SYS_REG_ENC_RANK(info->cap_info.rank, channel); sys_reg2 |= SYS_REG_ENC_COL(info->cap_info.col, channel); sys_reg2 |= SYS_REG_ENC_BK(info->cap_info.bk, channel); - sys_reg2 |= SYS_REG_ENC_CS1_ROW(info->cap_info.cs1_row, channel); sys_reg2 |= SYS_REG_ENC_BW(info->cap_info.bw, channel); sys_reg2 |= SYS_REG_ENC_DBW(info->cap_info.dbw, channel); SYS_REG_ENC_CS0_ROW(info->cap_info.cs0_row, sys_reg2, sys_reg3, channel); + if (info->cap_info.cs1_row) + SYS_REG_ENC_CS1_ROW(info->cap_info.cs1_row, sys_reg2, + sys_reg3, channel); ddr_msch_regs = dram->chan[channel].msch; noc_timing = ¶ms->ch[channel].noc_timings;