summaryrefslogtreecommitdiffstats
path: root/drivers/ps3/vuart.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ps3/vuart.h')
-rw-r--r--drivers/ps3/vuart.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/drivers/ps3/vuart.h b/drivers/ps3/vuart.h
index 28fd89f0c8a..1be992d568c 100644
--- a/drivers/ps3/vuart.h
+++ b/drivers/ps3/vuart.h
@@ -21,6 +21,8 @@
#if !defined(_PS3_VUART_H)
#define _PS3_VUART_H
+#include <asm/ps3.h>
+
struct ps3_vuart_stats {
unsigned long bytes_written;
unsigned long bytes_read;
@@ -29,17 +31,21 @@ struct ps3_vuart_stats {
unsigned long disconnect_interrupts;
};
+struct ps3_vuart_work {
+ struct work_struct work;
+ unsigned long trigger;
+ spinlock_t lock;
+ struct ps3_vuart_port_device* dev; /* to convert work to device */
+};
+
/**
- * struct ps3_vuart_port_device - a device on a vuart port
+ * struct ps3_vuart_port_priv - private vuart device data.
*/
-struct ps3_vuart_port_device {
- enum ps3_match_id match_id;
- struct device core;
-
- /* private driver variables */
+struct ps3_vuart_port_priv {
unsigned int port_number;
- unsigned long interrupt_mask;
+ u64 interrupt_mask;
+
struct {
spinlock_t lock;
struct list_head head;
@@ -50,6 +56,7 @@ struct ps3_vuart_port_device {
struct list_head head;
} rx_list;
struct ps3_vuart_stats stats;
+ struct ps3_vuart_work work;
};
/**
@@ -61,6 +68,7 @@ struct ps3_vuart_port_driver {
struct device_driver core;
int (*probe)(struct ps3_vuart_port_device *);
int (*remove)(struct ps3_vuart_port_device *);
+ void (*shutdown)(struct ps3_vuart_port_device *);
int (*tx_event)(struct ps3_vuart_port_device *dev);
int (*rx_event)(struct ps3_vuart_port_device *dev);
int (*disconnect_event)(struct ps3_vuart_port_device *dev);
@@ -68,13 +76,9 @@ struct ps3_vuart_port_driver {
/* int (*resume)(struct ps3_vuart_port_device *); */
};
-int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
-int ps3_vuart_write(struct ps3_vuart_port_device *dev,
- const void* buf, unsigned int bytes);
-int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
- unsigned int bytes);
+
static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver(
struct device_driver *_drv)
{
@@ -85,10 +89,22 @@ static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device(
{
return container_of(_dev, struct ps3_vuart_port_device, core);
}
+static inline struct ps3_vuart_port_device *ps3_vuart_work_to_port_device(
+ struct work_struct *_work)
+{
+ struct ps3_vuart_work *vw = container_of(_work, struct ps3_vuart_work,
+ work);
+ return vw->dev;
+}
int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf,
unsigned int bytes);
int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
unsigned int bytes);
+int ps3_vuart_read_async(struct ps3_vuart_port_device *dev, work_func_t func,
+ unsigned int bytes);
+void ps3_vuart_cancel_async(struct ps3_vuart_port_device *dev);
+void ps3_vuart_clear_rx_bytes(struct ps3_vuart_port_device *dev,
+ unsigned int bytes);
#endif