Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp784040imu; Tue, 20 Nov 2018 06:58:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/U5JkELK3aSmP91P8Y6n92g1j7vVIEm66GeuOLKD3QVeeBsUYQtzpT980hazc5NcVaLQdg4 X-Received: by 2002:a63:a552:: with SMTP id r18mr2213972pgu.176.1542725907525; Tue, 20 Nov 2018 06:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542725907; cv=none; d=google.com; s=arc-20160816; b=k67F8xEsLrFG4R/MixD2DKncCcK/rbjenGrjhfT2TuhW1PP7p/KLSPHEqN+cIBPDRa a1eMaUM6lz9Vq1cu2O9mHOI3n218fgFgSCqdvlsAk66ipd2zgWHQRlNnoM+xzB0Mg34S zo28iWeOJFlHISyw7XN1CajgF3lyUKH+8mH4DfCQWEGXbTeUacxTFcvuEShhfAxvZGUg Bdk/nEvUnqpRODH9maAlvJWzmt+rOHBxZ3P9FoXGzt/mwiSLl+4sctkpqaF4CbV9y1WJ qL6jk/rbaEuREH4s5hlq03kgIN8wA2B7g1GO+2xW7DZG23ZvpxjkL8QaT8xBR9sPGHWS ckDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=5URFgJImLVDDX0WO1lohNrgkCCdLgUsWNGHG+EaJcBg=; b=hUZ42BlPG3S33e3fBbaC75Lqk01kHj3j/AH0NAU9patvDssF4GvCPEZ6eFNhqXd94R DuCWu8tND0pnU4aQMbSqPOjvTTl/mFOIV8F1X8XH99NWGqC7pW3x6eJ97LaJt76HxWrw 94HurtlEFCz0JeAZcUxt3B5hjrlab/Ps/ByoW5F6x8dKt47Q6o89s4EyBexobisSUY78 utnWInh4Mp7GGezfmMy/V+G+GFZx5uClxMGsZvXup+GS6kJ1sRjMhwWNAWaiG5BTz/1J /lQlaFW4nJWZhUdOMxnZOxaItASXx0QX3lpcPJG1hlIp69iVT4Bs+62JPOuJfKeBBmse q8pQ== ARC-Authentication-Results: i=1; mx.google.com; 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 l23si42276162pgh.533.2018.11.20.06.58.12; Tue, 20 Nov 2018 06:58:27 -0800 (PST) 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; 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 S1727461AbeKUABW convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Nov 2018 19:01:22 -0500 Received: from mail.bootlin.com ([62.4.15.54]:56433 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726911AbeKUABW (ORCPT ); Tue, 20 Nov 2018 19:01:22 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id E3F90206A1; Tue, 20 Nov 2018 14:32:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 99BEC2037D; Tue, 20 Nov 2018 14:32:10 +0100 (CET) Date: Tue, 20 Nov 2018 14:32:09 +0100 From: Boris Brezillon To: Marek Vasut Cc: masonccyang@mxic.com.tw, broonie@kernel.org, Geert Uytterhoeven , Simon Horman , juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-spi@vger.kernel.org, tpiepho@impinj.com, zhengxunli@mxic.com.tw Subject: Re: [PATCH 1/2] spi: Add Renesas R-Car RPC SPI controller driver Message-ID: <20181120143209.49217efb@bbrezillon> In-Reply-To: <6b024f18-d0bc-3e65-f07c-cef913f795ab@gmail.com> References: <1542621690-10229-1-git-send-email-masonccyang@mxic.com.tw> <1542621690-10229-2-git-send-email-masonccyang@mxic.com.tw> <0223f43b-c6a6-eade-49af-4e7b7ef7f022@gmail.com> <6b024f18-d0bc-3e65-f07c-cef913f795ab@gmail.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Nov 2018 14:09:05 +0100 Marek Vasut wrote: > On 11/20/2018 08:23 AM, masonccyang@mxic.com.tw wrote: > > Hi Marek, > > Hi, > > >> Marek Vasut > >> 2018/11/19 下午 10:12 > >> > >> To > >> > >> > + > >> > +static int rpc_spi_set_freq(struct rpc_spi *rpc, unsigned long freq) > >> > +{ > >> > +   int ret; > >> > + > >> > +   if (rpc->cur_speed_hz == freq) > >> > +      return 0; > >> > + > >> > +   clk_disable_unprepare(rpc->clk_rpc); > >> > +   ret = clk_set_rate(rpc->clk_rpc, freq); > >> > +   if (ret) > >> > +      return ret; > >> > + > >> > +   ret = clk_prepare_enable(rpc->clk_rpc); > >> > +   if (ret) > >> > +      return ret; > >> > >> Is this clock disable/update/enable really needed ? I'd think that > >> clk_set_rate() would handle the rate update correctly. > > > > This is for run time PM mechanism in spi-mem layer and __spi_sync(), > > you may refer to another patch [1]. > > > > [1] > > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git/commit/?h=for-4.21&id=b942d80b0a394e8ea18fce3b032b4700439e8ca3 > > I think Geert commented on the clock topic, so let's move it there. > Disabling and enabling clock to change their rate looks real odd to me. Look at the CLK_SET_RATE_GATE definition and its users and you'll see it's not unusual to have such constraints on clks. Maybe your HW does not have such constraints, but it's not particularly odd to do that (though it could probably be automated by the clk framework somehow).