Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3617728ima; Mon, 4 Feb 2019 02:11:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IZyKnVm/GGXzWO0qH+JMgen37KOmC8dGQdHJ1GGsufHwSyfJSPjdyndrn1mL7ka9GI1VWwh X-Received: by 2002:a63:2f86:: with SMTP id v128mr11929721pgv.407.1549275097871; Mon, 04 Feb 2019 02:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549275097; cv=none; d=google.com; s=arc-20160816; b=O/f3rbdQvqKU1CXH/G66AxBEwqWay3JHn1+wpF6aI9sC/q3oUo94m9/GMVz0gQfncU 1jFLU5mDndGegaZChPwIZsMdFDcRbA/+hvEcj6cMSJKvY/7W7wN9aqD9Y2iS+/xj+VkH qv4DECV3FFqzw7Tz1zBwdtQPp/EQCiiDzoul4tJM4cNxs6dCe6DgtVYZIW0vBErMII29 8NEF1XKWaLW8cz4WmkUSkKlfIcaRRYPXGwF1NDK/efq/WGBuJ1hYYAfFQiLjHlP6DxQF 3fReztwpqg1GD40qntXcmuXKgmatfDInTDbWF35UI5NaCsgs+zLj7CGXJtWMhe9sAbGC 6lzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=+GMoqgJFQa/jKumXZfHSYRYKKo6zPy1dMCHs1UqgtXo=; b=bp4rtZvRs/Hhrr5eGJhyxqPRpUbn+IuPaYc/pZJB4Xl+ayzADDpmmvqrn6OebGQNDt +7WaoCPLSS5rAU/M8/9saUvAzOcMVxaanLsv8n0CAchRGU0K6Q7miY23cCjRDmOpchDG 28PJn9z2+GOp6BAjbMM64gLnW4NbsbFXI21W4j0i/xuL0FNFbIKevulPcmO8NYxL7PKw 1t00MQZ44f0CC8tM1Z+irWtKA24s8tzS+jr1kXx/4iD+fKr0vS8SOtDY9sTRUfdxbogU DGa8hr6BwMoUSul0QyVeEULkyXoVZ9fElEA19ojm9cbfhcjarq62gpdNBzZKg72T+Kn5 iYeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchiptechnology.onmicrosoft.com header.s=selector1-microchiptechnology-onmicrosoft-com header.b=02HQzjLQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18si5998460pgg.522.2019.02.04.02.11.22; Mon, 04 Feb 2019 02:11:37 -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=@microchiptechnology.onmicrosoft.com header.s=selector1-microchiptechnology-onmicrosoft-com header.b=02HQzjLQ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729405AbfBDKJ7 (ORCPT + 99 others); Mon, 4 Feb 2019 05:09:59 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:24519 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729391AbfBDKJ4 (ORCPT ); Mon, 4 Feb 2019 05:09:56 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="23387576" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:09:55 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.49) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+GMoqgJFQa/jKumXZfHSYRYKKo6zPy1dMCHs1UqgtXo=; b=02HQzjLQ4T8bIKyOqaBtXKnRU7qM8rMJ8camAH/MOC44le0og3apfCCpHHr+mBViZ57ZAwVI1aqa06+1uc44FEPGn1yXjmP9FXY8QRcl2gBY8EC8ilj4qgLb/SiREZAZQD9wfRbByC/1ars0+tPS5dx3HL6pXVjWk1BGua0LmOs= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1508.namprd11.prod.outlook.com (10.172.21.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.16; Mon, 4 Feb 2019 10:09:53 +0000 Received: from BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::847:4296:13b9:fc9f]) by BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::847:4296:13b9:fc9f%8]) with mapi id 15.20.1580.019; Mon, 4 Feb 2019 10:09:53 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 08/13] spi: atmel-quadspi: rework transfer macros Thread-Topic: [PATCH v4 08/13] spi: atmel-quadspi: rework transfer macros Thread-Index: AQHUvHHFjtXlWvSHX0eyX0SBDZrtmg== Date: Mon, 4 Feb 2019 10:09:53 +0000 Message-ID: <20190204100910.26701-9-tudor.ambarus@microchip.com> References: <20190204100910.26701-1-tudor.ambarus@microchip.com> In-Reply-To: <20190204100910.26701-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR08CA0270.eurprd08.prod.outlook.com (2603:10a6:803:dc::43) To BN6PR11MB1842.namprd11.prod.outlook.com (2603:10b6:404:101::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tudor.Ambarus@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.9.5 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR11MB1508;6:Y+jQ0nvrJ/KRZS1B16tmmaWprtV2zg6wkxonvTMF0uTiE0HMjsLCgMninXFeHrFvVeUaB+4iX2ih7/aI2f/3JJmx6cD86CLz+VG3j8yqGFIWbFnrh9QNiGNfariUEYlPexVrT78zDbMhOkgvRjUlPaSB8ewpOEddAOqUH3ZkMHeeKGPEyUO+gu6e9ydNTNVuoIGxjlrP0WFMIC4ddXLIMiD4Y51cuKNWRm0y7ZJezxNO4I/TRUY/IsHhul+PKkobtZEke2cDf7+4bvF82EUSuT/m+deoXtZmlx6Wl6VcDl322/xu6Z+ZzYKDnsWnbGIRWx6FZn1F+kaPadzReLjIWgBFXwFbJ3wkkENLwWmYFLNOzB18lqelL/+JA56piNmt5DLmEUlXFdqnK9aed7IR2u2spHwLa5y1UHYUaigcxnsg84Q/J7xMQ4Qw/M7iT8i2AOxpVh5JSdAyJW4w/pL2AQ==;5:rfJhucNzX7Gw40YkLCgSdbnugU4aXk0uH9p2myTOfuuGAPbpZjX6Oe6RlLNkKtxOWGatSSrd+wy5s9boWYatajRvhjQapItPO5U7RhynOUqvtC9jcUZ5b9U+WG4sHYEwlSDBh2zq4F67WaMdUPQBMvjpkY6HusxxtSvMRXlyPRfdsDlP9WI0G4NNQniVsITlzg0Lmj3Ent3Yv9xfc2KXFA==;7:2gE9Dq4AOY9UQBSf4ixIQSjbA5/hiA+lI8o1TFdhpAgKqH9ZfFlGuVUtx3hZGF7kCSM858Kxxb/znNJ0Sv2TScKNFuhM9fvp6BkxS7oaY0issSBBvuWCFDoose/gguL4/l5f3CXba/1sW97R60QIOA== x-ms-office365-filtering-correlation-id: 7606e48c-1a90-4e6f-5a82-08d68a88e80a x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1508; x-ms-traffictypediagnostic: BN6PR11MB1508: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(39860400002)(376002)(366004)(346002)(136003)(189003)(199004)(6486002)(11346002)(446003)(2616005)(486006)(106356001)(99286004)(6436002)(4326008)(105586002)(478600001)(476003)(76176011)(186003)(53936002)(305945005)(3846002)(6116002)(7736002)(81156014)(102836004)(26005)(81166006)(6512007)(107886003)(8676002)(25786009)(68736007)(39060400002)(52116002)(50226002)(110136005)(8936002)(2906002)(386003)(54906003)(6506007)(86362001)(1076003)(36756003)(71190400001)(71200400001)(316002)(97736004)(7416002)(14454004)(256004)(2501003)(14444005)(72206003)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1508;H:BN6PR11MB1842.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: wGHtUvbULyOCLFoRyl8Tbf/V8TZ8MVw4SGsF71yVA3lj2f/uFn0FAfGSsVAe2XinRwzj0v7MzK3CHf/qrfzN8cI/bGItfHqX9kM5diEqNd2N/6Dde1dsNqBYHG3jz1iuDwRbbi06mR4pNe4KgP+1g5TnVmjVBSyjIwPw7NNSNXP6SJDVHjVgTsp+SQ9TLLMkG3Wa5J/rLeivg7nZI+EjAloZ5YPaoySO8z205l+A5zdSjV3ViB0ITe8tDayTb/kSVLWDxW4uR5qlXsuawNjRMvH/06Efjj9SzftSs2fuiqXKw5qTytFuMipqakuwjXpKA11w/5Zas+Ls9oX1cFjEK8i5vAa6K6ZBDZNHtLS7G2FP4e1JdkWvNs46Q2QKrDJZjJb5MdK6Oqctjjq/WO23EDleiRDn2p37JTTAeqRGPyM= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7606e48c-1a90-4e6f-5a82-08d68a88e80a X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:51.0543 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1508 X-OriginatorOrg: microchip.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =3D=3D 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 --- 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, con= st struct spi_mem_op *op) if (op->data.nbytes) ifr |=3D QSPI_IFR_DATAEN; =20 - if (op->data.dir =3D=3D SPI_MEM_DATA_IN && op->data.nbytes) - ifr |=3D QSPI_IFR_TFRTYP_TRSFR_READ; - else - ifr |=3D QSPI_IFR_TFRTYP_TRSFR_WRITE; + if (op->data.dir =3D=3D SPI_MEM_DATA_OUT) + ifr |=3D QSPI_IFR_SAMA5D2_WRITE_TRSFR; =20 /* Clear pending interrupts */ (void)readl_relaxed(aq->regs + QSPI_SR); --=20 2.9.5