From patchwork Thu Dec 14 15:33:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 121972 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp6959875qgn; Thu, 14 Dec 2017 07:33:57 -0800 (PST) X-Google-Smtp-Source: ACJfBovky2hvKgTjf5AvcvsqD2SEVZQ6kyNwQXUum6fgAjzmHGv7kFavmCE+bGd2YTko6AfU6OFO X-Received: by 10.84.168.101 with SMTP id e92mr9887702plb.34.1513265636957; Thu, 14 Dec 2017 07:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513265636; cv=none; d=google.com; s=arc-20160816; b=OJisUfr9rcUUA3HMrWaGSXdue1OGVO8EUTQfHnj5uKHmyFhQYsYTeXrug17LpH0b/K 7CkawVjKZ4LTlvs0Iabi7dj4MNr7/yz5iSYwVET4fOeIYpNedAQAjxi8CxHgt+aVZoCL A+Cz2JC95/Qv7rQ7msT7pqWNUJYG2k5EvIH2hu5l3HQRrvGOoQNqKhINsimEQTGll7Tc Syyz/PIpbZYEGl0+McksS/W3+ETzJUwwjFjTdWL9WQMQOUvp0XtZuVjpXql5gLPFWXjC 5L527P2Hoo/etDK6a0Vg0fqowhZQHLEy7CTvXaosg/2nq7CdreZ+pdg/o92yF1BWJjjw bmfQ== 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=awsilpnffqNFYI5/h6fAl4dT2rvjMrX1j3ckMz+oyU0=; b=PyKZEV9hC/q7b6lYR4DvVmMSpIk91r+4X+R82/Zm7LUP5vzrT2tc6AzJXR9lK5H/1g 0l89rZ8z3ZtriSuXJGDEJqR+jitl5cZqS0Z9IhCpzX/FRQjyLVnTsNBTwms3bK+A0P2t m6Pp88zaJiEnAYsVW8v8T0B5/Gep3B+oSzgvThkq6qDfS2EqNqJAv6MiTK7yLF7OW89M ev32TJtcxOcpu1ZTKCSoM89oS0KDgHDaHRIIuoYjpoMxCJLKKfk8il4htDjqr5o8s9ta a9X3xjFcTrzEgQ6QfoVmnvJsQzAMDnxC0W92ul0RnFYB6aONTGL35Yo1ebXP9rUONF7m xotg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LO18VF/V; 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 q12si3358439pls.475.2017.12.14.07.33.56; Thu, 14 Dec 2017 07:33:56 -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=LO18VF/V; 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 S1753255AbdLNPdx (ORCPT + 19 others); Thu, 14 Dec 2017 10:33:53 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:39651 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbdLNPdv (ORCPT ); Thu, 14 Dec 2017 10:33:51 -0500 Received: by mail-pf0-f195.google.com with SMTP id l24so3850059pfj.6 for ; Thu, 14 Dec 2017 07:33:51 -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=awsilpnffqNFYI5/h6fAl4dT2rvjMrX1j3ckMz+oyU0=; b=LO18VF/VbIVUnaYghhn6h2kg9zRAMkcDlp7+/C3Spw51bW1yfZjfj3tyBHc7mdQa7w dfvtq1s4y14TCVlF+tyY6JyGcvGs1xWbfjXZ60gBmeJUL7DigS/i3HBRUBl19zUre+SN slkNiCWd0yD4+wiWdYO5B7IcQ98LQ+NBcCzSg= 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=awsilpnffqNFYI5/h6fAl4dT2rvjMrX1j3ckMz+oyU0=; b=kBCSxEH1auBAqRjGuAbTyqKgrczhoHwfbISAuaYM47Yj6zhc72yHK38DLJKjnz3yTC P9alTt3nUBzhLIqNrzZLeCHRdx4wCa4khVmFnFw/i7sTp0xx3420i3TJY4OBq4kLV1IJ d8aZweOSRWRKkRl+hTjpOz4dyKB8ZBDCbsjvQmNtY1oMNkhO97uLl8CQqo+8Lxq2C7PJ tpG8+7Lg8J+mzjUa1ZJeBCxyLLsRMRHzWW0f3d0CTjbTTV2QHufejXbclE8wPBZ41ieT yKstFIv7cRE4r4BBX/UDOSeovJmD95XQKqkIjdxnWk/7rnt8Gto92/N95OxoReXjOYmh F6KA== X-Gm-Message-State: AKGB3mKIaElWtHVX/36Ue+ZSZi22Msl8EMYLsU9GEeabD0rAWrgo9ynf jUHqfoPX5/d7vmTJRcJuzDu6FA== X-Received: by 10.84.240.131 with SMTP id z3mr10024216plk.317.1513265630637; Thu, 14 Dec 2017 07:33:50 -0800 (PST) Received: from localhost ([122.172.99.7]) by smtp.gmail.com with ESMTPSA id c73sm8658626pfd.181.2017.12.14.07.33.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 07:33:48 -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 V5 00/13] drivers: Boot Constraint core Date: Thu, 14 Dec 2017 21:03:07 +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, Here is V5 of the boot constraints core based on your feedback from V4. Hope this looks better now :) 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. Targeted for: v4.16 Pushed here: git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git boot-constraints 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