From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753229AbcGFKlG (ORCPT ); Wed, 6 Jul 2016 06:41:06 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:50909 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326AbcGFKlD (ORCPT ); Wed, 6 Jul 2016 06:41:03 -0400 X-AuditID: cbfec7f4-f796c6d000001486-4f-577ce03b0792 Subject: Re: [PATCH v3 1/2] clk: exynos5433: do not use CLK_IGNORE_UNUSED for SPI clocks To: Andi Shyti References: <1467270911-10971-1-git-send-email-andi.shyti@samsung.com> <1467270911-10971-2-git-send-email-andi.shyti@samsung.com> <577A2EFF.2010306@samsung.com> <20160704102614.GD1257@jack.zhora.eu> <577A7D8D.8070004@samsung.com> <20160706045108.GD23620@samsunx.samsung> Cc: Andi Shyti , Chanwoo Choi , Jaehoon Chung , Tomasz Figa , Michael Turquette , Stephen Boyd , Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrzej Hajda From: Sylwester Nawrocki Message-id: <577CE03A.3090603@samsung.com> Date: Wed, 06 Jul 2016 12:40:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-version: 1.0 In-reply-to: <20160706045108.GD23620@samsunx.samsung> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42I5/e/4VV3rBzXhBkcnCFncWneO1WL7kWes Fot/PGeyuP7lOavFjV9trBavXxha9D9+zWyx6fE1VouPPfdYLS7vmsNmMeP8PiaLi6dcLX6c 6WaxWLXrD6MDn8f7G63sHpf7epk8ri/5xOyxc9Zddo9NqzrZPDYvqffo27KK0ePzJrkAjigu m5TUnMyy1CJ9uwSujK7/k1kLLvNXNM6cwtLAeJ27i5GTQ0LARKL91ykWCFtM4sK99WxdjFwc QgJLGSWmzVrDBOE8Z5RY8vUOUBUHh7BAlMSD4xkgDSIC6hJL9m5lhqh5wSSxdNd6VpAEs8BL Zokt3REgNpuAoUTv0T5GEJtXQEti+42DrCBzWARUJTqOaYOERQUiJJ7MPQlVIijxY/I9sIM4 BUwlzqybyA5SziygJ3H/ohbEdHmJzWveMk9gFJiFpGMWQtUsJFULGJlXMYqmliYXFCel5xrq FSfmFpfmpesl5+duYoTEz5cdjIuPWR1iFOBgVOLhnfC8OlyINbGsuDL3EKMEB7OSCG/cvZpw Id6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxzd70PERJITyxJzU5NLUgtgskycXBKNTBWnFP67X34 y84NaffjL8hXtfb3H97M9m5tiXWpGPeMpw8n3z8QtWfqtBvvOtYIXt79hf/bxUPMpsZGq3h2 /Oy3sy3N/76soHF+gbHaMf3QA/ZstcUXgtI3155W/f5JvKFQeuq74H8JIdc2LP1w71Dc4UMx SwUPPH91//m0o/ZPVm2ouT/l3yH/d0osxRmJhlrMRcWJABXdXtqbAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/06/2016 06:51 AM, Andi Shyti wrote: > > I don't see anything wrong on the above. We could make it as: > @@ -640,13 +639,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); clk_set_rate() call needs to stay, we can only remove clk_prepare_enable(). > - } else { > + if (!sdd->port_conf->clk_from_cmu) { > /* Configure Clock */ > val = readl(regs + S3C64XX_SPI_CLK_CFG); > val &= ~S3C64XX_SPI_PSR_MASK; > >> I meant we could amend which clocks are specified at the SPI bus device >> DT nodes and change handling of clocks in the spi-s3c64xx driver to model >> everything properly and get it all working. > > I think that if the clock comes from the cmu it's not necessary > to disable it. I would like to avoid adding DTS properties > because we have the clock disabling inherited from old code which > it might not be required at all (in our tests, indeed it works). OK, anyway we already need to amend exynos5433.dtsi file to change the "spi_busclk0" clock specifier. I agree we can get rid of the clock gating in s3c64xx_spi_config() function, it should not do any harm and will help in getting rid of the bus access exceptions. In general PCLK should be enough for accessing register of the controller, one hypothesis is that automatic clock gating may be disabling PCLK when it sees SCLK inactive. I tested on exynos4412 trats2 board a large firmware file upload over SPI and didn't notice any bad side effects with above clk_disable_unprepare()/clk_prepare_enable() calls commented out.