[PATCH linux] drivers/fsi: Initial stubs for FSI device driver

Christopher Bostic christopher.lee.bostic at gmail.com
Fri Jul 1 00:45:16 AEST 2016


 Initial stubs for FSI device driver.

Signed-off-by: Christopher Bostic <cbostic at us.ibm.com>
---
 drivers/Makefile      |  1 +
 drivers/fsi/Makefile  |  5 +++++
 drivers/fsi/fsiinit.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/fsi/fsiinit.h | 41 ++++++++++++++++++++++++++++++++++++
 4 files changed, 104 insertions(+)
 create mode 100644 drivers/fsi/Makefile
 create mode 100644 drivers/fsi/fsiinit.c
 create mode 100644 drivers/fsi/fsiinit.h

diff --git a/drivers/Makefile b/drivers/Makefile
index 795d0ca..8ea7c58 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -172,3 +172,4 @@ obj-$(CONFIG_STM)           += hwtracing/stm/
 obj-$(CONFIG_ANDROID)          += android/
 obj-$(CONFIG_NVMEM)            += nvmem/
 obj-$(CONFIG_FPGA)             += fpga/
+obj-$(CONFIG_FSI)                          += fsi/
diff --git a/drivers/fsi/Makefile b/drivers/fsi/Makefile
new file mode 100644
index 0000000..f547c08
--- /dev/null
+++ b/drivers/fsi/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the FSI bus specific drivers.
+#
+
+obj-y          += fsiinit.o
diff --git a/drivers/fsi/fsiinit.c b/drivers/fsi/fsiinit.c
new file mode 100644
index 0000000..d692ea3
--- /dev/null
+++ b/drivers/fsi/fsiinit.c
@@ -0,0 +1,57 @@
+/*
+ * FSI Master device driver
+ *
+ * Copyright 2016 IBM Corp.
+ *
+ * Christopher Bostic <cbostic at us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include "fsiinit.h"
+
+MODULE_AUTHOR("Christopher Bostic cbostic at us.ibm.com");
+MODULE_DESCRIPTION("FSI master device driver");
+
+#define FSIDD_MAJOR    0               /* FSI device driver major */
+#define        FSIDD_TOSTR(x)  #x
+#define        FSIDD_VERNO     4000
+#define        FSIDD_VER(x)    FSIDD_TOSTR(x)
+
+struct fsidd fsidd = {         /* FSI device driver structure definition */
+       .magic = FSI_DD_MAGIC,
+       .strno = FSI_DD_STRNO,
+};
+
+
+static int fsi_start(void)
+{
+       int rc = 0;
+
+
+       printk("FSI DD v:%d installation ok\n", FSIDD_VERNO);
+       return rc;
+}
+
+static void fsi_exit(void)
+{
+
+}
+
+static int __init fsi_init(void)
+{
+       int rc = 0;
+
+       /* Set up the host controller */
+       fsi_start();
+       return rc;
+}
+
+module_init(fsi_init);
+module_exit(fsi_exit);
+
diff --git a/drivers/fsi/fsiinit.h b/drivers/fsi/fsiinit.h
new file mode 100644
index 0000000..70c3e13
--- /dev/null
+++ b/drivers/fsi/fsiinit.h
@@ -0,0 +1,41 @@
+/*
+ * FSI Master device driver structure definitions and defines
+ *
+ * Copyright 2016 IBM Corp.
+ *
+ * Christopher Bostic <cbostic at us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef DRIVERS_FSIINIT_H
+#define DRIVERS_FSIINIT_H
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/device.h>
+#include <linux/workqueue.h>
+#include <linux/hrtimer.h>
+
+#define FSI_DD_MAGIC   0x64644632      /* ddF2 */
+#define FSI_DD_STRNO   0x1             /* Structure version number */
+
+struct fsidd {                         /* FSI Main structure */
+       unsigned long magic;            /* Magic number */
+       unsigned long strno;            /* Structure version number */
+       dev_t major;                    /* Major number of device */
+       struct workqueue_struct *hotp_wq;       /* Hot plug work queue */
+       wait_queue_head_t error_wq;     /* Wait queue for port errors */
+       wait_queue_head_t lbus_wq;      /* Wait queue for lbus events */
+       wait_queue_head_t irq_wq;       /* Wait queue for IRQ loops */
+       wait_queue_head_t link_wq;      /* Wait queue for link changes */
+       unsigned long state;            /* State driver is in */
+       struct device dev;              /* Anchor point in /sys/kernel */
+};
+
+#define        to_fsidd(a)             container_of(a, struct fsidd, kobj)
+
+#endif /* DRIVERS_FSIINIT_H */
-- 
1.8.2.2


More information about the openbmc mailing list