summaryrefslogtreecommitdiffstats
path: root/arch/tile/gxio/trio.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-04-07 16:53:03 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-07-11 16:04:58 -0400
commitbce5bbbb23f780a792be7e594af7cd4b4aae1cd4 (patch)
treed140d8badb0ed24f4ccc2f89266772ae6836f0f3 /arch/tile/gxio/trio.c
parent10104a1ad670889adc1ae3779df968db621b5dbd (diff)
downloadblackbird-op-linux-bce5bbbb23f780a792be7e594af7cd4b4aae1cd4.tar.gz
blackbird-op-linux-bce5bbbb23f780a792be7e594af7cd4b4aae1cd4.zip
arch/tile: provide kernel support for the tilegx TRIO shim
Provide kernel support for the tilegx "Transaction I/O" (TRIO) on-chip hardware. This hardware implements the PCIe interface for tilegx; the driver changes to use TRIO for PCIe are in a subsequent commit. The change is layered on top of the tilegx GXIO IORPC subsystem. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/gxio/trio.c')
-rw-r--r--arch/tile/gxio/trio.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/tile/gxio/trio.c b/arch/tile/gxio/trio.c
new file mode 100644
index 000000000000..69f0b8df3ce3
--- /dev/null
+++ b/arch/tile/gxio/trio.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2012 Tilera Corporation. All Rights Reserved.
+ *
+ * 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, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for
+ * more details.
+ */
+
+/*
+ * Implementation of trio gxio calls.
+ */
+
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/module.h>
+
+#include <gxio/trio.h>
+#include <gxio/iorpc_globals.h>
+#include <gxio/iorpc_trio.h>
+#include <gxio/kiorpc.h>
+
+int gxio_trio_init(gxio_trio_context_t *context, unsigned int trio_index)
+{
+ char file[32];
+ int fd;
+
+ snprintf(file, sizeof(file), "trio/%d/iorpc", trio_index);
+ fd = hv_dev_open((HV_VirtAddr) file, 0);
+ if (fd < 0) {
+ context->fd = -1;
+
+ if (fd >= GXIO_ERR_MIN && fd <= GXIO_ERR_MAX)
+ return fd;
+ else
+ return -ENODEV;
+ }
+
+ context->fd = fd;
+
+ return 0;
+}
+
+EXPORT_SYMBOL_GPL(gxio_trio_init);
OpenPOWER on IntegriCloud