linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 5.10 12/30] parport_pc: Set up mode and ECR masks for Oxford Semiconductor devices
Date: Fri,  3 Mar 2023 16:46:57 -0500	[thread overview]
Message-ID: <20230303214715.1452256-12-sashal@kernel.org> (raw)
In-Reply-To: <20230303214715.1452256-1-sashal@kernel.org>

From: "Maciej W. Rozycki" <macro@orcam.me.uk>

[ Upstream commit c087df8d1e7dc2e764d11234d84b5af46d500f16 ]

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 adbd321a17cc ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/parport/parport_pc.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 925be41eeebec..c2af2aa6d437c 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2657,12 +2657,19 @@ static struct parport_pc_pci {
 	/* titan_010l */		{ 1, { { 3, -1 }, } },
 	/* avlab_1p		*/	{ 1, { { 0, 1}, } },
 	/* avlab_2p		*/	{ 2, { { 0, 1}, { 2, 3 },} },
-	/* The Oxford Semi cards are unusual: 954 doesn't support ECP,
-	 * and 840 locks up if you write 1 to bit 2! */
-	/* oxsemi_952 */		{ 1, { { 0, 1 }, } },
-	/* oxsemi_954 */		{ 1, { { 0, -1 }, } },
-	/* oxsemi_840 */		{ 1, { { 0, 1 }, } },
-	/* oxsemi_pcie_pport */		{ 1, { { 0, 1 }, } },
+	/* The Oxford Semi cards are unusual: older variants of 954 don't
+	 * support ECP, and 840 locks up if you write 1 to bit 2!  None
+	 * implement nFault or service interrupts and all require 00001
+	 * bit pattern to be used for bits 4:0 with ECR writes. */
+	/* oxsemi_952 */		{ 1, { { 0, 1 }, },
+					  PARPORT_MODE_COMPAT, ECR_MODE_MASK },
+	/* oxsemi_954 */		{ 1, { { 0, 1 }, },
+					  PARPORT_MODE_ECP |
+					  PARPORT_MODE_COMPAT, ECR_MODE_MASK },
+	/* oxsemi_840 */		{ 1, { { 0, 1 }, },
+					  PARPORT_MODE_COMPAT, ECR_MODE_MASK },
+	/* oxsemi_pcie_pport */		{ 1, { { 0, 1 }, },
+					  PARPORT_MODE_COMPAT, ECR_MODE_MASK },
 	/* aks_0100 */                  { 1, { { 0, -1 }, } },
 	/* mobility_pp */		{ 1, { { 0, 1 }, } },
 
-- 
2.39.2


  parent reply	other threads:[~2023-03-03 21:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 21:46 [PATCH AUTOSEL 5.10 01/30] IB/hfi1: Update RMT size calculation Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 02/30] iommu/amd: Fix error handling for pdev_pri_ats_enable() Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 03/30] media: uvcvideo: Handle cameras with invalid descriptors Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 04/30] media: uvcvideo: Handle errors from calls to usb_string Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 05/30] media: uvcvideo: Quirk for autosuspend in Logitech B910 and C910 Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 06/30] media: uvcvideo: Silence memcpy() run-time false positive warnings Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 07/30] staging: emxx_udc: Add checks for dma_alloc_coherent() Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 08/30] tty: fix out-of-bounds access in tty_driver_lookup_tty() Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 09/30] tty: serial: fsl_lpuart: disable the CTS when send break signal Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 10/30] serial: sc16is7xx: setup GPIO controller later in probe Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 11/30] mei: bus-fixup:upon error print return values of send and receive Sasha Levin
2023-03-03 21:46 ` Sasha Levin [this message]
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 13/30] tools/iio/iio_utils:fix memory leak Sasha Levin
2023-03-03 21:46 ` [PATCH AUTOSEL 5.10 14/30] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_status_word() Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 15/30] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_config_word() Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 16/30] firmware: coreboot: framebuffer: Ignore reserved pixel color bits Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 17/30] PCI: loongson: Prevent LS7A MRRS increases Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 18/30] usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 19/30] USB: ene_usb6250: Allocate enough memory for full object Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 20/30] usb: uvc: Enumerate valid values for color matching Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 21/30] usb: gadget: uvc: Make bSourceID read/write Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 22/30] PCI: Align extra resources for hotplug bridges properly Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 23/30] PCI: Take other bus devices into account when distributing resources Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 24/30] kernel/power/energy_model.c: fix memory leak with using debugfs_lookup() Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 25/30] kernel/fail_function: " Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 26/30] PCI: loongson: Add more devices that need MRRS quirk Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 27/30] PCI: Add ACS quirk for Wangxun NICs Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 28/30] phy: rockchip-typec: Fix unsigned comparison with less than zero Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 29/30] soundwire: cadence: Remove wasted space in response_buf Sasha Levin
2023-03-03 21:47 ` [PATCH AUTOSEL 5.10 30/30] soundwire: cadence: Drain the RX FIFO after an IO timeout Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230303214715.1452256-12-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=stable@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).