From patchwork Fri Feb 23 10:23:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 129345 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp435603lja; Fri, 23 Feb 2018 02:24:51 -0800 (PST) X-Google-Smtp-Source: AH8x226/8XQfERrX35zjBRsL9tQpjB+/y9YAMW0jJvggM60pm7DWyYp5RfFAmzwecfxHAFD2DW8p X-Received: by 10.99.152.10 with SMTP id q10mr1095640pgd.212.1519381491047; Fri, 23 Feb 2018 02:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519381491; cv=none; d=google.com; s=arc-20160816; b=IgKiX52xUUGWNj9bC2w2dNOo3uj5pmNeyXXVrz+XYmH2SzRxEpljoD8RD3wNdABQZd 3VxD/stXHbs7mqmct5e0smk46SRPooq6ztQNHUF6h6i/6JUhtcGodh7Ew4Lb4/tD6oEr yOs4dO+IxKIDTnotiGRtSpnpVfm7HimsMlEUakSIv8bpaj7cqcr68kcrl3+px+oXPM+e bH1GPfrzubz5zgPP5GRo5EuJqbxMwCGLkg0+/WpjMgQ0rHjam+l0QAuAvLo7WyvuvsgG u9ipCZ9ciesW+rhEZFJLs3V+oViBuK0A92ifg3lGrrsMxqt6MBjBWyKaR2sK2Iriwd07 yQBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=yTtftKTuyk9mvnahI37UwUVpztG3niifWNi5R55vYwI=; b=IcZ/zce5Efo7i4RMHzH5gT1+vZTi3a3g370o9NakEg1Mi8mtSFp/bEUcDqlvZ673wn NepldT8fpCJ6DHeeSxLaX807V4Odu6LTVJehrVrfaAB1oIve8ZrzH0O1Zkv1vpjRRIAx 1XtPe/ZEs/o4PB8ptYq3eFwLf+O9MEaKIatojYtiwyRZNMjzAVJfKYoSxVz9UQ5gGvbP cG2DOkxxDS0eVeCriJw8Gq8nFMFVSc5aVSba/Yyzm4t8pukJBoj6v/Ox3ESSFAsdp89v rkSxbmcfnJUYq8vHNhJzR4D0sXTTtp+17UlTxVVEhAQBFYK17Ag+vuxjMZWJHlifm+Sk 8mvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OUG+LoH8; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12si1344567pgf.289.2018.02.23.02.24.50; Fri, 23 Feb 2018 02:24:51 -0800 (PST) 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=@linaro.org header.s=google header.b=OUG+LoH8; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751789AbeBWKYp (ORCPT + 28 others); Fri, 23 Feb 2018 05:24:45 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:36949 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764AbeBWKYk (ORCPT ); Fri, 23 Feb 2018 05:24:40 -0500 Received: by mail-pl0-f67.google.com with SMTP id ay8so4655703plb.4 for ; Fri, 23 Feb 2018 02:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=yTtftKTuyk9mvnahI37UwUVpztG3niifWNi5R55vYwI=; b=OUG+LoH8dIsk1gv/hPWAUqThZ6jFunNwSAMOP/vLHr2rHBGLfb1VWieOGTY8nkRF5h uOItBja6pCKV2ThPCNPZhRKWXMkScaDDQNxERbgQIzzKBcj8VHcufLZZeoRVUSTJMJth sE6dGur2xKS+yuhmizA/Px5Ztv+izbse4IfUg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=yTtftKTuyk9mvnahI37UwUVpztG3niifWNi5R55vYwI=; b=qXHkAjc3/WnbN69Jc3gORkQyVOfacJHsVG7HjCs5eBXBrJzt8kRGHwGKITyXqIrD0K GdY/NrJeeBBsPa6Rz0gTdrtEKm70TYWi3IBI+2wkM3UTCHRMTyUy2tBWKsIpNcjf400Y EyeUGYnl4fD3HXAurRa35ObgeDWgnAdgExdFd6F7q7lBeroWMxGjdtz+2aH7AujqApSk eF6svn1u8t+TJ3gMH4IJU8tUPIpSbs2VpjCAFYRIVYiwr+BFNQ4bHEn1QTrES9dj81dO mh3Vv/P3rQBwzCfBB5W2+XVBcKQJnDxnSPznPZ8umbo60s0y+2U9GZYFgKu7wL8pMtE6 J8WA== X-Gm-Message-State: APf1xPAbnpURmJcdiCWDGb3ZL5F2ggsImGAzddv0nRtc0OuPMvu0G4ew GoXl6YNmq/4LI9FS3Gpz/UBFqx5K4qc= X-Received: by 2002:a17:902:6116:: with SMTP id t22-v6mr1249503plj.307.1519381479586; Fri, 23 Feb 2018 02:24:39 -0800 (PST) Received: from localhost ([122.167.232.138]) by smtp.gmail.com with ESMTPSA id z17sm3923443pfh.183.2018.02.23.02.24.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 02:24:39 -0800 (PST) From: Viresh Kumar To: Greg Kroah-Hartman Cc: Viresh Kumar , Vincent Guittot , Stephen Boyd , Rajendra Nayak , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robdclark@gmail.com, s.hauer@pengutronix.de, l.stach@pengutronix.de, shawnguo@kernel.org, fabio.estevam@nxp.com, nm@ti.com, xuwei5@hisilicon.com, robh+dt@kernel.org, olof@lixom.net Subject: [PATCH V7 13/13] boot_constraint: Add documentation Date: Fri, 23 Feb 2018 15:53:52 +0530 Message-Id: <6b17ffecd9917ff4a1fad848839ea667e92d715f.1519380923.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds boot constraint documentation. Signed-off-by: Viresh Kumar --- .../driver-api/boot-constraint/constraints.rst | 98 ++++++++++++++++++++++ Documentation/driver-api/boot-constraint/index.rst | 4 + Documentation/driver-api/index.rst | 1 + 3 files changed, 103 insertions(+) create mode 100644 Documentation/driver-api/boot-constraint/constraints.rst create mode 100644 Documentation/driver-api/boot-constraint/index.rst -- 2.15.0.194.g9af6a3dea062 diff --git a/Documentation/driver-api/boot-constraint/constraints.rst b/Documentation/driver-api/boot-constraint/constraints.rst new file mode 100644 index 000000000000..6da2df33f2c9 --- /dev/null +++ b/Documentation/driver-api/boot-constraint/constraints.rst @@ -0,0 +1,98 @@ +.. include:: + +========================= +Boot Constraint Subsystem +========================= + +:Copyright: |copy| 2017 Viresh Kumar , Linaro Ltd. + +Introduction +============ + +A lot of devices are configured and powered ON by the bootloader before passing +on control to the operating system, Linux in our case. It is important for some +of them to keep working until the time a Linux device driver probes the device +and reconfigure it. + +A typical example of that can be the LCD controller, which is used by the +bootloaders to show image(s) while the platform boots Linux. The LCD controller +can be using resources like clk, regulators, etc, that are shared with other +devices. These shared resources should be configured in such a way that they +satisfy need of all the user devices. If another device's (X) driver gets +probed before the LCD controller driver, then it may end up disabling or +reconfiguring these resources to ranges satisfying only the current user (device +X) and that may make the LCD screen unstable and present a bad user experience. + +Another case can be a debug serial port (earlycon) enabled from the bootloader, +which may be used to debug early kernel oops. + +There are also cases where the resources may not be shared, but the kernel will +disable them forcefully as no users may have appeared until a certain point in +the kernel boot. + +Of course we can have more complex cases where the same resource is getting used +by multiple devices while the kernel boots and the order in which the devices +get probed wouldn't matter as the other devices may break because of the chosen +configuration of the first probed device. + +Adding boot constraints +======================= + +A boot constraint defines a configuration requirement set for the device by the +boot loader. For example, if a clock is enabled for a device by the bootloader +and we want the device to be working as is until the time the device is probed +by its driver, then keeping this clock enabled is one of the boot constraint. + +Following are the different type of boot constraints supported currently by the +core: + +.. kernel-doc:: include/linux/boot_constraint.h + :functions: dev_boot_constraint_type + + +A single boot constraint can be added using the following helper: + +.. kernel-doc:: drivers/bootconstraint/core.c + :functions: dev_boot_constraint_add + + +The second parameter to this routine describes the constraint to add and is +represented by following structures: + +.. kernel-doc:: include/linux/boot_constraint.h + :functions: dev_boot_constraint dev_boot_constraint_info + +The power domain boot constraint doesn't need any data, while the clock and +power supply boot constraint specific data is represented by following +structures: + +.. kernel-doc:: include/linux/boot_constraint.h + :functions: dev_boot_constraint_supply_info dev_boot_constraint_clk_info + + +In order to simplify adding multiple boot constraints for a platform, the boot +constraints core supplies another helper which can be used to add all +constraints for the platform. + +.. kernel-doc:: drivers/bootconstraint/deferrable_dev.c + :functions: dev_boot_constraint_add_deferrable_of + + +The argument of this routine is described by following structure: + +.. kernel-doc:: include/linux/boot_constraint.h + :functions: dev_boot_constraint_of + + +Removing boot constraints +========================= + +Once the boot constraints are added, they will be honored by the boot constraint +core until the time a driver tries to probe the device. The constraints are +removed by the driver core if either the driver successfully probed the device +or failed with an error value other than -EPROBE_DEFER. The constraints are kept +as is for deferred probe. The driver core removes the constraints using the +following helper, which must not be called directly by the platforms: + +.. kernel-doc:: drivers/bootconstraint/core.c + :functions: dev_boot_constraints_remove diff --git a/Documentation/driver-api/boot-constraint/index.rst b/Documentation/driver-api/boot-constraint/index.rst new file mode 100644 index 000000000000..d6fce17626a2 --- /dev/null +++ b/Documentation/driver-api/boot-constraint/index.rst @@ -0,0 +1,4 @@ +.. toctree:: + :maxdepth: 1 + + constraints diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst index e9b41b1634f3..f982e71efb73 100644 --- a/Documentation/driver-api/index.rst +++ b/Documentation/driver-api/index.rst @@ -49,6 +49,7 @@ available subsections can be seen below. dmaengine/index slimbus soundwire/index + boot-constraint/index .. only:: subproject and html