From patchwork Mon Jun 17 07:31:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 594 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D9FE23F353 for ; Mon, 17 Jun 2019 09:37:39 +0200 (CEST) Received: by mail-pg1-f198.google.com with SMTP id y187sf7225151pgd.1 for ; Mon, 17 Jun 2019 00:37:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560757058; cv=pass; d=google.com; s=arc-20160816; b=ux1VHSvVpeTpB5eXOnl1Mhj2PMfJPbSCbv6Pu8qqrfwwB/+ysA6zPuZYAyEitV+mjq MhLpg2ShSiYArWHmS403N2+gFJ6b6EELUYSJQ3/Ac2G4bGeYEM9fmP5YvsbCjkFr/VbQ 7Ob/q4URun+ICs3T3pLohqnHvqgtcjdhXcDRlN9ihnhTo3VcrY1LJrdQeuI2kCCcLdjH 1IUbB6R1XCM8j31y0hACFsZ+4NCikGPCYbkpZ2C1GmwQDQYPwnY30ChrKwctPjp4of/q /+KqU2kZFLFNOdofHt/9lZWzVIRI8enaT4m9E1M1HmvotAG3OKD2+bZJmPEfSTNR7G5Q qbVQ== 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=mQQ1WEzblNzwjO6m4dXSzcvAMHK0QzPL0TLsSxiBmak=; b=BVVL6hg2H5m7qkf3zEd1xWrJlMaVQeah9VPQ12RFqJ1mYrd1GnGx+uhs7JPYSfmES1 3ASRGcwnK84jrLWY/RL+hXkeLJcRGYyYahxST9oLA98cMKKGjytmOG0yx/aJN7KfjQ+6 ZLu9DpbNIqCh6FpmvEGCQzDnYw4fEMQRuByFA4YAIIKbAZWrIwp0hDQlLqt4x/AZC2Gh rc+sGbPHnxYB4lP+XTZflS/nOZ5HY4PiDpExkIzBclalUk/N76695EX3nrKjfggfp/uY G95JygOgasuybzOoQL5qlOchHBi9geIrbFclyfyiD1s6fYewkmvNbm30kVbAR09Wcr0i 23LQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rXV66gwG; 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=mQQ1WEzblNzwjO6m4dXSzcvAMHK0QzPL0TLsSxiBmak=; b=UtvnD99xQUUSB4JnhSUSHi5hbm06OapD6+tgBdLhkznbGCd2jEY+c0cUrxvM7I9sJY FXnXoaTNKAnjzTC8d3AKNX5mzBtgC5L71hB65uzXORofVazjIW4NTLdTy0M+aztXgNvC nPzHWRup0WgRLrbzR0jERsZZtHcur5IyzGUAs= 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=mQQ1WEzblNzwjO6m4dXSzcvAMHK0QzPL0TLsSxiBmak=; b=e8uBivzkhsu1mWD+GIJ/kDyhe7k7iXGSAPsF99SDDTwdvREuW7mzMag4GY7hM2Bi+e j6kZsDT6tmMOi90vzluknctcOo86KzAdI787iSMJSXT4S8xjlwTWZ3Vy9+TouuW7iO4G IvYb8TTFj5FYx1uxjwzjKZi2B4I9DhEwlQaW68vGEtHM3FIl6k3FPVjboH6mB7CIEfrO IGz2Jug/u839GcO/l0Sw6OoarrDE98ScTF8ltt2WE+o3jKzERqcRPIHyXkTztDgjpX0K EF0picS3LEJQo3o6Ta83bWyXKYDrTzeTLK10mEFpn5T5iX58oQlp8JVDA4goZvXA9Hjy 3zlQ== X-Gm-Message-State: APjAAAU3LxdKqBOxXFl2p57VKtVhyzFddzkZLfqFZKk713Ekkh6MBEmu S67kMRgjRsEc3WnJdhymGotJozDl X-Google-Smtp-Source: APXvYqzS2H4gMVqyHGQjFjtWj2btL0B5axe2Xy2o+K+7rjTxuD3/6D2e4l755+CB2mlwpTtxWF3C4Q== X-Received: by 2002:a65:418d:: with SMTP id a13mr28883837pgq.332.1560757058661; Mon, 17 Jun 2019 00:37:38 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:9406:: with SMTP id x6ls496536pfo.16.gmail; Mon, 17 Jun 2019 00:37:38 -0700 (PDT) X-Received: by 2002:a63:1322:: with SMTP id i34mr2917503pgl.424.1560757058257; Mon, 17 Jun 2019 00:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560757058; cv=none; d=google.com; s=arc-20160816; b=QxU4rKWEi/UY3nOC2+R0PQjt0FyO+R3AU+yXjX/7sbc6+PHTLQMPARiJ2NzvNARqQr /u6R8J08HCLr2lB+elNL7iMCXO91T9gy6Psutf15rodqW0T9oWsvjZw/GeKv8CyX3SnJ Ad0ZDcahfYKAAZLwLPH3D4bwWhnojkN8nBbMYutcNlhM0/8XF2WkzR0N2DQeo7ykAVZr MUI9jWZF0X2DkA0g6W4AsUx5ONuXBJnHD6YmsVmoQ3APKQOe+UtIDFN5PwtB/u30uvLW bmpnRhfe/aXlXv2f0mtqCnCtI9eEBF5zoVGjzyURUSwkW/7FlXgp8Bx+3HnutNmMLTnY baiQ== 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=qAVGQg7YWrjgdY0fVjt4lm9+0ePKFs/oDTEcqP+eILc=; b=pRcq4leJlld8NPDte+u0f+ez58baL/XjkzhUoC8ldLZTMSlY2TYf3rAbSusoMJYZPL i5puGebStBV9z9nM6xO6eizofmJwATTfQt5qxQZlERTP0vYX1KpxILOwHxl1A2YKnPqA NBswjf9PlSp10NE4+Y9JKQO3WkHz5Iul2PiwBsjHjz99o3t6imMb7rnj4H5QAZjsFddw csnOPC84iYqCHsFe2bGRUenOuVa7HBUr+c2bfqAHWIAkeVrQmuC5Ge4TxNCXSrS//jAx /ir5ghYHos+FJrf5TKm2kPKjdr32I68JwjQRe8hrOAwIW48gplnjJ2APLn0yidKGpsM5 pgTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rXV66gwG; 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 a13sor12296236pjh.1.2019.06.17.00.37.38 for (Google Transport Security); Mon, 17 Jun 2019 00:37:38 -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:cb97:: with SMTP id a23mr24245041pju.67.1560757057971; Mon, 17 Jun 2019 00:37:37 -0700 (PDT) Received: from localhost.localdomain ([49.206.203.245]) by smtp.gmail.com with ESMTPSA id m41sm15205998pje.18.2019.06.17.00.37.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 00:37:37 -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 23/99] ram: rk3399: Update cs0_row to use sys_reg3 Date: Mon, 17 Jun 2019 13:01:36 +0530 Message-Id: <20190617073252.27810-24-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=rXV66gwG; 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: , cs0_row can handle the pmu via sys_reg2 and sys_reg3 while configuring the dram instead of just sys_reg2. So, update cs0_row macro to make use of both sys_reg2, sys_reg3. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen --- arch/arm/include/asm/arch-rockchip/sdram_common.h | 8 ++++++-- drivers/ram/rockchip/sdram_rk3399.c | 4 +++- 2 files changed, 9 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 c2374c0f83..4fe7d60daf 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -52,8 +52,6 @@ SYS_REG_BK_SHIFT(ch)) #define SYS_REG_CS0_ROW_SHIFT(ch) (6 + (ch) * 16) #define SYS_REG_CS0_ROW_MASK 3 -#define SYS_REG_ENC_CS0_ROW(n, ch) (((n) - 13) << \ - SYS_REG_CS0_ROW_SHIFT(ch)) #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) << \ @@ -65,6 +63,12 @@ #define SYS_REG_DBW_MASK 3 #define SYS_REG_ENC_DBW(n, ch) ((2 >> (n)) << SYS_REG_DBW_SHIFT(ch)) +#define SYS_REG_ENC_CS0_ROW(n, os_reg2, os_reg3, ch) do { \ + (os_reg2) |= (((n) - 13) & 0x3) << (6 + 16 * (ch)); \ + (os_reg3) |= ((((n) - 13) & 0x4) >> 2) << \ + (5 + 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 bb673a862e..40cc31601c 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1005,6 +1005,7 @@ static void dram_all_config(struct dram_info *dram, const struct rk3399_sdram_params *params) { u32 sys_reg2 = 0; + u32 sys_reg3 = 0; unsigned int channel, idx; sys_reg2 |= SYS_REG_ENC_DDRTYPE(params->base.dramtype); @@ -1025,10 +1026,10 @@ static void dram_all_config(struct dram_info *dram, sys_reg2 |= SYS_REG_ENC_RANK(info->rank, channel); sys_reg2 |= SYS_REG_ENC_COL(info->col, channel); sys_reg2 |= SYS_REG_ENC_BK(info->bk, channel); - sys_reg2 |= SYS_REG_ENC_CS0_ROW(info->cs0_row, channel); sys_reg2 |= SYS_REG_ENC_CS1_ROW(info->cs1_row, channel); sys_reg2 |= SYS_REG_ENC_BW(info->bw, channel); sys_reg2 |= SYS_REG_ENC_DBW(info->dbw, channel); + SYS_REG_ENC_CS0_ROW(info->cs0_row, sys_reg2, sys_reg3, channel); ddr_msch_regs = dram->chan[channel].msch; noc_timing = ¶ms->ch[channel].noc_timings; @@ -1050,6 +1051,7 @@ static void dram_all_config(struct dram_info *dram, } writel(sys_reg2, &dram->pmugrf->os_reg2); + writel(sys_reg3, &dram->pmugrf->os_reg3); rk_clrsetreg(&dram->pmusgrf->soc_con4, 0x1f << 10, params->base.stride << 10);