Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp393803rdb; Fri, 6 Oct 2023 06:48:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH51exbmq91dwQg+W7e0aBgEL6jt1UHjSz+Iwyb5W+sNwlrQsJarMy+Gi5v2KOrePAn4PXs X-Received: by 2002:a17:902:ea0a:b0:1bb:598a:14e5 with SMTP id s10-20020a170902ea0a00b001bb598a14e5mr10208495plg.43.1696600138099; Fri, 06 Oct 2023 06:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696600138; cv=none; d=google.com; s=arc-20160816; b=nuKKmbsNbqrAYz5Nc9kpUNzioO9cfSee0YnDcCpdTqTFfj2KszIfXtd9D6pIGsK0XO jqDAvB0mS7Z95oGOPnkevaV7j7FAdxj1bu5oma02ZdXRzL4Njm8h2W41i+l4GGyze/Av gMRzxHN6+Pp6e6CHp3QPzYHnIlM9791v58Qy8GFx9jcpoGJDOmQ/4NW6mEI1X4OByfkm Vy3TLb6ninl72Of6QcFwNyQcF4JOu9jR0iwgn472cN1HrshVtrLsBuJSAs5r7XYJET/1 KZ2SCLG7Kbcr8C+uhJz9ecQbXohr7f52/jxNejiLsYQrUjATW+nEEvEKuU6wKzwJwuZd o6NA== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=4Kbdufx+AHXJ7bO+V5r5LajhsEMCAIPjaRpknMjUD+4=; fh=10nPb+rxtC90e+ompWiia9JfnPLWb6MR6Ufb5oi62i4=; b=GW5Qly6DncTV5QEfKfMORsddtx1T6IzgbawbWyAQnklIy2Rbfkgge7ewUbGMnAETtI +ziYhcJZNoMmQGt+ab+HjJTmP/bI7/CQDihDBegSb6N4Qpx7Wr+zIadPrdf27tqqPXhp iw9R+YV5ArDx4Vv5OTcmHEj1SsypXGHhz7nQfgiCvzQZttUfzssdjaz2AJg7QK6Uyd5H cNupkaPSIwXy2I8Z0NGV0Nj+8ryS/wn4VNtKQLYgFz8WvG/xFnVczqknCbyCC7KcMq2Y JTyhXMND9nYryGBV3h0WU65wAb0I43U7ULOZJLhitNvy5z3tva+24FBfH+QMT93zSe1n fIow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tKtfW6F7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id p7-20020a170902e74700b001c3411c9b83si4049863plf.454.2023.10.06.06.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tKtfW6F7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6322380B2882; Fri, 6 Oct 2023 06:48:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232586AbjJFNsU (ORCPT + 99 others); Fri, 6 Oct 2023 09:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232609AbjJFNsF (ORCPT ); Fri, 6 Oct 2023 09:48:05 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA647D6D for ; Fri, 6 Oct 2023 06:46:55 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-99bdcade7fbso377661366b.1 for ; Fri, 06 Oct 2023 06:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696600014; x=1697204814; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4Kbdufx+AHXJ7bO+V5r5LajhsEMCAIPjaRpknMjUD+4=; b=tKtfW6F7BoL+r/nNs/tQ5QZoB1nKnth+/6UzJglFob9m2Yb9x4aEK2HtKhrvxcff9k pdlBnFMrTgqyXMIdqBxUP60gLFwZYdf8EeX7Xy5Ki7OL9V+JssL14W0n0JZJzVHl8r6p A6Y95KZA1rlbDsOmZb9xV0qvzrGJho+mrTRcwF/ExmrXkqUfESTVUB/1sK6Ttyfhbaez XneQoH2UwW3BDYfTnAvI0UUEsF8k/Rt/xhnS+ZjtrL4CxgkwNJguWJ68YwXA1jBw/RkK yzTgJFt5lcuDHYoxPxkfpob432J9giCfL5z27pXXM87n7pGSSW7Caad7forHVWWhrx1x DTrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696600014; x=1697204814; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4Kbdufx+AHXJ7bO+V5r5LajhsEMCAIPjaRpknMjUD+4=; b=K1I5NS026z8nA/4xKBiOfuVtfVIpjckhN1198MSdcayAeYH8v75i45ANp8KFJZVYsN jat7UdZ6VEjGprgwlhKyp53Inv/YFNJBq/g0c92dbPtMkp6vZF6JDyKsPjUI6alUrSrv UrTipTpd3c+wwdBjivzTmJzJUtbCFBrgiBMg5ncXXLR+XAm1Kc04tAXIm0kROxPcT59w EPA9EXbqv53vLdyFL0hL+6MsqMjOzY2XuVWpjXePMR5by1cidhcw/RQU/p/5CLk1VmyH jzsH0+BqYC7mBVXaFMJvU7mHQbo/VVE1LLEdVleCneU8IJSzkLew9Q1Z//jJvjE7CoC2 uEJQ== X-Gm-Message-State: AOJu0YzhTfwcRvYYmw8WrexkWrDYVo6y1vHwo3J7mAJthQhBgoc+qpsx 1h7tS9kWgYl7ohFg8ruz35iZww== X-Received: by 2002:a17:906:301a:b0:9a5:b814:8254 with SMTP id 26-20020a170906301a00b009a5b8148254mr7494241ejz.24.1696600013816; Fri, 06 Oct 2023 06:46:53 -0700 (PDT) Received: from [192.168.2.107] ([79.115.63.123]) by smtp.gmail.com with ESMTPSA id x26-20020a170906711a00b0099329b3ab67sm2918398ejj.71.2023.10.06.06.46.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Oct 2023 06:46:53 -0700 (PDT) Message-ID: Date: Fri, 6 Oct 2023 14:46:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] mtd: micron-st: enable lock/unlock for mt25qu512a Content-Language: en-US From: Tudor Ambarus To: SHUKLA Mamta Ramendra , "pratyush@kernel.org" , "michael@walle.cc" , "miquel.raynal@bootlin.com" , "richard@nod.at" , "vigneshr@ti.com" , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" Cc: GEO-CHHER-bsp-development References: <20230705154942.3936658-1-mamta.shukla@leica-geosystems.com> <19800e51-a871-be9f-9eb5-5829237e2613@linaro.org> <084ed945-7674-280f-5866-9238473a294d@leica-geosystems.com> <17989610-d069-40e2-9b4d-7ca6bdf2497e@linaro.org> <2d7271b3-dd60-44bb-9700-f6a5295ea873@linaro.org> <372046cb-9135-9a6c-fdb7-307a42f55b30@leica-geosystems.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 06 Oct 2023 06:48:55 -0700 (PDT) X-Spam-Level: ** On 10/6/23 14:33, Tudor Ambarus wrote: > > Hi, > > Thanks for the debugging info. > > On 10/6/23 11:30, SHUKLA Mamta Ramendra wrote: > > cut > >> -------------------------------------------------------- >> >> IMO, HAS_16BIT_SR flag is causing lock/unlock failure, >> since BP bits are calculated wrong then. >> >> I tested also for a case where I don't parse SFDP and >> reverted the condition in micron_st_nor_default_init() >> for 16BIT Status Register Flag. And lock/unlock fails with >> same log as Non-working case. >> >> And this mt25qu512 has 8-BIT SR as typical micron-st flash. >> > > Indeed, the problem is that HAS_16BIT_SR gets set when it shouldn't have > to. This means that the BFPT table of the flash is wrong and we should > fix the parsed settings via a post_bfpt hook. > > Does the following fix your problem? > here it is again, this time compile tested: diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c index 4afcfc57c896..20f76e278095 100644 --- a/drivers/mtd/spi-nor/micron-st.c +++ b/drivers/mtd/spi-nor/micron-st.c @@ -180,6 +180,18 @@ static const struct flash_info micron_nor_parts[] = { }, }; +static int mt25qu512a_post_bfpt_fixup(struct spi_nor *nor, + const struct sfdp_parameter_header *bfpt_header, + const struct sfdp_bfpt *bfpt) +{ + nor->flags &= ~SNOR_F_HAS_16BIT_SR; + return 0; +} + +static struct spi_nor_fixups mt25qu512a_fixups = { + .post_bfpt = mt25qu512a_post_bfpt_fixup, +}; + static const struct flash_info st_nor_parts[] = { { .name = "m25p05-nonjedec", @@ -405,10 +417,10 @@ static const struct flash_info st_nor_parts[] = { }, { .id = SNOR_ID(0x20, 0xbb, 0x20, 0x10, 0x44, 0x00), .name = "mt25qu512a", - .size = SZ_64M, - .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, - .fixup_flags = SPI_NOR_4B_OPCODES, + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | + SPI_NOR_BP3_SR_BIT6, .mfr_flags = USE_FSR, + .fixups = &mt25qu512a_fixups, }, { .id = SNOR_ID(0x20, 0xbb, 0x20), .name = "n25q512a", cut > If yes, please add some prints in sfdp.c to determine where it's set, > either in BFPT_DWORD15_QER_SR2_BIT1 or BFPT_DWORD15_QER_SR2_BIT1_NO_RD > > Is the datasheet for this flash public? Would you send me a link to it > please? > > Cheers, > ta