From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0EE8C4338F for ; Tue, 17 Aug 2021 12:50:21 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9EA06023B for ; Tue, 17 Aug 2021 12:50:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A9EA06023B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nic.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 51E0F8023C; Tue, 17 Aug 2021 14:50:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="KiKDmmZP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 63C1F82054; Tue, 17 Aug 2021 14:50:16 +0200 (CEST) Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 161F782BD6 for ; Tue, 17 Aug 2021 14:50:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from thinkpad (unknown [172.20.6.87]) by mail.nic.cz (Postfix) with ESMTPSA id 81525140878; Tue, 17 Aug 2021 14:50:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1629204611; bh=a2s2NTeh4futh5KX9WjpAQEkgG+8o0cp/Tn8PWFReks=; h=Date:From:To; b=KiKDmmZPt74FQHe5R+wsA48PWhHPGG8lN6ZZe5oVU9TFWXJ+jBz//qS/e9L7YZVyz DqCXWdCAZLGvM5DR28imz3OALWAE8kkwYDF6u7pmr7OesC3DLtojDfRJ07DEw6egbj 28pLaMFvDeJZNzavhmXpIad/xHXc9RgkKMt+2NcY= Date: Tue, 17 Aug 2021 14:50:10 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Stefan Roese Cc: Pali =?UTF-8?B?Um9ow6Fy?= , u-boot@lists.denx.de Subject: Re: [PATCH v2] arm: mvebu: a37xx: Define CONFIG_SYS_REF_CLK and use it instead of get_ref_clk() Message-ID: <20210817145010.32f295f5@thinkpad> In-Reply-To: References: <20210811185330.15414-2-pali@kernel.org> <20210816100227.24792-1-pali@kernel.org> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean > > +#elif defined(CONFIG_ARMADA_3700) > > +/* SAR values for Armada 3700 */ > > +#define MVEBU_TEST_PIN_LATCH_N MVEBU_REGISTER(0x13808) > > +#define MVEBU_XTAL_MODE_MASK BIT(9) > > +#define CONFIG_SYS_REF_CLK ((readl(MVEBU_TEST_PIN_LATCH_N) & MVEBU_XTAL_MODE_MASK) ? \ > > + 40000000 : 25000000) Stefan, we discussed this with Pali yesterday. For now, I am okay with it, but I consider this bad design. This either should be done via the clk API or, if we insist on keeping it simple, via a static inline function, with caching via a static variable, so that the register needs to be read only once (at least for each compilation unit). Regarding the clk API kernel has driver for armada-37xx-xtal. But I am thinking about expanding the clk-fixed-mmio driver so that it would be more generic and could be used for this. What do you think? Marek