linux-stable/drivers/parport
Maciej W. Rozycki c087df8d1e parport_pc: Set up mode and ECR masks for Oxford Semiconductor devices
No Oxford Semiconductor PCI or PCIe parallel port device supports the
Parallel Port FIFO mode.  All support the PS/2 Parallel Port mode and
the Enhanced Parallel Port mode via the ECR register.  The original 5V
PCI OX16PCI954 device does not support the Extended Capabilities Port
mode, the Test mode or the Configuration mode, but all the other OxSemi
devices do, including in particular the 3.3V PCI OXmPCI954 device and
the universal voltage PCI OXuPCI954 device.  All the unsupported modes
are marked reserved in the relevant datasheets.

Accordingly enable the `base_hi' BAR for the 954 devices to enable PS2
and EPP mode support via the ECR register, however mask the COMPAT mode
and, until we have a way to determine what chip variant it is that we
poke at, also the ECP mode, and mask the COMPAT mode only for all the
remaining OxSemi devices, fixing errors like:

parport0: FIFO is stuck
FIFO write timed out

and a non-functional port when the Parallel Port FIFO mode is selected.

Complementing the fix apply an ECR mask for all these devices, which are
documented to only permit writing to the mode field of the ECR register
with a bit pattern of 00001 required to be written to bits 4:0 on mode
field writes.  No nFault or service interrupts are implemented, which
will therefore never have to be enabled, though bit 2 does report the
FIFO threshold status to be polled for in the ECP mode where supported.

We have a documented case of writing 1 to bit 2 causing a lock-up with
at least one OX12PCI840 device (from old drivers/parport/ChangeLog):

2001-10-10  Tim Waugh  <twaugh@redhat.com>

	* parport_pc.c: Support for OX12PCI840 PCI card (reported by
	mk@daveg.com).  Lock-ups diagnosed by Ronnie Arosa (and now we
	just don't trust its ECR).

which commit adbd321a17 ("parport_pc: add base_hi BAR for oxsemi_840")
must have broken and by applying an ECR mask here we prevent the lock-up
from triggering.  This could have been the reason for requiring 00001 to
be written to bits 4:0 of ECR.

Update the inline comment accordingly; it has come from Linux 2.4.12
back in 2001 and predates the introduction of OXmPCI954 and OXuPCI954
devices that do support ECP.

References:

[1] "OX16PCI954 Integrated Quad UART and PCI interface", Oxford
    Semiconductor Ltd., Data Sheet Revision 1.3, Feb. 1999, Chapter 9
    "Bidirectional Parallel Port", pp. 53-55

[2] "OX16PCI952 Data Sheet, Integrated High Performance Dual UARTs,
    Parallel Port and 5.0v PCI interface", Oxford Semiconductor Ltd.,
    DS_B008A_00, Datasheet rev 1.1, June 2001, Chapter 8 "Bi-directional
    Parallel Port", pp. 52-56

[3] "OXmPCI954 DATA SHEET Integrated High Performance Quad UARTs, 8-bit
    Local Bus/Parallel Port. 3.3v PCI/miniPCI interface.", Oxford
    Semiconductor Ltd., DS-0019, June 2005, Chapter 10 "Bidirectional
    Parallel Port", pp. 86-90

[4] "OXmPCI952 Data Sheet, Integrated High Performance Dual UARTs, 8-bit
    Local Bus/Parallel Port. 3.3v PCI/miniPCI interface.", Oxford
    Semiconductor Ltd., DS-0020, June 2005, Chapter 8 "Bidirectional
    Parallel Port", pp. 73-77

[5] "OX12PCI840 Integrated Parallel Port and PCI interface", Oxford
    Semiconductor Ltd., DS-0021, Jun 2005, Chapter 5 "Bi-directional
    Parallel Port", pp. 18-21

[6] "OXPCIe952 PCI Express Bridge to Dual Serial & Parallel Port",
    Oxford Semiconductor, Inc., DS-0046, Mar 06 08, Chapter "Parallel
    Port Function", pp. 59-62

[7] "OXPCIe840 PCI Express Bridge to Parallel Port", Oxford
    Semiconductor, Inc., DS-0049, Mar 06 08, Chapter "Parallel Port
    Function", pp. 15-18

[8] "OXuPCI954 Data Sheet, Integrated High Performance Quad UARTs, 8-bit
    Local Bus/Parallel Port, 3.3 V and 5 V (Universal Voltage) PCI
    Interface.", Oxford Semiconductor, Inc., DS-0058, 26 Jan 2009,
    Chapter 8 "Bidirectional Parallel Port", pp. 62-65

[9] "OXuPCI952 Data Sheet, Integrated High Performance Dual UARTs, 8-bit
    Local Bus/Parallel Port, 3.3 V and 5.0 V Universal Voltage PCI
    Interface.", Oxford Semiconductor, Inc., DS-0059, Sep 2007, Chapter
    8 "Bidirectional Parallel Port", pp. 61-64

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lore.kernel.org/r/20230108215656.6433-6-sudipm.mukherjee@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-20 13:12:00 +01:00
..
BUGS-parport
daisy.c parport: daisy: Convert DPRINTK to pr_debug 2020-04-23 17:05:38 +02:00
ieee1284.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ieee1284_ops.c parport: remove non-zero check on count 2021-08-27 16:18:42 +02:00
Kconfig parport_pc: Also enable driver for PCI systems 2022-03-18 14:01:41 +01:00
Makefile parport: Add missing newline at end of file 2019-08-05 17:56:45 +02:00
multiface.h
parport_amiga.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
parport_atari.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
parport_ax88796.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
parport_cs.c parport: Convert printk(KERN_<LEVEL> to pr_<level>( 2020-04-23 17:05:37 +02:00
parport_gsc.c parisc/parport_gsc: switch from 'pci_' to 'dma_' API 2021-08-30 10:18:25 +02:00
parport_gsc.h parport: Use more comon logging styles 2020-04-23 17:05:37 +02:00
parport_ip32.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
parport_mfc3.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
parport_pc.c parport_pc: Set up mode and ECR masks for Oxford Semiconductor devices 2023-01-20 13:12:00 +01:00
parport_serial.c parport: serial: Retrieve IRQ vector with help of special getter 2021-07-29 17:08:40 +02:00
parport_sunbpp.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
probe.c parport: Use string_upper() instead of open coded variant 2021-05-21 14:48:58 +02:00
procfs.c Char/Misc driver patches for 5.8-rc1 2020-06-07 10:59:32 -07:00
share.c parport: fix a kernel-doc markup 2021-01-21 14:06:00 -07:00
TODO-parport