aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-08 13:04:20 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-08 13:04:20 -0500
commit21eb4fa1700112d1420d72e1de708af671a251c8 (patch)
tree3afd9f526da50108c27e05ac69826be5e7c2ad6e /drivers/char
parent0c0e8caf9fd6c9a49fb9fbdba14a8b7b4239adde (diff)
parentd003e7a1a569501cbe9a5ca14748177498c4893a (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc
* master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc: (116 commits) [POWERPC] Add export of vgacon_remap_base [POWERPC] Remove bogus comment about page_is_ram [POWERPC] windfarm: don't die on suspend thread signal [POWERPC] Fix comment in kernel/irq.c [POWERPC] ppc: Fix booke watchdog initialization [POWERPC] PPC: Use ARRAY_SIZE macro when appropriate [POWERPC] Use ARRAY_SIZE macro when appropriate [POWERPC] Fix ppc64's writing to struct file_operations [POWERPC] ppc: use syslog macro for the printk log level [POWERPC] ppc: cs4218_tdm remove extra brace [POWERPC] Add mpc52xx/lite5200 PCI support [POWERPC] Only use H_BULK_REMOVE if the firmware supports it [POWERPC] Fixup error handling when emulating a floating point instruction [POWERPC] Enable interrupts if we are doing fp math emulation [POWERPC] Added kprobes support to ppc32 [POWERPC] Make pSeries use the H_BULK_REMOVE hypervisor call [POWERPC] Clear RI bit in MSR before restoring r13 when returning to userspace [POWERPC] Fix performance monitor exception [POWERPC] Compile fixes for arch/powerpc dcr code [POWERPC] Maple: use mmio nvram ...
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig7
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/hvc_beat.c134
-rw-r--r--drivers/char/watchdog/booke_wdt.c20
4 files changed, 153 insertions, 9 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 9e43e39dc35c..d08bb4ee1307 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -610,6 +610,13 @@ config HVC_RTAS
610 help 610 help
611 IBM Console device driver which makes use of RTAS 611 IBM Console device driver which makes use of RTAS
612 612
613config HVC_BEAT
614 bool "Toshiba's Beat Hypervisor Console support"
615 depends on PPC_CELLEB
616 select HVC_DRIVER
617 help
618 Toshiba's Cell Reference Set Beat Console device driver
619
613config HVCS 620config HVCS
614 tristate "IBM Hypervisor Virtual Console Server support" 621 tristate "IBM Hypervisor Virtual Console Server support"
615 depends on PPC_PSERIES 622 depends on PPC_PSERIES
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index fc110637ced6..0326ca1a848a 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_RIO) += rio/ generic_serial.o
45obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o 45obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
46obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o 46obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o
47obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o 47obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
48obj-$(CONFIG_HVC_BEAT) += hvc_beat.o
48obj-$(CONFIG_HVC_DRIVER) += hvc_console.o 49obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
49obj-$(CONFIG_RAW_DRIVER) += raw.o 50obj-$(CONFIG_RAW_DRIVER) += raw.o
50obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o 51obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o
diff --git a/drivers/char/hvc_beat.c b/drivers/char/hvc_beat.c
new file mode 100644
index 000000000000..6f019f19be71
--- /dev/null
+++ b/drivers/char/hvc_beat.c
@@ -0,0 +1,134 @@
1/*
2 * Beat hypervisor console driver
3 *
4 * (C) Copyright 2006 TOSHIBA CORPORATION
5 *
6 * This code is based on drivers/char/hvc_rtas.c:
7 * (C) Copyright IBM Corporation 2001-2005
8 * (C) Copyright Red Hat, Inc. 2005
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 */
24
25#include <linux/module.h>
26#include <linux/init.h>
27#include <linux/err.h>
28#include <linux/string.h>
29#include <linux/console.h>
30#include <asm/prom.h>
31#include <asm/hvconsole.h>
32#include <asm/firmware.h>
33
34#include "hvc_console.h"
35
36extern int64_t beat_get_term_char(uint64_t, uint64_t *, uint64_t *, uint64_t *);
37extern int64_t beat_put_term_char(uint64_t, uint64_t, uint64_t, uint64_t);
38
39struct hvc_struct *hvc_beat_dev = NULL;
40
41/* bug: only one queue is available regardless of vtermno */
42static int hvc_beat_get_chars(uint32_t vtermno, char *buf, int cnt)
43{
44 static unsigned char q[sizeof(unsigned long) * 2]
45 __attribute__((aligned(sizeof(unsigned long))));
46 static int qlen = 0;
47 unsigned long got;
48
49again:
50 if (qlen) {
51 if (qlen > cnt) {
52 memcpy(buf, q, cnt);
53 qlen -= cnt;
54 memmove(q + cnt, q, qlen);
55 return cnt;
56 } else { /* qlen <= cnt */
57 int r;
58
59 memcpy(buf, q, qlen);
60 r = qlen;
61 qlen = 0;
62 return r;
63 }
64 }
65 if (beat_get_term_char(vtermno, &got,
66 ((unsigned long *)q), ((unsigned long *)q) + 1) == 0) {
67 qlen = got;
68 goto again;
69 }
70 return 0;
71}
72
73static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt)
74{
75 unsigned long kb[2];
76 int rest, nlen;
77
78 for (rest = cnt; rest > 0; rest -= nlen) {
79 nlen = (rest > 16) ? 16 : rest;
80 memcpy(kb, buf, nlen);
81 beat_put_term_char(vtermno, rest, kb[0], kb[1]);
82 rest -= nlen;
83 }
84 return cnt;
85}
86
87static struct hv_ops hvc_beat_get_put_ops = {
88 .get_chars = hvc_beat_get_chars,
89 .put_chars = hvc_beat_put_chars,
90};
91
92static int hvc_beat_useit = 1;
93
94static int hvc_beat_config(char *p)
95{
96 hvc_beat_useit = simple_strtoul(p, NULL, 0);
97 return 0;
98}
99
100static int hvc_beat_console_init(void)
101{
102 if (hvc_beat_useit && machine_is_compatible("Beat")) {
103 hvc_instantiate(0, 0, &hvc_beat_get_put_ops);
104 }
105 return 0;
106}
107
108/* temp */
109static int hvc_beat_init(void)
110{
111 struct hvc_struct *hp;
112
113 if (!firmware_has_feature(FW_FEATURE_BEAT))
114 return -ENODEV;
115
116 hp = hvc_alloc(0, NO_IRQ, &hvc_beat_get_put_ops, 16);
117 if (IS_ERR(hp))
118 return PTR_ERR(hp);
119 hvc_beat_dev = hp;
120 return 0;
121}
122
123static void __exit hvc_beat_exit(void)
124{
125 if (hvc_beat_dev)
126 hvc_remove(hvc_beat_dev);
127}
128
129module_init(hvc_beat_init);
130module_exit(hvc_beat_exit);
131
132__setup("hvc_beat=", hvc_beat_config);
133
134console_initcall(hvc_beat_console_init);
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c
index 488902231cc2..0e23f29f71ab 100644
--- a/drivers/char/watchdog/booke_wdt.c
+++ b/drivers/char/watchdog/booke_wdt.c
@@ -35,7 +35,7 @@
35#ifdef CONFIG_FSL_BOOKE 35#ifdef CONFIG_FSL_BOOKE
36#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */ 36#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */
37#else 37#else
38#define WDT_PERIOD_DEFAULT 4 /* Refer to the PPC40x and PPC4xx manuals */ 38#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */
39#endif /* for timing information */ 39#endif /* for timing information */
40 40
41u32 booke_wdt_enabled = 0; 41u32 booke_wdt_enabled = 0;
@@ -48,12 +48,22 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
48#endif 48#endif
49 49
50/* 50/*
51 * booke_wdt_ping:
52 */
53static __inline__ void booke_wdt_ping(void)
54{
55 mtspr(SPRN_TSR, TSR_ENW|TSR_WIS);
56}
57
58/*
51 * booke_wdt_enable: 59 * booke_wdt_enable:
52 */ 60 */
53static __inline__ void booke_wdt_enable(void) 61static __inline__ void booke_wdt_enable(void)
54{ 62{
55 u32 val; 63 u32 val;
56 64
65 /* clear status before enabling watchdog */
66 booke_wdt_ping();
57 val = mfspr(SPRN_TCR); 67 val = mfspr(SPRN_TCR);
58 val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); 68 val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period));
59 69
@@ -61,14 +71,6 @@ static __inline__ void booke_wdt_enable(void)
61} 71}
62 72
63/* 73/*
64 * booke_wdt_ping:
65 */
66static __inline__ void booke_wdt_ping(void)
67{
68 mtspr(SPRN_TSR, TSR_ENW|TSR_WIS);
69}
70
71/*
72 * booke_wdt_write: 74 * booke_wdt_write:
73 */ 75 */
74static ssize_t booke_wdt_write (struct file *file, const char __user *buf, 76static ssize_t booke_wdt_write (struct file *file, const char __user *buf,