21 #include <linux/string.h>
22 #include <linux/module.h>
24 #include <linux/errno.h>
26 #include <linux/kernel.h>
27 #include <linux/slab.h>
32 #include <linux/parport.h>
34 #include <asm/ptrace.h>
38 #include <asm/oplib.h>
45 #define dprintk(x) printk x
50 static void parport_sunbpp_disable_irq(
struct parport *
p)
60 static void parport_sunbpp_enable_irq(
struct parport *
p)
70 static void parport_sunbpp_write_data(
struct parport *p,
unsigned char d)
78 static unsigned char parport_sunbpp_read_data(
struct parport *p)
85 static unsigned char status_sunbpp_to_pc(
struct parport *p)
88 unsigned char bits = 0;
108 static unsigned char control_sunbpp_to_pc(
struct parport *p)
111 unsigned char bits = 0;
129 static unsigned char parport_sunbpp_read_control(
struct parport *p)
131 return control_sunbpp_to_pc(p);
134 static unsigned char parport_sunbpp_frob_control(
struct parport *p,
143 value_tcr, value_or));
145 if (val & PARPORT_CONTROL_STROBE) {
146 value_tcr &= ~P_TCR_DS;
152 if (val & PARPORT_CONTROL_AUTOFD) {
153 value_or &= ~P_OR_AFXN;
159 if (val & PARPORT_CONTROL_INIT) {
160 value_or &= ~P_OR_INIT;
166 if (val & PARPORT_CONTROL_SELECT) {
169 value_or &= ~P_OR_SLCT_IN;
176 value_tcr, value_or));
177 return parport_sunbpp_read_control(p);
180 static void parport_sunbpp_write_control(
struct parport *p,
unsigned char d)
182 const unsigned char wm = (PARPORT_CONTROL_STROBE |
183 PARPORT_CONTROL_AUTOFD |
184 PARPORT_CONTROL_INIT |
187 parport_sunbpp_frob_control (p, wm, d & wm);
190 static unsigned char parport_sunbpp_read_status(
struct parport *p)
192 return status_sunbpp_to_pc(p);
195 static void parport_sunbpp_data_forward (
struct parport *p)
205 static void parport_sunbpp_data_reverse (
struct parport *p)
223 s->
u.
pc.ctr = parport_sunbpp_read_control(p);
228 parport_sunbpp_write_control(p, s->
u.
pc.ctr);
233 .write_data = parport_sunbpp_write_data,
234 .read_data = parport_sunbpp_read_data,
236 .write_control = parport_sunbpp_write_control,
237 .read_control = parport_sunbpp_read_control,
238 .frob_control = parport_sunbpp_frob_control,
240 .read_status = parport_sunbpp_read_status,
242 .enable_irq = parport_sunbpp_enable_irq,
243 .disable_irq = parport_sunbpp_disable_irq,
245 .data_forward = parport_sunbpp_data_forward,
246 .data_reverse = parport_sunbpp_data_reverse,
248 .init_state = parport_sunbpp_init_state,
249 .save_state = parport_sunbpp_save_state,
250 .restore_state = parport_sunbpp_restore_state,
273 unsigned char value_tcr;
305 parport_sunbpp_enable_irq(p);
341 parport_sunbpp_disable_irq(p);
367 .of_match_table = bpp_match,