From patchwork Wed Jan 10 03:47:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124010 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4791345qgn; Tue, 9 Jan 2018 19:52:39 -0800 (PST) X-Google-Smtp-Source: ACJfBotiprzfbfEdWZl45IK3Ovf9mhzTXknTQWOp3iWuBlCeaf/XLXvakAB4Rb6C9MCpPCJ/1M7J X-Received: by 10.98.211.204 with SMTP id z73mr6118241pfk.198.1515556359430; Tue, 09 Jan 2018 19:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556359; cv=none; d=google.com; s=arc-20160816; b=QSEtLPQOsG9cH7QbCa4J356yVFks2SpFKt/n7hpj0ECQYXRl0158rAXBrWYFa46vZU 9olqH0sDUD2MyW8PPQlBdp5zmwkex7m0hX9Ln16TKw9RDs0OMKRa12uUg5z8CfSFwDMq vwZwCp2r0Ldx8UdjJB6iMrSERdV7PVOeguAAEGh0P8DGNu8cYAGftQpfy2bdXfqNIxt7 VXKGxmD7FCvX2tR65w8iCICv8WCOoK3/Gc6ELQVgh45NU+ZTww9qJqeBa33fF2GfWa80 9X9HvC6WmO0nq6MEOGL+3U0jHsN9ACtztPOYDBxvHkz9XQ9Swywv000aIl+rsG8Gq1Lo ikQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=JvF1dk+O7f0i+Fy6jVvZS+EaoWZtI51KnXjLkfkaMqQ=; b=0Hi/6jmIscw+Y/ZbGCT6uAUPlYIoEGvVE0uqDKE4o2kd1gVT362Ab3LlgY5nW9eu5/ G+HQkaGA1Kl2aqHgsZ1H6y5jg8p7mnN3mH5duInVWJfXYwb3ZReK7VRmh/FkVCbTYpYr OkTrWxPjA4qbvSD/EJSS2BsA0eagSyLcVZcAysDWYz3ryWzuSd473SB7DS4LMuKRPDf2 4ierokahCXzyCG6t17IMJ4Iz60BJdL9Zv7OyebFIOywCwqIxY3wLHxwCkMGJa3h3+8Iw vTOz0MbKhsWPALQZKNbBKY+FkVdcQYfkg3YeNSNdyAcDAK3TsrNBIFDMXw9hD7ZNEsK5 wO/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ce6DzfwY; 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 k4si11246672pls.297.2018.01.09.19.52.39; Tue, 09 Jan 2018 19:52:39 -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=Ce6DzfwY; 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 S1756867AbeAJDwh (ORCPT + 28 others); Tue, 9 Jan 2018 22:52:37 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:42256 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965146AbeAJDr4 (ORCPT ); Tue, 9 Jan 2018 22:47:56 -0500 Received: by mail-pg0-f68.google.com with SMTP id q67so9808629pga.9 for ; Tue, 09 Jan 2018 19:47:55 -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=JvF1dk+O7f0i+Fy6jVvZS+EaoWZtI51KnXjLkfkaMqQ=; b=Ce6DzfwYVXN+KftvKMbWxtfcaTa1QZCA3Xl0+JEjS8s50iVeSmmSeBRCFOyx9zexcV tK3C5ehEOI1PiythfXoT4IIgelUT4lhW20il+QkuQj8Jqb7jPmLEj7AFjz2Ywagd5tAo 4pLc+EMrw2KFTxS6aRyyAudfk2JO+76X6Y1b0= 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=JvF1dk+O7f0i+Fy6jVvZS+EaoWZtI51KnXjLkfkaMqQ=; b=eyT67yKKorb1H9+QUc4zysX6+fIZy4ozMRDYbV3bBCF9/9LFmmsxg8PcmsbIofKk/D oYhQEJdlKirjc2Sl84VgkZRv650+4NB0V7YWQ5QYLwsPnY33vMs8BkSZ/e3IXXLaBQ4U NXsX7/xX/ZA940b49C24Z12HD8l7XEh51myb1J1TnZtCPoqGUuKgmuitdPo3EbDvyzZ+ 8N8pghzTZaYAn6bNLvqccj+7f+EYJe9HmPqRibqurn75A2hNW95oZcr2otRHIjAIbgC/ NR/zGUSPl8+nU6jHIgLjh4pSyChHsMkzUEpycRym1eg1h2BWHCEQzc4pkh9hgD/6aZaS qTcA== X-Gm-Message-State: AKwxytcuI+rQT7Av006htSm5nq5BynSWn12/LBgQ2IRKe1EIpWG858qR FCaKdNWNS/YaJJaCYp927KWTjw== X-Received: by 10.99.2.136 with SMTP id 130mr2613478pgc.268.1515556075532; Tue, 09 Jan 2018 19:47:55 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id i186sm30474804pfg.178.2018.01.09.19.47.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:47:55 -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 01/13] of: platform: Add of_find_any_device_by_node() Date: Wed, 10 Jan 2018 09:17:30 +0530 Message-Id: <744c2ed81cfe95768369b061c422eec3708447a0.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This creates a new helper that returns the struct device corresponding to a struct device_node. This currently works only for amba and platform devices, but can be easily extended to include other bus types. This also creates an internal of_find_amba_device_by_node() helper, which isn't exported as of now. Signed-off-by: Viresh Kumar --- drivers/of/platform.c | 55 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/of_platform.h | 5 +++++ 2 files changed, 60 insertions(+) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b7cf84b29737..61a4a81bea9f 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -60,6 +60,61 @@ struct platform_device *of_find_device_by_node(struct device_node *np) } EXPORT_SYMBOL(of_find_device_by_node); +#ifdef CONFIG_ARM_AMBA +/** + * of_find_amba_device_by_node - Find the amba_device associated with a node + * @np: Pointer to device tree node + * + * Takes a reference to the embedded struct device which needs to be dropped + * after use. + * + * Returns amba_device pointer, or NULL if not found + */ +static struct amba_device *of_find_amba_device_by_node(struct device_node *np) +{ + struct device *dev; + + dev = bus_find_device(&amba_bustype, NULL, np, of_dev_node_match); + return dev ? to_amba_device(dev) : NULL; +} +#else +static inline struct amba_device *of_find_amba_device_by_node(struct device_node *np) +{ + return NULL; +} +#endif + +/** + * of_find_any_device_by_node - Find the struct device associated with a node + * @np: Pointer to device tree node + * + * Takes a reference to the embedded struct device which needs to be dropped + * after use. + * + * This currently supports only AMBA and platform devices. + * + * Returns struct device pointer, or NULL if not found + */ +struct device *of_find_any_device_by_node(struct device_node *np) +{ + struct device *dev = NULL; + + if (of_device_is_compatible(np, "arm,primecell")) { + struct amba_device *adev = of_find_amba_device_by_node(np); + + if (adev) + dev = &adev->dev; + } else { + struct platform_device *pdev = of_find_device_by_node(np); + + if (pdev) + dev = &pdev->dev; + } + + return dev; +} +EXPORT_SYMBOL(of_find_any_device_by_node); + #ifdef CONFIG_OF_ADDRESS /* * The following routines scan a subtree and registers a device for diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index fb908e598348..4909d1aa47ec 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -59,11 +59,16 @@ extern struct platform_device *of_device_alloc(struct device_node *np, struct device *parent); #ifdef CONFIG_OF extern struct platform_device *of_find_device_by_node(struct device_node *np); +extern struct device *of_find_any_device_by_node(struct device_node *np); #else static inline struct platform_device *of_find_device_by_node(struct device_node *np) { return NULL; } +static inline struct device *of_find_any_device_by_node(struct device_node *np) +{ + return NULL; +} #endif /* Platform devices and busses creation */ From patchwork Wed Jan 10 03:47:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 123998 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4788366qgn; Tue, 9 Jan 2018 19:48:07 -0800 (PST) X-Google-Smtp-Source: ACJfBotWHcDuDcl97AhQD+6QPIcvreDCEJj+RzA57n6o7M8gsLWv7jrtq3WLmEKzoS7MKHSHdlQw X-Received: by 10.159.244.8 with SMTP id x8mr17645045plr.24.1515556087310; Tue, 09 Jan 2018 19:48:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556087; cv=none; d=google.com; s=arc-20160816; b=0PgihZpF/KehlmRBL1H1dtA1gQMiUtTeKencJlUGIdcMpFI8ANcf8TsCGGSFd5zfq7 7c5sRl0tBOUdMh7qgiTIPoiEN66sX9xo1mohakFAKRphhBB6QYx1s+V8PioKZXycdt8A R6dnprzVn0fVqa3R/h+ejiApZTpRBkqvoEZxF04FaL+avNFEVGAmSI7DFmG4sAJ+yWbE 2jwHyfx/3ApEVGW2yoCYFu+SIUPxsbX/wFCm8aAY5S+rrGAFsOwToCh95Lx2nD6hQOsZ djIGQ3aPbv1ibMJKv6c6pJ/JWl6FlQEgQXeUqY09jcfTQy4KWuXMUtFc9aGkCmYcW3D5 brww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=hu7kPGEaReq4+9/jCNp4EVxDei3L0FcSw0t3TsHucLE=; b=ch8GJEgbZ0vhPD4fBDErsIWe32J7tQyTwIrKfg2peiSJjUqtcKnwjDpxCYdn4MPUud oHZxI8aJdWmgLChYw8pvv1GmGerjuJwWeYcj+WjjSYDux033RRSZJdX1FCTAtbazZaFc s1JD4iwa8kDoFTeK2wPLKxkdZzFrFM7OCw9dl4bAAOJ07ev4RRqCsX+Dm7gSb3kLTQdc v8AQ3xACB6Do3vKqBZemLZu1VfFOIrJ3iMyRDbpkc4CF9pQv9s1FW+uVnxTWQnlaoDrq +ovX8n1RvQcUPItsF/2967z7fIfftaYrFpqMEhyzJzfWH5WiSntahkK+JFTSluWJpfSv +18g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EQ0fURib; 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 q4si11364208plb.249.2018.01.09.19.48.07; Tue, 09 Jan 2018 19:48:07 -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=EQ0fURib; 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 S965178AbeAJDsD (ORCPT + 28 others); Tue, 9 Jan 2018 22:48:03 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:38894 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965127AbeAJDr6 (ORCPT ); Tue, 9 Jan 2018 22:47:58 -0500 Received: by mail-pg0-f65.google.com with SMTP id t67so9803928pgc.5 for ; Tue, 09 Jan 2018 19:47:58 -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=hu7kPGEaReq4+9/jCNp4EVxDei3L0FcSw0t3TsHucLE=; b=EQ0fURibvu7+X6Zq+IGBmcLumH+nmFbRnAOg6xnQ0e8adZSKyawVXJlHHWdH2NVD+0 J68fZg1GE9ZbR9GNIOaSdYKxvHWbySJSdaU270uyse5+EXubxlFwvlxFZqLApzMMAHZo 1dVWlRo6devGYpb8VOvZelCVQ6N+prAt8wCaQ= 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=hu7kPGEaReq4+9/jCNp4EVxDei3L0FcSw0t3TsHucLE=; b=oIcF5NbQZZO2MWTkxkvvQubDaHcRBks25w79mYAdfLPcLSJBENUEQAygVq6WqUUwmN Lcp+Im3HYuzBIGqs+oOjDu25IogoLWAoNHABtmZfoMSxd04fuIl+Vfkp5NBkEscJz1vC lKTh1lm2PCS9OhsR5NRgwRPNzCzGZiSt2ViVHMCP+JJ9KSHs9VAdNUXNo3Mfe/3DsvbP H1izlf36dEHofTZfYymGUuz1F24SUylxIq13MstxizmRSQ+3aZgB5TwFhFiEezoSgk02 Jsuw2T5XXwOauKKn+2t1IUD0UTc8OneAV9dOqRSNZHPWv+BiWF1mY2fWAtJ/c7OYBqeJ ebcw== X-Gm-Message-State: AKGB3mLuVwoJH1qZ8w+sCpXiWbq1JhpagibB2gnJH7tHkKMZE9PX8t8C DIzdwjZGXWffDgbMSxlF3Rwkcg== X-Received: by 10.98.201.26 with SMTP id k26mr15705054pfg.103.1515556078099; Tue, 09 Jan 2018 19:47:58 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id v64sm33106083pfi.187.2018.01.09.19.47.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:47:57 -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 02/13] of: platform: Make of_platform_bus_create() global Date: Wed, 10 Jan 2018 09:17:31 +0530 Message-Id: <543ef96471882c52fa70183c41787bad442f8bcc.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The boot constraints core needs to create platform or AMBA devices corresponding to a compatible string and not for rest of the nodes in DT. of_platform_bus_create() fits in the best to achieve that. Allow it to be used outside of platform.c. Signed-off-by: Viresh Kumar --- drivers/of/platform.c | 8 ++++---- include/linux/of_platform.h | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 61a4a81bea9f..6f707bfb348f 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -397,10 +397,10 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l * Creates a platform_device for the provided device_node, and optionally * recursively create devices for all the child nodes. */ -static int of_platform_bus_create(struct device_node *bus, - const struct of_device_id *matches, - const struct of_dev_auxdata *lookup, - struct device *parent, bool strict) +int of_platform_bus_create(struct device_node *bus, + const struct of_device_id *matches, + const struct of_dev_auxdata *lookup, + struct device *parent, bool strict) { const struct of_dev_auxdata *auxdata; struct device_node *child; diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 4909d1aa47ec..ff80fba79c41 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -81,6 +81,10 @@ extern int of_platform_bus_probe(struct device_node *root, const struct of_device_id *matches, struct device *parent); #ifdef CONFIG_OF_ADDRESS +extern int of_platform_bus_create(struct device_node *bus, + const struct of_device_id *matches, + const struct of_dev_auxdata *lookup, + struct device *parent, bool strict); extern int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, @@ -94,6 +98,13 @@ extern int devm_of_platform_populate(struct device *dev); extern void devm_of_platform_depopulate(struct device *dev); #else +static inline int of_platform_bus_create(struct device_node *bus, + const struct of_device_id *matches, + const struct of_dev_auxdata *lookup, + struct device *parent, bool strict) +{ + return -ENODEV; +} static inline int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, From patchwork Wed Jan 10 03:47:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124009 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4791142qgn; Tue, 9 Jan 2018 19:52:17 -0800 (PST) X-Google-Smtp-Source: ACJfBouoca1YMz/7gLXh6wJxjggtDy6WuJ2aCePhc8vfOa8Sc1KyfT1FPvjv1qRinglodKlRLHo/ X-Received: by 10.84.245.130 with SMTP id j2mr8840993pll.135.1515556337249; Tue, 09 Jan 2018 19:52:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556337; cv=none; d=google.com; s=arc-20160816; b=x5v20WKiRtEwzwA1M3gS+gUWOqt4sDC/JqPk6ZAjvXYcGEpErpPc95/fPwoZzj58G6 1KtYrtUEjNakMa5+kqcxq6sj7IoFZawLEQ/+kLrG4TYhcBKhzlZqeDieodgSgVbO/DoX UUhv0oxhbe3cFwP2X1ilLxro8CiqtkT1Xl3VvTvHtmeP9pUUTGkfKf3EyM4BpNRkVcOU dwM24uxLUvf1CVeWZe60rbvlYZzZG67M4MKtt/I8CoKUis6pRZzoaCSQOHTpP3/YrtZ7 In9IuNYMTpKv4WWACEjf9D21zki1IsOkELTIy9LggjdtBTFeeZwghLqtQwnE6yWA2xtj 9TLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=I4gtuqEeIk+gFW3SKHr/L+XpPeTk2VF2aQ4spVtTCos=; b=tpl+1PLh6XWn06U6Mxxse2mLMJbI+qudvwVRb3Op4L/QaEXLl7um0agetwQu9LoKXM gugmGd3rgWgcG54seOGdur2LX1Fej4WNbCHeoGH6UvYkcyHy3gLnVjvyPGd8iC9zCaOv EwpZBqkK+AotCZBhqfSSVOhB30GyR0ywOymsVPVbfa1UuqqeUQqX0j4xUlnHnGu11qH8 uEKoyg5F1M2tquH2JIWuU9QcxhohnPzwCK82KE6BfiFRYFkqttSzP2jMIKNUn8AI6zQV p6JoVPnyg9c5QrGfoZm8G/HAOtTC6yfXO4yYaCrZ607QM2K+MTaufHwBPB2z1Z3J6PCk qsLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mi4Buhq6; 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 l28si11094338pfg.215.2018.01.09.19.52.16; Tue, 09 Jan 2018 19:52:17 -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=Mi4Buhq6; 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 S934006AbeAJDwP (ORCPT + 28 others); Tue, 9 Jan 2018 22:52:15 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:44556 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965167AbeAJDsB (ORCPT ); Tue, 9 Jan 2018 22:48:01 -0500 Received: by mail-pg0-f65.google.com with SMTP id i5so9808594pgq.11 for ; Tue, 09 Jan 2018 19:48:01 -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=I4gtuqEeIk+gFW3SKHr/L+XpPeTk2VF2aQ4spVtTCos=; b=Mi4Buhq62JqiGIVWbriMPaYnL+2ddGP2E4CMO6fNcMgtjWSajnVVpsy2+7C/7Gw2te dS/39v4iPNdhMxgARXniNbwPWjg5co3R0/9w24CmSaCQZrTqq/qxReY/TkKrGRXnFjMN VkwtTh6tuzFwhND5pHT8IUtTzhmNGglXyOIoc= 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=I4gtuqEeIk+gFW3SKHr/L+XpPeTk2VF2aQ4spVtTCos=; b=a4eCvZ3LmJEG36flynyybF311bsrj6ag3zyA7Vh12tAgkq0aIzXs3Rt+YXSSxE2taj fgOWs818bNKmSuFasTFhsLbR33Zakc3B1LQeJHZh4IqK5bnHP8OZz8AUYPs1tcAaCyFt QRHExq7KdRgz+jQ5Xns7bP/qoWA8sB0bi5q/fu7Hdc4RH4ZdX+LwrqrYLwzUGOLJRyld 8nP6vsv1HR3Oy600tXvygsiG8Jewk5rJAevTqQY76bcGb3RwH6VYAqVnYHu7f43pVybC 7i5cuDiaObIdaJtuw1BL3bsr3h/I26scVhq4f2s5kVskE2hcSOTCUpBP2109hKwrvVEG idKQ== X-Gm-Message-State: AKGB3mI3l/xoGnvfNuOlgFJ2wcKLm2C//evr0WQmPZQ+0Bx2yuWvErrG C1Ex102RPz5cdl8g5apSCcuwo8K4Of8= X-Received: by 10.98.234.4 with SMTP id t4mr15667966pfh.74.1515556080769; Tue, 09 Jan 2018 19:48:00 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id e8sm35021435pfk.6.2018.01.09.19.47.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:00 -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 03/13] drivers: Add boot constraints core Date: Wed, 10 Jan 2018 09:17:32 +0530 Message-Id: <02c600abd47f28f9c507ee1186440e51f985ba2e.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, PM domain, 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. This patch introduces the concept of boot-constraints, which will be set by the bootloaders and the kernel will satisfy them until the time driver for such a device is probed (successfully or unsuccessfully). The list of boot constraint types is empty for now, and will be incrementally updated by later patches. Only two routines are exposed by the boot constraints core for now: - dev_boot_constraint_add(): This shall be called by parts of the kernel (before the device is probed) to set the constraints. - dev_boot_constraints_remove(): This is called only by the driver core after a device is probed successfully or unsuccessfully. Special handling is done here for deferred probing. Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/base/dd.c | 20 ++-- drivers/boot_constraint/Kconfig | 9 ++ drivers/boot_constraint/Makefile | 3 + drivers/boot_constraint/core.c | 219 +++++++++++++++++++++++++++++++++++++++ drivers/boot_constraint/core.h | 30 ++++++ include/linux/boot_constraint.h | 66 ++++++++++++ 8 files changed, 343 insertions(+), 7 deletions(-) create mode 100644 drivers/boot_constraint/Kconfig create mode 100644 drivers/boot_constraint/Makefile create mode 100644 drivers/boot_constraint/core.c create mode 100644 drivers/boot_constraint/core.h create mode 100644 include/linux/boot_constraint.h -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/Kconfig b/drivers/Kconfig index 152744c5ef0f..6aa1629423d4 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -5,6 +5,8 @@ source "drivers/amba/Kconfig" source "drivers/base/Kconfig" +source "drivers/boot_constraint/Kconfig" + source "drivers/bus/Kconfig" source "drivers/connector/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index e06f7f633f73..3a2774672e29 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -73,6 +73,7 @@ obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/ obj-$(CONFIG_PARPORT) += parport/ obj-$(CONFIG_NVM) += lightnvm/ obj-y += base/ block/ misc/ mfd/ nfc/ +obj-$(CONFIG_DEV_BOOT_CONSTRAINT) += boot_constraint/ obj-$(CONFIG_LIBNVDIMM) += nvdimm/ obj-$(CONFIG_DAX) += dax/ obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/ diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 533c82f55cea..dc89f98a2487 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -16,6 +16,7 @@ * Copyright (c) 2007-2009 Novell Inc. */ +#include #include #include #include @@ -419,15 +420,20 @@ static int really_probe(struct device *dev, struct device_driver *drv) */ devices_kset_move_last(dev); - if (dev->bus->probe) { + if (dev->bus->probe) ret = dev->bus->probe(dev); - if (ret) - goto probe_failed; - } else if (drv->probe) { + else if (drv->probe) ret = drv->probe(dev); - if (ret) - goto probe_failed; - } + + /* + * Remove boot constraints for both successful and unsuccessful probe(), + * except for the case where EPROBE_DEFER is returned by probe(). + */ + if (ret != -EPROBE_DEFER) + dev_boot_constraints_remove(dev); + + if (ret) + goto probe_failed; if (test_remove) { test_remove = false; diff --git a/drivers/boot_constraint/Kconfig b/drivers/boot_constraint/Kconfig new file mode 100644 index 000000000000..9195f9a39fe2 --- /dev/null +++ b/drivers/boot_constraint/Kconfig @@ -0,0 +1,9 @@ +config DEV_BOOT_CONSTRAINT + bool "Boot constraints for devices" + help + This enables boot constraints detection for devices. These constraints + are (normally) set by the Bootloader and must be satisfied by the + kernel until the relevant device driver is probed. Once the driver is + probed, the constraint is dropped. + + If unsure, say N. diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile new file mode 100644 index 000000000000..0f2680177974 --- /dev/null +++ b/drivers/boot_constraint/Makefile @@ -0,0 +1,3 @@ +# Makefile for device boot constraints + +obj-y := core.o diff --git a/drivers/boot_constraint/core.c b/drivers/boot_constraint/core.c new file mode 100644 index 000000000000..45a0fbed1b11 --- /dev/null +++ b/drivers/boot_constraint/core.c @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * This takes care of boot time device constraints, normally set by the + * Bootloader. + * + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ + +#include +#include +#include +#include + +#include "core.h" + +#define for_each_constraint(_constraint, _temp, _cdev) \ + list_for_each_entry_safe(_constraint, _temp, &_cdev->constraints, node) + +/* Global list of all constraint devices currently registered */ +static LIST_HEAD(constraint_devices); +static DEFINE_MUTEX(constraint_devices_mutex); + +/* Boot constraints core */ + +static struct constraint_dev *constraint_device_find(struct device *dev) +{ + struct constraint_dev *cdev; + + list_for_each_entry(cdev, &constraint_devices, node) { + if (cdev->dev == dev) + return cdev; + } + + return NULL; +} + +static struct constraint_dev *constraint_device_allocate(struct device *dev) +{ + struct constraint_dev *cdev; + + cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); + if (!cdev) + return ERR_PTR(-ENOMEM); + + cdev->dev = dev; + INIT_LIST_HEAD(&cdev->node); + INIT_LIST_HEAD(&cdev->constraints); + + list_add(&cdev->node, &constraint_devices); + + return cdev; +} + +static void constraint_device_free(struct constraint_dev *cdev) +{ + list_del(&cdev->node); + kfree(cdev); +} + +static struct constraint_dev *constraint_device_get(struct device *dev) +{ + struct constraint_dev *cdev; + + cdev = constraint_device_find(dev); + if (cdev) + return cdev; + + cdev = constraint_device_allocate(dev); + if (IS_ERR(cdev)) { + dev_err(dev, "Failed to add constraint dev (%ld)\n", + PTR_ERR(cdev)); + } + + return cdev; +} + +static void constraint_device_put(struct constraint_dev *cdev) +{ + if (!list_empty(&cdev->constraints)) + return; + + constraint_device_free(cdev); +} + +static struct constraint *constraint_allocate(struct constraint_dev *cdev, + enum dev_boot_constraint_type type) +{ + struct constraint *constraint; + int (*add)(struct constraint *constraint, void *data); + void (*remove)(struct constraint *constraint); + + switch (type) { + default: + return ERR_PTR(-EINVAL); + } + + constraint = kzalloc(sizeof(*constraint), GFP_KERNEL); + if (!constraint) + return ERR_PTR(-ENOMEM); + + constraint->cdev = cdev; + constraint->type = type; + constraint->add = add; + constraint->remove = remove; + INIT_LIST_HEAD(&constraint->node); + + list_add(&constraint->node, &cdev->constraints); + + return constraint; +} + +static void constraint_free(struct constraint *constraint) +{ + list_del(&constraint->node); + kfree(constraint); +} + +/** + * dev_boot_constraint_add: Adds a boot constraint. + * + * @dev: Device for which the boot constraint is getting added. + * @info: Structure representing the boot constraint. + * + * This routine adds a single boot constraint for the device. This must be + * called before the device is probed by its driver, otherwise the boot + * constraint will never get removed and may result in unwanted behavior of the + * hardware. The boot constraint is removed by the driver core automatically + * after the device is probed (successfully or unsuccessfully). + * + * Return: 0 on success, and a negative error otherwise. + */ +int dev_boot_constraint_add(struct device *dev, + struct dev_boot_constraint_info *info) +{ + struct constraint_dev *cdev; + struct constraint *constraint; + int ret; + + mutex_lock(&constraint_devices_mutex); + + /* Find or add the cdev type first */ + cdev = constraint_device_get(dev); + if (IS_ERR(cdev)) { + ret = PTR_ERR(cdev); + goto unlock; + } + + constraint = constraint_allocate(cdev, info->constraint.type); + if (IS_ERR(constraint)) { + dev_err(dev, "Failed to add constraint type: %d (%ld)\n", + info->constraint.type, PTR_ERR(constraint)); + ret = PTR_ERR(constraint); + goto put_cdev; + } + + constraint->free_resources = info->free_resources; + constraint->free_resources_data = info->free_resources_data; + + /* Set constraint */ + ret = constraint->add(constraint, info->constraint.data); + if (ret) + goto free_constraint; + + dev_dbg(dev, "Added boot constraint-type (%d)\n", + info->constraint.type); + + mutex_unlock(&constraint_devices_mutex); + + return 0; + +free_constraint: + constraint_free(constraint); +put_cdev: + constraint_device_put(cdev); +unlock: + mutex_unlock(&constraint_devices_mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(dev_boot_constraint_add); + +static void constraint_remove(struct constraint *constraint) +{ + constraint->remove(constraint); + + if (constraint->free_resources) + constraint->free_resources(constraint->free_resources_data); + + constraint_free(constraint); +} + +/** + * dev_boot_constraints_remove: Removes all boot constraints of a device. + * + * @dev: Device for which the boot constraints are getting removed. + * + * This routine removes all the boot constraints that were previously added for + * the device. This is called directly by the driver core and should not be + * called by platform specific code. + */ +void dev_boot_constraints_remove(struct device *dev) +{ + struct constraint_dev *cdev; + struct constraint *constraint, *temp; + + mutex_lock(&constraint_devices_mutex); + + cdev = constraint_device_find(dev); + if (!cdev) + goto unlock; + + for_each_constraint(constraint, temp, cdev) + constraint_remove(constraint); + + constraint_device_put(cdev); +unlock: + mutex_unlock(&constraint_devices_mutex); +} diff --git a/drivers/boot_constraint/core.h b/drivers/boot_constraint/core.h new file mode 100644 index 000000000000..1e87125de531 --- /dev/null +++ b/drivers/boot_constraint/core.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ +#ifndef _CORE_H +#define _CORE_H + +#include +#include +#include + +struct constraint_dev { + struct device *dev; + struct list_head node; + struct list_head constraints; +}; + +struct constraint { + struct constraint_dev *cdev; + struct list_head node; + enum dev_boot_constraint_type type; + void (*free_resources)(void *data); + void *free_resources_data; + + int (*add)(struct constraint *constraint, void *data); + void (*remove)(struct constraint *constraint); + void *private; +}; +#endif /* _CORE_H */ diff --git a/include/linux/boot_constraint.h b/include/linux/boot_constraint.h new file mode 100644 index 000000000000..2ce62b7b3cc6 --- /dev/null +++ b/include/linux/boot_constraint.h @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Boot constraints header. + * + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ +#ifndef _LINUX_BOOT_CONSTRAINT_H +#define _LINUX_BOOT_CONSTRAINT_H + +#include +#include + +struct device; + +/** + * enum dev_boot_constraint_type - This defines different boot constraint types. + * + */ +enum dev_boot_constraint_type { + DEV_BOOT_CONSTRAINT_NONE, +}; + +/** + * struct dev_boot_constraint - This represents a single boot constraint. + * + * @type: This is boot constraint type (like: clk, supply, etc.). + * @data: This points to constraint type specific data (like: + * dev_boot_constraint_clk_info). + */ +struct dev_boot_constraint { + enum dev_boot_constraint_type type; + void *data; +}; + +/** + * struct dev_boot_constraint_info - This is used to add a single boot + * constraint. + * + * @constraint: This represents a single boot constraint. + * @free_resources: This callback is called by the boot constraint core after + * the constraint is removed. This is an optional field. + * @free_resources_data: This is data to be passed to free_resources() callback. + * This is an optional field. + */ +struct dev_boot_constraint_info { + struct dev_boot_constraint constraint; + + /* This will be called just before the constraint is removed */ + void (*free_resources)(void *data); + void *free_resources_data; +}; + +#ifdef CONFIG_DEV_BOOT_CONSTRAINT +int dev_boot_constraint_add(struct device *dev, + struct dev_boot_constraint_info *info); +void dev_boot_constraints_remove(struct device *dev); +#else +static inline +int dev_boot_constraint_add(struct device *dev, + struct dev_boot_constraint_info *info) +{ return 0; } +static inline void dev_boot_constraints_remove(struct device *dev) {} +#endif /* CONFIG_DEV_BOOT_CONSTRAINT */ + +#endif /* _LINUX_BOOT_CONSTRAINT_H */ From patchwork Wed Jan 10 03:47:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 123999 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4788433qgn; Tue, 9 Jan 2018 19:48:12 -0800 (PST) X-Google-Smtp-Source: ACJfBosRFwYWilGsEUwEg8fA6UUQ/tJ+wkfCIEMtTwsiuM/KJjnjkXZIPDVxvRfq22lpW0A0yilc X-Received: by 10.99.116.26 with SMTP id p26mr6294692pgc.320.1515556092645; Tue, 09 Jan 2018 19:48:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556092; cv=none; d=google.com; s=arc-20160816; b=W6Zo9xLZK6Eb1NOpc/1E2f7J0fx2tIBHoGsF0uHFVAZwg42Il6L5oerMymbA765tKJ dulqJ4jFM3kDwiTy6PLeES+TQIybsfrdioRhj/dZabAdzx7/3NgSEyqS8nSSiXf5LOJW P2u+yoKgD9sjR5kg+JAi+ybdrMNJJ/V0wMAVnqOkvxjp5XBKvSFV7Z2FcVFrMBVNVgHF MEE5KMg73irn4fhUcJfxOSzP9LuisP2dx1zZZpv4cd3RUAkb+6MRI7ljCulkmYKxld0Q ggA6mgQFeQxzHG1JLKH99AMLYrb3G2DsGiWaeKCr5r429EbYaTBf43Q6Ckyj4eYN/WE1 8b6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=icrIZ+0hNJgAa851BNV/t+RWElv/Pouel/nrtZERfj0=; b=Tg/0Fp55Uj5+Lu6q7t7JmbmO9KGZXqAaDe0IRlJxqtLR+nIYxPAK7QWDZvsrt9PO+x qKSOSAQnIqw3M80W60ezeC1BlndAiHcJ+Pze/bml8pXXAMx6oBqAbFon6AROEqCdqRT7 CKz8Vh4ZmjHk7BxHnD1+8hZox9g/rumD/x5n1gzNXxE9xWvrpVILoZawsF8NbuMjvo7A +wSst9L3CkUw6l44ldWRsI+bRbhPSEj4yL4aLLPyapM6giy08DrDu9Qz65ntoYsNiJnZ bvR/zZt67mNljvrQaJD4Y17+NaVeZtFHYa3yU4RAeZgD7tSA9ZScRlEgjcTiWOGnWHTv dqSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FsuGWVjm; 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 z10si2359910pgp.671.2018.01.09.19.48.12; Tue, 09 Jan 2018 19:48:12 -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=FsuGWVjm; 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 S965197AbeAJDsJ (ORCPT + 28 others); Tue, 9 Jan 2018 22:48:09 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:40046 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965127AbeAJDsE (ORCPT ); Tue, 9 Jan 2018 22:48:04 -0500 Received: by mail-pl0-f68.google.com with SMTP id 62so6514594pld.7 for ; Tue, 09 Jan 2018 19:48:03 -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=icrIZ+0hNJgAa851BNV/t+RWElv/Pouel/nrtZERfj0=; b=FsuGWVjmrjoP6gbAnwUYNa+tEj3CEtPecf2VQrkU013fAkqO5N/8jmQtBKtOH4dGzP R0f9iL3OB6WmNbhdW7BqvHxpsyRE9j2z8uRlyAf5/9HmtwB1dR5RjRwuZfzEsG7Gz9H3 dB/smse3ZeHLHc1Pd7tsR5l7yBaN0Fpc6isiY= 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=icrIZ+0hNJgAa851BNV/t+RWElv/Pouel/nrtZERfj0=; b=rz+CDefoCinsg9QylIE6K/Se7O0qqvV8M78sc8/0QQBJ4AkiDR5jhVMlrSBgsig2eb aXJual2wiNlrTczQeRBcdEKdqtsxmjOXTQQILq7NhDo5MA8F6rQmBVqzl8/irzhKQrLk zXpO+V6l3V7lpZmOH5pCZK3wT+lWSgEqHz+pkEEDuIUDc5deRShyYkYsXU+vdIUjhVxl x0pS17P4cfWxPkxqRISwRT7y2R5CUKhJ9diBQRvOFycxYiUZz0VXEyDVbAaEW52GbI3f 0FQi2RAMFKxf1VTyWyFFXJQYBA9vv/QTGwCBg0brDkyPFjSfXfPkV3AYxyPCQtcPzpHH uFXw== X-Gm-Message-State: AKGB3mLR0w7HRO0VgL2fqWY+Q4NnprDSfiZ/YOmA3sTIidqRwgtNWjXN N7Lia6AStUcywChbnIdKbkG6tQ== X-Received: by 10.84.211.9 with SMTP id b9mr17612156pli.152.1515556083478; Tue, 09 Jan 2018 19:48:03 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id m22sm33124727pfg.120.2018.01.09.19.48.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:02 -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 04/13] boot_constraint: Add support for supply constraints Date: Wed, 10 Jan 2018 09:17:33 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the first constraint type: power-supply. The constraint is set by enabling the regulator and setting a voltage range (if required) for the respective regulator device, which will be honored by the regulator core even if more users turn up. Once the device is probed, the regulator is released and the constraint is removed. Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/boot_constraint/Makefile | 2 +- drivers/boot_constraint/core.c | 4 ++ drivers/boot_constraint/core.h | 5 +++ drivers/boot_constraint/supply.c | 95 ++++++++++++++++++++++++++++++++++++++++ include/linux/boot_constraint.h | 17 ++++++- 5 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 drivers/boot_constraint/supply.c -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile index 0f2680177974..a45616f0c3b0 100644 --- a/drivers/boot_constraint/Makefile +++ b/drivers/boot_constraint/Makefile @@ -1,3 +1,3 @@ # Makefile for device boot constraints -obj-y := core.o +obj-y := core.o supply.o diff --git a/drivers/boot_constraint/core.c b/drivers/boot_constraint/core.c index 45a0fbed1b11..63a4b1a2fa2c 100644 --- a/drivers/boot_constraint/core.c +++ b/drivers/boot_constraint/core.c @@ -91,6 +91,10 @@ static struct constraint *constraint_allocate(struct constraint_dev *cdev, void (*remove)(struct constraint *constraint); switch (type) { + case DEV_BOOT_CONSTRAINT_SUPPLY: + add = constraint_supply_add; + remove = constraint_supply_remove; + break; default: return ERR_PTR(-EINVAL); } diff --git a/drivers/boot_constraint/core.h b/drivers/boot_constraint/core.h index 1e87125de531..d0d3e7bf7d57 100644 --- a/drivers/boot_constraint/core.h +++ b/drivers/boot_constraint/core.h @@ -27,4 +27,9 @@ struct constraint { void (*remove)(struct constraint *constraint); void *private; }; + +/* Forward declarations of constraint specific callbacks */ +int constraint_supply_add(struct constraint *constraint, void *data); +void constraint_supply_remove(struct constraint *constraint); + #endif /* _CORE_H */ diff --git a/drivers/boot_constraint/supply.c b/drivers/boot_constraint/supply.c new file mode 100644 index 000000000000..916e5d6848d5 --- /dev/null +++ b/drivers/boot_constraint/supply.c @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ + +#include +#include +#include + +#include "core.h" + +struct constraint_supply { + struct dev_boot_constraint_supply_info supply; + struct regulator *reg; +}; + +int constraint_supply_add(struct constraint *constraint, void *data) +{ + struct dev_boot_constraint_supply_info *supply = data; + struct constraint_supply *csupply; + struct device *dev = constraint->cdev->dev; + int ret; + + csupply = kzalloc(sizeof(*csupply), GFP_KERNEL); + if (!csupply) + return -ENOMEM; + + csupply->reg = regulator_get(dev, supply->name); + if (IS_ERR(csupply->reg)) { + ret = PTR_ERR(csupply->reg); + if (ret != -EPROBE_DEFER) { + dev_err(dev, "regulator_get() failed for %s (%d)\n", + supply->name, ret); + } + goto free; + } + + if (supply->u_volt_min != 0 && supply->u_volt_max != 0) { + ret = regulator_set_voltage(csupply->reg, supply->u_volt_min, + supply->u_volt_max); + if (ret) { + dev_err(dev, "regulator_set_voltage %s failed (%d)\n", + supply->name, ret); + goto free_regulator; + } + } + + ret = regulator_enable(csupply->reg); + if (ret) { + dev_err(dev, "regulator_enable %s failed (%d)\n", + supply->name, ret); + goto remove_voltage; + } + + memcpy(&csupply->supply, supply, sizeof(*supply)); + csupply->supply.name = kstrdup_const(supply->name, GFP_KERNEL); + constraint->private = csupply; + + return 0; + +remove_voltage: + if (supply->u_volt_min != 0 && supply->u_volt_max != 0) + regulator_set_voltage(csupply->reg, 0, INT_MAX); +free_regulator: + regulator_put(csupply->reg); +free: + kfree(csupply); + + return ret; +} + +void constraint_supply_remove(struct constraint *constraint) +{ + struct constraint_supply *csupply = constraint->private; + struct dev_boot_constraint_supply_info *supply = &csupply->supply; + struct device *dev = constraint->cdev->dev; + int ret; + + kfree_const(supply->name); + + ret = regulator_disable(csupply->reg); + if (ret) + dev_err(dev, "regulator_disable failed (%d)\n", ret); + + if (supply->u_volt_min != 0 && supply->u_volt_max != 0) { + ret = regulator_set_voltage(csupply->reg, 0, INT_MAX); + if (ret) + dev_err(dev, "regulator_set_voltage failed (%d)\n", + ret); + } + + regulator_put(csupply->reg); + kfree(csupply); +} diff --git a/include/linux/boot_constraint.h b/include/linux/boot_constraint.h index 2ce62b7b3cc6..1db24d53b622 100644 --- a/include/linux/boot_constraint.h +++ b/include/linux/boot_constraint.h @@ -16,9 +16,24 @@ struct device; /** * enum dev_boot_constraint_type - This defines different boot constraint types. * + * @DEV_BOOT_CONSTRAINT_SUPPLY: This represents a power supply boot constraint. */ enum dev_boot_constraint_type { - DEV_BOOT_CONSTRAINT_NONE, + DEV_BOOT_CONSTRAINT_SUPPLY, +}; + +/** + * struct dev_boot_constraint_supply_info - Power supply boot constraint + * information. + * + * @name: This must match the power supply name for the device. + * @u_volt_min: This is the minimum microvolts value supported by the device. + * @u_volt_max: This is the maximum microvolts value supported by the device. + */ +struct dev_boot_constraint_supply_info { + const char *name; + unsigned int u_volt_min; + unsigned int u_volt_max; }; /** From patchwork Wed Jan 10 03:47:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124008 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4790375qgn; Tue, 9 Jan 2018 19:51:08 -0800 (PST) X-Google-Smtp-Source: ACJfBot9oyWAe6lIOqLDDAzk1JDDbAwea7uiO3NaShjEk5mBAcGYTN57Pe0sVuls3uF3bQPPvU3t X-Received: by 10.101.69.13 with SMTP id n13mr13728896pgq.91.1515556268691; Tue, 09 Jan 2018 19:51:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556268; cv=none; d=google.com; s=arc-20160816; b=ctcyU6CWAwmhR4HewR9RPVc9UALW81vznv9TuZ7KiBw7njHWZ00qKRqKrVsulOC8mL uVca2UK4UASyIysorl05mJu4Kkyj4IYmnUP5fy+4gr6b2Qyro+oPMFW45QJX0S4+ojZn 6HKqKQDVmfKQ/uM2MUyZAoewrNrYemjrow5yqJE58jjTHbc125PwiWpphed4ZyWk4Ffb S0xiuF5xA+6yjJ1sKx1x2hSYGG+POFpfkHvHRA6r3hUKoFuSnbhF2FgcesE9nDQrnKS1 lqPtjXnzIeu0ADfrman0ZBIRCqmS8WF9jl6nglR/GlbzrMWLId5vmXGqv7/UvJxLisoP xPIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=96/PenY+L4PT6MZMyfgg3j5Cpr3agCdGKBAcQne3S8E=; b=hq7LNru86umq3Ohb8ktl/vs66yJLPSY7u5fKbxtkzjb4DFBpBQoe1ajnA1mDxKLsrK 94x6Cqm40DE/kqU6fE6jwSZ/mnFC5ii6DvYsUco1UUufkc0CCbZKer0xlr9HdqztQ8D+ eRqurJXBA57sZQ3xZRbHp5do+Qe2mKmRjyWcYHbeUaE6qli0wY5V70jjMAmt8X7SzNfW BYmVLO14KZ7cXJUoU02x7PBdodnS5EieO0iRIxW2EKjVXiM1bIrKuKN3HUYGptFtFfk4 SSNIBUYTn40dxRGGlDbKIBCbb+EFxZfeBn25p/NI6b/ji1RkW5kGWTWPk9/UdS5/TKAd X9TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iyz/0Sxt; 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 68si11034442pff.213.2018.01.09.19.51.08; Tue, 09 Jan 2018 19:51:08 -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=iyz/0Sxt; 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 S1756486AbeAJDvG (ORCPT + 28 others); Tue, 9 Jan 2018 22:51:06 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:45065 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965185AbeAJDsG (ORCPT ); Tue, 9 Jan 2018 22:48:06 -0500 Received: by mail-pg0-f67.google.com with SMTP id c194so8835139pga.12 for ; Tue, 09 Jan 2018 19:48:06 -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=96/PenY+L4PT6MZMyfgg3j5Cpr3agCdGKBAcQne3S8E=; b=iyz/0Sxt+/4VHMJKlh9mzBjWSxrDMDSS/rlhHi2NeDHj05lD0VM9zOf3kGDiVcCu+o 0YDeJ8lDpWGY/wDtnvT3H1kfdthv3KszimIJ/4kJKTqO3pWbND3q8Cw3m2x3mf3GWmoI BpJoJCyhaUKrQ9aJa3buq+f3Y0hxpYPR9ynaw= 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=96/PenY+L4PT6MZMyfgg3j5Cpr3agCdGKBAcQne3S8E=; b=FPTum7mfDvK/bQ1Rx8UcrLUHktgzdnlcyxvf/SLYajG717WYIqU/mO9SMOjWCbdGN3 t4qAglD5TFnjVOPuMcWTJi5sWHwvEbBTTf3+fdBCOdc2GiEN+O3bS4kxo+pVzf4QWM+k RHSSoJC7umOI9L8NzvuFgbhk9YBXznPDSRvwbgctA/HOPuKRXFdesyLUmbx119hrNh5p KCprlt77yPfAjAkyapkFXcAuQXhs8Z+rYI2lOTkfBQaoF8jTHaEUJ9oNhSkm8jXj3MG1 YlTqZ7rPMYNvy3lOy8lJm/ppcuQeV+J3Yf2qdit0ZRHzsCPAHp8Z48TFH789cDvNQ3Zl qQlA== X-Gm-Message-State: AKGB3mJis3kC7lQ1DIxFwHcwLkF75DIUMGyVXZ0Y6ZSXnqsk9/tkEOKl pU7qWsCpglEvi8s4TOYsONY7NQ== X-Received: by 10.98.67.151 with SMTP id l23mr15765807pfi.194.1515556086012; Tue, 09 Jan 2018 19:48:06 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id a22sm36343410pfc.47.2018.01.09.19.48.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:05 -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 05/13] boot_constraint: Add support for clk constraints Date: Wed, 10 Jan 2018 09:17:34 +0530 Message-Id: <282c37b14c0f6102b6748e26314455c64d5fe46b.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the clk constraint type. The constraint is set by enabling the clk for the device. Once the device is probed, the clk is disabled and the constraint is removed. We may want to do clk_set_rate() from here, but lets wait for some real users that really want it. Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/boot_constraint/Makefile | 2 +- drivers/boot_constraint/clk.c | 67 ++++++++++++++++++++++++++++++++++++++++ drivers/boot_constraint/core.c | 4 +++ drivers/boot_constraint/core.h | 3 ++ include/linux/boot_constraint.h | 11 +++++++ 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 drivers/boot_constraint/clk.c -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile index a45616f0c3b0..3424379fd1e4 100644 --- a/drivers/boot_constraint/Makefile +++ b/drivers/boot_constraint/Makefile @@ -1,3 +1,3 @@ # Makefile for device boot constraints -obj-y := core.o supply.o +obj-y := clk.o core.o supply.o diff --git a/drivers/boot_constraint/clk.c b/drivers/boot_constraint/clk.c new file mode 100644 index 000000000000..db22acff43e6 --- /dev/null +++ b/drivers/boot_constraint/clk.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ + +#include +#include +#include + +#include "core.h" + +struct constraint_clk { + struct dev_boot_constraint_clk_info clk_info; + struct clk *clk; +}; + +int constraint_clk_add(struct constraint *constraint, void *data) +{ + struct dev_boot_constraint_clk_info *clk_info = data; + struct constraint_clk *cclk; + struct device *dev = constraint->cdev->dev; + int ret; + + cclk = kzalloc(sizeof(*cclk), GFP_KERNEL); + if (!cclk) + return -ENOMEM; + + cclk->clk = clk_get(dev, clk_info->name); + if (IS_ERR(cclk->clk)) { + ret = PTR_ERR(cclk->clk); + if (ret != -EPROBE_DEFER) { + dev_err(dev, "clk_get() failed for %s (%d)\n", + clk_info->name, ret); + } + goto free; + } + + ret = clk_prepare_enable(cclk->clk); + if (ret) { + dev_err(dev, "clk_prepare_enable() %s failed (%d)\n", + clk_info->name, ret); + goto put_clk; + } + + cclk->clk_info.name = kstrdup_const(clk_info->name, GFP_KERNEL); + constraint->private = cclk; + + return 0; + +put_clk: + clk_put(cclk->clk); +free: + kfree(cclk); + + return ret; +} + +void constraint_clk_remove(struct constraint *constraint) +{ + struct constraint_clk *cclk = constraint->private; + + kfree_const(cclk->clk_info.name); + clk_disable_unprepare(cclk->clk); + clk_put(cclk->clk); + kfree(cclk); +} diff --git a/drivers/boot_constraint/core.c b/drivers/boot_constraint/core.c index 63a4b1a2fa2c..df9e0bddbfbe 100644 --- a/drivers/boot_constraint/core.c +++ b/drivers/boot_constraint/core.c @@ -91,6 +91,10 @@ static struct constraint *constraint_allocate(struct constraint_dev *cdev, void (*remove)(struct constraint *constraint); switch (type) { + case DEV_BOOT_CONSTRAINT_CLK: + add = constraint_clk_add; + remove = constraint_clk_remove; + break; case DEV_BOOT_CONSTRAINT_SUPPLY: add = constraint_supply_add; remove = constraint_supply_remove; diff --git a/drivers/boot_constraint/core.h b/drivers/boot_constraint/core.h index d0d3e7bf7d57..720bda0a0f44 100644 --- a/drivers/boot_constraint/core.h +++ b/drivers/boot_constraint/core.h @@ -29,6 +29,9 @@ struct constraint { }; /* Forward declarations of constraint specific callbacks */ +int constraint_clk_add(struct constraint *constraint, void *data); +void constraint_clk_remove(struct constraint *constraint); + int constraint_supply_add(struct constraint *constraint, void *data); void constraint_supply_remove(struct constraint *constraint); diff --git a/include/linux/boot_constraint.h b/include/linux/boot_constraint.h index 1db24d53b622..d798355fd93f 100644 --- a/include/linux/boot_constraint.h +++ b/include/linux/boot_constraint.h @@ -16,12 +16,23 @@ struct device; /** * enum dev_boot_constraint_type - This defines different boot constraint types. * + * @DEV_BOOT_CONSTRAINT_CLK: This represents a clock boot constraint. * @DEV_BOOT_CONSTRAINT_SUPPLY: This represents a power supply boot constraint. */ enum dev_boot_constraint_type { + DEV_BOOT_CONSTRAINT_CLK, DEV_BOOT_CONSTRAINT_SUPPLY, }; +/** + * struct dev_boot_constraint_clk_info - Clock boot constraint information. + * + * @name: This must match the connection-id of the clock for the device. + */ +struct dev_boot_constraint_clk_info { + const char *name; +}; + /** * struct dev_boot_constraint_supply_info - Power supply boot constraint * information. From patchwork Wed Jan 10 03:47:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124004 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4789406qgn; Tue, 9 Jan 2018 19:49:33 -0800 (PST) X-Google-Smtp-Source: ACJfBosjHZFGzVlSq4rfeb/Ff0LQpFM3JUs31mG7LSmVannSNNXa69b8ZV9ImDjQNmYowwAVoO7h X-Received: by 10.159.245.150 with SMTP id a22mr8687015pls.60.1515556173795; Tue, 09 Jan 2018 19:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556173; cv=none; d=google.com; s=arc-20160816; b=xrh4x1uJMbYbtnrpsVoFoyy7dyRpktULQLjCP01GW+drNv6rxB5+ciI3pjQ9duqa4B 7PsoK6b2gYV2GLtEnexDRSWQYsv60nOHgIE/i+yzjjrxZVInO0YMq6RVPBF3bnuzFtP3 u/RS9iY4Gw+k3NsQVWt0Z407eDPaVNfoi6SmnRSWBbFSG02ruJ8Ij27LeGRE1omyoL1U ruJ7LWBS+hpbgeZnj0tVK/isJmLjOmr2Ngz4OGA5FDavN2rjIEr8bgxWpam7gibiyIzz KQvJT4NbGFnixfcrIRf5mOhoYvsPnuz9OWui+0VEO2LpYJKD/+jZIDmxn4U/m42f+zPF WUsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=yOVDowshOOB3m6GCsZb+K+vIW7RioybFuH6xJnqS0Kg=; b=iREJIzybr3SqgnXcBMiZCj16l5ihRKW4LqMEYkt7zt+uTxUf+es0XtJkFwo6T/zBzP QRi2qffu0dX0cl1rxp89JqZWrHVMvlT+uLsq7bgo6OyzPkAXB3eQj98LKyrlGwlSzUiM 95U1EJzMS4z8vQe03nLcAU0z9BuyMx+B2kqIFs62AluQtEoHnZDDO2yQBnTKWCRBaGSz h0/GR57oaQyA0lXEplP5bW/s5hUBzufjS374qKRZhlo8GLXyUA+YI4UDIfJtbhjbIRaD Uhw9ANOfFPqxetzQN4jEH5u7EoPSY1bxd2+cngQ82xILBo6gfQYd56UVMc2yNNJT+8ag nCHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qsfgcj+c; 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 d3si11653225pln.700.2018.01.09.19.49.33; Tue, 09 Jan 2018 19:49:33 -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=Qsfgcj+c; 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 S965217AbeAJDsS (ORCPT + 28 others); Tue, 9 Jan 2018 22:48:18 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35076 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965196AbeAJDsJ (ORCPT ); Tue, 9 Jan 2018 22:48:09 -0500 Received: by mail-pg0-f67.google.com with SMTP id d6so8750710pgv.2 for ; Tue, 09 Jan 2018 19:48:08 -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=yOVDowshOOB3m6GCsZb+K+vIW7RioybFuH6xJnqS0Kg=; b=Qsfgcj+c9tH9G7ml7XFBEvCd83NwFnzFswhmCeR1aoFmpG6kAXRXFCGYfSsJekvoXR a4zU4YWoN/yCavK5Vn/hRo+qQnOCbWDkJnee2JX4/MLmc0xMBNJgSTZHMD+BHw9BV33m 2B091pFFwZsBs+XQpOoHGTMcv/HxmkWcZ/6XQ= 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=yOVDowshOOB3m6GCsZb+K+vIW7RioybFuH6xJnqS0Kg=; b=WLhc6n4SryvaTCSi4v7RK6+A24pjZum9LXBHGONPpHWBhaXjNn8C73Wd+JncIwtwVx yeCJ3OcHvvt/dxvd3LF2JsZ96zpxwQiv2+54mdWjnjr7pc7rsCdr9257EHokGP5FMB1e Tiv497yuKkC6tdvhUDs6o0M9ldpAYhKDA3yvXGYKVOZZx52RrGUUjQHlzqd9ZWp77cV9 PFYUUevsoDlwREisdGBWnOERYM/SLNy5HcTi6FtkjQdUUZtx+z6yzCqYoubSaII5nLac bKFD6d20k2qkg5RHF1DVEUVhM0PnBzJny9h3mF4bCw/tksOeQef+XAyd9cbrEXTm1Oby kx5A== X-Gm-Message-State: AKGB3mKbBeuCK/Hp+ZBGTZHEalz+hwFMGnxHX2o4StoyLiurp6874p0p HZAqdf3wpP+CDTEshm/XD5DzAw== X-Received: by 10.98.80.70 with SMTP id e67mr15396375pfb.93.1515556088588; Tue, 09 Jan 2018 19:48:08 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id e8sm27182530pgs.44.2018.01.09.19.48.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:08 -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 06/13] boot_constraint: Add support for PM constraints Date: Wed, 10 Jan 2018 09:17:35 +0530 Message-Id: <231bb37457dd0d420116afeabd0b13683410fc09.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the PM constraint type. The constraint is set by attaching the power domain for the device, which will also enable the power domain. This guarantees that the power domain doesn't get shut down while being used. We don't need to detach the power domain to remove the constraint as the domain is attached only once, from here or before driver probe. Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/boot_constraint/Makefile | 2 +- drivers/boot_constraint/core.c | 4 ++++ drivers/boot_constraint/core.h | 3 +++ drivers/boot_constraint/pm.c | 21 +++++++++++++++++++++ include/linux/boot_constraint.h | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 drivers/boot_constraint/pm.c -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile index 3424379fd1e4..b7ade1a7afb5 100644 --- a/drivers/boot_constraint/Makefile +++ b/drivers/boot_constraint/Makefile @@ -1,3 +1,3 @@ # Makefile for device boot constraints -obj-y := clk.o core.o supply.o +obj-y := clk.o core.o pm.o supply.o diff --git a/drivers/boot_constraint/core.c b/drivers/boot_constraint/core.c index df9e0bddbfbe..b36c02aa50c5 100644 --- a/drivers/boot_constraint/core.c +++ b/drivers/boot_constraint/core.c @@ -95,6 +95,10 @@ static struct constraint *constraint_allocate(struct constraint_dev *cdev, add = constraint_clk_add; remove = constraint_clk_remove; break; + case DEV_BOOT_CONSTRAINT_PM: + add = constraint_pm_add; + remove = constraint_pm_remove; + break; case DEV_BOOT_CONSTRAINT_SUPPLY: add = constraint_supply_add; remove = constraint_supply_remove; diff --git a/drivers/boot_constraint/core.h b/drivers/boot_constraint/core.h index 720bda0a0f44..c5b27617b4ae 100644 --- a/drivers/boot_constraint/core.h +++ b/drivers/boot_constraint/core.h @@ -32,6 +32,9 @@ struct constraint { int constraint_clk_add(struct constraint *constraint, void *data); void constraint_clk_remove(struct constraint *constraint); +int constraint_pm_add(struct constraint *constraint, void *data); +void constraint_pm_remove(struct constraint *constraint); + int constraint_supply_add(struct constraint *constraint, void *data); void constraint_supply_remove(struct constraint *constraint); diff --git a/drivers/boot_constraint/pm.c b/drivers/boot_constraint/pm.c new file mode 100644 index 000000000000..4950ec6b248b --- /dev/null +++ b/drivers/boot_constraint/pm.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ + +#include + +#include "core.h" + +int constraint_pm_add(struct constraint *constraint, void *data) +{ + struct device *dev = constraint->cdev->dev; + + return dev_pm_domain_attach(dev, true); +} + +void constraint_pm_remove(struct constraint *constraint) +{ + /* Nothing to do for now */ +} diff --git a/include/linux/boot_constraint.h b/include/linux/boot_constraint.h index d798355fd93f..12fac0d565b0 100644 --- a/include/linux/boot_constraint.h +++ b/include/linux/boot_constraint.h @@ -17,10 +17,12 @@ struct device; * enum dev_boot_constraint_type - This defines different boot constraint types. * * @DEV_BOOT_CONSTRAINT_CLK: This represents a clock boot constraint. + * @DEV_BOOT_CONSTRAINT_PM: This represents a power domain boot constraint. * @DEV_BOOT_CONSTRAINT_SUPPLY: This represents a power supply boot constraint. */ enum dev_boot_constraint_type { DEV_BOOT_CONSTRAINT_CLK, + DEV_BOOT_CONSTRAINT_PM, DEV_BOOT_CONSTRAINT_SUPPLY, }; From patchwork Wed Jan 10 03:47:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124007 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4790200qgn; Tue, 9 Jan 2018 19:50:52 -0800 (PST) X-Google-Smtp-Source: ACJfBovGLX5T8zhsA+pLMRPT2x3Yt/sdbkxrDFpYwJ5YkMR4Z+lA/dSn/BXXVK+W6tYdgGcdKEo1 X-Received: by 10.98.14.75 with SMTP id w72mr15571805pfi.240.1515556251937; Tue, 09 Jan 2018 19:50:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556251; cv=none; d=google.com; s=arc-20160816; b=bL7Iq1MgC1tslYQhaW/sfLGZpTwHPSKUT+lHOhOWn+N/oQp42LvWEQ1n8GYIDiPw0Z BM3Yv04O6GY8dQ6yFl/BwTxam4BJ8HKElvNvJRRopEbrig+OTMqn/BqjT+69SgM0QGre RODJZb96aEcaLp2GOyoWAyhi4vL9hkjlQ3pHVAHv1T8IzB8GJpDofw7SRCWWulqXNlQF 7CCrGgxVXZHERB7pPP/5C0IxDBvn0/p4/z19QYoaBlpBp0X40eaO3VQ1b08nOhm0mQDn JLltHpLPhkMPVjl0Bl0sWJncF9SBmm2lqjN2VWdBnsqaGOMO9GC1ouJWUtgp7EJvEuuz x7Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Y9LAhMI7yhCkqOWCqeEdKg7pECc3enz78Dn0k4Sy7n4=; b=zN8adl8aMXrnwA6ZhH3tcsWQIYGpxz6ynEOj+njCkXLvqHgPG7xJjw1JfpKGXFZEK1 FBlJEpDr0eLxLP14sdDHgyFGPGkrumWiVWkocIGpzHLeW8S17zvhWzE3h48XLEwqotW+ 6MqbJ44CDIZmeemyHe1dZAM/jJ2wqIEd8AvLOxtq5yz9s/vdyJ50brazp+4Ru8jR6CNz YIj6WYzEwbHg2kjVy4/X8ImQcG7jbr8iyNDag/2cbVNP9LL7W8/piD4fRJ3ISoylRwm9 fk4d+T7QkwCxjIygt5j1/TSJeiYd1/V5tPLG8gF+/qTeKaLHOAY9ME1a9KKJBJMyH2Zn 8gQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c3PeOr6U; 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 r7si3795507pfh.262.2018.01.09.19.50.51; Tue, 09 Jan 2018 19:50:51 -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=c3PeOr6U; 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 S1756200AbeAJDuf (ORCPT + 28 others); Tue, 9 Jan 2018 22:50:35 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:44574 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965181AbeAJDsM (ORCPT ); Tue, 9 Jan 2018 22:48:12 -0500 Received: by mail-pg0-f65.google.com with SMTP id i5so9808941pgq.11 for ; Tue, 09 Jan 2018 19:48:12 -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=Y9LAhMI7yhCkqOWCqeEdKg7pECc3enz78Dn0k4Sy7n4=; b=c3PeOr6UYwegIAxqel7kamm4xbJThWTBjJAt8Kw3j+UNGMjM8rWPsu44KBRm6yMht0 MKtEmRrXa2Gce7vjsojz7gIhG4nouZfhHgQJ6OR+ULMeUrXsd/IcAjbjgFhcejzlV5xG TBrK506py5yyXrnc/yy4D+POjIjIXsdaLggGI= 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=Y9LAhMI7yhCkqOWCqeEdKg7pECc3enz78Dn0k4Sy7n4=; b=N9PIgF73Vr2UPeSKikPpiQxHW5fI82I959Gsp61VtOo4LH1FKlqsuRjxLzkwRzCBD6 kk794uJSPsFqXieqfJ9dkDpN+QrpNE0uMGpXybJpKKwdhGVUlQHtS5v5BXeV/vXfqKJd LN1GcIXTnTz/T0PF7e+/VLyHC8UfpVYVuIZiiUnw6Pelob6GdMS4+biUnvaWUOivCWC+ DLaQz52zU5ozLpp+25lZ3cNlOHJqf/xy1fwMGZblCrJymhn5GIF2kuTIK7DfmWhS4mY5 T2beammzVvoKyXPuKLM9FJuSQFN7TIy2Szlbd3pEtIsJHHKs/wdi7xP9u1hLT5U/lNlG IASQ== X-Gm-Message-State: AKGB3mLVb5BqgHZWy/77F1FHV4RxDh5bJnoA+CcxsBtRZmnzV6jwnIS8 i/tZau5hycFZNhatlJ5ur9sPMg== X-Received: by 10.98.11.130 with SMTP id 2mr8985618pfl.190.1515556091296; Tue, 09 Jan 2018 19:48:11 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id t80sm9194955pgb.88.2018.01.09.19.48.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:10 -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 07/13] boot_constraint: Add debugfs support Date: Wed, 10 Jan 2018 09:17:36 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds debugfs support for boot constraints. This is how it looks for a "vmmc-supply" constraint for the MMC device. $ ls -R /sys/kernel/debug/boot_constraints/ /sys/kernel/debug/boot_constraints/: f723d000.dwmmc0 /sys/kernel/debug/boot_constraints/f723d000.dwmmc0: clk-ciu pm-domain supply-vmmc supply-vmmcaux /sys/kernel/debug/boot_constraints/f723d000.dwmmc0/clk-ciu: /sys/kernel/debug/boot_constraints/f723d000.dwmmc0/pm-domain: /sys/kernel/debug/boot_constraints/f723d000.dwmmc0/supply-vmmc: u_volt_max u_volt_min /sys/kernel/debug/boot_constraints/f723d000.dwmmc0/supply-vmmcaux: u_volt_max u_volt_min Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/boot_constraint/clk.c | 3 ++ drivers/boot_constraint/core.c | 59 ++++++++++++++++++++++++++++++++++++++++ drivers/boot_constraint/core.h | 6 ++++ drivers/boot_constraint/pm.c | 11 ++++++-- drivers/boot_constraint/supply.c | 9 ++++++ 5 files changed, 86 insertions(+), 2 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/boot_constraint/clk.c b/drivers/boot_constraint/clk.c index db22acff43e6..ebc871c29a83 100644 --- a/drivers/boot_constraint/clk.c +++ b/drivers/boot_constraint/clk.c @@ -46,6 +46,8 @@ int constraint_clk_add(struct constraint *constraint, void *data) cclk->clk_info.name = kstrdup_const(clk_info->name, GFP_KERNEL); constraint->private = cclk; + constraint_add_debugfs(constraint, clk_info->name); + return 0; put_clk: @@ -60,6 +62,7 @@ void constraint_clk_remove(struct constraint *constraint) { struct constraint_clk *cclk = constraint->private; + constraint_remove_debugfs(constraint); kfree_const(cclk->clk_info.name); clk_disable_unprepare(cclk->clk); clk_put(cclk->clk); diff --git a/drivers/boot_constraint/core.c b/drivers/boot_constraint/core.c index b36c02aa50c5..0350c5057ee5 100644 --- a/drivers/boot_constraint/core.c +++ b/drivers/boot_constraint/core.c @@ -21,6 +21,63 @@ static LIST_HEAD(constraint_devices); static DEFINE_MUTEX(constraint_devices_mutex); +/* Debugfs */ + +static struct dentry *rootdir; + +static void constraint_device_add_debugfs(struct constraint_dev *cdev) +{ + struct device *dev = cdev->dev; + + cdev->dentry = debugfs_create_dir(dev_name(dev), rootdir); +} + +static void constraint_device_remove_debugfs(struct constraint_dev *cdev) +{ + debugfs_remove_recursive(cdev->dentry); +} + +void constraint_add_debugfs(struct constraint *constraint, const char *suffix) +{ + struct device *dev = constraint->cdev->dev; + const char *prefix; + char name[NAME_MAX]; + + switch (constraint->type) { + case DEV_BOOT_CONSTRAINT_CLK: + prefix = "clk"; + break; + case DEV_BOOT_CONSTRAINT_PM: + prefix = "pm"; + break; + case DEV_BOOT_CONSTRAINT_SUPPLY: + prefix = "supply"; + break; + default: + dev_err(dev, "%s: Constraint type (%d) not supported\n", + __func__, constraint->type); + return; + } + + snprintf(name, NAME_MAX, "%s-%s", prefix, suffix); + + constraint->dentry = debugfs_create_dir(name, constraint->cdev->dentry); +} + +void constraint_remove_debugfs(struct constraint *constraint) +{ + debugfs_remove_recursive(constraint->dentry); +} + +static int __init constraint_debugfs_init(void) +{ + rootdir = debugfs_create_dir("boot_constraints", NULL); + + return 0; +} +core_initcall(constraint_debugfs_init); + + /* Boot constraints core */ static struct constraint_dev *constraint_device_find(struct device *dev) @@ -48,12 +105,14 @@ static struct constraint_dev *constraint_device_allocate(struct device *dev) INIT_LIST_HEAD(&cdev->constraints); list_add(&cdev->node, &constraint_devices); + constraint_device_add_debugfs(cdev); return cdev; } static void constraint_device_free(struct constraint_dev *cdev) { + constraint_device_remove_debugfs(cdev); list_del(&cdev->node); kfree(cdev); } diff --git a/drivers/boot_constraint/core.h b/drivers/boot_constraint/core.h index c5b27617b4ae..9dd481d38b99 100644 --- a/drivers/boot_constraint/core.h +++ b/drivers/boot_constraint/core.h @@ -7,6 +7,7 @@ #define _CORE_H #include +#include #include #include @@ -14,6 +15,7 @@ struct constraint_dev { struct device *dev; struct list_head node; struct list_head constraints; + struct dentry *dentry; }; struct constraint { @@ -22,12 +24,16 @@ struct constraint { enum dev_boot_constraint_type type; void (*free_resources)(void *data); void *free_resources_data; + struct dentry *dentry; int (*add)(struct constraint *constraint, void *data); void (*remove)(struct constraint *constraint); void *private; }; +void constraint_add_debugfs(struct constraint *constraint, const char *suffix); +void constraint_remove_debugfs(struct constraint *constraint); + /* Forward declarations of constraint specific callbacks */ int constraint_clk_add(struct constraint *constraint, void *data); void constraint_clk_remove(struct constraint *constraint); diff --git a/drivers/boot_constraint/pm.c b/drivers/boot_constraint/pm.c index 4950ec6b248b..584d3d46ef65 100644 --- a/drivers/boot_constraint/pm.c +++ b/drivers/boot_constraint/pm.c @@ -11,11 +11,18 @@ int constraint_pm_add(struct constraint *constraint, void *data) { struct device *dev = constraint->cdev->dev; + int ret; - return dev_pm_domain_attach(dev, true); + ret = dev_pm_domain_attach(dev, true); + if (ret) + return ret; + + constraint_add_debugfs(constraint, "domain"); + + return 0; } void constraint_pm_remove(struct constraint *constraint) { - /* Nothing to do for now */ + constraint_remove_debugfs(constraint); } diff --git a/drivers/boot_constraint/supply.c b/drivers/boot_constraint/supply.c index 916e5d6848d5..28fda60a0711 100644 --- a/drivers/boot_constraint/supply.c +++ b/drivers/boot_constraint/supply.c @@ -57,6 +57,14 @@ int constraint_supply_add(struct constraint *constraint, void *data) csupply->supply.name = kstrdup_const(supply->name, GFP_KERNEL); constraint->private = csupply; + constraint_add_debugfs(constraint, supply->name); + + debugfs_create_u32("u_volt_min", 0444, constraint->dentry, + &csupply->supply.u_volt_min); + + debugfs_create_u32("u_volt_max", 0444, constraint->dentry, + &csupply->supply.u_volt_max); + return 0; remove_voltage: @@ -77,6 +85,7 @@ void constraint_supply_remove(struct constraint *constraint) struct device *dev = constraint->cdev->dev; int ret; + constraint_remove_debugfs(constraint); kfree_const(supply->name); ret = regulator_disable(csupply->reg); From patchwork Wed Jan 10 03:47:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124006 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4789745qgn; Tue, 9 Jan 2018 19:50:07 -0800 (PST) X-Google-Smtp-Source: ACJfBovP0lDQhNraBTC4WmwCKNyX0t9yRQEl66+g+Tu6K42edHqv/2mGtnE8IxR4bEkZ1vnEy9YJ X-Received: by 10.98.222.198 with SMTP id h189mr932892pfg.150.1515556207791; Tue, 09 Jan 2018 19:50:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556207; cv=none; d=google.com; s=arc-20160816; b=ZX/uYrsH9J7d6hnQ6RWXMLeKLt3OXkTd1v7zQrEmU0yvF5vHcwJam4KYJMGnCVIEQI 5rkFqC5wWlGf63vyZYg6nvmJSQx71OwL8SH+AVNDAVlgXUSLSzCbOao5elsAZGr6rKAN iciMzivuvMdkwzwBP5WGU+b56ugo6ZMafiD8G91h6j5dT+3Y2aF2+Z8zP9TEtHL5AQyf qNr0Gk8upxnoqFyRfx/CtMRGW9lyVDaw3xbBuKza8epzoBk9ET+wbaR3LqnLxYMNBn9X PTqfCQ3rMWWcJqR9J/W2NopdBW65Kzh+ol3R3m/+JTAjuiT3KTjDXitf+DPoBfSgYpy6 FxKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=AxixgptxoF1a5YSD7fnnHinY77lgikb7+X/JHXaO7Cs=; b=e6PxRztan+i2D5rmbyd2b4VzVZjXNVEe7GdepVy133zZJ9CTBd3DnMTRBZmGf2r0rN ugC6gMFfGxjEzfAENfSRKO9CHZAwPI4AStRt+ThSWTw7LUXDRuDoP7Nu4QJKnYwv3Tbm gtCSnXiLQwBot92xGfTgJsA9cyA8lKfwTm3P0AD6Q/qspgvIA2e/zPjJsdlKFAtcOQrP iHKS4XHzM2JFcAuiGYx44Kj/PUvAYZFSNkFnVZ3h4/vP9GCuMEkba+vl1pW1FpLPj4Rf v5Qo4nwHKdZa7ZJrjKo2N6HlUdYGmTp7I0kzL5KHXh32risGyq23V7i+zdVCdZ8Ne+Ih vbig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U4eonryn; 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 g12si44565plj.569.2018.01.09.19.50.07; Tue, 09 Jan 2018 19:50:07 -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=U4eonryn; 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 S1756044AbeAJDuG (ORCPT + 28 others); Tue, 9 Jan 2018 22:50:06 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36871 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965204AbeAJDsO (ORCPT ); Tue, 9 Jan 2018 22:48:14 -0500 Received: by mail-pl0-f65.google.com with SMTP id s3so6514435plp.4 for ; Tue, 09 Jan 2018 19:48:14 -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=AxixgptxoF1a5YSD7fnnHinY77lgikb7+X/JHXaO7Cs=; b=U4eonrynpiBy60tTBIDfxs8dj2oQ8bkp3rIWYTmbXzU5JjTz2VtCM/MnSPELPK4XbB nq/MzZGEiCbOcxGTwbYT5IzqS3quyMdQsjmI8o6JHmGPJkT3rpjx+KfhiKcDhMQQ2FmR kBfWxmgwe1UlhXAMjVHW20JYd5D6vIA33d0ng= 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=AxixgptxoF1a5YSD7fnnHinY77lgikb7+X/JHXaO7Cs=; b=S+m2r365UTMKOHLzSqfPdsCbVmijQWU3nLvm/GZtAadMfoTpoe+AdHr5/J8Qwus+jU rroKer6aRvHGhRHPXVNJa5abfl0nIdZrnhqc+vk2xrfBwFzcQbJfp31ROyFdHR6MMyHY GXxrOdIOgDuv0d3F1v4P5Wk1cUTy+gu5HJqCmIKXBtTr1xr8mCFsqqHBHdKX6DGOi0Gv vFjJUzHG02CpSDLr23xGDveUOHLBOaMCB79tpT5c3LMWZhRE+EdBGE9aIe1ocHSzC1qr VjBWbrj3jtMpGwIWpUkDBp4+g0enIGcfnpxP8nPSgghGRlBoidSnryyx4M8MUVj8vD7l HJ+g== X-Gm-Message-State: AKGB3mKgf5wdpqj0HrOh/bBh1orfLIYGp+2g018F32xQ4CXXVtd8gdxG 9jpgbCxV+2Jp3Ux2RwQqX7LBkg== X-Received: by 10.159.198.9 with SMTP id f9mr17811919plo.150.1515556093966; Tue, 09 Jan 2018 19:48:13 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id x84sm5569383pfe.81.2018.01.09.19.48.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:13 -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 08/13] boot_constraint: Manage deferrable constraints Date: Wed, 10 Jan 2018 09:17:37 +0530 Message-Id: <8b232c83176fe935b583b599b47f6cbb3e4ed0cf.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is possible that some of the resources aren't available at the time constraints are getting set and the boot constraints core will return -EPROBE_DEFER for them. In order to retry adding the constraints at a later point of time (after the resource is added and before any of its users come up), this patch proposes two things: - Each constraint is represented by a virtual platform device, so that it is re-probed again until the time all the dependencies aren't met. The platform device is removed along with the constraint, with help of the free_resources() callback. - Enable early defer probing support by calling driver_enable_deferred_probe(), so that the core retries probing deferred devices every time any device is bound to a driver. This makes sure that the constraint is set before any of the users of the resources come up. This is tested on ARM64 Hikey board where probe was deferred for a device. Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/base/dd.c | 12 ++ drivers/boot_constraint/Makefile | 2 +- drivers/boot_constraint/deferrable_dev.c | 241 +++++++++++++++++++++++++++++++ include/linux/boot_constraint.h | 27 ++++ 4 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 drivers/boot_constraint/deferrable_dev.c -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index dc89f98a2487..48a9945ff206 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -227,6 +227,18 @@ void device_unblock_probing(void) driver_deferred_probe_trigger(); } +/** + * driver_enable_deferred_probe() - Enable probing of deferred devices + * + * We don't want to get in the way when the bulk of drivers are getting probed + * and so deferred probe is disabled in the beginning. Enable it now because we + * need it. + */ +void driver_enable_deferred_probe(void) +{ + driver_deferred_probe_enable = true; +} + /** * deferred_probe_initcall() - Enable probing of deferred devices * diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile index b7ade1a7afb5..a765094623a3 100644 --- a/drivers/boot_constraint/Makefile +++ b/drivers/boot_constraint/Makefile @@ -1,3 +1,3 @@ # Makefile for device boot constraints -obj-y := clk.o core.o pm.o supply.o +obj-y := clk.o deferrable_dev.o core.o pm.o supply.o diff --git a/drivers/boot_constraint/deferrable_dev.c b/drivers/boot_constraint/deferrable_dev.c new file mode 100644 index 000000000000..158c04d41e09 --- /dev/null +++ b/drivers/boot_constraint/deferrable_dev.c @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ + +#include +#include +#include +#include +#include +#include + +#include "core.h" + +static DEFINE_IDA(pdev_index); + +void driver_enable_deferred_probe(void); + +struct boot_constraint_pdata { + struct device *dev; + struct dev_boot_constraint constraint; + int probe_failed; + int index; +}; + +static void boot_constraint_remove(void *data) +{ + struct platform_device *pdev = data; + struct boot_constraint_pdata *pdata = dev_get_platdata(&pdev->dev); + + ida_simple_remove(&pdev_index, pdata->index); + kfree(pdata->constraint.data); + platform_device_unregister(pdev); +} + +/* + * A platform device is added for each and every constraint, to handle + * -EPROBE_DEFER properly. + */ +static int boot_constraint_probe(struct platform_device *pdev) +{ + struct boot_constraint_pdata *pdata = dev_get_platdata(&pdev->dev); + struct dev_boot_constraint_info info; + int ret; + + if (WARN_ON(!pdata)) + return -EINVAL; + + info.constraint = pdata->constraint; + info.free_resources = boot_constraint_remove; + info.free_resources_data = pdev; + + ret = dev_boot_constraint_add(pdata->dev, &info); + if (ret) { + if (ret == -EPROBE_DEFER) + driver_enable_deferred_probe(); + else + pdata->probe_failed = ret; + } + + return ret; +} + +static struct platform_driver boot_constraint_driver = { + .driver = { + .name = "boot-constraints-dev", + }, + .probe = boot_constraint_probe, +}; + +static int __init boot_constraint_init(void) +{ + return platform_driver_register(&boot_constraint_driver); +} +core_initcall(boot_constraint_init); + +static int boot_constraint_add_dev(struct device *dev, + struct dev_boot_constraint *constraint) +{ + struct boot_constraint_pdata pdata = { + .dev = dev, + .constraint.type = constraint->type, + }; + struct platform_device *pdev; + struct boot_constraint_pdata *pdev_pdata; + int size, ret; + + switch (constraint->type) { + case DEV_BOOT_CONSTRAINT_CLK: + size = sizeof(struct dev_boot_constraint_clk_info); + break; + case DEV_BOOT_CONSTRAINT_PM: + size = 0; + break; + case DEV_BOOT_CONSTRAINT_SUPPLY: + size = sizeof(struct dev_boot_constraint_supply_info); + break; + default: + dev_err(dev, "%s: Constraint type (%d) not supported\n", + __func__, constraint->type); + return -EINVAL; + } + + /* Will be freed from boot_constraint_remove() */ + pdata.constraint.data = kmemdup(constraint->data, size, GFP_KERNEL); + if (!pdata.constraint.data) + return -ENOMEM; + + ret = ida_simple_get(&pdev_index, 0, 256, GFP_KERNEL); + if (ret < 0) { + dev_err(dev, "failed to allocate index (%d)\n", ret); + goto free; + } + + pdata.index = ret; + + pdev = platform_device_register_data(NULL, "boot-constraints-dev", ret, + &pdata, sizeof(pdata)); + if (IS_ERR(pdev)) { + dev_err(dev, "%s: Failed to create pdev (%ld)\n", __func__, + PTR_ERR(pdev)); + ret = PTR_ERR(pdev); + goto ida_remove; + } + + /* Release resources if probe has failed */ + pdev_pdata = dev_get_platdata(&pdev->dev); + if (pdev_pdata->probe_failed) { + ret = pdev_pdata->probe_failed; + goto remove_pdev; + } + + return 0; + +remove_pdev: + platform_device_unregister(pdev); +ida_remove: + ida_simple_remove(&pdev_index, pdata.index); +free: + kfree(pdata.constraint.data); + + return ret; +} + +static int dev_boot_constraint_add_deferrable(struct device *dev, + struct dev_boot_constraint *constraints, int count) +{ + int ret, i; + + for (i = 0; i < count; i++) { + ret = boot_constraint_add_dev(dev, &constraints[i]); + if (ret) + return ret; + } + + return 0; +} + +/* This only creates platform devices for now */ +static void add_deferrable_of_single(struct device_node *np, + struct dev_boot_constraint *constraints, + int count) +{ + struct device *dev; + int ret; + + if (!of_device_is_available(np)) + return; + + ret = of_platform_bus_create(np, NULL, NULL, NULL, false); + if (ret) + return; + + dev = of_find_any_device_by_node(np); + if (!dev) { + pr_err("Boot Constraints: Failed to find dev: %pOF\n", np); + return; + } + + ret = dev_boot_constraint_add_deferrable(dev, constraints, count); + if (ret) + dev_err(dev, "Failed to add boot constraint (%d)\n", ret); +} + +/* Not all compatible device nodes may have boot constraints */ +static bool node_has_boot_constraints(struct device_node *np, + struct dev_boot_constraint_of *oconst) +{ + int i; + + if (!oconst->dev_names) + return true; + + for (i = 0; i < oconst->dev_names_count; i++) { + if (!strcmp(oconst->dev_names[i], kbasename(np->full_name))) + return true; + } + + return false; +} + +/** + * dev_boot_constraint_add_deferrable_of: Adds all constraints for a platform. + * + * @oconst: This is an array of 'struct dev_boot_constraint_of', where each + * entry of the array is used to add one or more boot constraints across one or + * more devices having the same compatibility in the device tree. + * @count: Size of the 'oconst' array. + * + * This helper routine provides an easy way to add all boot constraints for a + * machine or platform. Just like dev_boot_constraint_add(), this must be called + * before the devices (to which we want to add constraints) are probed by their + * drivers, otherwise the boot constraint will never get removed for those + * devices and may result in unwanted behavior of the hardware. The boot + * constraints are removed by the driver core automatically after the devices + * are probed (successfully or unsuccessfully). + * + * This adds the boot constraints in a deferrable way and the caller need not + * worry about the availability of the resources required by the constraint. + * This routine will return successfully and the constraint will be added by the + * boot constraint core as soon as the resource is available at a later point in + * time. + */ +void dev_boot_constraint_add_deferrable_of(struct dev_boot_constraint_of *oconst, + int count) +{ + struct device_node *np; + int i; + + for (i = 0; i < count; i++) { + for_each_compatible_node(np, NULL, oconst[i].compat) { + if (!node_has_boot_constraints(np, &oconst[i])) + continue; + + add_deferrable_of_single(np, oconst[i].constraints, + oconst[i].count); + } + } +} +EXPORT_SYMBOL_GPL(dev_boot_constraint_add_deferrable_of); diff --git a/include/linux/boot_constraint.h b/include/linux/boot_constraint.h index 12fac0d565b0..ab752e19bfd0 100644 --- a/include/linux/boot_constraint.h +++ b/include/linux/boot_constraint.h @@ -79,16 +79,43 @@ struct dev_boot_constraint_info { void *free_resources_data; }; +/** + * struct dev_boot_constraint_of - This is used to add one or more boot + * constraints across one or more devices having the same compatibility in the + * device tree. + * + * @compat: This must match the compatible string of the devices to which we + * want to apply constraints. + * @constraints: This points to one or more boot constraints. + * @count: This contains the number of boot constraints pointed by the + * 'constraints' field. + * @dev_names: This is used to limit the application of boot constraints to only + * a subset of devices with matching compatibility. + * @dev_names_count: This is the number of devices pointed by the 'dev_names' + * array. + */ +struct dev_boot_constraint_of { + const char *compat; + struct dev_boot_constraint *constraints; + unsigned int count; + + const char * const *dev_names; + unsigned int dev_names_count; +}; + #ifdef CONFIG_DEV_BOOT_CONSTRAINT int dev_boot_constraint_add(struct device *dev, struct dev_boot_constraint_info *info); void dev_boot_constraints_remove(struct device *dev); +void dev_boot_constraint_add_deferrable_of(struct dev_boot_constraint_of *oconst, + int count); #else static inline int dev_boot_constraint_add(struct device *dev, struct dev_boot_constraint_info *info) { return 0; } static inline void dev_boot_constraints_remove(struct device *dev) {} +static inline void dev_boot_constraint_add_deferrable_of(struct dev_boot_constraint_of *oconst, int count) {} #endif /* CONFIG_DEV_BOOT_CONSTRAINT */ #endif /* _LINUX_BOOT_CONSTRAINT_H */ From patchwork Wed Jan 10 03:47:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124005 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4789577qgn; Tue, 9 Jan 2018 19:49:51 -0800 (PST) X-Google-Smtp-Source: ACJfBotO35o5UCzOuhnzbxTSmlIqL6LWCMXkQ4xh3lVd61Bbbd29RZYk7cWqJBQFUjSURJlzPIU+ X-Received: by 10.101.67.1 with SMTP id j1mr14169131pgq.204.1515556191463; Tue, 09 Jan 2018 19:49:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556191; cv=none; d=google.com; s=arc-20160816; b=OOKhlqKYHH+h0YRaAbXZxzycKjW4mwie8utnBngbqsA9kqNxzKeh0JP7UPPdz2Y0yk Clh9QKrkn5ycO5x/1j2Fv0mkDWj/a/qYzqwPPU24o7f+jQluPD0hjy64CJ3N9Vn7VKwd QCDNtx9ml/44spefDgilcv0ZRc+9ovofUq9FSjECjGYro38aSeby98Oz+31UheHxBxEh Nd7bFmi7E+lSHPOO44vNElSCh1NjlOmKMy4slq0KgO2HKIHLI4GZcsv9aMwHWUHpzyOn WixG/LLf9oU/9A7ay5CCC29H+Wj0EvlSSe78gMWqrlbP2QDLIiWsgmkMPs7v4cALApNW ft6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=n4ehJD1+yKwW2AxoOUVUm5GlfZ51/lPswpnsFynL80s=; b=WWzCi7hMGVmsK5bOlep3NvFAIvgIq/m8CU27pegquPcTukT+Sx0xeRXHEdxRpfVIzq fFpLvwXbeyWboDEos4Ul4tfntracvjVfsfWYfSGbHeFGK1URWoJwQSvcv1xUJPcV6GDW +vM08Zw5Op46eB27//WLCWOn+Nn61JjboMXDsvEDlIbBfRTAwxXJ1pjQRZ3+kFQBI9u7 KJxYyXYFaDUywLXpc8ZgLt5AoWNuHFuvQyjh7bi9YT7zf9gMU4gPceK6KqMWq4hcMoUu fa4EoPADkMQ/ICfSdgN8x+WQ3zM5E2VL6AX8DHFtufQFXv6xGULFf8QvDLvahlN1E9sC 5e/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+lzdR/j; 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 v3si11401955plb.385.2018.01.09.19.49.51; Tue, 09 Jan 2018 19:49:51 -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=i+lzdR/j; 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 S1755773AbeAJDtf (ORCPT + 28 others); Tue, 9 Jan 2018 22:49:35 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:37905 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965215AbeAJDsR (ORCPT ); Tue, 9 Jan 2018 22:48:17 -0500 Received: by mail-pg0-f68.google.com with SMTP id t67so9804527pgc.5 for ; Tue, 09 Jan 2018 19:48:17 -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=n4ehJD1+yKwW2AxoOUVUm5GlfZ51/lPswpnsFynL80s=; b=i+lzdR/jF0XouKb8ojIpZJcfapSG+jJjoGy2gDHahhsKn5pdzHycsgy5cjYN10tqFl LBp5Ho51ru7uHXL27o6t8vu69+9axTcQV0Ks8LLbTfBSFDQk73W1BNMCIJxOsY9omVcm VUyEJcKSLdtrjU7L+Aim4rfYB92q4sVfb0cP0= 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=n4ehJD1+yKwW2AxoOUVUm5GlfZ51/lPswpnsFynL80s=; b=l/n+Qqy/FatKiPMiXFVRdJi+VrnANEWI3vmf9pn48EduJkWUt7q+NXT264Ver4/SLa AUl0iaHKVnGJH6QRVwk3ps+Q4rIcw8SKeQbaKH7yZamdACM2Qneja30BKdVVMITLf5QV iXTMl2W+z8xQGQWh5x6vKXYjmbyzFBGsa5ctKqPEmXQ7o3WXV61kv2sRmSBm24ktZr5m XTuETOgOo6JoThbQvdmIoaMsVl0gF78hQiiFl+mKZaPPJoitK2bZ/b+u/IitFe11kyEy ncYxoxaD9tCWozpbnQSkMxHNX8QOiJ9X4VOnrtIDrML7VUBCmnh3D0eHVyq+Hzv/a59H abcA== X-Gm-Message-State: AKGB3mLrU3HoKtZSxzoHWS1CMHotg2xpnN4JM3qUgie0OinNTHUG/tpt 7mto/zvpcNsjmsuCAq6XqBBDKw== X-Received: by 10.101.75.5 with SMTP id r5mr14132313pgq.215.1515556096583; Tue, 09 Jan 2018 19:48:16 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id n65sm32723876pfa.83.2018.01.09.19.48.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:16 -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 09/13] boot_constraint: Add support for Hisilicon platforms Date: Wed, 10 Jan 2018 09:17:38 +0530 Message-Id: <9cfb77e0d4c823630013d262dbdc7b8ae7f9eaca.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds boot constraint support for Hisilicon platforms. Currently only one use case is supported: earlycon. One of the UART is enabled by the bootloader and is used for early console in the kernel. The boot constraint core handles it properly and removes constraints once the serial device is probed by its driver. This is tested on hi6220-hikey 96board. Signed-off-by: Viresh Kumar --- arch/arm64/Kconfig.platforms | 1 + drivers/boot_constraint/Makefile | 2 + drivers/boot_constraint/hikey.c | 158 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 drivers/boot_constraint/hikey.c -- 2.15.0.194.g9af6a3dea062 diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 2401373565ff..a586ed728393 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -87,6 +87,7 @@ config ARCH_HISI select ARM_TIMER_SP804 select HISILICON_IRQ_MBIGEN if PCI select PINCTRL + select DEV_BOOT_CONSTRAINT help This enables support for Hisilicon ARMv8 SoC family diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile index a765094623a3..5609280162c4 100644 --- a/drivers/boot_constraint/Makefile +++ b/drivers/boot_constraint/Makefile @@ -1,3 +1,5 @@ # Makefile for device boot constraints obj-y := clk.o deferrable_dev.o core.o pm.o supply.o + +obj-$(CONFIG_ARCH_HISI) += hikey.o diff --git a/drivers/boot_constraint/hikey.c b/drivers/boot_constraint/hikey.c new file mode 100644 index 000000000000..25acb4070569 --- /dev/null +++ b/drivers/boot_constraint/hikey.c @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * This takes care of Hisilicon boot time device constraints, normally set by + * the Bootloader. + * + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ + +#include +#include +#include +#include + +static bool earlycon_boot_constraints_enabled __initdata; + +static int __init enable_earlycon_boot_constraints(char *str) +{ + earlycon_boot_constraints_enabled = true; + + return 0; +} + +__setup_param("earlycon", boot_constraint_earlycon, + enable_earlycon_boot_constraints, 0); +__setup_param("earlyprintk", boot_constraint_earlyprintk, + enable_earlycon_boot_constraints, 0); + + +struct hikey_machine_constraints { + struct dev_boot_constraint_of *dev_constraints; + unsigned int count; +}; + +static struct dev_boot_constraint_clk_info uart_iclk_info = { + .name = "uartclk", +}; + +static struct dev_boot_constraint_clk_info uart_pclk_info = { + .name = "apb_pclk", +}; + +static struct dev_boot_constraint hikey3660_uart_constraints[] = { + { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &uart_iclk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &uart_pclk_info, + }, +}; + +static const char * const uarts_hikey3660[] = { + "serial@fff32000", /* UART 6 */ +}; + +static struct dev_boot_constraint_of hikey3660_dev_constraints[] = { + { + .compat = "arm,pl011", + .constraints = hikey3660_uart_constraints, + .count = ARRAY_SIZE(hikey3660_uart_constraints), + + .dev_names = uarts_hikey3660, + .dev_names_count = ARRAY_SIZE(uarts_hikey3660), + }, +}; + +static struct hikey_machine_constraints hikey3660_constraints = { + .dev_constraints = hikey3660_dev_constraints, + .count = ARRAY_SIZE(hikey3660_dev_constraints), +}; + +static const char * const uarts_hikey6220[] = { + "uart@f7113000", /* UART 3 */ +}; + +static struct dev_boot_constraint_of hikey6220_dev_constraints[] = { + { + .compat = "arm,pl011", + .constraints = hikey3660_uart_constraints, + .count = ARRAY_SIZE(hikey3660_uart_constraints), + + .dev_names = uarts_hikey6220, + .dev_names_count = ARRAY_SIZE(uarts_hikey6220), + }, +}; + +static struct hikey_machine_constraints hikey6220_constraints = { + .dev_constraints = hikey6220_dev_constraints, + .count = ARRAY_SIZE(hikey6220_dev_constraints), +}; + +static struct dev_boot_constraint hikey3798cv200_uart_constraints[] = { + { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &uart_pclk_info, + }, +}; + +static const char * const uarts_hikey3798cv200[] = { + "serial@8b00000", /* UART 0 */ +}; + +static struct dev_boot_constraint_of hikey3798cv200_dev_constraints[] = { + { + .compat = "arm,pl011", + .constraints = hikey3798cv200_uart_constraints, + .count = ARRAY_SIZE(hikey3798cv200_uart_constraints), + + .dev_names = uarts_hikey3798cv200, + .dev_names_count = ARRAY_SIZE(uarts_hikey3798cv200), + }, +}; + +static struct hikey_machine_constraints hikey3798cv200_constraints = { + .dev_constraints = hikey3798cv200_dev_constraints, + .count = ARRAY_SIZE(hikey3798cv200_dev_constraints), +}; + +static const struct of_device_id machines[] __initconst = { + { .compatible = "hisilicon,hi3660", .data = &hikey3660_constraints }, + { .compatible = "hisilicon,hi3798cv200", .data = &hikey3798cv200_constraints }, + { .compatible = "hisilicon,hi6220", .data = &hikey6220_constraints }, + { } +}; + +static int __init hikey_constraints_init(void) +{ + const struct hikey_machine_constraints *constraints; + const struct of_device_id *match; + struct device_node *np; + + if (!earlycon_boot_constraints_enabled) + return 0; + + np = of_find_node_by_path("/"); + if (!np) + return -ENODEV; + + match = of_match_node(machines, np); + of_node_put(np); + + if (!match) + return 0; + + constraints = match->data; + + dev_boot_constraint_add_deferrable_of(constraints->dev_constraints, + constraints->count); + + return 0; +} + +/* + * The amba-pl011 driver registers itself from arch_initcall level. Setup the + * serial boot constraints before that in order not to miss any boot messages. + */ +postcore_initcall_sync(hikey_constraints_init); From patchwork Wed Jan 10 03:47:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124003 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4789250qgn; Tue, 9 Jan 2018 19:49:19 -0800 (PST) X-Google-Smtp-Source: ACJfBotd4KabaNLztyPFFyd4JiXHT9ZBePpHLPYNk0kOHqJtqh2Ggrq6phOJApD6AD92SO7eb2TW X-Received: by 10.99.181.73 with SMTP id u9mr10644919pgo.377.1515556159639; Tue, 09 Jan 2018 19:49:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556159; cv=none; d=google.com; s=arc-20160816; b=fhSXyaIM+f8FTvrcP8EcG2OF42+1GdgJJ2jolViYoT6WW+mAbGWkGSIdhk8NcW0wC/ ju9aVIEBsL9rYJEtyEuGMhSlshm6MYpTEBhoSPoR6g4grwZKDHWjCTc3OUinIlY2717Z v+oEXvZ0mS0ngfzTsWJTyHUg5zshQcTYyxrj0A7CsDhjJB3k8Dp5cI1xMRTm9d5zjipr Digfci2Ojb7UrcaQRx6GRyH4YPlgfC2G8H4YWatwQUlOR9q67JQmo+cpaROPbPn2YbBH AJfS1/JlDBn7ymRYxGlK5mPFL0teQcdIB5UqU4D3z4yBiWvZYOvzlSXuX6fhCc0LAXdw yIGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=hUnDVCsM+3mG1cw0Vh2Qci495u5SCUtGl9LwwWeOOr0=; b=Ts9R2uLDbpg2AU5Uo4b9XeZfgzIvdSpI5ThZ4Z1/MAP824s2c+lQaQHbU/0p190D6Q GxHrOmKos8Dqrss3khYywdANu+K4xgL5KR9DSQZK1/Cf3XH0SgmbmUak+WJ5OytM2p2O tInYZtHTuKJMtMGWzor9NRKLHEwaQicYDzYP+bcr8AUvX8nKprs0+uiDZo2bDNnCFBPO 3lVNCXf+WjE0wEC/bg79Yp9kHAilbL2a/zmSUAJ90G/tWd+wN3cL0zmKW2yx+uHEi9uE jGlgeOhB1jHESvh0SezKZWbOnT8iD7hw/IoEddxC8UGlVCp9GxLA7pdrrWJSlZdChxVo cm4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kU44F301; 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 z10si2359910pgp.671.2018.01.09.19.49.19; Tue, 09 Jan 2018 19:49:19 -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=kU44F301; 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 S1755408AbeAJDtR (ORCPT + 28 others); Tue, 9 Jan 2018 22:49:17 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:40068 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965221AbeAJDsU (ORCPT ); Tue, 9 Jan 2018 22:48:20 -0500 Received: by mail-pl0-f67.google.com with SMTP id 62so6515057pld.7 for ; Tue, 09 Jan 2018 19:48:20 -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=hUnDVCsM+3mG1cw0Vh2Qci495u5SCUtGl9LwwWeOOr0=; b=kU44F3012PqPOI4Z99cWVhYkwSwTu+95jkRsBPttJrZGAnasUxShpLJ6e4A69OOsHb lvcUnytFMhhz4LI6nkogQASKFo472pfd79fmrCYlGxwF8OCh9KJV2YbS7x5qyQP34AXD ha3zGbccRL4rquGegO1KC5ErWlhJ9e553nFqA= 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=hUnDVCsM+3mG1cw0Vh2Qci495u5SCUtGl9LwwWeOOr0=; b=avn5BQcZ5il4F8CQK0DH4Kc9C4XFY7+Sp4aXNLft0JjmaBV7Fq2ropaiOrm7rEiO90 4dbuMy/KcAMJnYL/Vs0EkR+p7RkHJP4+SksWvRZy3tl2yo4g3unhJNpUuL2BEI3xx2U2 VeU8EcZNuTwoSs/yzpCXle0QyreDQN3yskJjiobkre5QXqh8hKanN5dlKMDvMDDzX0IV kdtIWJBeecWRaMpBus6SS8KlMPisySdp5rJCx2FPB/6eO5Tgwq1CJE6CKd6BsW6/lAWS OgFz9WYRHrilq/b3REblW+KWpxZymGMIG5o4oALXAHQwlEIu1FT7Y3OQO/nOZCP8W42J JNXw== X-Gm-Message-State: AKGB3mIziwUvuiyESPfcXnc7+7l+errSQZvxn385piMJBCzBgBs8FPmG 120kEJDcdr1hu8X/TI7k5CMCxg== X-Received: by 10.84.242.73 with SMTP id c9mr17710578pll.287.1515556099239; Tue, 09 Jan 2018 19:48:19 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id o63sm31782225pfg.101.2018.01.09.19.48.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:18 -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 10/13] boot_constraint: Add support for IMX platform Date: Wed, 10 Jan 2018 09:17:39 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds boot constraint support for IMX platforms. Currently only one use case is supported: earlycon. Some of the UARTs are enabled by the bootloader and are used for early console in the kernel. The boot constraint core handles them properly and removes them once the serial device is probed by its driver. This gets rid of lots of hacky code in the clock drivers. Signed-off-by: Viresh Kumar --- arch/arm/mach-imx/Kconfig | 1 + drivers/boot_constraint/Makefile | 1 + drivers/boot_constraint/imx.c | 126 ++++++++++++++++++++++++++++++++++++++ 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 - 14 files changed, 128 insertions(+), 140 deletions(-) create mode 100644 drivers/boot_constraint/imx.c -- 2.15.0.194.g9af6a3dea062 diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 782699e67600..f4d505fed092 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -4,6 +4,7 @@ menuconfig ARCH_MXC select ARCH_SUPPORTS_BIG_ENDIAN select CLKSRC_IMX_GPT select GENERIC_IRQ_CHIP + select DEV_BOOT_CONSTRAINT select GPIOLIB select PINCTRL select PM_OPP if PM diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile index 5609280162c4..f3e123b5d854 100644 --- a/drivers/boot_constraint/Makefile +++ b/drivers/boot_constraint/Makefile @@ -3,3 +3,4 @@ obj-y := clk.o deferrable_dev.o core.o pm.o supply.o obj-$(CONFIG_ARCH_HISI) += hikey.o +obj-$(CONFIG_ARCH_MXC) += imx.o diff --git a/drivers/boot_constraint/imx.c b/drivers/boot_constraint/imx.c new file mode 100644 index 000000000000..a4f3af33ba86 --- /dev/null +++ b/drivers/boot_constraint/imx.c @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * This takes care of IMX boot time device constraints, normally set by the + * Bootloader. + * + * Copyright (C) 2017 Linaro. + * Viresh Kumar + */ + +#include +#include +#include +#include + +static bool earlycon_boot_constraints_enabled __initdata; + +static int __init enable_earlycon_boot_constraints(char *str) +{ + earlycon_boot_constraints_enabled = true; + + return 0; +} + +__setup_param("earlycon", boot_constraint_earlycon, + enable_earlycon_boot_constraints, 0); +__setup_param("earlyprintk", boot_constraint_earlyprintk, + enable_earlycon_boot_constraints, 0); + + +struct imx_machine_constraints { + struct dev_boot_constraint_of *dev_constraints; + unsigned int count; +}; + +static struct dev_boot_constraint_clk_info uart_ipg_clk_info = { + .name = "ipg", +}; + +static struct dev_boot_constraint_clk_info uart_per_clk_info = { + .name = "per", +}; + +static struct dev_boot_constraint imx_uart_constraints[] = { + { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &uart_ipg_clk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &uart_per_clk_info, + }, +}; + +static struct dev_boot_constraint_of imx_dev_constraints[] = { + { + .compat = "fsl,imx21-uart", + .constraints = imx_uart_constraints, + .count = ARRAY_SIZE(imx_uart_constraints), + }, +}; + +static struct imx_machine_constraints imx_constraints = { + .dev_constraints = imx_dev_constraints, + .count = ARRAY_SIZE(imx_dev_constraints), +}; + +/* imx7 */ +static struct dev_boot_constraint_of imx7_dev_constraints[] = { + { + .compat = "fsl,imx6q-uart", + .constraints = imx_uart_constraints, + .count = ARRAY_SIZE(imx_uart_constraints), + }, +}; + +static struct imx_machine_constraints imx7_constraints = { + .dev_constraints = imx7_dev_constraints, + .count = ARRAY_SIZE(imx7_dev_constraints), +}; + +static const struct of_device_id machines[] __initconst = { + { .compatible = "fsl,imx25", .data = &imx_constraints }, + { .compatible = "fsl,imx27", .data = &imx_constraints }, + { .compatible = "fsl,imx31", .data = &imx_constraints }, + { .compatible = "fsl,imx35", .data = &imx_constraints }, + { .compatible = "fsl,imx50", .data = &imx_constraints }, + { .compatible = "fsl,imx51", .data = &imx_constraints }, + { .compatible = "fsl,imx53", .data = &imx_constraints }, + { .compatible = "fsl,imx6dl", .data = &imx_constraints }, + { .compatible = "fsl,imx6q", .data = &imx_constraints }, + { .compatible = "fsl,imx6qp", .data = &imx_constraints }, + { .compatible = "fsl,imx6sl", .data = &imx_constraints }, + { .compatible = "fsl,imx6sx", .data = &imx_constraints }, + { .compatible = "fsl,imx6ul", .data = &imx_constraints }, + { .compatible = "fsl,imx6ull", .data = &imx_constraints }, + { .compatible = "fsl,imx7d", .data = &imx7_constraints }, + { .compatible = "fsl,imx7s", .data = &imx7_constraints }, + { } +}; + +static int __init imx_constraints_init(void) +{ + const struct imx_machine_constraints *constraints; + const struct of_device_id *match; + struct device_node *np; + + if (!earlycon_boot_constraints_enabled) + return 0; + + np = of_find_node_by_path("/"); + if (!np) + return -ENODEV; + + match = of_match_node(machines, np); + of_node_put(np); + + if (!match) + return 0; + + constraints = match->data; + + dev_boot_constraint_add_deferrable_of(constraints->dev_constraints, + constraints->count); + + return 0; +} +subsys_initcall(imx_constraints_init); diff --git a/drivers/clk/imx/clk-imx25.c b/drivers/clk/imx/clk-imx25.c index 23686f756b5e..4df652cd912c 100644 --- a/drivers/clk/imx/clk-imx25.c +++ b/drivers/clk/imx/clk-imx25.c @@ -86,16 +86,6 @@ enum mx25_clks { static struct clk *clk[clk_max]; -static struct clk ** const uart_clks[] __initconst = { - &clk[uart_ipg_per], - &clk[uart1_ipg], - &clk[uart2_ipg], - &clk[uart3_ipg], - &clk[uart4_ipg], - &clk[uart5_ipg], - NULL -}; - static int __init __mx25_clocks_init(void __iomem *ccm_base) { BUG_ON(!ccm_base); @@ -241,8 +231,6 @@ static int __init __mx25_clocks_init(void __iomem *ccm_base) */ clk_set_parent(clk[cko_sel], clk[ipg]); - imx_register_uart_clocks(uart_clks); - return 0; } diff --git a/drivers/clk/imx/clk-imx27.c b/drivers/clk/imx/clk-imx27.c index 0a0ab95d16fe..379709d21b04 100644 --- a/drivers/clk/imx/clk-imx27.c +++ b/drivers/clk/imx/clk-imx27.c @@ -48,17 +48,6 @@ static const char *ssi_sel_clks[] = { "spll_gate", "mpll", }; static struct clk *clk[IMX27_CLK_MAX]; static struct clk_onecell_data clk_data; -static struct clk ** const uart_clks[] __initconst = { - &clk[IMX27_CLK_PER1_GATE], - &clk[IMX27_CLK_UART1_IPG_GATE], - &clk[IMX27_CLK_UART2_IPG_GATE], - &clk[IMX27_CLK_UART3_IPG_GATE], - &clk[IMX27_CLK_UART4_IPG_GATE], - &clk[IMX27_CLK_UART5_IPG_GATE], - &clk[IMX27_CLK_UART6_IPG_GATE], - NULL -}; - static void __init _mx27_clocks_init(unsigned long fref) { BUG_ON(!ccm); @@ -175,8 +164,6 @@ static void __init _mx27_clocks_init(unsigned long fref) clk_prepare_enable(clk[IMX27_CLK_EMI_AHB_GATE]); - imx_register_uart_clocks(uart_clks); - imx_print_silicon_rev("i.MX27", mx27_revision()); } diff --git a/drivers/clk/imx/clk-imx31.c b/drivers/clk/imx/clk-imx31.c index cbce308aad04..d0a720b61aca 100644 --- a/drivers/clk/imx/clk-imx31.c +++ b/drivers/clk/imx/clk-imx31.c @@ -63,16 +63,6 @@ enum mx31_clks { static struct clk *clk[clk_max]; static struct clk_onecell_data clk_data; -static struct clk ** const uart_clks[] __initconst = { - &clk[ipg], - &clk[uart1_gate], - &clk[uart2_gate], - &clk[uart3_gate], - &clk[uart4_gate], - &clk[uart5_gate], - NULL -}; - static void __init _mx31_clocks_init(void __iomem *base, unsigned long fref) { clk[dummy] = imx_clk_fixed("dummy", 0); @@ -208,8 +198,6 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[sdma_gate], NULL, "imx31-sdma"); clk_register_clkdev(clk[iim_gate], "iim", NULL); - - imx_register_uart_clocks(uart_clks); mxc_timer_init(MX31_GPT1_BASE_ADDR, MX31_INT_GPT, GPT_TYPE_IMX31); return 0; diff --git a/drivers/clk/imx/clk-imx35.c b/drivers/clk/imx/clk-imx35.c index 203cad6c9aab..081aacd2335b 100644 --- a/drivers/clk/imx/clk-imx35.c +++ b/drivers/clk/imx/clk-imx35.c @@ -86,14 +86,6 @@ enum mx35_clks { static struct clk *clk[clk_max]; -static struct clk ** const uart_clks[] __initconst = { - &clk[ipg], - &clk[uart1_gate], - &clk[uart2_gate], - &clk[uart3_gate], - NULL -}; - static void __init _mx35_clocks_init(void) { void __iomem *base; @@ -247,8 +239,6 @@ static void __init _mx35_clocks_init(void) */ clk_prepare_enable(clk[scc_gate]); - imx_register_uart_clocks(uart_clks); - imx_print_silicon_rev("i.MX35", mx35_revision()); } diff --git a/drivers/clk/imx/clk-imx51-imx53.c b/drivers/clk/imx/clk-imx51-imx53.c index 7bcaf270db11..2da06f8ffae1 100644 --- a/drivers/clk/imx/clk-imx51-imx53.c +++ b/drivers/clk/imx/clk-imx51-imx53.c @@ -131,20 +131,6 @@ static const char *ieee1588_sels[] = { "pll3_sw", "pll4_sw", "dummy" /* usbphy2_ static struct clk *clk[IMX5_CLK_END]; static struct clk_onecell_data clk_data; -static struct clk ** const uart_clks[] __initconst = { - &clk[IMX5_CLK_UART1_IPG_GATE], - &clk[IMX5_CLK_UART1_PER_GATE], - &clk[IMX5_CLK_UART2_IPG_GATE], - &clk[IMX5_CLK_UART2_PER_GATE], - &clk[IMX5_CLK_UART3_IPG_GATE], - &clk[IMX5_CLK_UART3_PER_GATE], - &clk[IMX5_CLK_UART4_IPG_GATE], - &clk[IMX5_CLK_UART4_PER_GATE], - &clk[IMX5_CLK_UART5_IPG_GATE], - &clk[IMX5_CLK_UART5_PER_GATE], - NULL -}; - static void __init mx5_clocks_common_init(void __iomem *ccm_base) { clk[IMX5_CLK_DUMMY] = imx_clk_fixed("dummy", 0); @@ -325,8 +311,6 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base) clk_prepare_enable(clk[IMX5_CLK_TMAX1]); clk_prepare_enable(clk[IMX5_CLK_TMAX2]); /* esdhc2, fec */ clk_prepare_enable(clk[IMX5_CLK_TMAX3]); /* esdhc1, esdhc4 */ - - imx_register_uart_clocks(uart_clks); } static void __init mx50_clocks_init(struct device_node *np) diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c index 8d518ad5dc13..255f571c0b0d 100644 --- a/drivers/clk/imx/clk-imx6q.c +++ b/drivers/clk/imx/clk-imx6q.c @@ -150,12 +150,6 @@ static inline int clk_on_imx6dl(void) return of_machine_is_compatible("fsl,imx6dl"); } -static struct clk ** const uart_clks[] __initconst = { - &clk[IMX6QDL_CLK_UART_IPG], - &clk[IMX6QDL_CLK_UART_SERIAL], - NULL -}; - static int ldb_di_sel_by_clock_id(int clock_id) { switch (clock_id) { @@ -918,7 +912,5 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) clk_set_parent(clk[IMX6QDL_CLK_GPU2D_CORE_SEL], clk[IMX6QDL_CLK_PLL3_USB_OTG]); } - - imx_register_uart_clocks(uart_clks); } CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init); diff --git a/drivers/clk/imx/clk-imx6sl.c b/drivers/clk/imx/clk-imx6sl.c index 9642cdf0fb88..97ab67783609 100644 --- a/drivers/clk/imx/clk-imx6sl.c +++ b/drivers/clk/imx/clk-imx6sl.c @@ -185,12 +185,6 @@ void imx6sl_set_wait_clk(bool enter) imx6sl_enable_pll_arm(false); } -static struct clk ** const uart_clks[] __initconst = { - &clks[IMX6SL_CLK_UART], - &clks[IMX6SL_CLK_UART_SERIAL], - NULL -}; - static void __init imx6sl_clocks_init(struct device_node *ccm_node) { struct device_node *np; @@ -447,7 +441,5 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node) clk_set_parent(clks[IMX6SL_CLK_LCDIF_AXI_SEL], clks[IMX6SL_CLK_PLL2_PFD2]); - - imx_register_uart_clocks(uart_clks); } CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init); diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c index e6d389e333d7..e38dfb855ae8 100644 --- a/drivers/clk/imx/clk-imx6sx.c +++ b/drivers/clk/imx/clk-imx6sx.c @@ -137,12 +137,6 @@ static u32 share_count_ssi3; static u32 share_count_sai1; static u32 share_count_sai2; -static struct clk ** const uart_clks[] __initconst = { - &clks[IMX6SX_CLK_UART_IPG], - &clks[IMX6SX_CLK_UART_SERIAL], - NULL -}; - static void __init imx6sx_clocks_init(struct device_node *ccm_node) { struct device_node *np; @@ -566,7 +560,5 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node) clk_set_parent(clks[IMX6SX_CLK_QSPI1_SEL], clks[IMX6SX_CLK_PLL2_BUS]); clk_set_parent(clks[IMX6SX_CLK_QSPI2_SEL], clks[IMX6SX_CLK_PLL2_BUS]); - - imx_register_uart_clocks(uart_clks); } CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init); diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c index 80dc211eb74b..91e5bda48df2 100644 --- a/drivers/clk/imx/clk-imx7d.c +++ b/drivers/clk/imx/clk-imx7d.c @@ -387,17 +387,6 @@ static int const clks_init_on[] __initconst = { static struct clk_onecell_data clk_data; -static struct clk ** const uart_clks[] __initconst = { - &clks[IMX7D_UART1_ROOT_CLK], - &clks[IMX7D_UART2_ROOT_CLK], - &clks[IMX7D_UART3_ROOT_CLK], - &clks[IMX7D_UART4_ROOT_CLK], - &clks[IMX7D_UART5_ROOT_CLK], - &clks[IMX7D_UART6_ROOT_CLK], - &clks[IMX7D_UART7_ROOT_CLK], - NULL -}; - static void __init imx7d_clocks_init(struct device_node *ccm_node) { struct device_node *np; @@ -884,8 +873,5 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) /* set uart module clock's parent clock source that must be great then 80MHz */ clk_set_parent(clks[IMX7D_UART1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]); - - imx_register_uart_clocks(uart_clks); - } CLK_OF_DECLARE(imx7d, "fsl,imx7d-ccm", imx7d_clocks_init); diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index 9074e6974b6d..d8a64367a061 100644 --- a/drivers/clk/imx/clk.c +++ b/drivers/clk/imx/clk.c @@ -74,41 +74,3 @@ void imx_cscmr1_fixup(u32 *val) *val ^= CSCMR1_FIXUP; return; } - -static int imx_keep_uart_clocks __initdata; -static struct clk ** const *imx_uart_clocks __initdata; - -static int __init imx_keep_uart_clocks_param(char *str) -{ - imx_keep_uart_clocks = 1; - - return 0; -} -__setup_param("earlycon", imx_keep_uart_earlycon, - imx_keep_uart_clocks_param, 0); -__setup_param("earlyprintk", imx_keep_uart_earlyprintk, - imx_keep_uart_clocks_param, 0); - -void __init imx_register_uart_clocks(struct clk ** const clks[]) -{ - if (imx_keep_uart_clocks) { - int i; - - imx_uart_clocks = clks; - for (i = 0; imx_uart_clocks[i]; i++) - clk_prepare_enable(*imx_uart_clocks[i]); - } -} - -static int __init imx_clk_disable_uart(void) -{ - if (imx_keep_uart_clocks && imx_uart_clocks) { - int i; - - for (i = 0; imx_uart_clocks[i]; i++) - clk_disable_unprepare(*imx_uart_clocks[i]); - } - - return 0; -} -late_initcall_sync(imx_clk_disable_uart); diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index d69c4bbf3597..c5edde073cea 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -8,7 +8,6 @@ extern spinlock_t imx_ccm_lock; void imx_check_clocks(struct clk *clks[], unsigned int count); -void imx_register_uart_clocks(struct clk ** const clks[]); extern void imx_cscmr1_fixup(u32 *val); From patchwork Wed Jan 10 03:47:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124000 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4788679qgn; Tue, 9 Jan 2018 19:48:31 -0800 (PST) X-Google-Smtp-Source: ACJfBosMTCGuk18EyMOofMu6h/m3BXbpqjYH4Rxc/swOp0y77AWAhciGbXnQUuuJOYSc8ac20rxM X-Received: by 10.159.198.73 with SMTP id y9mr17981180plt.385.1515556111409; Tue, 09 Jan 2018 19:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556111; cv=none; d=google.com; s=arc-20160816; b=qYZy2PafCFVGh6RHdUcbMCVio2W1cmM5Rtk9BNlQe4unVhhOL5GNtLPlAqy0Q6rXQj xSAulQ+g6lU5cbXTrL1sdJ5bVFfOLJkj6/4/jGN3p4gz6cu5QArx2/WOG4gjZMw/jbzK /gGuK+oXxoT9fHRu2ys4uBOWp9UMKXAwgtz0TAJQIqBFPbu4Snk3t31fioeiYsNFksWB mxvQVnKPbPtjpTBBIO2VIb0/KAn6eIMDW7VUepS0RPaL+sCFtsV4PJmDXCoUXkCF4de7 mCwPq6JuXb6i3LPhnjrDXCkGlg8A/cfEu5uukmxoBrHFiveqfeNhZZH+O70Mr2a+Hg1X 1VYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SjXMPtCgr7kmgW6Sc3OPuAZH24KsIrVGddQxvD6R5y0=; b=pzQ9XkJi6QeArxJdJBLQ+BCoNgK0FEmtkDdM6rWIi3Cfc4KOWAV++jP4bBWnfhR0YV AZA42mcuYxdZSNnDCIGzDixSalgsw7d2sdxPDFFtSRSICNqpIb0omIfvKh3pqCMSIkKc zRXlnTJus5FVdTv8DLl+zoTOA5f3C3+gDUi9NAUn/JimCuylwB7G/x7e/tue7y5DkNs3 WnQSbRD6a42q1+aGu1jJPk4VzxWwKKQOAyXFyziVnPXbVfYLWui1pV3zHHL9a2OUfTqd jVeGg2VaoqMD9fDbr7AodGuoCQy3nJrK0a1S1RbCxVrsrFDopAn+h3BQk8rG54ITPaX7 gtkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gkxrNxuB; 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 z10si2359910pgp.671.2018.01.09.19.48.31; Tue, 09 Jan 2018 19:48:31 -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=gkxrNxuB; 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 S965247AbeAJDs0 (ORCPT + 28 others); Tue, 9 Jan 2018 22:48:26 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:43942 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965232AbeAJDsW (ORCPT ); Tue, 9 Jan 2018 22:48:22 -0500 Received: by mail-pg0-f66.google.com with SMTP id f14so7238597pga.10 for ; Tue, 09 Jan 2018 19:48:22 -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=SjXMPtCgr7kmgW6Sc3OPuAZH24KsIrVGddQxvD6R5y0=; b=gkxrNxuBaAWUumc3op6iTOkXIZQQv2Jeuq7jO3YUNfPbGp2FabzyyRQlGILvchZruz M1oPtBLmrsT8pO8FDv3us0UniqhX9Bm/How2LTSuOc2r6IZSw7oKDaddqtEzJpqI8OkY MuCUVOoIKJ7U5D3hn9WmbxNpHyIgctRSwfcZw= 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=SjXMPtCgr7kmgW6Sc3OPuAZH24KsIrVGddQxvD6R5y0=; b=KRQsjVVy5eaeAqbwUd6ttqCVlSSOZf5Jd7zqF++uv8Ov1s8b2JYjJvcN1eK85qTq6E s5R3T8yMPTKxZ0/jM9trbCf9nqBXQuO9AkkNvO3ceGSl6AOWl2FmDxmO+s5EFD4qV43o cJgJpcbA+VG6BEjxmvRq2p58Ljpv8zA/kxqHAFhTgjuzX4F1AMqCmrR/bm7/KmKwzhqF Qi6mUV0Hz1FA9lEKiA7LG/Zl9Q3haLyeHa+RVqpIOJYDr7u/D4IlQVpAfZDVNWO0kXEB Zrp1BT+bS1L0XXPAm6jfAHKdLsGfYbicmIwIzm+VgZQBFW1SXTL3U7vYqA08LYnSFJQR fzTg== X-Gm-Message-State: AKGB3mIWKugeu4QpVwIFc6aK7t/QAcyRGvOiYyAgxIjv/sXcNggsxHFj J6pAaEhcNsd+DPh3ZR/fDjEe0w== X-Received: by 10.98.68.135 with SMTP id m7mr15604341pfi.9.1515556101832; Tue, 09 Jan 2018 19:48:21 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id d24sm5769069pfb.30.2018.01.09.19.48.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:21 -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 11/13] boot_constraint: Add Qualcomm display controller constraints Date: Wed, 10 Jan 2018 09:17:40 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajendra Nayak This sets boot constraints for the display controller used on Qualcomm dragonboard 410c. The display controlled is enabled by the bootloader to show a flash screen during kernel boot. The handover to kernel should be without any glitches on the screen.The resources of the display controller (like regulators) are shared with other peripherals, which may reconfigure those resources before the display driver comes up. The same problem can happen if the display driver probes first, as the constraints of the other devices (sharing same resources with display controller) may not be honored anymore by the kernel. Signed-off-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- arch/arm64/Kconfig.platforms | 1 + drivers/boot_constraint/Makefile | 1 + drivers/boot_constraint/qcom.c | 122 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 drivers/boot_constraint/qcom.c -- 2.15.0.194.g9af6a3dea062 diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index a586ed728393..b514327290ca 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -136,6 +136,7 @@ config ARCH_QCOM bool "Qualcomm Platforms" select GPIOLIB select PINCTRL + select DEV_BOOT_CONSTRAINT help This enables support for the ARMv8 based Qualcomm chipsets. diff --git a/drivers/boot_constraint/Makefile b/drivers/boot_constraint/Makefile index f3e123b5d854..7b6b5966c908 100644 --- a/drivers/boot_constraint/Makefile +++ b/drivers/boot_constraint/Makefile @@ -4,3 +4,4 @@ obj-y := clk.o deferrable_dev.o core.o pm.o supply.o obj-$(CONFIG_ARCH_HISI) += hikey.o obj-$(CONFIG_ARCH_MXC) += imx.o +obj-$(CONFIG_ARCH_QCOM) += qcom.o diff --git a/drivers/boot_constraint/qcom.c b/drivers/boot_constraint/qcom.c new file mode 100644 index 000000000000..0498f464da05 --- /dev/null +++ b/drivers/boot_constraint/qcom.c @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * This sets up Dragonboard 410c constraints on behalf of the bootloader, which + * uses display controller to display a flash screen during system boot. + * + * Copyright (C) 2017 Linaro. + * Viresh Kumar + * Rajendra Nayak + */ + +#include +#include +#include +#include + +static struct dev_boot_constraint_clk_info iface_clk_info = { + .name = "iface_clk", +}; + +static struct dev_boot_constraint_clk_info bus_clk_info = { + .name = "bus_clk", +}; + +static struct dev_boot_constraint_clk_info core_clk_info = { + .name = "core_clk", +}; + +static struct dev_boot_constraint_clk_info vsync_clk_info = { + .name = "vsync_clk", +}; + +static struct dev_boot_constraint_clk_info esc0_clk_info = { + .name = "core_clk", +}; + +static struct dev_boot_constraint_clk_info byte_clk_info = { + .name = "byte_clk", +}; + +static struct dev_boot_constraint_clk_info pixel_clk_info = { + .name = "pixel_clk", +}; + +static struct dev_boot_constraint_supply_info vdda_info = { + .name = "vdda" +}; + +static struct dev_boot_constraint_supply_info vddio_info = { + .name = "vddio" +}; + +static struct dev_boot_constraint constraints_mdss[] = { + { + .type = DEV_BOOT_CONSTRAINT_PM, + .data = NULL, + }, +}; + +static struct dev_boot_constraint constraints_mdp[] = { + { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &iface_clk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &bus_clk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &core_clk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &vsync_clk_info, + }, +}; + +static struct dev_boot_constraint constraints_dsi[] = { + { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &esc0_clk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &byte_clk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_CLK, + .data = &pixel_clk_info, + }, { + .type = DEV_BOOT_CONSTRAINT_SUPPLY, + .data = &vdda_info, + + }, { + .type = DEV_BOOT_CONSTRAINT_SUPPLY, + .data = &vddio_info, + }, +}; + +static struct dev_boot_constraint_of constraints[] = { + { + .compat = "qcom,mdss", + .constraints = constraints_mdss, + .count = ARRAY_SIZE(constraints_mdss), + }, { + .compat = "qcom,mdp5", + .constraints = constraints_mdp, + .count = ARRAY_SIZE(constraints_mdp), + }, { + .compat = "qcom,mdss-dsi-ctrl", + .constraints = constraints_dsi, + .count = ARRAY_SIZE(constraints_dsi), + }, +}; + +static int __init qcom_constraints_init(void) +{ + /* Only Dragonboard 410c is supported for now */ + if (!of_machine_is_compatible("qcom,apq8016-sbc")) + return 0; + + dev_boot_constraint_add_deferrable_of(constraints, + ARRAY_SIZE(constraints)); + + return 0; +} +subsys_initcall(qcom_constraints_init); From patchwork Wed Jan 10 03:47:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124002 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4789082qgn; Tue, 9 Jan 2018 19:49:01 -0800 (PST) X-Google-Smtp-Source: ACJfBouFKgJp15mfGTQJvql5YPZcsQ8fmiQaMAzelixv8JTAEr4lpSeyvVixTmHnukBhLAIAqMDD X-Received: by 10.99.181.73 with SMTP id u9mr10644460pgo.377.1515556141771; Tue, 09 Jan 2018 19:49:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556141; cv=none; d=google.com; s=arc-20160816; b=UJsV1HWpAfC+FWEKk0bvEOdaeY9dClAT2KZpjRtal0s81kITXTnrbf7loNZCn5ZPkO SJg6+HyJXmXDEGFCVE2rnToIThGU7csyq+6lyH+OE42x5AAHNS3geixdpmmxJBnkrWiJ VmUfGmPkdnKjI4t3gZxCvG1hru4zRL83sVaMOytpVQL7VxTas2yeBnzeTo47+jBGJxkc FkwVRtVDKiUuAkDtvnZbowgEhFzWSEvt46x5Un40xNc9KXXR+Vh1MW6ZhjZ65N6W1KBp hdz+2wTXxVsB00JvDZsF65VU1N2a6Z3dwphU/vsX408GsiK+zXzeg8fx5fwVitkafEyz +3/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=bxgKIPnNAttCGWxoqVOS7MP9SR5FQVbgZedI2T9RbRs=; b=dTOTKB3u3gAd6yuwNPu+4RnCWOFliSPK+igcFCfKB/cMVFmb6IF6V/scGj8e7zs7GM 4GfJixDsD1TLXwPpG+tAFtbqPzOgCDap5tX5rrIzTVrqqddMk5Jl9pvs18kAGLgc2LtU q1xnvcG16EsNQsCO6/zzbXsqkEn70dj3Wu6tzVeI1EKpl/kEe8wmjLej7Pn1wlAlBucd 22MIRogZzTAAtd4wfP6svIz3fCpr3OzFjqJh77N5F6wgRy9PwPrhC3/EQXwPzrLEMNfW 2wsnUL/BE+UlF3fINrv0eV3/epNuH1umThVcmpXiIDqcmmyd0l8jlV3B4aSqfRRxToIw Eq7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CFyvRc99; 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 z10si2359910pgp.671.2018.01.09.19.49.01; Tue, 09 Jan 2018 19:49: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=CFyvRc99; 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 S1754461AbeAJDtA (ORCPT + 28 others); Tue, 9 Jan 2018 22:49:00 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35974 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965192AbeAJDsY (ORCPT ); Tue, 9 Jan 2018 22:48:24 -0500 Received: by mail-pg0-f65.google.com with SMTP id j2so8602749pgv.3 for ; Tue, 09 Jan 2018 19:48:24 -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=bxgKIPnNAttCGWxoqVOS7MP9SR5FQVbgZedI2T9RbRs=; b=CFyvRc99OmaAU42WH/kE8F0TWoUl7rW7lV6X7VjC5FjHckaRHEpu6Awvy//aGcVeEg w3ZKESDVg6F8zFMPkJYof9eBiItpqo6TaMf3WX6Fmfg+3SInjr0PekMJfe3Q4QoJQ2PB bDicZnCCtH0xmtmeoRbiTvmJzw5rf8WdhRuE0= 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=bxgKIPnNAttCGWxoqVOS7MP9SR5FQVbgZedI2T9RbRs=; b=AXLh25eCTjaQ58VilmzgeSb1TWwp5hxlM7ikgDZK7mmDM47/RJfTHL45ZTdtqdaLCn qiHlWQ5LyNVLdbZjph3+Dk2he3dYKUS3d3IF1dhyDktP+nwJGXcnVFwOiyx0IXjBBAVH KHTeT2P3sXLbKYDe0HuVZgroHxccuIvZ5y99YbthG1cD830qgRtZYeiNKHEBFqIiTMG3 sTy2kyJLBmVRjt+ADC1NluV2ydemdgRBVrTS5OOgC5OfStjholXMFnv8wyusgntSxFXr Jhdk+2UanGyiiOF+vYI5QclceLb6/+yrqsDna2xAWSwxn0zZxzEY8HbryPBMKHUx4wuR EZJg== X-Gm-Message-State: AKGB3mLSbQQSVhXJhD7lB5XZ3ZYptU3zeUJDqgGv70rQfmshlO7HQvjx S/BmvBXZH8EKrq/Mzy57Uo4evw== X-Received: by 10.98.60.67 with SMTP id j64mr8416039pfa.217.1515556104370; Tue, 09 Jan 2018 19:48:24 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id m21sm27255074pgn.36.2018.01.09.19.48.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:23 -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 12/13] boot_constraint: Update MAINTAINERS Date: Wed, 10 Jan 2018 09:17:41 +0530 Message-Id: <1939c9c38274a92a0a98ec0041fbdfc0981511f3.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add entry for boot constraint subsystem in MAINTAINERS. Signed-off-by: Viresh Kumar --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.15.0.194.g9af6a3dea062 diff --git a/MAINTAINERS b/MAINTAINERS index b46c9cea5ae5..0b9be1c5a982 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2718,6 +2718,15 @@ S: Supported F: drivers/net/bonding/ F: include/uapi/linux/if_bonding.h +BOOT CONSTRAINT SUBSYSTEM +M: Viresh Kumar +L: linux-kernel@vger.kernel.org +S: Maintained +T: git git://git.linaro.org/people/vireshk/linux.git +F: Documentation/driver-api/boot_constraint/ +F: drivers/boot_constraint/ +F: include/linux/boot_constraint.h + BPF (Safe dynamic programs and tools) M: Alexei Starovoitov M: Daniel Borkmann From patchwork Wed Jan 10 03:47:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 124001 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4788713qgn; Tue, 9 Jan 2018 19:48:34 -0800 (PST) X-Google-Smtp-Source: ACJfBouqLwGLYKNo3F0/DRCsggwBVg6LwjkX68y3IF/gn+sEIcSn+Ht+iQm73C2nMbac2LWftA5O X-Received: by 10.98.17.7 with SMTP id z7mr15363641pfi.86.1515556113837; Tue, 09 Jan 2018 19:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515556113; cv=none; d=google.com; s=arc-20160816; b=JA0JlpW2CBACiKfU5c+UvRqw5iDPmBnsCAST+OYxCmL6YE6k0+ezvQ/vtaVZtw4p4x fL145aQDuCe/ISSTSPCSsiEc6vrkEo3r/vwaG3iqMOF67kp7r8aks8lkHzplWUvZhH0z Ts4niDmAiQVLFkRcyUHjRsgVf/FJ2vGGrsJKDYS77Zpb3qzK/sAQj9hSM6uQSVOuNeR0 Q9GBFtHhVS5oxpjr8B2P6jyN3zdNuMYYjs70cGlb18fLwZOpNGRP2SWSZNdLSuhh5YBn i15n8O+Swj4lrgIsxDwzeNQxlWRwLnIjLzIjoz8YgpPxpNwjvlSaM6TDZCaZbSRFUZ5M Kc7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=api11LEndXJusHFPvHzUNPAysLOMa4YH5yakyeuJ+c0=; b=vD7juDZKKBeGI1+ESd8UcEwQKNMlamtKPwr4mHvmNlK3xMNFB55n+12PnNLLyrKw24 yssU9IoZHCsQACKQDbHVRxG3grW1Hg88hngqCfUaYhEk6OWRSjprf5rUmRvQ+RFKu4Mu /GWmA0L8QnsuSOZUh+ytWOTJ0F6OsCRrOqZB+wgkaqK3rG4JCAVOMJ1bkdw1Hc+Idvyx b+bLCbVk1HXxAZQuTXBK4S3SqEJQQRU0MCnXbtY5KfPEA38zUUKs2S2tF5lbXvH2zCX2 ubsrrYv0Fc8Ien1wABNRTThlJxm3NteV5eA7LAqSXeraF/JB8ubP4heKq1gOkAvgbmGM Gj2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b7y0m1J/; 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 z10si2359910pgp.671.2018.01.09.19.48.33; Tue, 09 Jan 2018 19:48:33 -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=b7y0m1J/; 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 S965262AbeAJDsc (ORCPT + 28 others); Tue, 9 Jan 2018 22:48:32 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:37921 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965232AbeAJDs1 (ORCPT ); Tue, 9 Jan 2018 22:48:27 -0500 Received: by mail-pg0-f68.google.com with SMTP id t67so9804880pgc.5 for ; Tue, 09 Jan 2018 19:48:27 -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=b7y0m1J/q5cAi7NO5rLe5gxp+0vJ/MXpOB44wDaIZcloDThKK4NtV4OLlXJEd2rGbQ OR49fV90RAESKxnXUaYtiCjVFYH9XOMRJy5NwijOUHJ+3exboPIizJJVc7b6idGJMB2v ozXIUtwbzyOcJb1V9GjA/5Luy9tBhQnszm+xI= 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=XjHFX89io9bLzNTos4swaYdq6kNv67H367wOZRaHjGjhZ/eBeQNv5cBwpvuX+U+hmn 7h1sdz8OGaVkWxQnm1BEInq4QCGriGDQIL5k/3WR1mvWTmu6qniH4kHfM5yA/q+YV2a1 S62JkqgKhSrt1wG2hJaA4rZYPe28+dwGQO2iRNlsxGblbPLzIDvb8LSDiNpU6gJGivKR 2FCIbZeSyVz8wbvje5oeWCR10NHAw2AVHdViMolJV1MoP/yIxEw0cJxdQXNLA/k4j0jT OPejCO0icVH/PJetkYputBtQpbHXU7vfrxe0JLTQ5Wchjd2et44Em7j8VWKjaeh8Ql9s FjEw== X-Gm-Message-State: AKGB3mKCTM/VKBuBo9Ow5VjC4Rl9Lk4DhwWOz2ybOy4T9Dxwvvd0xiKL JyQ5FU/oqHV3PD2vZ1GMpYzPAg== X-Received: by 10.98.163.131 with SMTP id q3mr6328624pfl.87.1515556106877; Tue, 09 Jan 2018 19:48:26 -0800 (PST) Received: from localhost ([122.172.19.39]) by smtp.gmail.com with ESMTPSA id k63sm33139898pfk.172.2018.01.09.19.48.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 19:48:26 -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 13/13] boot_constraint: Add documentation Date: Wed, 10 Jan 2018 09:17:42 +0530 Message-Id: <000b848c02d4ef5d7d7bc06d3c30c9d27862ba60.1515554879.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.15.0.194.g9af6a3dea062 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