Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5595531rwb; Tue, 22 Nov 2022 02:08:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7qOhv5OKyARcVYhQbOLYdYjM5De6iICwjd/HxvF5cK8ZEAJDrGuG4ajtHd//7tFg0VPrDW X-Received: by 2002:aa7:d816:0:b0:458:4868:814 with SMTP id v22-20020aa7d816000000b0045848680814mr20619626edq.190.1669111693464; Tue, 22 Nov 2022 02:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669111693; cv=none; d=google.com; s=arc-20160816; b=HB+aFQSPSnCR8e+ybovElSh8e3H2+8W752XX3S8ylvPsWguFeRf5akO4+7Wv96wWJE YXUa4psLGI9u3NdB2xDWNXo7wOQItmUiQj/EmPVbNUEqMs1ECeRDFFTT6jpSST65Ye00 FHHJxhc/aZ8ZZIaf+yBSDw9162EpYwE3ld/MIzikjePstrgU1w4MSAmGIpEOG7Rpje5p 21P0KT4fknG2jyktWLkfuN71oLX4I53x5gQwGcZ6dbHuqVe/ZfxezWubp+BYt2WzYfns ds7yab3kCCNTE0HZEO0cdIzi2HP4fbTSNsM9r91sf9JosrmyKpBgPzOKg1vQ8dyjEEuA jtcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=w7GGsdQ+7EVwz1XvGhev+Xy4/In4783cOO3O+rmimJY=; b=roNx7FIcmlFGfi8G7zrvE4CGjtkB2O04DShSGTRwq24kcUAHx3JEfplZdj+mA3j8Ty QHCYFOCX4U6fKuDwUcKtuwgEhiRnv36I16M9ZTmKwrImxtrM6CgNMrISMQNCVKTuqUYK VSqxgsn6m07UCd10ByykgNxJZdp+k0UcH/SHSC7pJWnGN36vvLxTBjhAXYoDrqL8BU/Z sOh3eI1T+uWO+znWJdMg1Fy+KQfO093HI8uw/A2dF/Vtsf+o1a+PizqwUdxXLUnEqCLM VWE80oALZBhfnI2nqqNiL0QvpZQpjwp/cno4TF2RvbKFq0IsytJnbiStMy3Y9WxFaopv 94lA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa31-20020a1709076d1f00b0078dfe6dc4d2si9242741ejc.33.2022.11.22.02.07.31; Tue, 22 Nov 2022 02:08:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232557AbiKVJCL (ORCPT + 91 others); Tue, 22 Nov 2022 04:02:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232416AbiKVJCI (ORCPT ); Tue, 22 Nov 2022 04:02:08 -0500 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72139A456; Tue, 22 Nov 2022 01:02:07 -0800 (PST) Received: by mail-qk1-f177.google.com with SMTP id x21so9821944qkj.0; Tue, 22 Nov 2022 01:02:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w7GGsdQ+7EVwz1XvGhev+Xy4/In4783cOO3O+rmimJY=; b=MdaAMO5X4rrnfLSxECbaK5/Tz4R6kQtgy96f17JCBj32vru0LwpjuyLSPKXLJLNZoD IlUbFKKo6SNagxau6QOrEKNnTzf26DFzUawil/83nvC7xyqQ3HjURYoXOttihQMhozBq eKLH/OqyUj4yKbzFhnsAbr2Dy2hHJvr6KmMdP2aHqZVqrzj+sTO7geEiKa2+cFr5BgZz UhBWeoRIz6qDl+yJOvaRGZfpNxhkyif3MFCp/eGx31XYmS4Ic4MzsW52OFHcfLKLQ70E px7h8eplLERYqmE+gcM83G5YdWiTTTDvH3VMIv5TvRFbSDCn8aGlnKqfNtymB6etw4cs frJQ== X-Gm-Message-State: ANoB5pmII+up+yl+3haixLt9mTZUCG8Mh5Kiek1QV6eeHmIHEGqt8ExI EpVYGmJgwlf2AnYUXkuMYxv+qZyJM0XW3g== X-Received: by 2002:a05:620a:14a4:b0:6fa:2f16:88d1 with SMTP id x4-20020a05620a14a400b006fa2f1688d1mr3671549qkj.462.1669107726314; Tue, 22 Nov 2022 01:02:06 -0800 (PST) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com. [209.85.219.175]) by smtp.gmail.com with ESMTPSA id q46-20020a05620a2a6e00b006fbcab95d70sm9279160qkp.101.2022.11.22.01.02.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Nov 2022 01:02:05 -0800 (PST) Received: by mail-yb1-f175.google.com with SMTP id v184so1202815ybv.6; Tue, 22 Nov 2022 01:02:05 -0800 (PST) X-Received: by 2002:a25:9e84:0:b0:6de:6183:c5c3 with SMTP id p4-20020a259e84000000b006de6183c5c3mr3143112ybq.89.1669107725187; Tue, 22 Nov 2022 01:02:05 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <191a7f3e-0733-8058-5829-fe170a06dd5a@linaro.org> From: Geert Uytterhoeven Date: Tue, 22 Nov 2022 10:01:53 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/7] dt-bindings: clock: renesas,r9a06g032-sysctrl: Add h2mode property To: Krzysztof Kozlowski Cc: Herve Codina , 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Hi Krzysztof, On Tue, Nov 22, 2022 at 9:42 AM Krzysztof Kozlowski wrote: > On 22/11/2022 09:25, Geert Uytterhoeven wrote: > > 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? Exactly. > 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? Enabling the clocks does not have anything to do with this ordering. Clock consumers that are part of the clock domain are probed after clock providers. If the clock is missing, that would be an incorrect description in DTS. > Broken dependency. What if you want to use this in a different SoC, > where the sysctrl does not provide clocks? Broken dependency. This is the "renesas,r9a06g032-sysctrl" DT bindings document. It talks about this SoC implementation specifically. This is not a random synthesizable IP Core that can appear anywhere. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds