From patchwork Mon Feb 4 10:09:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E8C46C2 for ; Mon, 4 Feb 2019 10:09:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DA602AB00 for ; Mon, 4 Feb 2019 10:09:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C8D62AB25; Mon, 4 Feb 2019 10:09:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C159A2AB00 for ; Mon, 4 Feb 2019 10:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728529AbfBDKJZ (ORCPT ); Mon, 4 Feb 2019 05:09:25 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:24492 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727276AbfBDKJZ (ORCPT ); Mon, 4 Feb 2019 05:09:25 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="23387561" 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:24 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:24 -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=gWHKIK4fFjTkNuJ6sIdaTUYwPTegVccQ7ogOIV84gQg=; b=kWtyc6cIGvIrwYDfANcRwZCVC9eHjff+5BM/yaIN+BT6kl2alpGKnWAttVUh+YEQxi+VhwxBKjpB2DB2PzHX0yTFHt8Fi+5mX9iqUCSkvcKvy0ibxSLIPbHsPVTjpKlLtp8VNPA+T7obEaBxw6S7kl3bjRTkI8qNfwFC3pmiaAU= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1473.namprd11.prod.outlook.com (10.172.21.16) 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:23 +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:23 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 01/13] spi: atmel-quadspi: cache MR value to avoid a write access Thread-Topic: [PATCH v4 01/13] spi: atmel-quadspi: cache MR value to avoid a write access Thread-Index: AQHUvHGzRPeVO5Si6USSpYr2BTVPaw== Date: Mon, 4 Feb 2019 10:09:22 +0000 Message-ID: <20190204100910.26701-2-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;BN6PR11MB1473;6:aPUXR5tjg2tH3OAmjHaZvqeqr2LGGV0eeiyyV9FP8Q7FVyGHVBKm63kBiKmq0WuQN2g+wRp1OQ3JHDHfpe/OXnrjvmhlP0S5y4okhYPov+8jHBViB7HI6ice/4ZZok49gdtDMcMp5Ipeyhfm+EpBJkI7IsD34SH1kTGzM5gkoUM/Q55MO3McITC/NpwLmDo+0U4eWHLcjWncBMDwtDHiVdvkx0YecuW5NTMdu7N+gYcmbyQgsIdcOlDAphuV3csxkap0XKHyQqCmbE2y2hAWkElqtAvdFUyv8De5OpSLf/22BqKKzIuzE8xulem7aOAHVTTjhDaS3S118hT6emVicZTxuet4D3rd/jsDCHOQL93wt7H4URXSNzDQL5S34PlkbI31uySUCHci2n1JeixMZnQOI6u7jZU/NUGGAboCSXHr8itMTQSbmH7j1U8FxysLr8sF6i77oqHVda+/kdqY8A==;5:W9fEJB96CvoFUi3G60+3e+iYowS4lkZIVlEmoZ35vBi05nNaZY8PaPsASwBaURg7v8zCnpIVcO66R+ZVsLi84CtMMRZcMKconyGiTHUqjCbFn9K50wo6ThB067+xA0cYA7TohIfqe2heyM9KWC333VWBTCd7c0Ago0uPBKZ8FL4fXnnQXUqdphoI870N9veGLz0+g2MJFkOP7KxPuqs6Vw==;7:wV+fdxcfinPV+l3T0vZVZrDJrLxKarf1tW25t7hdmWkjaRQhqD8u3bj633m7OBOzDeAeJgwIv7kTnK/hAvcwglmITjeIdl4N/yjyb5BolOMDqQu3/XcwattAjuI8ZDC36MRdBn5mxY1rBdxnVeVEfg== x-ms-office365-filtering-correlation-id: 0fd42ea1-2271-4595-9e3e-08d68a88d5ba x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1473; x-ms-traffictypediagnostic: BN6PR11MB1473: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(189003)(52116002)(8676002)(478600001)(2906002)(26005)(2501003)(186003)(50226002)(53936002)(4326008)(81156014)(316002)(66066001)(8936002)(3846002)(81166006)(6116002)(1076003)(386003)(6506007)(106356001)(68736007)(6436002)(6512007)(39060400002)(76176011)(102836004)(107886003)(71200400001)(54906003)(71190400001)(105586002)(476003)(99286004)(36756003)(7736002)(14444005)(6486002)(97736004)(446003)(11346002)(14454004)(2616005)(86362001)(305945005)(7416002)(256004)(72206003)(486006)(110136005)(25786009);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1473;H:BN6PR11MB1842.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: TnSCwZ0JXxklfTLhPPkmMPRO6yrP1ZVGzCJuvaFZajVJ3HYqtv6AJKlpG27CxIsmWmohUowmHXwKewAWQ6SMNMNOTyaimexiqpivrOI5+M99UGn1xAvr70GbXAQe4p63NUn+Mqk4gmzfuznjh9JvGF7LzPRmjtv1NIdnJWVjqSQOcFOW9Mkj0RnVW3+WOEZISgC4z3bFc37NUfXdLqBiPqDq0zM1WuDiC8a4ropXkNSeCuJIQvBOZsrAdISbeQGGT+DdwO1uy3rBzfPduHqU69ZD89ycfSJ/9Wwjvg15xMXpaZ4tQHbK0uorvZ0i3HuEgHtrwaJo5E2xBGS3BfkowH3eRobhD4gwtQNbv0+0N1DQz53n7kiqcsYe1zzlOkbyQVphLvnB3BcDsRsqI48J45Cr3sGaNkbiUzMoYXNKDzU= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd42ea1-2271-4595-9e3e-08d68a88d5ba X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:20.3187 (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: BN6PR11MB1473 X-OriginatorOrg: microchip.com Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Set the controller by default in Serial Memory Mode (SMM) at probe. Cache Mode Register (MR) value to avoid write access when setting the controller in serial memory mode at exec_op(). Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: s/smm/mr, init controller in serial memory mode by default v3: update smm value when different. rename mr/smm v2: cache MR value instead of moving the write access at probe drivers/spi/atmel-quadspi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index ddc712410812..d6864d29f294 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -155,6 +155,7 @@ struct atmel_qspi { struct clk *clk; struct platform_device *pdev; u32 pending; + u32 mr; struct completion cmd_completion; }; @@ -238,7 +239,14 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) icr = QSPI_ICR_INST(op->cmd.opcode); ifr = QSPI_IFR_INSTEN; - qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); + /* + * If the QSPI controller is set in regular SPI mode, set it in + * Serial Memory Mode (SMM). + */ + if (aq->mr != QSPI_MR_SMM) { + qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); + aq->mr = QSPI_MR_SMM; + } mode = find_mode(op); if (mode < 0) @@ -381,6 +389,10 @@ static int atmel_qspi_init(struct atmel_qspi *aq) /* Reset the QSPI controller */ qspi_writel(aq, QSPI_CR, QSPI_CR_SWRST); + /* Set the QSPI controller by default in Serial Memory Mode */ + qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); + aq->mr = QSPI_MR_SMM; + /* Enable the QSPI controller */ qspi_writel(aq, QSPI_CR, QSPI_CR_QSPIEN); From patchwork Mon Feb 4 10:09:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9051417FB for ; Mon, 4 Feb 2019 10:10:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DF842AB30 for ; Mon, 4 Feb 2019 10:10:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7162C2AB3C; Mon, 4 Feb 2019 10:10:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C5852AB30 for ; Mon, 4 Feb 2019 10:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729208AbfBDKJ3 (ORCPT ); Mon, 4 Feb 2019 05:09:29 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:59630 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727276AbfBDKJ2 (ORCPT ); Mon, 4 Feb 2019 05:09:28 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="26111683" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:09:27 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:27 -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=BR7fQ5aqYpuxmi7PdNrJSi0RGaLoIH/OxMiPCd6Rdqw=; b=rzdKneSnow7fLhUI3ny8j+/xtifrkmSnLRjP+wV28GwzsgVivtDMbgSJ3qaBEQ4kg97CgQIsfnIXwCGbOrZ1FS2B3S8k0DF1bH1dpNqT9MZJPupsffMVfbaYJ6ZA77Q4Vk3XZpMgBQN7xwgm+RXJ55+T6h8Gf5ofKH10IleQ4dc= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1473.namprd11.prod.outlook.com (10.172.21.16) 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:26 +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:25 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 02/13] spi: atmel-quadspi: order header files inclusion alphabetically Thread-Topic: [PATCH v4 02/13] spi: atmel-quadspi: order header files inclusion alphabetically Thread-Index: AQHUvHG16z+TW/c7n0q4+zU3WNe8eg== Date: Mon, 4 Feb 2019 10:09:25 +0000 Message-ID: <20190204100910.26701-3-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;BN6PR11MB1473;6:E0ywOX2vkTLBA/reHzXd6UCMW7xKlodCernp/v5XlJH7bQTGF5wK7nTRhzD4LEYp2qtHzD2BEaa8yGpInQ/tSX3yLWKW3BdPzyDU4ZSFtR15mB6d6Cqxf1wFAkWzc+W8mVRpRQezcyb5yKKWYoDe1oiBxMzSEgqJLDlOXu6bI/UJFdQCP804PDTzOy5ZaS8B3OUPTyaiEtl+AWe8wsEHCvsMpg7c/yuWXYbUHdQjSAwwg0hoCz55UYKDCrrvVXBKMj/Hr7tHsU/An8tHUn25/KuTGR4Cgw6v+RextrPS0GHd7gXUIMZ7EtsyVGapOg+BY6B7AUdcloHsE151dFW8suhcyky53dfjK6ouChCJ0CZuMNIE6WfEaFtzwST6iyHcDNcLJNOeo4mXYMc1k5OdpQiWPagCPqhrzCUOhC/tZNj9E80kH06YmKb1SOJes+VBQEwqQrmG9ODvsZqA2XECnQ==;5:WLaH6f4LnRd4eLi7KzzHWnajyJhi9xkhXoghG1EQ0h/M3uifpJjs2QsVoKls6bqfsdjYuZRivcGHf07k6JVqygfrrhwdRPlscNjy/NjyjdYLEd0CoJnonzniIjpPr7nkQ7lqU7aP7tWR2DnPoNQt1/d8Up2wOVQtNoHq+HpsQA7sS86oPOmgLe8Jd5J11DMWJ3zKxyDdp25CtmflK9d/Vw==;7:6UmSVqD9vvEwmbx/VFBue/OQg4pyYr2r0C6071jh8ydEam1AXwzQ+jrVINt1+4AJFawFQsWV6nJW+HGrNTGQrGkuKrea6Ayj6FZyikW1iqkjI4hOV4KkebElcKMZk3uh8IDVKXuGPcqDpnb5t8lGFw== x-ms-office365-filtering-correlation-id: 30212ffe-04b2-4f5c-cbf2-08d68a88d775 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1473; x-ms-traffictypediagnostic: BN6PR11MB1473: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(189003)(52116002)(8676002)(478600001)(2906002)(26005)(2501003)(186003)(50226002)(53936002)(4326008)(81156014)(316002)(66066001)(8936002)(3846002)(81166006)(6116002)(1076003)(386003)(6506007)(106356001)(68736007)(6436002)(6512007)(39060400002)(76176011)(102836004)(107886003)(71200400001)(54906003)(71190400001)(105586002)(476003)(99286004)(36756003)(7736002)(6486002)(97736004)(446003)(11346002)(14454004)(2616005)(86362001)(305945005)(7416002)(256004)(72206003)(486006)(110136005)(4744005)(25786009);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1473;H:BN6PR11MB1842.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: +Or0c5X+j3YNJHlVvvXPW4CWehZoxaeNIJPHDRtDojGiO3kih0kSseemQ/C74NY1j79kKVo06MDfYKEkpRLn08l12cc/vMtydDpsDOVVLGCt+NbpHwR+jMOWUm4Yuz2DyxsjX9aQNxsMVwTlIfa5C1N03m58Zx4EcTxuRjoJVxA9rKfHzhK/WCvfB+i6gmXCKqZZNynKLI4eCSmTZu9amLLTXpfRo9B4dw0oZmCuhC4AXkuKgRiigWn+DB6UdSz6qN0cfwoxNU2+OY9yG1NDU8IOVwrJ84S4VCtDMdrfRc21hOPm4ZATjfK3BbkzI105ej1gCQ0MjIHRfEJXSsdgc8k5CwzIC1ywty/sMECPPHHGGNvHoxkFFpqSMLHgws5biAA+kZuND7ksYsLRyjf6bs+2ULj0Jd1u1sr90Y8OdL8= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 30212ffe-04b2-4f5c-cbf2-08d68a88d775 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:23.2202 (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: BN6PR11MB1473 X-OriginatorOrg: microchip.com Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Cosmetic change, no functional change. Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: no change v3: no change v2: collect R-b drivers/spi/atmel-quadspi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index d6864d29f294..7d83ce8747e8 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -22,16 +22,15 @@ * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale. */ -#include #include -#include -#include #include #include #include -#include - #include +#include +#include +#include +#include #include /* QSPI register offsets */ From patchwork Mon Feb 4 10:09:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DF841390 for ; Mon, 4 Feb 2019 10:09:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08C8C2AB00 for ; Mon, 4 Feb 2019 10:09:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0A982AB25; Mon, 4 Feb 2019 10:09:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58E5A2AB00 for ; Mon, 4 Feb 2019 10:09:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbfBDKJc (ORCPT ); Mon, 4 Feb 2019 05:09:32 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:24506 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729277AbfBDKJc (ORCPT ); Mon, 4 Feb 2019 05:09:32 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="23387567" 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:30 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:30 -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=kn/yZj9INKHkEQl/zoGxdTrB+FRyWlYTxAbzAokJqXg=; b=MlwS/Ft8fXT4lRplv918/iyr7LOYAwDb6C7BgnKB4YlHZiv1LzUrEOxqNsO3EjfCKpSUt0LlwPRHDNP+7gVUTOSkM1R1qCKbmu/WdCmmkYqhBUEhJV70Mr4GpwsY79aHgzcMpWrBxJfDsKbh6Br8COBWwXHs8xcDH8LWlNAEQWI= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1473.namprd11.prod.outlook.com (10.172.21.16) 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:29 +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:29 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 03/13] spi: atmel-quadspi: drop wrappers for iomem accesses Thread-Topic: [PATCH v4 03/13] spi: atmel-quadspi: drop wrappers for iomem accesses Thread-Index: AQHUvHG3hTnXBKRwUkGWSgBj26+yAA== Date: Mon, 4 Feb 2019 10:09:28 +0000 Message-ID: <20190204100910.26701-4-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;BN6PR11MB1473;6:nXbbemTttL2nJB/MYEYpSIG19CIVSfjgEREzjmfiwcxd6/B6aSVdlGbNQU9THVXMojhz8s1rT7PabwaRxxDs/3eaX1aa2x9u9PJf7KpD4XuActehMoF2DkqD/uoUcdrT7G2UrtOnqImtlrXLo+iOw/pbzxH3hGZHNNDt/3f2XA9RjdMnDXeguNYBMijwTXgWoWHmJVrnWn03xzCxx5Q4TlnfF1sAxo9h0HrUzu4kkUoDUfM11wkKD2PUKxMSWwwK0jZO8AM3fpH7hKERCTUPmwhkNm9npyeowJ4czrYjTjra1lYCIZt9n7CQLCdEcYoyNFa3gZRcZt0EL8EXVPHOpqkLRpi1lQj52XZf1sep/A4u5OAMhQhI9cXxWyud6pkSqjXDtOml9q+fhS1dS837L7CBgcCHZPfxiKalhb31npk2Hq3hGAcW+7WsvG9185c9Ee49X6h+9jE9v31WMpHEsA==;5:o01xUDCVVKhqPwgc5jL0spT1pkRaznOeeiGti9p/K+T90TI71JVRSmxDl/FOTcSpdfYtd6K0B4DhLbJNwQC9IDt78G2dEWfU7GZw/qUMZsmord59I3MVWeUSMBl0tZnAF78L1OvD0TP+TxMwXZ6INhgIx2wq+zZCSpAvmIRqAtuWiBWwu5Q7Oiy5Xsp30iKfYmEBz/K2vfHSKurvFFjWHg==;7:ysaVd0NkldOj7Zjn/U1YJXtljNLRtzlyHdneBT81Ic9ALSBaKmPFx2AQbNfNe7+BslLxBBpldWaBSxdDBf5I9ovwEi2kfOTG9L9nfZqg9d/FwqlCoAzmWFoPYDdbzWUa0P8CPFKs8c1gYXJMF8j2Dw== x-ms-office365-filtering-correlation-id: b951f7b0-398d-4c0a-9ddc-08d68a88d94c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1473; x-ms-traffictypediagnostic: BN6PR11MB1473: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(189003)(52116002)(8676002)(478600001)(2906002)(26005)(2501003)(186003)(50226002)(53936002)(4326008)(81156014)(316002)(66066001)(8936002)(3846002)(81166006)(6116002)(1076003)(386003)(6506007)(106356001)(68736007)(6436002)(6512007)(39060400002)(76176011)(102836004)(107886003)(71200400001)(54906003)(71190400001)(105586002)(476003)(99286004)(36756003)(7736002)(14444005)(6486002)(97736004)(446003)(11346002)(14454004)(2616005)(86362001)(305945005)(7416002)(256004)(72206003)(486006)(110136005)(25786009);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1473;H:BN6PR11MB1842.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: 0zPUwbU6OKUUSrEl7dG0jXbtGjgSVJJTMdyQDZfGu+eXSq5aS9FNoQkf8lBXjgx/wRltBmLfFE7iUcTdtVJmMbRRVwuvF8TTFMR3YIXd0cbOw4zh/RFI1WicWqwY/qMekZ+J0mey6xT/KF41dR4U5gqz1BCWje0oXogysduOnuDyR5LNJhEiAkhPWQP4RGKPmSBjnwiu78gsSpF99OjZc7GoXpJVWpiCOPJ09phn+WOv8PIJX88IIpzklkwxXWrjqK0VE0NazCWtPss0kINoaKyweJzxYR9noM7fsk+tem5PYAg7xkpZKkHfMSu7XThYovRjRaHo3dShN+UbOwxaLNA4cVy6DGkj2JgZW9aX/ERzaG20Rcm5EsCgEmfD5dm5RRkZB/vffCGgru6vSvbfH1jtw2rLBMBW/AwC+C41BQg= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b951f7b0-398d-4c0a-9ddc-08d68a88d94c X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:26.2206 (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: BN6PR11MB1473 X-OriginatorOrg: microchip.com Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus The wrappers hid that the accesses are relaxed. Drop them. Suggested-by: Boris Brezillon Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: - drop local variable that kept aq->regs, the compiler should be smart enough to store it in a register - collect R-b v3: no change v2: new patch drivers/spi/atmel-quadspi.c | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 7d83ce8747e8..c745e75b755e 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -175,17 +175,6 @@ static const struct qspi_mode sama5d2_qspi_modes[] = { { 4, 4, 4, QSPI_IFR_WIDTH_QUAD_CMD }, }; -/* Register access functions */ -static inline u32 qspi_readl(struct atmel_qspi *aq, u32 reg) -{ - return readl_relaxed(aq->regs + reg); -} - -static inline void qspi_writel(struct atmel_qspi *aq, u32 reg, u32 value) -{ - writel_relaxed(value, aq->regs + reg); -} - static inline bool is_compatible(const struct spi_mem_op *op, const struct qspi_mode *mode) { @@ -243,7 +232,7 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) * Serial Memory Mode (SMM). */ if (aq->mr != QSPI_MR_SMM) { - qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); + writel_relaxed(QSPI_MR_SMM, aq->regs + QSPI_MR); aq->mr = QSPI_MR_SMM; } @@ -303,17 +292,17 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) ifr |= QSPI_IFR_TFRTYP_TRSFR_WRITE; /* Clear pending interrupts */ - (void)qspi_readl(aq, QSPI_SR); + (void)readl_relaxed(aq->regs + QSPI_SR); /* Set QSPI Instruction Frame registers */ - qspi_writel(aq, QSPI_IAR, iar); - qspi_writel(aq, QSPI_ICR, icr); - qspi_writel(aq, QSPI_IFR, ifr); + writel_relaxed(iar, aq->regs + QSPI_IAR); + writel_relaxed(icr, aq->regs + QSPI_ICR); + writel_relaxed(ifr, aq->regs + QSPI_IFR); /* Skip to the final steps if there is no data */ if (op->data.nbytes) { /* Dummy read of QSPI_IFR to synchronize APB and AHB accesses */ - (void)qspi_readl(aq, QSPI_IFR); + (void)readl_relaxed(aq->regs + QSPI_IFR); /* Send/Receive data */ if (op->data.dir == SPI_MEM_DATA_IN) @@ -324,22 +313,22 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) op->data.buf.out, op->data.nbytes); /* Release the chip-select */ - qspi_writel(aq, QSPI_CR, QSPI_CR_LASTXFER); + writel_relaxed(QSPI_CR_LASTXFER, aq->regs + QSPI_CR); } /* Poll INSTRuction End status */ - sr = qspi_readl(aq, QSPI_SR); + sr = readl_relaxed(aq->regs + QSPI_SR); if ((sr & QSPI_SR_CMD_COMPLETED) == QSPI_SR_CMD_COMPLETED) return err; /* Wait for INSTRuction End interrupt */ reinit_completion(&aq->cmd_completion); aq->pending = sr & QSPI_SR_CMD_COMPLETED; - qspi_writel(aq, QSPI_IER, QSPI_SR_CMD_COMPLETED); + writel_relaxed(QSPI_SR_CMD_COMPLETED, aq->regs + QSPI_IER); if (!wait_for_completion_timeout(&aq->cmd_completion, msecs_to_jiffies(1000))) err = -ETIMEDOUT; - qspi_writel(aq, QSPI_IDR, QSPI_SR_CMD_COMPLETED); + writel_relaxed(QSPI_SR_CMD_COMPLETED, aq->regs + QSPI_IDR); return err; } @@ -378,7 +367,7 @@ static int atmel_qspi_setup(struct spi_device *spi) scbr--; scr = QSPI_SCR_SCBR(scbr); - qspi_writel(aq, QSPI_SCR, scr); + writel_relaxed(scr, aq->regs + QSPI_SCR); return 0; } @@ -386,14 +375,14 @@ static int atmel_qspi_setup(struct spi_device *spi) static int atmel_qspi_init(struct atmel_qspi *aq) { /* Reset the QSPI controller */ - qspi_writel(aq, QSPI_CR, QSPI_CR_SWRST); + writel_relaxed(QSPI_CR_SWRST, aq->regs + QSPI_CR); /* Set the QSPI controller by default in Serial Memory Mode */ - qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); + writel_relaxed(QSPI_MR_SMM, aq->regs + QSPI_MR); aq->mr = QSPI_MR_SMM; /* Enable the QSPI controller */ - qspi_writel(aq, QSPI_CR, QSPI_CR_QSPIEN); + writel_relaxed(QSPI_CR_QSPIEN, aq->regs + QSPI_CR); return 0; } @@ -403,8 +392,8 @@ static irqreturn_t atmel_qspi_interrupt(int irq, void *dev_id) struct atmel_qspi *aq = (struct atmel_qspi *)dev_id; u32 status, mask, pending; - status = qspi_readl(aq, QSPI_SR); - mask = qspi_readl(aq, QSPI_IMR); + status = readl_relaxed(aq->regs + QSPI_SR); + mask = readl_relaxed(aq->regs + QSPI_IMR); pending = status & mask; if (!pending) @@ -510,7 +499,7 @@ static int atmel_qspi_remove(struct platform_device *pdev) struct atmel_qspi *aq = spi_controller_get_devdata(ctrl); spi_unregister_controller(ctrl); - qspi_writel(aq, QSPI_CR, QSPI_CR_QSPIDIS); + writel_relaxed(QSPI_CR_QSPIDIS, aq->regs + QSPI_CR); clk_disable_unprepare(aq->clk); return 0; } From patchwork Mon Feb 4 10:09:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7AB11390 for ; Mon, 4 Feb 2019 10:09:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5C882AB00 for ; Mon, 4 Feb 2019 10:09:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99B792AB25; Mon, 4 Feb 2019 10:09:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D23B2AB00 for ; Mon, 4 Feb 2019 10:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729320AbfBDKJq (ORCPT ); Mon, 4 Feb 2019 05:09:46 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:23806 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727689AbfBDKJp (ORCPT ); Mon, 4 Feb 2019 05:09:45 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="25825516" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:09:34 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.107) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:33 -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=HaYxaNBKwRaW5vxHWs66S0Bvl3mPfPUab0t93rbEJXo=; b=Ibut65JBgjdluM05ukLjMmEkKnt7q32lea/f5WJSTNLnJjDOzvwqFOmIYrT3oNkLtmySJGSRQzWURjWPJXiidli2FYaPkNaobAuXFUcrmO1jB89MI8fF/A/xn31dF7C4vwygf+AfY+d7sL0H4i4/bVwZ157fNx/g1xG/1wKeYBs= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1473.namprd11.prod.outlook.com (10.172.21.16) 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:32 +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:32 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 04/13] spi: atmel-quadspi: fix naming scheme Thread-Topic: [PATCH v4 04/13] spi: atmel-quadspi: fix naming scheme Thread-Index: AQHUvHG5Jq0015cwR0myuxhyL3a68w== Date: Mon, 4 Feb 2019 10:09:32 +0000 Message-ID: <20190204100910.26701-5-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;BN6PR11MB1473;6:skemZT0iRVd57wTKDn0Y+3Wvlsj9/h/A6lJn3EPQ0iTRkDwDsA+JSTn8yKIxllsvupiYL2TsAQKpYMwPwNTj4xCpXRNcH1ArZ1C3M+7UIpr3mT60jeD0w1x1zTQvkTpINma40vSzKRK7Z4GUQ+gFFwlVzEw6a+GVYM3X02ERswco9MVSDRur3npJ1ImMJWjELh5DY5K5Em1RNDEO1E4BSgA4y7s9lkEypmvfIEn9OQMbL/IkP4rE4VlzYBedkDds6KI876JKUbLA3AVVVBbIKtBM5L+4z1goHY1vKqf9crr62p2ZLGwE/bU6vBp+oGF2q9+OHTZFpfi/mIjeeyrzdJeCD31cpz2m0ZcN+DUqROLpa01493pbvqelM8w2QBUPQVVg71fXUlFNOuaeb4RoU5v5woObqM0hksY1IiVaa8aBPiSAE85ZMvUppql1Oi2A2QDWMhK91Sjvq6Cx7RqyHQ==;5:+bAzbqHUQ/MIKc7rB0QBnd80duXuh7arx5tn44gwz7jdyr7q6ms6cSerErt4vn5Q9JUz4oqX7tsTQDYCUiCCGJ9XxZigJ+tyjAwsaDfrvpB+Uegc4cOzfici9USvw5fJsi6sBzLdOfKpl9EQiDYOseaZulE2s6ObgmfRvyBTmdTjvKLlsbpQaeKPFrwOC74LVRSoTPgsUaaNuSe2C7mr2g==;7:Z4AVvrEN4A9KHrPblstLj9AblAb3AZ3sY5UIckNUdZxwWAHgx13NfsNHO8w4xr7xEfK8hutVJzyH+6G2xOTPNA47vb2z4kuy5BMtfi8Pzqb23O7JjKIzOYecX5lbgd8KJCEYnUYuDJFVrJuoilkqHA== x-ms-office365-filtering-correlation-id: 7d59033e-1602-4d6e-3dec-08d68a88db67 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1473; x-ms-traffictypediagnostic: BN6PR11MB1473: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(189003)(52116002)(8676002)(478600001)(2906002)(26005)(2501003)(186003)(50226002)(53936002)(4326008)(81156014)(316002)(66066001)(8936002)(3846002)(81166006)(6116002)(1076003)(386003)(6506007)(106356001)(68736007)(6436002)(6512007)(39060400002)(76176011)(102836004)(107886003)(71200400001)(54906003)(71190400001)(105586002)(476003)(99286004)(36756003)(7736002)(14444005)(6486002)(97736004)(446003)(11346002)(14454004)(2616005)(86362001)(305945005)(7416002)(256004)(72206003)(486006)(110136005)(25786009);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1473;H:BN6PR11MB1842.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: XUpVO30+kh48jfYrjoEIliPwdHdkY80mG9vFbmoUqA5pnqyu/MizIgig+3WWhiKmW+4PAwkhErTUQAn92pAhiFISg5SqoQnhR1BTXoKKjo22yv3/p59bUFyiFkcAx8tQAXwuO7nGeUb+Q14gBBxiBOd7xZNluo6rDO5J/syqFAOPsdF1V0c9evYhzbi2vAgpO2HO3q4eBcqqPfmsJc+IB/tle6KOTUeCXmIwSnm/UdRuE5SfVLq/pi6IXKa0rMuDK+3taanVP2Nyr6BIV7XZAk7gXr9ThMmoaAQjhfhE2HDRbd9DlT+jO+/VH5O6DgnvqqlqMCBzY//jzXZJguE6ATLsMl4klEYjAySvE3/RWgHvYrGQTLSPBPoEyjZwWIH1SqL6P8BrgyZWD1v0tW2E/z2aW5yTd/m9QQc4HFBvX/M= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7d59033e-1602-4d6e-3dec-08d68a88db67 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:29.4734 (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: BN6PR11MB1473 X-OriginatorOrg: microchip.com Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Let general names to core drivers. Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: collect R-b v3: no change v2: update after the removing of iomem access wrappers drivers/spi/atmel-quadspi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index c745e75b755e..be1d1ba7898c 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -158,14 +158,14 @@ struct atmel_qspi { struct completion cmd_completion; }; -struct qspi_mode { +struct atmel_qspi_mode { u8 cmd_buswidth; u8 addr_buswidth; u8 data_buswidth; u32 config; }; -static const struct qspi_mode sama5d2_qspi_modes[] = { +static const struct atmel_qspi_mode sama5d2_qspi_modes[] = { { 1, 1, 1, QSPI_IFR_WIDTH_SINGLE_BIT_SPI }, { 1, 1, 2, QSPI_IFR_WIDTH_DUAL_OUTPUT }, { 1, 1, 4, QSPI_IFR_WIDTH_QUAD_OUTPUT }, @@ -175,8 +175,8 @@ static const struct qspi_mode sama5d2_qspi_modes[] = { { 4, 4, 4, QSPI_IFR_WIDTH_QUAD_CMD }, }; -static inline bool is_compatible(const struct spi_mem_op *op, - const struct qspi_mode *mode) +static inline bool atmel_qspi_is_compatible(const struct spi_mem_op *op, + const struct atmel_qspi_mode *mode) { if (op->cmd.buswidth != mode->cmd_buswidth) return false; @@ -190,12 +190,12 @@ static inline bool is_compatible(const struct spi_mem_op *op, return true; } -static int find_mode(const struct spi_mem_op *op) +static int atmel_qspi_find_mode(const struct spi_mem_op *op) { u32 i; for (i = 0; i < ARRAY_SIZE(sama5d2_qspi_modes); i++) - if (is_compatible(op, &sama5d2_qspi_modes[i])) + if (atmel_qspi_is_compatible(op, &sama5d2_qspi_modes[i])) return i; return -1; @@ -204,7 +204,7 @@ static int find_mode(const struct spi_mem_op *op) static bool atmel_qspi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) { - if (find_mode(op) < 0) + if (atmel_qspi_find_mode(op) < 0) return false; /* special case not supported by hardware */ @@ -236,7 +236,7 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) aq->mr = QSPI_MR_SMM; } - mode = find_mode(op); + mode = atmel_qspi_find_mode(op); if (mode < 0) return -ENOTSUPP; From patchwork Mon Feb 4 10:09:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA10A6C2 for ; Mon, 4 Feb 2019 10:09:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C77692AB00 for ; Mon, 4 Feb 2019 10:09:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB9FB2AB25; Mon, 4 Feb 2019 10:09:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F56F2AB00 for ; Mon, 4 Feb 2019 10:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729298AbfBDKJk (ORCPT ); Mon, 4 Feb 2019 05:09:40 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:33446 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728508AbfBDKJk (ORCPT ); Mon, 4 Feb 2019 05:09:40 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="26269131" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:09:39 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:39 -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=ONzljGUKpxSEzjquSeX0Xc1OQzIQlDcNjKqAIPOusBI=; b=dwrRTRqfDTXpvOMuaRs1hcGIMWeTKMtsIRJjTVtLwFw0deEaKESRXBxoh9InkRUosqCvfMHwJwr1oWVx8fiVT/rw1WW7Zdrd0G9EQX1fdKQFUlm0Decp+Fo0jag6WfmiHo+V/CH8UhOTQnV9MyGsQ/DwyjdtQUOflGzPUGP7UNI= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1553.namprd11.prod.outlook.com (10.172.23.10) 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:35 +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:35 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 05/13] spi: atmel-quadspi: remove unnecessary cast Thread-Topic: [PATCH v4 05/13] spi: atmel-quadspi: remove unnecessary cast Thread-Index: AQHUvHG7FrZsuRI6JkGSi50b6kZeGw== Date: Mon, 4 Feb 2019 10:09:35 +0000 Message-ID: <20190204100910.26701-6-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;BN6PR11MB1553;6:6DU13k39C2gdorANswtXWwDb2JlePpPw34FI1Udnwly0HL5xlrJAZeeWGuyoFO9oni+X1l5ac+UZmxhlEGqsv+MU9mOzXbtQCVmk07woGJmg+HuJPIdHu7oxHF1M8ZyGmKcwEauryI1faiGY/liugOHKe/ML8/4E9rnYDxcBTKUtI+QFw3uFYqhrlTmSpcs+E3jVN/lEwOVc3RS7fvjWx+9OriwD/hotb4AO3G5J5fipcXrGXWg+XeRpZKfaPoIOcNXwrdP0KUuzu9D0c7d884D8d0VpqitNr8llm7pD6MtAaOU6434rzuTm7s1Oj9ba5/beqBEZzkIq6Qi0Ws/szURCXuwDZqb//tC1KWTZso6zls+t9gUOeofpQsXWXd6PZIVElgWxrB7F/VWlZd9DLUajTjVuND07F8Uv1q9dkGd1UKndZCXpuHW3rc3JlRVV9JDfrBlQbD1DC4vFNdzIqw==;5:Nt4NuklSRIvUpNrjFBasA3m4gglTVt+pVcl04xqpLzSXq5O72UJHIV/lTT0snkjcm89NahcweUtehjisex4bR4Cy9pLSw/99wGremA5MRKSMZo/BFl1/esKJtfi4IeZrT3/WhpIZnFfVbktfFWNggUPKNeca6+/K63g1j/dcmmuSw/bcpOq5JdQ3/4bmORSt6+xeheXBtYGkbN0FDZE5Mg==;7:qagK4kiJuvn/QYa8R+deNBqgNFwRrYdbUvZ7YpXwHyWDIwBgU9RoJhM80mZrTOQgofmNcm+prleuYoq4At0eGRzcnatJwmzbfGWRGVkeVrKa0AgL3DbS8VJ5i3G+h58uovGuIsEzwaKrF66LG4OvUw== x-ms-office365-filtering-correlation-id: ac730272-e9e0-4f61-4895-08d68a88dd3f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1553; x-ms-traffictypediagnostic: BN6PR11MB1553: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39850400004)(136003)(366004)(396003)(346002)(376002)(189003)(199004)(8676002)(81166006)(81156014)(316002)(76176011)(8936002)(4744005)(110136005)(305945005)(186003)(54906003)(66066001)(7736002)(446003)(3846002)(6116002)(6436002)(68736007)(86362001)(478600001)(102836004)(1076003)(36756003)(105586002)(26005)(106356001)(99286004)(72206003)(50226002)(6512007)(2501003)(14454004)(11346002)(476003)(486006)(256004)(14444005)(7416002)(25786009)(4326008)(53936002)(39060400002)(107886003)(2906002)(6486002)(2616005)(52116002)(97736004)(71200400001)(386003)(71190400001)(6506007);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1553;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: LfguKdxVrQJkzHbDVJjKQkyIn0w/zHuL22XcD0+zlbwP+fZDKsArnHUNC7dE4G9FEjpsq4gVgBCLqD5qbPOptgnnHiuoJa6W8aqetFYTrFInt+mpcaUFIUzwzf3wj59suJE62hIjKo26oeWZV5D+0jr8Y8mCKUfyOKcg+3W/GAjDFFX7atvZeo22yHeUMOw4zB6az2Mg3UIFMoHSNXMAuOGeigUDA6P8boJJvu8p/UGlEkjQH0UzOOax2EwVbYEHws5KWHSS5fQZ/4UnDJ6DRc3x60Uwmjac+svPKygCDOQZLB83pneB8mJbD91B8FU5wXnmXU/oC5HI8BP34UrmWIfXHyhV1auZbwiiK9B9gTQPyjf7MkgHvDqCaXfvmQpaRG/A+S4VwE18mifqak5KCSSvbzHQJp2I5fDsNTxdT7o= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ac730272-e9e0-4f61-4895-08d68a88dd3f X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:32.7821 (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: BN6PR11MB1553 X-OriginatorOrg: microchip.com Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus The cast is done implicitly. Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: no change v3: no change v2: collect R-b drivers/spi/atmel-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index be1d1ba7898c..be7f87fd5ac7 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -389,7 +389,7 @@ static int atmel_qspi_init(struct atmel_qspi *aq) static irqreturn_t atmel_qspi_interrupt(int irq, void *dev_id) { - struct atmel_qspi *aq = (struct atmel_qspi *)dev_id; + struct atmel_qspi *aq = dev_id; u32 status, mask, pending; status = readl_relaxed(aq->regs + QSPI_SR); From patchwork Mon Feb 4 10:09:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17FA01390 for ; Mon, 4 Feb 2019 10:10:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 065532AB30 for ; Mon, 4 Feb 2019 10:10:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE4FE2AB3C; Mon, 4 Feb 2019 10:10:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D0AB2AB30 for ; Mon, 4 Feb 2019 10:10:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728011AbfBDKJv (ORCPT ); Mon, 4 Feb 2019 05:09:51 -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 S1727689AbfBDKJv (ORCPT ); Mon, 4 Feb 2019 05:09:51 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="23387571" 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:49 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:49 -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=GsIqQp4S2TjLKPSdu/z3ptMP5oR6DmykRM4FmGRHgsM=; b=LiYZSFCxcswY4H7oSxSz4lS7l/gqOqEpPoPXu/mQ1G6v0el4pf8IW4nZZvzeNUhNHPkPeiVd+LsxZW5Ke1XIcJVfDfeM7LHlqvHGMkHnFV4gIuWw/PTn0A0RPao5q2AVshA72niVL+v2x5QzPA03psTSd6TamITuwEARszxtSho= 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:47 +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:47 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 06/13] spi: atmel-quadspi: return appropriate error code Thread-Topic: [PATCH v4 06/13] spi: atmel-quadspi: return appropriate error code Thread-Index: AQHUvHHC6KE9JPQGH0KQIcX+/+O1dw== Date: Mon, 4 Feb 2019 10:09:47 +0000 Message-ID: <20190204100910.26701-7-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:BtBjuSXi89LeAAfABNzLzLEF/3BifgTh8H5fIWVm+Nh54/eAM2iZNE2uTohrXFiS+GqXz5mibLsL8UXHsjjcMIlLg0pfdh9bh3vUZHENqFWqyJLnKgGbwGlQ1ZDuxhhSkDm/2HxItmNjdyjIx8ANaUsHNgOE0RZJZmJVKoqW++2Ey8b7lbhaYy3mAuuB9y32o104H8/NBBAI9H25sg9fOlsL6oXWvWRIh301H4arW5uRGv0mW56TOwW6ZZhAYj6HlLw7x+RWXR+DM8uCkM/+p0dHLL0yDXxgOU43azCfR9ifCfHFzPWZGNGZE6cnvlsNVAhNxbD8F2IPtIFHo8D9wSJwhqZZV38j+eVD0EsszhnVFItX/VFW/qt03QTVJ1hWk59GIFpm+iRdk5xcOnR2WgsG36ptvBDTwR2csyNKzpsTcs5ZNxOZVEbkBKKz1D/9ClL/fdhWVYtJojTv8sxQcA==;5:aBoFUDhVo69GvrygS7lZrE7xXdP5KMz54YrrdaZRgXhQCVRI8bwkILvllAaZ6Le3ffhsl/gnw6Cm0QK8CBEUdai+oTYwIBgYM3kOBie8V++BobdaQFD7KRHgzBmVlern9giNdIDKqznElrG1Xktg0/klX5UTcQd8IMHht2ZjdUbIz1+uycLrxfx7Vbe527nZA64+u0JoA7CU3LVjuAC8Rg==;7:UA/AH5A7wcdlxVIN8V4ziI/n/mtqXaJloZ5bGtRggBgqR/z7CLN/TXCoxX9UNoLMn3vMbJh/P46ZIzRFcPIDb2rpk/Im4TazhMe7KMgBPQei6AaO5yPSpDMyKBvIrndYojdNqvbHObn4nlFQioerAA== x-ms-office365-filtering-correlation-id: 81164169-e28b-4887-3794-08d68a88e476 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)(4744005)(71190400001)(71200400001)(316002)(97736004)(7416002)(14454004)(256004)(2501003)(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: sBHsqucvF5CldpgZfj9tsygPEOleHxwKrhon2BA8BJ1RIQ+BTwe0cZ++q9oZamsfB8dhD59icgqz5iD0YnK4LO5EkFrlvRjvzJRIyeMSP+FRF3d3NydtDi88sOZtc/TFNUt47eSxomAWS/J9Z4LZJAD9+LVi0TESznv2CtzelccHGY4pCS4MrEqPnSMDbYc1a1JOTWMsWUNp3jFpPQHT3ggWMvp+o7jXfS4cdgztv60Az5IEEtyOmQ39FYCp919gOB8VEFMCCW8Ii85fqtJoCAptMqf/JlXTTNDM7XVHtBvMNSdbAGHb1oUelLsfpzzZiTyUSJf0pJ13iBMvN8Xdcn6gMKX61Jckkc1/p09tWyqp8gn/fs5bpEzVK4ZzewEED+WiT92nif4HyPBS9ZYN8xFe54rp0oVwnyCnz9EDNSY= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 81164169-e28b-4887-3794-08d68a88e476 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:45.1023 (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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Return -ENOTSUPP when atmel_qspi_find_mode() fails. Propagate the error in atmel_qspi_exec_op(). Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: no change v3: no change v2: collect R-b drivers/spi/atmel-quadspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index be7f87fd5ac7..06c31830d07b 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -198,7 +198,7 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op) if (atmel_qspi_is_compatible(op, &sama5d2_qspi_modes[i])) return i; - return -1; + return -ENOTSUPP; } static bool atmel_qspi_supports_op(struct spi_mem *mem, @@ -238,7 +238,7 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) mode = atmel_qspi_find_mode(op); if (mode < 0) - return -ENOTSUPP; + return mode; ifr |= sama5d2_qspi_modes[mode].config; From patchwork Mon Feb 4 10:09:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A07376C2 for ; Mon, 4 Feb 2019 10:10:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F11C2AB30 for ; Mon, 4 Feb 2019 10:10:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 832532AB3C; Mon, 4 Feb 2019 10:10:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02C622AB30 for ; Mon, 4 Feb 2019 10:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729368AbfBDKJz (ORCPT ); Mon, 4 Feb 2019 05:09:55 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:23818 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729353AbfBDKJy (ORCPT ); Mon, 4 Feb 2019 05:09:54 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="25825536" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:09:52 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.107) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:52 -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=QudQEcBNY3IlZXAcjHloyvJjDnL9r/QZ3QsqUfCNLQs=; b=LMUwYrdB36RIqDIavx4M7bQJu8tqr2ud3ilFCgehi72uVopJHAfPYABdXWhnG73IssVoMbctUlTrRHXUXttdtK3P9Z8Lqhf3ernmT7se/k5SUwLKLqokn6ESKg7Lw73I1AjYlL2ZaHkSLLrN/K5j/Jd3leRjTSlww4f7dxvg1Ew= 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:50 +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:50 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 07/13] spi: atmel-quadspi: switch to SPDX license identifiers Thread-Topic: [PATCH v4 07/13] spi: atmel-quadspi: switch to SPDX license identifiers Thread-Index: AQHUvHHEp1fPUXoA/UCY5jCZC4t8Lw== Date: Mon, 4 Feb 2019 10:09:50 +0000 Message-ID: <20190204100910.26701-8-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:4LF7YhruNp1aq4ni0Zk/Sid5MoycbRe42kUW8LknzSldrAbC1pj63qSWR+PBxp2MBIEWI5+ZhTV0RX9D2GjeBRKBKHJPDKPBo+RmSyu0tSfmOd+7ffJ882YF3XETdnsyPtpnD1E6A188GucSAHRx+4tPBz22656JwaogeqCvjB4/98ILXjDlst+tk4QOwGFE7wrOqIDpcMUmpaJdHt5Fgjfz0p7sVazemEJdbLO+FBU3VQhF+zzEYYbkplZeKZ59g8a38Up3SvijrMEX6IbZmD42RnEIiF2/YQeveVtD70nbZkEcbZQb3A2xlWizjzZ0jABfVDZd/aRgGJ+02PReyZukdMwCrVL7W61qm8fW1db6sox9FLWTcWsjAEWWsGpzrpg7dyN26yqw5XWP6V7b+1GIgFjGo9A5hV3i0TtXfTqpd9xVn+Ce4r2RdCHHq82mf1SaHR0m6uLrmnLTq6sHzg==;5:IIm/JxZrRlrdJlo7KfrBro6/r9CL+NvbtVdayOwYJNjjd8X9PBhw3tDwFp/VHq7jTPtVFAoUFAsV4QsSQHUcqoB/ihWctcb+gV8XU9iijVX9AS8pAiVOkOQR04uvG/9+1XfsJt+X59eeA7VedynvGAqyCYa9E7Qp4PGxroJcDxJkth79wuXZZMnJyxTiDpd89+yCtp5hZm9K4UtL48vN0Q==;7:JbSlE1bgm4sdoXdFlULqulY+41z3rxs30rDFBQ/tCiurCS5uGQB9anZ6lbSr3qX3LZ3IQlUkO5Nfb0Von5Mn6gp1Ip0PQ9NiSull9wxkKzLg/mKfkfTusC+OrGF+FqQM/8VD1tbpJxrQzWOa8LyE6A== x-ms-office365-filtering-correlation-id: 729be9c0-2b09-498f-de99-08d68a88e64e 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)(6306002)(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)(72206003)(66066001)(2004002);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: u2MYBub+52mxCmFajoeCAAGpCvfZY6rgf0iPUhmMBrDtZ6FhdTjS/Iz0Afr74raxrP6Hv8h4o/9JIsOONA3iI9Z2Ty+mBat4sKufVWs6akVp1OeAEJRe6deKLFGwq5Qkgstn3yiMEJQBjdajwDXeSAu5iIeeD5t+gxQ7oakdmqDBqHxBW7jzJToIuIGEtUBuYbcswcat4YDBXP/enFCCogUHtCJZDaPYE2eCg/P+HD8i7+YnfpTlek2R9/1ama28HWF8V2n99fSZb3BX1afVNjwG49swxI5hk3Ag+el7XMV5jvXOiEJEduMST7G4Y2qfBShwwhVNBfPmwQn7f70Rs9wIhS1nbr9MGklfdjryoLtWy6K/3L1csIpP8MU9gnyGyGEo8pf8yti7m1OQTheCAYshnOY8b+48MfyUQ3SAdUs= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 729be9c0-2b09-498f-de99-08d68a88e64e X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:48.0428 (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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Adopt the SPDX license identifiers to ease license compliance management. Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: no change v3: no change v2: collect R-b drivers/spi/atmel-quadspi.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 06c31830d07b..ce4f8a648f45 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Driver for Atmel QSPI Controller * @@ -7,18 +8,6 @@ * Author: Cyrille Pitchen * Author: Piotr Bugalski * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale. */ From patchwork Mon Feb 4 10:09:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1758D1390 for ; Mon, 4 Feb 2019 10:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05E2D2AB3B for ; Mon, 4 Feb 2019 10:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE0C12AB3E; Mon, 4 Feb 2019 10:10:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E0E72AB3B for ; Mon, 4 Feb 2019 10:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729353AbfBDKJ6 (ORCPT ); Mon, 4 Feb 2019 05:09:58 -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= 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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); From patchwork Mon Feb 4 10:09:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DBC86C2 for ; Mon, 4 Feb 2019 10:10:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDC2D2AB00 for ; Mon, 4 Feb 2019 10:10:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEDC52AB25; Mon, 4 Feb 2019 10:10:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 796052AB00 for ; Mon, 4 Feb 2019 10:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729391AbfBDKKC (ORCPT ); Mon, 4 Feb 2019 05:10:02 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:59645 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729403AbfBDKJ7 (ORCPT ); Mon, 4 Feb 2019 05:09:59 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="26111701" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:09:58 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:58 -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=sl0ZxzuWZAR77THBGi7a4o9ip4vZenzv5gkGL1ZO2/Y=; b=RJMASlnhu/chu9QNTyAWg/rVsrsflLhDNv+hqXb3WKxE8m7SHmwGr+Yo0CTtgmRgTnYHBZyU6XvEkLvlWru7EAB+ZANYljQxTabiYfqnExFDqJmAm2SN5RDv8WRI3m7L9OV4SnTbMMXYwsEpBZTxk82vP9mVoAcoKMqFoBrnenA= 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:57 +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:57 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 09/13] dt-bindings: spi: atmel-quadspi: update example to new clock binding Thread-Topic: [PATCH v4 09/13] dt-bindings: spi: atmel-quadspi: update example to new clock binding Thread-Index: AQHUvHHHgJu9moC3XEqdb/LUZheacg== Date: Mon, 4 Feb 2019 10:09:56 +0000 Message-ID: <20190204100910.26701-10-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:yoIXTVPaDh6GAiOXATzb1MyGXincU5eyeRa1yfFkoDNx0uZfID3zDjhshNpDBtZg5aJp8zjudIUKgKnFcCHrqhSzA8pTpxhw4p3aQxI+FAMGdFRR1PKwSJUtXFQBy/Zo/+IgpL2rNm3+Yp0fp1OBcRpUQqrG5lZn13UPZm6btHVnWwQ9lpz5naORT18quBIcQLADfi3KeSex4nWMUDSaUUz0LUSemnmbPRXNxePpfVCRPDRuOrvK7GmQmxjVGBusmxW4fNyCsv/Hft1gfDrWAJdv4hrEL+NAoRn7I26E250QVsrQMgM3+GUb5hg0L6TzUoAshsqs14T1o2dxTOLDmT4Qktl8Rij1i0fKCokUkm0wVQWFuMWkUwtGsF4X+cFoHhTUIYxtoNo95z+dBPve2zH75oJD11SpbFY36U2K4RxAdWG3FX4HZ+h30w+JCqDxlvnLgGabkIUk1KQchQb0Ag==;5:5S6o+v8t2Lyxcu3nlcGcchIEsWwR6ZlYTyyemmaFWpGi8Gw73GttO+GITo1m/Mx1a8kqWdAC++LPM6ZcIWHD4oADd093fKvMVZYvhJZh1xwOe370Pi/h/qC5ixKjJJGtGWvTuiJj1zatrpviY2ybXkYfUyYsU5KQXMNTHd18vcygGLgWSX5oyrdPvuculZs+QSC93AAG+MsTDV1DQwJm4w==;7:8iSExSVYDN3VhJdKupGoGgljn9zN613ipSHujtMtUJA407swI2DURGaVog2g0BBI+Yj2rUDrTEIL7nADO7XIxtwDqF/aZDtue+zoYDQdN7hgih9xo4UraCTNsTLRfuDll1ovB3uxlo7MCM0qp6bh0A== x-ms-office365-filtering-correlation-id: 0fa432ae-4bbe-4571-5c75-08d68a88e9f1 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)(4744005)(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: x2CgSAf52F0RezGIWtdvpVXiVBvuyDby12e5aaoT4w8q1gehn06XQBA/X27zJ7iTTtIHNddHHvFL+oz+oB63Mj/Qdt1SxnWiZWSnfxEh9C3ksXrilMBBOEpXAHdqNlsX5WjEUE+MRkRpwOoEJt4rvgkCrrfl8fegbS3I50iW84rocfXGBHN6shPPmPpVuEPh2tTuI/8xYisuhj3XEb74ShMIKZBVaHw+FxPcOkXZcHIcPTThB4EI8CTZbbcvV5yS4WdwAKfSwOvNkKEUpMOkuxNVuxycPGCUBXa9FwCZbfHUB766QuwI9weX0AflI38JY3jfqfv4F/uqb9HjSxXJjfcAg5me+CVqN75S8Qc4WIrFzTpvlxUMDdbi/1B+GwKKszAsHtm1bhlQR8h+/ITijOi8u7FeoTVsSHh9o3IZlTA= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0fa432ae-4bbe-4571-5c75-08d68a88e9f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:53.9287 (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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Introduced in: commit b60557876849 ("ARM: dts: at91: sama5d2: switch to new clock binding") Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: no change v3: new patch Documentation/devicetree/bindings/spi/atmel-quadspi.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/atmel-quadspi.txt b/Documentation/devicetree/bindings/spi/atmel-quadspi.txt index b93c1e2f25dd..e9dae6264d89 100644 --- a/Documentation/devicetree/bindings/spi/atmel-quadspi.txt +++ b/Documentation/devicetree/bindings/spi/atmel-quadspi.txt @@ -19,7 +19,7 @@ spi@f0020000 { reg = <0xf0020000 0x100>, <0xd0000000 0x8000000>; reg-names = "qspi_base", "qspi_mmap"; interrupts = <52 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&spi0_clk>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 52>; #address-cells = <1>; #size-cells = <0>; pinctrl-names = "default"; From patchwork Mon Feb 4 10:10:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E49C61390 for ; Mon, 4 Feb 2019 10:10:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2DF12AB3B for ; Mon, 4 Feb 2019 10:10:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C698E2AB5B; Mon, 4 Feb 2019 10:10:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E36D62AB3B for ; Mon, 4 Feb 2019 10:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729421AbfBDKKF (ORCPT ); Mon, 4 Feb 2019 05:10:05 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:24536 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729430AbfBDKKD (ORCPT ); Mon, 4 Feb 2019 05:10:03 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="23387582" 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:10:03 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:10:02 -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=Hi1vNDMrxr0a1GeY9ud/j7RRugFDkPqeT8Wp8GY6C3A=; b=KoE9sjjnOWDm5gra/59xE8HwX2XfmDLfiPxEw/FmmRGJ+O9qeu7uoCRkeIthcr6thAQ8DgdbaCQwnfETaCgzda5AVfaCBAg4PWIlD4E0cB6Ih1V0LOFIjA4sCZyHaa24g9opoEa7lX6idvEs/HSGZzLYfYfGnEGTSyfaZttaLxo= 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:10:01 +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:10:01 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 10/13] dt-bindings: spi: atmel-quadspi: make "pclk" mandatory Thread-Topic: [PATCH v4 10/13] dt-bindings: spi: atmel-quadspi: make "pclk" mandatory Thread-Index: AQHUvHHKNN0AaU4kNUq82/lZ0qLedQ== Date: Mon, 4 Feb 2019 10:10:01 +0000 Message-ID: <20190204100910.26701-11-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:CGRyQDY9D9mUpou7mwzrd1JqKfEtzMU3BUVIVg8WiVMIulv4d9pZrKIUF1LHNuvIQebqz+oxc5qvpgjv6PF+pl+5sx57EmA9eB3XEfQ7yQQBQFx2QvAsri9m3NlY29nP3AluCgHszi1/R3aWc8ia4OoZKfy+i7Z8x60PfHXiJqSJlU8yKBelVpyv8brZYm/1aGcdEq3+wYG3Imi+/PfSBA0vsrRj/wBSlj4w/aRM8DPgE8YJSN44FFBiVrIf5sS3uifHut2L2YkrmhZ6TVBFf4rdhJM7RrtW9wuo+YJC4NtdbOKghGFT6jiK1uVeYlFjQwWh1RdJCC22Zm4/MDoyudNRCP29iONgyuIRCijFadIR82oRBRhcox2BRzR+9DOn/yeTJdgah9lUIUZznDarAGhcxIKGA0xuS4qGxfVNbuZoV4XkqY6D9CxEolkzZVl6uEfPrma3+pl5DmCJVAuLtg==;5:DvEPMp4SPKg1hj3Ls5nlxT8rK+LI4AgK+mLTgtV7S/G6nKU92fvUBfh9jccmY8oKtt4S/ylH3Qny2HszFWXBjuWrA1Z2PbspUCI+ZnYz5+9PMoUSZ8m68dMYYSGkrAZXAl5Q/wudPuGIZKzOF0PEyTJ118hDXBrWDHkOm/acdqBALYbc2+dcLytWxnjPZkxY63FIW2+04iv12iWcm48EMw==;7:C1of3+oieED+bF7ElCGCIFP/TeIRhJfs6RepS9Kkr4Qdi0QpnKF5ej74feVTMkuKOWOqZyPAqo7pyEoiT9UDUSeN8S175WK9sC2Gan+ZksJv1VP3xdS12NgsVOU1YP7IgDhw8afc94tTIJAW0VRCHw== x-ms-office365-filtering-correlation-id: a4d3f372-ab71-4121-4337-08d68a88ec97 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)(979002)(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)(72206003)(66066001)(969003)(989001)(999001)(1009001)(1019001);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: wmkBAQR5BHEdrJkOSKA5F9gucnqqgKV7QVp2TAdwHdctRal5uexQfFjvyAa5uL+6SBzjyBKGfGSiyCh7aS69u1EkMwfd5dV96/GF/kBA/qpmCK5caH3NP1jw88XZwXp32rOn8E6IYCi7S7BZ+afne/1fVFy5x8ZgtNPoxYOQTiGBlTS3y7W5uVOZnKXI/WLfaUzd+mCgvz1KjwN37fPhoSFmiAPxG9cQeMh+Qwq52cojfN86aSwjjN5hfJk5AatKvv8tlhuTB1r5XIz7l7KWDhhL5N0FZ75kVwDh0kw3CSjLC8CY2+8FGOTPiEyw2YeTV4AKiRozvELXwEGkrMdNLy0UjNjsT5YprRjGt+1MAkytrr3meXoJGeacJmN9jHS7NOb0F/j2KBCLJPmpHRfBEZ4Jo0nIpMr2TUk920ecuWI= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a4d3f372-ab71-4121-4337-08d68a88ec97 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:57.5187 (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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Naming clocks is a good practice. Make "pclk" madatory even if we support unnamed clock in the driver, to be backward compatible with old DTs. Suggested-by: Boris Brezillon Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: add missing semicolon, collect R-b v3: new patch Documentation/devicetree/bindings/spi/atmel-quadspi.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/atmel-quadspi.txt b/Documentation/devicetree/bindings/spi/atmel-quadspi.txt index e9dae6264d89..50bd257e6826 100644 --- a/Documentation/devicetree/bindings/spi/atmel-quadspi.txt +++ b/Documentation/devicetree/bindings/spi/atmel-quadspi.txt @@ -9,6 +9,7 @@ Required properties: - qspi_mmap: memory mapped address space - interrupts: Should contain the interrupt for the device. - clocks: The phandle of the clock needed by the QSPI controller. +- clock-names: Should contain "pclk" for the peripheral clock. - #address-cells: Should be <1>. - #size-cells: Should be <0>. @@ -20,6 +21,7 @@ spi@f0020000 { reg-names = "qspi_base", "qspi_mmap"; interrupts = <52 IRQ_TYPE_LEVEL_HIGH 7>; clocks = <&pmc PMC_TYPE_PERIPHERAL 52>; + clock-names = "pclk"; #address-cells = <1>; #size-cells = <0>; pinctrl-names = "default"; From patchwork Mon Feb 4 10:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0B016C2 for ; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA682AB30 for ; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D34222AB3C; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99D4D2AB30 for ; Mon, 4 Feb 2019 10:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729459AbfBDKKL (ORCPT ); Mon, 4 Feb 2019 05:10:11 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:33464 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729448AbfBDKKI (ORCPT ); Mon, 4 Feb 2019 05:10:08 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="26269144" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:10:06 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:10:06 -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=+28Y2aJ8lIMlNQDPgbnkcqOqn5q0Pm2UPftgTWFysnk=; b=MtJPNFFhItlI1W4e2/kbk5eimMNwaH6+MqC2gN5Y/aPEVOIN3ngd9tVnt/soEP+1Ef4dNtP1hLWmYnwr38jVYL1nT6lEG2gT8myhhvHHpxDFwvBVYjfVhhz3/kbuxUAU1p6dX92Ru10sJn/1/SjTLeGSqXkBXLb1a2ZlZmSH6is= 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:10:04 +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:10:04 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 11/13] spi: atmel-quadspi: add support for named peripheral clock Thread-Topic: [PATCH v4 11/13] spi: atmel-quadspi: add support for named peripheral clock Thread-Index: AQHUvHHMdbu+8gPxv02aD+K9PloJHQ== Date: Mon, 4 Feb 2019 10:10:04 +0000 Message-ID: <20190204100910.26701-12-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/rRzrmttsHLtWSgHgm9pNIC2o9JzK3eWQn+l4wja+cakrGomV3rTHe7LBH5ZSZbjcJiTuQi7dMEOsu5mpeaWWnjRllD0hEDo5cNtzRH4oEPjSrHKeBXLpyrjx2BKaHyg8KJnQNkjGMm/CceqFEgw/gxLBwv/1ReBfDQiMQnPMHOCcdazBhH2YMJq1wnrwLiXahE3dgcRczaiqImkgjsyMjyj6tKlstX34QK6B6XVk2j2k6+3LGktKIhW1DQNCKxBvv8QTIzm/mtuaymm7FRXgjtVA/r4B/Ue9cCyAGJIbNdFBvwmgacwzuGGlipWuTuzKvuCAPLFY3liUruVWnsnl/OgD1ew/aKYOw0w+NDaUCyGAl/Kf1leBuSoQPRPvPgsoUthgCMLJxQ5RKPhjzFnUxWpYHBBPA777nOTtNB2vRAMZsEtIb9IedYYeNuA1+Q+S436Hly1wFKYmo4/fuO/g==;5:+F+fWhsuzDAGQLehqbZK1K/4M51Q/4/lun0LWJNuzMTeKNABH5zSIICrYa18HwcRBle3xzsvYt/M6X58ePK0pZrRZirJnBk792YKpdMPifWHNh+lt6LJ6us4l+4+zIFZ9zRSDOvs9cP8TtNsH6O6xP97LBDuaf6nFOvQ2C0ykEQ80jnIbjxqVNjX1jrQEtQZLagDHA84v6EbTqzaOy1Lyw==;7:w802giGm6RycDJ3lwSW2b4oXug3Ge4CEUwOD58X8PCt3VQvI4wxAUb8E5RXC9KoRCCwr2HpYrBNjbdZ/mxLF0NRhInFbFUdzgjICL7tl9SsHCxf+wqnpaxW8d8Dqx4xbSMT/MZb5dPnHuc/4AUCNeg== x-ms-office365-filtering-correlation-id: 79908c6a-6ee0-4ba2-4a60-08d68a88ee90 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: xmrPJRi2JAxbkkFjW8L/UWrNYJ2tRui/EF/jTKb4MENKJuSmgWfuHHwBrgv1r0wZKOkZcnlI3a/+wb2ZT7Ow863PCY7BYuNDRPSi9eY44/1bieC+eA0rDF7cf7Y0ejPXr8/vaGQz63z6zpKAzWUSrwCs6QHv9CP6NaINUCKbyqxxoH71AqHIAAghGDlFPrHBCkRI2jjKxSg5YgBlVC+y+zirgdkfbvLRpRXE/xTwZPjPRWTZ1EMgiyAgobVEjw62xcrFJ31bcD6NT2frYnYbFSdo8wPlRvvDvZVd/JdozyvtQM2WXDOeLWqegt7e0t6Q222bm6InDVuQvq5yh/3DIUUtaem3D/qYLk/00HfrIpORn0QZ/BpvcNYMd4Q6P3AP1pW/N5aohzG7XuNpRUkLD2laR8MKDr/vD2iHxzdfUKo= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 79908c6a-6ee0-4ba2-4a60-08d68a88ee90 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:10:01.6411 (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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Naming clocks is a good practice. Keep supporting unnamed peripheral clock, to be backward compatible with old DTs. While here, rename clk to pclk, to indicate that it is a peripheral clock. Suggested-by: Boris Brezillon Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: collect R-b v3: new patch drivers/spi/atmel-quadspi.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 19a3980775ad..336501d962e5 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -137,7 +137,7 @@ struct atmel_qspi { void __iomem *regs; void __iomem *mem; - struct clk *clk; + struct clk *pclk; struct platform_device *pdev; u32 pending; u32 mr; @@ -341,7 +341,7 @@ static int atmel_qspi_setup(struct spi_device *spi) if (!spi->max_speed_hz) return -EINVAL; - src_rate = clk_get_rate(aq->clk); + src_rate = clk_get_rate(aq->pclk); if (!src_rate) return -EINVAL; @@ -433,15 +433,18 @@ static int atmel_qspi_probe(struct platform_device *pdev) } /* Get the peripheral clock */ - aq->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(aq->clk)) { + aq->pclk = devm_clk_get(&pdev->dev, "pclk"); + if (IS_ERR(aq->pclk)) + aq->pclk = devm_clk_get(&pdev->dev, NULL); + + if (IS_ERR(aq->pclk)) { dev_err(&pdev->dev, "missing peripheral clock\n"); - err = PTR_ERR(aq->clk); + err = PTR_ERR(aq->pclk); goto exit; } /* Enable the peripheral clock */ - err = clk_prepare_enable(aq->clk); + err = clk_prepare_enable(aq->pclk); if (err) { dev_err(&pdev->dev, "failed to enable the peripheral clock\n"); goto exit; @@ -452,25 +455,25 @@ static int atmel_qspi_probe(struct platform_device *pdev) if (irq < 0) { dev_err(&pdev->dev, "missing IRQ\n"); err = irq; - goto disable_clk; + goto disable_pclk; } err = devm_request_irq(&pdev->dev, irq, atmel_qspi_interrupt, 0, dev_name(&pdev->dev), aq); if (err) - goto disable_clk; + goto disable_pclk; err = atmel_qspi_init(aq); if (err) - goto disable_clk; + goto disable_pclk; err = spi_register_controller(ctrl); if (err) - goto disable_clk; + goto disable_pclk; return 0; -disable_clk: - clk_disable_unprepare(aq->clk); +disable_pclk: + clk_disable_unprepare(aq->pclk); exit: spi_controller_put(ctrl); @@ -484,7 +487,7 @@ static int atmel_qspi_remove(struct platform_device *pdev) spi_unregister_controller(ctrl); writel_relaxed(QSPI_CR_QSPIDIS, aq->regs + QSPI_CR); - clk_disable_unprepare(aq->clk); + clk_disable_unprepare(aq->pclk); return 0; } @@ -492,7 +495,7 @@ static int __maybe_unused atmel_qspi_suspend(struct device *dev) { struct atmel_qspi *aq = dev_get_drvdata(dev); - clk_disable_unprepare(aq->clk); + clk_disable_unprepare(aq->pclk); return 0; } @@ -501,7 +504,7 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev) { struct atmel_qspi *aq = dev_get_drvdata(dev); - clk_prepare_enable(aq->clk); + clk_prepare_enable(aq->pclk); return atmel_qspi_init(aq); } From patchwork Mon Feb 4 10:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 439F217FB for ; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3203D2AB3B for ; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 260FA2AB3E; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3015C2AB3C for ; Mon, 4 Feb 2019 10:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728482AbfBDKKS (ORCPT ); Mon, 4 Feb 2019 05:10:18 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:33464 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728453AbfBDKKK (ORCPT ); Mon, 4 Feb 2019 05:10:10 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="26269146" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:10:10 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.107) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:10:09 -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=DM9YvZFRmm2TujWMa9nU320PQq2xBK8WAP6mbRCU62Q=; b=oAgHbpy9TM02n/W6bIcNXCjQO3rfT7Zv0AoGEXibeFTCqfCt39AnYYB1kfAr+SohH1f5o3Gp6ToudHHxxvvG6wa3DO9v2yRh0b5iqE4Y5LHg0cx6biJ8RerxSHwOedQ8/S4eEIcy2Emcsy/LFXvPf5cHQfFT7ztRFIZmznWy/xU= 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:10:08 +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:10:08 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 12/13] dt-bindings: spi: atmel-quadspi: QuadSPI driver for Microchip SAM9X60 Thread-Topic: [PATCH v4 12/13] dt-bindings: spi: atmel-quadspi: QuadSPI driver for Microchip SAM9X60 Thread-Index: AQHUvHHORQ3gmJMls022AUAaShGcrw== Date: Mon, 4 Feb 2019 10:10:08 +0000 Message-ID: <20190204100910.26701-13-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:F6H9QMlkGjUeufPohpPHIofAK/Q+1rILtJVyR6CABwmTA5dwHjPsOEqLG5kJf68ddhsD40+31ygumT8/c2TdWbuHhd70Tj3QNu6I/aimw2Rd3lUIH/YrfNVh4JwmwC9PNInar2uY9xVUz5EfczY2f6S/oSrvxMICE5YTu9RxbGwuLAF0yJvqxQN51PhOvTV3+YLGYBA4xv9QI//3WDmRvmHlWzFEsDbxZuNnABDC0ar8ljDHsKKG616aMru3kjQ95g0/d7VQHI/HNXBcgH6WoT1SFLQgcXZhRqu3ZPeriXbSzz76IRGEGcH1uZ0A2dvwh94Q7Lx6qHUc0ebQr81yiZvAonDzWLKejEeVmCokw/ae5hRh7QQZ58IcR1ZSmnnx3cKYucfUY45EplYpT37MZznSY7sxaQIUv2CM9vxzLE9QfgLDigvvm3UoxxHW9xg+Ehqsfp5YspcxxbueRnPdTA==;5:CONmofZgrPnM5MMq8vlShcM9MKpZBgCt50cSCc98cVIAjfGhFsKsjnDJo9UEIbFdSsEooC0pkneDopM4+mdOO7/xaIe1johz3jvvqgFWxI9PpkNaNToQNJYTp32Iq6ryGNvvxOGvTGm9GILRkwqLW7ed75E97fZyTU+0qopnfSJs0LdiIvTDjBgyQXO3JzlL/sqw76uULuef1buYlMwgIQ==;7:bkENbz5KA/kWVfvMTqrOuNcQPDJrKq0toK6NN0b5tSylCfLetlKoVqvhRpkl687eyYZWP5sSx1hRr3Gz8QNiM5ymC76Y/Kk+1haemIQ9xWWjIFrYqZ7Ye7niuMoYB1JzBCPfEgF5kuOFj0+elhV91g== x-ms-office365-filtering-correlation-id: 6448876f-88b0-47a3-4b78-08d68a88f0a1 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: VSKawq9VLWQHfpDKbDDL8UCxz0VH9bvmbsvzBbjo76BiXEgcnO4+S6Bgx8TquJO41zcXbhzaVnZvYS2/7wBZ1BIne8YKbESiVcQmBBcIpI7TetR8MNCD2nKpknQyNiGYrMJ77nq4Bl1pSJn7Jb3vr6OFgb/Iv9LZHi8JszCi6WvxH4eprytqK8RsxYtskN2cQF5HCEH0dmYLcptEE4vl+orB6AAHeLsAn0+UbAGJ9Ta6f20B1KNlA597oiPPEWVJuPSiB+3sHbj+nqwbEsSGOeT9/J9Y/tp/lip6oWmw4vvFiQDK4X+/A64jEOz4bMoDibonWL0IIA4PbKmqKB5w5MUPWveYx52MgMGbxpFfhoiruJqN3kVFICruSUk3XfscBID16sERCKjswzn0AFy2StQdx5MM29F+0YcRDwEmjBY= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6448876f-88b0-47a3-4b78-08d68a88f0a1 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:10:05.0149 (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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus The sam9x60 qspi controller uses 2 clocks, one for the peripheral register access, the other for the qspi core and phy. Both are mandatory. Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: collect R-b v3: "pclk" was made mandatory in previous patch. Reword clock descriptions. v2: - make "pclk" mandatory even for sama5d2. Unnamed clk will be supported in the driver. - drop unneeded example Documentation/devicetree/bindings/spi/atmel-quadspi.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/atmel-quadspi.txt b/Documentation/devicetree/bindings/spi/atmel-quadspi.txt index 50bd257e6826..7c40ea694352 100644 --- a/Documentation/devicetree/bindings/spi/atmel-quadspi.txt +++ b/Documentation/devicetree/bindings/spi/atmel-quadspi.txt @@ -1,15 +1,19 @@ * Atmel Quad Serial Peripheral Interface (QSPI) Required properties: -- compatible: Should be "atmel,sama5d2-qspi". +- compatible: Should be one of the following: + - "atmel,sama5d2-qspi" + - "microchip,sam9x60-qspi" - reg: Should contain the locations and lengths of the base registers and the mapped memory. - reg-names: Should contain the resource reg names: - qspi_base: configuration register address space - qspi_mmap: memory mapped address space - interrupts: Should contain the interrupt for the device. -- clocks: The phandle of the clock needed by the QSPI controller. -- clock-names: Should contain "pclk" for the peripheral clock. +- clocks: Should reference the peripheral clock and the QSPI system + clock if available. +- clock-names: Should contain "pclk" for the peripheral clock and "qspick" + for the system clock when available. - #address-cells: Should be <1>. - #size-cells: Should be <0>. From patchwork Mon Feb 4 10:10:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E55CF6C2 for ; Mon, 4 Feb 2019 10:10:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D138E2AB3B for ; Mon, 4 Feb 2019 10:10:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4B522AB3C; Mon, 4 Feb 2019 10:10:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A493D2AB3E for ; Mon, 4 Feb 2019 10:10:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728344AbfBDKKZ (ORCPT ); Mon, 4 Feb 2019 05:10:25 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:33483 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728453AbfBDKKY (ORCPT ); Mon, 4 Feb 2019 05:10:24 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="26269150" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:10:23 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.107) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:10:23 -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=ali36uYEmRJApX2WSVWs24q65iyd2Qr87zsfVgfjAYE=; b=HrrUP3mQRlN+EyKQ/fNdIZlFml8/qrFzaqkE2wZxarWmVCzvcIEaOarrwi8EoCsBvrtqal9du08SXGXRWPxbP62Y9E/WhJ4HeuygFYeHXDb/oGw5Y76M4UirCnnMv/gxwMuJ/o35cFepETW0WpwRty8J6u++FZhBDW6PPkLErOg= 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:10:21 +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:10:21 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 13/13] spi: atmel-quadspi: add support for sam9x60 qspi controller Thread-Topic: [PATCH v4 13/13] spi: atmel-quadspi: add support for sam9x60 qspi controller Thread-Index: AQHUvHHWdNk7TDcc4kmbhc3k/0wcZw== Date: Mon, 4 Feb 2019 10:10:21 +0000 Message-ID: <20190204100910.26701-14-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:+4YVLMz1wE8wyLOJhYc4d1eXbCzg6SO6wY6bPBUP6aMRQ8LouZkumUb12w52lUVLcUxgw+XmQqvlcZR4CAmm/Wc64ahJkVMawgwwNWro7hW/K2lGJaaW9Oic7wR18cwDGAHEH/5FtvNwMm6/gxE5ilzUlYvFyQShqeuACfy2rC9RqNL7P3LLaB9vJ7o6rbn/vHy3CLfmuyBVt7ujbkcG0HfbqHjdYAcxOn2aBOne4c32/PX62UBwxIfmC+cXTutJuOGz8+iOlnV5OaBjMiqmjNCdClbprX1IflVs7F7t1+HmMrHCVxWxpCAai0ufzqT8RAwO5Hk3+tt8s2ug3wpq0Js0mrCEUo00VXZg25Tug1zDjuyYrvFeOVRGCjIvZJeUDR0vbRsmrO3QaeCogLTE5SoyyYcU7+eOK4LOfxQzFh1Qelqv1VJ8PxB9FBI8wmb5tn0QoDpfMSXW86bqJzuNqA==;5:nA1JMqjxlSGPxRlTvG7w6wSCvN8JoJLdwXOuGWFyZW4tK+j+yIsgXKFEaHk1VrmG5OyTvESpmD0ky93FwDOaPgz8LbSXpFzMep6hDFtSqugas3x6YHKptlQVOatNAy6RytyIIRuMIRsPcNzhXefB7tbNHJqJz+2be47oQF0+2pU/Ma4SULOJmxmPHLpxzlrkS9mnKsV42didoNKdjDtM9Q==;7:deIhmbZTkrztiCHRvSr6t8ujIXP9p1ntJuYlxRnux8ZyMPkRd9Q4nQlzdam0M8uZyYWEZ1AkTZmAeBj6x9I8+EzhDwTUYNe6fQXHVl3m+P0ULczmfjBBYkeDnY+3E8oi2N7FP6cktkGmQG7YCulccg== x-ms-office365-filtering-correlation-id: 21b5aea3-1482-45cb-e9ec-08d68a88f874 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)(53946003)(2906002)(386003)(54906003)(6506007)(86362001)(1076003)(36756003)(30864003)(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: MrkUx/3g7DXJumJYc4wWetT0wRJymF49AN24nIn2DZthdQmsTm8TJMIZy6AsTdO7zwyZ2C6EfMEfRovbloU0W+IDywpg5dyTkypQ9h4aS+BPCZIbNV9GN22Y8bm7bSI+0L9Xao4aftY+v/w8spCgQJ2JXN+OmMUG5VWhONTURYmeomYmmQoxhIYcqRKmQSYcrb3/1PdeRNMqI0AgwsPvYpLymDRJofQ+LiTYZds1umR5WtUMtFVluRzCNTTf+fPEP+RWFNMoyQaMY+eK1ok8GmV2W7k4DCeUAcSrtGzAd/tNNWI7YGnMsEWlUouv7T72dEr64tETK5vxYS1mv8LNTlq5qHTSkOokwEYTkQ/jFbLj5RagiWSt0NEFL/3cc7MCWlgkZiM23abxxjYzobWEyAdXfCLli2qPggldWK3x7ng= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 21b5aea3-1482-45cb-e9ec-08d68a88f874 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:10:08.5198 (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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus The sam9x60 qspi controller uses 2 clocks, one for the peripheral register access, the other for the qspi core and phy. Both are mandatory. It uses different transfer type bits in IFR register. It has dedicated registers to specify a read or a write instruction: Read Instruction Code Register (RICR) and Write Instruction Code Register (WICR). ICR/RICR/WICR have identical fields. Tested with sst26vf064b jedec,spi-nor flash. Backward compatibility test done on sama5d2 qspi controller and mx25l25635e jedec,spi-nor flash. Signed-off-by: Tudor Ambarus --- v4: - drop local variables that kept aq->regs and &pdev->dev, the compiler should be smart enough to store them in a register - add comment saying QSPI_IFR_APBTFRTYP_READ is defined in sam9x60 - s/sama5d2_qspi_modes/atmel_qspi_modes, modes are the same both controllers - fix kernel doc header - move comment in function body v3: - reorganize the code and change ops functions pointers to avoid code duplication. From the IP perspective, the transfer type bits are different, and what registers are written: ricr/wicr instead of icr. - treat just regular spi transfers. Mem transfers will be added together with dirmap support. v2: - rework clock handling - reorder setting of register values in set_cfg() calls -> move functions that can fail in the upper part of the function body. drivers/spi/atmel-quadspi.c | 282 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 228 insertions(+), 54 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 336501d962e5..52e96c3ff9e6 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,9 @@ #define QSPI_IAR 0x0030 /* Instruction Address Register */ #define QSPI_ICR 0x0034 /* Instruction Code Register */ +#define QSPI_WICR 0x0034 /* Write Instruction Code Register */ #define QSPI_IFR 0x0038 /* Instruction Frame Register */ +#define QSPI_RICR 0x003C /* Read Instruction Code Register */ #define QSPI_SMR 0x0040 /* Scrambling Mode Register */ #define QSPI_SKR 0x0044 /* Scrambling Key Register */ @@ -88,7 +91,7 @@ #define QSPI_SCR_DLYBS_MASK GENMASK(23, 16) #define QSPI_SCR_DLYBS(n) (((n) << 16) & QSPI_SCR_DLYBS_MASK) -/* Bitfields in QSPI_ICR (Instruction Code Register) */ +/* Bitfields in QSPI_ICR (Read/Write Instruction Code Register) */ #define QSPI_ICR_INST_MASK GENMASK(7, 0) #define QSPI_ICR_INST(inst) (((inst) << 0) & QSPI_ICR_INST_MASK) #define QSPI_ICR_OPT_MASK GENMASK(23, 16) @@ -118,6 +121,7 @@ #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) +#define QSPI_IFR_APBTFRTYP_READ BIT(24) /* Defined in SAM9X60 */ /* Bitfields in QSPI_SMR (Scrambling Mode Register) */ #define QSPI_SMR_SCREN BIT(0) @@ -134,16 +138,40 @@ #define QSPI_WPSR_WPVSRC(src) (((src) << 8) & QSPI_WPSR_WPVSRC) +/* Describes register values. */ +struct atmel_qspi_cfg { + u32 icr; + u32 iar; + u32 ifr; +}; + +struct atmel_qspi_caps; + struct atmel_qspi { void __iomem *regs; void __iomem *mem; struct clk *pclk; + struct clk *qspick; struct platform_device *pdev; + const struct atmel_qspi_caps *caps; u32 pending; u32 mr; struct completion cmd_completion; }; +struct atmel_qspi_ops { + void (*set_tfrtyp)(const struct spi_mem_op *op, + struct atmel_qspi_cfg *cfg); + void (*write_regs)(const struct atmel_qspi *aq, + const struct spi_mem_op *op, + const struct atmel_qspi_cfg *cfg); +}; + +struct atmel_qspi_caps { + const struct atmel_qspi_ops *ops; + bool has_qspick; +}; + struct atmel_qspi_mode { u8 cmd_buswidth; u8 addr_buswidth; @@ -151,7 +179,7 @@ struct atmel_qspi_mode { u32 config; }; -static const struct atmel_qspi_mode sama5d2_qspi_modes[] = { +static const struct atmel_qspi_mode atmel_qspi_modes[] = { { 1, 1, 1, QSPI_IFR_WIDTH_SINGLE_BIT_SPI }, { 1, 1, 2, QSPI_IFR_WIDTH_DUAL_OUTPUT }, { 1, 1, 4, QSPI_IFR_WIDTH_QUAD_OUTPUT }, @@ -180,8 +208,8 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op) { u32 i; - for (i = 0; i < ARRAY_SIZE(sama5d2_qspi_modes); i++) - if (atmel_qspi_is_compatible(op, &sama5d2_qspi_modes[i])) + for (i = 0; i < ARRAY_SIZE(atmel_qspi_modes); i++) + if (atmel_qspi_is_compatible(op, &atmel_qspi_modes[i])) return i; return -ENOTSUPP; @@ -201,63 +229,69 @@ static bool atmel_qspi_supports_op(struct spi_mem *mem, return true; } -static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) +static int atmel_qspi_set_mode(struct atmel_qspi_cfg *cfg, + const struct spi_mem_op *op) { - struct atmel_qspi *aq = spi_controller_get_devdata(mem->spi->master); - int mode; - u32 dummy_cycles = 0; - u32 iar, icr, ifr, sr; - int err = 0; - - iar = 0; - icr = QSPI_ICR_INST(op->cmd.opcode); - ifr = QSPI_IFR_INSTEN; - - /* - * If the QSPI controller is set in regular SPI mode, set it in - * Serial Memory Mode (SMM). - */ - if (aq->mr != QSPI_MR_SMM) { - writel_relaxed(QSPI_MR_SMM, aq->regs + QSPI_MR); - aq->mr = QSPI_MR_SMM; - } + int mode = atmel_qspi_find_mode(op); - mode = atmel_qspi_find_mode(op); if (mode < 0) return mode; + cfg->ifr = atmel_qspi_modes[mode].config; + return 0; +} - ifr |= sama5d2_qspi_modes[mode].config; +/** + * atmel_qspi_set_address_mode() - set address mode. + * @cfg: contains register values + * @op: describes a SPI memory operation + */ +static int atmel_qspi_set_address_mode(struct atmel_qspi_cfg *cfg, + const struct spi_mem_op *op) +{ + u32 dummy_cycles = 0; if (op->dummy.buswidth && op->dummy.nbytes) dummy_cycles = op->dummy.nbytes * 8 / op->dummy.buswidth; + /* + * The controller allows 24 and 32-bit addressing while NAND-flash + * requires 16-bit long. Handling 8-bit long addresses is done using + * the option field. For the 16-bit addresses, the workaround depends + * of the number of requested dummy bits. If there are 8 or more dummy + * cycles, the address is shifted and sent with the first dummy byte. + * Otherwise opcode is disabled and the first byte of the address + * contains the command opcode (works only if the opcode and address + * use the same buswidth). The limitation is when the 16-bit address is + * used without enough dummy cycles and the opcode is using a different + * buswidth than the address. + */ if (op->addr.buswidth) { switch (op->addr.nbytes) { case 0: break; case 1: - ifr |= QSPI_IFR_OPTEN | QSPI_IFR_OPTL_8BIT; - icr |= QSPI_ICR_OPT(op->addr.val & 0xff); + cfg->ifr |= QSPI_IFR_OPTEN | QSPI_IFR_OPTL_8BIT; + cfg->icr = QSPI_ICR_OPT(op->addr.val & 0xff); break; case 2: if (dummy_cycles < 8 / op->addr.buswidth) { - ifr &= ~QSPI_IFR_INSTEN; - ifr |= QSPI_IFR_ADDREN; - iar = (op->cmd.opcode << 16) | - (op->addr.val & 0xffff); + cfg->ifr &= ~QSPI_IFR_INSTEN; + cfg->ifr |= QSPI_IFR_ADDREN; + cfg->iar = (op->cmd.opcode << 16) | + (op->addr.val & 0xffff); } else { - ifr |= QSPI_IFR_ADDREN; - iar = (op->addr.val << 8) & 0xffffff; + cfg->ifr |= QSPI_IFR_ADDREN; + cfg->iar = (op->addr.val << 8) & 0xffffff; dummy_cycles -= 8 / op->addr.buswidth; } break; case 3: - ifr |= QSPI_IFR_ADDREN; - iar = op->addr.val & 0xffffff; + cfg->ifr |= QSPI_IFR_ADDREN; + cfg->iar = op->addr.val & 0xffffff; break; case 4: - ifr |= QSPI_IFR_ADDREN | QSPI_IFR_ADDRL; - iar = op->addr.val & 0x7ffffff; + cfg->ifr |= QSPI_IFR_ADDREN | QSPI_IFR_ADDRL; + cfg->iar = op->addr.val & 0x7ffffff; break; default: return -ENOTSUPP; @@ -266,22 +300,100 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) /* Set number of dummy cycles */ if (dummy_cycles) - ifr |= QSPI_IFR_NBDUM(dummy_cycles); + cfg->ifr |= QSPI_IFR_NBDUM(dummy_cycles); - /* Set data enable */ - if (op->data.nbytes) - ifr |= QSPI_IFR_DATAEN; + return 0; +} +static void atmel_qspi_sama5d2_set_tfrtyp(const struct spi_mem_op *op, + struct atmel_qspi_cfg *cfg) +{ if (op->data.dir == SPI_MEM_DATA_OUT) - ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; + cfg->ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; +} +static void atmel_qspi_sama5d2_write_regs(const struct atmel_qspi *aq, + const struct spi_mem_op *op, + const struct atmel_qspi_cfg *cfg) +{ /* Clear pending interrupts */ (void)readl_relaxed(aq->regs + QSPI_SR); /* Set QSPI Instruction Frame registers */ - writel_relaxed(iar, aq->regs + QSPI_IAR); - writel_relaxed(icr, aq->regs + QSPI_ICR); - writel_relaxed(ifr, aq->regs + QSPI_IFR); + writel_relaxed(cfg->iar, aq->regs + QSPI_IAR); + writel_relaxed(cfg->icr, aq->regs + QSPI_ICR); + writel_relaxed(cfg->ifr, aq->regs + QSPI_IFR); +} + +static void atmel_qspi_sam9x60_set_tfrtyp(const struct spi_mem_op *op, + struct atmel_qspi_cfg *cfg) +{ + if (!op->addr.nbytes && op->data.dir == SPI_MEM_DATA_IN) + cfg->ifr |= QSPI_IFR_APBTFRTYP_READ; +} + +static void atmel_qspi_sam9x60_write_regs(const struct atmel_qspi *aq, + const struct spi_mem_op *op, + const struct atmel_qspi_cfg *cfg) +{ + /* Clear pending interrupts */ + (void)readl_relaxed(aq->regs + QSPI_SR); + + /* Set QSPI Instruction Frame registers */ + writel_relaxed(cfg->iar, aq->regs + QSPI_IAR); + if (op->data.dir == SPI_MEM_DATA_IN) + writel_relaxed(cfg->icr, aq->regs + QSPI_RICR); + else + writel_relaxed(cfg->icr, aq->regs + QSPI_ICR); + writel_relaxed(cfg->ifr, aq->regs + QSPI_IFR); +} + +static int atmel_qspi_set_cfg(struct atmel_qspi *aq, + const struct spi_mem_op *op, + struct atmel_qspi_cfg *cfg) +{ + int ret; + + /* + * If the QSPI controller is set in regular SPI mode, set it in + * Serial Memory Mode (SMM). + */ + if (aq->mr != QSPI_MR_SMM) { + writel_relaxed(QSPI_MR_SMM, aq->regs + QSPI_MR); + aq->mr = QSPI_MR_SMM; + } + + ret = atmel_qspi_set_mode(cfg, op); + if (ret) + return ret; + + ret = atmel_qspi_set_address_mode(cfg, op); + if (ret) + return ret; + + cfg->ifr |= QSPI_IFR_INSTEN; + cfg->icr |= QSPI_ICR_INST(op->cmd.opcode); + + /* Set data enable */ + if (op->data.nbytes) + cfg->ifr |= QSPI_IFR_DATAEN; + + aq->caps->ops->set_tfrtyp(op, cfg); + aq->caps->ops->write_regs(aq, op, cfg); + + return 0; +} + +static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) +{ + struct atmel_qspi *aq = spi_controller_get_devdata(mem->spi->master); + struct atmel_qspi_cfg cfg = {0}; + u32 sr; + int err; + + err = atmel_qspi_set_cfg(aq, op, &cfg); + if (err) + return err; /* Skip to the final steps if there is no data */ if (op->data.nbytes) { @@ -290,11 +402,11 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) /* Send/Receive data */ if (op->data.dir == SPI_MEM_DATA_IN) - _memcpy_fromio(op->data.buf.in, - aq->mem + iar, op->data.nbytes); + _memcpy_fromio(op->data.buf.in, aq->mem + cfg.iar, + op->data.nbytes); else - _memcpy_toio(aq->mem + iar, - op->data.buf.out, op->data.nbytes); + _memcpy_toio(aq->mem + cfg.iar, op->data.buf.out, + op->data.nbytes); /* Release the chip-select */ writel_relaxed(QSPI_CR_LASTXFER, aq->regs + QSPI_CR); @@ -395,8 +507,20 @@ static int atmel_qspi_probe(struct platform_device *pdev) struct spi_controller *ctrl; struct atmel_qspi *aq; struct resource *res; + const struct atmel_qspi_caps *caps; int irq, err = 0; + caps = of_device_get_match_data(&pdev->dev); + if (!caps) { + dev_err(&pdev->dev, "Could not retrieve QSPI caps\n"); + return -EINVAL; + } + + if (!caps->ops->set_tfrtyp || !caps->ops->write_regs) { + dev_err(&pdev->dev, "Could not retrieve QSPI ops\n"); + return -EINVAL; + } + ctrl = spi_alloc_master(&pdev->dev, sizeof(*aq)); if (!ctrl) return -ENOMEM; @@ -413,6 +537,7 @@ static int atmel_qspi_probe(struct platform_device *pdev) init_completion(&aq->cmd_completion); aq->pdev = pdev; + aq->caps = caps; /* Map the registers */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_base"); @@ -450,28 +575,48 @@ static int atmel_qspi_probe(struct platform_device *pdev) goto exit; } + if (caps->has_qspick) { + /* Get the QSPI system clock */ + aq->qspick = devm_clk_get(&pdev->dev, "qspick"); + if (IS_ERR(aq->qspick)) { + dev_err(&pdev->dev, "missing system clock\n"); + err = PTR_ERR(aq->qspick); + goto disable_pclk; + } + + /* Enable the QSPI system clock */ + err = clk_prepare_enable(aq->qspick); + if (err) { + dev_err(&pdev->dev, + "failed to enable the QSPI system clock\n"); + goto disable_pclk; + } + } + /* Request the IRQ */ irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "missing IRQ\n"); err = irq; - goto disable_pclk; + goto disable_qspick; } err = devm_request_irq(&pdev->dev, irq, atmel_qspi_interrupt, 0, dev_name(&pdev->dev), aq); if (err) - goto disable_pclk; + goto disable_qspick; err = atmel_qspi_init(aq); if (err) - goto disable_pclk; + goto disable_qspick; err = spi_register_controller(ctrl); if (err) - goto disable_pclk; + goto disable_qspick; return 0; +disable_qspick: + clk_disable_unprepare(aq->qspick); disable_pclk: clk_disable_unprepare(aq->pclk); exit: @@ -487,6 +632,7 @@ static int atmel_qspi_remove(struct platform_device *pdev) spi_unregister_controller(ctrl); writel_relaxed(QSPI_CR_QSPIDIS, aq->regs + QSPI_CR); + clk_disable_unprepare(aq->qspick); clk_disable_unprepare(aq->pclk); return 0; } @@ -495,6 +641,7 @@ static int __maybe_unused atmel_qspi_suspend(struct device *dev) { struct atmel_qspi *aq = dev_get_drvdata(dev); + clk_disable_unprepare(aq->qspick); clk_disable_unprepare(aq->pclk); return 0; @@ -505,6 +652,7 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev) struct atmel_qspi *aq = dev_get_drvdata(dev); clk_prepare_enable(aq->pclk); + clk_prepare_enable(aq->qspick); return atmel_qspi_init(aq); } @@ -512,8 +660,34 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(atmel_qspi_pm_ops, atmel_qspi_suspend, atmel_qspi_resume); +static const struct atmel_qspi_ops atmel_sama5d2_qspi_ops = { + .set_tfrtyp = atmel_qspi_sama5d2_set_tfrtyp, + .write_regs = atmel_qspi_sama5d2_write_regs, +}; + +static const struct atmel_qspi_caps atmel_sama5d2_qspi_caps = { + .ops = &atmel_sama5d2_qspi_ops, +}; + +static const struct atmel_qspi_ops atmel_sam9x60_qspi_ops = { + .set_tfrtyp = atmel_qspi_sam9x60_set_tfrtyp, + .write_regs = atmel_qspi_sam9x60_write_regs, +}; + +static const struct atmel_qspi_caps atmel_sam9x60_qspi_caps = { + .ops = &atmel_sam9x60_qspi_ops, + .has_qspick = true, +}; + static const struct of_device_id atmel_qspi_dt_ids[] = { - { .compatible = "atmel,sama5d2-qspi" }, + { + .compatible = "atmel,sama5d2-qspi", + .data = &atmel_sama5d2_qspi_caps, + }, + { + .compatible = "microchip,sam9x60-qspi", + .data = &atmel_sam9x60_qspi_caps, + }, { /* sentinel */ } };