From patchwork Fri Aug 18 14:58:00 2017 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: 110401 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935275obb; Fri, 18 Aug 2017 07:58:56 -0700 (PDT) X-Received: by 10.84.209.172 with SMTP id y41mr9880480plh.61.1503068336279; Fri, 18 Aug 2017 07:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068336; cv=none; d=google.com; s=arc-20160816; b=OFRKPQRXW6xjV1VpibialmiAaRPsiV0r9Hr3wsFEkZwJjVAgoxnuhRmNZRFESnZklG h11KotLF7CebfuIxDVhbMf7iyoN3Ovvi1wcZJwTJnixzs9rN48UoY1xBNDTdNJ6yWjso g0S7FPpjx7WiFOtd+Upj+pj2H2wyTb3Qhpss6FbADaMRrGAk9mu2pKPmX9DiWXLzX0UG gIDkWte4P/qoMm04tNqYVIYX0a4TstCoQJwFpoZXg4AeIt0COqik8NnITNBH5MKOxBq1 ASbwTxHrU0Ve3ZBqlbPsAkgoMjElYP/didSWj2f66DH1EW6e7akPZwg/TIX5J9RGx/EH Ny2Q== 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 :arc-authentication-results; bh=mDvR6N2xC92PbapfKy11QiOHSTKEGrjoHQTwd9JvwrM=; b=ZxGfCRSqfMKPw8Ya05Zcf/uUXwN2FJ29O27ZhocDwaWF/pimrC+1cifL8+yJyXTA2N FDZNGSbXfdFhkXkb0XLez1HR1AWM2K6dNuhLj7mqLwsjrjft76CsN7FdAq/8kzoyVu+k lQmoajhsdOAJ8Q5HD2bWTCji3/NHinIA69MKsW9OT9Ij72a5NiskU8o8S7zc5xNwy0Bv cdcphDY3veZeLSNQ7Dt4+bksUVFGuw+wLxAsoQ38kz3K39Y0FZZrJBw7vNbbF2LwdKKm 2It38BWTOAfsaU6p5i9M0PrEOzQ8Vc8sd7Zt6BHoSH58EKyA4vawPRNQs0gxhy792kpy rNnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=S8JtawFC; 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 q20si3741542pfa.458.2017.08.18.07.58.55; Fri, 18 Aug 2017 07:58:56 -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=S8JtawFC; 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 S1752393AbdHRO6x (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:53 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:19592 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbdHRO6u (ORCPT ); Fri, 18 Aug 2017 10:58:50 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwkGC007580; Fri, 18 Aug 2017 09:58:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068326; bh=zBftX7ZvIAf+i70hp3Jw7XcMnCyb8BxxQfhrLkcgMow=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=S8JtawFCimrpGQmUQjmRccPzoVZ/RdquSMQ4zZY+BgMpwsOdMzB2g0cK2h33qaqVF IjToSrMHQGM/hsXvDBhByKHrEEWfraoo6ghRuMvoUU4kErOgRmKM/3ZEN2ClFUQ/vs pjjbDvxrIZE/mkcGwA7jPSnUib8SjH2B4mT9Bk6Y= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwkAp012250; Fri, 18 Aug 2017 09:58:46 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:46 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) 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.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:46 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwKk6023721; Fri, 18 Aug 2017 09:58:44 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 08/18] PCI: endpoint: functions/pci-epf-test: Add support to poll early for host commands Date: Fri, 18 Aug 2017 20:28:00 +0530 Message-ID: <20170818145810.17649-9-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-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 Certain platforms like TI's K2G doesn't support link-up notification. Add support to poll early (without waiting for the linkup notification) for commands from the host. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/functions/pci-epf-test.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index e378dae9e510..a0aea2500690 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -55,6 +55,7 @@ struct pci_epf_test { void *reg[6]; struct pci_epf *epf; enum pci_barno test_reg_bar; + bool linkup_notifier; struct delayed_work cmd_handler; }; @@ -77,6 +78,7 @@ static struct pci_epf_header test_header = { struct pci_epf_test_data { enum pci_barno test_reg_bar; + bool linkup_notifier; }; static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; @@ -424,6 +426,7 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) static int pci_epf_test_bind(struct pci_epf *epf) { int ret; + struct pci_epf_test *epf_test = epf_get_drvdata(epf); struct pci_epf_header *header = epf->header; struct pci_epc *epc = epf->epc; struct device *dev = &epf->dev; @@ -449,6 +452,9 @@ static int pci_epf_test_bind(struct pci_epf *epf) if (ret) return ret; + if (!epf_test->linkup_notifier) + queue_work(kpcitest_workqueue, &epf_test->cmd_handler.work); + return 0; } @@ -466,11 +472,14 @@ static int pci_epf_test_probe(struct pci_epf *epf) const struct pci_epf_device_id *match; struct pci_epf_test_data *data; enum pci_barno test_reg_bar = BAR_0; + bool linkup_notifier = true; match = pci_epf_match_device(pci_epf_test_ids, epf); data = (struct pci_epf_test_data *)match->driver_data; - if (data) + if (data) { test_reg_bar = data->test_reg_bar; + linkup_notifier = data->linkup_notifier; + } epf_test = devm_kzalloc(dev, sizeof(*epf_test), GFP_KERNEL); if (!epf_test) @@ -479,6 +488,7 @@ static int pci_epf_test_probe(struct pci_epf *epf) epf->header = &test_header; epf_test->epf = epf; epf_test->test_reg_bar = test_reg_bar; + epf_test->linkup_notifier = linkup_notifier; INIT_DELAYED_WORK(&epf_test->cmd_handler, pci_epf_test_cmd_handler);