From patchwork Fri Aug 11 13:30:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 109868 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp917633qge; Fri, 11 Aug 2017 06:30:57 -0700 (PDT) X-Received: by 10.99.100.134 with SMTP id y128mr15328784pgb.365.1502458257723; Fri, 11 Aug 2017 06:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502458257; cv=none; d=google.com; s=arc-20160816; b=v7um1f8PaTWjAwV6hYjeuv1J9iTIVEAZS6BLAEne5NULpkVJxWAbjWsNmJKN0d/8q9 Y7hUtb1AIngCCUPbDIjwCcr1sGWCoQD9NS9mU3gKTV9ckhO6jTH/Ln/wWMZtW827iMGb Rc+nD9DeAaga8nkVgTHp0ARsEMtd090TAIGjyX6TG5wDgvdmV2fydrH+7hdqXeabgGFG UqjOltRVBzdBAGritSKEPkadm03PZAWEtBxIIEDLMaMliQOytuAOF5mHVHhh5Mm96N0v Tfx/ViFvA+nZeBThCoZc4OudoV50C4wrpB58hE0fI+O9JhsUSTWhynFuC2lORVvCVkd6 nETQ== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1nkLDcfG0kx1foZzpaYMqvvL5sr6RvbRQLtD50oC8go=; b=rnExUtH0sX+QfmKxc19n/WVwYXuJ24qFk0OaWq1VMr2r5G8dKDbqRCUEioO10sV8Ot Vepn7ykLYPm8XFLdK4ftiwskXk7vvpn0CcCKQcciBGonKWDY5EMUl7ab6+J5DTZZoo5y fuVpc7C51a+Xt7OJJ0oLFOQDpiqeDdNmdn/gWrYMEG4JBn4+Db7OObW8TFnwMmvaD7wV KOmCgma9/lLkh1o6RsUfJpVzU75XQGGdNkm8lHdDpDgw/+rvsCSKGTdw8bC6yYIUgHoo NKjckrwYCSU8ana6VNxT0QNNldnCJA7r5IK+UVIfgSAfw+BhOy+IK2rFm77pwK3D37Nm iclA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v15si514594pgt.73.2017.08.11.06.30.57; Fri, 11 Aug 2017 06:30:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753321AbdHKNaZ (ORCPT + 25 others); Fri, 11 Aug 2017 09:30:25 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44568 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753215AbdHKNaW (ORCPT ); Fri, 11 Aug 2017 09:30:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3DABA15AD; Fri, 11 Aug 2017 06:30:22 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B93AF3F540; Fri, 11 Aug 2017 06:30:20 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Arnd Bergmann , Andy Gross , Jens Wiklander Subject: [PATCH 1/3] firmware: of: populate /firmware/ node during init Date: Fri, 11 Aug 2017 14:30:35 +0100 Message-Id: <1502458237-1683-2-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502458237-1683-1-git-send-email-sudeep.holla@arm.com> References: <1502458237-1683-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since "/firmware" does not have its own "compatible" property as it's just collection of nodes representing firmware interface, it's sub-nodes are not populated during system initialization. Currently different firmware drivers search the /firmware/ node and populate the sub-node devices selectively. Instead we can populate the /firmware/ node during init to avoid more drivers continuing to populate the devices selectively. This patch adds initcall to achieve the same. Cc: Arnd Bergmann Cc: Rob Herring Signed-off-by: Sudeep Holla --- drivers/firmware/Makefile | 1 + drivers/firmware/of.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 drivers/firmware/of.c -- 2.7.4 diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 91d3ff62c653..d9a6fce43613 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o +obj-$(CONFIG_OF) += of.o obj-$(CONFIG_QCOM_SCM) += qcom_scm.o obj-$(CONFIG_QCOM_SCM_64) += qcom_scm-64.o obj-$(CONFIG_QCOM_SCM_32) += qcom_scm-32.o diff --git a/drivers/firmware/of.c b/drivers/firmware/of.c new file mode 100644 index 000000000000..149b9660fb44 --- /dev/null +++ b/drivers/firmware/of.c @@ -0,0 +1,34 @@ +/* + * Populates the nodes under /firmware/ device tree node + * + * Copyright (C) 2017 ARM Ltd. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Released under the GPLv2 only. + * SPDX-License-Identifier: GPL-2.0 + */ + +#include +#include +#include + +static int __init firmware_of_init(void) +{ + struct device_node *fw_np; + int ret; + + fw_np = of_find_node_by_name(NULL, "firmware"); + + if (!fw_np) + return 0; + + ret = of_platform_populate(fw_np, NULL, NULL, NULL); + + of_node_put(fw_np); + + return ret; +} +arch_initcall_sync(firmware_of_init);