Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3058410rwb; Fri, 20 Jan 2023 10:36:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXsn6S4WwlVk+5vQ4IosIYXuy8a52JPNPYb2uLg3JX8FiDr1QhrXdT+KCdCwHNHiTX7kG31v X-Received: by 2002:aa7:d701:0:b0:49a:d3c2:c76f with SMTP id t1-20020aa7d701000000b0049ad3c2c76fmr17287179edq.13.1674239773455; Fri, 20 Jan 2023 10:36:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674239773; cv=none; d=google.com; s=arc-20160816; b=fa01Nj2gST/q3TtHa/jdSRL5Mn/uam3Lhnvs6oc/n/VncMthyn9OKN4SIS83/GPYC6 jd+aBff6pAEgRV4icGEbBQD7Zm8LGhceVjao7TnGCi4yMWcbznwPRGp88icb1PHJIO6d dJQmbYRzfK1c79i0Zws6Z19qnbBFasI0c5xLlkshNXu48iNdoSXLocqeYxtFEn1Kirn6 Tw5GZTXtXkzkU5K/bb8gU6CdfvHOFnEntdhh7Y9He2dCWgaIVAb0xedGCAaLZkUFwL00 HwncTrE2gDhWtGLfgooSoGAA1uU8NvG6GrHG6LcZ9vYmsoq2csOAnlWrPDIWRxsFDAaj z6jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=oIkO5gx/n6pvdASc/nUcxO9v2oX9ajTXxRa/fHrC1iw=; b=MUphBU/neBIW6M9oljeJPotrFu8jFLBan3G6xnfwV2mbAXeXMEnU+r8geqVgeUU0vU yF3LfZl+ocYphNN8GceLc0JP+dQrW6uESiRKFXjdQAKqOameec7w473wy+OAJXAzLtsE wS/ICw0zX0UaenjTy8Y2mSnNdP89XyoyMuJhNLe0AJ6CDBX+f6vpVCdfaDtof/BreTIU chSX9YvsJrz6X/xHm53v5T093hMGi6le0L7maibuXN1wawg3xEHJ6+cXP9tCiF2ktOw+ 3gjTwG0yK7jYlbTCUONylylJLyX1MUGPTAAO4yZwxXEM56VWA6cGrOPBCgZhPLXQgA+h 1ZuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EfH8CCMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc35-20020a17090716a300b0086db2a9332dsi5967078ejc.168.2023.01.20.10.35.57; Fri, 20 Jan 2023 10:36:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EfH8CCMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbjATRw7 (ORCPT + 52 others); Fri, 20 Jan 2023 12:52:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjATRw5 (ORCPT ); Fri, 20 Jan 2023 12:52:57 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F368F7DB for ; Fri, 20 Jan 2023 09:52:16 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so6370496wml.3 for ; Fri, 20 Jan 2023 09:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oIkO5gx/n6pvdASc/nUcxO9v2oX9ajTXxRa/fHrC1iw=; b=EfH8CCMDzmm1bTRKeFTIov4kfsWe7s938mLZT9qtCqcj12h6hVJR22yPWg2ePHluSc FzVMs/VLuaYku5u93/kmUgo9J1m37jC8n/Xno8P0Ds2t4upKoUM9Hgrr0PZevxd/ol7C 1qrR6Inc0z2qaBh/BS+EriD8ufJphDV/rAyb3n5hdTAoiZmKZUdvH4hDFJzj4PUAQ8c/ bAo5ZHxjuWbyqzXKaiuyfo60cM7wqL2ftBFohSaVUtiRyvPbrzFDiIWy8DnAqGfpJBRq nigiIVygMg8NsZMG9pS5rvU4BrmS7XAbqTZqgwhEoBgiape/wlQ7pcd+1BR6qxzSJVAJ aLhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oIkO5gx/n6pvdASc/nUcxO9v2oX9ajTXxRa/fHrC1iw=; b=MDD7ujhzZGFPZ2dRLeUo6tBC2njcH6Q/c3TfOlF9H1unPjFy46K/mPs0nQQGABu9eG MJcgwwTa85rCPyCRdTLTLjLrFJbo7wcDXRNMUDDCvbdvsXfFxEvjVQRYXTKtVof4Io7I W1xpZHDX4lWdoguBkZtywUw7LziTDByN3VMwBwvsc7USCpOb8L7jaEdpX3vq4pA94pjU v9t2pg5ANzDhzROL5iecptcM62ETqlGl302OVvcMQq0/QVV06UzvIvQ+FMyhWFB/DhYd kRKsWZkvxrZ7Di9Y62nrZbjR3TIlymT5bQEAYRxSZN2jFWR2sClYFYSArwvx90QiaKeh g3Uw== X-Gm-Message-State: AFqh2kqrXDsuP3d5c8tWgK9cSEEE5mCfPKWIuAg5P0V2p7EkQv2T91So 3KvS34pILTMWwBMvHCjOBi8HNA== X-Received: by 2002:a05:600c:4d06:b0:3da:f0a:83d7 with SMTP id u6-20020a05600c4d0600b003da0f0a83d7mr14851108wmp.8.1674237134886; Fri, 20 Jan 2023 09:52:14 -0800 (PST) Received: from [192.168.1.109] ([178.197.216.144]) by smtp.gmail.com with ESMTPSA id n42-20020a05600c3baa00b003d96efd09b7sm3732949wms.19.2023.01.20.09.52.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Jan 2023 09:52:14 -0800 (PST) Message-ID: <87005399-4cef-c705-24ee-11ed49071ddc@linaro.org> Date: Fri, 20 Jan 2023 18:52:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: [PATCH] memory: renesas-rpc-if: Remove redundant division of dummy Content-Language: en-US To: Wolfram Sang , linux-renesas-soc@vger.kernel.org Cc: Mark Brown , Sergei Shtylyov , linux-kernel@vger.kernel.org References: <20230112090655.43367-1-wsa+renesas@sang-engineering.com> From: Krzysztof Kozlowski In-Reply-To: <20230112090655.43367-1-wsa+renesas@sang-engineering.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/01/2023 10:06, Wolfram Sang wrote: > From: Cong Dang > > The dummy cycles value was wrongly calculated if dummy.buswidth > 1, > which affects QSPI, OSPI, HyperFlash on various SoCs. We're lucky in > Single SPI case since its dummy.buswidth equals to 1, so the result of > the division is unchanged > > This issue can be reproduced using something like the following commands > A. QSPI mode: Mount device with jffs2 format > jffs2: CLEANMARKER node found at 0x00000004, not first node in block (0x00000000) > > B. QSPI mode: Write data to mtd10, where mtd10 is a parition on SPI Flash > storage, defined properly in a device tree > > [Correct fragment, read from SPI Flash] > > root@v3x:~# echo "hello" > /dev/mtd10 > root@v3x:~# hexdump -C -n100 /dev/mtd10 > 00000000 68 65 6c 6c 6f 0a ff ff ff ff ff ff ff ff ff ff |hello...........| > 00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > > [Incorrect read of the same fragment: see the difference at offsets 0-3] > > root@v3x:~# echo "hello" > /dev/mtd10 > root@v3x:~# hexdump -C -n100 /dev/mtd10 > 00000000 00 00 00 00 68 65 6c 6c 6f 0a ff ff ff ff ff ff |....hello.......| > 00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| > > As seen from the result, 4 NULL bytes were inserted before the test data. > Wrong calculation in rpcif_prepare() led to miss of some dummy cycle. A > division by bus width is redundant because it had been performed already > in spi-rpc-if.c::rpcif_spi_mem_prepare() > > Fix this by removing the redundant division. > > Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver") > Signed-off-by: Cong Dang > Signed-off-by: Hai Pham > Signed-off-by: Wolfram Sang > --- > > Sadly, I cannot test this patch myself because I don't have access to > hardware which uses a buswidth > 1 for the dummy read. However, from > code review, this patch makes sense. The division by buswidth is done > twice, once in the SPI driver and once in the RPC core. It should stay > only in the SPI driver. Any tests or further reviews on this? If not, I'll pick it up in few days. Best regards, Krzysztof