diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2007-06-15 18:01:06 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-06-28 05:16:40 -0400 |
commit | 7626e78d29651d3075e88f233c0632867ea6a35c (patch) | |
tree | 0f1d4b26d6597b9a81af2e2009ce2dae6aaabbc7 /drivers/ps3/vuart.h | |
parent | a3323d1a52ec5b70821590e4beaaf13c466fd396 (diff) |
[POWERPC] PS3: Vuart rework
PS3 vuart updates to reflect the new PS3 unified device support.
- Move vuart devices to the PS3 system bus.
- Replace use of ps3_vuart_port_device with ps3_system_bus_device.
- Make the PS3 vuart bus driver a loadable module.
- Add remove() and shutdown() routines.
- Move ps3_vuart_work into ps3_vuart_port_priv.tx_list.
- Remove redundant spinlock ps3_vuart_work.lock.
- No longer free ps3_vuart_port_device.priv on shutdown.
- Cleanup Kconfig defs.
- Export symbols needed for modular port drivers.
- Arrange to use port numbers found in repository.
- Fix bugs in ps3_vuart_read_async() and polled reading
- Cleanup handling of shared interrupt with ps3_vuart_bus_interrupt_get()
and ps3_vuart_bus_interrupt_put()
- Add more comments to vuart.c.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/ps3/vuart.h')
-rw-r--r-- | drivers/ps3/vuart.h | 71 |
1 files changed, 23 insertions, 48 deletions
diff --git a/drivers/ps3/vuart.h b/drivers/ps3/vuart.h index 1be992d568c8..eb7f6d94a890 100644 --- a/drivers/ps3/vuart.h +++ b/drivers/ps3/vuart.h | |||
@@ -34,29 +34,7 @@ struct ps3_vuart_stats { | |||
34 | struct ps3_vuart_work { | 34 | struct ps3_vuart_work { |
35 | struct work_struct work; | 35 | struct work_struct work; |
36 | unsigned long trigger; | 36 | unsigned long trigger; |
37 | spinlock_t lock; | 37 | struct ps3_system_bus_device *dev; /* to convert work to device */ |
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 | |||
45 | struct 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 | }; | 38 | }; |
61 | 39 | ||
62 | /** | 40 | /** |
@@ -64,32 +42,30 @@ struct ps3_vuart_port_priv { | |||
64 | */ | 42 | */ |
65 | 43 | ||
66 | struct ps3_vuart_port_driver { | 44 | struct ps3_vuart_port_driver { |
67 | enum ps3_match_id match_id; | 45 | struct ps3_system_bus_driver core; |
68 | struct device_driver core; | 46 | int (*probe)(struct ps3_system_bus_device *); |
69 | int (*probe)(struct ps3_vuart_port_device *); | 47 | int (*remove)(struct ps3_system_bus_device *); |
70 | int (*remove)(struct ps3_vuart_port_device *); | 48 | void (*shutdown)(struct ps3_system_bus_device *); |
71 | void (*shutdown)(struct ps3_vuart_port_device *); | 49 | void (*work)(struct ps3_system_bus_device *); |
72 | int (*tx_event)(struct ps3_vuart_port_device *dev); | 50 | /* int (*tx_event)(struct ps3_system_bus_device *dev); */ |
73 | int (*rx_event)(struct ps3_vuart_port_device *dev); | 51 | /* int (*rx_event)(struct ps3_system_bus_device *dev); */ |
74 | int (*disconnect_event)(struct ps3_vuart_port_device *dev); | 52 | /* int (*disconnect_event)(struct ps3_system_bus_device *dev); */ |
75 | /* int (*suspend)(struct ps3_vuart_port_device *, pm_message_t); */ | 53 | /* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */ |
76 | /* int (*resume)(struct ps3_vuart_port_device *); */ | 54 | /* int (*resume)(struct ps3_system_bus_device *); */ |
77 | }; | 55 | }; |
78 | 56 | ||
79 | int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv); | 57 | int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv); |
80 | void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv); | 58 | void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv); |
81 | 59 | ||
82 | static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver( | 60 | static inline struct ps3_vuart_port_driver * |
83 | struct device_driver *_drv) | 61 | ps3_system_bus_dev_to_vuart_drv(struct ps3_system_bus_device *_dev) |
84 | { | ||
85 | return container_of(_drv, struct ps3_vuart_port_driver, core); | ||
86 | } | ||
87 | static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device( | ||
88 | struct device *_dev) | ||
89 | { | 62 | { |
90 | return container_of(_dev, struct ps3_vuart_port_device, core); | 63 | struct ps3_system_bus_driver *sbd = |
64 | ps3_system_bus_dev_to_system_bus_drv(_dev); | ||
65 | BUG_ON(!sbd); | ||
66 | return container_of(sbd, struct ps3_vuart_port_driver, core); | ||
91 | } | 67 | } |
92 | static inline struct ps3_vuart_port_device *ps3_vuart_work_to_port_device( | 68 | static inline struct ps3_system_bus_device *ps3_vuart_work_to_system_bus_dev( |
93 | struct work_struct *_work) | 69 | struct work_struct *_work) |
94 | { | 70 | { |
95 | struct ps3_vuart_work *vw = container_of(_work, struct ps3_vuart_work, | 71 | struct ps3_vuart_work *vw = container_of(_work, struct ps3_vuart_work, |
@@ -97,14 +73,13 @@ static inline struct ps3_vuart_port_device *ps3_vuart_work_to_port_device( | |||
97 | return vw->dev; | 73 | return vw->dev; |
98 | } | 74 | } |
99 | 75 | ||
100 | int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf, | 76 | int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf, |
101 | unsigned int bytes); | ||
102 | int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf, | ||
103 | unsigned int bytes); | 77 | unsigned int bytes); |
104 | int ps3_vuart_read_async(struct ps3_vuart_port_device *dev, work_func_t func, | 78 | int ps3_vuart_read(struct ps3_system_bus_device *dev, void *buf, |
105 | unsigned int bytes); | 79 | unsigned int bytes); |
106 | void ps3_vuart_cancel_async(struct ps3_vuart_port_device *dev); | 80 | int ps3_vuart_read_async(struct ps3_system_bus_device *dev, unsigned int bytes); |
107 | void ps3_vuart_clear_rx_bytes(struct ps3_vuart_port_device *dev, | 81 | void ps3_vuart_cancel_async(struct ps3_system_bus_device *dev); |
82 | void ps3_vuart_clear_rx_bytes(struct ps3_system_bus_device *dev, | ||
108 | unsigned int bytes); | 83 | unsigned int bytes); |
109 | 84 | ||
110 | #endif | 85 | #endif |