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); }