Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4168341ooa; Tue, 14 Aug 2018 02:01:57 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxTqDgD8fCaAQxZgUVRMCtue4fLK1Hmd2atrGn0exfuU6OezfqOF9NRgGwBmOlI4a6YuoIX X-Received: by 2002:a63:9311:: with SMTP id b17-v6mr20221166pge.261.1534237317486; Tue, 14 Aug 2018 02:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534237317; cv=none; d=google.com; s=arc-20160816; b=p5C8Eto7Wk/RNLsB+Ir4OmtBDfcQKvGhxHk9o/vQFqabpdrI9yAxxNbZ5zmT1X0+NF KEm3+1VwCmgvzDI65TeyeL831SlQ72FyAYSVS+vkrvIBi6TM79Z4JkeymjsmH5oykvUr 5767xEA1MuUBubCSbpQNtZLe+kMGqyzfMQbdi5v6O9ncbKFXCZBNUU3y9UCa4fSixQcd ugTtBMR5lV5lSZE+7u+FbPIHfnaX5dwPQujkUwOQDL+komf7AGUYEZ4c3AoRSY7OgAz5 UrUBwzzbXxsYWDNG9oT2Bj4uVOvaVHEZgaBY/ay4UpJu4VlLQp84ywMGnvRePQ0yBWAp P5bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=SJpkwWyTa6TPe9F0HLwzCjJDb+LBeR5lEbLSFe40oRE=; b=fQzCGbJdnNC3nVjuzG3A/9zUCRys+3rJ2FkTgP9NEm47NQ8fRA2vyG6i2rtg18taRv mvQ0G9phVzeodigHuurVvT6ovHfhycrmc6+2mFrXA83uFggQ4MBLseZhMX00x2FOdU19 L0T8LT5h/hEOdRoA2jqrRYen8aQVINMVH8xAzc9kroplQ/o8CNS0uHyCHKSybb5zqDhj zAeYIHtW7WZz3TSnubydU5mSguGzxoY3BGBxlsb1NFMSk2jsjbHmh2oFJd1LZJjP8vSO 0w2Z4uxYSaesM3RcFOHbf5IDkfYsAWjl43yA8yV+P48EzJpkjpC8ay3cl7X0GdoSAWgg cPOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TxFJxS56; dkim=pass header.i=@codeaurora.org header.s=default header.b=A1+svyl1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i123-v6si20000333pfe.145.2018.08.14.02.01.42; Tue, 14 Aug 2018 02:01:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TxFJxS56; dkim=pass header.i=@codeaurora.org header.s=default header.b=A1+svyl1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731938AbeHNLqS (ORCPT + 99 others); Tue, 14 Aug 2018 07:46:18 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45248 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730119AbeHNLqS (ORCPT ); Tue, 14 Aug 2018 07:46:18 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 43C7E6076A; Tue, 14 Aug 2018 09:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534237203; bh=wpOFNrTqT0pT7zZxq3pO2UF2hJ1eT80s8Wsjz/7SZfY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TxFJxS56tvGcVClcQdkDyG/L3rS7Wkk2AM52N9HrW00ilrShTgqp3UWPj6sZM7Uow 6dL5TqnZC05s5ZUcmiGKSiU68mQWpU6JaRlJe2rRRCAXsXHu21DohEY4fc8/Zn+mpr 5F4DAiC+najUddFF/BROk2UoBuD/fSHDCE/JMZ64= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 626BF601B4; Tue, 14 Aug 2018 09:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534237202; bh=wpOFNrTqT0pT7zZxq3pO2UF2hJ1eT80s8Wsjz/7SZfY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=A1+svyl1PXwcqmShPALNXrQA89QEZn81k0scEdvPShyhUdA/DKLS0aa4Se/0MOUxm iv81HMrO4xTuoDdF4ARDQ5H7OeotPpI7FJ4J2f712UlhWJZthqFswG6b9op0R1w4Mq EKh64KbzgVgnE8dQhkElzZSGscV2Zpsc7qtcq4ws= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 14 Aug 2018 14:30:02 +0530 From: dkota@codeaurora.org To: Mark Brown Cc: Doug Anderson , Stephen Boyd , LKML , linux-spi , Sagar Dharia , Karthikeyan Ramasubramanian , linux-arm-msm , "Mahadevan, Girish" Subject: Re: [PATCH] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP In-Reply-To: <20180810164636.GI20971@sirena.org.uk> References: <20180522173000.GG24776@sirena.org.uk> <8968e04c-a200-ef06-5c33-94e399f7b9fe@codeaurora.org> <20180524162940.GA4828@sirena.org.uk> <28d8ab5fdeb34e52eba7ca771a17bc06@codeaurora.org> <61f2e1fb394bfe47ace42352f2e1b3a6@codeaurora.org> <20180810105205.GC20971@sirena.org.uk> <20180810161329.GF20971@sirena.org.uk> <20180810164636.GI20971@sirena.org.uk> Message-ID: X-Sender: dkota@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-08-10 22:16, Mark Brown wrote: > On Fri, Aug 10, 2018 at 09:59:46PM +0530, dkota@codeaurora.org wrote: > >> Now the need is, how to communicate the SPI controller maximum >> frequency to >> SPI core framework? >> Is it by DTSI entry or hardcoding in the SPI controller driver? > > If you've got a limit that exists in the IP the hard code it in the > driver. > >> My stand is for providing the DTSI entry. >> Why because, this keeps SPI controller driver generic across the >> boards and >> portable. >> Also it is not against to Device tree usage because maximum frequency >> is describing the property of the hardware. > > If the limit the controller has is not coming from the clock tree then > presumably it's a physical limitation of the silicon and isn't going to > vary per board. If the limit is coming from the board then it should > be > specified per slave since different slaves may have different > requirements on different boards. Agree with you guys, will hard code the controller maximum frequency in the driver. I will address this change in the next patchset. Could you all please comment on the other points too: >>> Do you mean spi-rx-delay-us and spi-tx-delay-us properties? Those are >>> documented but don't seem to be used. There's also the delay_usecs >>> part >>> of the spi_transfer structure, which may be what you're talking >>> about. >> >> delay_usecs is for inter-transfer delays within a message rather than >> after the initial chip select assert (it can be used to keep chip >> select >> asserted for longer after the final transfer too). Obviously this is >> also something that shouldn't be configured in a driver specific >> fashion. >> > > Hmmm ok, so you mean don't send these as controller_data, rather add > new > members to the spi_device struct ? spi_cs_clk_delay -> Adds Delay from CS line toggle to Clock line toggle spi_inter_words_delay -> Adds inter-word delay for each transfer. Could you please provide more information on accommodating these parameters in SPI core structures like spi_device or spi_transfer? Why because these are very specific to Qualcomm SPI GENI controller. If we define them in spi core framework structures, SPI Slave driver will program and expect it in the SPI transfers. >> + mas->cur_speed_hz = spi_slv->max_speed_hz; > > Why can't you use clk_get_rate() instead? Or call clk_set_rate() with > the rate you want the master clk to run at and then divide that down > from there? > > >> > Not sure I follow, the intention is to run the controller clock based on >> > the slave's max frequency. > >> That's good. The problem I see is that we have to specify the max >> frequency in the controller/bus node, and also in the child/slave >> node. >> It should only need to be specified in the slave node, so making the >> cur_speed_hz equal the max_speed_hz is problematic. The current speed >> of >> the master should be determined by calling clk_get_rate(). > > We don't require that the slaves all individually set a speed since it > gets a bit redundant, it should be enough to just use the default the > controller provides. A bigger problem with this is that the driver > will > never see a transfer which doesn't explicitly have a speed set as the > core will ensure something is set, open coding this logic in every > driver would obviously be tiresome. clock_get_rate() will returns the rate which got set as per the clock plan(which was the rounded up frequency) which can be less than or equal to the requested frequency. For that reason using the cur_speed_hz to store the requested frequency and skip clock configuration for the consecutive transfers with same frequency. --Dilip