Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp253999pxa; Tue, 4 Aug 2020 04:58:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx102D+2VbA86z4ZdFapfVN5+qq+BehSpiKUxL6VscUF0wY6yM2sRHoOlKNYKEjluvbVd7f X-Received: by 2002:a05:6402:2379:: with SMTP id a25mr19703649eda.180.1596542296925; Tue, 04 Aug 2020 04:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596542296; cv=none; d=google.com; s=arc-20160816; b=Ecp1dhrXUJlAJ+W3A9DYZybbmo5WDLPCv/GlvJAnJxFVForhO1889+wNL9/71xDTBg Y3kx/wc9dO1USZkZVG9/T/GEz2ZgG3wItHCH1Mfo/dY5HdnIn+js+ZOLG/0vzl6YjnQ9 S6cWWqBROQaUcwXrbhxc1x5KGsoc/RUYPwANbQcBN76b3L82KiY+9V8G1Br6AYLkgVST ZzTeBInOWrHXPXXH8CubbMrTbwFAykbvByRSgPgalPQvdeILwKDI6dsUAKSSfUZaKHK/ N0Yj3kKdiRtyQZ1mX5xpUAMMmNKohxvsIsQ9mwB5koKhs5ayFb5XsGMDXrbrWaZhRcQb i4Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=bsewAvXNXN9Jx+WxICRJzrJnIy0XKWyo6wqhqLUIgb8=; b=HKtZ4gEMvM/XSMl3E8oUThUKhVIvbByvrK6VyUYMDxzYQHOh2/a6PugN1SwtIrlb8c 2Jn3rezYmA+7jbHjvON+nd3+kOyIdAg1JZgmE5RAvm7qO2/iY29lnPo8dAb7PCpqMDK1 ArqjhhdoGltHW6OAnSzsNsTkm2B3F2HjsPejl/8E5sCi4yIOoKHhzFOYRlOF9YBWCoGZ qbXzUWm1Rcj3i04Gm4Ug1qlGMjloyxZ6lCHxE3AS2+fG6wrS2jSmfUlTV0pP+Y0mL4k8 E19RVQXGByavXBe381NJj8/YbW4W/4vQ0P5qyiPYSeBhc6lMpA7KHbDuYZwdDzJy3Bqx 15EQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lh27si12810425ejb.545.2020.08.04.04.57.43; Tue, 04 Aug 2020 04:58:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728157AbgHDL4F (ORCPT + 99 others); Tue, 4 Aug 2020 07:56:05 -0400 Received: from mga01.intel.com ([192.55.52.88]:36354 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730358AbgHDLyk (ORCPT ); Tue, 4 Aug 2020 07:54:40 -0400 IronPort-SDR: yvhls4l+eb1tRfZb2WlfJmaCYQ61KW0wJd/jjGSEIdo1UoW/CfzqOAumjtbMw0CnkyOweMDGDT uozNiaRLwxYg== X-IronPort-AV: E=McAfee;i="6000,8403,9702"; a="170378366" X-IronPort-AV: E=Sophos;i="5.75,433,1589266800"; d="scan'208";a="170378366" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2020 04:52:39 -0700 IronPort-SDR: 5j8lkSutCNkcZJP6Z22txQhbEEyybEd3JikPty+wtafuTyns5+9QrI47aQw9fxslKMosrmzW2t GxfCGB2fWp8g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,433,1589266800"; d="scan'208";a="396550686" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.163]) by fmsmga001.fm.intel.com with SMTP; 04 Aug 2020 04:52:34 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 04 Aug 2020 14:52:33 +0300 Date: Tue, 4 Aug 2020 14:52:33 +0300 From: Mika Westerberg To: Daniel Gutson Cc: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bazhaniuk , Richard Hughes , Arnd Bergmann , Greg Kroah-Hartman Subject: Re: [PATCH] Remove attempt by intel-spi-pci to turn the SPI flash chip writeable Message-ID: <20200804115233.GO1375436@lahna.fi.intel.com> References: <20200803134449.72502-1-daniel.gutson@eclypsium.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200803134449.72502-1-daniel.gutson@eclypsium.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, Aug 03, 2020 at 10:44:49AM -0300, Daniel Gutson wrote: > Currently, the intel-spi-pci driver tries to unconditionally set > the SPI chip writeable. After discussing in the LKML, the original > author decided that it was better to remove the attempt. > > Context, the intel-spi has a module argument that controls > whether the driver attempts to turn the SPI flash chip writeable. > The default value is FALSE (don't try to make it writeable). > However, this flag applies only for a number of devices, coming from the > platform driver, whereas the devices detected through the PCI driver > (intel-spi-pci) are not subject to this check since the configuration > takes place in intel-spi-pci which doesn't have an argument. > > This patch removes the code that attempts to turn the SPI chip writeable. I think you should make the $subject to follow the convention used in the SPI-NOR subsystem. You can see it running following command: $ git log --oneline drivers/mtd/spi-nor/controllers/intel-spi-pci.c In this case I think it should be: mtd: spi-nor: intel-spi: Do not try to make the SPI flash chip writable or something like that. The patch itself looks good, one minor comment below. > > Signed-off-by: Daniel Gutson > --- > drivers/mtd/spi-nor/controllers/intel-spi-pci.c | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/drivers/mtd/spi-nor/controllers/intel-spi-pci.c b/drivers/mtd/spi-nor/controllers/intel-spi-pci.c > index 81329f680bec..d721ba4e8b41 100644 > --- a/drivers/mtd/spi-nor/controllers/intel-spi-pci.c > +++ b/drivers/mtd/spi-nor/controllers/intel-spi-pci.c > @@ -41,13 +41,7 @@ static int intel_spi_pci_probe(struct pci_dev *pdev, > if (!info) > return -ENOMEM; > > - /* Try to make the chip read/write */ > pci_read_config_dword(pdev, BCR, &bcr); > - if (!(bcr & BCR_WPD)) { > - bcr |= BCR_WPD; > - pci_write_config_dword(pdev, BCR, bcr); > - pci_read_config_dword(pdev, BCR, &bcr); > - } > info->writeable = !!(bcr & BCR_WPD); Perhaps we should log this in debug level (dev_dbg()) so when debugging possible issues we can see that the chip is write protected by the BIOS. > > ispi = intel_spi_probe(&pdev->dev, &pdev->resource[0], info); > -- > 2.25.1