Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3017434rwb; Mon, 15 Aug 2022 16:14:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR5bbvDDlGbXLQDedLlztoixjcIQBOzTpfVj1MrklIfz/n1hv9dEv2rOmQ4uRmg+Fm3Ubb1n X-Received: by 2002:a17:906:93f7:b0:730:da74:3454 with SMTP id yl23-20020a17090693f700b00730da743454mr11866094ejb.331.1660605245089; Mon, 15 Aug 2022 16:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605245; cv=none; d=google.com; s=arc-20160816; b=G3/r5jdLk8qoRuS6dY79Bsakua7DoY6lxjEMdDVo0ZaTgTFAZzp7ZWvxwtowBfocHi H1spxU+fj9gboyySnk3CV/9V5sDgDHxa2+plerIoQy7XbePjdURADabPwoPo3cu2wwq2 dpLgHcschGBHv2y3nqkUnd/uY+tFAvUarlR3RV58ZLMs4osFej9sDdR7pQ9hHNHh7sMn LbfWqjowcKSWB9c5xG1BXlji9asI6QlHki3P/5NO0TX/tmzXlwFl91XPRF186k9bnKj0 joU9ahjoPSxB2t1S4OkJ9Iu1dX2sVxzZMHDSwI8TjSpF6EHBXfO7F78R7STKjPHEVE9k jPZA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y6UxyLjxHQJK7mg0tFZtlCsFKQ+/AAuA8Dbxq7h4VIA=; b=yn0lq/q82goqe4fbwdY4Ig8+dJERHqf0jRmJ9gK/IymJJUgnQuAZPCrlc9A4xatxD7 C23+ooZf4Gp82u+6cvcctRnaVqjP3DjUXH+vDcCDWShq+W2TM4Gl2Rvk0wAgx03dh3dw pbDTYUVRrKajBs3F/e+V0tb239ry1OlkM0m0Ys2edhuUDQQCKRr7gvfg8NAQSQqgnSCK E2W4B/Up/hROwpli48TfSGh4foR8Bezbyl6GKjWnbnpX6F2CT7+/4p7HZkY/JVi3+vTk Uj/GYolI09W8p54SHcaW/5DEeGsWei/sg7rB8LZK0876bpnlZP2Vnnn0/6PwULAuYmTW x26Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0KYxtaO2; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a1709065d0b00b00730753784b1si8608121ejt.45.2022.08.15.16.13.39; Mon, 15 Aug 2022 16:14:05 -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=@linuxfoundation.org header.s=korg header.b=0KYxtaO2; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350659AbiHOW1D (ORCPT + 99 others); Mon, 15 Aug 2022 18:27:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233475AbiHOWTM (ORCPT ); Mon, 15 Aug 2022 18:19:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E0C86AA0F; Mon, 15 Aug 2022 12:43:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8A71B81141; Mon, 15 Aug 2022 19:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DAE6C433C1; Mon, 15 Aug 2022 19:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592592; bh=yA9DHMFC1385fMRfRW8h8EJYiVdCQ+fwbnh7w5teX2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0KYxtaO2yi62WhRVLMFdpG346LN2gaRjx+7E6HZeNWh5/2/SwutAtbZPOx3k/Ih7e UYgXhiD6EMtPmqvv/Pkn2B5tx18lVGDotDVr50foos0KTHhCzQeBTen/da4TL8LIoh tq7QIgcgCfbq/KR6JggCObW/2Fx/EsCxKj3DfJKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrice Chotard , Tudor Ambarus , Alexander Sverdlin , Pratyush Yadav , Sasha Levin Subject: [PATCH 5.18 0795/1095] mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() Date: Mon, 15 Aug 2022 20:03:14 +0200 Message-Id: <20220815180502.131812520@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Patrice Chotard [ Upstream commit f8cd9f632f4415b1e8838bdca8ab42cfb37a6584 ] For erase operations, reg_proto must be used as indicated in struct spi_nor description in spi-nor.h. This issue was found when DT property spi-tx-bus-width is set to 4. In this case the spi_mem_op->addr.buswidth is set to 4 for erase command which is not correct. Tested on stm32mp157c-ev1 board with mx66l51235f spi-nor. Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol") Signed-off-by: Patrice Chotard [ta: use nor->reg_proto in spi_nor_controller_ops_erase()] Signed-off-by: Tudor Ambarus Tested-by: Alexander Sverdlin Reviewed-by: Pratyush Yadav Link: https://lore.kernel.org/r/20220629133013.3382393-1-patrice.chotard@foss.st.com Signed-off-by: Sasha Levin --- drivers/mtd/spi-nor/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index c1630131c734..170182eb431e 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -177,7 +177,7 @@ int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8 opcode, static int spi_nor_controller_ops_erase(struct spi_nor *nor, loff_t offs) { - if (spi_nor_protocol_is_dtr(nor->write_proto)) + if (spi_nor_protocol_is_dtr(nor->reg_proto)) return -EOPNOTSUPP; return nor->controller_ops->erase(nor, offs); @@ -976,7 +976,7 @@ static int spi_nor_erase_chip(struct spi_nor *nor) SPI_MEM_OP_NO_DUMMY, SPI_MEM_OP_NO_DATA); - spi_nor_spimem_setup_op(nor, &op, nor->write_proto); + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); ret = spi_mem_exec_op(nor->spimem, &op); } else { @@ -1121,7 +1121,7 @@ int spi_nor_erase_sector(struct spi_nor *nor, u32 addr) SPI_MEM_OP_NO_DUMMY, SPI_MEM_OP_NO_DATA); - spi_nor_spimem_setup_op(nor, &op, nor->write_proto); + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); return spi_mem_exec_op(nor->spimem, &op); } else if (nor->controller_ops->erase) { -- 2.35.1