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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C98BFC4332F for ; Tue, 12 Dec 2023 15:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/A5rJX6crWE6SKsynaeG9rRSmZe77E60ysQl7C6CUys=; b=s4cVFvlRJnzTA2 5KFXV8j80dpBz2gpZpNTwEiPwTMw7cQU1AeOeDmU4hnOZ6hXo6UTn3XICjnOyvZMENl/tumLQWt+1 XER1+8uzFeYCqO7S13EtawZ6dv2E+1J2mAbR/6E0KuIRyOpDgYj0Iu2YpCXspO45lwOKq/s+05V7j OQ+EaKFsaSK7BgTUYLYAX8LCE+0VcotT5wMyCZOzwp+vzN7zdrrgF+6wproBMafMB0tuHz6cPeCte raGv6Psn5AMSTrIMbTTl/caV0bwU1enOQ2xeVIu/LpTp5zWoKhWsA3ffS9BxqKeSV0C9OEFv1eMRl XthzOS/aOIb5w+TQZrsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rD4HS-00BzSW-2k; Tue, 12 Dec 2023 15:02:42 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rD4HN-00BzR8-19 for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2023 15:02:39 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50bf2d9b3fdso7641192e87.3 for ; Tue, 12 Dec 2023 07:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702393355; x=1702998155; darn=lists.infradead.org; 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=SJSaOj/O3sNlbMjuItblJHTlzvK1I9vT1qpvbGVa2tk=; b=GGAjSn8qjoD7b3gtF3hH9t/zFNoVq5t8Gt3t/bst8ucaY4E9oWXRUkBoMc/+usiGV2 7XM7A4VDG/TPLxrBkgyyEYVUfUvf5ZIp3kETW1Qd2/1GVzsYuxQe10lFF06tEC3dEZSY p2+EGLUf6KP339ZCCebON1Dkvc4vrpF1ZqHy8xqyKlYErMhmeleKFoon9s6Kni/0s8rc BADwSmOwg+P8tx991J3Wi3hVG2o2gHmAaRilJoxlmfON6paPWj2yUfrhMdhKb/7/kFB5 xuKXcSEwLcaxjdA54EKqIJy9qjjlpo9PzKFYFnapcyXUNSyI5Bjo88zo8LOpj3PAA3wp Dy6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702393355; x=1702998155; 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=SJSaOj/O3sNlbMjuItblJHTlzvK1I9vT1qpvbGVa2tk=; b=EyeoMXC+Lyd0pv9T+7OfhROuUmToPhK6Mp6fKn2Z7desLIVv94dT8cxJqS/2BD/Jqb VoA2u21JGvTEUJYXNkhwlgE/LDGR6EnqWIQkzkz4qHsEvNzg0iP2uu5qRQdoauta5x6J WtS5yQcFnlOBXjoPDIqPKZWiJs8R/176VpN7M8IsmZxCUMnwU58xKaUbiOWBgFGMmVq4 OK5OZ/HalMFG+UxIPtHtdVgIjW+rmzF87dlNzPdLtmgPfOCQGag4ohv7CNsE73rK0nJf VjCAsbIIeIJh/WnuDGoiw7bb3Dg2i6HB6vA3HNxidNzmpbpZJP/Gbdw1guknIyvWKDqv x8eg== X-Gm-Message-State: AOJu0Yw/DFvP/SI+o7EJ4n6OYKL2SEY3XM1lOTyxld656rwUoHCihBlX vcBvgwmzNImXOMecZVeBJy/jsQ== X-Google-Smtp-Source: AGHT+IEQrTt5tPm83DHZ6HyQKpuEeSOXvUyNiD23wBW25lvvmAykVrQcO2UewxP10LZ8abWJJdsapw== X-Received: by 2002:a05:6512:3a90:b0:50d:23e4:fe9c with SMTP id q16-20020a0565123a9000b0050d23e4fe9cmr3279122lfu.64.1702393354454; Tue, 12 Dec 2023 07:02:34 -0800 (PST) Received: from [192.168.2.107] ([79.115.63.202]) by smtp.gmail.com with ESMTPSA id v10-20020a170906564a00b009fea232316bsm6343831ejr.193.2023.12.12.07.02.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Dec 2023 07:02:33 -0800 (PST) Message-ID: Date: Tue, 12 Dec 2023 15:02:31 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 07/10] mtd: spi-nor: Add stacked memories support in spi-nor Content-Language: en-US To: "Mahapatra, Amit Kumar" , "broonie@kernel.org" , "pratyush@kernel.org" , "miquel.raynal@bootlin.com" , "richard@nod.at" , "vigneshr@ti.com" , "sbinding@opensource.cirrus.com" , "lee@kernel.org" , "james.schulman@cirrus.com" , "david.rhodes@cirrus.com" , "rf@opensource.cirrus.com" , "perex@perex.cz" , "tiwai@suse.com" References: <20231125092137.2948-1-amit.kumar-mahapatra@amd.com> <20231125092137.2948-8-amit.kumar-mahapatra@amd.com> <5a6f6764-6779-42b0-b6c6-3f638b85ef78@linaro.org> From: Tudor Ambarus In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231212_070237_395274_8CCCDDA7 X-CRM114-Status: GOOD ( 26.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "git \(AMD-Xilinx\)" , "alexandre.belloni@bootlin.com" , "alsa-devel@alsa-project.org" , "patches@opensource.cirrus.com" , "amitrkcian2002@gmail.com" , "linux-sound@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "michael@walle.cc" , "linux-mtd@lists.infradead.org" , "claudiu.beznea@tuxon.dev" , "linux-spi@vger.kernel.org" , "Simek, Michal" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/11/23 13:37, Mahapatra, Amit Kumar wrote: Hi! cut >>>>>>> drivers/mtd/spi-nor/core.c | 272 >>>>>>> +++++++++++++++++++++++++++++----- >>>> -- >>>>>>> drivers/mtd/spi-nor/core.h | 4 + >>>>>>> include/linux/mtd/spi-nor.h | 15 +- >>>>>>> 3 files changed, 240 insertions(+), 51 deletions(-) >>>>>>> >>>>>>> diff --git a/drivers/mtd/spi-nor/core.c >>>>>>> b/drivers/mtd/spi-nor/core.c index 93ae69b7ff83..e990be7c7eb6 >>>>>>> 100644 >>>>>>> --- a/drivers/mtd/spi-nor/core.c >>>>>>> +++ b/drivers/mtd/spi-nor/core.c >>>>>> >>>>>> cut >>>>>> >>>>>>> @@ -2905,7 +3007,10 @@ static void spi_nor_init_fixup_flags(struct >>>>>>> spi_nor *nor) static int spi_nor_late_init_params(struct spi_nor >>>>>>> *nor) { >>>>>>> struct spi_nor_flash_parameter *params = spi_nor_get_params(nor, >>>>>> 0); >>>>>>> - int ret; >>>>>>> + struct device_node *np = spi_nor_get_flash_node(nor); >>>>>>> + u64 flash_size[SNOR_FLASH_CNT_MAX]; >>>>>>> + u32 idx = 0; >>>>>>> + int rc, ret; >>>>>>> >>>>>>> if (nor->manufacturer && nor->manufacturer->fixups && >>>>>>> nor->manufacturer->fixups->late_init) { @@ -2937,6 +3042,44 >>>>>>> @@ static int spi_nor_late_init_params(struct spi_nor *nor) >>>>>>> if (params->n_banks > 1) >>>>>>> params->bank_size = div64_u64(params->size, params- >>>> n_banks); >>>>>>> >>>>>>> + nor->num_flash = 0; >>>>>>> + >>>>>>> + /* >>>>>>> + * The flashes that are connected in stacked mode should be >> of >>>>>>> +same >>>>>> make. >>>>>>> + * Except the flash size all other properties are identical for all >> the >>>>>>> + * flashes connected in stacked mode. >>>>>>> + * The flashes that are connected in parallel mode should be >> identical. >>>>>>> + */ >>>>>>> + while (idx < SNOR_FLASH_CNT_MAX) { >>>>>>> + rc = of_property_read_u64_index(np, "stacked- >> memories", >>>>>> idx, >>>>>>> +&flash_size[idx]); >>>>>> >>>>>> This is a little late in my opinion, as we don't have any sanity >>>>>> check on the flashes that are stacked on top of the first. We shall >>>>>> at least read and compare the ID for all. >>>>> >>>>> Alright, I will incorporate a sanity check for reading and comparing >>>>> the ID of the stacked flash. Subsequently, I believe this stacked >>>>> logic should be relocated to spi_nor_get_flash_info() where we >>>>> identify the first flash. Please share your thoughts on this. >>>>> Additionally, do you >>>> >>>> I'm wondering whether we can add a layer on top of the flash type to >>>> handle >>> >>> When you mention "on top," are you referring to incorporating it into >>> the MTD layer? Initially, Miquel had submitted this patch to address >> >> I mean something above SPI MEM flashes, be it NOR, NANDs or whatever. >> Instead of treating the stacked flashes as a monolithic device and treat in SPI >> NOR some array of flashes, to have a layer above which probes the SPI MEM >> flash driver for each stacked flash. In your case SPI NOR would be probed >> twice, as you use 2 SPI NOR flashes. >> >>> stacked/parallel handling in the MTD layer. >>> https://lore.kernel.org/linux-mtd/20200114191052.0a16d116@xps13/t/ >>> However, the Device Tree bindings were initially not accepted. >> >> Okay, thanks for the pointer. I'll take a look. haven't yet read the thread from above, but I skimmed over the AMD controller datasheet. >> >>> Following a series of discussions, the below bindings were eventually >>> merged. >>> https://lore.kernel.org/all/20220126112608.955728-4-miquel.raynal@boot >>> lin.com/ >> >> I saw, thanks. >> >>> >>>> the stacked/parallel modes. This way everything will become flash >>>> type independent. Would it be possible to stack 2 SPI NANDs? How >>>> about a SPI NOR and a SPI NAND? >>>> >>>> Is the datasheet of the controller public? >>> >>> Yes, >>> https://docs.xilinx.com/r/en-US/am011-versal-acap-trm/Quad-SPI-Control >>> ler >>> >> >> Wonderful, I'll take a look. I see two clocks there. Does this mean that the >> stacked flashes can be operated at different frequencies? Do you know if we > > In stacked configuration, both flashes utilize a common clock (single > clock line). In a parallel setup, the flashes share the same clock but > have distinct clock lines. Please refer the diagrams in the sections > below for reference. > https://docs.xilinx.com/r/en-US/am011-versal-acap-trm/QSPI-Flash-Interface-Diagrams Thanks! Can you share with us what flashes you used for testing in the stacked and parallel configurations? >> can combine a SPI NOR with a SPI NAND in stacked configuration? > > No, Xilinx/AMD QSPI controllers doesn't support this configuration. > 2 SPI NANDs shall work with the AMD controller, right? I skimmed over the QSPI controller datasheet and wondered why one would get complicated with 2 Quad Flashes when we have Octal. But then I saw that the same SoC can configure an Octal controller (the Octal and Quad controllers seems mutual exclusive) and that the Octal one can operate 2 octal flashes in stacked mode :). Cheers, ta _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel