All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Joao Pinto <Joao.Pinto@synopsys.com>,
	Arnd Bergmann <arnd@arndb.de>, <gregkh@linuxfoundation.org>,
	<kishon@ti.com>, <nsekhar@ti.com>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>
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	[thread overview]
Message-ID: <20170818145810.17649-9-kishon@ti.com> (raw)
In-Reply-To: <20170818145810.17649-1-kishon@ti.com>

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 <kishon@ti.com>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

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);
 
-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Joao Pinto <Joao.Pinto@synopsys.com>,
	Arnd Bergmann <arnd@arndb.de>,
	gregkh@linuxfoundation.org, kishon@ti.com, nsekhar@ti.com,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org
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	[thread overview]
Message-ID: <20170818145810.17649-9-kishon@ti.com> (raw)
In-Reply-To: <20170818145810.17649-1-kishon@ti.com>

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 <kishon@ti.com>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

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);
 
-- 
2.11.0

  parent reply	other threads:[~2017-08-18 14:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 14:57 [PATCH 00/18] PCI: endpoint: Make pci-epf-test more flexible Kishon Vijay Abraham I
2017-08-18 14:57 ` Kishon Vijay Abraham I
2017-08-18 14:57 ` [PATCH 01/18] PCI: endpoint: pci-epc-core: Use of_dma_configure() to set initial dma mask Kishon Vijay Abraham I
2017-08-18 14:57   ` Kishon Vijay Abraham I
2017-08-18 14:57 ` [PATCH 02/18] PCI: endpoint: pci-epf-core: Add an API to get matching "pci_epf_device_id" Kishon Vijay Abraham I
2017-08-18 14:57   ` Kishon Vijay Abraham I
2017-08-18 14:57 ` [PATCH 03/18] PCI: endpoint: pci-epf-core: Make ->remove() callback optional Kishon Vijay Abraham I
2017-08-18 14:57   ` Kishon Vijay Abraham I
2017-08-18 14:57 ` [PATCH 04/18] PCI: endpoint: pci-epc-mem: Add support for configurable page size Kishon Vijay Abraham I
2017-08-18 14:57   ` Kishon Vijay Abraham I
2017-08-18 14:57 ` [PATCH 05/18] PCI: endpoint: functions/pci-epf-test: Add "volatile" to pci_epf_test_reg Kishon Vijay Abraham I
2017-08-18 14:57   ` Kishon Vijay Abraham I
2017-08-18 14:57 ` [PATCH 06/18] PCI: endpoint: functions/pci-epf-test: Do not reset *command* inadvertently Kishon Vijay Abraham I
2017-08-18 14:57   ` Kishon Vijay Abraham I
2017-08-18 14:57 ` [PATCH 07/18] PCI: endpoint: functions/pci-epf-test: Add support to use _any_ BAR's to map PCI_ENDPOINT_TEST regs Kishon Vijay Abraham I
2017-08-18 14:57   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` Kishon Vijay Abraham I [this message]
2017-08-18 14:58   ` [PATCH 08/18] PCI: endpoint: functions/pci-epf-test: Add support to poll early for host commands Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 09/18] PCI: endpoint: functions/pci-epf-test: Remove the ->remove() callback Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 10/18] PCI: dwc: designware: Provide page_size to pci_epc_mem Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 11/18] PCI: dwc: dra7xx: Reset all BARs during initialization Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 12/18] PCI: dwc: designware-ep: Do not disable " Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 13/18] misc: pci_endpoint_test: Add support for PCI_ENDPOINT_TEST regs to be mapped to any BAR Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 14/18] misc: pci_endpoint_test: Add support to provide aligned buffer addresses Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 15/18] misc: pci_endpoint_test: Add support to not enable MSI interrupts Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 16/18] misc: pci_endpoint_test: Avoid using hard coded BAR sizes Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 17/18] misc: pci_endpoint_test: Enable/Disable MSI using module param Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 14:58 ` [PATCH 18/18] tools: PCI: Add a missing option help line Kishon Vijay Abraham I
2017-08-18 14:58   ` Kishon Vijay Abraham I
2017-08-18 15:53 ` [PATCH 00/18] PCI: endpoint: Make pci-epf-test more flexible Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170818145810.17649-9-kishon@ti.com \
    --to=kishon@ti.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.