Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3535492pxb; Sun, 20 Feb 2022 23:29:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZIkKtoNLg+In2eYz7CltsHzDH/XoHzr8Os5VIwkPTeOOHrWJgiT+DKzfiO8Z4M4yOi901 X-Received: by 2002:a50:cd59:0:b0:410:ac25:e570 with SMTP id d25-20020a50cd59000000b00410ac25e570mr19473706edj.252.1645428595454; Sun, 20 Feb 2022 23:29:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645428595; cv=none; d=google.com; s=arc-20160816; b=jSlR1SPvKHoI/wUcu+U86Px1whfpYrsS9EpJqZ3AUB+YbyrdWKShLBLPzWMAiGNmbq W735xcWQvA3p8juz2mg8TkoaZxp0SR/qb00ZEgfQ2eKkRVx1gwr8hOwK+BtQI/NFSKjB e5/2URKh654hQtlRBXe1h1vCyGsiNpKSHLG+Sg0HssvxWQ+zleUZnsc9ClehCldO0ZiL LQekS+5iISKUWYo54e1wyxqfHAcjguCFpbEGcnqcFKLma4a/ZdjiahQsxgtRwnVR7iOv uvfEfP9RhDNkvH54ntM0lKm8VHNKyalOGd5XjYsfySYAAHSmdXYhfR2OtxRLwfLHJO33 DZdQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xVb0fT1MGhcBbhhTafWv2pABvtbVRcxp+NDQSOBSHBI=; b=B1+eh6ea4Xt/LcCqHawdNeQdozNFZzmnKgp43ATQ2oya2OXom28eFIGlLTqUxBZ8Ux uj+0S5D+knVJzH20cXBKVSwdmbHvCUYdaS1/9D+EjwfME1PG1a/JglW4+zL/XLbKT/Hl EDHUiT3QAAuASTJzeXrFDnzDd1Sl95WGnCXlS9icp2U8HnpTFoGyCc6KZa5aBAQ1Q1We 6Q10EOnymn1jEVnv2R90e0To226iRqlKdDG2rSqm03klJ3BMuRfVISGwfRUwvoteURzs Z9C7udbvyhOT2dOBgC7h39wm3yky0kqlZaoWUC8CT54VQBArV13oBrF6BhUbDvgQ7OcO KnMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vrUhGbzW; 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 sa40si10815551ejc.746.2022.02.20.23.29.33; Sun, 20 Feb 2022 23:29:55 -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=vrUhGbzW; 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 S239491AbiBTPPI (ORCPT + 99 others); Sun, 20 Feb 2022 10:15:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239167AbiBTPPF (ORCPT ); Sun, 20 Feb 2022 10:15:05 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8033734B97 for ; Sun, 20 Feb 2022 07:14:44 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id o34so8141574wms.1 for ; Sun, 20 Feb 2022 07:14:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xVb0fT1MGhcBbhhTafWv2pABvtbVRcxp+NDQSOBSHBI=; b=vrUhGbzWYj9b0IvENuCjMtgDybie2NNldRu/4ngPcWe+XGiXsvwrMpfRvcEvVaP3Ps UJCnKFn+dmvzzjzM9JLBxemtS6FsgvCHYfZREBuBx/aqs/U3r5TPjSNoTAKTbxtQiz0P rIqhmznel+D2xTurkav2gDEPUIjJD0xed1eMPjEWnQIAZKgUMcyViX3CnyU0sxGV1osN r7/KYIk39sxKnmLKQwUvUcGs7WAmYh3m3M+tVqfhecNSCZXoiOM93tTofC/Ot/xWh5k1 d1xruKTiXtp7GXbKUN/vn6p1xgYvC70uJ0zCsrWLsh4iLxMybafTJBLgxOZdU+XDmrY1 rGkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xVb0fT1MGhcBbhhTafWv2pABvtbVRcxp+NDQSOBSHBI=; b=6th8joYNI/rik54BntjfWrBtI2hNgjaNn3AxJWxCVjowVHGPsP+5PcIjjbWdqKdMTn xycKCLR/CZSZ5Ygl4DHsWbwibWpnCdJ3USe8/ICAzT7V5RrVuDUYvyug4kOBWPJPjr+q Svhoiln5XnT/9J+GDxYa8dzpLRr3hW8w4xbQMDN1/Zi9C2rVaKOCUEXZH67bA0R8SVzs 4ciUtunwzGNEdpqJjfUA3bAtg9//K1dy2dJ1gLVk7BefKD2zl7l4gSTc18LZ0GV2JkXG cw8D3XOvGQyXrnUFOKRmMKX0S+PvC4op/C6+IufbDLBi5q1padbPNBNwF1Jywt79/uX3 N6kQ== X-Gm-Message-State: AOAM533XFIlbugWIYoXb0+1HhtGIUyDieb+jA2TeNQQuysJrf2HPRPoA ojPabPMDDab+wY9LSWj3xQwx3Q== X-Received: by 2002:a7b:c74e:0:b0:37b:9785:fbe5 with SMTP id w14-20020a7bc74e000000b0037b9785fbe5mr14373492wmk.54.1645370078205; Sun, 20 Feb 2022 07:14:38 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id d6sm46703322wrs.85.2022.02.20.07.14.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 07:14:37 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Christophe Kerello , stable@vger.kernel.org, Miquel Raynal , Srinivas Kandagatla Subject: [PATCH 2/2] mtd: core: Fix a conflict between MTD and NVMEM on wp-gpios property Date: Sun, 20 Feb 2022 15:14:32 +0000 Message-Id: <20220220151432.16605-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220220151432.16605-1-srinivas.kandagatla@linaro.org> References: <20220220151432.16605-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Christophe Kerello Wp-gpios property can be used on NVMEM nodes and the same property can be also used on MTD NAND nodes. In case of the wp-gpios property is defined at NAND level node, the GPIO management is done at NAND driver level. Write protect is disabled when the driver is probed or resumed and is enabled when the driver is released or suspended. When no partitions are defined in the NAND DT node, then the NAND DT node will be passed to NVMEM framework. If wp-gpios property is defined in this node, the GPIO resource is taken twice and the NAND controller driver fails to probe. A new Boolean flag named ignore_wp has been added in nvmem_config. In case ignore_wp is set, it means that the GPIO is handled by the provider. Lets set this flag in MTD layer to avoid the conflict on wp_gpios property. Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin") Signed-off-by: Christophe Kerello Cc: stable@vger.kernel.org Acked-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla --- drivers/mtd/mtdcore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 70f492dce158..eef87b28d6c8 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -546,6 +546,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd) config.stride = 1; config.read_only = true; config.root_only = true; + config.ignore_wp = true; config.no_of_node = !of_device_is_compatible(node, "nvmem-cells"); config.priv = mtd; @@ -833,6 +834,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd, config.owner = THIS_MODULE; config.type = NVMEM_TYPE_OTP; config.root_only = true; + config.ignore_wp = true; config.reg_read = reg_read; config.size = size; config.of_node = np; -- 2.21.0