Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571758

[PATCH v3 12/18] drivers/fsi: Set up links for slave communication

From Christopher Bostic <cbostic@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH v3 12/18] drivers/fsi: Set up links for slave communication
Date 2017-02-01 18:00 +0100
Message-ID <t66qf-8ov-57@gated-at.bofh.it> (permalink)
References <t66qd-8ov-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Chris Bostic <cbostic@us.ibm.com>

Enable each link and send a break command in preparation
for scanning each link for slaves.

Signed-off-by: Chris Bostic <cbostic@us.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 drivers/fsi/fsi-core.c   | 38 ++++++++++++++++++++++++++++++++++++--
 drivers/fsi/fsi-master.h |  2 ++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 3119aa1..b2c9274 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -271,14 +271,48 @@ static int fsi_slave_init(struct fsi_master *master,
 
 /* FSI master support */
 
+static int fsi_master_link_enable(struct fsi_master *master, int link)
+{
+	if (master->link_enable)
+		return master->link_enable(master, link);
+
+	return 0;
+}
+
+/*
+ * Issue a break command on this link
+ */
+static int fsi_master_break(struct fsi_master *master, int link)
+{
+	if (master->send_break)
+		return master->send_break(master, link);
+
+	return 0;
+}
+
 static int fsi_master_scan(struct fsi_master *master)
 {
-	int link, slave_id;
+	int link, slave_id, rc;
+
+	for (link = 0; link < master->n_links; link++) {
+		rc = fsi_master_link_enable(master, link);
+		if (rc) {
+			dev_dbg(master->dev,
+				"enable link:%d failed with:%d\n", link, rc);
+			continue;
+		}
+		rc = fsi_master_break(master, link);
+		if (rc) {
+			dev_dbg(master->dev,
+				"Break to link:%d failed with:%d\n", link, rc);
+			continue;
+		}
 
-	for (link = 0; link < master->n_links; link++)
 		for (slave_id = 0; slave_id < FSI_N_SLAVES; slave_id++)
 			fsi_slave_init(master, link, slave_id);
 
+	}
+
 	return 0;
 }
 
diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h
index e75a810..94a0671 100644
--- a/drivers/fsi/fsi-master.h
+++ b/drivers/fsi/fsi-master.h
@@ -29,6 +29,8 @@ struct fsi_master {
 	int		(*write)(struct fsi_master *, int link,
 				uint8_t slave, uint32_t addr,
 				const void *val, size_t size);
+	int		(*send_break)(struct fsi_master *, int link);
+	int		(*link_enable)(struct fsi_master *, int link);
 };
 
 extern int fsi_master_register(struct fsi_master *master);
-- 
1.8.2.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/18] FSI device driver introduction Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 17/18] drivers/fsi: Document FSI master sysfs files in ABI Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 06/18] drivers/fsi: Add empty master scan Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 13/18] drivers/fsi: Set slave SMODE to init communication Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 03/18] drivers/fsi: add driver to device matches Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 15/18] drivers/fsi: Add FSI bus documentation Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
    Re: [PATCH v3 15/18] drivers/fsi: Add FSI bus documentation Rob Herring <robh@kernel.org> - 2017-02-07 18:30 +0100
  [PATCH v3 09/18] drivers/fsi: Implement slave initialisation Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 01/18] drivers/fsi: Add empty fsi bus definitions Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 12/18] drivers/fsi: Set up links for slave communication Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
  [PATCH v3 16/18] drivers/fsi: Add documentation for GPIO based FSI master Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:00 +0100
    Re: [PATCH v3 16/18] drivers/fsi: Add documentation for GPIO based  FSI master Rob Herring <robh@kernel.org> - 2017-02-07 18:30 +0100
  [PATCH v3 07/18] drivers/fsi: Add FSI crc calculators to library Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:10 +0100
  [PATCH v3 10/18] drivers/fsi: scan slaves & register devices Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:10 +0100
  [PATCH v3 11/18] drivers/fsi: Add device read/write/peek functions Christopher Bostic <cbostic@linux.vnet.ibm.com> - 2017-02-01 18:10 +0100

csiph-web