12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/parport.h>
16 #include <linux/errno.h>
18 #include <linux/slab.h>
23 #define AX_SPR_BUSY (1<<7)
24 #define AX_SPR_ACK (1<<6)
25 #define AX_SPR_PE (1<<5)
26 #define AX_SPR_SLCT (1<<4)
27 #define AX_SPR_ERR (1<<3)
29 #define AX_CPR_nDOE (1<<5)
30 #define AX_CPR_SLCTIN (1<<3)
31 #define AX_CPR_nINIT (1<<2)
32 #define AX_CPR_ATFD (1<<1)
33 #define AX_CPR_STRB (1<<0)
56 parport_ax88796_read_data(
struct parport *
p)
64 parport_ax88796_write_data(
struct parport *
p,
unsigned char data)
72 parport_ax88796_read_control(
struct parport *
p)
94 parport_ax88796_write_control(
struct parport *p,
unsigned char control)
113 dev_dbg(dd->
dev,
"write_control: ctrl=%02x, cpr=%02x\n", control, cpr);
116 if (parport_ax88796_read_control(p) != control) {
117 dev_err(dd->
dev,
"write_control: read != set (%02x, %02x)\n",
118 parport_ax88796_read_control(p), control);
123 parport_ax88796_read_status(
struct parport *p)
127 unsigned int ret = 0;
148 parport_ax88796_frob_control(
struct parport *p,
unsigned char mask,
152 unsigned char old = parport_ax88796_read_control(p);
154 dev_dbg(dd->
dev,
"frob: mask=%02x, val=%02x, old=%02x\n",
157 parport_ax88796_write_control(p, (old & ~mask) | val);
162 parport_ax88796_enable_irq(
struct parport *p)
176 parport_ax88796_disable_irq(
struct parport *p)
190 parport_ax88796_data_forward(
struct parport *p)
199 parport_ax88796_data_reverse(
struct parport *p)
214 dev_dbg(dd->
dev,
"init_state: %p: state=%p\n", d, s);
223 dev_dbg(dd->
dev,
"save_state: %p: state=%p\n", p, s);
232 dev_dbg(dd->
dev,
"restore_state: %p: state=%p\n", p, s);
237 .write_data = parport_ax88796_write_data,
238 .read_data = parport_ax88796_read_data,
240 .write_control = parport_ax88796_write_control,
241 .read_control = parport_ax88796_read_control,
242 .frob_control = parport_ax88796_frob_control,
244 .read_status = parport_ax88796_read_status,
246 .enable_irq = parport_ax88796_enable_irq,
247 .disable_irq = parport_ax88796_disable_irq,
249 .data_forward = parport_ax88796_data_forward,
250 .data_reverse = parport_ax88796_data_reverse,
252 .init_state = parport_ax88796_init_state,
253 .save_state = parport_ax88796_save_state,
254 .restore_state = parport_ax88796_restore_state,
285 dev_err(_dev,
"no memory for private data\n");
291 dev_err(_dev,
"no MEM specified\n");
296 size = resource_size(res);
301 dev_err(_dev,
"cannot reserve memory\n");
308 dev_err(_dev,
"cannot ioremap region\n");
319 &parport_ax88796_ops);
322 dev_err(_dev,
"failed to register parallel port\n");
349 platform_set_drvdata(pdev, pp);
351 dev_info(_dev,
"attached parallel port driver\n");
370 struct parport *p = platform_get_drvdata(pdev);
388 struct parport *p = platform_get_drvdata(dev);
391 parport_ax88796_save_state(p, &dd->
suspend);
398 struct parport *p = platform_get_drvdata(dev);
401 parport_ax88796_restore_state(p, &dd->
suspend);
406 #define parport_ax88796_suspend NULL
407 #define parport_ax88796_resume NULL
414 .name =
"ax88796-pp",
417 .probe = parport_ax88796_probe,
418 .remove = parport_ax88796_remove,