Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp856154imu; Tue, 20 Nov 2018 08:00:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/W4V3CzfwaJWsz4MHnqgV8Nc5MNhZ5SbO2+/pKBOSnr0Rscpxzkg/DIS/J57vHtyKiOJTG/ X-Received: by 2002:a63:4044:: with SMTP id n65mr2348744pga.90.1542729643479; Tue, 20 Nov 2018 08:00:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729643; cv=none; d=google.com; s=arc-20160816; b=Q2In61Buav9hAFM2BNcsA/vW36fEBEpPvKRCAOhZR40geEB6aPMN7ELnERKA6Ih/wt Xt4133Ru83oy4duv0dYCjy4gHheX7i/R7m1gvMk9QUFJDg8wD2N1j9g3fP9G9b6Tq33L pEyW6bS/MDWHgnImZ9HTB4n0jB2ldn3QARQRlWeXYpFROfua2Gze2Rt75s2lo5QFcuMl /5o1aKX3CXbHMsZnDTjvSfoszij1ntnO0U8llrpV+UjipMW5A1EaGSUec5dSdqS/+LcE 1ajP1nR1JS7KIOWtem5/HppgFvFNtsZR7v82238/xOLjF5o9GspCBIbCLEdo4QAtOh/6 ZG4w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=eG+UIlp2B6FrYwPrA4iw0S0K/xFSflGKxZ5DRSlwwdA=; b=j699ATAP8OrtTWQcL00IxrqaJDEx2ufW+8Qcwe5btqyYRPxgjXvQ8MV84ENfLqOac7 2oK+Al/LE6WyVFI1AXCY4aLYklnXvpkmad0HZVjE9FNf28oBFu0MY5b8rLhJgwQFx7pb bS1H7gKFyvt9/hjPvOG7KsCGhnuHlJQadP+wA0IfSWx9+BN4Z2muRN/gtKcKKH6JQshf DN6fXxQlZJk6SXkIwndKzvX8DK1vDAj/MIXGaDOLMuBEq0UN5EOehA+zxQ8mZM1nIwzx M4c+LY00bXaIdGywnC/Irkciiobq680uSVEgVLmIfC7HD/jYApSCnTDnqpV+Rklbgqzq 1evA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RViZxl7Q; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 126si11372332pff.77.2018.11.20.08.00.28; Tue, 20 Nov 2018 08:00:43 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RViZxl7Q; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726433AbeKUAEo (ORCPT + 99 others); Tue, 20 Nov 2018 19:04:44 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38785 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeKUAEo (ORCPT ); Tue, 20 Nov 2018 19:04:44 -0500 Received: by mail-wm1-f66.google.com with SMTP id k198so2273046wmd.3; Tue, 20 Nov 2018 05:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eG+UIlp2B6FrYwPrA4iw0S0K/xFSflGKxZ5DRSlwwdA=; b=RViZxl7QrFnITKIlHX2aqkz70BAlN1A+H2WHfaX2rc8cti19QVuu8Sr855NYZmNRL9 jhmiFsfyGbMqMI5ymOcA8+4sdoWQhZd6vGLnDCkjhhdpThBACnYRCay1+trYfKQRDVPw 9WPzbcIuIAUYb8w87N4N1bbCV5C8WHs2urb7A84eCe/xr59Igyk8JlAXgVsVYsuw1h+s wneJQSaglB3KTyIAiRvshaYvobTH61kT1bkSyrMtOPHdEo5YXe3alIZHDrC/H5DV7KO6 KEvaGcoqjeaCzI5GKWs9WA/5TF5gFf76w4KVvGyofOWwpV8GDJHMjnj/hHkMxUciSDl/ fZEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eG+UIlp2B6FrYwPrA4iw0S0K/xFSflGKxZ5DRSlwwdA=; b=EEzkR1cFzVuIpdGqtBPWArfXXSKRUP/4I7Q+4WpQNMBRyoyGmpwl9EMdAzSrLIuqAo J5ca6fePmK2mgkjEhE/uykJ9DVDRrLjDmnCQ/HKMug4jn6jgYQgAJvC2V+5Ow635jSs6 ZkAyPZtus262bDU1tAGuXpMyuCCdoWvohtTe/pIDbgViZRonCHeOLFbQK6+5BnscMHu3 DXiZGC0Ui+AdvUFwuRUQszpoB3DeQBZf0xtLcrhgHQD8W8n2QcgRQ/DvEyexNxpDeSmr 2bFJ7yVXDB06wkHaRoSkiMCPgpWjhB9RAULARwz7DR0fyF9yMlRooo32ZMWaJMLsiM75 tJ1A== X-Gm-Message-State: AGRZ1gJ6Z11qAiZ7iryo+Ls8NS/5YMUJ1koTKc2cfx52hUmFaDi6dFEk 6BGkkSg1mIEpGq4Gnwt16LI= X-Received: by 2002:a1c:ce0e:: with SMTP id e14mr2323550wmg.53.1542720931767; Tue, 20 Nov 2018 05:35:31 -0800 (PST) Received: from [192.168.1.4] (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id 197-v6sm32710029wmh.44.2018.11.20.05.35.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 05:35:31 -0800 (PST) Subject: Re: [PATCH 1/2] spi: Add Renesas R-Car RPC SPI controller driver To: Boris Brezillon 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 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> <20181120143209.49217efb@bbrezillon> From: Marek Vasut Message-ID: <31c9518a-2088-7c3f-aec0-9e1b69b30745@gmail.com> Date: Tue, 20 Nov 2018 14:35:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20181120143209.49217efb@bbrezillon> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/20/2018 02:32 PM, Boris Brezillon wrote: > 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). I think you stated my concern right at the end, good, no need for me to add to this. Yes, I don't think any random driver should deal with peculiarities of the clock controller. -- Best regards, Marek Vasut