Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7111923imu; Thu, 31 Jan 2019 05:14:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Kleb5YgRncwFtE11LvoMTUJhWMqdeRzX5fanhjH84TgZNVF8S93hK0R1ug7K0bw9ROUlY X-Received: by 2002:a62:b2c3:: with SMTP id z64mr34392701pfl.120.1548940484485; Thu, 31 Jan 2019 05:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548940484; cv=none; d=google.com; s=arc-20160816; b=tirTblXWFBAnPh+34G/e/j14b1ZiSVhMBq0w7bLY5tZ2bciwTGeeGcdo1rycJpS/kY 6UkgP/jXMNGPr5DNbF9FwH4aKFK9rhZxKZSfwoZW6xSzAw7b+QjA+IigHJ3U6JW9f5Qb /X59yCbidXyb/RGJ7BEwZEXckXfeSuQCq0ZnVcDO7Y9sBwkugVF0Oj7UlnUqVlF19FJC 04gJC2w8bYnkfZCci10l5vR5eaOjf6dAY5MdphHQJe6ctK3MtKByIgJCuDQIAC85tTxU 7krNgNCHy2VRsMbsYQUwK9KFd0HHyindF5FBzIHsGlLJ3qsrVsPk95GMDQ97iFIcn2rA fzng== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=UdDAaRPVmOi/D6fD910NHxZ2EnFci0dEE52jtIxGTzo=; b=ze1uP6+NqhEXhCH4EOw/mBSPCV5EmA6FawoXTY235iAoMpjtCUL2W+OHA3iulsbz3T qLUlgeRlrPjgq5vzFPoVJCcL4tUtX/dx506OVHPkYpgWAkQplobaSd7eU1ETyAdRkHXp GIavwGYayBIHxdijOGcRcpt9qJd53RxmMA9JFopKvosdTkJtBsyo8GjErr51y8RbDSgU BxKlUSk4YPgrBrb3bHjVMFDOdCDuT/Su4HyRinNClMOICLuTleZHMEn5o1flsVvMAdSY sD/tHO+gKFobkddUeaQJo82AFulAU7uTjBuKc2W10++AYVwv36AbqD7a2k6Dyb49GWOs 3KMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="gEry/j8c"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si4488566plr.204.2019.01.31.05.14.28; Thu, 31 Jan 2019 05:14:44 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="gEry/j8c"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733042AbfAaNMt (ORCPT + 99 others); Thu, 31 Jan 2019 08:12:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:53654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbfAaNMt (ORCPT ); Thu, 31 Jan 2019 08:12:49 -0500 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E072F2087F; Thu, 31 Jan 2019 13:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548940368; bh=l+hMYyleZdMvs+nKECj68JvNPAZLYxFaw+dcGnDGAs4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gEry/j8ctx5y7ogEtPv/kKAh/Aq9UGxP7DPURymMwibOP2Q7787qslVCFEy6508TY +1u1FJKhQtXe4k5HG8Nv4Rt7CJQTvTU0K++ggUmIqJR1zHbqsYkqcPwD6K+kdaoMXu thKSvbyp7NEUh+nWAqQLxn6qvV2nS9iWMqC/cSh4= Date: Thu, 31 Jan 2019 14:12:35 +0100 From: Boris Brezillon To: Cc: , , , , , , Subject: Re: [PATCH 9/9] spi: atmel-quadspi: add support for sam9x60 qspi controller Message-ID: <20190131141235.418e8e9c@bbrezillon> In-Reply-To: <5a91b6b2-0fed-f411-6e96-568e610f15fa@microchip.com> References: <20190130150818.24902-1-tudor.ambarus@microchip.com> <20190130150818.24902-10-tudor.ambarus@microchip.com> <20190131125504.3eff449d@bbrezillon> <5a91b6b2-0fed-f411-6e96-568e610f15fa@microchip.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-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, 31 Jan 2019 12:40:04 +0000 wrote: > On 01/31/2019 01:55 PM, Boris Brezillon wrote: > > On Wed, 30 Jan 2019 15:08:47 +0000 > > wrote: > > > >> + > >> +static int atmel_sam9x60_qspi_set_cfg(struct atmel_qspi *aq, > >> + const struct spi_mem_op *op, > >> + struct atmel_qspi_cfg *cfg) > >> +{ > >> + int ret = atmel_qspi_set_mode(cfg, op); > >> + > >> + if (ret) > >> + return ret; > >> + > >> + cfg->icr = QSPI_ICR_INST(op->cmd.opcode); > >> + > >> + if (!op->addr.nbytes) { > >> + cfg->ifr |= QSPI_IFR_TFRTYP_TRSFR_REG; > >> + if (op->data.dir == SPI_MEM_DATA_OUT) > >> + cfg->ifr |= QSPI_IFR_APBTFRTYP_WRITE; > >> + else > >> + cfg->ifr |= QSPI_IFR_APBTFRTYP_READ; > >> + } else { > >> + cfg->ifr |= QSPI_IFR_TFRTYP_TRSFR_MEM; > > > > Why do you use a MEM transfer here? What's the difference with a > > regular transfer? > > QSPI_IFR_TFRTYP_TRSFR_MEM must be set when one wants to read/write in the serial > memory, and particularly a memory data. > > QSPI_IFR_TFRTYP_TRSFR_REG must be set when one wants to read or write to serial > memory, but not a memory data. > Read examples: JEDEC_ID or QSPI_SR > Write examples: writing the configuration or the QSPI_SR. > > Does this answers your question? Not really :-). From the SPI bus perspective, there's no difference between a read/write from/to actual memory blocks or a read/write reg/param-page, so there must be something different on the controller side. I think regular transfers should work for anything, which is why I initially suggested to use that in the ->exec_op() implementation. If memory accesses are optimized somehow and do not work for all accesses, then we should keep them for the dirmap implementation. After reading the sama5d2 datasheet, I have the feeling that the only difference is the fact that the address is directly extracted from the AHB window offset when using mem accesses (instead of being taken from the IAR register), plus the possibility to enable the data scrambler/randomize.