Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3874914ima; Mon, 4 Feb 2019 06:39:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN41CIqHQIKmWDqq09bvlvzC+RgYF+t7ReeJgK6u2qIqNgV9jqQlVbpoQnAoFnNRKDkw7/i8 X-Received: by 2002:a62:8096:: with SMTP id j144mr52166827pfd.140.1549291189101; Mon, 04 Feb 2019 06:39:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549291189; cv=none; d=google.com; s=arc-20160816; b=aQljjnSyWw1gG/aKd0r4O9v402e+bG8bOXhhEJFgF6QTJOuKZTErKHb+uCDHytDkWB 2HVY2qKdkuHA9xl+Ayxau/E0nwsoaeCg/ViPKJR1xQBYZNowIPa7AE5sNaPLQUIPQzm2 BWKIFIJ53WR4pc6RM7By1IQN79ZP5eEihDwxW7yhYVoPgUwypHjMMYaNFiiL7UKC0lB+ PV3UsS4V4mVWb1howqe1q73vTzIj0j7tJmyFtKHoQlw3i/COTeQQKnvFl5VyhoOU6mia 6VtkFEQoTUnc0m/+ReOib/pG5G/k2DfDcAZd4855mv+3HeBSh3aK22LMNLIpJepOJaFK bqEw== 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=IgiP3FmMZa9mRE2EOOdXwJGz4r0XVHuRiVyVQ8fJDpc=; b=A4HCJn7UAvK8F3neKa8cyXipaMIk8hJ9lBbXBlyROgyQ5qCWCBoKo8cht2+/fVE2vf 83JSQnk/KLqtrZ874Zd/ldlLQnTxNgmvniZlvhUrU7udcp96lNXHGsFaHb35A9RAHlpO aUhtWRtVp3bS+Ki8I6ps+APDA1YiDew5Y9B+ISMkXyPT48l86l7EsDIkmGAHnNOFf1cc 6HxcSPL5bI7HMYIG+JJPO99eS/A5GCI/4Kl6j2p1kM7QgdrZxBlpnPs+1ttfHGhuEJat tKxIIn1vXSlZpvCfNnDr9GAsAoeiw+WQxBSsPqYYUQLjfbgk/9NnyEYbRTFNWBQL0yNL BHkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EKh2xoBo; 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 o16si207603pgd.117.2019.02.04.06.39.32; Mon, 04 Feb 2019 06:39:49 -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=EKh2xoBo; 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 S1728856AbfBDOBo (ORCPT + 99 others); Mon, 4 Feb 2019 09:01:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:57544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfBDOBn (ORCPT ); Mon, 4 Feb 2019 09:01:43 -0500 Received: from bbrezillon (unknown [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 4BACA2082F; Mon, 4 Feb 2019 14:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549288902; bh=3KNwqHnHGZNCWkch9CrjOjSh+cKQ+OW5kIx/iou8hsk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EKh2xoBo4ZacXyPGZI9QCUvf4sv2duUHecD7SFeuuOMxbLdHBl0YrcDDjO+muuxGP Lel8MDvrwy5GqsX8Lyt+DrHPxiCkPhJoP9RwCAZqKU8fAkFHm5GVMd6B1KDiQpGVAy EU4EqBuw+nXxWOGdkcEyJInQGzIyG5N0Hn2COmus= Date: Mon, 4 Feb 2019 15:01:36 +0100 From: Boris Brezillon To: Cc: , , , , , , , , , , , , Subject: Re: [PATCH v4 08/13] spi: atmel-quadspi: rework transfer macros Message-ID: <20190204150136.519060ff@bbrezillon> In-Reply-To: <20190204100910.26701-9-tudor.ambarus@microchip.com> References: <20190204100910.26701-1-tudor.ambarus@microchip.com> <20190204100910.26701-9-tudor.ambarus@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 Mon, 4 Feb 2019 10:09:53 +0000 wrote: > From: Tudor Ambarus > > Split the TFRTYP_TRSFR_ bitfields in 2: one bit encoding the > mem/reg transfer type and one bit encoding the direction of > the transfer (read/write). > > Remove NOP when setting read transfer type. Remove useless > setting of write transfer type when > op->data.dir == SPI_MEM_DATA_IN && !op->data.nbytes. > > QSPI_IFR_TFRTYP_TRSFR_WRITE is specific just to sama5d2 qspi, > rename it to QSPI_IFR_SAMA5D2_WRITE_TRSFR. > > Suggested-by: Boris Brezillon > Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon > --- > v4: introduce QSPI_IFR_TFRTYP_MEM, reword commit > v3: new patch > > drivers/spi/atmel-quadspi.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c > index ce4f8a648f45..19a3980775ad 100644 > --- a/drivers/spi/atmel-quadspi.c > +++ b/drivers/spi/atmel-quadspi.c > @@ -113,11 +113,8 @@ > #define QSPI_IFR_OPTL_4BIT (2 << 8) > #define QSPI_IFR_OPTL_8BIT (3 << 8) > #define QSPI_IFR_ADDRL BIT(10) > -#define QSPI_IFR_TFRTYP_MASK GENMASK(13, 12) > -#define QSPI_IFR_TFRTYP_TRSFR_READ (0 << 12) > -#define QSPI_IFR_TFRTYP_TRSFR_READ_MEM (1 << 12) > -#define QSPI_IFR_TFRTYP_TRSFR_WRITE (2 << 12) > -#define QSPI_IFR_TFRTYP_TRSFR_WRITE_MEM (3 << 13) > +#define QSPI_IFR_TFRTYP_MEM BIT(12) > +#define QSPI_IFR_SAMA5D2_WRITE_TRSFR BIT(13) > #define QSPI_IFR_CRM BIT(14) > #define QSPI_IFR_NBDUM_MASK GENMASK(20, 16) > #define QSPI_IFR_NBDUM(n) (((n) << 16) & QSPI_IFR_NBDUM_MASK) > @@ -275,10 +272,8 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) > if (op->data.nbytes) > ifr |= QSPI_IFR_DATAEN; > > - if (op->data.dir == SPI_MEM_DATA_IN && op->data.nbytes) > - ifr |= QSPI_IFR_TFRTYP_TRSFR_READ; > - else > - ifr |= QSPI_IFR_TFRTYP_TRSFR_WRITE; > + if (op->data.dir == SPI_MEM_DATA_OUT) > + ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; > > /* Clear pending interrupts */ > (void)readl_relaxed(aq->regs + QSPI_SR);