Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp920065imu; Thu, 13 Dec 2018 06:39:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/VMP33/wfYmFvFF2Gb6o04/Lltdcm+6bjtlFvTXUC8NFh5LseE5se7W3n6C+ibKIFN1UX88 X-Received: by 2002:a63:f34b:: with SMTP id t11mr22199501pgj.341.1544711969857; Thu, 13 Dec 2018 06:39:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544711969; cv=none; d=google.com; s=arc-20160816; b=c+wgMMyvN/VvKELjr3PGbygXO1l3cfkUBGgK1vjnm98+k+HK5tZBS5q8L+0P9jvprB mxIi9q6R+8V5BWVBKGt7CMTC07wPM9compOyu9DBvCZ2yEENJ3Qhq6l+itHh0wb9xvQX BzGcVHjNL5LQzmfKmbDzAlXIuoBOd28b3aXZcXY7T2gZLqfbD2EWKSb311rYXw1K66Si OzjNVsa+xRtAxpbvHQ94LpvNZ/JkU6x24EAKrOG1MuRzAN59zVCArZ2m/Yz8yvnzTpqe bil5mUCTgZP69e0kpFpYQ2a8p989zBB9usNvEZxpkwUWPyut2zQA86xy3g3AzmjikSrV pxoQ== 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; bh=CV/VVGgS3HMG9kwtHYSailcGxvgZ0uVBAAIkcyIKVU4=; b=CAEvi6PGs/703Vp1TTYhBSzZ9YXgbC07ClQvLtwhrmYLfkbwG6BWkORiFmXl9Frbmt RaqTTbiFIbSbDQJ9vxgrrFn7wfn8pWmtUSsQIDj0vY1FBbxytZtZUk+l3s87nHlqfDBD gUPXO8zgNBN/Lsi44slDNci0xrIxI1nIBiwb7S2MCrd0JCzP3kqVhkKPHUChmxz5P6FA q5M7GZgIR1ZJagCJT15gZYRsb067SiRA4vIgfQFudjEe38+79M6UzZgQjcjGX1W234RD 6vAoza8q6DJXANYqZamNoJwSkSuUx2L7Qy4Qf4RUctTKaESr2tl/Qa4ZBde9EtRpr27q X5rg== 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 o89si1754451pfk.223.2018.12.13.06.39.14; Thu, 13 Dec 2018 06:39:29 -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 S1728931AbeLMOhU (ORCPT + 99 others); Thu, 13 Dec 2018 09:37:20 -0500 Received: from mail-sz2.amlogic.com ([211.162.65.114]:28857 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727551AbeLMOhU (ORCPT ); Thu, 13 Dec 2018 09:37:20 -0500 Received: from [10.28.18.96] (10.28.18.96) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 13 Dec 2018 22:37:07 +0800 Subject: Re: [PATCH v2 3/3] spi: meson-axg: add a linear clock divider support To: Jerome Brunet , Neil Armstrong , Mark Brown CC: Yixun Lan , Kevin Hilman , Carlo Caione , Jianxin Pan , Xingyu Chen , , , , References: <1544690354-16409-1-git-send-email-sunny.luo@amlogic.com> <1544690354-16409-4-git-send-email-sunny.luo@amlogic.com> <3cc699dc-4021-b993-2b47-b00b40f380f8@baylibre.com> From: Sunny Luo Message-ID: Date: Thu, 13 Dec 2018 22:37:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [10.28.18.96] X-ClientProxiedBy: mail-sz2.amlogic.com (10.28.11.6) To mail-sz2.amlogic.com (10.28.11.6) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jerome, On 2018/12/13 17:28, Jerome Brunet wrote: > On Thu, 2018-12-13 at 09:55 +0100, Neil Armstrong wrote: >>> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig >>> config SPI_MESON_SPICC >>> tristate "Amlogic Meson SPICC controller" >>> - depends on ARCH_MESON || COMPILE_TEST >>> + depends on OF && COMMON_CLK && (ARCH_MESON || COMPILE_TEST) > > The purpose of this patch is clock, right ? Why does it add a dependency on OF > ? > I did it by the way. Maybe it's better to add it in patch 1. >>> +static int meson_spicc_clk_init(struct meson_spicc_device *spicc) >>> +{ >>> + struct device *dev = &spicc->pdev->dev; >>> + struct clk_fixed_factor *div0; >>> + struct clk_divider *div1; > > Could you come up with something better than div0 and div1 ? it is confusing, > especially with the comment above about div3 and 4 ... fixed_factor, div maybe > ? > Good, It is really confusing, I will change next patch. >>> + div1 = &meson_spicc_div1; >>> + div1->reg = spicc->base + (u64)div1->reg; > > So you have static data which you override here. This works only if there is a > single instance ... and does not really improve readability in your case. > > IMO, you'd be better off without the static data above. This is a terrible bug for more than one instances. I must overwrite it. >>> + if (!spicc->data->has_enhance_clk_div) { > > Do all SoC with 'has_oen' have 'has_enhance_clk_div' too ? > DO you really need two flags ? Yes, all Soc with 'has_oen' must have 'has_enhance_clk_div' too. It is distinct to use two flags here, what do you think of it? >>> + mux = &meson_spicc_sel; >>> + snprintf(name, sizeof(name), "%s#_sel", dev_name(dev)); >>> + init.name = name; >>> + init.ops = &clk_mux_ops; >>> + init.parent_names = mux_parent_names; >>> + init.num_parents = 2; >>> + init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT; > > Why CLK_SET_RATE_NO_REPARENT ? CCF should pick the parent that give the best > results, best to let it do its task ... > There are two div in AXG, one is the coarse old-div and the other is enhance-div. From SoCs designer's opinion, the ehance-div aims to take place of the old-div.