From patchwork Thu Jul 7 07:23:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9217909 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 0617060B16 for ; Thu, 7 Jul 2016 07:27:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFF3F2875B for ; Thu, 7 Jul 2016 07:27:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E465F28763; Thu, 7 Jul 2016 07:27:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 982B02875C for ; Thu, 7 Jul 2016 07:27:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750952AbcGGHZG (ORCPT ); Thu, 7 Jul 2016 03:25:06 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:52411 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750814AbcGGHYW (ORCPT ); Thu, 7 Jul 2016 03:24:22 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O9X014K2OKJAH80@mailout1.samsung.com>; Thu, 07 Jul 2016 16:24:19 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.112]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 7B.47.05161.3A30E775; Thu, 7 Jul 2016 16:24:19 +0900 (KST) X-AuditID: cbfee68f-f79476d000001429-1e-577e03a38edc Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 28.DF.04429.3A30E775; Thu, 7 Jul 2016 00:24:19 -0700 (MST) Received: from samsunx.samsung ([10.113.63.54]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O9X008W4OKG1C40@mmp1.samsung.com>; Thu, 07 Jul 2016 16:24:19 +0900 (KST) From: Andi Shyti To: Mark Brown Cc: Sylwester Nawrocki , Kukjin Kim , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi Date: Thu, 07 Jul 2016 16:23:57 +0900 Message-id: <1467876237-12183-1-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsWyRsSkQHcxc124wcJV6hbbjzxjtVj84zmT xdSHT9gsXr8wtOh//JrZYtPja6wWl3fNYbOYcX4fk0Xjx5vsFofftLM6cHlcX/KJ2WPTqk42 j81L6j36tqxi9Pi8SS6ANYrLJiU1J7MstUjfLoErY8eR9awFf/kqjq2JaWCcy9PFyMkhIWAi 8Xz1E1YIW0ziwr31bF2MXBxCAisYJX5d2MUCU7R1515WiMRSRol/fxuZQBJCAh8ZJY5sqgax 2QQ0JZpu/2ADsUUElCWuft/LAtLALHCaSWLZ+TfMIAlhgWCJ9S0PGEFsFgFViXVHdoGt5hVw k/i19BE7xDY5icvTH4CdISEwj11i4rFJTBANAhLfJh8CmsoBlJCV2HSAGaJeUuLgihssExgF FzAyrGIUTS1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E+qvLz9rXedjO/BR89/Jx2e 7Cg896369OVPbs1IUBDOjggKuMv2lfs068ypJ3aleioapLzi+vXQzLUzJVPtWGbjwj8nv2Rw i3x7eCdt86Xeps3flPXmXVp0zfY1W/oRzVNtTza5/NLQX6bEUpyRaKjFXFScCAD0lvN7sAIA AA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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 When the clock is coming from the cmu it is not required to be disabled and then re-enabled in order to change the rate. Besides, some exynos chipsets (e.g. exynos5433) do not deliver any to the SFR if one from the pclk ("spi" in this case) or sclk ("busclk") is disabled. Remove the clock disabling/enabling to avoid falling into this situation. Signed-off-by: Sylwester Nawrocki Signed-off-by: Andi Shyti Reviewed-by: Krzysztof Kozlowski --- Hi, This patch has been tested by me and Sylwester on Trats2 (exynos4412) and tm2(e) (exynos5433) boards, for big data (which use dma transfer) and small data. It also fixes in exynos5433 a synchronus abort caused by the fact that the pclk (spi) doesn't get delivered if the sclk is disabled (busclk) Thanks, Andi drivers/spi/spi-s3c64xx.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 048c900..c719e73 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -577,9 +577,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) u32 val; /* Disable Clock */ - if (sdd->port_conf->clk_from_cmu) { - clk_disable_unprepare(sdd->src_clk); - } else { + if (!sdd->port_conf->clk_from_cmu) { val = readl(regs + S3C64XX_SPI_CLK_CFG); val &= ~S3C64XX_SPI_ENCLK_ENABLE; writel(val, regs + S3C64XX_SPI_CLK_CFG); @@ -622,11 +620,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) writel(val, regs + S3C64XX_SPI_MODE_CFG); if (sdd->port_conf->clk_from_cmu) { - /* Configure Clock */ - /* There is half-multiplier before the SPI */ clk_set_rate(sdd->src_clk, sdd->cur_speed * 2); - /* Enable Clock */ - clk_prepare_enable(sdd->src_clk); } else { /* Configure Clock */ val = readl(regs + S3C64XX_SPI_CLK_CFG);