hisi_sas: Add initial bare main driver
authorJohn Garry <john.garry@huawei.com>
Tue, 17 Nov 2015 16:50:30 +0000 (00:50 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 26 Nov 2015 03:12:51 +0000 (22:12 -0500)
This patch adds the initial bare main driver for the HiSilicon SAS
HBA. This only introduces the changes to build and load the main driver
module.

The complete driver consists of the core main module and also a module
platform driver for driving the hw.

The HBA is a platform device.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/Kconfig
drivers/scsi/Makefile
drivers/scsi/hisi_sas/Kconfig [new file with mode: 0644]
drivers/scsi/hisi_sas/Makefile [new file with mode: 0644]
drivers/scsi/hisi_sas/hisi_sas.h [new file with mode: 0644]
drivers/scsi/hisi_sas/hisi_sas_main.c [new file with mode: 0644]

index 5f692ae4074959e019a74eb0c81405cb2869195c..37dce2380a527224ae9fa0307908817a377ded5d 100644 (file)
@@ -473,6 +473,7 @@ config SCSI_AACRAID
 source "drivers/scsi/aic7xxx/Kconfig.aic7xxx"
 source "drivers/scsi/aic7xxx/Kconfig.aic79xx"
 source "drivers/scsi/aic94xx/Kconfig"
+source "drivers/scsi/hisi_sas/Kconfig"
 source "drivers/scsi/mvsas/Kconfig"
 
 config SCSI_MVUMI
index c14bca4a9675c1d1ce29d759354cd8a835bdf98d..862ab4efad61e90de24c506675801ec8d16ecff5 100644 (file)
@@ -157,6 +157,7 @@ obj-$(CONFIG_CHR_DEV_SCH)   += ch.o
 obj-$(CONFIG_SCSI_ENCLOSURE)   += ses.o
 
 obj-$(CONFIG_SCSI_OSD_INITIATOR) += osd/
+obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas/
 
 # This goes last, so that "real" scsi devices probe earlier
 obj-$(CONFIG_SCSI_DEBUG)       += scsi_debug.o
diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig
new file mode 100644 (file)
index 0000000..37a0c71
--- /dev/null
@@ -0,0 +1,6 @@
+config SCSI_HISI_SAS
+       tristate "HiSilicon SAS"
+       select SCSI_SAS_LIBSAS
+       select BLK_DEV_INTEGRITY
+       help
+               This driver supports HiSilicon's SAS HBA
diff --git a/drivers/scsi/hisi_sas/Makefile b/drivers/scsi/hisi_sas/Makefile
new file mode 100644 (file)
index 0000000..d86b05e
--- /dev/null
@@ -0,0 +1 @@
+obj-$(CONFIG_SCSI_HISI_SAS)            += hisi_sas_main.o
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
new file mode 100644 (file)
index 0000000..a5cec22
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Linaro Ltd.
+ * Copyright (c) 2015 Hisilicon Limited.
+ *
+ * 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 _HISI_SAS_H_
+#define _HISI_SAS_H_
+
+#include <linux/dmapool.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <scsi/libsas.h>
+
+#define DRV_VERSION "v1.0"
+
+#endif
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
new file mode 100644 (file)
index 0000000..7201363
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015 Linaro Ltd.
+ * Copyright (c) 2015 Hisilicon Limited.
+ *
+ * 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 "hisi_sas.h"
+#define DRV_NAME "hisi_sas"
+
+static struct scsi_transport_template *hisi_sas_stt;
+
+static struct sas_domain_function_template hisi_sas_transport_ops = {
+};
+
+static __init int hisi_sas_init(void)
+{
+       pr_info("hisi_sas: driver version %s\n", DRV_VERSION);
+
+       hisi_sas_stt = sas_domain_attach_transport(&hisi_sas_transport_ops);
+       if (!hisi_sas_stt)
+               return -ENOMEM;
+
+       return 0;
+}
+
+static __exit void hisi_sas_exit(void)
+{
+       sas_release_transport(hisi_sas_stt);
+}
+
+module_init(hisi_sas_init);
+module_exit(hisi_sas_exit);
+
+MODULE_VERSION(DRV_VERSION);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("John Garry <john.garry@huawei.com>");
+MODULE_DESCRIPTION("HISILICON SAS controller driver");
+MODULE_ALIAS("platform:" DRV_NAME);