From patchwork Sun Oct 29 13:48:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 117405 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1527116qgn; Sun, 29 Oct 2017 06:49:17 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TEJh4rA7Xy0ythzEdscyKUZIYLp0LWEY9WLHF+VMXvAlw5JKNAiPFtAugJBqCx3KIuNFhY X-Received: by 10.98.247.26 with SMTP id h26mr5894973pfi.233.1509284957002; Sun, 29 Oct 2017 06:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509284956; cv=none; d=google.com; s=arc-20160816; b=trXy+nz1GqFJIw1mE60Wx1RxDvRgFLkdkVh8U6nv6naic2kRNnR9jqmmA9OMfgxjMy cTZnbit0Itq6LwMVwaN6Ci4ddQ6KY/LEkCofTheSTf6fU8zxb1+sC9ouC53xLR2a7otI T/MmJzR8N86Ygv/0yUUvYr8+pEasQEaUOC266CuStKv/rB8W1abylxMpemp7GeVHrMWt zTagfxnnh6YC4A4GwMxFZJRbJZj5wX95E7Jd664/ftfV5yZvw2ZbVWul2dI6vEYd3pNg UP6PrpP8kry1B6jJO82qHllkTL6fpHaFUymXAJ4AX00ICvSWYoEPLCkziS+C9lAGeTri cnIQ== 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=Whfk8yc6N7dOZrcciQHg1gnKjQ+nYR/Nn/4eBycYgLo=; b=zfvP65GqnfHiRLgxKtrN1Q08NJnq3zzXRzBSaVwkTmzIMj5EkwtadI6a8NMzdtWzKn EmVrwtvzfQJKCPNUTlacFj6PdIrlHbBzZoAMPfIKTq58xew15O52O/AADAt/E7trd0Mn Xd0UNumg8T+9DScIfcTATe8ajyQumyXQM5+ruiP7T57C3hdLXEOFYX5eR6EFTgOPb5Rt 8mo/W77xd7WQsBxzHy4kr7AOWezP25ZZlp7kfld6A8oB176EMSspIbbYtLQe/xm14XfL bD3IsziN2tOwmeeWtQl6jPf8PQNxKL5nqXIId/0w75q1PoHXrzf1040kulrRTN3DpPNY 7qfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TGUjwfe9; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (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 k139si8697498pfd.399.2017.10.29.06.49.16; Sun, 29 Oct 2017 06:49:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TGUjwfe9; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751221AbdJ2NtN (ORCPT + 6 others); Sun, 29 Oct 2017 09:49:13 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:56128 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751269AbdJ2NtL (ORCPT ); Sun, 29 Oct 2017 09:49:11 -0400 Received: by mail-pg0-f66.google.com with SMTP id 15so9098043pgc.12 for ; Sun, 29 Oct 2017 06:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=A4xQ7Ems0hs62VGhUMXAHbPFZYuzFIEZ2HGKQ7+qlzM=; b=TGUjwfe9ikGTCUoOqVaAjnUtBiAq7nQRySulxzfpIri69rhTKeDoqkmiYx3NswXxDw UoT2dWOmQUSxQGCpAC5KcrF4J2Big82B02Emi3RlzXZ0Ebpj8du2GqoJgZwWu3OOy2C7 iuAC+2JNShi/xlOPypSHoDeLqCHz4a6ToNk3Q= 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=A4xQ7Ems0hs62VGhUMXAHbPFZYuzFIEZ2HGKQ7+qlzM=; b=XVuS2cJ53T4QF1SS0uRJ6FeqXIgeHW0WHbJ6w+bu5tcIyUunvzfD9m8qXYvzuvGCwd Zvr2ot9FFqKNKFtIQoybLeknBH1dFYprd6b0NNmf6KQ8JgTudrbCf1sGN58cfe96cIRs khhn1fWkXFq4HAOuGiU38cv2aWd3GKv04VUKXo7bUyJ9XS+4jUhkYjZPM6CUlAG7A/Ha liTrMlNY5afMSlh2x1snG8pXcaklaqLzxnGs7KIPfsibEOt7WBVTxK5Sfu5oKsC0Pcdo HrGN2MNhURiBencgVi15n8Gx1lu0HJNj489/FGWu7+W7RfWHWvFSW+kLdmA+LHREVqmo WOWw== X-Gm-Message-State: AMCzsaXmy0jRk4Wm0+/SNI/ZXy5JcNbfT1XZkZRZ5tCeCIe3qKoySEPy gASfp9E0ZWsnl/iKJydNM3rsAQ== X-Received: by 10.99.67.71 with SMTP id q68mr5207126pga.163.1509284951019; Sun, 29 Oct 2017 06:49:11 -0700 (PDT) Received: from localhost ([122.167.161.211]) by smtp.gmail.com with ESMTPSA id n22sm24366497pfa.161.2017.10.29.06.49.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Oct 2017 06:49:09 -0700 (PDT) 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, devicetree@vger.kernel.org, Frank Rowand Subject: [PATCH V4 00/12] drivers: Boot Constraints core Date: Sun, 29 Oct 2017 19:18:48 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.rc1.236.g92ea95045093 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Greg, Here is V4 of the boot constraints core based on your feedback from V3. We now have support for three platforms (as you suggested) included in this series: Hisilicon, IMX and Qualcomm. I have tested the Hisilicon patches on hikey 9660 board, IMX stuff is tested by Sascha (Pengutronix) on i.MX6 and Qualcomm stuff is 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-constraints", 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. Rebased over: driver-core/master Targeted for: v4.16 (Sending it earlier for reviews mostly) Pushed here: git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git device/boot-constraints 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 (11): of: platform: Add of_find_amba_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 earlycon helper boot_constraint: Add support for Hisilicon platforms boot_constraint: Add support for IMX platform arch/arm/mach-imx/Kconfig | 1 + arch/arm64/Kconfig.platforms | 2 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/base/dd.c | 32 +++- drivers/boot_constraints/Kconfig | 9 + drivers/boot_constraints/Makefile | 7 + drivers/boot_constraints/clk.c | 73 ++++++++ drivers/boot_constraints/core.c | 271 ++++++++++++++++++++++++++++++ drivers/boot_constraints/core.h | 48 ++++++ drivers/boot_constraints/deferrable_dev.c | 235 ++++++++++++++++++++++++++ drivers/boot_constraints/hikey.c | 145 ++++++++++++++++ drivers/boot_constraints/imx.c | 113 +++++++++++++ drivers/boot_constraints/pm.c | 31 ++++ drivers/boot_constraints/qcom.c | 123 ++++++++++++++ drivers/boot_constraints/serial.c | 28 +++ drivers/boot_constraints/supply.c | 107 ++++++++++++ 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 | 28 ++- include/linux/boot_constraint.h | 74 ++++++++ include/linux/of_platform.h | 21 +++ 31 files changed, 1340 insertions(+), 151 deletions(-) create mode 100644 drivers/boot_constraints/Kconfig create mode 100644 drivers/boot_constraints/Makefile create mode 100644 drivers/boot_constraints/clk.c create mode 100644 drivers/boot_constraints/core.c create mode 100644 drivers/boot_constraints/core.h create mode 100644 drivers/boot_constraints/deferrable_dev.c create mode 100644 drivers/boot_constraints/hikey.c create mode 100644 drivers/boot_constraints/imx.c create mode 100644 drivers/boot_constraints/pm.c create mode 100644 drivers/boot_constraints/qcom.c create mode 100644 drivers/boot_constraints/serial.c create mode 100644 drivers/boot_constraints/supply.c create mode 100644 include/linux/boot_constraint.h -- 2.15.0.rc1.236.g92ea95045093 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html