From patchwork Wed Jul 12 06:34:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 107441 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp432456qge; Tue, 11 Jul 2017 23:34:59 -0700 (PDT) X-Received: by 10.99.175.18 with SMTP id w18mr2273685pge.67.1499841298899; Tue, 11 Jul 2017 23:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499841298; cv=none; d=google.com; s=arc-20160816; b=HHoWxWu3IREn3mGefxWFNioxxDVRqO5c6Q6bc0gued5XvJSsIZuxwUuYw3g3wWnmNt d1/XCtHl8zl6iKC2/wXWduslYK9fnaNCJr2p44BgA9QTSqYV/cPSJUUHfJmeKBEV/yLQ /z4Ky/z0Vsba0t+g9VXP8PCEz1g111munVSbzoOKBxB4sgNH1ittQZsy2aMojqjh5Im3 88OwvvAU69l7TV8JHQLaVuj8BBmfW3b5ln/P6uNUD+QdWCR2lfJQkLzfgI4HZgzg16Xu oFWTXAfAWKRAVnXYSCaqtYh3bEpgKwk8KeNhwodZRGr8vVkrVYwPQO6Y2xXx3+AsMtXf fTwQ== 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=nuWlD4ZUw8Qqc6XKFtmj1TUF7NvJ6H2w7Mt90V6/BIs=; b=dkfHjtm5PZWH97c6TafkXV4YFPn/z2TqtDUJpJm/2z0YWzwCD7JDMvHuS8HQuDM8iu cnyNewM2xQp+KT0E6XglX1N8KQgkBLSEpSaE0rYtmd5EZRXpWysKVljcXisNPrB/B/p/ Ip/z5zSgBnBUCrjJ40POGJMqbVRrBwCVB9JONdZKhWRTek1bvNygGobOCG/wDeXYtPsE vEmRnuMCct3Qj/l4u8Zcc/AOp1I8GKcQxATVm9nAnBF1qs3ZFzJB/q5zZBw2tBFavYDm JUDS8SNqjTqVQ1gyw+F3Rr3TqP+SNFF/1swm7clX6c8AjP0hyYIptKkNVBlFGcuItoe6 xclA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=dzK+PKs4; 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 x13si1265814pgq.222.2017.07.11.23.34.57; Tue, 11 Jul 2017 23:34:58 -0700 (PDT) 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.b=dzK+PKs4; 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 S1755543AbdGLGep (ORCPT + 25 others); Wed, 12 Jul 2017 02:34:45 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:35684 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750738AbdGLGeo (ORCPT ); Wed, 12 Jul 2017 02:34:44 -0400 Received: by mail-pg0-f43.google.com with SMTP id j186so8001776pge.2 for ; Tue, 11 Jul 2017 23:34:44 -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=nuWlD4ZUw8Qqc6XKFtmj1TUF7NvJ6H2w7Mt90V6/BIs=; b=dzK+PKs4fhobNXbdaQQGcWD+WHGSwTm5GSubgOBH0Gs4opK733gdpJMQoPqrj+xapD XgEkAeLfr0xOXks5GVaI8v30+6LdhL7jlAbSx9LUCkXtXVHlqNwTEGz0nG48mqksYUaH PSX+H/sHoFUTG3ves/ml4g5SHWCfS+NqFwZ4c= 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=nuWlD4ZUw8Qqc6XKFtmj1TUF7NvJ6H2w7Mt90V6/BIs=; b=AnXsMho7DbGE6SwcAMlzv963aAX6cQAbCCj3MrdKHhwHTTWZQwaaXzoJrvjIZRvzsl tJcxbzpC7JtDHFCOyWh0j0Me7SeYPfboSZWIW9w0k7f/feL/X72enev5FOzd3qNyTTLQ MY3XXJEAfUNUL5ysBicYHfO5IJFSaOOr/JoT8/LlA8NOWyK96korfCpGLz7fiKYvfmks mffKvaordJJ/g+DNK9flmZxzAgC912NZnNl2fQefzxgv/ZoGAEPEroS19JyB4D+vdV4p x7ozmuU2tzvlJJ0ez9jKpwGHxyLx9wAtHYKmTia7mNOglJHXzv9+Kk/skzSy591ciAFJ NAfg== X-Gm-Message-State: AIVw112EcOaHEFHspmCbvkX+qONo0jOq5b8Lciik5CewWQNPzgfLOgFG gw+ukKFwtFmWRbZu X-Received: by 10.84.241.4 with SMTP id a4mr2480167pll.160.1499841283575; Tue, 11 Jul 2017 23:34:43 -0700 (PDT) Received: from localhost ([122.167.138.108]) by smtp.gmail.com with ESMTPSA id z6sm2720349pff.46.2017.07.11.23.34.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 23:34:42 -0700 (PDT) From: Viresh Kumar To: Greg Kroah-Hartman , Frank Rowand , Jonathan Corbet , Mark Rutland , Rob Herring Cc: Viresh Kumar , Vincent Guittot , Mark Brown , Stephen Boyd , Rajendra Nayak , Shiraz Hashim , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC v2 0/6] drivers: Boot Constraints core Date: Wed, 12 Jul 2017 12:04:30 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg and others, I am sending the V2 for this series after waiting for just 2 weeks because this one presents a clearer picture on how is this going to get used. V2 has gained updates for adding the constraints for platform and AMBA devices created from DT. 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 reconfiguring these resources to ranges satisfying the current users (only device X) and that can make the LCD screen unstable. 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. Proposed solution: This patchset introduces the concept of boot-constraints, which are set by the different parts of the kernel (on behalf of the bootloaders) and the kernel will satisfy them until the time driver for such a device is probed (successfully or unsuccessfully). Once the driver's probe() routine is called, the driver core removes the constraints set for the particular device. Only the power-supply constraint type is supported for now. This can be used across platforms working with DT, ACPI, etc and has no dependency on those. The last two patches add support to set these constraints automatically for the devices created via DT. 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. It is tested on ARM hikey ARM64 platform and compile testing is done for X86 as well (without enabling boot constraints config option). -- viresh Viresh Kumar (6): drivers: Add boot constraints core drivers: boot_constraint: Add support for supply constraints drivers: boot_constraint: Add boot_constraints_disable kernel parameter drivers: boot_constraint: Add debugfs support drivers: boot_constraint: Add initial DT bindings drivers: boot_constraint: Add constraints for OF devices Documentation/admin-guide/kernel-parameters.txt | 3 + .../devicetree/bindings/boot-constraints.txt | 68 ++++ drivers/base/Kconfig | 10 + drivers/base/Makefile | 4 + drivers/base/base.h | 1 + drivers/base/boot_constraint.c | 404 +++++++++++++++++++++ drivers/base/boot_constraint_of.c | 122 +++++++ drivers/base/dd.c | 32 +- drivers/of/platform.c | 4 + include/linux/boot_constraint.h | 44 +++ 10 files changed, 685 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/boot-constraints.txt create mode 100644 drivers/base/boot_constraint.c create mode 100644 drivers/base/boot_constraint_of.c create mode 100644 include/linux/boot_constraint.h -- 2.13.0.71.gd7076ec9c9cb