Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1934570ybl; Thu, 29 Aug 2019 00:47:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzqOefo6oaaqtQ+oxMMXOLUlgE+VIihxB+vxSAEKWOfpmyOyfsHBBGQkbjsj1076XgFI1K X-Received: by 2002:a62:6045:: with SMTP id u66mr9379791pfb.261.1567064864455; Thu, 29 Aug 2019 00:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567064864; cv=none; d=google.com; s=arc-20160816; b=0auFnw+/EBBLBjMH8j8EBWXiueBFxDwwSkH3ZPsLlBR51dqKtUZTwRgxG28veehzHu L+0uvu8Q21y4kz0B73F1tvb8Jo3OKfETAypzEgfUlNWWC6AdUv7BYKujRG58SO9sL9Kq LweHTGWbnosZM2F6b0XkOoy7iDrtCewygxwG5zaXCjm5ZuNnT/pA5hH1EzzJpW64Y4yt 5L6p82Ryj3pZTaoBz07khAZG8A56DMj5Y+8trnLVXpuMRpT+RO6p35tnkeB5ate6YGBW Cz1H5qTBjxAN5envymeBm7pfc3t/vsBCEGs849GYkPimxZFmfIR0/ZR063Lijif2RtJc VZ8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=1wMjA5KSksLju2OI40VA1ZBlTUCnvvzsw6vzsXA8A9k=; b=tL7TEdBRqRXyuRamkjIcPDQ3Qud+1sMISUoixpu/pb10PJOBcateFlh02+1TsFRVxZ wiemWTa0b1SXEqVrm62lozSDqj3wS9itrUPc79O2W5TOsx7YpVTbRJRNWVso05eNDjNU 8Us/rilg1uLzO7JwvcXYvjFCVy7WVj+3L8FhwY307yMdpp/Bsicas2wZKoilCwTGYNEO rmsCjVOJr5NTVrpYjaRG6FNd2kC7FXlmclZCH38PP4G7sK1FPqZOevjWVSP0QSIfSRk8 0g/0xOjH57tJJiId4yiaVXY3gDajUOF8AUGFWsFH5XbjaxvFIN4IHzGqgzDdMFAOcicc tSPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tRP+YIfj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si1297933pgh.35.2019.08.29.00.47.29; Thu, 29 Aug 2019 00:47:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tRP+YIfj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbfH2Hqb (ORCPT + 99 others); Thu, 29 Aug 2019 03:46:31 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:39427 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbfH2Hq2 (ORCPT ); Thu, 29 Aug 2019 03:46:28 -0400 Received: by mail-pf1-f202.google.com with SMTP id n186so1853727pfn.6 for ; Thu, 29 Aug 2019 00:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=1wMjA5KSksLju2OI40VA1ZBlTUCnvvzsw6vzsXA8A9k=; b=tRP+YIfjsrAJxEUSVJpaCYb5qWQcnh7XHYJB/HsE8MfRkD1HhWBCqOjh1oLgQHnXfQ ey0UDHnkvETAbWD3LCQWBWCncLfEco0qlLBMe+MplhEyWNLAZz062F4YLh5GMfL51Lp1 ULAGvPsIuBaEvvnCcIdgffyYjI1vPgjbSpGdD86MwCmpADhnqwz1vZom/N8ROuD1DXLC 7QAzj0NFvRqHeHpuJoZwkWTESzRnpmkabkxS1E7W7+jxDLcxGbYh2ufppQTWstSrJPLp PQeicPm5eSszkSyeFuyjm4ry6ZLHknPP6Weqd3oR84pWtMAbS9VveRLLwIhn3yWXSVr7 s3qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=1wMjA5KSksLju2OI40VA1ZBlTUCnvvzsw6vzsXA8A9k=; b=rdBfTzwWVz73BbqtQOVHCGaIDhKuYhmbcnlVkMEeePkVR3EpnZg/ccLwgxLAhQGyP4 QKo7x5j8PES9QBj5L3YKJJAXQQYSWliKYHZJSaW8Of512eih2eh3grVVahS0rgxecfa7 uh0JG7nsmDk7FVYLJJcgQaM1GHMWkF/9N/euW0Vbiz0WrdSYQ5X2zJDo2lAUZaS9KCt1 z5A3iyjAQSV75B3aQsAETZMJ8jn8aeatA23Ke5Qml185V5HcPLdqNzpqAmcvbRhFtAUp 1/vO536zuywgAeZ4LxvjdlYjnxtoVaijuhJaUleRzOMwFGaQMHE//mjJRAKdfx/JCP/T rgEw== X-Gm-Message-State: APjAAAUa+cJoklhWmx4LF94vTRLRynHkkR9Z4NdjN6UhhzPzNgfAyQig mu9IKJyWoNK1pRMpbeHdtJ/oqtu9PyP2BwQ= X-Received: by 2002:a63:e948:: with SMTP id q8mr6861702pgj.93.1567064787979; Thu, 29 Aug 2019 00:46:27 -0700 (PDT) Date: Thu, 29 Aug 2019 00:46:02 -0700 In-Reply-To: <20190829074603.70424-1-saravanak@google.com> Message-Id: <20190829074603.70424-7-saravanak@google.com> Mime-Version: 1.0 References: <20190829074603.70424-1-saravanak@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v10 6/7] dt-bindings: Add depends-on property to break cyclic inferred dependencies From: Saravana Kannan To: Rob Herring , Mark Rutland , Greg Kroah-Hartman , "Rafael J. Wysocki" , Frank Rowand , Jonathan Corbet , Len Brown Cc: Saravana Kannan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-acpi@vger.kernel.org, clang-built-linux@googlegroups.com, David Collins , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The functional dependencies of a device can be inferred by looking at the common devicetree bindings like clocks, interconnects and regulators. However, this can sometimes result in cyclic dependencies where one of the inferred dependencies isn't really a functional dependency. Add a depends-on property that can override inferred dependencies by explicitly listing the suppliers of a device and thereby allow breaking any cyclic inferred depenencies. Signed-off-by: Saravana Kannan --- .../devicetree/bindings/depends-on.txt | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/depends-on.txt diff --git a/Documentation/devicetree/bindings/depends-on.txt b/Documentation/devicetree/bindings/depends-on.txt new file mode 100644 index 000000000000..e6535917b189 --- /dev/null +++ b/Documentation/devicetree/bindings/depends-on.txt @@ -0,0 +1,46 @@ +Explicit listing of dependencies +================================ + +Apart from parent-child relationships, devices (consumers) often have +functional dependencies on other devices (suppliers). Examples of common +suppliers are clocks, interconnects and regulators. + +The consumer-supplier dependencies of most devices can be inferred by +simply looking at the devicetree bindings of common suppliers like clocks, +interconnects and regulators. However, this can sometimes result in cyclic +dependencies where one of the inferred dependencies isn't really a +functional dependency. + +When there is an inferred cyclic dependency between devices, we need a way +to explicitly list the suppliers of one or more devices in the cycle so +that we can break the cycle. + +The depends-on property fills this need. It can be used to explicitly list +the suppliers of a device and override any inferred dependencies of that +device. + +This property shall be used ONLY to break cyclic dependencies. + +Optional properties: +- depends-on: A list of phandles to suppliers of the device. + +Examples: +Here, the inferred depencency would state that cc2 is dependent on cc1 and +cc3; and cc3 is dependent on cc1 and cc2. This creates a cycle between cc2 +and cc3. + +With the use of depends-on, cc2 is only dependent on cc1; and cc3 is still +dependent on cc1 and cc2. This breaks the cycle between cc2 and cc3. + +cc2: cc2@40031000 { + compatible = "cc2"; + reg = <0x40031000 0x1000>; + clocks = <&cc1 10>, <&cc3 7>; + depends-on = <&cc1>; +}; + +cc3: cc3@40034000 { + compatible = "cc3"; + reg = <0x40031000 0x1000>; + clocks = <&cc1 10>, <&cc2 7>; +}; -- 2.23.0.187.g17f5b7556c-goog