From patchwork Wed Jan 10 03:47:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 123997 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4788286qgn; Tue, 9 Jan 2018 19:48:01 -0800 (PST) X-Google-Smtp-Source: ACJfBosP8OCwz9D4KYDPoUVPyX1GCofHzvm6rasVo2GJomLjPLI/1/M1Y9kK6XRe9b3eK2GdTwxv X-Received: by 10.84.139.1 with SMTP id 1mr17364238plq.250.1515556081293; Tue, 09 Jan 2018 19:48:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556081; cv=none; d=google.com; s=arc-20160816; b=l8Fehw7OkpkCP678P6MQXGaPgCuheijF2wov7ZWMy1eoGp0e/HO00fHJ8QLVJikWEH zwoinHrnKj6zB3Svpbp8t4mnImIvzUZ3XfT7/9oIaVIB0jtNpYyZ9foaCIEeL4QgVuOa XhovoPaAOnYcgujYwEkK/aiB1NHFvbgg+EAjmox4R+vKuuUEtabXaKxTqD76V77t873t 2zFu5KQJ6fP7cXm1YCE5O5maHPYGyHasTeoGcIlf56VfW5MxtCGfEbPu+tkYi73q2N7i QHZThNuKPcPDA9srzhEsJNWZERSSPVA+7Bxabom7XeA/N5ciwg0XkRb4H/zbPM757/tV 2rsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ki4fniqOHi7tGk9FfeiiowH99pCAlLoSY+6J998WwMk=; b=uXtuaMNXSIKuHmn9u1jwH7aSffaCWC5/BUVPvSnMOX3fsvxtDle/8/IJ9Mx4c1YYLr uJwt7HZsikJCV7DDXIwGDMcgpPfAccaYt8g4CkKII1Wgu/LJZUfhwEPjG/E3oqI9Qaub DSTosyQIy+8mXretDXdaSwLMkAkgdyG6R1WzRsylWdQbSGkXsl/gAz1PsBuHAyqH6XyV vcFlGNdqQxksq6HrDpWcAcqR/re5d7udJzySAvTRsW/TDy6KS+9HDPofuwqT6dReVfD2 D6hX7jzOI3e6VtSg+rwFMhBXYPwQzbQFaM+qWfOBiwE7NDScOjdxLSClks0ue1Ch34Ga M6UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AFs0jfWA; 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 e5si420940plb.319.2018.01.09.19.48.01; Tue, 09 Jan 2018 19:48:01 -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=AFs0jfWA; 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 S965161AbeAJDr6 (ORCPT + 28 others); Tue, 9 Jan 2018 22:47:58 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:38887 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965127AbeAJDrx (ORCPT ); Tue, 9 Jan 2018 22:47:53 -0500 Received: by mail-pg0-f65.google.com with SMTP id t67so9803777pgc.5 for ; Tue, 09 Jan 2018 19:47:53 -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; bh=ki4fniqOHi7tGk9FfeiiowH99pCAlLoSY+6J998WwMk=; b=AFs0jfWAfB4qDpKdFDZ3PiMlPMtUo0zThBmYPFFcum6hPFpUGJQ0E9BaBtFOp66mU7 hjl0vvqqVCSw/pIIa8lfs9tzec5CNyjG0GsbDr0rjx42zeXGp/z4klA8387reFOjS8wa sp7DOsRKSs9TcfGq0+xIJnSCBjPgEDwbRbmp4= 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; bh=ki4fniqOHi7tGk9FfeiiowH99pCAlLoSY+6J998WwMk=; b=GOFk1G2RkI2Ycg3fUQ+wBItsz+hRItkIir5bRDg+kxbYFLgFWQU9QupTd3u5FbL4U5 Z2BqHQZUFY8Nw6k5fWvjdpaBStPi9SqcuauDu55kB2dTp/HkdQSK1ZXFUCRV5SaVJlv4 JxTcqpEhMAfAy+RFdu978FmC5iZn2nWWPG9LSMQydb6Hlpvps3oCfxjLG9mCAMLRxqiP ES2UDyPoxq/uHqNOg6MMtCjz3Hs7/7aCg0P/60shf5kGvfEKv984CH75UhotqiiQTt6W 4SQ3dRHVdFJfXnVWgI/faylVnfONwBZTc3CRB3sYIf/EsfJrDLA04GxM2lehp2TnJj/Q LXnA== X-Gm-Message-State: AKGB3mLKncv1kgfML53HvMAiJCn9QZ6oXOUA7wBzbcbc7+2YwVCk25w4 roamuGibupCkqKb+LEUGZHnEbg== X-Received: by 10.99.61.143 with SMTP id k137mr14508942pga.315.1515556073020; Tue, 09 Jan 2018 19:47:53 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id t1sm5939464pfj.21.2018.01.09.19.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:47:52 -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 Subject: [PATCH V6 Resend 00/13] drivers: Boot Constraint core Date: Wed, 10 Jan 2018 09:17:29 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, I am re-sending V6 as you suggested. There is no change from the patches sent on 14/15th of December, apart from rebasing on driver-core-next. I have tested the Hisilicon patches (again) on hikey 9660 board, IMX stuff was earlier tested by Sascha (Pengutronix) on i.MX6 and Qualcomm stuff was earlier tested by Rajendra (Qualcomm) on Dragonboard 410C (This required some more patches related to display driver which Rajendra should be sending separately later on). Problem statement: Some devices are powered ON by the bootloader before the bootloader handovers control to Linux. It maybe important for those devices to keep working until the time a Linux device driver probes the device and reconfigure its resources. A typical example of that can be the LCD controller, which is used by the bootloaders to show image(s) while the platform is booting into Linux. The LCD controller can be using some resources, like clk, regulators, etc, that are shared between several devices. These shared resources should be configured to satisfy need of all the users. If another device's (X) driver gets probed before the LCD controller driver in this case, then it may end up disabling or reconfiguring these resources to ranges satisfying the current users (only device X) and that can make the LCD screen unstable. Another case can be a debug serial port enabled from the bootloader. Of course we can have more complex cases where the same resource is getting used by two devices while the kernel boots and the order in which devices get probed wouldn't matter as the other device will surely break then. 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 kernel boot. This makes sure that the resources stay enabled. A wide variety of constraints can be satisfied using the new framework. Proposed solution: This series introduces the concept of "boot-constraint", which are set by platform specific drivers (for now at least) at early init (like subsys_initcall) and the kernel will keep satisfying them until the time driver for such a device is probed (successfully or unsuccessfully). Once the driver is probed, the driver core removes the constraints set for the device. This series implements clk, regulator and PM domain constraints currently. Pushed here: git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git boot-constraints V5->V6: - Fix a build error reported by build bot for !CONFIG_OF_ADDRESS. This was already sent on 15th December. - Rebased over latest driver-core-next. V4->V5: - SPDX Licence format used. - arm,primecell stuff removed from boot constraint core and added a helper in OF core (which already handles amba and platform devices). - Removed a bunch of BUG_ON(), pr_fmt(), comments. - Changed directory and other names from boot_constraints/boot_constraint. - Removed serial.o file and moved the code to hikey and imx files. - Don't return error from dummy helper. - Added documentation and corresponding kernel doc comments in the code. - Updated MAINTAINERS. V3->V4: - Added support for imx, hikey and Qcom usecases. - Enhanced boot constraints core to make drivers code easy and handle complex cases. - Two new patches for OF included to provide APIs to boot constraint core. - Removed the kernel parameter patch for now. - Don't check return values of debugfs routines. - Moved the boot constraints core from drivers/base/ to drivers/. V2->V3: - Removed DT support as we aren't sure about how to define the bindings yet. - Added CLK and PM domain constraint types. - A new directory is added for boot constraints, which will also contain platform specific drivers in future. - Deferred devices are still supported, just that it wouldn't be called from generic code anymore but platform specific code. - Tested on Qcom 410c dragonboard with display flash screen (Rajendra). - Usual renaming/commit-log-updates/etc changes done. V1->V2: - Add support for setting constraints for devices created from DT. - Allow handling deferred devices earlier then late_init. - Remove 'default y' line from kconfig. - Drop '=" after boot_constraints_disable kernel param. - Dropped the dummy testing patch now. -- viresh Rajendra Nayak (1): boot_constraint: Add Qualcomm display controller constraints Viresh Kumar (12): of: platform: Add of_find_any_device_by_node() of: platform: Make of_platform_bus_create() global drivers: Add boot constraints core boot_constraint: Add support for supply constraints boot_constraint: Add support for clk constraints boot_constraint: Add support for PM constraints boot_constraint: Add debugfs support boot_constraint: Manage deferrable constraints boot_constraint: Add support for Hisilicon platforms boot_constraint: Add support for IMX platform boot_constraint: Update MAINTAINERS boot_constraint: Add documentation .../driver-api/boot-constraint/constraints.rst | 98 +++++++ Documentation/driver-api/boot-constraint/index.rst | 4 + Documentation/driver-api/index.rst | 1 + MAINTAINERS | 9 + arch/arm/mach-imx/Kconfig | 1 + arch/arm64/Kconfig.platforms | 2 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/base/dd.c | 32 ++- drivers/boot_constraint/Kconfig | 9 + drivers/boot_constraint/Makefile | 7 + drivers/boot_constraint/clk.c | 70 +++++ drivers/boot_constraint/core.c | 290 +++++++++++++++++++++ drivers/boot_constraint/core.h | 47 ++++ drivers/boot_constraint/deferrable_dev.c | 241 +++++++++++++++++ drivers/boot_constraint/hikey.c | 158 +++++++++++ drivers/boot_constraint/imx.c | 126 +++++++++ drivers/boot_constraint/pm.c | 28 ++ drivers/boot_constraint/qcom.c | 122 +++++++++ drivers/boot_constraint/supply.c | 104 ++++++++ drivers/clk/imx/clk-imx25.c | 12 - drivers/clk/imx/clk-imx27.c | 13 - drivers/clk/imx/clk-imx31.c | 12 - drivers/clk/imx/clk-imx35.c | 10 - drivers/clk/imx/clk-imx51-imx53.c | 16 -- drivers/clk/imx/clk-imx6q.c | 8 - drivers/clk/imx/clk-imx6sl.c | 8 - drivers/clk/imx/clk-imx6sx.c | 8 - drivers/clk/imx/clk-imx7d.c | 14 - drivers/clk/imx/clk.c | 38 --- drivers/clk/imx/clk.h | 1 - drivers/of/platform.c | 63 ++++- include/linux/boot_constraint.h | 121 +++++++++ include/linux/of_platform.h | 16 ++ 34 files changed, 1541 insertions(+), 151 deletions(-) create mode 100644 Documentation/driver-api/boot-constraint/constraints.rst create mode 100644 Documentation/driver-api/boot-constraint/index.rst create mode 100644 drivers/boot_constraint/Kconfig create mode 100644 drivers/boot_constraint/Makefile create mode 100644 drivers/boot_constraint/clk.c create mode 100644 drivers/boot_constraint/core.c create mode 100644 drivers/boot_constraint/core.h create mode 100644 drivers/boot_constraint/deferrable_dev.c create mode 100644 drivers/boot_constraint/hikey.c create mode 100644 drivers/boot_constraint/imx.c create mode 100644 drivers/boot_constraint/pm.c create mode 100644 drivers/boot_constraint/qcom.c create mode 100644 drivers/boot_constraint/supply.c create mode 100644 include/linux/boot_constraint.h -- 2.15.0.194.g9af6a3dea062