From patchwork Mon Jun 17 07:32:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 651 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 7CEE73F353 for ; Mon, 17 Jun 2019 09:40:48 +0200 (CEST) Received: by mail-pl1-f198.google.com with SMTP id t2sf5525649plo.10 for ; Mon, 17 Jun 2019 00:40:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560757247; cv=pass; d=google.com; s=arc-20160816; b=fnNfOnxO+FWH7/XLShFGY9Shbix4LYtXYBk2B+EjJF3RPJnXfXfAxGDH8EIGh0Wojd Xe56I/wZFAJyR3mN9+kVyDjWNQWxUZ/DQJz68vv2msEezOI4mVHqmeHKeKLbP+FTsZYA K462/vHMI40YKzcsGIWrrtR7ef8DrvzUSsZ4bINoqyyEVUEBqgQw7GbMkuGJ4wjDs+02 KgPRbKIFhWTaiC4cRRgSK6LBtDOvjNYBO82kwL2v/ZshUyMGIrKgZFJmNV4CqbFzycN+ mgUl/3ovZbOonxMBLrkXIQqEPg9d/cQnh0JdPZR6xLhDiEtzqNlq9bC4KXYmXq8iTr8f 8SfQ== 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=C88YRWhmDkBbQGeJJkDCfhMLZ7HiuYjL8oOgJnHiC1k=; b=u3F7nuqdxXXTb6JHYJsgBZGabucB3pcUjcG1fQ8YPC28VXBVujW7hrZl67ZPqpmR1v IcmpiECk0X0jm1xeReLYqrXXJe2EvuQIaxZzo1UR/n5OXOihyVoMzH9+IS3W3s7jydh6 nchxvULZA8RMzSsVtQYELnwSNFfTeCEBvN2t8GEPCq99P167TjOv5ysTYPGjI5jdbQg5 kbrmRwWDsu5lT+Z4kIqJ+H0wDL5c2VayGgMBswBrmh4/kzxI4VhkpU61NF6Wo0mJj3H1 FiWmZ3GXl5mVsZ7GJxw5KN7UFOU2Ei5d/sMA1qcL9zbL33NcncQr5yMgFJHbKChxOZC3 hGlw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Ws5nm6wF; 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=C88YRWhmDkBbQGeJJkDCfhMLZ7HiuYjL8oOgJnHiC1k=; b=m1tzKTjlSifbEz+3FE/opzpO/jH9ASYTnVNIQOwWeTTH7AEWG1cLXM8vJ0N41ex87L xL4Q6vIe4pdW6DsbBUltqzb5yawq4OOCh+c1Zj9eRcMzxFJIZbFOe8+JbkhstFem3j4b i+vPP4/KNJxmWY0jxbr+i81pqF7o274REVLNc= 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=C88YRWhmDkBbQGeJJkDCfhMLZ7HiuYjL8oOgJnHiC1k=; b=KtqAcRIad0AoDSsNkNo2pdJm6/nYG2QgREISgbd9goBg+fPu3VJlfREYCw4qZuyUw6 h3r/EhLOo5M0fmpeIijp4onxMhNNeJvNcybrrStEV4oOyZZ6uKUVHW+07C9mVXRm10JW ADES2DhbfpfkN6hLOdf9RHei0bvSz3vcAjZ2tjncxAUmxbloVpuRGzDT7ma7Kk7hcHy1 O1HYM6b61W8W9+aZjcFuaI3ko2alNWSfyL1iBZqk+ofA40JdAHMKPnFuHa+skoirP8n3 dq3J/tEk3f8ApQV8DALDMYibuvA3PFnhVYC4WQe+ZEH+EmsDmp4qOCRkXGqnzx8AdCrP orvg== X-Gm-Message-State: APjAAAUnlVwelhy1uLRN0bnTz0kN3b8Al88ruZYtUAtqW2GCtDwlzjkK +eeuU72p20JwxCb4GWzttTGC11BS X-Google-Smtp-Source: APXvYqzE+aOsXYl3B8OgRsPR0FNXh/5t1Ucmu7IkvMLJEAH5j1m4ae22mAvQbAv1hQBWEAOXAKqMRA== X-Received: by 2002:a62:1d8f:: with SMTP id d137mr29330822pfd.207.1560757247341; Mon, 17 Jun 2019 00:40:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:b20b:: with SMTP id t11ls3748476plr.16.gmail; Mon, 17 Jun 2019 00:40:47 -0700 (PDT) X-Received: by 2002:a17:90a:36a9:: with SMTP id t38mr25016321pjb.19.1560757247049; Mon, 17 Jun 2019 00:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560757247; cv=none; d=google.com; s=arc-20160816; b=OMWIvpzX/z1NnoWTKLLW9WsDMQo4L6CyulIJOlHbJwYTrGSM8pzR0yoqcdwZmkIGIj weWV/kxcieEES8N7Ros9NW5I3g42qce4iFFCQ+cfnQJyTOETNB3XJweyg3ZvFA9C8V04 5xupc6ROrI9KTe4IKYRH3olQfQkv00jWiyNzqR8H9a8I7PhEypfHrxxWw2kCd1orqvf8 jTUwtBf8hscqbnmley8Pvy3Ojm/g0kK7VLimqYr0yBMP4XwRmZu7IvUtMcEUpDvrhVBB 7IkLBt4OYXr0d2BISIE3WgaU/umVSN986qE+H2Wl51hSbTjsw6v/p7CO7BfVOLEoAWMD 64NQ== 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=JHJEi1B9BWCNPdGxI/VcOYj0TnW0NM3sy1W63Kvi/ww=; b=bcrxRSkV8emLRztKLOKkZ2uEUyreNthfHLMv2L3h63AmDwes9Zmg1MSWFMNXF+Ozhh EHJqzGzzuyDxuVHWYRuJrDVC428Sa07kFHZdS9N+neCjRGXHG5D/UbPX7Ztqi5309JYP YOIBTs7Mt0qeQh2ZEIuB3jtZuDxLd8wDfw90wAeJ/zOSPoretW7OulsrP0e/eakmV4+4 Ye41UJoCdWOSwHdAkC3cqHcf6+waJqIaEewLiwj7P37rjcScRqe41BzT2Hxzjk9imqq4 M7gTR7emJBYqQGKcLj8Cv6MOdinP5ljbyegezHKFZvf5oIjY6eX+ngBfFMk29doEbVG6 e+1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Ws5nm6wF; 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 h8sor10185747pgv.31.2019.06.17.00.40.47 for (Google Transport Security); Mon, 17 Jun 2019 00:40:47 -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:2159:: with SMTP id s25mr46043225pgm.234.1560757246726; Mon, 17 Jun 2019 00:40:46 -0700 (PDT) Received: from localhost.localdomain ([49.206.203.245]) by smtp.gmail.com with ESMTPSA id m41sm15205998pje.18.2019.06.17.00.40.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 00:40: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 v2 80/99] ram: rk3399: Simplify data training first argument Date: Mon, 17 Jun 2019 13:02:33 +0530 Message-Id: <20190617073252.27810-81-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=Ws5nm6wF; 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: , data training is using chan_info as first argument with channel number as second argument instead of that use dram_info as first argument so-that we can get the chan_info at data training definition. This was the argument handling is meaningful, readable and it would help to add similar data training for lpddr4 in future. Signed-off-by: Jagan Teki --- drivers/ram/rockchip/sdram_rk3399.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index e3180d0ef2..927c7cced3 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1286,10 +1286,11 @@ static int data_training_wdql(const struct chan_info *chan, u32 channel, return 0; } -static int data_training(const struct chan_info *chan, u32 channel, +static int data_training(struct dram_info *dram, u32 channel, const struct rk3399_sdram_params *params, u32 training_flag) { + struct chan_info *chan = &dram->chan[channel]; u32 *denali_phy = chan->publ->denali_phy; int ret; @@ -1499,8 +1500,7 @@ static int switch_to_phy_index1(struct dram_info *dram, for (channel = 0; channel < ch_count; channel++) { denali_phy = dram->chan[channel].publ->denali_phy; clrsetbits_le32(&denali_phy[896], (0x3 << 8) | 1, 1 << 8); - ret = data_training(&dram->chan[channel], channel, - params, PI_FULL_TRAINING); + ret = data_training(dram, channel, params, PI_FULL_TRAINING); if (ret < 0) { debug("index1 training failed\n"); return ret; @@ -1663,8 +1663,7 @@ static int sdram_init(struct dram_info *dram, if (params->base.dramtype == LPDDR3) training_flag |= PI_CA_TRAINING; - if (!(data_training(&dram->chan[ch], ch, - params, training_flag))) + if (!(data_training(dram, ch, params, training_flag))) break; } /* Computed rank with associated channel number */