From patchwork Wed Sep 6 07:05:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9940009 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9C0C602CC for ; Wed, 6 Sep 2017 07:05:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AAAD28AFB for ; Wed, 6 Sep 2017 07:05:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F78728B00; Wed, 6 Sep 2017 07:05: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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 439EC28AFB for ; Wed, 6 Sep 2017 07:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751870AbdIFHFT (ORCPT ); Wed, 6 Sep 2017 03:05:19 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:57110 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751875AbdIFHFO (ORCPT ); Wed, 6 Sep 2017 03:05:14 -0400 Received: from vsmta14.fe.internet.bosch.com (unknown [10.4.98.54]) by imta24.fe.bosch.de (Postfix) with ESMTP id C59A7D8022E; Wed, 6 Sep 2017 09:04:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1504681483; bh=JbLYvlyOc+H/3b2ur7aNFVMicCuJNJVOtVEm8wJtcNA=; l=10; h=From:From:Reply-To:Sender; b=wZ4iHHv5eF0Xx7g2BBX+d7HfctaXzM858HP4+iWVyKGSBYlYBc73lxl9YsZfOiPqP LEZ8kERgKq7JaGNvMApTOvxvbUH51M3FBXIZR20mO0X33OH6+WOBi//ICPdVwBxxz9 +vbyWNa1mqCjgfO+oB2yYMHCCDoaf4I/xd2i2/Ys= Received: from SI-HUB1000.de.bosch.com (vsgw23.fe.internet.bosch.com [10.4.98.23]) by vsmta14.fe.internet.bosch.com (Postfix) with ESMTP id BB8F6A40916; Wed, 6 Sep 2017 09:05:12 +0200 (CEST) Received: from HI-Z0EVG.hi.de.bosch.com (10.34.218.219) by SI-HUB1000.de.bosch.com (10.4.103.106) with Microsoft SMTP Server id 14.3.319.2; Wed, 6 Sep 2017 09:05:11 +0200 Received: from HI-Z0EVG.hi.de.bosch.com (localhost [IPv6:::1]) by HI-Z0EVG.hi.de.bosch.com (Postfix) with ESMTP id DC6E11B46B13; Wed, 6 Sep 2017 09:05:10 +0200 (CEST) From: Dirk Behme To: , , Geert Uytterhoeven CC: Hiromitsu Yamasaki , Dirk Behme Subject: [PATCH 6/8] spi: sh-msiof: Add MSIOF parent clock changing function for R-Car Gen3 Date: Wed, 6 Sep 2017 09:05:05 +0200 Message-ID: <20170906070507.26223-7-dirk.behme@de.bosch.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170906070507.26223-1-dirk.behme@de.bosch.com> References: <20170906070507.26223-1-dirk.behme@de.bosch.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-23304.006 X-TMASE-MatchedRID: 6GTnfG1j+io/pUoYqyfnNAPZZctd3P4BLYdywTHl7nsOkJQR4QWbsJJo t8xOxyL57Jlg7R3T2W9nVL4io/9yjjhUupg4y4m6nIGynr5ObIZPZ8WbDkfxU5soi2XrUn/Jn6K dMrRsL14qtq5d3cxkNfDH3oiH65tyvWbquHEAH+AiwX3GbkhL7tRAvKM0zrS1IZZoICM20na/v8 rLDQSBSKRCIWwp8KsgjP2gMhLRerPOQpzCvHm2wW5o89UbrNpIXyZ6pl/oDQ1+Az0rNWZh1oK3x HwHujePnOrUWil1YnlDDKa3G4nrLQ== Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hiromitsu Yamasaki Signed-off-by: Hiromitsu Yamasaki Signed-off-by: Dirk Behme --- drivers/spi/spi-sh-msiof.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index a960e8da123d..2c53fc3f73af 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -188,6 +188,14 @@ struct sh_msiof_spi_priv { #define IER_RFOVFE 0x00000008 /* Receive FIFO Overflow Enable */ +static int msiof_rcar_is_gen3(struct device *dev) +{ + struct device_node *node = dev->of_node; + + return of_device_is_compatible(node, "renesas,msiof-r8a7795") || + of_device_is_compatible(node, "renesas,msiof-r8a7796"); +} + static u32 sh_msiof_read(struct sh_msiof_spi_priv *p, int reg_offs) { switch (reg_offs) { @@ -1252,6 +1260,8 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) const struct of_device_id *of_id; struct sh_msiof_spi_info *info; struct sh_msiof_spi_priv *p; + struct clk *ref_clk; + u32 clk_rate = 0; int i; int ret; @@ -1352,6 +1362,17 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) goto err2; } + if (msiof_rcar_is_gen3(&master->dev)) { + ref_clk = devm_clk_get(&pdev->dev, "msiof_ref_clk"); + if (!IS_ERR(ref_clk)) + clk_rate = clk_get_rate(ref_clk); + if (clk_rate) { + clk_prepare_enable(p->clk); + clk_set_rate(p->clk, clk_rate); + clk_disable_unprepare(p->clk); + } + } + return 0; err2: