Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6969604ybh; Thu, 8 Aug 2019 08:21:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyu8B646tR5liZvyA/Rm4QTCe1JSsuz57IrzyAlA0WpyZu4NB5DHeSO2977I3o3jnGfMCVL X-Received: by 2002:a62:5c47:: with SMTP id q68mr16328097pfb.205.1565277666271; Thu, 08 Aug 2019 08:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565277666; cv=none; d=google.com; s=arc-20160816; b=J31jKrwu6TLEq/hfb9W8muHsmaoojg51EtH7XA+WF12tXrymqRBRxwF4Y0Sh3oUUKo NoIZ5efWhtMKHn22jxZA4/2zXJokSmG+40pORdd0qBYC2WLK8cpKKdqsi137/jzkXgsc RjtQfu9VhvLDuwDkgcMwGl8H2/c17bzY2jPHnfDFQ3IAPuLvtC6BO7Nn+USglOOEYGbZ 2XYlrgQ/cnl276YljK9zuC238d0GZ/YNNdjs4hlqXfxUClFA0/NZuRp+SoOpENdW2yTh d8pGfgSj7pC/VsF0HcD3i5PAdJustJ8PQZxKrSJghr/Aw6Li2iu3uWVL4FGoaRZgwqpt gRsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=QcOBW91hDpfsMKXFu9TTm+I5mgE+hfRYMj5oj5D7akQ=; b=aG3KCXU+4V+nw9UHcNYuw9gq3OqhX5AvOoEsRsunHwPBMd3jjKrqxffp63nfEW5KsZ juc/8t0EQ5UNnLm0GHNDQLtXH92cD2L2GDYS9yQPR2lNpuNkWB4vr37wggSSoYhOxE6n 1yUIGffaG3X4D9dLCtsvi8/7kIVTVy0Hd9DuzmYCkOfumWiqwJIJ9GdIBvzkX8xm6DDb fcZIXFDd9lr7M50CCekZ77EziTfm5ZAq+PyY1s9i3P95NaZ29Be09JnFWU8u8eVl4But rbKu6bTPNfM8NX7SSywrjmMwQxE/4Xf9qKYLMm2S71ic7tLiq6iirPmX5J7Xl/7Idy52 7zGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si2098809pjq.17.2019.08.08.08.20.49; Thu, 08 Aug 2019 08:21:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732990AbfHHPTv (ORCPT + 99 others); Thu, 8 Aug 2019 11:19:51 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40242 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbfHHPTu (ORCPT ); Thu, 8 Aug 2019 11:19:50 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 5D68828C51F; Thu, 8 Aug 2019 16:19:48 +0100 (BST) Date: Thu, 8 Aug 2019 17:19:45 +0200 From: Boris Brezillon To: Tomer Maimon Cc: Vignesh Raghavendra , Miquel Raynal , Richard Weinberger , Tudor Ambarus , Marek Vasut , Boris Brezillon , Linux Kernel Mailing List , linux-mtd@lists.infradead.org Subject: Re: [PATCH v5 2/3] mtd: spi-nor: Move m25p80 code in spi-nor.c Message-ID: <20190808171945.21a608cc@collabora.com> In-Reply-To: References: <20190806051041.3636-1-vigneshr@ti.com> <20190806051041.3636-3-vigneshr@ti.com> <20190808160452.1da76beb@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Aug 2019 17:44:35 +0300 Tomer Maimon wrote: > Hi Boris, > > On Thu, 8 Aug 2019 at 17:04, Boris Brezillon > wrote: > > > Hi Tomer, > > > > On Thu, 8 Aug 2019 13:05:14 +0300 > > Tomer Maimon wrote: > > > > > @@ -688,6 +1003,16 @@ static int spi_nor_erase_sector(struct spi_nor > > *nor, > > > > u32 addr) > > > > if (nor->erase) > > > > return nor->erase(nor, addr); > > > > > > > > + if (nor->spimem) { > > > > + struct spi_mem_op op = > > > > + SPI_MEM_OP(SPI_MEM_OP_CMD(nor->erase_opcode, > > 1), > > > > + SPI_MEM_OP_ADDR(nor->addr_width, > > addr, > > > > 1), > > > > + SPI_MEM_OP_NO_DUMMY, > > > > + SPI_MEM_OP_NO_DATA); > > > > + > > > > + return spi_mem_exec_op(nor->spimem, &op); > > > > + } > > > > + > > > > > > > > > > static int spi_nor_erase_sector(struct spi_nor *nor, u32 addr) > > > { > > > > > > int i; > > > > > > if (nor->flags & SNOR_F_S3AN_ADDR_DEFAULT) > > > addr = spi_nor_s3an_addr_convert(nor, addr); > > > > > > if (nor->erase) > > > return nor->erase(nor, addr); > > > > > > /* > > > * Default implementation, if driver doesn't have a specialized HW > > > * control > > > */ > > > for (i = nor->addr_width - 1; i >= 0; i--) { > > > nor->bouncebuf[i] = addr & 0xff; > > > addr >>= 8; > > > } > > > > > > if (nor->spimem) { > > > struct spi_mem_op op = > > > SPI_MEM_OP(SPI_MEM_OP_CMD(nor->erase_opcode, 1), > > > SPI_MEM_OP_NO_ADDR, > > > SPI_MEM_OP_NO_DUMMY, > > > SPI_MEM_OP_DATA_OUT(nor->addr_width, > > nor->bouncebuf, 1)); > > > > That's wrong. If you need that, that's probably a spi-mem controller > > driver issue. Address cycles should be passed through the > > spi_mem_op->addr field, not packed with the data cycles. > > > > Maybe I missing something but this is not the way it > working in the current spi-nor and m25p80 driver... > in function spi_nor_erase_sector it calling > nor->write_reg(nor, nor->erase_opcode, nor->bouncebuf, nor->addr_width); > > so it will call m25p80_write_reg and in this function the op sets as follow: > > struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(opcode, 1), > SPI_MEM_OP_NO_ADDR, > SPI_MEM_OP_NO_DUMMY, > SPI_MEM_OP_DATA_OUT(len, NULL, 1)); > > Do we like to modify it? Yes. The spi-mem core is taking care of this conversion [1]. [1]https://elixir.bootlin.com/linux/v5.3-rc3/source/drivers/spi/spi-mem.c#L329