Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3711377imm; Mon, 30 Jul 2018 01:58:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcYsYS98Mf+fJDUfGT2HMRaEmb6p+TzeMKAw/vi1uPA7wDNNrtmWZoZ3ECtU3IBiFb1VDQ/ X-Received: by 2002:a17:902:e3:: with SMTP id a90-v6mr15916134pla.227.1532941122885; Mon, 30 Jul 2018 01:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532941122; cv=none; d=google.com; s=arc-20160816; b=Qwdy7fNMXz85EHBHXoyGlgU7rdV/KqA2XGybQybeiSYsY/RA0Y27ziexse07YNVxai NP+n/E4YBmNYMcrtWCBsMicR7wDux0+H16rkELG78j4yl01eyzcQu5XixgQHO79C6wp9 1iRJ3q9YKjIofYbjvq6NgJ6UXqWH4KMGT7dE2UvFsL/88CDhrC/UG8Izbytkf/ovXjp7 oaTJ7DzF1BR5YBvjGqmyR6fvZVuQUeC+t5tAiTbeJMXShelTp5AU0y/U/jEpXpImHtQa wAzZuo0tF3+duGJhGXkHmpRCLrbsVYy9kZYH0kc3hX+DwF8Do3Ios1YShTBs10YxHwx/ 8ubg== 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:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=X5KJ/aAr7CPxobSoh4m3nwI9irEo3EPh75UQqwwcRZ0=; b=qk2YSp6dXlpspnFXzEttQqZHt+v/eKNI8Awdoq0gbBgNZO7Vz38flJI+f4g+D7LD6i YjrACkUtd2hkaD+vALe879FDP/lpllsaiMx1z38FMzrAkWdXEELZXc2lJVvxiEwP84yf XJ97XpYiCtvhk5E8hExM2X2Knja0RscXVFMY+FmO8HX0kzFCe8zW01dQG71Lp7SGkGEi mEf+IP2VPGVL0xXn7mozFfBkMCqqjk3b/xgz4fK+RCnWWFdOPNwcxlWa0uYzDmQ1Ysqb SzUVkitVOD+T0gWrQkdYWUz+yYE6Gqg2lD4d3GbkxLZ+IYN0XdljNGuGPi2ezaZzkJxD EUyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=OIwR42BH; 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 f89-v6si2739962plf.20.2018.07.30.01.58.28; Mon, 30 Jul 2018 01:58:42 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=OIwR42BH; 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 S1726760AbeG3Kb3 (ORCPT + 99 others); Mon, 30 Jul 2018 06:31:29 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33831 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726620AbeG3Kb3 (ORCPT ); Mon, 30 Jul 2018 06:31:29 -0400 Received: by mail-wr1-f68.google.com with SMTP id c13-v6so11945941wrt.1 for ; Mon, 30 Jul 2018 01:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=X5KJ/aAr7CPxobSoh4m3nwI9irEo3EPh75UQqwwcRZ0=; b=OIwR42BHKfC6ukVke7Vb3Pb0oc1EHQAWEKUUjF0+7TkuXpg5FgwxBDcFqL/2BHSwix yFfsA3QoVLb65dy7Bkk3Hv5YDlfwm2r1Meq2YmrPbaF/wWSc1gPhYy9ylPQDJHHM3WhA 1XD3gmCm3UJlcGgnIdZM1OTw7BHaaU1TWvlL9AY5eHVYAAqvfAG57p6Ejv+PHi9gB+kh /uFmLVtY1b2A8kp3JFxXQscjmi7ZnQaObDy9ibhGnEl7+pGIYPNRUBBny+5rJsSo+4O1 Ry8FLhvhy0Z65DFiHB2h0AvYbimRHHpCvXHi4Tob+F4j1IHrNLvEhR5FXyCW9sKx9F9P EtTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=X5KJ/aAr7CPxobSoh4m3nwI9irEo3EPh75UQqwwcRZ0=; b=RrHKcT9VORpPOhnVR+VpaqrlpmeJO51Bjef9ELeOPEqv6SZU9czeqeoZezFZ+uY4E9 HjkCp2thRjcWqNzVv4P3i05op454GtqYHwcgRdeWoX0lqDVpJ8YEDdx7ahIAHyZn/ENR H+Kpk3ilOe7TqSFTuaObjVUJTceOxQwv9c+HppuIiY5AWn/PMl1KRk7hDzbhy4Qb4/iS SYn5bhoGWkBCKzkPd6Xn9aeUPwQTMYNuoSuWjdq09e43nKAunIRHNCwE3eVpyIf7YB19 rpGosCCAZhC9+GpHVoLqXd7dlBSyrO+RNKYIju7bXvFt9LRZEgR5cKar80Exe8GUAALl 7HzQ== X-Gm-Message-State: AOUpUlFbASx+YXJFCAcC+cZ16T1mGCNs1CZdIjhKV/J2Gf0mRexx5Fab NIc+Ch3dLK/bQWST+LZ35U0L1w== X-Received: by 2002:adf:bacf:: with SMTP id w15-v6mr17275740wrg.203.1532941049017; Mon, 30 Jul 2018 01:57:29 -0700 (PDT) Received: from boomer (uluru.liltaz.com. [163.172.81.188]) by smtp.gmail.com with ESMTPSA id r12-v6sm7561237wmh.0.2018.07.30.01.57.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 01:57:28 -0700 (PDT) Message-ID: Subject: Re: [PATCH v3 2/2] clk: meson: add sub MMC clock controller driver From: Jerome Brunet To: Stephen Boyd , Neil Armstrong , Yixun Lan Cc: Rob Herring , Martin Blumenstingl , Kevin Hilman , Michael Turquette , linux-kernel@vger.kernel.org, Boris Brezillon , Liang Yang , Qiufang Dai , Miquel Raynal , Carlo Caione , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jian Hu Date: Mon, 30 Jul 2018 10:57:26 +0200 In-Reply-To: <153270995155.48062.4302847978258086624@swboyd.mtv.corp.google.com> References: <20180712211244.11428-1-yixun.lan@amlogic.com> <20180712211244.11428-3-yixun.lan@amlogic.com> <153261840298.48062.2497103873681297587@swboyd.mtv.corp.google.com> <153270970080.48062.18399022907046343950@swboyd.mtv.corp.google.com> <153270995155.48062.4302847978258086624@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.4 (3.28.4-1.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-27 at 09:45 -0700, Stephen Boyd wrote: > Quoting Stephen Boyd (2018-07-27 09:41:40) > > Quoting Yixun Lan (2018-07-27 07:52:23) > > > HI Stephen: > > > > > > On 07/26/2018 11:20 PM, Stephen Boyd wrote: > > > > Quoting Yixun Lan (2018-07-12 14:12:44) > > > > > diff --git a/drivers/clk/meson/mmc-clkc.c b/drivers/clk/meson/mmc-clkc.c > > > > > new file mode 100644 > > > > > index 000000000000..36c4c7cd69a6 > > > > > --- /dev/null > > > > > +++ b/drivers/clk/meson/mmc-clkc.c > > > > > @@ -0,0 +1,367 @@ > > > > > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) > > > > > +/* > > > > > + * Amlogic Meson MMC Sub Clock Controller Driver > > > > > + * > > > > > + * Copyright (c) 2017 Baylibre SAS. > > > > > + * Author: Jerome Brunet > > > > > + * > > > > > + * Copyright (c) 2018 Amlogic, inc. > > > > > + * Author: Yixun Lan > > > > > + */ > > > > > + > > > > > +#include > > > > > > > > Is this include used? > > > > > > > > > > this is needed by clk_get_rate() > > > see drivers/clk/meson/mmc-clkc.c:204 > > > > Hmm ok. That's unfortunate. > > You should be able to read the hardware to figure out the clk frequency? > This may be a sign that the phase clk_ops are bad and should be passing > in the frequency of the parent clk to the op so that phase can be > calculated. Jerome? > It could be a away to do it but: a) if we modify the API, we would need to update every clock driver using it. There is not that many users of the phase API but still, it is annoying b) This particular driver need the parent rate, other might need something else I guess. (parent phase ??, duty cycle ??) I think the real problem here it that you are using the consumer API. You should be using the provider API like clk_hw_get_rate. Look at the clk-divider.c which use clk_hw_round_rate() on the parent clock. Clock drivers should deal with 'struct clk_hw', not 'struct clk'. I think it was mentioned in the past that the 'clk' within 'struct clk_hw' might be removed someday. Yixun, please don't put your clock driver within the controller driver. Please implement your 'phase-delay' clock in its own file and export the ops, like every other clock in the amlogic directory. Also, please review your list of '#define', some of them are unnecessary copy/paste from the MMC driver. Regards Jerome