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 36AA5C433F5 for ; Tue, 26 Oct 2021 02:00:01 +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 3C2A660EC0 for ; Tue, 26 Oct 2021 02:00:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3C2A660EC0 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 BA27B80F0E; Tue, 26 Oct 2021 03:59:57 +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="Og+PoNY6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 84111807D5; Tue, 26 Oct 2021 03:59:55 +0200 (CEST) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (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 769A680F1A for ; Tue, 26 Oct 2021 03:59:51 +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-qk1-x735.google.com with SMTP id j12so13767725qkk.5 for ; Mon, 25 Oct 2021 18:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uiSOBp2+MccV0ZSKUag7QVF/JiZNqlyDZmbp3a7qGYc=; b=Og+PoNY6YQkCigqgnj4G7EUZuwKbCCL34qpGzAOiVW1CCmdYUlRZYLMLzCtO8DZO1L CHJVnfL49j7204sK2zEKyENtD/fjjsntSnXdcr3LmrpLP44aXIVQtWAT1N4BOo3MGsm5 Ew9CNjt/S82uqpo8/N1HIsS4kl2EFWWVjg+GTsPSXWGMYM0H3IrI+cC15tfLZPi3zcS2 BMcF6F8Hrf3xLY09IF2hIKO8CCDlBFmwzLy1qRC0XJGvtVHqPUxSqJkw96JnIXFNGNsa LHYefbpRJpip5WA3hHt7Js341vipsOaMUEstCQSX3HTXzq7n4jnF1q/zxBpFvTqaz92/ GhDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uiSOBp2+MccV0ZSKUag7QVF/JiZNqlyDZmbp3a7qGYc=; b=0qXu0wk09BNGNK4TKb8M5zet59yb4Qs4MieHrbWFkWhP68cXF+CHEnNuS0glEf7ZT9 Xm5YC1hbwGoq7eed4NmQ+feuQ4M/guAW1uNe+QjVyCJnZI5BhxeSvUGlt+N31S8uEbWV g6gsECIH5XoVutqMtDvQYrvPq2J/RM4DnxCNgKFDALlPAGiWvJ99JXNyqAJoIUUOtb/L XVQ1sWZmDXZlHDLS0C+VFtjjMSKgL+ZXivkLN6EQU7kqdqBqJ6iHZ2PC93j6ePl6WzRc Cdwk3iHRfAAfhdpgH+dAIa0xT8rWQxyvC4VDHilXATKtQRp1i66hzehrU7CFsiO/T3Oh 52EA== X-Gm-Message-State: AOAM533JgoGL7IlvP8ZFuaCysSBEq87PsSC9qS8RZ1749Ey1ailWNjdR guaOVbPtwGTno+GgXYSaQkTB8u8rZX8= X-Google-Smtp-Source: ABdhPJxWPLhniXEWnKVMa+TlWXxktHpfmV1NBPm3Kqwms/AQ4XZueHNBCZX8cAz3aV8JdNLYYgXkZw== X-Received: by 2002:a37:65d0:: with SMTP id z199mr16693064qkb.484.1635213589702; Mon, 25 Oct 2021 18:59:49 -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 y7sm10058046qtj.39.2021.10.25.18.59.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Oct 2021 18:59:49 -0700 (PDT) Subject: Re: [PATCH] clk: introduce u-boot,ignore-clk-defaults From: Sean Anderson 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> <126ed56e-58c2-e80c-95d9-17874ca254c3@gmail.com> Message-ID: <57a7e4eb-4c81-d15e-3211-6f35fc2ee19e@gmail.com> Date: Mon, 25 Oct 2021 21:59:48 -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: <126ed56e-58c2-e80c-95d9-17874ca254c3@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 9:23 PM, Sean Anderson wrote: > 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-B= oot >>>>>>> reuse the same device tree and Linux Kernel device tree, but we n= ot >>>>>>> register all the clks as Linux Kernel, so clk_set_defaults will f= ail >>>>>>> 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 >>>>>>> --- >>>>>>> =C2=A0=C2=A0=C2=A0 doc/device-tree-bindings/device.txt | 3 +++ >>>>>>> =C2=A0=C2=A0=C2=A0 drivers/clk/clk-uclass.c=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 3 +++ >>>>>>> =C2=A0=C2=A0=C2=A0 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. >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Linux will only load t= he driver if the device can be detected (e.g. on >>>>>> I2C >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus). Note that this i= s an out-of-tree Linux feature. >>>>>>> >>>>>>> +Common device bindings that could be shared listed below: >>>>>>> + - u-boot,ignore-clk-defaults : ignore the assigned-clock-parent= s >>>>>>> +=C2=A0=C2=A0 and assigned-clock-rates for a device that has the = property. >>>>>>> >>>>>>> =C2=A0=C2=A0=C2=A0 Example >>>>>>> =C2=A0=C2=A0=C2=A0 ------- >>>>>>> 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, enu= m >>>>>> clk_defaults_stage stage) >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!dev_has_ofnode(dev)) >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 return 0; >>>>>>> >>>>>>> +=C2=A0=C2=A0 if (ofnode_get_property(dev_ofnode(dev), "u-boot,ig= nore-clk-defaults", >>>>>> NULL)) >>>>>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ret= urn 0; >>>>>>> + >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * To avoid setting defaults = twice, don't set them before relocation. >>>>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * However, still set them fo= r 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= =2E >>>>>> ENOSYS should probably be treated the same way (warn, but don't fa= il). >>>>> >>>>> I am not sure whether people expect force error for ENOENT/ENOSYS i= n 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? >=20 > u-boot,assigned-clock-status =3D "disabled"; Actually, I think that was Peng's idea in the first place :) --Sean