From patchwork Mon Mar 25 09:39:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 161066 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3750561jan; Mon, 25 Mar 2019 02:43:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+lqz1dafhllbvncNoBgXNmqByPFLx502fZj2YWDw5GdhfI2MEOCtearxgLBGPwKPS6gk3 X-Received: by 2002:a63:9246:: with SMTP id s6mr22670064pgn.316.1553507018229; Mon, 25 Mar 2019 02:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553507018; cv=none; d=google.com; s=arc-20160816; b=dLMTH3XgN6ywwBwXO1cxZ5wstaARWMJJOi0/WsrTufNxCp8UQEnUT0Fv+YWX4MZA3O StRIYdAU3U7V0GPa0IUbXfwjdMDIGxzJP/xISs9PP7LWYJP7sPj27/OUulYhq0H+DHdh gHnMhKTevqV1P9j4aeP2coJ2sRWDk9V2fQZReLdhPRjPl5nI5nvZA3oyHSFhDsEg6aS5 VctkgQ0ng8t+Tg/a+rVMuSzte2x9uZv2E9Z2yo5UG7gqplr0b9p5aRRKLzu7fq32R3NO b5j8uw7M1EAjzFaxCCYU2OSo4ajCuCJ6JlBx4OXsWJXUTeuO13n6BKpC8RwlbFLZV4cr u4hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=dFVQ4pidiC5cYCJgE2pe5Ra71CSY84AMLd39Zm5xel0=; b=xRUmrM/Q0ktd9ERSszb4q5y82zTAML1S0mXpbwDqf7HE3pY6MCSHpD7gbLSxwMCsX2 +3qaydMylM4eF7z5IY3tiYP12aYQUysIYx+z9R9h7nWPMxieGAFDtvgK1uG9xNSmichk 6j0dW4ZSrLqM9aD+qKYuI3Jdb5L/N0C1bua9orml9Ifz42m/fErUhfqdWOrkLCnPNooH WVejMB8oeNxqGQFjKOlmoAxS7CJ1RYPVXGRlgEci+C7Jcab6XSsJ2XvU9SzEBTCVZLLn 2vdMSDD+ubWcCTr9LTcdDWJiNL2ao0rrw/MNY08EttfhI4AwhYuydQ3g7Uxy8npRn/g3 Atjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=oFHlQN+Z; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si14578030pla.80.2019.03.25.02.43.37; Mon, 25 Mar 2019 02:43:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=oFHlQN+Z; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730699AbfCYJng (ORCPT + 31 others); Mon, 25 Mar 2019 05:43:36 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:45066 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730377AbfCYJnf (ORCPT ); Mon, 25 Mar 2019 05:43:35 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2P9hEch068172; Mon, 25 Mar 2019 04:43:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553506994; bh=dFVQ4pidiC5cYCJgE2pe5Ra71CSY84AMLd39Zm5xel0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=oFHlQN+Zv+DIffg/ycZ53VEn1IUGxVmlUKoeiP8RnPqGdybNpVAGllBlBFJE9vh2Z s0nuMAs52kkB9fcgUF4M24KU3LAuBMhgayQZznmirlbGSwsCTX7YXayqWQ5x/2L+ma +Vd54kIfzbMRBn5JicZL6XdH2ntnKe5yyAB9MLJ4= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2P9hEjs015765 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Mar 2019 04:43:14 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 25 Mar 2019 04:43:13 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Mon, 25 Mar 2019 04:43:13 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2P9feaV028077; Mon, 25 Mar 2019 04:43:08 -0500 From: Kishon Vijay Abraham I To: Gustavo Pimentel , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Arnd Bergmann , Murali Karicheri CC: Kishon Vijay Abraham I , Jingoo Han , Greg Kroah-Hartman , , , , , , , Minghuan Lian , Mingkai Hu , Roy Zang , Jesper Nilsson , Sekhar Nori Subject: [PATCH v3 16/26] PCI: OF: Allow of_pci_get_max_link_speed() to be used by PCI Endpoint drivers Date: Mon, 25 Mar 2019 15:09:37 +0530 Message-ID: <20190325093947.32633-17-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325093947.32633-1-kishon@ti.com> References: <20190325093947.32633-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org of_pci_get_max_link_speed() is built only if CONFIG_PCI is enabled. Make of_pci_get_max_link_speed() to be also used by PCI Endpoint controllers with just CONFIG_PCI_ENDPOINT enabled. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- drivers/pci/Makefile | 2 +- drivers/pci/of.c | 44 +++++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 22 deletions(-) -- 2.17.1 Acked-by: Bjorn Helgaas diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 657d642fcc67..28cdd8c0213a 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -10,10 +10,10 @@ obj-$(CONFIG_PCI) += access.o bus.o probe.o host-bridge.o \ ifdef CONFIG_PCI obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_SYSFS) += slot.o -obj-$(CONFIG_OF) += of.o obj-$(CONFIG_ACPI) += pci-acpi.o endif +obj-$(CONFIG_OF) += of.o obj-$(CONFIG_PCI_QUIRKS) += quirks.o obj-$(CONFIG_PCIEPORTBUS) += pcie/ obj-$(CONFIG_HOTPLUG_PCI) += hotplug/ diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 3d32da15c215..8095933f8452 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -15,6 +15,7 @@ #include #include "pci.h" +#ifdef CONFIG_PCI void pci_set_of_node(struct pci_dev *dev) { if (!dev->bus->dev.of_node) @@ -196,27 +197,6 @@ int of_get_pci_domain_nr(struct device_node *node) } EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); -/** - * This function will try to find the limitation of link speed by finding - * a property called "max-link-speed" of the given device node. - * - * @node: device tree node with the max link speed information - * - * Returns the associated max link speed from DT, or a negative value if the - * required property is not found or is invalid. - */ -int of_pci_get_max_link_speed(struct device_node *node) -{ - u32 max_link_speed; - - if (of_property_read_u32(node, "max-link-speed", &max_link_speed) || - max_link_speed > 4) - return -EINVAL; - - return max_link_speed; -} -EXPORT_SYMBOL_GPL(of_pci_get_max_link_speed); - /** * of_pci_check_probe_only - Setup probe only mode if linux,pci-probe-only * is present and valid @@ -537,3 +517,25 @@ int pci_parse_request_of_pci_ranges(struct device *dev, return err; } +#endif /* CONFIG_PCI */ + +/** + * This function will try to find the limitation of link speed by finding + * a property called "max-link-speed" of the given device node. + * + * @node: device tree node with the max link speed information + * + * Returns the associated max link speed from DT, or a negative value if the + * required property is not found or is invalid. + */ +int of_pci_get_max_link_speed(struct device_node *node) +{ + u32 max_link_speed; + + if (of_property_read_u32(node, "max-link-speed", &max_link_speed) || + max_link_speed > 4) + return -EINVAL; + + return max_link_speed; +} +EXPORT_SYMBOL_GPL(of_pci_get_max_link_speed);