aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/basler/excite/excite_procfs.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-06-18 11:39:46 -0400
committerRalf Baechle <ralf@linux-mips.org>2006-06-19 12:39:26 -0400
commit35189fad3cb5f6e3ab66c8321928a851de0cd2b1 (patch)
tree70dcd11a08d964da9ee27bc716b2205f250b42dd /arch/mips/basler/excite/excite_procfs.c
parent355c471f2ff324c21f8a1fb8e2e242a0f2a4aa68 (diff)
[MIPS] Support for the RM9000-based Basler eXcite smart camera platform.
Signed-off-by: Thomas Koeller <thomas.koeller@baslerweb.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/basler/excite/excite_procfs.c')
-rw-r--r--arch/mips/basler/excite/excite_procfs.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/arch/mips/basler/excite/excite_procfs.c b/arch/mips/basler/excite/excite_procfs.c
new file mode 100644
index 000000000000..c62be0341fb8
--- /dev/null
+++ b/arch/mips/basler/excite/excite_procfs.c
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) 2004, 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * Procfs support for Basler eXcite
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/config.h>
23#include <linux/proc_fs.h>
24#include <linux/stat.h>
25#include <asm/page.h>
26#include <asm/io.h>
27#include <asm/system.h>
28#include <asm/rm9k-ocd.h>
29
30#include <excite.h>
31
32static int excite_get_unit_id(char *buf, char **addr, off_t offs, int size)
33{
34 const int len = snprintf(buf, PAGE_SIZE, "%06x", unit_id);
35 const int w = len - offs;
36 *addr = buf + offs;
37 return w < size ? w : size;
38}
39
40static int
41excite_bootrom_read(char *page, char **start, off_t off, int count,
42 int *eof, void *data)
43{
44 void __iomem * src;
45
46 if (off >= EXCITE_SIZE_BOOTROM) {
47 *eof = 1;
48 return 0;
49 }
50
51 if ((off + count) > EXCITE_SIZE_BOOTROM)
52 count = EXCITE_SIZE_BOOTROM - off;
53
54 src = ioremap(EXCITE_PHYS_BOOTROM + off, count);
55 if (src) {
56 memcpy_fromio(page, src, count);
57 iounmap(src);
58 *start = page;
59 } else {
60 count = -ENOMEM;
61 }
62
63 return count;
64}
65
66void excite_procfs_init(void)
67{
68 /* Create & populate /proc/excite */
69 struct proc_dir_entry * const pdir = proc_mkdir("excite", &proc_root);
70 if (pdir) {
71 struct proc_dir_entry * e;
72
73 e = create_proc_info_entry("unit_id", S_IRUGO, pdir,
74 excite_get_unit_id);
75 if (e) e->size = 6;
76
77 e = create_proc_read_entry("bootrom", S_IRUGO, pdir,
78 excite_bootrom_read, NULL);
79 if (e) e->size = EXCITE_SIZE_BOOTROM;
80 }
81}