aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vme/boards
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-26 15:34:58 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-26 15:34:58 -0400
commitdb3b9e990e75573402cda22faf933760f076c033 (patch)
tree4e742e97f7bd71adc61ce23938e361d80b61a45d /drivers/vme/boards
parent8176df8e95df4c867457076190cfb18f2d7ff18c (diff)
Staging: VME: move VME drivers out of staging
This moves the VME core, VME board drivers, and VME bridge drivers out of the drivers/staging/vme/ area to drivers/vme/. The VME device drivers have not moved out yet due to some API questions they are still working through, that should happen soon, hopefully. Cc: Martyn Welch <martyn.welch@ge.com> Cc: Manohar Vanga <manohar.vanga@cern.ch> Cc: Vincent Bossier <vincent.bossier@gmail.com> Cc: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vme/boards')
-rw-r--r--drivers/vme/boards/Kconfig9
-rw-r--r--drivers/vme/boards/Makefile5
-rw-r--r--drivers/vme/boards/vme_vmivme7805.c123
-rw-r--r--drivers/vme/boards/vme_vmivme7805.h37
4 files changed, 174 insertions, 0 deletions
diff --git a/drivers/vme/boards/Kconfig b/drivers/vme/boards/Kconfig
new file mode 100644
index 00000000000..76163135352
--- /dev/null
+++ b/drivers/vme/boards/Kconfig
@@ -0,0 +1,9 @@
1comment "VME Board Drivers"
2
3config VMIVME_7805
4 tristate "VMIVME-7805"
5 help
6 If you say Y here you get support for the VMIVME-7805 board.
7 This board has an additional control interface to the Universe II
8 chip. This driver has to be included if you want to access VME bus
9 with VMIVME-7805 board.
diff --git a/drivers/vme/boards/Makefile b/drivers/vme/boards/Makefile
new file mode 100644
index 00000000000..43658340885
--- /dev/null
+++ b/drivers/vme/boards/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the VME board drivers.
3#
4
5obj-$(CONFIG_VMIVME_7805) += vme_vmivme7805.o
diff --git a/drivers/vme/boards/vme_vmivme7805.c b/drivers/vme/boards/vme_vmivme7805.c
new file mode 100644
index 00000000000..8e05bb4e135
--- /dev/null
+++ b/drivers/vme/boards/vme_vmivme7805.c
@@ -0,0 +1,123 @@
1/*
2 * Support for the VMIVME-7805 board access to the Universe II bridge.
3 *
4 * Author: Arthur Benilov <arthur.benilov@iba-group.com>
5 * Copyright 2010 Ion Beam Application, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/errno.h>
16#include <linux/pci.h>
17#include <linux/poll.h>
18#include <linux/io.h>
19
20#include "vme_vmivme7805.h"
21
22static int __init vmic_init(void);
23static int vmic_probe(struct pci_dev *, const struct pci_device_id *);
24static void vmic_remove(struct pci_dev *);
25static void __exit vmic_exit(void);
26
27/** Base address to access FPGA register */
28static void *vmic_base;
29
30static const char driver_name[] = "vmivme_7805";
31
32static DEFINE_PCI_DEVICE_TABLE(vmic_ids) = {
33 { PCI_DEVICE(PCI_VENDOR_ID_VMIC, PCI_DEVICE_ID_VTIMR) },
34 { },
35};
36
37static struct pci_driver vmic_driver = {
38 .name = driver_name,
39 .id_table = vmic_ids,
40 .probe = vmic_probe,
41 .remove = vmic_remove,
42};
43
44static int __init vmic_init(void)
45{
46 return pci_register_driver(&vmic_driver);
47}
48
49static int vmic_probe(struct pci_dev *pdev, const struct pci_device_id *id)
50{
51 int retval;
52 u32 data;
53
54 /* Enable the device */
55 retval = pci_enable_device(pdev);
56 if (retval) {
57 dev_err(&pdev->dev, "Unable to enable device\n");
58 goto err;
59 }
60
61 /* Map Registers */
62 retval = pci_request_regions(pdev, driver_name);
63 if (retval) {
64 dev_err(&pdev->dev, "Unable to reserve resources\n");
65 goto err_resource;
66 }
67
68 /* Map registers in BAR 0 */
69 vmic_base = ioremap_nocache(pci_resource_start(pdev, 0), 16);
70 if (!vmic_base) {
71 dev_err(&pdev->dev, "Unable to remap CRG region\n");
72 retval = -EIO;
73 goto err_remap;
74 }
75
76 /* Clear the FPGA VME IF contents */
77 iowrite32(0, vmic_base + VME_CONTROL);
78
79 /* Clear any initial BERR */
80 data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
81 data |= BM_VME_CONTROL_BERRST;
82 iowrite32(data, vmic_base + VME_CONTROL);
83
84 /* Enable the vme interface and byte swapping */
85 data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
86 data = data | BM_VME_CONTROL_MASTER_ENDIAN |
87 BM_VME_CONTROL_SLAVE_ENDIAN |
88 BM_VME_CONTROL_ABLE |
89 BM_VME_CONTROL_BERRI |
90 BM_VME_CONTROL_BPENA |
91 BM_VME_CONTROL_VBENA;
92 iowrite32(data, vmic_base + VME_CONTROL);
93
94 return 0;
95
96err_remap:
97 pci_release_regions(pdev);
98err_resource:
99 pci_disable_device(pdev);
100err:
101 return retval;
102}
103
104static void vmic_remove(struct pci_dev *pdev)
105{
106 iounmap(vmic_base);
107 pci_release_regions(pdev);
108 pci_disable_device(pdev);
109
110}
111
112static void __exit vmic_exit(void)
113{
114 pci_unregister_driver(&vmic_driver);
115}
116
117MODULE_DESCRIPTION("VMIVME-7805 board support driver");
118MODULE_AUTHOR("Arthur Benilov <arthur.benilov@iba-group.com>");
119MODULE_LICENSE("GPL");
120
121module_init(vmic_init);
122module_exit(vmic_exit);
123
diff --git a/drivers/vme/boards/vme_vmivme7805.h b/drivers/vme/boards/vme_vmivme7805.h
new file mode 100644
index 00000000000..44c2c449808
--- /dev/null
+++ b/drivers/vme/boards/vme_vmivme7805.h
@@ -0,0 +1,37 @@
1/*
2 * vmivme_7805.h
3 *
4 * Support for the VMIVME-7805 board access to the Universe II bridge.
5 *
6 * Author: Arthur Benilov <arthur.benilov@iba-group.com>
7 * Copyright 2010 Ion Beam Application, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15
16#ifndef _VMIVME_7805_H
17#define _VMIVME_7805_H
18
19#ifndef PCI_VENDOR_ID_VMIC
20#define PCI_VENDOR_ID_VMIC 0x114A
21#endif
22
23#ifndef PCI_DEVICE_ID_VTIMR
24#define PCI_DEVICE_ID_VTIMR 0x0004
25#endif
26
27#define VME_CONTROL 0x0000
28#define BM_VME_CONTROL_MASTER_ENDIAN 0x0001
29#define BM_VME_CONTROL_SLAVE_ENDIAN 0x0002
30#define BM_VME_CONTROL_ABLE 0x0004
31#define BM_VME_CONTROL_BERRI 0x0040
32#define BM_VME_CONTROL_BERRST 0x0080
33#define BM_VME_CONTROL_BPENA 0x0400
34#define BM_VME_CONTROL_VBENA 0x0800
35
36#endif /* _VMIVME_7805_H */
37