From patchwork Wed Jan 10 03:47:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10153903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D5F60602D8 for ; Wed, 10 Jan 2018 03:51:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C24A127813 for ; Wed, 10 Jan 2018 03:51:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B687E2785D; Wed, 10 Jan 2018 03:51:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3FEE227813 for ; Wed, 10 Jan 2018 03:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Fa+I89ffnNo+Kirksizn2cFuPP5rGXroUS2NN0TcXvY=; b=LOPGgmnXhaLCukJ0f/LuSnOLMN 29BKYcG0GvkLKvV5sRKmd0gEMUX0burU6pKF8+skQ87nO3vpuQ//uNbUwVcqI6R9bRoKIx+cIxlte sAu2WKojuJ67tYbw8SK+o6XTlNLseCHvlKZsoFozI44jhSCNeuQ1aktkvM7hYXfDg9bBqY1UfVEA7 84rHHYNPZ1wd66BBe6K1FCDpTqS+wafEfOgCE6A2H26B/BM37kWed59emQXmS+E2TxpsXQe6yQYUp Ge0gD4EqLLw1GmxFR3g3rK63KlFBU2UgVzOTHB76rzfL9lWQzgsIMqtaAhZBwacj2XZ4e8m0cfx6m p85NbIzg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eZ7Pt-00072Y-6x; Wed, 10 Jan 2018 03:51:05 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eZ7Ni-0002uX-Fm for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Jan 2018 03:48:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=api11LEndXJusHFPvHzUNPAysLOMa4YH5yakyeuJ+c0=; b=lKy4AwGd3cbEhpjUXsV0vwuy3 HEcxU0x59BOSGiqOHDBVVTd4Do+Txuj1rHk/NWju3vMJarmXEQGnKuGHIYTeH18LMU7iTwigxckLS Ud2rGZRXlAQhVpPOXJNFnHizWlTGtw83Qt8TYTsExIkiVGVHQ9w+ch7xBKMtNYC8w4Ay+yd0soigM nxGI3Beq23/Mte110m+NO1FUwY3pRfeUnvLmN4IMJuWH0HSysHIP2h06xgf2749VOvQwfnQQU6Sbn vnWhVC3iOQuk2/FITmj8D8b6LkQhMVfwwlt/qiylNh/pIQgnwGVUf04uPubWY268pkg5y3auPqrDE xFC2KIu8g==; Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eZ7Nd-0005Xc-Nd for linux-arm-kernel@lists.infradead.org; Wed, 10 Jan 2018 03:48:47 +0000 Received: by mail-pg0-x244.google.com with SMTP id q67so9809639pga.9 for ; Tue, 09 Jan 2018 19:48:29 -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=api11LEndXJusHFPvHzUNPAysLOMa4YH5yakyeuJ+c0=; b=b7y0m1J/q5cAi7NO5rLe5gxp+0vJ/MXpOB44wDaIZcloDThKK4NtV4OLlXJEd2rGbQ OR49fV90RAESKxnXUaYtiCjVFYH9XOMRJy5NwijOUHJ+3exboPIizJJVc7b6idGJMB2v ozXIUtwbzyOcJb1V9GjA/5Luy9tBhQnszm+xI= 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=api11LEndXJusHFPvHzUNPAysLOMa4YH5yakyeuJ+c0=; b=ow8QCM8izGQVfQZHOmtDmyJrlf/013aPSR99j47iQay/2ENUwmMR3FFeZCR95xBdsv 3wGuVTJizuiTiM2J/G+n8izZnfKxMvLV7kurYJlyAaEO84M8HE6AI77T1kPtttDG2R6n KFYwURW83cvEaj0WNr5pCp8aTpr3N364NlZGczp0WAmdlZgRgj+2YpTUNpXBn0OKYSGx 9xa63ldpdlKDaBmbSOc+ypIjjj1WqmGSpvvEwbsidi/Z8D6ZMmjvtdW3CZSa4Y7yMhD1 xkyvwtkskSP6gDmpXHCiqInth+6qbrjB0huq4OojUL6jtt2SIoIzSqjB9o2vTR0etOOJ 6fyg== X-Gm-Message-State: AKGB3mIU6nsGoUWjhtSxBp06tHDdDcFsDi8G8vocVt0bI3RvW/HWO+x6 5EEVoo7wkVZdwkcAx36Sk0wNbg== X-Google-Smtp-Source: ACJfBou9talQn4aYsLAR8oFIaI/sV9Qga172HOKvz7NZ0TJ4c0PbWtZm5Ve2Mpjx5t6mlqdEc5E2eQ== X-Received: by 10.98.163.131 with SMTP id q3mr6328624pfl.87.1515556106877; Tue, 09 Jan 2018 19:48:26 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id k63sm33139898pfk.172.2018.01.09.19.48.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:26 -0800 (PST) From: Viresh Kumar To: Greg Kroah-Hartman Subject: [PATCH V6 13/13] boot_constraint: Add documentation Date: Wed, 10 Jan 2018 09:17:42 +0530 Message-Id: <000b848c02d4ef5d7d7bc06d3c30c9d27862ba60.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, Rajendra Nayak , Viresh Kumar , s.hauer@pengutronix.de, Stephen Boyd , linux-kernel@vger.kernel.org, xuwei5@hisilicon.com, robdclark@gmail.com, robh+dt@kernel.org, fabio.estevam@nxp.com, Vincent Guittot , shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 diff --git a/Documentation/driver-api/boot-constraint/constraints.rst b/Documentation/driver-api/boot-constraint/constraints.rst new file mode 100644 index 000000000000..036bb77a26f9 --- /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/boot_constraint/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/boot_constraint/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/boot_constraint/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 d17a9876b473..e591c172b5b5 100644 --- a/Documentation/driver-api/index.rst +++ b/Documentation/driver-api/index.rst @@ -47,6 +47,7 @@ available subsections can be seen below. gpio misc_devices dmaengine/index + boot-constraint/index .. only:: subproject and html