From patchwork Wed Dec 11 13:26:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 923 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 84D183F32D for ; Wed, 11 Dec 2019 14:26:37 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id m14sf7870304pjr.14 for ; Wed, 11 Dec 2019 05:26:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1576070796; cv=pass; d=google.com; s=arc-20160816; b=c0mfB4f2uJK8hfkscc9ndKwcaWSZY3wa+N2PjT0/mdeUo+PTuUfShDnhFoHO+dIf18 bqxoFexdK/08eBNT5+RuPGJ8p0dvcyyTl1mIL8yGB+bKAvxenxavlXQKEyj1NLcyaRma R6zo2Uy6XkrJJhykDUnbdRAxWLVLOSTKX3J+J70ZdOvidJue5UuInIHN+0+fYyaAL+7P 64h6CcjXja0jAh5CCFw1BwIXba46269504+V0v3asO/IwtsfENv75tW1YycuptcWcsiL CcLkJVfMEpkWrYAkC6jizLoZKlRfLcVEUsGoHAVui/mIIhqmkDvtRjAGrGosk/4wI1Eb NLyA== 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=1tQpGbWnqM4ETL9saTOYEuXOo0OQMrsrRcOYe37F6tk=; b=qGy5mg9Daefvzjyqb3NS842SAcOwYJA2Zirzl9yCRYXKEPL5wFlIl6I4uDEllgAqXo M5XN61r3OJe0HWsw2KlZ4p7/Tw7BaTAqBr2NTWSJqxpqKQ6QQTigsl57vQkJeII9aRZo OKluH3C4JRCh8Gvkvwv/u1cRQjv/mdG7GkCYCnaA8MLdMPjM8ef2uPH48YKUZ5CgF9Ng QcGk1YrdO6yHhmGBMLlozBLydSXNwhoeuc+DWFh71Z49Gf5mnZ8jxNSuX3EbGdJ3jrme zTEvButraIICdsvP/LIWktqaXA/8AuSVCAdKmyZI84ooHOigDrcGy5G0S44f6c/cj6ou C6BA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=q1bdb59F; 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=1tQpGbWnqM4ETL9saTOYEuXOo0OQMrsrRcOYe37F6tk=; b=NyOzhJQ1Oh3MXASgG1Lfp3JT8/zT1uAEte+PplOebD7PD2X4RyNm5Dedyd31T5YJWy T0Q74pxzzCPjzUW9FVdUHjPi0UAtTXEBzI9EABO2Dlh59NCIZCWexeVtwqJYw9nUKzy7 8Fu621wThELlJLJAApyvatu0QOZSAXm4az0Ps= 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=1tQpGbWnqM4ETL9saTOYEuXOo0OQMrsrRcOYe37F6tk=; b=Jxk7V3XhrOOs1g5gJDrplB/G/2wlLsKs+tbcYUNE0Sy+OLALvjcEvDffGmY2K4GrXp 5aqyfTZiWeeWn4smEfI4ACPR1zWFMwMuo7taY0Rq/UiqmdQBswrQBGXOdYzG9TKfQKYZ jyGxroAuP5ofYkmGOWTDFkzk0MW4teJfz/XG485YHdExaERQvBksgwsNTu3aDHzhhCT4 tQ9NBxo6tvZmkS5d7C/+XihiLCK2egssqE0F/Bp6B7XXszFEPJPhLs/WtEkEYn/QkNhh Vtz3g4E5Kt4oLl9o1obh21zNNoE32hZhnQvPDDtcVfIuNGQMlYdRh35YKjC9SoQY0yGy Oc4Q== X-Gm-Message-State: APjAAAVAN5zH8HNpJfWe2hhfRCluIa6uzuTmWUefDseBmlF0ZR4VWqqS B816OS6LwO4hMq/IP3xK+SL37Fnw X-Google-Smtp-Source: APXvYqx6D4hzbsNCr5bNTYaR3gNHyZe3KcIpOmMbUdGkUZtKBuoRDBF+VMU/18iJtCYcfx1GPbcdSw== X-Received: by 2002:a17:902:ab8c:: with SMTP id f12mr3316234plr.55.1576070796263; Wed, 11 Dec 2019 05:26:36 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:868f:: with SMTP id g15ls529002plo.11.gmail; Wed, 11 Dec 2019 05:26:35 -0800 (PST) X-Received: by 2002:a17:902:5a83:: with SMTP id r3mr3274149pli.145.1576070795667; Wed, 11 Dec 2019 05:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576070795; cv=none; d=google.com; s=arc-20160816; b=m+iV+Njpn5cc6hBEtb4H7kpOvJ9abdVwC24tMkVsNWSnAR/eoo+B+5IcUAtnf1GK3K nVlKhrmWNQxj2QZEC0Lb3fHeDKNULclV67ZCpTIkT5SBvrGzB9j3TpIbUXRqykD/3gM6 04Eg+b4c2aJLPEb3vEjhCK2x6f3EobByWu8QNQEizzRyi2CxNEseL63tQqlkrMaHTZY9 0sjyPbG84mcddYylc6+72L4+NIjLnyMG0dobhTj1Y85tYMh0noP9algqsgYTaz60CMSC RvGZNrL+5KuHMVhBGHwpakts0LXeoG2Pez10xbCm7PPH27M1q+Sw3jxXoYgZ1VPZq6Dq D+SA== 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=gVIB5EpzB/rDAwAohidNPXnxHhhwcS3JjiItD99CNjU=; b=HLCKb3JD6VORCmmb9znJZ3R1n5dsSx2whOpdh/EMsHQmxJkjCvyMZK2a55Em8L6G3l JZtzXoH7pICCEgjSDOVYx914YtbavH4wfF5dNelYY+8WoSGqgUmf+m9eILeWGiqMie2R 2SToqw9AQ94bNk49KLtqz5GE9EktjrXpNMs8jf6s+jKKyI3QMhcZbeCcy9/JYR29rbri D5f/E2MZTMqvSx9DO+/rNLhNyi/hCVwfrVxeOXrz6HsZgqX1Lh1mpKQ7kPfsWlnnw9m8 g95a85Mdd0hnPoxm7p05TcOwkX15AgmMhSyR+JUH4IU+I6+5UfPi3w/qyywPcrMyC6+o 4NYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=q1bdb59F; 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 g8sor2289549pjl.3.2019.12.11.05.26.34 for (Google Transport Security); Wed, 11 Dec 2019 05:26:34 -0800 (PST) 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:d682:: with SMTP id x2mr3601839pju.44.1576070794580; Wed, 11 Dec 2019 05:26:34 -0800 (PST) Received: from localhost.localdomain ([49.206.200.202]) by smtp.gmail.com with ESMTPSA id e23sm2716145pjt.23.2019.12.11.05.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 05:26:34 -0800 (PST) From: Jagan Teki To: Simon Glass , Kever Yang , Philipp Tomsich Cc: u-boot@lists.denx.de, linux-amarula , linux-rockchip@lists.infradead.org, Jagan Teki Subject: [PATCH 1/2] Revert "rockchip: spi: fix off-by-one in chunk size computation" Date: Wed, 11 Dec 2019 18:56:22 +0530 Message-Id: <20191211132623.430-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20191211132623.430-1-jagan@amarulasolutions.com> References: <20191211132623.430-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=q1bdb59F; 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: , The maximum transfer length (in a single transaction) for the Rockchip SPI controller is 64Kframes (i.e. 0x10000 frames) of 8bit or 16bit frames and is encoded as (num_frames - 1) in CTRLR1. So the 0x10000 is offset value for 64K but the actual size value would be 'minus 1' from 0x10000. With the existing code of 0x10000 transfer length leads to read failure when we try to read the flash with > 0x10000 size like, 1. sf read failure when with > 0x10000 2. Boot from SPI flash failed during spi_flash_read call in common/spl/spl_spi.c Observed and Tested in - Rockpro64 with Gigadevice flash - ROC-RK3399-PC with Winbond flash This reverts commit e647decdd93c7408741329432f26758fbec04c7a. Signed-off-by: Jagan Teki --- drivers/spi/rk_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index c04535ac44..d9a310ce80 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -451,7 +451,7 @@ static int rockchip_spi_xfer(struct udevice *dev, unsigned int bitlen, /* This is the original 8bit reader/writer code */ while (len > 0) { - int todo = min(len, 0x10000); + int todo = min(len, 0xffff); rkspi_enable_chip(regs, false); writel(todo - 1, ®s->ctrlr1);