Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DA7FC433F5 for ; Mon, 25 Oct 2021 00:13:34 +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 638B260F46 for ; Mon, 25 Oct 2021 00:13:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 638B260F46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 8A3348169E; Mon, 25 Oct 2021 02:13:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="i+LsFSiX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E143815CE; Mon, 25 Oct 2021 02:13:29 +0200 (CEST) Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 80ECF82DF6 for ; Mon, 25 Oct 2021 02:13:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x829.google.com with SMTP id w2so8891312qtn.0 for ; Sun, 24 Oct 2021 17:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Wq/2QBTGwx+hSeSqfITZZ79dQUYKVQGRqyy6wyTNLTA=; b=i+LsFSiXbVAqa5VHdCR7L5fkqeAtvMk2MNdFIVAsofsJb64pEVniPOMo6wwbh4mfGb bNSgCvIQ4ujf3anKzQqgFcOxFittZwzWy7CUUovGDFjD8RqRnbfQe93YORc3z1GEj3MO j8khwQYg+xJMFZ/v0fS/78JSX4ornnVHNmw/YssGgQ3s3keLNoyoAhNnjpXJGTOn/iKe bNY37xHQSgYCdYCJDnorjRDCNhRDQX0Ur56QiycQYZ2fO1MNfGNd9pdQag/2WyVKiJo8 CdyU0D2UzQoUHTDGJUp+eqiheQxtXMi3dVu9AgQR5hx0pYlLtYcxZtTp/P7FpEbWPVl3 v2hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Wq/2QBTGwx+hSeSqfITZZ79dQUYKVQGRqyy6wyTNLTA=; b=Bk+nCE29N9TMEPdiC2RpfUwbCDu2CFpYslCi9pB9FybbUG4XkUfvs92B2uuPo5f2Mg gwA1gKJYFPGxKZl23PTdjNslOk1Auf7UnKDytL3/Dst+nrFCcQAFEbmpExqqUiyT3ZTe sz4Qi2JYMhd8YU8zgxL1fGqOm2s+16RkBD2OA4ih3SzspSnEngTA6Rq0VWI2njgUdRxt NlMlTNJ5eHAFcMY2CJxoLGoNSWu/ZrExE63wp/a233mXO3XPKOHnFUynV2okJwvPWe5r XiJvjdU0ZBYIPX3pTNmOSvlea8di0IvIskKTn35XUBfkvKlSzd1goXTE5xUkS2mwoPNu 999Q== X-Gm-Message-State: AOAM533iuZegQFpGaTmIl/SHUPCB5rIgQMhSURctWk4mS0/rOaHELW+S OsPD14iQfk89gpqeTDiSEzQX9ECItDQ= X-Google-Smtp-Source: ABdhPJyyOBj/6HfSdgdhD8RHWHJxB61ZUlKpQDkxlvOkMReXaAIjFZGuNu0+W6rsRwNsqI6dqld2cw== X-Received: by 2002:ac8:5f8d:: with SMTP id j13mr14489920qta.108.1635120803837; Sun, 24 Oct 2021 17:13:23 -0700 (PDT) Received: from [192.168.1.201] (pool-108-45-127-224.washdc.fios.verizon.net. [108.45.127.224]) by smtp.googlemail.com with ESMTPSA id w16sm6430470qtj.42.2021.10.24.17.13.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Oct 2021 17:13:23 -0700 (PDT) Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults To: Simon Glass , Peng Fan Cc: "Peng Fan (OSS)" , "lukma@denx.de" , "trini@konsulko.com" , "u-boot@lists.denx.de" References: <20211013093702.15938-1-peng.fan@oss.nxp.com> <4b931477-50d7-c307-0891-f3a85eaf56cd@gmail.com> From: Sean Anderson Message-ID: Date: Sun, 24 Oct 2021 20:13:22 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US 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 On 10/14/21 10:19 PM, Simon Glass wrote: > Hi Peng, Sean, > > On Thu, 14 Oct 2021 at 19:17, Peng Fan wrote: >> >>> Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults >>> >>> >>> On 10/13/21 5:37 AM, Peng Fan (OSS) wrote: >>>> From: Peng Fan >>>> >>>> Current code has a force clk_set_defaults in multiple stages, U-Boot >>>> reuse the same device tree and Linux Kernel device tree, but we not >>>> register all the clks as Linux Kernel, so clk_set_defaults will fail >>>> and cause the clk provider registeration fail. >>>> >>>> So introduce a new property to ignore the default settings which could >>>> be used by any node that wanna ignore default settings. >>>> >>>> Signed-off-by: Peng Fan >>>> --- >>>> doc/device-tree-bindings/device.txt | 3 +++ >>>> drivers/clk/clk-uclass.c | 3 +++ >>>> 2 files changed, 6 insertions(+) >>>> >>>> diff --git a/doc/device-tree-bindings/device.txt >>>> b/doc/device-tree-bindings/device.txt >>>> index 73ce2a3b5b..fe34ced268 100644 >>>> --- a/doc/device-tree-bindings/device.txt >>>> +++ b/doc/device-tree-bindings/device.txt >>>> @@ -28,6 +28,9 @@ the acpi,compatible property. >>>> Linux will only load the driver if the device can be detected (e.g. on >>> I2C >>>> bus). Note that this is an out-of-tree Linux feature. >>>> >>>> +Common device bindings that could be shared listed below: >>>> + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parents >>>> + and assigned-clock-rates for a device that has the property. >>>> >>>> Example >>>> ------- >>>> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index >>>> 493018b33e..6bf3179e7b 100644 >>>> --- a/drivers/clk/clk-uclass.c >>>> +++ b/drivers/clk/clk-uclass.c >>>> @@ -376,6 +376,9 @@ int clk_set_defaults(struct udevice *dev, enum >>> clk_defaults_stage stage) >>>> if (!dev_has_ofnode(dev)) >>>> return 0; >>>> >>>> + if (ofnode_get_property(dev_ofnode(dev), "u-boot,ignore-clk-defaults", >>> NULL)) >>>> + return 0; >>>> + >>>> /* >>>> * To avoid setting defaults twice, don't set them before relocation. >>>> * However, still set them for SPL. And still set them if >>>> explicitly >>>> >>> >>> Why not just have the property ignore errors? >> >> I think the force err return was done by Simon? >> >>> >>> In the long term, it may be better to standardize that e.g. ENOENT means that >>> the clock doesn't exist. That way we can skip setting the defaults. >>> ENOSYS should probably be treated the same way (warn, but don't fail). >> >> I am not sure whether people expect force error for ENOENT/ENOSYS in U-Boot. >> For i.MX, I not expect force error. > > Yes that is me, indeed. It's just that we should not silently ignore > errors. If we know the clock is optional, then the driver that knows > that can handle it. But if we start having things quietly fail, > debugging becomes a pain. Can't we have them loudly fail instead? --Sean