From patchwork Sun Oct 29 13:48:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 117416 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1528916qgn; Sun, 29 Oct 2017 06:51:22 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SzkYGQoSxzgjtX22UolGApWMN+MF/HwyyZJ+NadN5tXP5RAJQwQ58e+AZxgbAEpWidFP71 X-Received: by 10.99.96.141 with SMTP id u135mr5350165pgb.316.1509285082748; Sun, 29 Oct 2017 06:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509285082; cv=none; d=google.com; s=arc-20160816; b=sO5EnO2TYYT0TauAhiBPgC9reM3tI0DQzkfFoEkN1AHnY77zAJkim10trAAJ8WFMte /jGqBgG25NqWGGTd0r1AL42R0+3Lqf+0Ki/nq1Ls/Oz/bT63b/Ygd5Y9Q+Y271R1cJvj n3Y5Xat5jx/7occolJsExcCI91mFnJhGdgA10XmMYltx7WLkpPmFndZ+giadPuBc7Swz bgRwVVlcBCqdPIvacBZkbxfbBfiuzLUvqXfiaH8vnOhOzJ4vA42YItZS4/d17A7dKcKG mJZkgmv2ygNTCEeYHgdG8PpeJapZzxlwW6jtjRjH4U9zJZzses4i877Tr8YqCSGi6lvL ytig== 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=bbCnTR7yEQSHK/Llf8XcNTlrxAiUkAg4Hu/HvOy7I04=; b=v09CyJAi68hpEE5d/zh7nD1QmXlu1KOGPBRTjkzl7FaN4mR4OuPs6g4Ipv7Td4UxgX 90kPv0jibcEax1btcj+3aFgbqKkVNTMZKH1vAzPsxzvnUWl7ahqNs06EBy6je4Zb74pF PR5mrvIfl/67KW66xRZ9P9WK+GPYc0osL0mK+HNdBSXDYxxJCnoXIQr85XllOfLNvz+J mrTf9VyQpGwIpIOXUCbnBQ3/9LV6Q4rdkNLb53l/H5o0NBY3aUBWlMYlyjzgLENSCJzV 0Tfa59mfNgORuWqKybzyTZStnm9zNvMrJE0jr2jeU+08n8oTFMTmvtVTUxs9do5MaQed sLpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Zmf6B5R/; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d88si8782884pfl.232.2017.10.29.06.51.22; Sun, 29 Oct 2017 06:51:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Zmf6B5R/; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751487AbdJ2NtY (ORCPT + 6 others); Sun, 29 Oct 2017 09:49:24 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:55224 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395AbdJ2NtO (ORCPT ); Sun, 29 Oct 2017 09:49:14 -0400 Received: by mail-pf0-f196.google.com with SMTP id n89so8651824pfk.11 for ; Sun, 29 Oct 2017 06:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=MGNME3iV88Fpl6OXn/v2oDG0HfU336eiLHOcuqQrUh8=; b=Zmf6B5R/B7RNNkMCqqYtu+GmYtZDyoWShuQGUD3nY2hnvrpTRA8Jj7SbASMiUX0K+P gh4jaUgDqM1eKkd81Z7QMJRt8TNHMmcuEE+yJusoNXamjpNdph3BH85ENjhvwZcB947k 6Zi3wRW8rrl+i0yxtE4mzSvm+m8Cy0MiLdryg= 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=MGNME3iV88Fpl6OXn/v2oDG0HfU336eiLHOcuqQrUh8=; b=NYz8VSAVuzF/gY33MXAk0XsL5uHknzjlDO+d1ZDiqAy1HguN8p5LnPlJbb12POTWCh 99WFtU+4hZWWQ+CkukcZs6y4LaBpT2M3yEVaWreqfrUmAN6Vs/cKtRmZL/f3//SgPc3F VIlLTJYai2c3YMxphZ1EDFnApQeBAUv/Eonnt7RhKY+39Nn5TCjGlFG+CBEB0TQ6T+Xh QLfOtFKd5DauBB4o+v20zZzbv0Lj2gOAEaVb5Er8pi+yO9/+YAgetTnRl4YvRGB97J4x lgvABi2kWGp/YpRjKk6TnkOkYdrMRoeF1ZtU8F7duAlv7J99a2xiy16mpaNIJxgD5vdE vIqw== X-Gm-Message-State: AMCzsaVWneiYlj+gVN7Nd0KPC9q3EYFTBdGDdOHgX2ZzZo56zyErje5x LpsjArMGtgLoTdxlgsLK6H+wHw== X-Received: by 10.98.181.1 with SMTP id y1mr5705387pfe.240.1509284953561; Sun, 29 Oct 2017 06:49:13 -0700 (PDT) Received: from localhost ([122.167.161.211]) by smtp.gmail.com with ESMTPSA id i8sm20407967pgq.67.2017.10.29.06.49.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Oct 2017 06:49:13 -0700 (PDT) From: Viresh Kumar To: Greg Kroah-Hartman Cc: Viresh Kumar , Vincent Guittot , Stephen Boyd , Rajendra Nayak , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robdclark@gmail.com, s.hauer@pengutronix.de, l.stach@pengutronix.de, shawnguo@kernel.org, fabio.estevam@nxp.com, nm@ti.com, xuwei5@hisilicon.com, robh+dt@kernel.org, Frank Rowand , devicetree@vger.kernel.org Subject: [PATCH V4 01/12] of: platform: Add of_find_amba_device_by_node() Date: Sun, 29 Oct 2017 19:18:49 +0530 Message-Id: <80731ad75f52781bf1d5fb1a1a211ee59b4a2ffb.1509284255.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.rc1.236.g92ea95045093 In-Reply-To: References: In-Reply-To: References: Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org of_find_device_by_node() works only with platform devices. Lets create one for amba devices as well. Cc: Frank Rowand Cc: devicetree@vger.kernel.org Signed-off-by: Viresh Kumar --- drivers/of/platform.c | 20 ++++++++++++++++++++ include/linux/of_platform.h | 9 +++++++++ 2 files changed, 29 insertions(+) -- 2.15.0.rc1.236.g92ea95045093 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/of/platform.c b/drivers/of/platform.c index ac15d0e3d27d..b38a8e5908a3 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -60,6 +60,26 @@ 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 + */ +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; +} +EXPORT_SYMBOL(of_find_amba_device_by_node); +#endif + #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 8a561e08bc9e..fbf8a6443885 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -61,6 +61,15 @@ static inline struct platform_device *of_find_device_by_node(struct device_node } #endif +#if defined(CONFIG_OF) && defined(CONFIG_ARM_AMBA) +extern struct amba_device *of_find_amba_device_by_node(struct device_node *np); +#else +static inline struct amba_device *of_find_amba_device_by_node(struct device_node *np) +{ + return NULL; +} +#endif + #ifdef CONFIG_OF_ADDRESS /* Platform drivers register/unregister */ extern struct platform_device *of_device_alloc(struct device_node *np, From patchwork Sun Oct 29 13:48:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 117406 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1527414qgn; Sun, 29 Oct 2017 06:49:36 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SOjOqfkWL1tEV8mVpUzeRZYT+1XIm96S8MFgIxTKBkqkayl5PFxVGxu9rlFhfqPpSOrFc1 X-Received: by 10.99.127.78 with SMTP id p14mr5076372pgn.176.1509284976013; Sun, 29 Oct 2017 06:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509284976; cv=none; d=google.com; s=arc-20160816; b=wmsw85F2DTXzz5idtYs6y5wTG+UeQhQa4B9Jgrqp1xoeeFQu7YHtKG06LJruMW44Xq 9jDRroe2alnCeWKuhvziQJTjzLmiO9V1wIFo9RW2LtBfo0wXnZCmDYfla74Y997km4VH XhForaOIElyNgn6bGrjNy31JtfNtskuc1N4hggow/tNM76mC/TfKAu/9ZoIS7vk/TOfg iunyW3YiOMGOsJhj3CaH70FtpxfI6vtN4lGAjH1/JCR2J6Mb+E0fAktL/+xEdHP5GksP Gpodc0pmjOKbU9HkEKFrfBehy/6UXyiVaRKTFMR362pUfCp0mawtH5AmschHDPzBbGdQ 5fWw== 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=D3MJac11KrTr2ra+Yw3r+KJe71HswxxxdkGzZiHfcSI=; b=c7tZIjdJqAYkZKJt+qvfRYRcOZ9x2mBofCec+utIQxCoBEdw1Q9JQgo98nd6IeR0XR CR/YNPlEpsqhgitMZl7UULDnCZlr+EL5+RaFv2KDuZzEbWtM9kVLn14iIVcF8WOjmLzT CjH/F21Fczq4g4RKbt2q/a3tA2ojJsWqRck+/0a9aAXdk9idODDkDIE6iSDOa5XO2hre t6Hp9w7RFXAMFBiZYj/smrksEG7QmGFDu5+ualXl4SaBKiiCULcBAYXdOpDIOh4QESW/ Sjb1XfL5njX76S/L7c/Uw7m+9/sfemMGmoswK8pZoxK0ZMCUi0go6jGQ7/0lS/uzngWM Rxug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eW7Z8JqI; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si8653501pfh.329.2017.10.29.06.49.35; Sun, 29 Oct 2017 06:49:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eW7Z8JqI; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751540AbdJ2NtT (ORCPT + 6 others); Sun, 29 Oct 2017 09:49:19 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:48765 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751487AbdJ2NtQ (ORCPT ); Sun, 29 Oct 2017 09:49:16 -0400 Received: by mail-pg0-f68.google.com with SMTP id v78so9111676pgb.5 for ; Sun, 29 Oct 2017 06:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=i3mB2YTWccTQOCRmFWxHUEe57HzDqBU87FJuMGdYxt4=; b=eW7Z8JqIoA8MkJAaWa2jksiSsnMx9siJuqkV1GW8YwmGZRn8ylphR4yffeBf4mDgAX tNLzPVtG+wVoYFKfP9TdYTWEOOJGQCW0vQ31IsJEDpnOG5kZ3j6hEeWHvHtMUyVD1VHt JvvfTGi436MRDnlr/jUIm4olPCgi9/iGQy4FE= 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=i3mB2YTWccTQOCRmFWxHUEe57HzDqBU87FJuMGdYxt4=; b=CYlkValx8I98nmFNlsl5ab956XfSA82B60W2fK1HNel1m8r1HJukigRNYxVi7/dvOs XRPewwL0yNuhuqlr74WClPx7BR2fKKaQ+9t/ks6K/FZXxZxHnXq5c4PGxXWCcevVORM5 RT22T86CdcSWy2Oyy2NjnOOzKcA50crYp7vtYxF7eCabE4ybRMs0VRzHs0cmiuQsK75F raMgnKlXgUI4gJn++wbyir6z75XvR/+pDVP6jJv6rq4RO9IUNaKK3okaulAsZXTAYAbi kKSwillKx8M3VHEq7Bb8WVpCO78zInI4lxdEWgEE0XCPgxaGS9KbOCfWzqRUGq/fIh0h ZmOA== X-Gm-Message-State: AMCzsaU2ejQgVsdIos//bwZ6q6blBctR/xiQN6ZsayPAOROMK0za+hdG 0wg+opiSZsadyi7O3seI3SnnDA== X-Received: by 10.98.156.210 with SMTP id u79mr5772841pfk.50.1509284956055; Sun, 29 Oct 2017 06:49:16 -0700 (PDT) Received: from localhost ([122.167.161.211]) by smtp.gmail.com with ESMTPSA id v15sm23517533pfa.50.2017.10.29.06.49.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Oct 2017 06:49:15 -0700 (PDT) From: Viresh Kumar To: Greg Kroah-Hartman Cc: Viresh Kumar , Vincent Guittot , Stephen Boyd , Rajendra Nayak , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robdclark@gmail.com, s.hauer@pengutronix.de, l.stach@pengutronix.de, shawnguo@kernel.org, fabio.estevam@nxp.com, nm@ti.com, xuwei5@hisilicon.com, robh+dt@kernel.org, Frank Rowand , devicetree@vger.kernel.org Subject: [PATCH V4 02/12] of: platform: Make of_platform_bus_create() global Date: Sun, 29 Oct 2017 19:18:50 +0530 Message-Id: <0244d3887d8439bb2c65c14fbc37074543b9789d.1509284255.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.rc1.236.g92ea95045093 In-Reply-To: References: In-Reply-To: References: Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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. Cc: Frank Rowand Cc: devicetree@vger.kernel.org Signed-off-by: Viresh Kumar --- drivers/of/platform.c | 8 ++++---- include/linux/of_platform.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) -- 2.15.0.rc1.236.g92ea95045093 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b38a8e5908a3..808628842ea8 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -362,10 +362,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 fbf8a6443885..3ee106018b60 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -82,6 +82,10 @@ extern struct platform_device *of_platform_device_create(struct device_node *np, struct device *parent); extern int of_platform_device_destroy(struct device *dev, void *data); +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_bus_probe(struct device_node *root, const struct of_device_id *matches, struct device *parent); @@ -118,6 +122,14 @@ static inline int of_platform_device_destroy(struct device *dev, void *data) return -ENODEV; } +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_bus_probe(struct device_node *root, const struct of_device_id *matches, struct device *parent)