Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8770C6FD1C for ; Thu, 9 Mar 2023 10:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230449AbjCIKnv (ORCPT ); Thu, 9 Mar 2023 05:43:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbjCIKnL (ORCPT ); Thu, 9 Mar 2023 05:43:11 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D74EC58B4B for ; Thu, 9 Mar 2023 02:42:40 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id t15so1372679wrz.7 for ; Thu, 09 Mar 2023 02:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678358559; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=AXe5GLVgfCGpsOd/5Hq05tqMS28XNylXrDvLRZzzBYk=; b=nBr8nAd36m9PAaXhfYM/4OLaddFdsGqVE33IkJXe836CVY1mwrMaJ0z6xZBf96qoOI wHtu0PFtoKoyIzX+VPr+/fuzdwvpjf7WHn48t+f9zcU6YwYZWztwBuqGj7l0dwdbArgj 9BdJxnMMnENBMqvEWmtN9PjHCRl7l2YExcQXYKyBbziRvao/CePqrt7EvP4HpVtto5VH QXi3YjTFTii/7goIfJr/GTdt68ovUVdmBOWoUiiz0gXw5VAu3RMa5w0b1gBU8OSuUqb4 AEtkZbqFYD4W0WJ0d3IiA/1XF2s9Fl82n7X/PtjFCiLZRgjUzj9Q13c24vjHb1a/yAmF vQrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678358559; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AXe5GLVgfCGpsOd/5Hq05tqMS28XNylXrDvLRZzzBYk=; b=D5PDAK6j15RogACMFEUuz6tNtt6W1YDZvJg8PZ+pkCbMHBnV1teb6INvH+6uNNK2/u wWvELu+WKtAmVQ8nUV74s9RjwPq2mTrCldolMYd1kk1WMpbHIjLqbFZxaQ3RIZSEKgwX YnK2updrzcYiSpgSo0h/+cg1FQjrOrxb4qJSDL5P/SMPDx3Xi8Bq7bL+HxhY8/foj0U2 5z7dSC1tL1Xyt/AnWK4tWt6WWCeESksBP9IPqN/aUeR90oTk5UW+bDBpEPWf1l6JZflu Wh26XnSSH5T21iXV+6zerKfZEBVR/hvwJjqzyBmizjrf3KnJqw3G+uiX62Mo6tDUCSo5 6agw== X-Gm-Message-State: AO0yUKU5KKkbYbYNQ0GztE8bExrnrn/8C1aVugM1E06gbYCDsPG4ZdbA LZorYO5VM+Qfgy9kbPj8t0e8vg== X-Google-Smtp-Source: AK7set9TX+g8GQa3ZvYm7K5IyQckLiVBKmzBF9eqRJS1rvlystpDX78yR8o1b1wUu4lOee+V+S+WMQ== X-Received: by 2002:a05:6000:507:b0:2c5:4f2d:d9b4 with SMTP id a7-20020a056000050700b002c54f2dd9b4mr12687108wrf.58.1678358559301; Thu, 09 Mar 2023 02:42:39 -0800 (PST) Received: from [192.168.0.173] ([79.115.63.78]) by smtp.gmail.com with ESMTPSA id f12-20020a5d58ec000000b002c71b4d476asm17579951wrd.106.2023.03.09.02.42.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Mar 2023 02:42:38 -0800 (PST) Message-ID: <1849e2c8-54f5-9e56-4ed8-8b0e4a826d04@linaro.org> Date: Thu, 9 Mar 2023 12:42:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] spi: Replace `dummy.nbytes` with `dummy.ncycles` To: Michael Walle Cc: Serge Semin , Sergiu.Moga@microchip.com, Mark Brown , Tudor Ambarus , Pratyush Yadav , miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Claudiu.Beznea@microchip.com, chin-ting_kuo@aspeedtech.com, clg@kaod.org, joel@jms.id.au, andrew@aj.id.au, kdasu.kdev@gmail.com, han.xu@nxp.com, john.garry@huawei.com, matthias.bgg@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, haibo.chen@nxp.com, yogeshgaur.83@gmail.com, heiko@sntech.de, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, michal.simek@xilinx.com, bcm-kernel-feedback-list@broadcom.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com References: <20220911174551.653599-1-sergiu.moga@microchip.com> <20220925220304.buk3yuqoh6vszfci@mobilestation> <18e6e8a8-6412-7e31-21e0-6becd4400ac1@microchip.com> <20220926172454.kbpzck7med5bopre@mobilestation> <1766f6ef-d9d8-04f7-a6bf-0ea6bc0b3d23@linaro.org> From: Tudor Ambarus Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09.03.2023 10:38, Michael Walle wrote: >> In an ideal world, where both the controller and the device talk about >> dummy number of cycles, I would agree with you, buswidth and dtr should >> not be relevant for the number of dummy cycles. But it seems that there >> are old controllers (e.g. spi-hisi-sfc-v3xx.c, spi-mt65xx.c, spi-mxic.c) >> that support buswidths > 1 and work only with dummy nbytes, they are not >> capable of specifying a smaller granularity (ncycles). Thus the older >> controllers would have to convert the dummy ncycles to dummy nbytes. >> Since mixed transfer modes are a thing (see jesd251, it talks about >> 4S-4D-4D), where single transfer mode (S) can be mixed with double >> transfer mode (D) for a command, the controller would have to guess the >> buswidth and dtr of the dummy. Shall they replicate the buswidth and dtr >> of the address or of the data? There's no rule for that. > > But in the end that doesn't matter because they are just dummy clock > cycles and the mode will only affect the data/address/command. Therefore, > the controller is free to choose the mode that suits it best. > > But that begs the question, is ncycles in regard to DTR or SDR? That is, > are you counting just one type of edges or both the falling and rising > edges. The smallest granularity would be ncycles in regard of DTR. To me, > it's not obvious what the SEMPER Nano Flash [1] uses. I'd say we choose > the smallest granularty in spi-mem to be future proof and maybe provide > some spi-mem helper to help setting the cycles for SDR/DTR. As an example, > if you want to wait 4 cycles in SDR you'd have ncycles=8 in spi-mem. > No, we can't invent our own measuring units. We have cycles and half cycles (regardless of the transfer mode used (STR, DTR)). > So you won't need the mode nor the dtr property. > > -michael > > [1] > https://www.infineon.com/dgdl/Infineon-S25FS256T_256Mb_SEMPER_Nano_Flash_Quad_SPI_1.8V-DataSheet-v01_00-EN.pdf?fileId=8ac78c8c80027ecd0180740c5a46707a