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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A94C6C433F5 for ; Tue, 26 Oct 2021 01:23:47 +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 AEE1560E8C for ; Tue, 26 Oct 2021 01:23:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AEE1560E8C 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 95315807CD; Tue, 26 Oct 2021 03:23:44 +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="RlcsqYEg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 329878337C; Tue, 26 Oct 2021 03:23:43 +0200 (CEST) Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) (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 EF5D9807CD for ; Tue, 26 Oct 2021 03:23:38 +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-qv1-xf29.google.com with SMTP id d6so8468994qvb.3 for ; Mon, 25 Oct 2021 18:23:38 -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=KX0Jnj0vkB2RTB48msIJ9DjwWdapiJJGCLiyn/ocPTg=; b=RlcsqYEgH58WIF1rxUsDRBc4WA3H568dFg2X2jpzQ0XP0Lr8A5+DSw9nNKtrUjybFn mTQlen35sz6zVUQ/mKUXw7rWmT/Sm72yy5n42raYrTBMTTQnE9Z3kZH8lr6NvduvXc34 JIkQCVvXUPrF3FUR0QhJDPrlvbXl7b95LPVP0WvKFJjPjQBcVvoitDZ3GrCEujtlrlwk WMsKmkJcED4qri7VUyFVZjmnY54/pPkYkLLomAAhFSJ3m4UuLBlNYbrlSQv+fGGd2QtE nq03VZMFcf2QYg6mXpmpjUJOxXxg2kMrejdhR2ZfxXVvy9LO9U9dDxVbKeNkSx2s6mxm 5sNA== 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=KX0Jnj0vkB2RTB48msIJ9DjwWdapiJJGCLiyn/ocPTg=; b=QPRMVVKkyO44ny87Ynlpf8F62hOFv8vnp7J4ZPr3cHSU1xcCom720sPjv5uyUG23jC ppwNRCrO3c+ri0hSwHtV06KoBLeeWVjgDgw8WFEeC7a+/fbIpeW5UKUZY4b/ky/La4DL /PVed74FYFXHZI7l7RndLO4Lc/o4fPvsAaIQYiaAZAA9tkfRKqRmumDxBwbGJExGERiB OiPmWFgdKPHCRTvsiOAbPBm+e02VZXztrx5TWWMVm909bLyb22N4R32iZfO9zB9hoHjo GzYUc2i2irHmhINaYdpricqLFiAy68oXSjh5lo6R1y8dvUF5OoJls1yezcBLpnqyKSnK BrGA== X-Gm-Message-State: AOAM531fGdy8HjIi7oLyH7L2PU7xHpG2o0IFUSyWapDRY1gx5zlivNRk JdmorZw/RbjF1XNcA9i9j5M8HQnRkyg= X-Google-Smtp-Source: ABdhPJw9rjEaLdoK4b2tB0efkzdjSsluRANBTtuqSRzrTWozV8e6JlvTsCYJ5v3L2wzfdFT/XpG+2Q== X-Received: by 2002:ad4:5f48:: with SMTP id p8mr19398354qvg.39.1635211417264; Mon, 25 Oct 2021 18:23:37 -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 j14sm8968530qtq.36.2021.10.25.18.23.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Oct 2021 18:23:36 -0700 (PDT) Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults To: Simon Glass Cc: Peng Fan , "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: <126ed56e-58c2-e80c-95d9-17874ca254c3@gmail.com> Date: Mon, 25 Oct 2021 21:23:36 -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/25/21 11:18 AM, Simon Glass wrote: > Hi Sean, > > On Sun, 24 Oct 2021 at 18:13, Sean Anderson wrote: >> >> 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? >> > > That is how it works today, as I understand it. But some boards want > the defaults to be there but not to implement them in U-Boot. This > seems fair enough to me. Perhaps we could add something to each node > instead, to disable it? u-boot,assigned-clock-status = "disabled"; ? --Sean