From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 798ECC4338F for ; Wed, 28 Jul 2021 10:29:15 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4D3660F9E for ; Wed, 28 Jul 2021 10:29:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C4D3660F9E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72A9382BD7; Wed, 28 Jul 2021 12:29:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NO4kWUYv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B09382956; Wed, 28 Jul 2021 12:29:10 +0200 (CEST) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8780982956 for ; Wed, 28 Jul 2021 12:29:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-ej1-x629.google.com with SMTP id go31so3764181ejc.6 for ; Wed, 28 Jul 2021 03:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=i93uhU1udXO6iFQnWaAwI42yV9DbE53uL+j9HqhnmRU=; b=NO4kWUYvBQKs65bLu6+fPXbFT9cSi7kooBDlOsvD6TmLPS75md8posPVgIK5810QK5 zQqmGujxYKg5H3594YSaMZEvEcltgyjRgvFweIipxF9VsLwECJuKTzoxLbGTaD1KdoLf NFgjYcGPwa2D9RSEDhrDZ7KVTZ5CZhN+k/AN4YWutPGO/g3Mlxiz/BiGtv9GPRB6RPFW p3hIy/lolP8RNErwn6r9xcOglDTZEbEGzS5/MspG9l0XEkKGkWr01PSttQrAvPs81BKc nAtnZZaUPXiSRPnAeNY4ALCD11uV85mO4rvsvEOjpD9GWk6XGJSUvjJOHs6KaQ5qOtyW J35w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=i93uhU1udXO6iFQnWaAwI42yV9DbE53uL+j9HqhnmRU=; b=rkkCIGjDUYbK8bhx8rpyiq5VXHom5bxtNlw7Yy7dT0iEgmz53Pj+fGOHduaM5yJD7u QEtwW9se+O0oH7N1QrUYztcV45rnSPLnAbBg1vnG5AyIP5xwYX1ssHZAtavcmoH+7CNm 9YWIj3ww85VVI8X526FHZfqOH1Imvdb3ZB5hORpQmwN0H4AQjEUo2O4RVRVBrKXQmd9e qJWE+fj27Q70XssRPijQ2iComot632Favw4/myVGOxzAYdjXqV4QvF90t13+x9tG1Brw JCY7U+Gu9Vhph3pqLMVXljeE7LH93zuob0ruWVMbObvUqlCipH3zlrPEZe7d1VITWc6g tGgg== X-Gm-Message-State: AOAM530KKM+awNIjfJKRCAESoBeIv9OiNUM/tY4p1TdeEx0ycNHTMWNV MYOTtJsdtYj1oGItAhQLOUXM3VCfnh6s3Q== X-Google-Smtp-Source: ABdhPJzV1jp/IZ9D9MBnDG3rSGas3Gm7F7CG4u7RF9bJl+LQJbi8nnVZIH4KgnEVzXwQUwc4BuRa0w== X-Received: by 2002:a17:906:fb11:: with SMTP id lz17mr8852590ejb.336.1627468146985; Wed, 28 Jul 2021 03:29:06 -0700 (PDT) Received: from pek-vx-bsp2.wrs.com (ec2-44-242-66-180.us-west-2.compute.amazonaws.com. [44.242.66.180]) by smtp.gmail.com with ESMTPSA id m26sm2400215edf.4.2021.07.28.03.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 03:29:06 -0700 (PDT) From: Bin Meng To: u-boot@lists.denx.de, Simon Glass , Jagan Teki Subject: [PATCH 1/2] spi: ich: Limit slave->max_read_size Date: Wed, 28 Jul 2021 18:28:56 +0800 Message-Id: <20210728102857.526170-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Since commit 43c145b8b3ee ("spi: ich: Correct max-size bug in ich_spi_adjust_size()") (in v2020.04-rc1), SPI flash read no longer works with ICH SPI controller in software sequencer mode. ICH controller can only transfer a small number of bytes at once. Before commit 43c145b8b3ee, the logic happens to make sure data.nbytes is limited to slave->max_write_size but after commit 43c145b8b3ee data.nbytes is no longer limited because slave->max_read_size is not initialized with a valid number. Fixes: 43c145b8b3ee ("spi: ich: Correct max-size bug in ich_spi_adjust_size()") Signed-off-by: Bin Meng --- drivers/spi/ich.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c index 3d49c22a9d..08d54e86f4 100644 --- a/drivers/spi/ich.c +++ b/drivers/spi/ich.c @@ -918,12 +918,14 @@ static int ich_spi_child_pre_probe(struct udevice *dev) struct spi_slave *slave = dev_get_parent_priv(dev); /* - * Yes this controller can only write a small number of bytes at + * Yes this controller can only transfer a small number of bytes at * once! The limit is typically 64 bytes. For hardware sequencing a * a loop is used to get around this. */ - if (!plat->hwseq) + if (!plat->hwseq) { + slave->max_read_size = priv->databytes; slave->max_write_size = priv->databytes; + } /* * ICH 7 SPI controller only supports array read command * and byte program command for SST flash -- 2.25.1