aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ps3/vuart.h
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2006-12-08 21:27:47 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-10 21:49:53 -0500
commit74e95d5de9d8eb243cda68b546bdb29f6ef0f01c (patch)
treec1f3a14628510af3ca134da5db409dcc8d428e99 /drivers/ps3/vuart.h
parent0204568a088fecd5478153504f9476ee2c46d5bf (diff)
[POWERPC] ps3: Add vuart support
Adds support for the PS3 virtual UART (vuart). The vuart provides a bi-directional byte stream data link between logical partitions. This is needed for the ps3 graphics driver and the ps3 power control support to be able to communicate with the lv1 policy module. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/ps3/vuart.h')
-rw-r--r--drivers/ps3/vuart.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/drivers/ps3/vuart.h b/drivers/ps3/vuart.h
new file mode 100644
index 000000000000..28fd89f0c8aa
--- /dev/null
+++ b/drivers/ps3/vuart.h
@@ -0,0 +1,94 @@
1/*
2 * PS3 virtual uart
3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
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; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#if !defined(_PS3_VUART_H)
22#define _PS3_VUART_H
23
24struct ps3_vuart_stats {
25 unsigned long bytes_written;
26 unsigned long bytes_read;
27 unsigned long tx_interrupts;
28 unsigned long rx_interrupts;
29 unsigned long disconnect_interrupts;
30};
31
32/**
33 * struct ps3_vuart_port_device - a device on a vuart port
34 */
35
36struct ps3_vuart_port_device {
37 enum ps3_match_id match_id;
38 struct device core;
39
40 /* private driver variables */
41 unsigned int port_number;
42 unsigned long interrupt_mask;
43 struct {
44 spinlock_t lock;
45 struct list_head head;
46 } tx_list;
47 struct {
48 unsigned long bytes_held;
49 spinlock_t lock;
50 struct list_head head;
51 } rx_list;
52 struct ps3_vuart_stats stats;
53};
54
55/**
56 * struct ps3_vuart_port_driver - a driver for a device on a vuart port
57 */
58
59struct ps3_vuart_port_driver {
60 enum ps3_match_id match_id;
61 struct device_driver core;
62 int (*probe)(struct ps3_vuart_port_device *);
63 int (*remove)(struct ps3_vuart_port_device *);
64 int (*tx_event)(struct ps3_vuart_port_device *dev);
65 int (*rx_event)(struct ps3_vuart_port_device *dev);
66 int (*disconnect_event)(struct ps3_vuart_port_device *dev);
67 /* int (*suspend)(struct ps3_vuart_port_device *, pm_message_t); */
68 /* int (*resume)(struct ps3_vuart_port_device *); */
69};
70
71int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
72int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
73void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
74int ps3_vuart_write(struct ps3_vuart_port_device *dev,
75 const void* buf, unsigned int bytes);
76int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
77 unsigned int bytes);
78static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver(
79 struct device_driver *_drv)
80{
81 return container_of(_drv, struct ps3_vuart_port_driver, core);
82}
83static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device(
84 struct device *_dev)
85{
86 return container_of(_dev, struct ps3_vuart_port_device, core);
87}
88
89int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf,
90 unsigned int bytes);
91int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
92 unsigned int bytes);
93
94#endif