Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5714835rwb; Tue, 22 Nov 2022 04:05:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf4d3rkC4Z5cFNOsfucXHE0zVhBHUVOooCeEeF6BvsIzFELS70zgGHMED5IojP2sfK3zLlTX X-Received: by 2002:a63:1151:0:b0:438:a750:99b7 with SMTP id 17-20020a631151000000b00438a75099b7mr3256160pgr.605.1669118718932; Tue, 22 Nov 2022 04:05:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669118718; cv=none; d=google.com; s=arc-20160816; b=xWzlmj3CxuQ6yQgHbR6eG5NdZQspqTuITR2QIal7gbQ3D7OCmC59j2fIgqn8/+R59x ytQOr08tyWbxtRJqZ6iypayMsgKcSdS48/vZnK6rtLeWH9WDfDa3dqHxwbXTBSJAx/Mo ceGQ+gjb2rk+fYc8+eM+PniU566HadxwP7ored8TqOZsfa7EUS0EdVUrqo3I7B/gugmO UH/oe5w4h2HIbsInxB5FMHPIwz+5tLK+gldRNLPDOh6zKHGogLrOpB8GrRZ5ni4oTXED k5ywBySSZ9AzrgaII40+ShAf211MJud+4IvH1QDOwrqAcyQYEJD6xo4H0foCzbkUIq6z u/Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Y0ITFibk1D5kN6pD+TuW/Zc9FBNNeG7KecXWMUXzLtY=; b=jm5m+C/LG5ZfNNzlSDp4M0SEMSxVE3OQ74opKCRkiazDYuUiEWNZGBAjGK3vKzHCU2 c7Hiswyx3a6i0gkekehIpdhdeo7dcx6SssitYr32Q0FgWtu4WI+UdqWBDty8UO9iDnAX MU7+Ulcf22+i0UDp+DRAOH3DexUcN9sGXJ4ZOAblNH7FoOd9c2FviVbtyY5laJD185Ts vweQabbkNA0XMZIxhGfub4z4OBr6lj3rEYZ3KOzr/fPx9rzS6r5cf9+WtcykW+3eZ+QE cmI/2ecd7clPin+wxTbZgwHcgLBeb4M2fUxIBEwLzNEOncJwTFNqJOnxMp2KtPmqN4I6 Rg2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tv6UFU9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a170902ce9100b001783ba6f79dsi647268plg.494.2022.11.22.04.05.06; Tue, 22 Nov 2022 04:05:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tv6UFU9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233598AbiKVKfB (ORCPT + 91 others); Tue, 22 Nov 2022 05:35:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233530AbiKVKeE (ORCPT ); Tue, 22 Nov 2022 05:34:04 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E1F05F4F for ; Tue, 22 Nov 2022 02:30:52 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id u2so17464720ljl.3 for ; Tue, 22 Nov 2022 02:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Y0ITFibk1D5kN6pD+TuW/Zc9FBNNeG7KecXWMUXzLtY=; b=Tv6UFU9BtdA2bzA1xaIgMpHGf+KWGuuoNEQiGhuaAoUtRWfOmM7z4L50kA2gT1LB/f 7LLu51ykx5KWyMi+gXzLv3fe+HdFHwYjALXRn+ajgknC1Xgfw6nw4knYSOymopZjnXL2 8yOTgrFLCC5IdSUtOQYe6yfvcJtL/mjO92VJUAKf+T11TqJb0Tg138Kk3a7iQbskwS6i VghECyydrPro+UPt4Kzot59fv/G/SYe21XwZ7lGQVH7MI02hM0heLwU8fdIxSSQaztBG 2n6FjbjcLkcVzF1kMY5NFzUAz+vOZnZ6Nt1WatOZ7lU2mWQUAME9Bn64QOkBTNLMDi6r ds/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y0ITFibk1D5kN6pD+TuW/Zc9FBNNeG7KecXWMUXzLtY=; b=3XL8voI/GOW3Alwmc4UgPGwu1Zta78Xz3hVSwmC9BnBav6S+aruo53igGj8heGhIJJ nOzNklRFnhI5ZZZaOVJ8RGxcKCfjUMYOUgPOm/WZisJ4hQYixguexk+JqxROuN9v114z p/DwfFsy8CGCapLCugw+1f/IGbMXE+/eMomZNnoC0+VHhAgZ601kodLGclkR4amCQntI iq9UruIz9xbXp31rEtKuCbSfwBjpO8bmcc64gEaj/prnpfUrAS184m5m4E0VZIKjMZvW Xr5ObVZ6X40AoHSXncLeqUnIGZtKH9Ilu9n2Typn0bsgFUbPH0FdiDhM9EF/kugf/uQd jQGA== X-Gm-Message-State: ANoB5pl/m+Kt+KbCjId6D4X6UtpFjrta6iTy7fOdVuOnGjDb6WvfRKV2 IQbWjRH+iv6G6sjlmohV53jckA== X-Received: by 2002:a2e:a4b4:0:b0:26c:5cf3:cc89 with SMTP id g20-20020a2ea4b4000000b0026c5cf3cc89mr7390586ljm.483.1669113050432; Tue, 22 Nov 2022 02:30:50 -0800 (PST) Received: from [192.168.0.20] (088156142067.dynamic-2-waw-k-3-2-0.vectranet.pl. [88.156.142.67]) by smtp.gmail.com with ESMTPSA id g23-20020a2ea4b7000000b0026dce0a5ca9sm1803692ljm.70.2022.11.22.02.30.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Nov 2022 02:30:49 -0800 (PST) Message-ID: <3856e2d8-1c16-a69f-4ac5-34b8e7f18c2b@linaro.org> Date: Tue, 22 Nov 2022 11:30:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 2/7] dt-bindings: clock: renesas,r9a06g032-sysctrl: Add h2mode property Content-Language: en-US To: Herve Codina Cc: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Greg Kroah-Hartman , Magnus Damm , Gareth Williams , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Thomas Petazzoni , Miquel Raynal References: <20221114111513.1436165-1-herve.codina@bootlin.com> <20221114111513.1436165-3-herve.codina@bootlin.com> <20221115150417.513955a7@bootlin.com> <20221118112349.7f09eefb@bootlin.com> <20221121165921.559d6538@bootlin.com> <4e54bfb4-bb67-73b8-f58f-56797c5925d3@linaro.org> <1f12883b-1e37-7f2b-f9e9-c8bad290a133@linaro.org> <191a7f3e-0733-8058-5829-fe170a06dd5a@linaro.org> <20221122100706.739cec4d@bootlin.com> From: Krzysztof Kozlowski In-Reply-To: <20221122100706.739cec4d@bootlin.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/11/2022 10:07, Herve Codina wrote: > On Tue, 22 Nov 2022 09:42:48 +0100 > Krzysztof Kozlowski wrote: > >> On 22/11/2022 09:25, Geert Uytterhoeven wrote: >>> Hi Krzysztof, >>> >>> On Tue, Nov 22, 2022 at 8:45 AM Krzysztof Kozlowski >>> wrote: >>>> On 21/11/2022 21:46, Geert Uytterhoeven wrote: >>>>>> This does not change anything. Herve wrote: >>>>>> >>>>>>> probe some devices (USB host and probably others) >>>>>> >>>>>> Why some can be probed earlier and some not, if there are no >>>>>> dependencies? If there are dependencies, it's the same case with sysctrl >>>>>> touching the register bit and the USB controller touching it (as well >>>>>> via syscon, but that's obvious, I assume). >>>>>> >>>>>> Where is the synchronization problem? >>>>> >>>>> The h2mode bit (and probably a few other controls we haven't figured out >>>>> yet) in the sysctrl must be set before any of the USB devices is active. >>>>> Hence it's safest for the sysctrl to do this before any of the USB drivers >>>>> probes. >>>> >>>> Again, this does not differ from many, many of other devices. All of >>>> them must set something in system controller block, before they start >>>> operating (or at specific time). It's exactly the same everywhere. >>> >>> The issue here is that there are two _different drivers_ (USB host >>> and device). When both are modular, and the driver that depends on the >>> sysctrl setting is loaded second, you have a problem: the sysctrl change >>> must not be done when the first driver is already using the hardware. >>> >>> Hence the sysctrl driver should take care of it itself during early >>> initialization (it's the main clock controller, so it's a dependency >>> for all other I/O device drivers). >> >> I assumed you have there bit for the first device (which can switch >> between USB host and USB device) to choose appropriate mode. The >> bindings also expressed this - "the USBs are". Never said anything about >> dependency between these USBs. >> >> Are you saying that the mode for first device cannot be changed once the >> second device (which is only host) is started? IOW, the mode setup must >> happen before any of these devices are started? >> >> Anyway with sysctrl approach you will have dependency and you cannot >> rely on clock provider-consumer relationship to order that dependency. >> What if you make all clocks on and do not take any clocks in USB device? >> Broken dependency. What if you want to use this in a different SoC, >> where the sysctrl does not provide clocks? Broken dependency. > > The issue is really related to the Renesas sysctrl itself and not related > to the USB drivers themselves. > From the drivers themselves, the issue is not seen (I mean the driver > takes no specific action related to this issue). > If we change the SOC, the issue will probably not exist anymore. > Yeah, and in the next SoC you will bring 10 of such properties to sysctrl arguing that if one was approved, 10 is also fine. Somehow people on the lists like to use that argument - I saw it somewhere, so I am allowed to do here the same. I understand that the registers responsible for configuration are in sysctrl block, but it does not mean that it should be described as part of sysctrl Devicetree node. If there was no synchronization problem, this would be regular example of register in syscon which is handled (toggled) by the device (so USB device/host controller). Since there is synchronization problem, you argue that it is correct representation of hardware. No, it is not, because logically in DT you do not describe mode or existence of other devices in some other node and it still does not describe this ordering. Best regards, Krzysztof