From patchwork Tue Feb 5 17:33:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797835 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 91FB1746 for ; Tue, 5 Feb 2019 17:33:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8277F2C75F for ; Tue, 5 Feb 2019 17:33:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76B7D2C785; Tue, 5 Feb 2019 17:33:11 +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 0620A2C781 for ; Tue, 5 Feb 2019 17:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730545AbfBERdK (ORCPT ); Tue, 5 Feb 2019 12:33:10 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:61915 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726622AbfBERdJ (ORCPT ); Tue, 5 Feb 2019 12:33:09 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="23466282" 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; 05 Feb 2019 10:33:08 -0700 Received: from NAM01-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; Tue, 5 Feb 2019 10:33:08 -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=Rx9hsF7hwtPJHAJm3dfQIvWLx/MMmmTqgNTWiWIKX6M=; b=EsmAUL1JOcCVBxSACuFg/Gf50/LsJ7JZzoaiNw+Zx7qP7F3fWpzaIRfwSF6zebfUY5tqThRaTlHFWC+lQp4IzkcX76djq2aBWe4GdbNGURRaJ85VYQuXgrHrJiS8Y13NVLReH62ft8mc9MS8w2YqB0xKhj5fhFq46f49ALMJ6os= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1681.namprd11.prod.outlook.com (10.173.26.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:06 +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; Tue, 5 Feb 2019 17:33:06 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 01/13] spi: atmel-quadspi: cache MR value to avoid a write access Thread-Topic: [PATCH v6 01/13] spi: atmel-quadspi: cache MR value to avoid a write access Thread-Index: AQHUvXjafo7rsA240EGmjwHrAHFLbg== Date: Tue, 5 Feb 2019 17:33:06 +0000 Message-ID: <20190205173254.16388-2-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1681;6:yx5PqbBVT+83Vmw+MY0yQim4/XfaDvSpf2uYn7z84R0g4frz9c96cgRCy5Y3/Xqbc730/IATUIC+fygYekoaGVjjtXDtHnORazJ847PD34X1DUdLQnR3EC3V2SEcnEIN8BJPR1c0nkV6BWAFqBuIO5s1VO0lwQOMj+hG/wQHcdojIlFJz1llM240p6L8nfwMRRjVa/zh6gEYUAb5a2XASJaavHRzPq4VNutCz3FtbKmA+iU69ZWG9vPvMURQlpRZzQTsHj3JRRqSvJeMMbMrNEgpDl1+67e51UfwKn3V3m6GEe/XadTEZIjjaj5KOImxCFr74HiKPJHjl+XPZgFwUcrJp5oMnza5CgaGuS0OArNF3TO/cuZOoh+V/7MOtwNF0AaJCWwrxDDoRrg+qdGhycgbPrPetRSrKW9VsmEwN/6HVQ+oXmg1xOG4xKbppEAnyOXXcClQoPgmIuK6qtuAvQ==;5:0wMKvItMKGgFuJQX/Z2GOBRj2tA9xxWUUPJtfOt6mUs5J75LEHpXh9YQ28NU4IcR97IBxH/wtFhSrRiqRWF5Sx4kfTkjdzyeRYd9xdm2fKzH8TRdu3yrLpJt8+dXclA42OKasSjfxcTg9a5IiolV08XvZaV84TbmDwJJmeY3GSuRAGy2ixYgBjzipWm8f1TtI3VfccR6zliVtKvbpezbww==;7:B4A7ZtWieig3OhJq6U3vMmBDD4ALq/2o0Sp3KQj8zxkeTyfdQ1F3htpWHFYzy4MwibuZRiPni/uTtbmeZBgTs9fXEXtZyf6bSLosMRhpIc/v1O/QS8tWj9QTubDCWhtCoq2oPScA6pK5ImDHTQqaiw== x-ms-office365-filtering-correlation-id: b778c038-c14b-46a0-9bdf-08d68b8ffced x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1681; x-ms-traffictypediagnostic: BN6PR11MB1681: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(4326008)(186003)(1076003)(36756003)(26005)(110136005)(25786009)(6512007)(316002)(476003)(11346002)(7416002)(54906003)(486006)(2616005)(446003)(86362001)(6486002)(6436002)(66066001)(478600001)(71200400001)(7736002)(97736004)(14454004)(71190400001)(76176011)(14444005)(256004)(52116002)(3846002)(2501003)(305945005)(99286004)(6116002)(53936002)(72206003)(386003)(107886003)(8936002)(106356001)(81156014)(81166006)(105586002)(102836004)(50226002)(68736007)(6506007)(2906002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1681;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: 76DzDukMwntzdZ7gc6PvZQptNsXo8dE6oRi7tLSNbKn++SA34+AE9yxXRImDUZDAODNGkqZI1rJs5nomv0UImjEWWNB3BEdxZvPP2Jn1A379vzawertkIRCCuaxXrAkrcP5rrFSvswOGR0DN4laTmlGSluzix4gPMqVC+M6ND6yknjb8MCz+ojhYMMpNgemgtQwH76+dk+ep8WJYwBtUuAy26Dkzk4jKZwCVq4j0hAjoUKC69AWzLlJZcl1bs/L2cF4zI6JPuWvh7VASUZhXLeCxyDAqtcYHWUTXT3wVfRgI3SX0bz7bjJaksd/Rp8gEFtH/NheMYwjTbwXW3eJnzexJZfmDhOd+y7b8XYDUJbRHKYQ/IEQxDcgZzYHQcn1fAk6BnfK9SL3EWh8Dv2T7U6A6eci3P+rVk0+MoS2VCYE= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b778c038-c14b-46a0-9bdf-08d68b8ffced X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:03.7909 (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: BN6PR11MB1681 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 --- v6: no change v5: collect R-b 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 Tue Feb 5 17:33: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: 10797869 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 5C037922 for ; Tue, 5 Feb 2019 17:34:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA5D32793B for ; Tue, 5 Feb 2019 17:34:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B8E4285A7; Tue, 5 Feb 2019 17:34:28 +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 359172A760 for ; Tue, 5 Feb 2019 17:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730582AbfBERdN (ORCPT ); Tue, 5 Feb 2019 12:33:13 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:41027 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726622AbfBERdM (ORCPT ); Tue, 5 Feb 2019 12:33:12 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="26340118" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 05 Feb 2019 10:33:11 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 10:33:11 -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=ilExX4CoBlbb6VpJB/DpV0CgUqLATdWKWBrBqCU3bJc=; b=EqRwYaifQqkGQUot4+8kLq2V4EFLKbe7/OcE7LfJSxZhV67YLp5JhGa+ZvQ+AIqZQ6Ic9LRaFywNJVt+cybCL/w9vzjxWeisAdjSxjrLpyj+gFTGBRDM1spAvWl5qaxkOZ8I5CODlkQ6ZLcjmpvlweWlCT4o1Zyj0so7zw7qiBw= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1681.namprd11.prod.outlook.com (10.173.26.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:09 +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; Tue, 5 Feb 2019 17:33:09 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 02/13] spi: atmel-quadspi: order header files inclusion alphabetically Thread-Topic: [PATCH v6 02/13] spi: atmel-quadspi: order header files inclusion alphabetically Thread-Index: AQHUvXjcjl82TiRX0kyk3skfMtGbOw== Date: Tue, 5 Feb 2019 17:33:08 +0000 Message-ID: <20190205173254.16388-3-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1681;6:H8U+xXhTG3M3fA3+f1dvGm94NgXzQONPxjWWs2zlBLKWxoIVGBEfQGmBILRGp3eq1sxyjXfRfYV7bKvOfQSjTsGIb4CFZ6Wch1SG9VHvdoMsS4zae/d+o3RCNxdQIGZDaUoKcRqokz5ClYLbxpzsgxmGM/OWZPi1ST69+u46XKIgZ1sD3wt03TXNunBnLtpel2Ak4a5YpsMIUmrC2m00qRrb7a5h2hQiCOOJihp+HpbWK1RFrHKzIw79T0av/iqbjkIn4UCaR1ls5k/F5WQgPFIOpAjX35GUJZ3FpSfrBiiMZ4Zg8VMF8GDBpBt3CFIYkB2DwFb0lcnxKlkXdhEn4S80FYolfL1qZ7UlynHjlRnb33x7ntkTuzkr9slNbTWneErXY+EzXDCX1kZhNIztyVZ2yy5wHRTSGN4MZT01fCFNsx9i5hFVUPF6H4FHOcYFpJTEo144TEY8263BcvFDwg==;5:ON8nCxBxpT8FVTherDIm1D92htZ0IStg8zmp1c02NPwnhh9PsNak2+tInAQ2IuNJOOZbQNXU5MjHnFIU3HOBfNwEyvCsZpNFm2BnM+fc2AW7FoCc5nQnzrL5zQSeiG+9A+zwRE+kRmtgDxhO18I7mOA2yxpkeCyMKKn7qIfcNlr9uFxmYrKlo+fs7VhvXu1PTmSur4BupEWRnTXDTKDvzg==;7:5yHMGmvixgdtaotFjTQyn3CNbfTZP6SYvBy9r2ulfuazwgVXXCXsFjv+ArXAwSIWWqbxkarosVsJxgmkFj8Q+MkmjFGHWhWafE5gdgtnR6tW8Aa70NDNdU7+Q8+csGy+ZdPQvi3nsCf2SPBXsY1niw== x-ms-office365-filtering-correlation-id: 41ff5320-808e-46c0-8afd-08d68b8ffe83 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1681; x-ms-traffictypediagnostic: BN6PR11MB1681: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(4326008)(186003)(1076003)(36756003)(26005)(110136005)(25786009)(6512007)(316002)(476003)(11346002)(7416002)(54906003)(486006)(2616005)(446003)(86362001)(6486002)(6436002)(66066001)(4744005)(478600001)(71200400001)(7736002)(97736004)(14454004)(71190400001)(76176011)(256004)(52116002)(3846002)(2501003)(305945005)(99286004)(6116002)(53936002)(72206003)(386003)(107886003)(8936002)(106356001)(81156014)(81166006)(105586002)(102836004)(50226002)(68736007)(6506007)(2906002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1681;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: h9caS1f+0EWgcMUlQWo6a+Bav7pTUtx18076wctVx4c6KR9IXEgKoxS5TVkAl8/YMTvlri3e+SR0kMAlamhMBzEoo09+BLSBJSHGyLDZRhbEesyE1OWjkXTclvKKkfxURqZahKjzvSdQf4teHKlwI7qffyI/sAibdQqfQZ2INK4daul25Jc0S1ielJod76sZD3pa4tXbSC3Pz7OeG7tgTI4mrdPoqVOsMP2u4I51638ZdZPyATAMq7kmDHbEjhfP8Gr+u9LgHUnhcudsvzEsgpU+GHKdvut8SpmrnVyJ2YH6RiD+6lGmgv/1NhgHCff/nJnBKGHjHiyWnoQ5dUYrZVFgWtXiqBUjzU8BT2zqkl64D5IKzw8u4yC19FrnYpaPTa193DICbhVkWI6soPdmbZd9UFkxviDLipqJler3SIw= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 41ff5320-808e-46c0-8afd-08d68b8ffe83 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:06.4042 (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: BN6PR11MB1681 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797867 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 BC7F1746 for ; Tue, 5 Feb 2019 17:34:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34BD427F4B for ; Tue, 5 Feb 2019 17:34:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2908828712; Tue, 5 Feb 2019 17:34:28 +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 943CF27F4B for ; Tue, 5 Feb 2019 17:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730606AbfBERdS (ORCPT ); Tue, 5 Feb 2019 12:33:18 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:50029 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726622AbfBERdR (ORCPT ); Tue, 5 Feb 2019 12:33:17 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="26171814" 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; 05 Feb 2019 10:33:16 -0700 Received: from NAM05-DM3-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; Tue, 5 Feb 2019 10:33:15 -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=lQsD1JP9gTOivPb3K4xqkp2r4zY988NSi6O7JL2rpwE=; b=36iGcu6kaT1qJBRoxPCjKYgXvb4HLMV2nHU/87Ho49BGsi5jxnu0CDzsjCbJO3rVqNujJs1U2Wu6tnxYdoKqgc1cPMi+gL4Jk5qu4wmED2PWhH3DY5GinIpVel6D3gBNaFYFQqAlsUUIjrWcD3APZV5m7bRNZM8dIAhtnW6UiAE= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:11 +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; Tue, 5 Feb 2019 17:33:11 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 03/13] spi: atmel-quadspi: drop wrappers for iomem accesses Thread-Topic: [PATCH v6 03/13] spi: atmel-quadspi: drop wrappers for iomem accesses Thread-Index: AQHUvXjdI/FR2vCCk0qkO004YQmzWw== Date: Tue, 5 Feb 2019 17:33:11 +0000 Message-ID: <20190205173254.16388-4-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:oWk80F7HItH79Wi2FnpwYO3AxDCuXNK4Zb+yiR2AK/yJ4l5lVwRKBW7fGWywNN9ZWJy0j7N/4aCV76Exd3AY/OJjzAwSV4rcdl1E0/mEyE0LCPz/4lI9KMutY5lEkNu5sm1fpcLFlY8SckRamSdc39BnLKQ0vkV5ywc7hI82yyd/I+6zOG+YR3+hyRkIVnzHh1nLFV971lxXE5GwZW1Iz9VDMf9AAkHL7z1tfqW4Tt/74CCfsAMvokVALHr6UJgMnlxc+bjBokxoCW5p4pgRwazYJ1WUY7TCzLsiCDJ+JuLkLkSoGBHQNakC8x/aApLyNSR6ZO6cnL1j71xv5stpVHM+IGkxm+n6b8fvATOplHgZHiWX3yhzR3Yr4G9Lz1pPHt1Vrfku5lnyufzv4mV1y1m7bC0d8UiOtRQGp3YRN08KQT42bg0LDvLM7HJ0HyiCx1k37jdub4H6B1lmZS3aBA==;5:gu3DVvJDsYs+wL2aDqchegaXGIhjFrSCI6fJn48mytpZgt0N2PNH+y05or6FT11dUKKntY7hzJlIexFe4pLtK0Tnvzm3crYBmj91GZjSld/hjk18+ciwnzmGFBmOu4YnMHzBErWNMn7L2n3HiVMoHXhFk+K2/KL5XPP1/k/ZNgxfsL9pYiyXoo5keXhO/KlgI24D6ajPTzdspRdMBGXgug==;7:z40HNbHEN6wz0Pj84mX8ZeLN3I8VYez/E9+JvbC4Th+Gly3NPhcAdIkerJVSc4HP1iL97Icnv8EeDx7V6VJkOJCcLwi7Fn3kTYn2w5keicAM/4lVgt8eQCkoft0PY/+4AL4VLVF6Yn90rzOLH4p4MA== x-ms-office365-filtering-correlation-id: cf103f7b-be74-4d19-9d88-08d68b90001b x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(14444005)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: PhKMqXa10+pSnha6LQhLvYqZnhFKTmnlIhECb8Z2wN6+hb1GTAoSrMELtCP0FEPYVk0ABKE67elqnA9v+e8lF5xbMKlcKjxZSVIX0//FrG07ANbGLOBVVvQ9YzmNFjmwhe6RD+85UWgC5UEft0TvaHJ0RyTNEiqLc9XErJTmCInXaASs3l77MnXzZU6YsUY2JOALqjRD+110XQSmpXLgjnnorEORhd99/BrkEnD9MFd6KfnvIDrlJXQf6GpD9cfbGLrveSXwv0qUNpoULfFwxVzDiE7KMFb4UA0VOCJ9HbrhBFLAa2S6eK7fWAn9J1DVh6hJ/elqLXL+ZPfBns/RvQi/dDlQi/efzQRz8hIQM4nFstoJM4v0jxyfIMrldciOFEAEe/UwXKCQU6/riq+ov/3MJsIkJAbTy05XJKfcYLA= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cf103f7b-be74-4d19-9d88-08d68b90001b X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:09.1066 (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: BN6PR11MB1539 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797865 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 458D8922 for ; Tue, 5 Feb 2019 17:34:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4ED62793B for ; Tue, 5 Feb 2019 17:34:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8FC7285A7; Tue, 5 Feb 2019 17:34:26 +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 3C3762793B for ; Tue, 5 Feb 2019 17:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730613AbfBERdS (ORCPT ); Tue, 5 Feb 2019 12:33:18 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:61927 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729557AbfBERdS (ORCPT ); Tue, 5 Feb 2019 12:33:18 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="23466286" 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; 05 Feb 2019 10:33:17 -0700 Received: from NAM05-DM3-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; Tue, 5 Feb 2019 10:33:17 -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=6c9NZf9oXUsk3YKA+7J+ISU54YoNkI5ixnDQIFx6pjI=; b=yUb+q7NMLH6jctz1r8k4EfPu1Et2/UthVw4MEWGMljb3ij+xMrmGFmq4W4lRaAQO1kaVHVKtZj13WyUr8lcV4Ae1tvJ0VhNh1Cldw04PgGLcv0VZ/3c0XLSHdEWJreaJwiepg2kgdoE63FSkIihWNRydiubn0yJywiqn5CxX0Ek= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:14 +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; Tue, 5 Feb 2019 17:33:14 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 04/13] spi: atmel-quadspi: fix naming scheme Thread-Topic: [PATCH v6 04/13] spi: atmel-quadspi: fix naming scheme Thread-Index: AQHUvXjfj1K/ID5q10WA4l8z4XzioQ== Date: Tue, 5 Feb 2019 17:33:14 +0000 Message-ID: <20190205173254.16388-5-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:IFfcwbojajrnax+l4yy9PsFecnUxveVSezBRyXeJGqnijKlZhvBIzztob795+soqA1TV94rNCgsoLS2r9H77LNsapFJ03r1KzR2vmCmv0nQ+Ko+2tWNwF+obNLwJdXVCraciUIUZUDU33QTJ/luuAIdWJvCGQx/i0CNSwSEhjtzAvQXgWKw+D9NetMWSFbFTX99bCloJGNF2EarG982IHzWGzQIDvZUlI0fV8308K6jA+wVmMsOsQddtpYNJQcewXJ/HMGC5Hj3Af0vipE0PahPVyVGDHjEAUclJHAF5ICGcNVdsAnermHFohiVx3DYf4E3CUT+/RKqRXWEVHLTc78XCNFIfxgOt3fHtXni5TTLaIH6z0G8FOCcRtekW76VAutN1+UgxsVBrNiGUGU8qydd4pj4lGS54wa+UH4RZrHd+lClZADt5rMBfCsmaQaOa6jCXUoJ/OL9p7Yw77aCalA==;5:LWcODmq0zNe1x/o8DbVWawQWw+1+9gs5UJpxX1gcbzRfFyJ/s6yFUY7+3fRXLv5daL/qgQXsKxYjtaQiBeMC1neJdgMJxB6nSyyfBpPSSUz+2K3ETsKwnaFnWktHW0A2+rx2AOb5xUOy/Pu8M3a33bcOaHr/hmDtp1i+33f9S22A71wsc/6GcmXNGa74fuQ/ocbNdzc0553/eg5sxR+JGQ==;7:DvvgsczzC7Uxhd9myQtTN+WIEMX/Pqicl1V+/oiftAPUqk2tCh9PrTN+jQP2LCyQ6AphaxJR+mlsDzerOqYAZBL/N0Q3So+tn+uJB6NN/uu7E9Gxvmn/FP1/nKtaHUNaZoco0TinXsr675Qddo4wJg== x-ms-office365-filtering-correlation-id: 09279811-169d-46cb-921a-08d68b9001c3 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(14444005)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: BFhOe89zNmZG3IKX7lA+Q9XueooK3U15jDv9b6nRzAr02Ba12YdlAA82qK1zSyZI/JPZx452BrkNci+Ty/bKu/fNiaBoBnvNK6OQ2+TcyuR+eXj5JMeQv77G2GZaKDSPh+b1KqSmvsV6b3ghVF6TFTbmgp1GbwvuC4MXD2wmqtntS7CvL++gyCZvxZrE7/8xOTIHTfR/K2o2IZ9iU+yccI7sX+BFScZ+2vWeB3jBDizt9SeSsIw819VeuVxqe4ZHbxntTK5tyQLaGoVhaCCzsNlL26eRlZsyloqmKRr18AtWv2oX53kDtAks/0D1Keh8MronbDspUpFzG4WCLjvJDbn+aS5KJYNIzc/nF1UbjFmXsWGyY+8JimXMiwAaHnPSnJKv6VROveY8Xv28dyeATMYPR6MhrWKSuZSsmClhy5Y= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 09279811-169d-46cb-921a-08d68b9001c3 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:11.7168 (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: BN6PR11MB1539 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797863 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 CD878922 for ; Tue, 5 Feb 2019 17:34:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC0F72793B for ; Tue, 5 Feb 2019 17:34:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFD4F285A7; Tue, 5 Feb 2019 17:34:21 +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 5CEDD2793B for ; Tue, 5 Feb 2019 17:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730642AbfBERdW (ORCPT ); Tue, 5 Feb 2019 12:33:22 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:36241 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729557AbfBERdV (ORCPT ); Tue, 5 Feb 2019 12:33:21 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="27308219" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 10:33:20 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 10:33:20 -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=lGrBLi5Fx7hLrIS0sNlobL3tmxiG1BCbeeRUVBRxjCc=; b=QJmmaAZgDOOjWhZtK/wQFG+TVkvF/dcZGPJjeFFbgYmODhhzVpbHb7V7tf65Pum6SkQJ4VgMYv0gXZopXAPnSq3ATbLcuThZaFrZEhC61+M/he81YNb30P7jx8R1Rk6/deYERUnemhlObv886tkQ+5GgzoP8NR+U92hANEkPm4s= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:17 +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; Tue, 5 Feb 2019 17:33:17 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 05/13] spi: atmel-quadspi: remove unnecessary cast Thread-Topic: [PATCH v6 05/13] spi: atmel-quadspi: remove unnecessary cast Thread-Index: AQHUvXjhv0xyV0vw4Ui/dteRJV57wQ== Date: Tue, 5 Feb 2019 17:33:17 +0000 Message-ID: <20190205173254.16388-6-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:mc0zMmzIHQPeZvLzvNAWUH+8GJlZyOT2Rf4z7/hnEtv1B4nZvdgA/2KrAFzAFluOL/LMTfOC7Jk5fPgThZYbTdJ73BpCkLcK36cV93LqyefzraLvsuRYVbmH7eiWPQbbB15QHlsstd05w1GiAibdWBKnbUkloyiLUpZcXsYX6fJVpzxRYpXp0++VCCaNEBQbF8ZHFtXhJsbeklBg/kpm/euO5a3dqk1tWWmdPjarlguqZcrPN8X74UGL/NjKV+Ow7hFOHu4GVv51R5KDyUaDw7w8eAF0AXzLhvcCt5k+jTYcy3bwb1iZMo3fdefJm5ItTMWeitiSAwSeayLk5BEoOCPlHM9e5H/dIthWHlkipF5pyzfph43l2wxHhb3ch0sAoRQboV2UBVj2hELGhEgIJriuzyzXdiZvXHZIS4dfaVqaGlrxl3oSJ3VqM1R0sZ/ol4pojYPZbjGqMda+JnuYkQ==;5:1XWUAmpJuU1DvVHcodxolD5H8TH3oVz3GnNA4MW/KTuLZXFIjHmFSLS75nm9jr1pTJ/RL5jtbZkFU+nLO/BI9noSCRk6QVEUpXvpaiFWCIWGyUgd8z3TkpQkczgJCJMz4fKmv5RDYFEuJ72Xk1L3HCBVk6MnkdTfK9NZVhqZGdHxf8poyhAhO44vXb3Ll35UMBIf6AGNzaO5yTxsCp5Adw==;7:s0O0kg4dPEdbdPuZE+Bf8UZ0W8BLdh6Ja74LGi79tuHQHaxUI0XR7IDyM+Q20ITTdKntAxODXclhfW41+YRaTDCJDKcBVoClwcrYNXMyxYMCmTM5xCBqPoTeGpM+TuRj/0cnQjMyC1SrOxDQ8XxuSw== x-ms-office365-filtering-correlation-id: 41c037a4-3118-4a9e-c169-08d68b900356 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(4744005)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(14444005)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: xEZW/+hoNlT12UWnp/LNLTS7Pbw2aIvbN/elwMvT1jdDNXxUORAW+UFPrYfGQGpRl4GR+hR9H4VKCc/t8GYyUCnyb4tNaca6zrT3TA+myv7sVCI9DkaVEbf3CvKcOL93whqt3vni9UfEivG5ID2YuKIeuHVPeK0MAUvl8BU9kiYcVUyZVjdul4+YbV0Hl04ZvB4QqZqL3a/ROHklRC+jDnZaHg9nZ1yK3PE7MmIr82Axpb7tIpji+px6if60Xn4nVoZW3tb0Gn9aPITZbGa8Q2urhc/PVRDE/pmbUew8T030gLDQC0iQbQUeI62O3V0orCQORxytFYkkXBCKx1PW08SGvtuX5Epk1l9ebZBTWXCv1vBP/hQTbojHzW899aTQEJcxQJdI/AzG+ZeGTeZHgdfe8KVIrkVD1EjR4E2hiuU= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 41c037a4-3118-4a9e-c169-08d68b900356 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:14.5323 (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: BN6PR11MB1539 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797859 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 B9662746 for ; Tue, 5 Feb 2019 17:34:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9B7E2793B for ; Tue, 5 Feb 2019 17:34:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DC5527F4B; Tue, 5 Feb 2019 17:34:18 +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 487B92793B for ; Tue, 5 Feb 2019 17:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730660AbfBERdZ (ORCPT ); Tue, 5 Feb 2019 12:33:25 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:61935 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730657AbfBERdY (ORCPT ); Tue, 5 Feb 2019 12:33:24 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="23466290" 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; 05 Feb 2019 10:33:23 -0700 Received: from NAM05-BY2-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; Tue, 5 Feb 2019 10:33: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=huspZwo1gTAYKC+kwF92rW3WwfZEJpcJio58pZ1P4Ho=; b=X6DIpDiPb5MG+w7C/DVY+RxxnvmY3GGCFVAQ8Ci+ynsHroOnQDHoifkaWXsR4xNZa6pvlqvLxIs52crHeqOdgGVEd+uKJTNuzGcIoxHOpY6ziTZ2ylexcTv2JMgertIK4nxtpoS9CtSziI3tHsdlq564UIZvCf2CvA/nFYDlo3c= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:20 +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; Tue, 5 Feb 2019 17:33:20 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 06/13] spi: atmel-quadspi: return appropriate error code Thread-Topic: [PATCH v6 06/13] spi: atmel-quadspi: return appropriate error code Thread-Index: AQHUvXjiUqKhx/gt+UG0OZy3lJy5pA== Date: Tue, 5 Feb 2019 17:33:19 +0000 Message-ID: <20190205173254.16388-7-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:VB8+QKeZe31FTAP8f3CoYruQ/ZQ709G2gVRDA1hGjg0Nqq7gwir2hD0EfrzxqUFCdi2qog8MQreYWTt8rYf7Xs/A2MWzK9ko9nSV+A6yOyF6LlLM2ShoWqyo7J/jVgwDphvAeNrVKU5DPIvYzNTOVx18G1I4JtBzrzjyLtKlgZ9gY+9x6rIUG7BNc80UpWYX+JhuV66fcKXWXqBEP0/3/hMF5/k5ntGosg+l7ImJ9yOsIfxbY/dOg5qeKtM+isxb6uy++o2hDOra3oQvl5vOyx6nG4JCtN1mcBVJyZ/AKUEofsko/7TnuSBo+TyCWwnykKFn1K5hp8Soece68KIsvvto6bFm0m0AaefZUN/Myx9kXjdhluGjeKiTIBj3sl/sp7nB+NXBCNykdo5kuDuWINSFoZL1Ya8Ukw+1gPWNPnlq98oH4x+KTM21EpKBnEqlyp4rKMvZcDPxTykB6Ic2iQ==;5:CzZmZn1VAvEgTC04DvJle2N6flEthVFZOvCig2RwyfaI+q3u6BBjuWVo1GvgPyG4kmuPR4Xsf/H1G282Ycc8EU1TYB1OgVGOzyADvxwu5FelI0Jie/X8ea/Wge1z/uO3EMjJisA8jZOQ3mcR/DPo7f/2srGj5CQ/vGn8a88hPncxB+BwYFpqY/MGpKqDw/Gyj9jt8dmmVMuwhaAFF+6W9A==;7:c2FQ2mxKN3cpkCdIcB3V6ZS9X9ieLOqfqTg+3JNFAwbWeEwdSMxn2Ep+RqzyvhJKIqYRt46AhQVXU6PkE5E09olr+GBqakDuapeeZdxQUR6dwfD5hkZNMUOsQkM1ENhCSi0OHBrlt7JgyOzqdeCsJA== x-ms-office365-filtering-correlation-id: 29bdc89a-f2db-4c98-a28a-08d68b900508 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(4744005)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: qv+eaeO+5hFtzi5zF8DVbCKZz5FgZ7I1qU1hEIORq4Wk4TIUCojjE0kZ8DeA2zIfSIy+Aow5NhsCGRzymRmCAS/s+47FyjbtqMXLrqwSpPmplF6o+GWvIlvrF2rPTjedROKAwyKb+4QxEt2RUw1+0gN26ETxMRHLGhfHL2kozD/BertC2KcVa88/o2OLGa6lskZanMCI/dj8Yr+ls9GdMG8rPbO3Sb+tLpjte5pF3Y3/rMFMbBOMWZuUHsX1ag03BLf3JVGK6DQlQUOoxvmhej0qulAFMPPcwutxJKfEeOb8p08O7p9GNeVBtJexMeKsItyVM+rG80lyhe4f+RuhXVW+T7cbmSlRetb9qXdXhYPRm6rsF9H3ZxAdKbGdyfUIrOTcSME4rIgRhNY8vVnyZM2vuTigPFJhtWFlkPC1Eew= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 29bdc89a-f2db-4c98-a28a-08d68b900508 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:17.2927 (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: BN6PR11MB1539 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33: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: 10797857 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 4D170746 for ; Tue, 5 Feb 2019 17:34:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B5FE2793B for ; Tue, 5 Feb 2019 17:34:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F24027F4B; Tue, 5 Feb 2019 17:34:16 +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 BC39F2793B for ; Tue, 5 Feb 2019 17:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730680AbfBERd2 (ORCPT ); Tue, 5 Feb 2019 12:33:28 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:61935 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730657AbfBERd1 (ORCPT ); Tue, 5 Feb 2019 12:33:27 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="23466291" 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; 05 Feb 2019 10:33:26 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.106) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 10:33:25 -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=3UOckbbOwWjrY8pYGuiGu1lXxPi3bHyFsWLyDzUf/Po=; b=DP9ijxwRs/CHjaUco1RbQTyX4mZhRk8bxEeXw2VlYBnieFzBAeOXVv0OwpG1v8BbezrafavAT9Npoi52CJ4j4n8soq5M9t1I8oSXgGZqg4KhqP+mgXexKLgIL46qePtsxCE1FcFuqiphk9YTxjNH0jcxk3PbW0o5QHUQB9exflk= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:22 +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; Tue, 5 Feb 2019 17:33:22 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 07/13] spi: atmel-quadspi: switch to SPDX license identifiers Thread-Topic: [PATCH v6 07/13] spi: atmel-quadspi: switch to SPDX license identifiers Thread-Index: AQHUvXjkYK6hX5/T2Eqsp/GwdKcA2g== Date: Tue, 5 Feb 2019 17:33:22 +0000 Message-ID: <20190205173254.16388-8-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:2o29WW1SS1WeaVIV1TfUHUKsHINVpOCOEF21cc7OCB5lRYNSC7ZAyrjGkuHfW9RgpaX5a48aMmHytAJFnfvTMM38Y/S4W3KEQCic4SleBAAGu/xndKjRL3wUjOsbq1Rc97qmbDExGETmppbiqdPJz4XHuZSpDYutUMjcN1U1nVwdVFAJcszZfV3M5QL+2oJdhKjRYJrgRQ5mm7JM+ubsHAmiBGtvuwuWsH5UxndehmkrfdDxY/SNT2qNVgNIfEojZ4Q2Duq8oBgCcac/OZkQHsuyIdSoAfvx7yq7RgNTL2ZSmRN8WOIjwG+9z5VdD9Ls1OurfVRdbXX/O3z5bm2SSSv4g7e6aGjQmzscKn5QH6TL3oHAwweIOIZY1ziZ8j3nmWi0ofEZL10A1fEze9agSPRmZql/gl0RHWmcyGp4+YznEZ9mrWwSVrTViIMgn+LOxB5lVd6+rijRNAtCXrggBw==;5:aAPDJn+TGPMclf8olp6TVHtJbQUyMxqmwUJVuP3q+7+7DJkt+K24xCUa4/FyLgCA9IjRDV3v2g3UCJ1h8A/TZJ+xGUqI60hBWV7nGJfFMn5fCyfiBD0xxmFUD7GCqJa/BZKzz+4IQsG4MIsM0MZLkj0ufWOKEjBrGjsKZoOD3oWi4QhXLU1VauQfvCCEQ6wcGip4VOVAiCkFz+EcsjWPIg==;7:lZ28BfvZNIBah4I8eHAoIVUC4c2rUOH37xwmlq71b7j/2IXcp7SxzuLpiZRP8bzkvfTVlZjPwg8Dg7zzVOeFwT93pvLqr7BxdzlImk5XIWhHZ2UmjL0IkjtDGKHc3fVkL2PxV9LZSpYvK897cLOiMg== x-ms-office365-filtering-correlation-id: 5c75e3c4-3756-4828-67cf-08d68b9006b4 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(66066001)(476003)(6306002)(97736004)(107886003)(6436002)(186003)(2616005)(446003)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: CsIR3yAsvAzHE1SiOjyhXbNV8okqcixonofTzUL+az6l55jkZECgIS5qllKQ4nfar27CQzEefQ4DHMLdIZbCIiSa5/qZw86a6Oz+hU7+yTS9q6QSm+3GkzZejY0tPfubRUh7C5OqUF39aYK32qMQFUDRRSYFZPsPXHANeM8pESckWNfMYWdUV7wJBNBhSDzWht5dXWgg6grXDAmMB8brgT/QvwlTwfq+6J3G8W0m2RuvfQolQ6CT0+luCQqCUHF4dLRn2T99kuqB17hzBw0skRxJbK9s3Lyy4URgBN48+FcgJjqzoATxMcaoqhtDt+2i90jJV4LJC6GZay/BtVmHXCk2vsi8XBs+8uln3/Jq4CB1bL5NVinvAXeDaeEOimjqMrZgs+AnL7U6WFeVaoIc/iT5eVMpBCxKcb+JilpDpjI= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5c75e3c4-3756-4828-67cf-08d68b9006b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:20.1202 (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: BN6PR11MB1539 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33: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: 10797851 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 A8724922 for ; Tue, 5 Feb 2019 17:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98AD62793B for ; Tue, 5 Feb 2019 17:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C65127F9F; Tue, 5 Feb 2019 17:34:07 +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 27D712793B for ; Tue, 5 Feb 2019 17:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730705AbfBERde (ORCPT ); Tue, 5 Feb 2019 12:33:34 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:41046 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730687AbfBERda (ORCPT ); Tue, 5 Feb 2019 12:33:30 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="26340137" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 05 Feb 2019 10:33:28 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 10:33:28 -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=gwVggtJ1QTryUz/2CC34Onhb9QKLVzjHCqUtO1f+FRo=; b=S/06xTI4JWzKRjpc0qpGyMh/KPp5+vH7RJlPnisGhQ6kr/rSDkY5PBOs9zsfWvDG8AVLC/EGEfjFUArl8gFElE1P8l4exV53YABNCRTi83d8Vo4CRMJ1Mz1gXFadqj+y2GzUkP7BB5TynWD/9r9Kc6MlnQQtuZFUQv4fLUB9nLQ= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:25 +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; Tue, 5 Feb 2019 17:33:25 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 08/13] spi: atmel-quadspi: rework transfer macros Thread-Topic: [PATCH v6 08/13] spi: atmel-quadspi: rework transfer macros Thread-Index: AQHUvXjlLDX82obY1kidqcTofvU6Mw== Date: Tue, 5 Feb 2019 17:33:25 +0000 Message-ID: <20190205173254.16388-9-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:nBfv3N2ZBcHqmLbWBjWOjXqLfFfyPudAvbI+6TwTjW4J3ht31YgTk+YbruNy3xGUWChGMKSSOo5rZeJ4tJfCWPmCkcfxc/L2NBVs7H/iFseBWaP6Ov3fLuiwMNBK6gKUj8Vth2t3CzivEfWUxq2DYpBoDncsnEehRNVZzybCfTgbSib9hlSD+UJM/419EmF7zJ957f+uAbS7OVxmujsUbGstMKAeXo9yq3IKvpNyZa1xLznVZ/eQn+X6jYuQJX4pqPWtXZceq6yZy8Y81WMeip55Lqwy0DhsIB/7QpvD+NUjkwl/4Hm1ViEbhrtWIgo3E+Om3kkPWRln/UkiosZH8ri/iOkCI72ceufkR3aI4iIygo7s3qwzZ/f5PzkM6EakkaNl60vnvpf1cPTfSWohgbf0iAYxPdTl4emfEKowWuxcE2irR5UmFlS6HYdtJZ6BLIUkJ8oJNijSaQAPq7qjHQ==;5:Fj6MKvHvO6obFWYka5cceQtzaVJPrg4m1/3XJk27fTzlaeC/TAigRdQJom29wDx8OWh+fQP6xJtZd5/5Y5s6iK83ZTCwpInTZw8KROD2DVQT+6wGN6vw6h8cNKeoSbHQ4rIA87aOCnhvc27diXgNkH3IjeD6kGCigNZk3CCmEzBczvzzE/NbSh7DdjFL0jjTV5jHT5S/y8oere+FE7Hc7A==;7:LrpCKyYk53xYolTQfdYccIBRB2P4s7cWPTku7kNDly6uryQAylC2kEjvzNmEIir17iSr2iGSLSsSlG6QLRUSpwbiCHI1tfbaFxx8QJquV88Uj5R0SGSgfnfwy5jDa/AJktLB1tRrnxreub3S60YRmg== x-ms-office365-filtering-correlation-id: ddd44fa2-acdf-42cd-79a1-08d68b90084c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(14444005)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: TcL5AfFhC54on1wSmgMKK3EVF2XQqWe9w/c34cwH9YQcoCcxB4CcYmTnnRofYkM4x7exstJpXqd4NoJ0MW+7umnj5UQfsy1riidWhas4Ln/v3ZpWKZzsON2WIfMXIFfmSrvK3GmH0W/FlKi4xnYG0T/XLoSMAKLkwnTUdQHKeo8ZGDmmsAa34V4FigOYwYFAg215D27of/hjIKF8nwSswbUrYZeAyGiE9L5YVr9BEWntj1wVwiImZICp7FIH8gA5JEOuVO+lyMI2Xvn17G4ndiJtYdXDAsuMU94jWkOBKuqt/wERnAHdwmVmUWtOO2R9/OFu0cOMnMgkEsO3HrE/gCl4YsuhhBBDyDqRAEoRh3LYjIfBICV2Q3OaqQZf96DyBuq7JSh/tS8nhwv1wGNiL6ubEX3IXgB74ocSc6vsxQw= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ddd44fa2-acdf-42cd-79a1-08d68b90084c X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:22.8345 (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: BN6PR11MB1539 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. Signed-off-by: Tudor Ambarus --- v6: no change v5: collect R-b 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 Tue Feb 5 17:33:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797841 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 21F96922 for ; Tue, 5 Feb 2019 17:33:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F6172A8EA for ; Tue, 5 Feb 2019 17:33:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0256D2C61A; Tue, 5 Feb 2019 17:33: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 954DF2A8EA for ; Tue, 5 Feb 2019 17:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729110AbfBERdd (ORCPT ); Tue, 5 Feb 2019 12:33:33 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:49474 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730657AbfBERdc (ORCPT ); Tue, 5 Feb 2019 12:33:32 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="25881411" 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; 05 Feb 2019 10:33:31 -0700 Received: from NAM05-DM3-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; Tue, 5 Feb 2019 10:33:31 -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=cfH2Jg5tnbHT+3iBrkm9uPVkz+bTwBk4NDVX8KiHmA0=; b=eB+RhzJo50LZHKEBiEJIlJ0YCaCtSddG9k3VzQa7i5fBFsSR1UZs1rKgbXndO0+I3/JkjGTxJQXXbRE4RQT0K8cmXlGNoWv7vGNsj4W6OjZbYZLU9MyocHKEu14C1FRLuD5C8W4vOVfWO67Dj5IhhhXc2xW/qNB4bWNpgspQmWk= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:28 +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; Tue, 5 Feb 2019 17:33:28 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 09/13] dt-bindings: spi: atmel-quadspi: update example to new clock binding Thread-Topic: [PATCH v6 09/13] dt-bindings: spi: atmel-quadspi: update example to new clock binding Thread-Index: AQHUvXjn06mxv8WDSEe35xEVc4rrbw== Date: Tue, 5 Feb 2019 17:33:27 +0000 Message-ID: <20190205173254.16388-10-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:ZFfYHVgMcPRUsWd94s0cGfn5MvXTqV5iQSE+pjBMNcFOoxOE1mxS4vdEuOq74Xj6wMnG0LTqRWwz58dqVnsU8yVBurMhECSaJC6WVylFvYJs4Jx6ZJ0jZRea9IIQjlPpq/kTniZfnZ1SMUz1YhdXp8fnbWsUSBUxop3UFHJuV2pWmbL8/s9gr+IapP4V5+YYaOC5YhgF4wxY9wzmALXLclq303kDvG/0wcvueZ+1aRQLXgaA44lOF0eLWnqfcUVLx83FOKndggAGcDePIVKyDLJ0ik8/hLjEca7quRke/4OxsvQKf+ZcuOJpOpnGpyIsNWuypjJQSGf5g+QTUhnQ5/c/9eiN/GK0iU1zDcUY8tQJMDVC7HvRXJ7sVVveaUTYCsCCq0feVpi+lNtEwgPt5Lh7+UlHso2J3dbPhAiPZPNd/EmUO8NaxoARE21ggpu/dgBkdkmaOHdUz54yJnB9OQ==;5:oFsuIbEHl7sgrdy3ZV5NScp2Fevc8QamPtU33k/m2wBFN5qC+L5ijVAR7dJNB+tlQcyN/ayxSIslKOy9rE1mlypGmJV7Hzl5pqBVGT5FoR5ZBqW6aLJvaRXuoL/mgFRFxhkLZ4VaFuxmaMhL8WuvO5Nq8T0Sgw2ANr/Y7JC3R4BiLoy+E1mQfT65UtitTxNzK9BKkInxgVC7tqvzehwJ/Q==;7:DhqsSbYPGLsk5IpDF6yoyc20+A5CDzbd5SB4/vkOaOBBD2WtFX6G35WI6wButR6BlZK+9v/tke3S6HbkHslypt0OO1aG7GTgVS2cL2pMVPOfKwFH9MjDRxHPEWorI3vCJcoVdhbV+gKB3Dr1CPRAWw== x-ms-office365-filtering-correlation-id: e06666d9-864f-43f4-5de7-08d68b9009dd x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(4744005)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(14444005)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: Sd/E3p09ilGajcATbZSU4jzTpI4nq3sS9j6l2ZB3xbDjylgi1uZjZh0c+lxSBpxPOvdJzUhMUGRFkaZNDiGRa1QcQVhpVDc6v7s0YF/NMcoY99WvUMYbMO+Cv/WL63pfv9zBJq/hV7VwRg9mjhoImJKqDNDXgLbxby7LxfJNHPWLuv2MX/ysA4TXEW7hLeJ4cCT8TCxgCd9+ndrehksKNPOBJWwBs/PAjXmADpsWGjKhGGn0h/W2DaIDttNNrBeZpy3apMc59lgJV2nAcsfd7Ry3VS3eXtwTjUXnVmWcZ6beoicTVzUJGiUVPnYyXJHczYwPYLRBxvkqrg0m0cjKRolA/dh1vwr+Lz70Yg1WicKLJKCrwIsJWh29ZQ9UDdNYBxFXQg6RzvMIwWZI7P1/RfzQxJlnh6F6W2yYX5uQZLo= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e06666d9-864f-43f4-5de7-08d68b9009dd X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:25.4748 (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: BN6PR11MB1539 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797853 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 04E48746 for ; Tue, 5 Feb 2019 17:34:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E879F2793B for ; Tue, 5 Feb 2019 17:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC7E427F3E; Tue, 5 Feb 2019 17:34:07 +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 825C327F4B for ; Tue, 5 Feb 2019 17:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729606AbfBEReH (ORCPT ); Tue, 5 Feb 2019 12:34:07 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:50041 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730703AbfBERde (ORCPT ); Tue, 5 Feb 2019 12:33:34 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="26171831" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 05 Feb 2019 10:33:33 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 10:33: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=3nXrQZXeOCUbWGDz7IVa2QEx0dQ+ABc72ETbWdOCENs=; b=Xl7aGykzbTM7/V1vJ01FHiMFygAJt5Q4uoSNM4u1ceolO7FdW7rHZ61W0tn1P7xCmQhSVUeCKjgal79LZowYGmKTvACNq3FA/TIAuBmvdQgNyZCf6YnFsf8X2bvnod8KBn5qYPhcViyYlEIg7E2VqEU7RJAV4hQIGXz443/EmFc= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1681.namprd11.prod.outlook.com (10.173.26.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:30 +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; Tue, 5 Feb 2019 17:33:30 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 10/13] dt-bindings: spi: atmel-quadspi: make "pclk" mandatory Thread-Topic: [PATCH v6 10/13] dt-bindings: spi: atmel-quadspi: make "pclk" mandatory Thread-Index: AQHUvXjprowezEMR+UGbdwWUreHtIA== Date: Tue, 5 Feb 2019 17:33:30 +0000 Message-ID: <20190205173254.16388-11-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1681;6:bOkZG8rli9MARNKykM85IFlrAmGP2J0wtz1V+fGm2yHzMR9pQUxmgptYQJoUevyNvPC0DGh0HzicnQFBWDzuUATNOjuGBPh+pNgT0cnVsI0ZOU+Qbsx3qAuhOPzYHmYMk9Ij0MJ/R0YBU+1RY8cZpsFFz/4W/nVcu7oGutMi31QwXHgXel1X6+RlZmGSKnXTMybFvwgtqEYLFHWrOQ/kLOxyXXA3RbxV78wObZgb8R/cjmOma0d/skqT/4GCaNvlSLdpQEn7p9nLxKPQ3EeOVRxFysPt3GSj/0fKtZJdGl6330OGA94jL1iGKLndpv1d16efVJ7aWaeIrXdcdzJlsv/imUNWBEav6a/1t5g+o0Rc2P1IkDHZkb1mqpoaBRNY+NafzYCrT2RjJhVhGkcDPepaxusVj0sYJ0YM3WzpcRhk5T+Uu1293N1BdpWBALIUlVXned8uKIHA7ZInh9ZdZA==;5:zUJUQ8d/DNRdnRrWawG48q1iC/IfHizaVO9vQKGdWmzFrAzugyh5R7/a3B6wuJ9Mee+qAXRPkuu6nbZkWdOu9OKlgCCXEr8X0dVOu0MdMMJJTYX7Qyy8FGDr6vudWCTXzLB73/3bEiV5jvMIfPX9TqGcFJyNDiHpuQ6DLOuNZDB5u+9KztPY2hiWLP70HYcsS+7LIfO4NbMECaxU9FDcCQ==;7:hh73UnnyW/j9p+5Hm5Apz7i71GavoNjJ+p6ZVqZH3oqtfKTTq1zzj/3X46ESCyr7W2WFYC/kmc72urI94RfQEp7dAKLJkqTzJXJhDy719yY0e/JYsLX9aO4a7TS3uYeCqv8CklUYU/iY+agWaKPj2A== x-ms-office365-filtering-correlation-id: 81067654-ace4-4d50-2442-08d68b900b7e x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1681; x-ms-traffictypediagnostic: BN6PR11MB1681: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(4326008)(186003)(1076003)(36756003)(26005)(110136005)(25786009)(6512007)(316002)(476003)(11346002)(7416002)(54906003)(486006)(2616005)(446003)(86362001)(6486002)(6436002)(66066001)(478600001)(71200400001)(7736002)(97736004)(14454004)(71190400001)(76176011)(256004)(52116002)(3846002)(2501003)(305945005)(99286004)(6116002)(53936002)(72206003)(386003)(107886003)(8936002)(106356001)(81156014)(81166006)(105586002)(102836004)(50226002)(68736007)(6506007)(2906002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1681;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: j//nneVn0RKy77+jsy8zYGXY/Zt0sGuM4Wr3GKdHJpB+DkEf2yb0HliOUYzq2SoevLaOyJn3DJeDWHA/Zs9ZvyKy/QohOmo0lQNb9vsYiZWnYxsbe4iryeAbnhJFVQvICMoPUkypzuMRsu7SLTUKvfCfWIUcs6leRe7VVrvBQDcg/FWQH+dvVAbFBAQbjerc5hpU+BF8+FnTPd3fZs4iI4ffFuMl19V4JqNGohM9vhgniH3afkejCZ6bn5D89o00Kz6edPFks4XfFB6D9L/uRhPTJwPHYadDl2H6k1vBNiXKjidAyJa+Z5ljmUsGZ5tUwAefuyHIOzZrfWgWonJxFdFd6x5X6uyXE/J4L/VlJ8IcXdU6DsbVGsFE3ckW8XiXo8AlaUjiek9XktdUFh/UGC1WleZoWBVWoygYoJDBVjY= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 81067654-ace4-4d50-2442-08d68b900b7e X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:28.1522 (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: BN6PR11MB1681 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797847 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 28DD314E1 for ; Tue, 5 Feb 2019 17:33:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 175D82793B for ; Tue, 5 Feb 2019 17:33:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B7CE27F9F; Tue, 5 Feb 2019 17:33:59 +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 8A8982793B for ; Tue, 5 Feb 2019 17:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729700AbfBERdk (ORCPT ); Tue, 5 Feb 2019 12:33:40 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:36250 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728343AbfBERdg (ORCPT ); Tue, 5 Feb 2019 12:33:36 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="27308229" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 10:33:35 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 10:33:35 -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=AmIVqyhHBWdy7c6OdpYPwojel4/8XGfRyij7OI6jUPM=; b=3W4TnFRqhWU8udWqJDbaR2h/eRkWjCAgUqS5bOsgtrvKPgUZ1jOSRtSmKAFQAU3SFIR+cHmaVtoXwVjLQwvLXHknzwXryQtg0kY+73/Ou3wKFa1A1qRLka5R8w7J1OkDDyRiKZ3C1WifTuO8Mvb8XeRrtm9v0wuBra9UPZZHSn8= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1681.namprd11.prod.outlook.com (10.173.26.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:33 +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; Tue, 5 Feb 2019 17:33:33 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 11/13] spi: atmel-quadspi: add support for named peripheral clock Thread-Topic: [PATCH v6 11/13] spi: atmel-quadspi: add support for named peripheral clock Thread-Index: AQHUvXjqJ3E9SQTUFkazPzVgYVrsSQ== Date: Tue, 5 Feb 2019 17:33:33 +0000 Message-ID: <20190205173254.16388-12-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1681;6:ob4WjecegswXDMuGwuGzKtDUjZ/UfIPL2TTc1SDv5VS4gAG8QIC9nXcd3j2urnzGOOQdaxqUZdL1/e2l3BS6Wj+xqrt/xOS/uXNJIQ1ARtVS/BT/95hedyl0mgUE3KFuqdntpM9IbeLWTzq3CchKLnSiJPBljlFuN61woqE+9Hj2N7UcvMEbCJdx0Az28s5x4yX+RIRCcXpxqzwMtHF66uFZuFqXBUJUrdxt1jhZ7dV7VaOBMsPIQuqkTIUM1x1FkolipcdNdIrvV4NLNUABei06MDYymAZPqmHcfpJtxA5Wqa2AvosfZinvUrQbUpkyOPJYMM1+bGwftEv+NH1OGvFnxJXnivfnP6Up7UvQ8B4ISAcyx1dKA5+X4FaLJjCqvOLkcvywJCzSN/0/YvwcJ6j/nLMUrl/LtAtSxRRGDoKSeRGYCtItwg4NKsnsWx0oO77ZQuQTKbKM6QC4Iz/cOA==;5:hyHc1zAhgVu13Q9eaHqbqdqDv8yzQMLP4RYvjvXnwOG8GSPsj+XKgRHkBNS3nlbDIkkxfa8wL1m8bMDkAfe08r7XWKWrrFkHilwLhErNcHFsiEAHQQK0bsF0HkeS9swXNpP3zO9J+0j9HoaTO71h637VV9oHuqJVIzUcNIjSHbL5ZH+S1vbeqoctpm6Yds9h9zPTXoV5dGJMEWanu5+Qqw==;7:8VazuvPvI1TNePBZ4F9gqillH4xywGGp47h3wCWVkcCB81Kku9JwByH26opSN0ktusrY/oXTSGEbKdCDUAtav1THLauYFT9082QI16BLRyAAzy8/Z94iY134naMJcN6B/YrJc3kiNGNu57E2JUtVKQ== x-ms-office365-filtering-correlation-id: 74fc2498-71f9-426f-f887-08d68b900d21 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1681; x-ms-traffictypediagnostic: BN6PR11MB1681: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(39860400002)(376002)(366004)(189003)(199004)(4326008)(186003)(1076003)(36756003)(26005)(110136005)(25786009)(6512007)(316002)(476003)(11346002)(7416002)(54906003)(486006)(2616005)(446003)(86362001)(6486002)(6436002)(66066001)(478600001)(71200400001)(7736002)(97736004)(14454004)(71190400001)(76176011)(14444005)(256004)(52116002)(3846002)(2501003)(305945005)(99286004)(6116002)(53936002)(72206003)(386003)(107886003)(8936002)(106356001)(81156014)(81166006)(105586002)(102836004)(50226002)(68736007)(6506007)(2906002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1681;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: SOQNVigxNgRMEWkYOUBobYXbN+aSDuBVYtpv7LHv6KojgGkGI3wimrG66Ly6Bs9OBNjINOzs47LfWR14xCcQtDM2vNw6oEgb5iuzeQHhNSRNCq5AFSVgbkWmD6Xg1EwZLoCUPPGOqjb/+215lrc51MswBO5GhRQNx2bsfgZ+56iVLo7yrCVz9EF+V4zGfG1175vc61ZAgsEqbAyc4l5eHpQAAhZyHBHKLcsy8LJqZNmGs+L8yGf/o83PaosfYXRkVemZm1r7uuxHmEc8Sv3l2T43IL4UTFsD/Iz/9BvSH7xclErtPQ8/xKDMltwXLqtNHegEQxXZANAFEax4jrTmp8h5RGsChsvh9FrVpxYTVfkEwAPs9ZnkJu/eFbCJHHmYS80lBPa2Ajdk27Z8egR9p0wWGZFmnEenxz+MmpBOBKU= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 74fc2498-71f9-426f-f887-08d68b900d21 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:30.9526 (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: BN6PR11MB1681 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33: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: 10797849 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 0AC7C922 for ; Tue, 5 Feb 2019 17:34:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB1862793B for ; Tue, 5 Feb 2019 17:33:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD43C27F4B; Tue, 5 Feb 2019 17:33:59 +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 CA47127F3E for ; Tue, 5 Feb 2019 17:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730763AbfBERd6 (ORCPT ); Tue, 5 Feb 2019 12:33:58 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:49481 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729154AbfBERdk (ORCPT ); Tue, 5 Feb 2019 12:33:40 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="25881425" 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; 05 Feb 2019 10:33:39 -0700 Received: from NAM05-BY2-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; Tue, 5 Feb 2019 10:33:38 -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=vnPNLz7Zj0WP8PCqpyRMz1iMXvA+YRwBN4HSmUM0tW4=; b=vyIFtj6MmRr7Yz4y9cpbCH7mfbN8V3aNly9PAxfsPibLfjAIjRyaipYFcXdKZGHsHySps3coaYoBiE/iKmBICcUtL2N+UjlikbQw19H7DPyXt0gQbR2rA3WSPpaDjHnfFdoMUNC+LnKp+FwF8l/MAfmPZtdJa2ZnC9QbCW40Mp0= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:36 +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; Tue, 5 Feb 2019 17:33:36 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 12/13] dt-bindings: spi: atmel-quadspi: QuadSPI driver for Microchip SAM9X60 Thread-Topic: [PATCH v6 12/13] dt-bindings: spi: atmel-quadspi: QuadSPI driver for Microchip SAM9X60 Thread-Index: AQHUvXjsZikC9xtTx0aofZ0egHbBrg== Date: Tue, 5 Feb 2019 17:33:35 +0000 Message-ID: <20190205173254.16388-13-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:WpAvIBd0MKD7d7dou3qWkXJOy/WegL6aKe4CTVz03WO4vMtVbFMnmaKlyhpZtCq6i4kPZ5DD30vT2ZTd6PLkgVIzL6qcvrRr3VMXD1dkCe+FwDpUdamohxHIxFRiTXAb9pioH6/oQKVZZprcH+QWlggmt0YYciC+YmsW6pCukS3j2TPSi3lAyZVs3t+cLHxPhwK0zNq6glefX3TGRZT4Ea/9piBBt7sLraNXkHRVAHBeNmApwsoBVXgPfU78IGZH9kXMXTw9oZYypcMn9kmV5yeXcCaigrhs9/+qUGSRmjAJtjCY7/JPbLKwKjdReSoDbSTz/RwanHcNyCBws2g0mB/9dGYmXajBNp/JXzrZhaz/6pzsATwAxkdpX18BbRmcx2/mt6+3ZJ81Tg7Zn0CG5wbRl7alBbcaYVDjtykMIbwqRTnsUp6XVd5yN7/zWt6/qMNakvAOsgIDwaph/AzXNQ==;5:5DXuHUPyAV7yXLddBmJH/UYOIJ0mr2sTCOJCGRAX8bw0nBeD7CWXTf1gnVxp+Yf1V/ZJA3Hm6VROZgUv32jwmPjYjkBlt6253bgEOLxvRYoXvxn+OKqS149FYHWlz+WOt2ekdtznBJViYSh0hwOgr924Ugcm3rRu7p2hb2emkMnHfuegMAdz4pIYt/TtDEIu/3ZpPNjoi9/Ck7TaLP1UmQ==;7:qIK0hx6XCBSUuzVl1e9bFnUJ4nZEnaIYn6ZW6M5SY9CiKDC/32+FIengtmDhmJyliFnnBVbXRXZnAGlJwrDaqE339ChV7zkYES1eG3jJ2iZz873l8E9IIVbJBVrxg7zbjX7+HApFtZ8eRUUzqd3HYQ== x-ms-office365-filtering-correlation-id: d7727321-5c3c-4c45-6b34-08d68b900eb0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(14444005)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: 4i68Hvldjv3iyIS8u6uEcZIFgMaw4S9PRuickltIsFQqooc0Cwixr3erW3sF5NtZwBpcKqc7XD2TJXkIripoaEX2ZJIY34weYGZAPKw+TgcdNRIZOLwEa1KJ29GkQkmref9D6ZVC7HDbWX4Y6o3mIo9eSgzRRSmB9iYkkuHL7bzN1gko0c6DE46CQGlBSXwoNIKR9NxTZGmPe/8TiIv4jnkTdiwuPI1Imq5m+vuIA79aQjCLNVpDEOlfJpnNpfFwFBJIoeeZTsrZ6/GEf+r8M6L0CPZgkfF5NTqbMugXnv7wnnGSnA+5qCOvtMPZLI++1bIh7PhMPZAmaCsJIR6IWZgoUmBjNF6If7H1IF9j9HKCaEtGF0iwqaHgr958BA3yFrMLtyKG/qromCct6+mXDEfH9hRPxt6BKdhvSrL04Xk= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d7727321-5c3c-4c45-6b34-08d68b900eb0 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:33.5869 (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: BN6PR11MB1539 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 --- v6: no change v5: no change 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 Tue Feb 5 17:33:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10797845 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 83A78746 for ; Tue, 5 Feb 2019 17:33:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 724A02793B for ; Tue, 5 Feb 2019 17:33:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6620527F4B; Tue, 5 Feb 2019 17:33:58 +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 6D8D72793B for ; Tue, 5 Feb 2019 17:33:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729179AbfBERdp (ORCPT ); Tue, 5 Feb 2019 12:33:45 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:41058 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728343AbfBERdn (ORCPT ); Tue, 5 Feb 2019 12:33:43 -0500 X-IronPort-AV: E=Sophos;i="5.56,564,1539673200"; d="scan'208";a="26340151" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 05 Feb 2019 10:33:42 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 10:33:41 -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=v4Od9gnCxi3jip042FHAM7tJUXHXYe07DTLwP8ZuCzQ=; b=SwWchiYCwclmbctT7lOP4cMpQE6CAw82ckaeUG/XHELP5plUWG71Jz5E9BEfEG8l6p7y3fSW63GyzhhiUFV9GlzKqwxrlT7s3EgKUc2G9PjXi/+XkVorogVYG5vCguUGDL16W1vU1a8EpbVaYw7oKMqYXo70h7SaJ/Q3Y7RErJ4= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1539.namprd11.prod.outlook.com (10.172.23.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Tue, 5 Feb 2019 17:33:38 +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; Tue, 5 Feb 2019 17:33:38 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v6 13/13] spi: atmel-quadspi: add support for sam9x60 qspi controller Thread-Topic: [PATCH v6 13/13] spi: atmel-quadspi: add support for sam9x60 qspi controller Thread-Index: AQHUvXjtLv08A027eU25+F42pnge9g== Date: Tue, 5 Feb 2019 17:33:38 +0000 Message-ID: <20190205173254.16388-14-tudor.ambarus@microchip.com> References: <20190205173254.16388-1-tudor.ambarus@microchip.com> In-Reply-To: <20190205173254.16388-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR07CA0128.eurprd07.prod.outlook.com (2603:10a6:802:16::15) 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;BN6PR11MB1539;6:vG0lVldju4QaQIJVcKqoP7uRjyrrJ0Xu0qm6Hx3nlTPgXr10NN04D16qaTsr4QRnF11jU7baZUe9r2XLdk0eGEQ1CimlAAbm0PCBvkwNSvJZW78lVVjRDYP2iGI5xa0/pSxGhHff+U51FiV98AXxphhvz+0Y8LD3M2dax36PNnUH9VgtfihbYC45sUd2bXaFS5PveasguhMX3pLkJ1i4wi4YnNKtNxLq1wNx8tjvmSqRqxUQ4fVApEMIxuj9SGJpwyInYUpoREwnsUTgvi++ckLkVfggYQjiZ25Z/v82f9VAr5X+fo80zkhaa+TN34qgp3+hQ7amZX4uASM+EmUYonk7opPPDd7dOMtr0LoS7cDOazMSU1FQOjhlLIdtdHwE7F5CFXWTIwufHHUSfEtuVpHlA+Slau1P9TsHj16MdJKKqHSq1th7rtZI9hckjp0cFiTDWcgtkv4cFkbaV9Hefg==;5:YMKn9vWFmXLJvwAuALZ69qLHqD65siS5uZ/oGzkFTUIIsxk3kEZLt5UmBXPOc1GOcmn3eag20MYW3Gug4oAHJ1wLdh9dxJb4jMynmCQsiDGvI/QOJ/exOBY0jBKmZ0QKdx7FXIlZPd1fGfh+l8/AoDudrST1rrcyLIGC2sGVRX8vVEWP5z+V4u//XML/iX/tDfkQUFgpbwrFDUJ6Snn1qw==;7:STSx4VhM2uS4rsbWAKqg7LijuMZxJM7cykpZ4IKc2K2b+IDfV4/NxMJs0mBC5U1OXdKaRv9gxWcEsXDQHZMx77T7XYo25aQ3B3pCbqrxQueFY2f5SidJS5wrRMe4SdO7AjXXON3ATZKZ/NCIzKDDZw== x-ms-office365-filtering-correlation-id: 81ee7cbb-f835-44ad-974b-08d68b90103a x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1539; x-ms-traffictypediagnostic: BN6PR11MB1539: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(366004)(136003)(39860400002)(199004)(189003)(386003)(6506007)(7736002)(4326008)(71200400001)(71190400001)(99286004)(72206003)(2906002)(110136005)(14454004)(316002)(305945005)(76176011)(8936002)(8676002)(52116002)(7416002)(3846002)(478600001)(6116002)(54906003)(2501003)(50226002)(1076003)(36756003)(106356001)(53936002)(105586002)(30864003)(25786009)(81156014)(6486002)(68736007)(81166006)(256004)(86362001)(102836004)(26005)(486006)(6512007)(11346002)(14444005)(66066001)(476003)(97736004)(107886003)(6436002)(186003)(2616005)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1539;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: UUm5iApy4yz/Vf8S45O9AXol2Xq9wdFBeexd2dJatlP8yOYv08tzb652fGkxeC73XRh3h0nyjsiYx+KSPqGdGNeY0gccFDplQIVK/DGUb0UPZrZoVP/Or+wtgXo6ucFsEzNsZGdUC+Eobx7+trr2YnXBejGZ0sNS53mIDUgTUu/SlFb86g3oDZt55kuyxTZ238auJtAAEvyecYM3zyip27DwbJrtUcbNey9jFUYTP9grf1jJA2fxjDboPJIqTgaj6c3jhMXFlapojQ6/heSqLV4K1Kcg7f+fEXnSDcSxeeD2Rtr2mFQMYD1maZmowZ4pX5x+4WBP+dLhcbp8RiwvaxtXxm5IgX8ZhBzfrkTrrPNtXKL8hj9FFKMtu2MO6cWQXVfnY9nVn6KBZFm4iCAvqsI1P508s4pCZc/klxEn7cg= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 81ee7cbb-f835-44ad-974b-08d68b90103a X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 17:33:36.1651 (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: BN6PR11MB1539 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 Reviewed-by: Boris Brezillon --- v6: add a caps instance to the sama5d2 entry instead of allowing caps to be NULL v5: - use WICR for sam9x60 - remove ops hooks and introduce caps->has_ricr - get rid of the cfg struct - group IO accesses together in atmel_qspi_set_cfg() 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 | 163 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 128 insertions(+), 35 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 336501d962e5..fffc21cd5f79 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) @@ -133,12 +137,18 @@ #define QSPI_WPSR_WPVSRC_MASK GENMASK(15, 8) #define QSPI_WPSR_WPVSRC(src) (((src) << 8) & QSPI_WPSR_WPVSRC) +struct atmel_qspi_caps { + bool has_qspick; + bool has_ricr; +}; 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; @@ -151,7 +161,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 +190,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,36 +211,37 @@ 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_cfg(struct atmel_qspi *aq, + const struct spi_mem_op *op, u32 *offset) { - struct atmel_qspi *aq = spi_controller_get_devdata(mem->spi->master); - int mode; + u32 iar, icr, ifr; u32 dummy_cycles = 0; - u32 iar, icr, ifr, sr; - int err = 0; + int mode; 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; - } - mode = atmel_qspi_find_mode(op); if (mode < 0) return mode; - - ifr |= sama5d2_qspi_modes[mode].config; + ifr |= atmel_qspi_modes[mode].config; 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: @@ -264,6 +275,9 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) } } + /* offset of the data access in the QSPI memory space */ + *offset = iar; + /* Set number of dummy cycles */ if (dummy_cycles) ifr |= QSPI_IFR_NBDUM(dummy_cycles); @@ -272,16 +286,51 @@ 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_OUT) - ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; + /* + * 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; + } /* 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); + if (aq->caps->has_ricr) { + if (!op->addr.nbytes && op->data.dir == SPI_MEM_DATA_IN) + ifr |= QSPI_IFR_APBTFRTYP_READ; + + /* Set QSPI Instruction Frame registers */ + writel_relaxed(iar, aq->regs + QSPI_IAR); + if (op->data.dir == SPI_MEM_DATA_IN) + writel_relaxed(icr, aq->regs + QSPI_RICR); + else + writel_relaxed(icr, aq->regs + QSPI_WICR); + writel_relaxed(ifr, aq->regs + QSPI_IFR); + } else { + if (op->data.dir == SPI_MEM_DATA_OUT) + ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; + + /* 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); + } + + 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); + u32 sr, offset; + int err; + + err = atmel_qspi_set_cfg(aq, op, &offset); + if (err) + return err; /* Skip to the final steps if there is no data */ if (op->data.nbytes) { @@ -290,11 +339,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 + offset, + op->data.nbytes); else - _memcpy_toio(aq->mem + iar, - op->data.buf.out, op->data.nbytes); + _memcpy_toio(aq->mem + offset, op->data.buf.out, + op->data.nbytes); /* Release the chip-select */ writel_relaxed(QSPI_CR_LASTXFER, aq->regs + QSPI_CR); @@ -450,28 +499,55 @@ static int atmel_qspi_probe(struct platform_device *pdev) goto exit; } + aq->caps = of_device_get_match_data(&pdev->dev); + if (!aq->caps) { + dev_err(&pdev->dev, "Could not retrieve QSPI caps\n"); + err = -EINVAL; + goto exit; + } + + if (aq->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 +563,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 +572,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 +583,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 +591,22 @@ 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_caps atmel_sama5d2_qspi_caps = {}; + +static const struct atmel_qspi_caps atmel_sam9x60_qspi_caps = { + .has_qspick = true, + .has_ricr = 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 */ } };