From patchwork Thu Dec 14 15:33:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10112549 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 686166019C for ; Thu, 14 Dec 2017 15:39:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5876528210 for ; Thu, 14 Dec 2017 15:39:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CA062939B; Thu, 14 Dec 2017 15:39:05 +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 9FBC928210 for ; Thu, 14 Dec 2017 15:39:04 +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=j2u/JDwTdTbJ3dTR4X2yyaikrP VAicL8cPx6ZleOBiYe/Hup4hD3aU+2p8PYlbkNs5xEPhfK7YjaI8pjJ0tTd8dpgEsERdfQ9NM3M76 dSxQj0npESsQc+dQkQBjK9McQ3IvWp+Ku7boqXZ46a2fp9Y12j5NT++KE0QvfKa0zthj4uA8AOqFF X3mY335HYp4vFU/mxZk6Iz5RooRorZAJPHISbI2ZVHz6AB/loXXwaQ5sDZMA0iR2/di2frjP4+sR2 Km2UyNAW6I0TYBbB1b7zsE8pfcv+6L07O05Okxu9Il5tqGcDI5BNnNUw4yXHAcTJd4C4beg+nqqmZ IGk6cL6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePVbD-0000gQ-R0; Thu, 14 Dec 2017 15:39:03 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ePVX7-0003zB-16 for linux-arm-kernel@lists.infradead.org; Thu, 14 Dec 2017 15:34:58 +0000 Received: by mail-pg0-x244.google.com with SMTP id k15so3625241pgr.7 for ; Thu, 14 Dec 2017 07:34:28 -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=i8uuwGK8/7YyIG7MOlPIzZEGoySM01O92fmsykZ3H7TLG8+rHE/GJlZUF7K2YfZ94a 3UwmRR4Idcnnv7Piu+x8Bl/vbDS/b8oh4Yijf5qqITu8dIVm88Kx9awFIlqL9OuJYjc9 QWHnFuiLWC02ZH9NII+ccKx9TiVS+UGKtJy+o= 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=ogZnWJIWCLQsjphmpv6+w0peCwMf9wslDisiL3C+komT4G2/hKunIyxGO2Plhz+kDc AVay3mJz3sgxS1kpA25dWxX844XdKuoOgNB+DONspGPOqVbsiXR3r8lY9W5WehVedWgN uGGZ++kac1LmouZ5z8vHbzRVXq4pGZauOocA1peyRUPVPydVb4vyKTsy6hVC2le23VAH t/ksjBAQXja/QZdhoyhNp/+rjTGRp+eDMJIzTNx4MWZCAdDrgotWVBHtCr1vwXie3hMu nM/r0qToKSLHxIZT6/hUxUbiGxlmOZdNjDwMiCup5d5seA4OYAHDASW2ecLWXPpGwbDO 7siw== X-Gm-Message-State: AKGB3mIV1b5SPDg6n9ImxMesgtuMbPYyCA13Iz1D2138NNsXad7JZnht a1OTXau9/F68CvGRnRs558I8Ug== X-Google-Smtp-Source: ACJfBouKRbsg7NFuWQZKUEfIf/dZuxf2pE8kdx7lqdlVjf2PwFCB+f/CSRPmaLNx1hb7FDrA5WvihA== X-Received: by 10.99.177.75 with SMTP id g11mr8981330pgp.268.1513265667911; Thu, 14 Dec 2017 07:34:27 -0800 (PST) Received: from localhost ([122.172.99.7]) by smtp.gmail.com with ESMTPSA id e2sm7190342pgv.34.2017.12.14.07.34.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 07:34:27 -0800 (PST) From: Viresh Kumar To: Greg Kroah-Hartman Subject: [PATCH V5 13/13] boot_constraint: Add documentation Date: Thu, 14 Dec 2017 21:03:20 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171214_073449_673822_76D58802 X-CRM114-Status: GOOD ( 20.69 ) 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