Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6246938iob; Tue, 10 May 2022 13:53:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZgy3kzxnh3SFiami8EBH+jVgD0mDou87UN+zj5lqwGpa/s1DGGKrbwEOOKT6kwVougE2Y X-Received: by 2002:a05:6402:3509:b0:427:e7db:1513 with SMTP id b9-20020a056402350900b00427e7db1513mr25153853edd.407.1652216021601; Tue, 10 May 2022 13:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652216021; cv=none; d=google.com; s=arc-20160816; b=U7xJGH9esiyEgAPRDVGagKAKCxnEDVUGxrM0pJCAT1KaFlpo06yKnfgXWR1W2CucJT xI2SagOpRo2I5QWKSf28vJhOSsONeepGN8CPTEVKdvo59/kjTW3KEriObUjD5omno/qm y5wrez0ddQDBSg0SkDSdOt/msuoPi/FJu6LDlAUNIKzBRbcXWejhaYi4nrOF4NFoLdDO UnIC8FSTMAA8rPWvczoRB3JRwbvvims3GRJ+uU6Rj+CxaRwXfmJprNP92fBR3cMlKcfg lsOVtioJgX/3654Si/uB5SGQyBhnxqsPzKMjp/7kKCGT5daOI6WCbS9iHBvD5aA657LG X0+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=MAMluAWKintqA1HsqZ0+rRZBUqhaKw3r86HTFWznY5U=; b=oSWg4CuO7058mIbtUzDPL+gNOvvQWkTfEIiiq8AJNi3lkCq62iuRIWDGskKqkpOjgr SmmFvmNI+5adpqYUBIxFhnIK4kmwWemShskk6Oa+e2mIQGOvJM3W6aYRKyFt50f7Eyel K/MHKuy9N8/SgGv6MuN4yw7l6MvLyd+gCViNs+aR55nk8660n5/sErwDt/kJTNP/18VU 9Zt73B29UUXYDGcN/VWFsTeE22AlkJJb+lGuJZobQVbhM9gqd+jRXgEDHsNreVWERPcT sTgMCKAjOnDd8VYZJiGlQslW1pMYanVX13e3H2cH9DQJnPmYFHHU+cSydX9KF6FQxNrS doIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=B+iUHM3+; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gz12-20020a170906f2cc00b006efef30bd26si373560ejb.47.2022.05.10.13.53.17; Tue, 10 May 2022 13:53:41 -0700 (PDT) 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=@walle.cc header.s=mail2016061301 header.b=B+iUHM3+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344861AbiEJOpx (ORCPT + 99 others); Tue, 10 May 2022 10:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344327AbiEJOof (ORCPT ); Tue, 10 May 2022 10:44:35 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 813171A6ADB for ; Tue, 10 May 2022 07:02:39 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 6CE0222238; Tue, 10 May 2022 16:02:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1652191357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=MAMluAWKintqA1HsqZ0+rRZBUqhaKw3r86HTFWznY5U=; b=B+iUHM3+LJwbo8pibqOVNP85Fc6l9auZlcceatGQKKTPcUdKaJ3qaOGzX4YBq6JPmLuljJ uPdR01FK54X07X3OAwJ0u4tpzNjcstxhisR2sgY0uA8gqxzhBMzjf/MXwFUEhvPhV0FxaW aXIrBzEaVGNFvu6gDFyfj4ouv3SiouQ= From: Michael Walle To: Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Shaik Sajida Bhanu Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH 0/2] introduce SNOR_ID3() Date: Tue, 10 May 2022 16:02:30 +0200 Message-Id: <20220510140232.3519184-1-michael@walle.cc> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 For support which rely solely on the SFDP data, all we need to know is its JEDEC ID. All further information should be fetched from SFDP. For this, introduce a SNOR_ID3() macro which should be used for all new flashes with SFDP. The dropped information are page size, number of sectors and sector size. The number of sectors (together with sector size) is only used to calculate the total flash size. In case of SFDP, this is read from there. The sector size is also used to select a proper erase opcode. We can just keep that one zero and the selection algorithm will select the same erase opcode; that is the opcode for the largest erase size (which is btw rather odd..). The page size is also taken from SFDP. There is one exception: older SFDP tables. These doesn't contain this data. So if there will be flashes with that, we should assume some sane value. Shaik, could you please re-test your w25q512nwm support with this patch. I read through the SFDP data and it should behave exactly the same as before. Michael Walle (2): mtd: spi-nor: introduce SNOR_ID3() mtd: spi-nor: winbond: use SNOR_ID3() for w25q512nwm drivers/mtd/spi-nor/core.c | 7 +++++-- drivers/mtd/spi-nor/core.h | 9 +++++++++ drivers/mtd/spi-nor/winbond.c | 3 +-- 3 files changed, 15 insertions(+), 4 deletions(-) -- 2.30.2