From patchwork Mon Jun 17 07:31:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 574 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 955FE3F072 for ; Mon, 17 Jun 2019 09:36:31 +0200 (CEST) Received: by mail-pl1-f198.google.com with SMTP id f2sf5488148plr.0 for ; Mon, 17 Jun 2019 00:36:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560756990; cv=pass; d=google.com; s=arc-20160816; b=Dyd2R9+4j3HgcbQ0nHhwq2OVrruK4diVLKN6MJ5SQfpTxeYUoqkeZlnc9airO8G1k1 tBkRpb5OB/2d2gqBzgP/tMwxp7C5k4kNQpjKsZaldt5X5bIPO8zhxB1maS0zr1dHDoJ6 JsBzk516V3Hd0uVc+/+qxcndXm2Kh9JPQ1dX2ppVYUKHyK7VHZSHv7vdALUIGPB4/wWA t0o5bHSQAEU1uoeDfBNjH/1sl5cSO2700WIujlWgYBYm0wufm1qQeBa1QniTHRQcMDTG MLtqeLLxrpEa04QkapgB9d0SPXQhkybeMnMwTSPjV+399d8CPzSs5bpFARs8nPYeSSBO bDjg== 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=IsY1Y2yud8UAY4QOYBJqHJsiv9UrZ4ovNCbL/0Rj0NE=; b=HpiwiEMkWpH84qQ9GvTRGeWs85FP+YYWJES/N0UPDw9cTlrLBT9zmtbof6QZV0jVRC zPNLTa3zpTtevMyUodyDjDu/1u98Xgld2zZYg+qkBpqhvx4z6kVFNXKGmAQJ3Oj+Zs9x hc998PaTM7lasT7KJp4YMxOBJCgw+UgNWqnLDNBqm88P3HgbOFJuL5dAyEQwYJSvz23E GBdwXfF5qCgFsm0WmjXWBffKGkggHzTZZgbLvTuf45vudVhIy96UX9cO0dO6UciPygAJ pzKIF1+8P3F52KTgHQV2JE2Gt0Zf8BDf7r+Iv0G+DOxG57/0bqkxlAoXcsidkJeQtK/O s1cQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Ww300Cmq; 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=IsY1Y2yud8UAY4QOYBJqHJsiv9UrZ4ovNCbL/0Rj0NE=; b=dXqz4L7Ot4WxJNa85beJy70OWCJcMUNd0uyq71eLONOLG3zIHZ5qCymvb+VnyVC+yY DT4mey615dEVd4m4gPDfqNjX62F53JoaJyFYccu4mZoLZXJDPSj6wS80twOmJAudgfWm 0AZ2kpNWUXiacOzz8MbvmlIs7SUwYugJyB920= 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=IsY1Y2yud8UAY4QOYBJqHJsiv9UrZ4ovNCbL/0Rj0NE=; b=DzE2kw3VodPq5xCAblm4Shbsmoo8j6Z5eFw5NOzSRa+jJabioJfacOQ8TCGcbMrWLh LKcJzpuf3bhFMEvCAit2uskxUs++azx3pkhqhKuzKg3dp5CpSkF4Ji33W3NXPrsxynix 69U+GiQBkTlOnLOlI55RN/1McXQXOMZOhwtsIbl0VGovqkuirvsYj1IvRji3xFjcSC25 wnPVQWmCf6cKy2A4fQG8gDiAG8G8xE6ctyS8HcO3BQlgV7sVJXan8ca61qe4MQvmjkAd JDhCyJii4xuLHvPavkTheoXrElj5fBwuEHwAjrj8MeWqJrAKPsbiMMX6TJfqPfNlXa+R 0uvg== X-Gm-Message-State: APjAAAU/YM8eDnBt8d7lJY/G2eV15sbp+hFr1Fd5GodUIgAbmFVWdnW6 c5YG+8FC/pl0ZD69TX+Sc1OCTWh/ X-Google-Smtp-Source: APXvYqwCD5tZDVO+cF144F+0Gtu5hKHwJn3wGMh/NrU3OpDMUfp1CmCO7Nb+1o031HZmHftdehbDPQ== X-Received: by 2002:aa7:8188:: with SMTP id g8mr60621240pfi.221.1560756990423; Mon, 17 Jun 2019 00:36:30 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:372f:: with SMTP id u44ls3381923pjb.5.canary-gmail; Mon, 17 Jun 2019 00:36:30 -0700 (PDT) X-Received: by 2002:a17:902:f204:: with SMTP id gn4mr88679567plb.3.1560756990089; Mon, 17 Jun 2019 00:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560756990; cv=none; d=google.com; s=arc-20160816; b=gFyEUMc0WeKw37OoIHqX0Zt9Z8uSMlc2Qg60ngDUMTQAZUstBTr936VGIsg4y0jmHC RxmdhiOotNvgGji54VUw9PDDQ3hmHC8xECbxZl0vqjySGiegTyvHhcWC2+Mw4+ENC+O2 qL5szZ2dFsrEZVhJTPLFiipvSkWktfGuGjCm8aI/2JiX+cIuxHUL/de2WN+58kShLO39 CIvIodKiTFngduz4eAcQZHhyCr/1ia6Lc2YUbJC6FbRvrYYWHjG7juwQRlsI8qBtSx0c 2Z66s/7mSvQDtgxBWnSTzk3eR5nEvbD4jEMNsuUD9UgOXcc4jj2wTO6xMMtQVGQC7h4J UFxQ== 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=7hEbN4PwZywNJrm+qGPj+Jg8NZT6WGoxWgkH1ZzDnjc=; b=Qo6egNCCJIsQMbucl1y6yN5mYmo1eFyMjRmpylquORGEN2qol4TfEsnOB903J8G822 CMFiMkSO8iU4OmDVWFv29Iq2IVct0SNw6O+Gmu0rg1+yJvh6xcnepQtbT4VHSfJifFUx u8FEgQoM3bvWI4yPDpPHlutZZnAlGH0Q0mL17CypjkAk0senbAQUBN/wpxsL97kBPHwN HXv4kob034iw+9KZCiYGPPpQSICbPguXGuxkOUM0X124CuY1yVrk7RB0K5rAqTqZ89ZP wi7lKzEHoxc1JH+mciBClN9hFl5RXm6l3WQnGci3evjD5sXG5AxbxWhVrGDfx06UzQqf tpOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Ww300Cmq; 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 k135sor10324734pgc.23.2019.06.17.00.36.30 for (Google Transport Security); Mon, 17 Jun 2019 00:36:30 -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:1b07:: with SMTP id b7mr19604283pgb.133.1560756989669; Mon, 17 Jun 2019 00:36:29 -0700 (PDT) Received: from localhost.localdomain ([49.206.203.245]) by smtp.gmail.com with ESMTPSA id m41sm15205998pje.18.2019.06.17.00.36.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 00:36:29 -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 03/99] ram: rk3399: Add proper spaces in code Date: Mon, 17 Jun 2019 13:01:16 +0530 Message-Id: <20190617073252.27810-4-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=Ww300Cmq; 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 proper spaces in the code of - data training functions - rk3399_dmc_init No functionality change. Signed-off-by: Jagan Teki --- drivers/ram/rockchip/sdram_rk3399.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 8191ab6176..b8962d68f2 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -620,8 +620,10 @@ static int data_training_ca(const struct chan_info *chan, u32 channel, for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); + /* PI_100 PI_CALVL_EN:RW:8:2 */ clrsetbits_le32(&denali_pi[100], 0x3 << 8, 0x2 << 8); + /* PI_92 PI_CALVL_REQ:WR:16:1,PI_CALVL_CS:RW:24:2 */ clrsetbits_le32(&denali_pi[92], (0x1 << 16) | (0x3 << 24), @@ -651,9 +653,11 @@ static int data_training_ca(const struct chan_info *chan, u32 channel, (obs_err == 1)) return -EIO; } + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ writel(0x00003f7c, (&denali_pi[175])); } + clrbits_le32(&denali_pi[100], 0x3 << 8); return 0; @@ -670,8 +674,10 @@ static int data_training_wl(const struct chan_info *chan, u32 channel, for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); + /* PI_60 PI_WRLVL_EN:RW:8:2 */ clrsetbits_le32(&denali_pi[60], 0x3 << 8, 0x2 << 8); + /* PI_59 PI_WRLVL_REQ:WR:8:1,PI_WRLVL_CS:RW:16:2 */ clrsetbits_le32(&denali_pi[59], (0x1 << 8) | (0x3 << 16), @@ -705,6 +711,7 @@ static int data_training_wl(const struct chan_info *chan, u32 channel, (obs_err == 1)) return -EIO; } + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ writel(0x00003f7c, (&denali_pi[175])); } @@ -726,8 +733,10 @@ static int data_training_rg(const struct chan_info *chan, u32 channel, for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); + /* PI_80 PI_RDLVL_GATE_EN:RW:24:2 */ clrsetbits_le32(&denali_pi[80], 0x3 << 24, 0x2 << 24); + /* * PI_74 PI_RDLVL_GATE_REQ:WR:16:1 * PI_RDLVL_CS:RW:24:2 @@ -764,9 +773,11 @@ static int data_training_rg(const struct chan_info *chan, u32 channel, (obs_err == 1)) return -EIO; } + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ writel(0x00003f7c, (&denali_pi[175])); } + clrbits_le32(&denali_pi[80], 0x3 << 24); return 0; @@ -781,8 +792,10 @@ static int data_training_rl(const struct chan_info *chan, u32 channel, for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); + /* PI_80 PI_RDLVL_EN:RW:16:2 */ clrsetbits_le32(&denali_pi[80], 0x3 << 16, 0x2 << 16); + /* PI_74 PI_RDLVL_REQ:WR:8:1,PI_RDLVL_CS:RW:24:2 */ clrsetbits_le32(&denali_pi[74], (0x1 << 8) | (0x3 << 24), @@ -805,9 +818,11 @@ static int data_training_rl(const struct chan_info *chan, u32 channel, else if (((tmp >> 2) & 0x1) == 0x1) return -EIO; } + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ writel(0x00003f7c, (&denali_pi[175])); } + clrbits_le32(&denali_pi[80], 0x3 << 16); return 0; @@ -822,13 +837,16 @@ static int data_training_wdql(const struct chan_info *chan, u32 channel, for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); + /* * disable PI_WDQLVL_VREF_EN before wdq leveling? * PI_181 PI_WDQLVL_VREF_EN:RW:8:1 */ clrbits_le32(&denali_pi[181], 0x1 << 8); + /* PI_124 PI_WDQLVL_EN:RW:16:2 */ clrsetbits_le32(&denali_pi[124], 0x3 << 16, 0x2 << 16); + /* PI_121 PI_WDQLVL_REQ:WR:8:1,PI_WDQLVL_CS:RW:16:2 */ clrsetbits_le32(&denali_pi[121], (0x1 << 8) | (0x3 << 16), @@ -845,9 +863,11 @@ static int data_training_wdql(const struct chan_info *chan, u32 channel, else if (((tmp >> 6) & 0x1) == 0x1) return -EIO; } + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ writel(0x00003f7c, (&denali_pi[175])); } + clrbits_le32(&denali_pi[124], 0x3 << 16); return 0; @@ -938,6 +958,7 @@ static void dram_all_config(struct dram_info *dram, sys_reg |= sdram_params->base.dramtype << SYS_REG_DDRTYPE_SHIFT; sys_reg |= (sdram_params->base.num_channels - 1) << SYS_REG_NUM_CH_SHIFT; + for (channel = 0, idx = 0; (idx < sdram_params->base.num_channels) && (channel < 2); channel++) { @@ -1164,6 +1185,7 @@ static int rk3399_dmc_init(struct udevice *dev) priv->chan[1].publ, priv->chan[1].msch); debug("cru %p, cic %p, grf %p, sgrf %p, pmucru %p\n", priv->cru, priv->cic, priv->pmugrf, priv->pmusgrf, priv->pmucru); + #if CONFIG_IS_ENABLED(OF_PLATDATA) ret = clk_get_by_index_platdata(dev, 0, dtplat->clocks, &priv->ddr_clk); #else @@ -1173,11 +1195,13 @@ static int rk3399_dmc_init(struct udevice *dev) printf("%s clk get failed %d\n", __func__, ret); return ret; } + ret = clk_set_rate(&priv->ddr_clk, params->base.ddr_freq * MHz); if (ret < 0) { printf("%s clk set failed %d\n", __func__, ret); return ret; } + ret = sdram_init(priv, params); if (ret < 0) { printf("%s DRAM init failed %d\n", __func__, ret);