aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ps3/vuart.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ps3/vuart.h')
-rw-r--r--drivers/ps3/vuart.h59
1 files changed, 55 insertions, 4 deletions
diff --git a/drivers/ps3/vuart.h b/drivers/ps3/vuart.h
index 2cbf728a3a0b..1be992d568c8 100644
--- a/drivers/ps3/vuart.h
+++ b/drivers/ps3/vuart.h
@@ -21,6 +21,44 @@
21#if !defined(_PS3_VUART_H) 21#if !defined(_PS3_VUART_H)
22#define _PS3_VUART_H 22#define _PS3_VUART_H
23 23
24#include <asm/ps3.h>
25
26struct ps3_vuart_stats {
27 unsigned long bytes_written;
28 unsigned long bytes_read;
29 unsigned long tx_interrupts;
30 unsigned long rx_interrupts;
31 unsigned long disconnect_interrupts;
32};
33
34struct ps3_vuart_work {
35 struct work_struct work;
36 unsigned long trigger;
37 spinlock_t lock;
38 struct ps3_vuart_port_device* dev; /* to convert work to device */
39};
40
41/**
42 * struct ps3_vuart_port_priv - private vuart device data.
43 */
44
45struct ps3_vuart_port_priv {
46 unsigned int port_number;
47 u64 interrupt_mask;
48
49 struct {
50 spinlock_t lock;
51 struct list_head head;
52 } tx_list;
53 struct {
54 unsigned long bytes_held;
55 spinlock_t lock;
56 struct list_head head;
57 } rx_list;
58 struct ps3_vuart_stats stats;
59 struct ps3_vuart_work work;
60};
61
24/** 62/**
25 * struct ps3_vuart_port_driver - a driver for a device on a vuart port 63 * struct ps3_vuart_port_driver - a driver for a device on a vuart port
26 */ 64 */
@@ -41,10 +79,6 @@ struct ps3_vuart_port_driver {
41int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv); 79int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
42void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv); 80void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
43 81
44int ps3_vuart_write(struct ps3_vuart_port_device *dev,
45 const void* buf, unsigned int bytes);
46int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
47 unsigned int bytes);
48static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver( 82static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver(
49 struct device_driver *_drv) 83 struct device_driver *_drv)
50{ 84{
@@ -55,5 +89,22 @@ static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device(
55{ 89{
56 return container_of(_dev, struct ps3_vuart_port_device, core); 90 return container_of(_dev, struct ps3_vuart_port_device, core);
57} 91}
92static inline struct ps3_vuart_port_device *ps3_vuart_work_to_port_device(
93 struct work_struct *_work)
94{
95 struct ps3_vuart_work *vw = container_of(_work, struct ps3_vuart_work,
96 work);
97 return vw->dev;
98}
99
100int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf,
101 unsigned int bytes);
102int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
103 unsigned int bytes);
104int ps3_vuart_read_async(struct ps3_vuart_port_device *dev, work_func_t func,
105 unsigned int bytes);
106void ps3_vuart_cancel_async(struct ps3_vuart_port_device *dev);
107void ps3_vuart_clear_rx_bytes(struct ps3_vuart_port_device *dev,
108 unsigned int bytes);
58 109
59#endif 110#endif