From patchwork Mon Feb 4 10:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0B016C2 for ; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA682AB30 for ; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D34222AB3C; Mon, 4 Feb 2019 10:10:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99D4D2AB30 for ; Mon, 4 Feb 2019 10:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729459AbfBDKKL (ORCPT ); Mon, 4 Feb 2019 05:10:11 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:33464 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729448AbfBDKKI (ORCPT ); Mon, 4 Feb 2019 05:10:08 -0500 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="26269144" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:10:06 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:10:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+28Y2aJ8lIMlNQDPgbnkcqOqn5q0Pm2UPftgTWFysnk=; b=MtJPNFFhItlI1W4e2/kbk5eimMNwaH6+MqC2gN5Y/aPEVOIN3ngd9tVnt/soEP+1Ef4dNtP1hLWmYnwr38jVYL1nT6lEG2gT8myhhvHHpxDFwvBVYjfVhhz3/kbuxUAU1p6dX92Ru10sJn/1/SjTLeGSqXkBXLb1a2ZlZmSH6is= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1508.namprd11.prod.outlook.com (10.172.21.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.16; Mon, 4 Feb 2019 10:10:04 +0000 Received: from BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::847:4296:13b9:fc9f]) by BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::847:4296:13b9:fc9f%8]) with mapi id 15.20.1580.019; Mon, 4 Feb 2019 10:10:04 +0000 From: To: , , , , , , , , CC: , , , , , Subject: [PATCH v4 11/13] spi: atmel-quadspi: add support for named peripheral clock Thread-Topic: [PATCH v4 11/13] spi: atmel-quadspi: add support for named peripheral clock Thread-Index: AQHUvHHMdbu+8gPxv02aD+K9PloJHQ== Date: Mon, 4 Feb 2019 10:10:04 +0000 Message-ID: <20190204100910.26701-12-tudor.ambarus@microchip.com> References: <20190204100910.26701-1-tudor.ambarus@microchip.com> In-Reply-To: <20190204100910.26701-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR08CA0270.eurprd08.prod.outlook.com (2603:10a6:803:dc::43) To BN6PR11MB1842.namprd11.prod.outlook.com (2603:10b6:404:101::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tudor.Ambarus@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.9.5 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR11MB1508;6:y/rRzrmttsHLtWSgHgm9pNIC2o9JzK3eWQn+l4wja+cakrGomV3rTHe7LBH5ZSZbjcJiTuQi7dMEOsu5mpeaWWnjRllD0hEDo5cNtzRH4oEPjSrHKeBXLpyrjx2BKaHyg8KJnQNkjGMm/CceqFEgw/gxLBwv/1ReBfDQiMQnPMHOCcdazBhH2YMJq1wnrwLiXahE3dgcRczaiqImkgjsyMjyj6tKlstX34QK6B6XVk2j2k6+3LGktKIhW1DQNCKxBvv8QTIzm/mtuaymm7FRXgjtVA/r4B/Ue9cCyAGJIbNdFBvwmgacwzuGGlipWuTuzKvuCAPLFY3liUruVWnsnl/OgD1ew/aKYOw0w+NDaUCyGAl/Kf1leBuSoQPRPvPgsoUthgCMLJxQ5RKPhjzFnUxWpYHBBPA777nOTtNB2vRAMZsEtIb9IedYYeNuA1+Q+S436Hly1wFKYmo4/fuO/g==;5:+F+fWhsuzDAGQLehqbZK1K/4M51Q/4/lun0LWJNuzMTeKNABH5zSIICrYa18HwcRBle3xzsvYt/M6X58ePK0pZrRZirJnBk792YKpdMPifWHNh+lt6LJ6us4l+4+zIFZ9zRSDOvs9cP8TtNsH6O6xP97LBDuaf6nFOvQ2C0ykEQ80jnIbjxqVNjX1jrQEtQZLagDHA84v6EbTqzaOy1Lyw==;7:w802giGm6RycDJ3lwSW2b4oXug3Ge4CEUwOD58X8PCt3VQvI4wxAUb8E5RXC9KoRCCwr2HpYrBNjbdZ/mxLF0NRhInFbFUdzgjICL7tl9SsHCxf+wqnpaxW8d8Dqx4xbSMT/MZb5dPnHuc/4AUCNeg== x-ms-office365-filtering-correlation-id: 79908c6a-6ee0-4ba2-4a60-08d68a88ee90 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR11MB1508; x-ms-traffictypediagnostic: BN6PR11MB1508: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(39860400002)(376002)(366004)(346002)(136003)(189003)(199004)(6486002)(11346002)(446003)(2616005)(486006)(106356001)(99286004)(6436002)(4326008)(105586002)(478600001)(476003)(76176011)(186003)(53936002)(305945005)(3846002)(6116002)(7736002)(81156014)(102836004)(26005)(81166006)(6512007)(107886003)(8676002)(25786009)(68736007)(39060400002)(52116002)(50226002)(110136005)(8936002)(2906002)(386003)(54906003)(6506007)(86362001)(1076003)(36756003)(71190400001)(71200400001)(316002)(97736004)(7416002)(14454004)(256004)(2501003)(14444005)(72206003)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR11MB1508;H:BN6PR11MB1842.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: xmrPJRi2JAxbkkFjW8L/UWrNYJ2tRui/EF/jTKb4MENKJuSmgWfuHHwBrgv1r0wZKOkZcnlI3a/+wb2ZT7Ow863PCY7BYuNDRPSi9eY44/1bieC+eA0rDF7cf7Y0ejPXr8/vaGQz63z6zpKAzWUSrwCs6QHv9CP6NaINUCKbyqxxoH71AqHIAAghGDlFPrHBCkRI2jjKxSg5YgBlVC+y+zirgdkfbvLRpRXE/xTwZPjPRWTZ1EMgiyAgobVEjw62xcrFJ31bcD6NT2frYnYbFSdo8wPlRvvDvZVd/JdozyvtQM2WXDOeLWqegt7e0t6Q222bm6InDVuQvq5yh/3DIUUtaem3D/qYLk/00HfrIpORn0QZ/BpvcNYMd4Q6P3AP1pW/N5aohzG7XuNpRUkLD2laR8MKDr/vD2iHxzdfUKo= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 79908c6a-6ee0-4ba2-4a60-08d68a88ee90 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:10:01.6411 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1508 X-OriginatorOrg: microchip.com Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus Naming clocks is a good practice. Keep supporting unnamed peripheral clock, to be backward compatible with old DTs. While here, rename clk to pclk, to indicate that it is a peripheral clock. Suggested-by: Boris Brezillon Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: collect R-b v3: new patch drivers/spi/atmel-quadspi.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 19a3980775ad..336501d962e5 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -137,7 +137,7 @@ struct atmel_qspi { void __iomem *regs; void __iomem *mem; - struct clk *clk; + struct clk *pclk; struct platform_device *pdev; u32 pending; u32 mr; @@ -341,7 +341,7 @@ static int atmel_qspi_setup(struct spi_device *spi) if (!spi->max_speed_hz) return -EINVAL; - src_rate = clk_get_rate(aq->clk); + src_rate = clk_get_rate(aq->pclk); if (!src_rate) return -EINVAL; @@ -433,15 +433,18 @@ static int atmel_qspi_probe(struct platform_device *pdev) } /* Get the peripheral clock */ - aq->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(aq->clk)) { + aq->pclk = devm_clk_get(&pdev->dev, "pclk"); + if (IS_ERR(aq->pclk)) + aq->pclk = devm_clk_get(&pdev->dev, NULL); + + if (IS_ERR(aq->pclk)) { dev_err(&pdev->dev, "missing peripheral clock\n"); - err = PTR_ERR(aq->clk); + err = PTR_ERR(aq->pclk); goto exit; } /* Enable the peripheral clock */ - err = clk_prepare_enable(aq->clk); + err = clk_prepare_enable(aq->pclk); if (err) { dev_err(&pdev->dev, "failed to enable the peripheral clock\n"); goto exit; @@ -452,25 +455,25 @@ static int atmel_qspi_probe(struct platform_device *pdev) if (irq < 0) { dev_err(&pdev->dev, "missing IRQ\n"); err = irq; - goto disable_clk; + goto disable_pclk; } err = devm_request_irq(&pdev->dev, irq, atmel_qspi_interrupt, 0, dev_name(&pdev->dev), aq); if (err) - goto disable_clk; + goto disable_pclk; err = atmel_qspi_init(aq); if (err) - goto disable_clk; + goto disable_pclk; err = spi_register_controller(ctrl); if (err) - goto disable_clk; + goto disable_pclk; return 0; -disable_clk: - clk_disable_unprepare(aq->clk); +disable_pclk: + clk_disable_unprepare(aq->pclk); exit: spi_controller_put(ctrl); @@ -484,7 +487,7 @@ static int atmel_qspi_remove(struct platform_device *pdev) spi_unregister_controller(ctrl); writel_relaxed(QSPI_CR_QSPIDIS, aq->regs + QSPI_CR); - clk_disable_unprepare(aq->clk); + clk_disable_unprepare(aq->pclk); return 0; } @@ -492,7 +495,7 @@ static int __maybe_unused atmel_qspi_suspend(struct device *dev) { struct atmel_qspi *aq = dev_get_drvdata(dev); - clk_disable_unprepare(aq->clk); + clk_disable_unprepare(aq->pclk); return 0; } @@ -501,7 +504,7 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev) { struct atmel_qspi *aq = dev_get_drvdata(dev); - clk_prepare_enable(aq->clk); + clk_prepare_enable(aq->pclk); return atmel_qspi_init(aq); }