aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/parport
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'drivers/parport')
-rw-r--r--drivers/parport/Kconfig18
-rw-r--r--drivers/parport/parport_amiga.c36
-rw-r--r--drivers/parport/parport_atari.c9
-rw-r--r--drivers/parport/parport_ax88796.c13
-rw-r--r--drivers/parport/parport_gsc.c24
-rw-r--r--drivers/parport/parport_ip32.c2
-rw-r--r--drivers/parport/parport_mfc3.c37
-rw-r--r--drivers/parport/parport_pc.c354
-rw-r--r--drivers/parport/parport_serial.c32
-rw-r--r--drivers/parport/parport_sunbpp.c40
10 files changed, 478 insertions, 87 deletions
diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig
index 0e60438ebe3..d92185a5523 100644
--- a/drivers/parport/Kconfig
+++ b/drivers/parport/Kconfig
@@ -36,7 +36,7 @@ if PARPORT
36config PARPORT_PC 36config PARPORT_PC
37 tristate "PC-style hardware" 37 tristate "PC-style hardware"
38 depends on (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV && \ 38 depends on (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV && \
39 (!M68K || ISA) && !MN10300 && !AVR32 && !BLACKFIN && !XTENSA 39 (!M68K || ISA) && !MN10300 && !AVR32 && !BLACKFIN
40 ---help--- 40 ---help---
41 You should say Y here if you have a PC-style parallel port. All 41 You should say Y here if you have a PC-style parallel port. All
42 IBM PC compatible computers and some Alphas have PC-style 42 IBM PC compatible computers and some Alphas have PC-style
@@ -57,8 +57,8 @@ config PARPORT_SERIAL
57 will be called parport_serial. 57 will be called parport_serial.
58 58
59config PARPORT_PC_FIFO 59config PARPORT_PC_FIFO
60 bool "Use FIFO/DMA if available" 60 bool "Use FIFO/DMA if available (EXPERIMENTAL)"
61 depends on PARPORT_PC 61 depends on PARPORT_PC && EXPERIMENTAL
62 help 62 help
63 Many parallel port chipsets provide hardware that can speed up 63 Many parallel port chipsets provide hardware that can speed up
64 printing. Say Y here if you want to take advantage of that. 64 printing. Say Y here if you want to take advantage of that.
@@ -70,8 +70,8 @@ config PARPORT_PC_FIFO
70 specify which IRQ/DMA to use. 70 specify which IRQ/DMA to use.
71 71
72config PARPORT_PC_SUPERIO 72config PARPORT_PC_SUPERIO
73 bool "SuperIO chipset support" 73 bool "SuperIO chipset support (EXPERIMENTAL)"
74 depends on PARPORT_PC 74 depends on PARPORT_PC && EXPERIMENTAL
75 help 75 help
76 Saying Y here enables some probes for Super-IO chipsets in order to 76 Saying Y here enables some probes for Super-IO chipsets in order to
77 find out things like base addresses, IRQ lines and DMA channels. It 77 find out things like base addresses, IRQ lines and DMA channels. It
@@ -85,8 +85,8 @@ config PARPORT_PC_PCMCIA
85 ports. If unsure, say N. 85 ports. If unsure, say N.
86 86
87config PARPORT_IP32 87config PARPORT_IP32
88 tristate "SGI IP32 builtin port" 88 tristate "SGI IP32 builtin port (EXPERIMENTAL)"
89 depends on SGI_IP32 89 depends on SGI_IP32 && EXPERIMENTAL
90 select PARPORT_NOT_PC 90 select PARPORT_NOT_PC
91 help 91 help
92 Say Y here if you need support for the parallel port on 92 Say Y here if you need support for the parallel port on
@@ -126,8 +126,8 @@ config PARPORT_GSC
126 select PARPORT_NOT_PC 126 select PARPORT_NOT_PC
127 127
128config PARPORT_SUNBPP 128config PARPORT_SUNBPP
129 tristate "Sparc hardware" 129 tristate "Sparc hardware (EXPERIMENTAL)"
130 depends on SBUS 130 depends on SBUS && EXPERIMENTAL
131 select PARPORT_NOT_PC 131 select PARPORT_NOT_PC
132 help 132 help
133 This driver provides support for the bidirectional parallel port 133 This driver provides support for the bidirectional parallel port
diff --git a/drivers/parport/parport_amiga.c b/drivers/parport/parport_amiga.c
index ee78e0ee6e0..8bef6d60f88 100644
--- a/drivers/parport/parport_amiga.c
+++ b/drivers/parport/parport_amiga.c
@@ -48,6 +48,23 @@ static unsigned char amiga_read_data(struct parport *p)
48 return ciaa.prb; 48 return ciaa.prb;
49} 49}
50 50
51#if 0
52static unsigned char control_pc_to_amiga(unsigned char control)
53{
54 unsigned char ret = 0;
55
56 if (control & PARPORT_CONTROL_SELECT) /* XXX: What is SELECP? */
57 ;
58 if (control & PARPORT_CONTROL_INIT) /* INITP */
59 /* reset connected to cpu reset pin */;
60 if (control & PARPORT_CONTROL_AUTOFD) /* AUTOLF */
61 /* Not connected */;
62 if (control & PARPORT_CONTROL_STROBE) /* Strobe */
63 /* Handled only directly by hardware */;
64 return ret;
65}
66#endif
67
51static unsigned char control_amiga_to_pc(unsigned char control) 68static unsigned char control_amiga_to_pc(unsigned char control)
52{ 69{
53 return PARPORT_CONTROL_SELECT | 70 return PARPORT_CONTROL_SELECT |
@@ -78,6 +95,25 @@ static unsigned char amiga_frob_control( struct parport *p, unsigned char mask,
78 return old; 95 return old;
79} 96}
80 97
98#if 0 /* currently unused */
99static unsigned char status_pc_to_amiga(unsigned char status)
100{
101 unsigned char ret = 1;
102
103 if (status & PARPORT_STATUS_BUSY) /* Busy */
104 ret &= ~1;
105 if (status & PARPORT_STATUS_ACK) /* Ack */
106 /* handled in hardware */;
107 if (status & PARPORT_STATUS_PAPEROUT) /* PaperOut */
108 ret |= 2;
109 if (status & PARPORT_STATUS_SELECT) /* select */
110 ret |= 4;
111 if (status & PARPORT_STATUS_ERROR) /* error */
112 /* not connected */;
113 return ret;
114}
115#endif
116
81static unsigned char status_amiga_to_pc(unsigned char status) 117static unsigned char status_amiga_to_pc(unsigned char status)
82{ 118{
83 unsigned char ret = PARPORT_STATUS_BUSY | PARPORT_STATUS_ACK | PARPORT_STATUS_ERROR; 119 unsigned char ret = PARPORT_STATUS_BUSY | PARPORT_STATUS_ACK | PARPORT_STATUS_ERROR;
diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c
index 7ad59ac68cf..0b28fccec03 100644
--- a/drivers/parport/parport_atari.c
+++ b/drivers/parport/parport_atari.c
@@ -130,6 +130,15 @@ parport_atari_data_forward(struct parport *p)
130static void 130static void
131parport_atari_data_reverse(struct parport *p) 131parport_atari_data_reverse(struct parport *p)
132{ 132{
133#if 0 /* too dangerous, can kill sound chip */
134 unsigned long flags;
135
136 local_irq_save(flags);
137 /* Soundchip port B as input. */
138 sound_ym.rd_data_reg_sel = 7;
139 sound_ym.wd_data = sound_ym.rd_data_reg_sel & ~0x40;
140 local_irq_restore(flags);
141#endif
133} 142}
134 143
135static struct parport_operations parport_atari_ops = { 144static struct parport_operations parport_atari_ops = {
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 7c5d86696ee..844f6137970 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -420,7 +420,18 @@ static struct platform_driver axdrv = {
420 .resume = parport_ax88796_resume, 420 .resume = parport_ax88796_resume,
421}; 421};
422 422
423module_platform_driver(axdrv); 423static int __init parport_ax88796_init(void)
424{
425 return platform_driver_register(&axdrv);
426}
427
428static void __exit parport_ax88796_exit(void)
429{
430 platform_driver_unregister(&axdrv);
431}
432
433module_init(parport_ax88796_init)
434module_exit(parport_ax88796_exit)
424 435
425MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 436MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
426MODULE_DESCRIPTION("AX88796 Parport parallel port driver"); 437MODULE_DESCRIPTION("AX88796 Parport parallel port driver");
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 050773c3682..5d6de380e42 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -137,7 +137,7 @@ struct parport_operations parport_gsc_ops =
137/* 137/*
138 * Checks for port existence, all ports support SPP MODE 138 * Checks for port existence, all ports support SPP MODE
139 */ 139 */
140static int parport_SPP_supported(struct parport *pb) 140static int __devinit parport_SPP_supported(struct parport *pb)
141{ 141{
142 unsigned char r, w; 142 unsigned char r, w;
143 143
@@ -201,7 +201,7 @@ static int parport_SPP_supported(struct parport *pb)
201 * be misdetected here is rather academic. 201 * be misdetected here is rather academic.
202 */ 202 */
203 203
204static int parport_PS2_supported(struct parport *pb) 204static int __devinit parport_PS2_supported(struct parport *pb)
205{ 205{
206 int ok = 0; 206 int ok = 0;
207 207
@@ -232,9 +232,10 @@ static int parport_PS2_supported(struct parport *pb)
232 232
233/* --- Initialisation code -------------------------------- */ 233/* --- Initialisation code -------------------------------- */
234 234
235struct parport *parport_gsc_probe_port(unsigned long base, 235struct parport *__devinit parport_gsc_probe_port (unsigned long base,
236 unsigned long base_hi, int irq, 236 unsigned long base_hi,
237 int dma, struct pci_dev *dev) 237 int irq, int dma,
238 struct pci_dev *dev)
238{ 239{
239 struct parport_gsc_private *priv; 240 struct parport_gsc_private *priv;
240 struct parport_operations *ops; 241 struct parport_operations *ops;
@@ -270,7 +271,6 @@ struct parport *parport_gsc_probe_port(unsigned long base,
270 if (!parport_SPP_supported (p)) { 271 if (!parport_SPP_supported (p)) {
271 /* No port. */ 272 /* No port. */
272 kfree (priv); 273 kfree (priv);
273 kfree(ops);
274 return NULL; 274 return NULL;
275 } 275 }
276 parport_PS2_supported (p); 276 parport_PS2_supported (p);
@@ -344,9 +344,9 @@ struct parport *parport_gsc_probe_port(unsigned long base,
344 344
345#define PARPORT_GSC_OFFSET 0x800 345#define PARPORT_GSC_OFFSET 0x800
346 346
347static int parport_count; 347static int __devinitdata parport_count;
348 348
349static int parport_init_chip(struct parisc_device *dev) 349static int __devinit parport_init_chip(struct parisc_device *dev)
350{ 350{
351 struct parport *p; 351 struct parport *p;
352 unsigned long port; 352 unsigned long port;
@@ -381,7 +381,7 @@ static int parport_init_chip(struct parisc_device *dev)
381 return 0; 381 return 0;
382} 382}
383 383
384static int parport_remove_chip(struct parisc_device *dev) 384static int __devexit parport_remove_chip(struct parisc_device *dev)
385{ 385{
386 struct parport *p = dev_get_drvdata(&dev->dev); 386 struct parport *p = dev_get_drvdata(&dev->dev);
387 if (p) { 387 if (p) {
@@ -414,15 +414,15 @@ static struct parisc_driver parport_driver = {
414 .name = "Parallel", 414 .name = "Parallel",
415 .id_table = parport_tbl, 415 .id_table = parport_tbl,
416 .probe = parport_init_chip, 416 .probe = parport_init_chip,
417 .remove = parport_remove_chip, 417 .remove = __devexit_p(parport_remove_chip),
418}; 418};
419 419
420int parport_gsc_init(void) 420int __devinit parport_gsc_init(void)
421{ 421{
422 return register_parisc_driver(&parport_driver); 422 return register_parisc_driver(&parport_driver);
423} 423}
424 424
425static void parport_gsc_exit(void) 425static void __devexit parport_gsc_exit(void)
426{ 426{
427 unregister_parisc_driver(&parport_driver); 427 unregister_parisc_driver(&parport_driver);
428} 428}
diff --git a/drivers/parport/parport_ip32.c b/drivers/parport/parport_ip32.c
index d4716273651..0dc34f12f92 100644
--- a/drivers/parport/parport_ip32.c
+++ b/drivers/parport/parport_ip32.c
@@ -135,7 +135,7 @@
135#define PARPORT_IP32_ENABLE_EPP (1U << 3) 135#define PARPORT_IP32_ENABLE_EPP (1U << 3)
136#define PARPORT_IP32_ENABLE_ECP (1U << 4) 136#define PARPORT_IP32_ENABLE_ECP (1U << 4)
137static unsigned int features = ~0U; 137static unsigned int features = ~0U;
138static bool verbose_probing = DEFAULT_VERBOSE_PROBING; 138static int verbose_probing = DEFAULT_VERBOSE_PROBING;
139 139
140/* We do not support more than one port. */ 140/* We do not support more than one port. */
141static struct parport *this_port = NULL; 141static struct parport *this_port = NULL;
diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c
index 7578d79b368..362db31d8ca 100644
--- a/drivers/parport/parport_mfc3.c
+++ b/drivers/parport/parport_mfc3.c
@@ -147,6 +147,25 @@ DPRINTK(KERN_DEBUG "frob_control mask %02x, value %02x\n",mask,val);
147 return old; 147 return old;
148} 148}
149 149
150#if 0 /* currently unused */
151static unsigned char status_pc_to_mfc3(unsigned char status)
152{
153 unsigned char ret = 1;
154
155 if (status & PARPORT_STATUS_BUSY) /* Busy */
156 ret &= ~1;
157 if (status & PARPORT_STATUS_ACK) /* Ack */
158 ret |= 8;
159 if (status & PARPORT_STATUS_PAPEROUT) /* PaperOut */
160 ret |= 2;
161 if (status & PARPORT_STATUS_SELECT) /* select */
162 ret |= 4;
163 if (status & PARPORT_STATUS_ERROR) /* error */
164 ret |= 16;
165 return ret;
166}
167#endif
168
150static unsigned char status_mfc3_to_pc(unsigned char status) 169static unsigned char status_mfc3_to_pc(unsigned char status)
151{ 170{
152 unsigned char ret = PARPORT_STATUS_BUSY; 171 unsigned char ret = PARPORT_STATUS_BUSY;
@@ -165,6 +184,14 @@ static unsigned char status_mfc3_to_pc(unsigned char status)
165 return ret; 184 return ret;
166} 185}
167 186
187#if 0 /* currently unused */
188static void mfc3_write_status( struct parport *p, unsigned char status)
189{
190DPRINTK(KERN_DEBUG "write_status %02x\n",status);
191 pia(p)->ppra = (pia(p)->ppra & 0xe0) | status_pc_to_mfc3(status);
192}
193#endif
194
168static unsigned char mfc3_read_status(struct parport *p) 195static unsigned char mfc3_read_status(struct parport *p)
169{ 196{
170 unsigned char status; 197 unsigned char status;
@@ -174,6 +201,14 @@ DPRINTK(KERN_DEBUG "read_status %02x\n", status);
174 return status; 201 return status;
175} 202}
176 203
204#if 0 /* currently unused */
205static void mfc3_change_mode( struct parport *p, int m)
206{
207 /* XXX: This port only has one mode, and I am
208 not sure about the corresponding PC-style mode*/
209}
210#endif
211
177static int use_cnt = 0; 212static int use_cnt = 0;
178 213
179static irqreturn_t mfc3_interrupt(int irq, void *dev_id) 214static irqreturn_t mfc3_interrupt(int irq, void *dev_id)
@@ -362,7 +397,7 @@ static void __exit parport_mfc3_exit(void)
362 397
363 398
364MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>"); 399MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>");
365MODULE_DESCRIPTION("Parport Driver for Multiface 3 expansion cards Parallel Port"); 400MODULE_DESCRIPTION("Parport Driver for Multiface 3 expansion cards Paralllel Port");
366MODULE_SUPPORTED_DEVICE("Multiface 3 Parallel Port"); 401MODULE_SUPPORTED_DEVICE("Multiface 3 Parallel Port");
367MODULE_LICENSE("GPL"); 402MODULE_LICENSE("GPL");
368 403
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 903e1285fda..d1cdb9449f8 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -197,6 +197,54 @@ static int change_mode(struct parport *p, int m)
197 ECR_WRITE(p, oecr); 197 ECR_WRITE(p, oecr);
198 return 0; 198 return 0;
199} 199}
200
201#ifdef CONFIG_PARPORT_1284
202/* Find FIFO lossage; FIFO is reset */
203#if 0
204static int get_fifo_residue(struct parport *p)
205{
206 int residue;
207 int cnfga;
208 const struct parport_pc_private *priv = p->physport->private_data;
209
210 /* Adjust for the contents of the FIFO. */
211 for (residue = priv->fifo_depth; ; residue--) {
212 if (inb(ECONTROL(p)) & 0x2)
213 /* Full up. */
214 break;
215
216 outb(0, FIFO(p));
217 }
218
219 printk(KERN_DEBUG "%s: %d PWords were left in FIFO\n", p->name,
220 residue);
221
222 /* Reset the FIFO. */
223 frob_set_mode(p, ECR_PS2);
224
225 /* Now change to config mode and clean up. FIXME */
226 frob_set_mode(p, ECR_CNF);
227 cnfga = inb(CONFIGA(p));
228 printk(KERN_DEBUG "%s: cnfgA contains 0x%02x\n", p->name, cnfga);
229
230 if (!(cnfga & (1<<2))) {
231 printk(KERN_DEBUG "%s: Accounting for extra byte\n", p->name);
232 residue++;
233 }
234
235 /* Don't care about partial PWords until support is added for
236 * PWord != 1 byte. */
237
238 /* Back to PS2 mode. */
239 frob_set_mode(p, ECR_PS2);
240
241 DPRINTK(KERN_DEBUG
242 "*** get_fifo_residue: done residue collecting (ecr = 0x%2.2x)\n",
243 inb(ECONTROL(p)));
244 return residue;
245}
246#endif /* 0 */
247#endif /* IEEE 1284 support */
200#endif /* FIFO support */ 248#endif /* FIFO support */
201 249
202/* 250/*
@@ -892,6 +940,234 @@ static size_t parport_pc_ecp_write_block_pio(struct parport *port,
892 940
893 return written; 941 return written;
894} 942}
943
944#if 0
945static size_t parport_pc_ecp_read_block_pio(struct parport *port,
946 void *buf, size_t length,
947 int flags)
948{
949 size_t left = length;
950 size_t fifofull;
951 int r;
952 const int fifo = FIFO(port);
953 const struct parport_pc_private *priv = port->physport->private_data;
954 const int fifo_depth = priv->fifo_depth;
955 char *bufp = buf;
956
957 port = port->physport;
958 DPRINTK(KERN_DEBUG "parport_pc: parport_pc_ecp_read_block_pio\n");
959 dump_parport_state("enter fcn", port);
960
961 /* Special case: a timeout of zero means we cannot call schedule().
962 * Also if O_NONBLOCK is set then use the default implementation. */
963 if (port->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK)
964 return parport_ieee1284_ecp_read_data(port, buf,
965 length, flags);
966
967 if (port->ieee1284.mode == IEEE1284_MODE_ECPRLE) {
968 /* If the peripheral is allowed to send RLE compressed
969 * data, it is possible for a byte to expand to 128
970 * bytes in the FIFO. */
971 fifofull = 128;
972 } else {
973 fifofull = fifo_depth;
974 }
975
976 /* If the caller wants less than a full FIFO's worth of data,
977 * go through software emulation. Otherwise we may have to throw
978 * away data. */
979 if (length < fifofull)
980 return parport_ieee1284_ecp_read_data(port, buf,
981 length, flags);
982
983 if (port->ieee1284.phase != IEEE1284_PH_REV_IDLE) {
984 /* change to reverse-idle phase (must be in forward-idle) */
985
986 /* Event 38: Set nAutoFd low (also make sure nStrobe is high) */
987 parport_frob_control(port,
988 PARPORT_CONTROL_AUTOFD
989 | PARPORT_CONTROL_STROBE,
990 PARPORT_CONTROL_AUTOFD);
991 parport_pc_data_reverse(port); /* Must be in PS2 mode */
992 udelay(5);
993 /* Event 39: Set nInit low to initiate bus reversal */
994 parport_frob_control(port,
995 PARPORT_CONTROL_INIT,
996 0);
997 /* Event 40: Wait for nAckReverse (PError) to go low */
998 r = parport_wait_peripheral(port, PARPORT_STATUS_PAPEROUT, 0);
999 if (r) {
1000 printk(KERN_DEBUG "%s: PE timeout Event 40 (%d) "
1001 "in ecp_read_block_pio\n", port->name, r);
1002 return 0;
1003 }
1004 }
1005
1006 /* Set up ECP FIFO mode.*/
1007/* parport_pc_frob_control(port,
1008 PARPORT_CONTROL_STROBE |
1009 PARPORT_CONTROL_AUTOFD,
1010 PARPORT_CONTROL_AUTOFD); */
1011 r = change_mode(port, ECR_ECP); /* ECP FIFO */
1012 if (r)
1013 printk(KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n",
1014 port->name);
1015
1016 port->ieee1284.phase = IEEE1284_PH_REV_DATA;
1017
1018 /* the first byte must be collected manually */
1019 dump_parport_state("pre 43", port);
1020 /* Event 43: Wait for nAck to go low */
1021 r = parport_wait_peripheral(port, PARPORT_STATUS_ACK, 0);
1022 if (r) {
1023 /* timed out while reading -- no data */
1024 printk(KERN_DEBUG "PIO read timed out (initial byte)\n");
1025 goto out_no_data;
1026 }
1027 /* read byte */
1028 *bufp++ = inb(DATA(port));
1029 left--;
1030 dump_parport_state("43-44", port);
1031 /* Event 44: nAutoFd (HostAck) goes high to acknowledge */
1032 parport_pc_frob_control(port,
1033 PARPORT_CONTROL_AUTOFD,
1034 0);
1035 dump_parport_state("pre 45", port);
1036 /* Event 45: Wait for nAck to go high */
1037 /* r = parport_wait_peripheral(port, PARPORT_STATUS_ACK,
1038 PARPORT_STATUS_ACK); */
1039 dump_parport_state("post 45", port);
1040 r = 0;
1041 if (r) {
1042 /* timed out while waiting for peripheral to respond to ack */
1043 printk(KERN_DEBUG "ECP PIO read timed out (waiting for nAck)\n");
1044
1045 /* keep hold of the byte we've got already */
1046 goto out_no_data;
1047 }
1048 /* Event 46: nAutoFd (HostAck) goes low to accept more data */
1049 parport_pc_frob_control(port,
1050 PARPORT_CONTROL_AUTOFD,
1051 PARPORT_CONTROL_AUTOFD);
1052
1053
1054 dump_parport_state("rev idle", port);
1055 /* Do the transfer. */
1056 while (left > fifofull) {
1057 int ret;
1058 unsigned long expire = jiffies + port->cad->timeout;
1059 unsigned char ecrval = inb(ECONTROL(port));
1060
1061 if (need_resched() && time_before(jiffies, expire))
1062 /* Can't yield the port. */
1063 schedule();
1064
1065 /* At this point, the FIFO may already be full. In
1066 * that case ECP is already holding back the
1067 * peripheral (assuming proper design) with a delayed
1068 * handshake. Work fast to avoid a peripheral
1069 * timeout. */
1070
1071 if (ecrval & 0x01) {
1072 /* FIFO is empty. Wait for interrupt. */
1073 dump_parport_state("FIFO empty", port);
1074
1075 /* Anyone else waiting for the port? */
1076 if (port->waithead) {
1077 printk(KERN_DEBUG "Somebody wants the port\n");
1078 break;
1079 }
1080
1081 /* Clear serviceIntr */
1082 ECR_WRITE(port, ecrval & ~(1<<2));
1083false_alarm:
1084 dump_parport_state("waiting", port);
1085 ret = parport_wait_event(port, HZ);
1086 DPRINTK(KERN_DEBUG "parport_wait_event returned %d\n",
1087 ret);
1088 if (ret < 0)
1089 break;
1090 ret = 0;
1091 if (!time_before(jiffies, expire)) {
1092 /* Timed out. */
1093 dump_parport_state("timeout", port);
1094 printk(KERN_DEBUG "PIO read timed out\n");
1095 break;
1096 }
1097 ecrval = inb(ECONTROL(port));
1098 if (!(ecrval & (1<<2))) {
1099 if (need_resched() &&
1100 time_before(jiffies, expire)) {
1101 schedule();
1102 }
1103 goto false_alarm;
1104 }
1105
1106 /* Depending on how the FIFO threshold was
1107 * set, how long interrupt service took, and
1108 * how fast the peripheral is, we might be
1109 * lucky and have a just filled FIFO. */
1110 continue;
1111 }
1112
1113 if (ecrval & 0x02) {
1114 /* FIFO is full. */
1115 dump_parport_state("FIFO full", port);
1116 insb(fifo, bufp, fifo_depth);
1117 bufp += fifo_depth;
1118 left -= fifo_depth;
1119 continue;
1120 }
1121
1122 DPRINTK(KERN_DEBUG
1123 "*** ecp_read_block_pio: reading one byte from the FIFO\n");
1124
1125 /* FIFO not filled. We will cycle this loop for a while
1126 * and either the peripheral will fill it faster,
1127 * tripping a fast empty with insb, or we empty it. */
1128 *bufp++ = inb(fifo);
1129 left--;
1130 }
1131
1132 /* scoop up anything left in the FIFO */
1133 while (left && !(inb(ECONTROL(port) & 0x01))) {
1134 *bufp++ = inb(fifo);
1135 left--;
1136 }
1137
1138 port->ieee1284.phase = IEEE1284_PH_REV_IDLE;
1139 dump_parport_state("rev idle2", port);
1140
1141out_no_data:
1142
1143 /* Go to forward idle mode to shut the peripheral up (event 47). */
1144 parport_frob_control(port, PARPORT_CONTROL_INIT, PARPORT_CONTROL_INIT);
1145
1146 /* event 49: PError goes high */
1147 r = parport_wait_peripheral(port,
1148 PARPORT_STATUS_PAPEROUT,
1149 PARPORT_STATUS_PAPEROUT);
1150 if (r) {
1151 printk(KERN_DEBUG
1152 "%s: PE timeout FWDIDLE (%d) in ecp_read_block_pio\n",
1153 port->name, r);
1154 }
1155
1156 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
1157
1158 /* Finish up. */
1159 {
1160 int lost = get_fifo_residue(port);
1161 if (lost)
1162 /* Shouldn't happen with compliant peripherals. */
1163 printk(KERN_DEBUG "%s: DATA LOSS (%d bytes)!\n",
1164 port->name, lost);
1165 }
1166
1167 dump_parport_state("fwd idle", port);
1168 return length - left;
1169}
1170#endif /* 0 */
895#endif /* IEEE 1284 support */ 1171#endif /* IEEE 1284 support */
896#endif /* Allowed to use FIFO/DMA */ 1172#endif /* Allowed to use FIFO/DMA */
897 1173
@@ -953,7 +1229,7 @@ static struct superio_struct *find_free_superio(void)
953 1229
954 1230
955/* Super-IO chipset detection, Winbond, SMSC */ 1231/* Super-IO chipset detection, Winbond, SMSC */
956static void show_parconfig_smsc37c669(int io, int key) 1232static void __devinit show_parconfig_smsc37c669(int io, int key)
957{ 1233{
958 int cr1, cr4, cra, cr23, cr26, cr27; 1234 int cr1, cr4, cra, cr23, cr26, cr27;
959 struct superio_struct *s; 1235 struct superio_struct *s;
@@ -1038,7 +1314,7 @@ static void show_parconfig_smsc37c669(int io, int key)
1038} 1314}
1039 1315
1040 1316
1041static void show_parconfig_winbond(int io, int key) 1317static void __devinit show_parconfig_winbond(int io, int key)
1042{ 1318{
1043 int cr30, cr60, cr61, cr70, cr74, crf0; 1319 int cr30, cr60, cr61, cr70, cr74, crf0;
1044 struct superio_struct *s; 1320 struct superio_struct *s;
@@ -1106,7 +1382,8 @@ static void show_parconfig_winbond(int io, int key)
1106 } 1382 }
1107} 1383}
1108 1384
1109static void decode_winbond(int efer, int key, int devid, int devrev, int oldid) 1385static void __devinit decode_winbond(int efer, int key, int devid,
1386 int devrev, int oldid)
1110{ 1387{
1111 const char *type = "unknown"; 1388 const char *type = "unknown";
1112 int id, progif = 2; 1389 int id, progif = 2;
@@ -1158,7 +1435,7 @@ static void decode_winbond(int efer, int key, int devid, int devrev, int oldid)
1158 show_parconfig_winbond(efer, key); 1435 show_parconfig_winbond(efer, key);
1159} 1436}
1160 1437
1161static void decode_smsc(int efer, int key, int devid, int devrev) 1438static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
1162{ 1439{
1163 const char *type = "unknown"; 1440 const char *type = "unknown";
1164 void (*func)(int io, int key); 1441 void (*func)(int io, int key);
@@ -1192,7 +1469,7 @@ static void decode_smsc(int efer, int key, int devid, int devrev)
1192} 1469}
1193 1470
1194 1471
1195static void winbond_check(int io, int key) 1472static void __devinit winbond_check(int io, int key)
1196{ 1473{
1197 int origval, devid, devrev, oldid, x_devid, x_devrev, x_oldid; 1474 int origval, devid, devrev, oldid, x_devid, x_devrev, x_oldid;
1198 1475
@@ -1230,7 +1507,7 @@ out:
1230 release_region(io, 3); 1507 release_region(io, 3);
1231} 1508}
1232 1509
1233static void winbond_check2(int io, int key) 1510static void __devinit winbond_check2(int io, int key)
1234{ 1511{
1235 int origval[3], devid, devrev, oldid, x_devid, x_devrev, x_oldid; 1512 int origval[3], devid, devrev, oldid, x_devid, x_devrev, x_oldid;
1236 1513
@@ -1271,7 +1548,7 @@ out:
1271 release_region(io, 3); 1548 release_region(io, 3);
1272} 1549}
1273 1550
1274static void smsc_check(int io, int key) 1551static void __devinit smsc_check(int io, int key)
1275{ 1552{
1276 int origval, id, rev, oldid, oldrev, x_id, x_rev, x_oldid, x_oldrev; 1553 int origval, id, rev, oldid, oldrev, x_id, x_rev, x_oldid, x_oldrev;
1277 1554
@@ -1315,7 +1592,7 @@ out:
1315} 1592}
1316 1593
1317 1594
1318static void detect_and_report_winbond(void) 1595static void __devinit detect_and_report_winbond(void)
1319{ 1596{
1320 if (verbose_probing) 1597 if (verbose_probing)
1321 printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n"); 1598 printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n");
@@ -1328,7 +1605,7 @@ static void detect_and_report_winbond(void)
1328 winbond_check2(0x250, 0x89); 1605 winbond_check2(0x250, 0x89);
1329} 1606}
1330 1607
1331static void detect_and_report_smsc(void) 1608static void __devinit detect_and_report_smsc(void)
1332{ 1609{
1333 if (verbose_probing) 1610 if (verbose_probing)
1334 printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n"); 1611 printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n");
@@ -1338,7 +1615,7 @@ static void detect_and_report_smsc(void)
1338 smsc_check(0x370, 0x44); 1615 smsc_check(0x370, 0x44);
1339} 1616}
1340 1617
1341static void detect_and_report_it87(void) 1618static void __devinit detect_and_report_it87(void)
1342{ 1619{
1343 u16 dev; 1620 u16 dev;
1344 u8 origval, r; 1621 u8 origval, r;
@@ -1795,24 +2072,24 @@ static int parport_ECPEPP_supported(struct parport *pb)
1795#else /* No IEEE 1284 support */ 2072#else /* No IEEE 1284 support */
1796 2073
1797/* Don't bother probing for modes we know we won't use. */ 2074/* Don't bother probing for modes we know we won't use. */
1798static int parport_PS2_supported(struct parport *pb) { return 0; } 2075static int __devinit parport_PS2_supported(struct parport *pb) { return 0; }
1799#ifdef CONFIG_PARPORT_PC_FIFO 2076#ifdef CONFIG_PARPORT_PC_FIFO
1800static int parport_ECP_supported(struct parport *pb) 2077static int parport_ECP_supported(struct parport *pb)
1801{ 2078{
1802 return 0; 2079 return 0;
1803} 2080}
1804#endif 2081#endif
1805static int parport_EPP_supported(struct parport *pb) 2082static int __devinit parport_EPP_supported(struct parport *pb)
1806{ 2083{
1807 return 0; 2084 return 0;
1808} 2085}
1809 2086
1810static int parport_ECPEPP_supported(struct parport *pb) 2087static int __devinit parport_ECPEPP_supported(struct parport *pb)
1811{ 2088{
1812 return 0; 2089 return 0;
1813} 2090}
1814 2091
1815static int parport_ECPPS2_supported(struct parport *pb) 2092static int __devinit parport_ECPPS2_supported(struct parport *pb)
1816{ 2093{
1817 return 0; 2094 return 0;
1818} 2095}
@@ -2074,7 +2351,7 @@ struct parport *parport_pc_probe_port(unsigned long int base,
2074 2351
2075 printk(KERN_INFO "%s: PC-style at 0x%lx", p->name, p->base); 2352 printk(KERN_INFO "%s: PC-style at 0x%lx", p->name, p->base);
2076 if (p->base_hi && priv->ecr) 2353 if (p->base_hi && priv->ecr)
2077 printk(KERN_CONT " (0x%lx)", p->base_hi); 2354 printk(" (0x%lx)", p->base_hi);
2078 if (p->irq == PARPORT_IRQ_AUTO) { 2355 if (p->irq == PARPORT_IRQ_AUTO) {
2079 p->irq = PARPORT_IRQ_NONE; 2356 p->irq = PARPORT_IRQ_NONE;
2080 parport_irq_probe(p); 2357 parport_irq_probe(p);
@@ -2085,7 +2362,7 @@ struct parport *parport_pc_probe_port(unsigned long int base,
2085 p->irq = PARPORT_IRQ_NONE; 2362 p->irq = PARPORT_IRQ_NONE;
2086 } 2363 }
2087 if (p->irq != PARPORT_IRQ_NONE) { 2364 if (p->irq != PARPORT_IRQ_NONE) {
2088 printk(KERN_CONT ", irq %d", p->irq); 2365 printk(", irq %d", p->irq);
2089 priv->ctr_writable |= 0x10; 2366 priv->ctr_writable |= 0x10;
2090 2367
2091 if (p->dma == PARPORT_DMA_AUTO) { 2368 if (p->dma == PARPORT_DMA_AUTO) {
@@ -2109,21 +2386,21 @@ struct parport *parport_pc_probe_port(unsigned long int base,
2109 /* p->ops->ecp_read_data = parport_pc_ecp_read_block_pio; */ 2386 /* p->ops->ecp_read_data = parport_pc_ecp_read_block_pio; */
2110#endif /* IEEE 1284 support */ 2387#endif /* IEEE 1284 support */
2111 if (p->dma != PARPORT_DMA_NONE) { 2388 if (p->dma != PARPORT_DMA_NONE) {
2112 printk(KERN_CONT ", dma %d", p->dma); 2389 printk(", dma %d", p->dma);
2113 p->modes |= PARPORT_MODE_DMA; 2390 p->modes |= PARPORT_MODE_DMA;
2114 } else 2391 } else
2115 printk(KERN_CONT ", using FIFO"); 2392 printk(", using FIFO");
2116 } else 2393 } else
2117 /* We can't use the DMA channel after all. */ 2394 /* We can't use the DMA channel after all. */
2118 p->dma = PARPORT_DMA_NONE; 2395 p->dma = PARPORT_DMA_NONE;
2119#endif /* Allowed to use FIFO/DMA */ 2396#endif /* Allowed to use FIFO/DMA */
2120 2397
2121 printk(KERN_CONT " ["); 2398 printk(" [");
2122 2399
2123#define printmode(x) \ 2400#define printmode(x) \
2124 {\ 2401 {\
2125 if (p->modes & PARPORT_MODE_##x) {\ 2402 if (p->modes & PARPORT_MODE_##x) {\
2126 printk(KERN_CONT "%s%s", f ? "," : "", #x);\ 2403 printk("%s%s", f ? "," : "", #x);\
2127 f++;\ 2404 f++;\
2128 } \ 2405 } \
2129 } 2406 }
@@ -2139,9 +2416,9 @@ struct parport *parport_pc_probe_port(unsigned long int base,
2139 } 2416 }
2140#undef printmode 2417#undef printmode
2141#ifndef CONFIG_PARPORT_1284 2418#ifndef CONFIG_PARPORT_1284
2142 printk(KERN_CONT "(,...)"); 2419 printk("(,...)");
2143#endif /* CONFIG_PARPORT_1284 */ 2420#endif /* CONFIG_PARPORT_1284 */
2144 printk(KERN_CONT "]\n"); 2421 printk("]\n");
2145 if (probedirq != PARPORT_IRQ_NONE) 2422 if (probedirq != PARPORT_IRQ_NONE)
2146 printk(KERN_INFO "%s: irq %d detected\n", p->name, probedirq); 2423 printk(KERN_INFO "%s: irq %d detected\n", p->name, probedirq);
2147 2424
@@ -2268,8 +2545,9 @@ EXPORT_SYMBOL(parport_pc_unregister_port);
2268#ifdef CONFIG_PCI 2545#ifdef CONFIG_PCI
2269 2546
2270/* ITE support maintained by Rich Liu <richliu@poorman.org> */ 2547/* ITE support maintained by Rich Liu <richliu@poorman.org> */
2271static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma, 2548static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
2272 const struct parport_pc_via_data *via) 2549 int autodma,
2550 const struct parport_pc_via_data *via)
2273{ 2551{
2274 short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; 2552 short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
2275 u32 ite8872set; 2553 u32 ite8872set;
@@ -2317,17 +2595,14 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
2317 break; 2595 break;
2318 case 0x6: 2596 case 0x6:
2319 printk(KERN_INFO "parport_pc: ITE8873 found (1S)\n"); 2597 printk(KERN_INFO "parport_pc: ITE8873 found (1S)\n");
2320 release_region(inta_addr[i], 32);
2321 return 0; 2598 return 0;
2322 case 0x8: 2599 case 0x8:
2323 printk(KERN_INFO "parport_pc: ITE8874 found (2S)\n"); 2600 printk(KERN_INFO "parport_pc: ITE8874 found (2S)\n");
2324 release_region(inta_addr[i], 32);
2325 return 0; 2601 return 0;
2326 default: 2602 default:
2327 printk(KERN_INFO "parport_pc: unknown ITE887x\n"); 2603 printk(KERN_INFO "parport_pc: unknown ITE887x\n");
2328 printk(KERN_INFO "parport_pc: please mail 'lspci -nvv' " 2604 printk(KERN_INFO "parport_pc: please mail 'lspci -nvv' "
2329 "output to Rich.Liu@ite.com.tw\n"); 2605 "output to Rich.Liu@ite.com.tw\n");
2330 release_region(inta_addr[i], 32);
2331 return 0; 2606 return 0;
2332 } 2607 }
2333 2608
@@ -2375,10 +2650,10 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
2375 2650
2376/* VIA 8231 support by Pavel Fedin <sonic_amiga@rambler.ru> 2651/* VIA 8231 support by Pavel Fedin <sonic_amiga@rambler.ru>
2377 based on VIA 686a support code by Jeff Garzik <jgarzik@pobox.com> */ 2652 based on VIA 686a support code by Jeff Garzik <jgarzik@pobox.com> */
2378static int parport_init_mode; 2653static int __devinitdata parport_init_mode;
2379 2654
2380/* Data for two known VIA chips */ 2655/* Data for two known VIA chips */
2381static struct parport_pc_via_data via_686a_data = { 2656static struct parport_pc_via_data via_686a_data __devinitdata = {
2382 0x51, 2657 0x51,
2383 0x50, 2658 0x50,
2384 0x85, 2659 0x85,
@@ -2387,7 +2662,7 @@ static struct parport_pc_via_data via_686a_data = {
2387 0xF0, 2662 0xF0,
2388 0xE6 2663 0xE6
2389}; 2664};
2390static struct parport_pc_via_data via_8231_data = { 2665static struct parport_pc_via_data via_8231_data __devinitdata = {
2391 0x45, 2666 0x45,
2392 0x44, 2667 0x44,
2393 0x50, 2668 0x50,
@@ -2397,8 +2672,9 @@ static struct parport_pc_via_data via_8231_data = {
2397 0xF6 2672 0xF6
2398}; 2673};
2399 2674
2400static int sio_via_probe(struct pci_dev *pdev, int autoirq, int autodma, 2675static int __devinit sio_via_probe(struct pci_dev *pdev, int autoirq,
2401 const struct parport_pc_via_data *via) 2676 int autodma,
2677 const struct parport_pc_via_data *via)
2402{ 2678{
2403 u8 tmp, tmp2, siofunc; 2679 u8 tmp, tmp2, siofunc;
2404 u8 ppcontrol = 0; 2680 u8 ppcontrol = 0;
@@ -2572,7 +2848,7 @@ static struct parport_pc_superio {
2572 int (*probe) (struct pci_dev *pdev, int autoirq, int autodma, 2848 int (*probe) (struct pci_dev *pdev, int autoirq, int autodma,
2573 const struct parport_pc_via_data *via); 2849 const struct parport_pc_via_data *via);
2574 const struct parport_pc_via_data *via; 2850 const struct parport_pc_via_data *via;
2575} parport_pc_superio_info[] = { 2851} parport_pc_superio_info[] __devinitdata = {
2576 { sio_via_probe, &via_686a_data, }, 2852 { sio_via_probe, &via_686a_data, },
2577 { sio_via_probe, &via_8231_data, }, 2853 { sio_via_probe, &via_8231_data, },
2578 { sio_ite_8872_probe, NULL, }, 2854 { sio_ite_8872_probe, NULL, },
@@ -2857,7 +3133,7 @@ static int parport_pc_pci_probe(struct pci_dev *dev,
2857 return -ENODEV; 3133 return -ENODEV;
2858} 3134}
2859 3135
2860static void parport_pc_pci_remove(struct pci_dev *dev) 3136static void __devexit parport_pc_pci_remove(struct pci_dev *dev)
2861{ 3137{
2862 struct pci_parport_data *data = pci_get_drvdata(dev); 3138 struct pci_parport_data *data = pci_get_drvdata(dev);
2863 int i; 3139 int i;
@@ -2876,7 +3152,7 @@ static struct pci_driver parport_pc_pci_driver = {
2876 .name = "parport_pc", 3152 .name = "parport_pc",
2877 .id_table = parport_pc_pci_tbl, 3153 .id_table = parport_pc_pci_tbl,
2878 .probe = parport_pc_pci_probe, 3154 .probe = parport_pc_pci_probe,
2879 .remove = parport_pc_pci_remove, 3155 .remove = __devexit_p(parport_pc_pci_remove),
2880}; 3156};
2881 3157
2882static int __init parport_pc_init_superio(int autoirq, int autodma) 3158static int __init parport_pc_init_superio(int autoirq, int autodma)
@@ -2980,7 +3256,7 @@ static struct pnp_driver parport_pc_pnp_driver = {
2980static struct pnp_driver parport_pc_pnp_driver; 3256static struct pnp_driver parport_pc_pnp_driver;
2981#endif /* CONFIG_PNP */ 3257#endif /* CONFIG_PNP */
2982 3258
2983static int parport_pc_platform_probe(struct platform_device *pdev) 3259static int __devinit parport_pc_platform_probe(struct platform_device *pdev)
2984{ 3260{
2985 /* Always succeed, the actual probing is done in 3261 /* Always succeed, the actual probing is done in
2986 * parport_pc_probe_port(). */ 3262 * parport_pc_probe_port(). */
@@ -2996,7 +3272,7 @@ static struct platform_driver parport_pc_platform_driver = {
2996}; 3272};
2997 3273
2998/* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */ 3274/* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */
2999static int __attribute__((unused)) 3275static int __devinit __attribute__((unused))
3000parport_pc_find_isa_ports(int autoirq, int autodma) 3276parport_pc_find_isa_ports(int autoirq, int autodma)
3001{ 3277{
3002 int count = 0; 3278 int count = 0;
@@ -3125,8 +3401,8 @@ static int __init parport_init_mode_setup(char *str)
3125#endif 3401#endif
3126 3402
3127#ifdef MODULE 3403#ifdef MODULE
3128static char *irq[PARPORT_PC_MAX_PORTS]; 3404static const char *irq[PARPORT_PC_MAX_PORTS];
3129static char *dma[PARPORT_PC_MAX_PORTS]; 3405static const char *dma[PARPORT_PC_MAX_PORTS];
3130 3406
3131MODULE_PARM_DESC(io, "Base I/O address (SPP regs)"); 3407MODULE_PARM_DESC(io, "Base I/O address (SPP regs)");
3132module_param_array(io, int, NULL, 0); 3408module_param_array(io, int, NULL, 0);
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index ef6169adb84..e9c32274df3 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -62,7 +62,6 @@ enum parport_pc_pci_cards {
62 timedia_9079a, 62 timedia_9079a,
63 timedia_9079b, 63 timedia_9079b,
64 timedia_9079c, 64 timedia_9079c,
65 wch_ch353_2s1p,
66}; 65};
67 66
68/* each element directly indexed from enum list, above */ 67/* each element directly indexed from enum list, above */
@@ -87,8 +86,7 @@ struct parport_pc_pci {
87 struct parport_pc_pci *card, int failed); 86 struct parport_pc_pci *card, int failed);
88}; 87};
89 88
90static int netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par, 89static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par, int autoirq, int autodma)
91 int autoirq, int autodma)
92{ 90{
93 /* the rule described below doesn't hold for this device */ 91 /* the rule described below doesn't hold for this device */
94 if (dev->device == PCI_DEVICE_ID_NETMOS_9835 && 92 if (dev->device == PCI_DEVICE_ID_NETMOS_9835 &&
@@ -112,7 +110,7 @@ static int netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par,
112 return 0; 110 return 0;
113} 111}
114 112
115static struct parport_pc_pci cards[] = { 113static struct parport_pc_pci cards[] __devinitdata = {
116 /* titan_110l */ { 1, { { 3, -1 }, } }, 114 /* titan_110l */ { 1, { { 3, -1 }, } },
117 /* titan_210l */ { 1, { { 3, -1 }, } }, 115 /* titan_210l */ { 1, { { 3, -1 }, } },
118 /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init }, 116 /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init },
@@ -147,7 +145,6 @@ static struct parport_pc_pci cards[] = {
147 /* timedia_9079a */ { 1, { { 2, 3 }, } }, 145 /* timedia_9079a */ { 1, { { 2, 3 }, } },
148 /* timedia_9079b */ { 1, { { 2, 3 }, } }, 146 /* timedia_9079b */ { 1, { { 2, 3 }, } },
149 /* timedia_9079c */ { 1, { { 2, 3 }, } }, 147 /* timedia_9079c */ { 1, { { 2, 3 }, } },
150 /* wch_ch353_2s1p*/ { 1, { { 2, -1}, } },
151}; 148};
152 149
153static struct pci_device_id parport_serial_pci_tbl[] = { 150static struct pci_device_id parport_serial_pci_tbl[] = {
@@ -246,8 +243,7 @@ static struct pci_device_id parport_serial_pci_tbl[] = {
246 { 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a }, 243 { 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a },
247 { 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b }, 244 { 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b },
248 { 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c }, 245 { 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c },
249 /* WCH CARDS */ 246
250 { 0x4348, 0x7053, 0x4348, 0x3253, 0, 0, wch_ch353_2s1p},
251 { 0, } /* terminate list */ 247 { 0, } /* terminate list */
252}; 248};
253MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl); 249MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl);
@@ -259,7 +255,7 @@ MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl);
259 * Cards not tested are marked n/t 255 * Cards not tested are marked n/t
260 * If you have one of these cards and it works for you, please tell me.. 256 * If you have one of these cards and it works for you, please tell me..
261 */ 257 */
262static struct pciserial_board pci_parport_serial_boards[] = { 258static struct pciserial_board pci_parport_serial_boards[] __devinitdata = {
263 [titan_110l] = { 259 [titan_110l] = {
264 .flags = FL_BASE1 | FL_BASE_BARS, 260 .flags = FL_BASE1 | FL_BASE_BARS,
265 .num_ports = 1, 261 .num_ports = 1,
@@ -464,12 +460,6 @@ static struct pciserial_board pci_parport_serial_boards[] = {
464 .base_baud = 921600, 460 .base_baud = 921600,
465 .uart_offset = 8, 461 .uart_offset = 8,
466 }, 462 },
467 [wch_ch353_2s1p] = {
468 .flags = FL_BASE0|FL_BASE_BARS,
469 .num_ports = 2,
470 .base_baud = 115200,
471 .uart_offset = 8,
472 },
473}; 463};
474 464
475struct parport_serial_private { 465struct parport_serial_private {
@@ -480,7 +470,8 @@ struct parport_serial_private {
480}; 470};
481 471
482/* Register the serial port(s) of a PCI card. */ 472/* Register the serial port(s) of a PCI card. */
483static int serial_register(struct pci_dev *dev, const struct pci_device_id *id) 473static int __devinit serial_register (struct pci_dev *dev,
474 const struct pci_device_id *id)
484{ 475{
485 struct parport_serial_private *priv = pci_get_drvdata (dev); 476 struct parport_serial_private *priv = pci_get_drvdata (dev);
486 struct pciserial_board *board; 477 struct pciserial_board *board;
@@ -501,7 +492,8 @@ static int serial_register(struct pci_dev *dev, const struct pci_device_id *id)
501} 492}
502 493
503/* Register the parallel port(s) of a PCI card. */ 494/* Register the parallel port(s) of a PCI card. */
504static int parport_register(struct pci_dev *dev, const struct pci_device_id *id) 495static int __devinit parport_register (struct pci_dev *dev,
496 const struct pci_device_id *id)
505{ 497{
506 struct parport_pc_pci *card; 498 struct parport_pc_pci *card;
507 struct parport_serial_private *priv = pci_get_drvdata (dev); 499 struct parport_serial_private *priv = pci_get_drvdata (dev);
@@ -562,8 +554,8 @@ static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
562 return 0; 554 return 0;
563} 555}
564 556
565static int parport_serial_pci_probe(struct pci_dev *dev, 557static int __devinit parport_serial_pci_probe (struct pci_dev *dev,
566 const struct pci_device_id *id) 558 const struct pci_device_id *id)
567{ 559{
568 struct parport_serial_private *priv; 560 struct parport_serial_private *priv;
569 int err; 561 int err;
@@ -598,7 +590,7 @@ static int parport_serial_pci_probe(struct pci_dev *dev,
598 return 0; 590 return 0;
599} 591}
600 592
601static void parport_serial_pci_remove(struct pci_dev *dev) 593static void __devexit parport_serial_pci_remove (struct pci_dev *dev)
602{ 594{
603 struct parport_serial_private *priv = pci_get_drvdata (dev); 595 struct parport_serial_private *priv = pci_get_drvdata (dev);
604 int i; 596 int i;
@@ -663,7 +655,7 @@ static struct pci_driver parport_serial_pci_driver = {
663 .name = "parport_serial", 655 .name = "parport_serial",
664 .id_table = parport_serial_pci_tbl, 656 .id_table = parport_serial_pci_tbl,
665 .probe = parport_serial_pci_probe, 657 .probe = parport_serial_pci_probe,
666 .remove = parport_serial_pci_remove, 658 .remove = __devexit_p(parport_serial_pci_remove),
667#ifdef CONFIG_PM 659#ifdef CONFIG_PM
668 .suspend = parport_serial_pci_suspend, 660 .suspend = parport_serial_pci_suspend,
669 .resume = parport_serial_pci_resume, 661 .resume = parport_serial_pci_resume,
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 5c4b6a1db6c..910c5a26e34 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -82,6 +82,27 @@ static unsigned char parport_sunbpp_read_data(struct parport *p)
82 return sbus_readb(&regs->p_dr); 82 return sbus_readb(&regs->p_dr);
83} 83}
84 84
85#if 0
86static void control_pc_to_sunbpp(struct parport *p, unsigned char status)
87{
88 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
89 unsigned char value_tcr = sbus_readb(&regs->p_tcr);
90 unsigned char value_or = sbus_readb(&regs->p_or);
91
92 if (status & PARPORT_CONTROL_STROBE)
93 value_tcr |= P_TCR_DS;
94 if (status & PARPORT_CONTROL_AUTOFD)
95 value_or |= P_OR_AFXN;
96 if (status & PARPORT_CONTROL_INIT)
97 value_or |= P_OR_INIT;
98 if (status & PARPORT_CONTROL_SELECT)
99 value_or |= P_OR_SLCT_IN;
100
101 sbus_writeb(value_or, &regs->p_or);
102 sbus_writeb(value_tcr, &regs->p_tcr);
103}
104#endif
105
85static unsigned char status_sunbpp_to_pc(struct parport *p) 106static unsigned char status_sunbpp_to_pc(struct parport *p)
86{ 107{
87 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base; 108 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
@@ -265,7 +286,7 @@ static struct parport_operations parport_sunbpp_ops =
265 .owner = THIS_MODULE, 286 .owner = THIS_MODULE,
266}; 287};
267 288
268static int bpp_probe(struct platform_device *op) 289static int __devinit bpp_probe(struct platform_device *op)
269{ 290{
270 struct parport_operations *ops; 291 struct parport_operations *ops;
271 struct bpp_regs __iomem *regs; 292 struct bpp_regs __iomem *regs;
@@ -330,7 +351,7 @@ out_unmap:
330 return err; 351 return err;
331} 352}
332 353
333static int bpp_remove(struct platform_device *op) 354static int __devexit bpp_remove(struct platform_device *op)
334{ 355{
335 struct parport *p = dev_get_drvdata(&op->dev); 356 struct parport *p = dev_get_drvdata(&op->dev);
336 struct parport_operations *ops = p->ops; 357 struct parport_operations *ops = p->ops;
@@ -367,13 +388,24 @@ static struct platform_driver bpp_sbus_driver = {
367 .of_match_table = bpp_match, 388 .of_match_table = bpp_match,
368 }, 389 },
369 .probe = bpp_probe, 390 .probe = bpp_probe,
370 .remove = bpp_remove, 391 .remove = __devexit_p(bpp_remove),
371}; 392};
372 393
373module_platform_driver(bpp_sbus_driver); 394static int __init parport_sunbpp_init(void)
395{
396 return platform_driver_register(&bpp_sbus_driver);
397}
398
399static void __exit parport_sunbpp_exit(void)
400{
401 platform_driver_unregister(&bpp_sbus_driver);
402}
374 403
375MODULE_AUTHOR("Derrick J Brashear"); 404MODULE_AUTHOR("Derrick J Brashear");
376MODULE_DESCRIPTION("Parport Driver for Sparc bidirectional Port"); 405MODULE_DESCRIPTION("Parport Driver for Sparc bidirectional Port");
377MODULE_SUPPORTED_DEVICE("Sparc Bidirectional Parallel Port"); 406MODULE_SUPPORTED_DEVICE("Sparc Bidirectional Parallel Port");
378MODULE_VERSION("2.0"); 407MODULE_VERSION("2.0");
379MODULE_LICENSE("GPL"); 408MODULE_LICENSE("GPL");
409
410module_init(parport_sunbpp_init)
411module_exit(parport_sunbpp_exit)