public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] gpib: Add support for ines pci_xl board
@ 2026-04-11 17:25 Dave Penkler
  2026-04-11 17:25 ` [PATCH 1/6] gpib: Add enums for INES 72130 based cards Dave Penkler
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Dave Penkler @ 2026-04-11 17:25 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: stable, Dave Penkler

INES have 2 pci boards that both have the same vendor and device ID
[16da:0011]. The older board is based on the 72010 chip that has a
number of extended registers that are missing in the 72130 based
board. This caused random error messages when the 72130 based board was
being used. The one extended register in the 72130 chip is the bus
status register which is at a different offset and has a different
layout.

The proprietary ines driver uses some undocumented heuristics
to determine which board is being used. In order to configure the
correct behaviour of the linux ines gpib driver for the 72130 based
board we introduce a new board type "ines_pci_xl" and rely on user
configuration to set the appropriate board type. The chip type is set
in the ines_pci_xl_attach() routine and the ines72130_line_status()
routine accesses the 72130 bus status register.

Patch 1: Add the chip type enum, the BSR offset and bit mask enums
Patch 2: Adds the 72130 specific line_status routine
Patch 3: Avoids accessing the extended registers when in 72130 mode
Patch 4: Adds the pci_xl gpib_interface initialisation structure
Patch 5: Add the attach routine for the 72130 based  pci_xl board
Patch 6: Adds the common driver register and unregister calls

Dave Penkler (6):
  gpib: Add enums for INES 72130 based cards
  gpib: Add ines 72130 line_status routine
  gpib: Don't use extended registers
  gpib: Add ines_pci_xl_interface
  gpib: Add attach routine for pci_xl board
  gpib; Add register and unregister calls

 drivers/gpib/ines/ines.h      | 16 +++++++
 drivers/gpib/ines/ines_gpib.c | 90 +++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] gpib: Add enums for INES 72130 based cards
  2026-04-11 17:25 [PATCH 0/6] gpib: Add support for ines pci_xl board Dave Penkler
@ 2026-04-11 17:25 ` Dave Penkler
  2026-04-11 17:25 ` [PATCH 2/6] gpib: Add ines 72130 line_status routine Dave Penkler
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dave Penkler @ 2026-04-11 17:25 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: stable, Dave Penkler

Add Chip type enum
Add offset for 72130 bus status register
Add bit masks for line state in 72130 bus status register

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
 drivers/gpib/ines/ines.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpib/ines/ines.h b/drivers/gpib/ines/ines.h
index 6ad57e9a1216..22af59682870 100644
--- a/drivers/gpib/ines/ines.h
+++ b/drivers/gpib/ines/ines.h
@@ -21,6 +21,7 @@ enum ines_pci_chip {
 	PCI_CHIP_AMCC5920,
 	PCI_CHIP_QUANCOM,
 	PCI_CHIP_QUICKLOGIC5030,
+	PCI_CHIP_INES_72130,
 };
 
 struct ines_priv {
@@ -162,4 +163,19 @@ enum ines_auxd_bits {
 	INES_T6_50us = 0x10,
 };
 
+enum ines72130_regs {
+	BUS_STATUS_REG = 0xc,
+};
+
+enum ines_72130_bus_status_bits  {
+	BSR_NRFD_BIT = 0x1,
+	BSR_NDAC_BIT = 0x2,
+	BSR_DAV_BIT = 0x4,
+	BSR_EOI_BIT = 0x8,
+	BSR_SRQ_BIT = 0x10,
+	BSR_ATN_BIT = 0x20,
+	BSR_REN_BIT = 0x40,
+	BSR_IFC_BIT = 0x80,
+};
+
 #endif	// _INES_GPIB_H
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] gpib: Add ines 72130 line_status routine
  2026-04-11 17:25 [PATCH 0/6] gpib: Add support for ines pci_xl board Dave Penkler
  2026-04-11 17:25 ` [PATCH 1/6] gpib: Add enums for INES 72130 based cards Dave Penkler
@ 2026-04-11 17:25 ` Dave Penkler
  2026-04-11 17:25 ` [PATCH 3/6] gpib: Don't use extended registers Dave Penkler
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dave Penkler @ 2026-04-11 17:25 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: stable, Dave Penkler

The 72130 chip has a different bus statue register offset
and layout.

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
 drivers/gpib/ines/ines_gpib.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index c000f647fbb5..dd98cb261a4c 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -57,6 +57,34 @@ static int ines_line_status(const struct gpib_board *board)
 	return status;
 }
 
+static int ines72130_line_status(const struct gpib_board *board)
+{
+	int status = VALID_ALL;
+	int bsr_bits;
+	struct ines_priv *ines_priv = board->private_data;
+
+	bsr_bits = ines_inb(ines_priv, BUS_STATUS_REG);
+
+	if (bsr_bits & BSR_REN_BIT)
+		status |= BUS_REN;
+	if (bsr_bits & BSR_IFC_BIT)
+		status |= BUS_IFC;
+	if (bsr_bits & BSR_SRQ_BIT)
+		status |= BUS_SRQ;
+	if (bsr_bits & BSR_EOI_BIT)
+		status |= BUS_EOI;
+	if (bsr_bits & BSR_NRFD_BIT)
+		status |= BUS_NRFD;
+	if (bsr_bits & BSR_NDAC_BIT)
+		status |= BUS_NDAC;
+	if (bsr_bits & BSR_DAV_BIT)
+		status |= BUS_DAV;
+	if (bsr_bits & BSR_ATN_BIT)
+		status |= BUS_ATN;
+
+	return status;
+}
+
 static void ines_set_xfer_counter(struct ines_priv *priv, unsigned int count)
 {
 	if (count > 0xffff) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] gpib: Don't use extended registers
  2026-04-11 17:25 [PATCH 0/6] gpib: Add support for ines pci_xl board Dave Penkler
  2026-04-11 17:25 ` [PATCH 1/6] gpib: Add enums for INES 72130 based cards Dave Penkler
  2026-04-11 17:25 ` [PATCH 2/6] gpib: Add ines 72130 line_status routine Dave Penkler
@ 2026-04-11 17:25 ` Dave Penkler
  2026-04-11 17:25 ` [PATCH 4/6] gpib: Add ines_pci_xl_interface Dave Penkler
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dave Penkler @ 2026-04-11 17:25 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: stable, Dave Penkler

When the chip type is 72310 then avoid accessing extended registers
Apart from the BSR the 72310 supports only the standard NEC u7210
registers.

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
 drivers/gpib/ines/ines_gpib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index dd98cb261a4c..df299a9d7f4d 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -103,6 +103,9 @@ static int ines_t1_delay(struct gpib_board *board, unsigned int nano_sec)
 
 	retval = nec7210_t1_delay(board, nec_priv, nano_sec);
 
+	if (ines_priv->pci_chip_type == PCI_CHIP_INES_72130)
+		return retval;
+
 	if (nano_sec <= 250) {
 		write_byte(nec_priv, INES_AUXD | INES_FOLLOWING_T1_250ns |
 			   INES_INITIAL_T1_2000ns, AUXMR);
@@ -322,6 +325,8 @@ static irqreturn_t ines_interrupt(struct gpib_board *board)
 	spin_lock_irqsave(&board->spinlock, flags);
 
 	nec7210_interrupt(board, nec_priv);
+	if (priv->pci_chip_type == PCI_CHIP_INES_72130)
+		goto out;
 	isr3_bits = ines_inb(priv, ISR3);
 	isr4_bits = ines_inb(priv, ISR4);
 	if (isr3_bits & IFC_ACTIVE_BIT)	{
@@ -339,6 +344,7 @@ static irqreturn_t ines_interrupt(struct gpib_board *board)
 
 	if (wake)
 		wake_up_interruptible(&board->wait);
+out:
 	spin_unlock_irqrestore(&board->spinlock, flags);
 	return IRQ_HANDLED;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] gpib: Add ines_pci_xl_interface
  2026-04-11 17:25 [PATCH 0/6] gpib: Add support for ines pci_xl board Dave Penkler
                   ` (2 preceding siblings ...)
  2026-04-11 17:25 ` [PATCH 3/6] gpib: Don't use extended registers Dave Penkler
@ 2026-04-11 17:25 ` Dave Penkler
  2026-04-11 17:25 ` [PATCH 5/6] gpib: Add attach routine for pci_xl board Dave Penkler
  2026-04-11 17:25 ` [PATCH 6/6] gpib; Add register and unregister calls Dave Penkler
  5 siblings, 0 replies; 7+ messages in thread
From: Dave Penkler @ 2026-04-11 17:25 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: stable, Dave Penkler

Add new interface initialisation struct for 72130 based boards.

It is basically the same as the ines_pci_interface apart from the
name, attach and line_status fields.

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
 drivers/gpib/ines/ines_gpib.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index df299a9d7f4d..118e6c7b0ff1 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -603,6 +603,34 @@ static struct gpib_interface ines_pci_unaccel_interface = {
 	.return_to_local = ines_return_to_local,
 };
 
+static struct gpib_interface ines_pci_xl_interface = {
+	.name = "ines_pci_xl",
+	.attach = ines_pci_xl_attach,
+	.detach = ines_pci_detach,
+	.read = ines_read,
+	.write = ines_write,
+	.command = ines_command,
+	.take_control = ines_take_control,
+	.go_to_standby = ines_go_to_standby,
+	.request_system_control = ines_request_system_control,
+	.interface_clear = ines_interface_clear,
+	.remote_enable = ines_remote_enable,
+	.enable_eos = ines_enable_eos,
+	.disable_eos = ines_disable_eos,
+	.parallel_poll = ines_parallel_poll,
+	.parallel_poll_configure = ines_parallel_poll_configure,
+	.parallel_poll_response = ines_parallel_poll_response,
+	.local_parallel_poll_mode = NULL, // XXX
+	.line_status = ines72130_line_status,
+	.update_status = ines_update_status,
+	.primary_address = ines_primary_address,
+	.secondary_address = ines_secondary_address,
+	.serial_poll_response = ines_serial_poll_response,
+	.serial_poll_status = ines_serial_poll_status,
+	.t1_delay = ines_t1_delay,
+	.return_to_local = ines_return_to_local,
+};
+
 static struct gpib_interface ines_pci_interface = {
 	.name = "ines_pci",
 	.attach = ines_pci_accel_attach,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] gpib: Add attach routine for pci_xl board
  2026-04-11 17:25 [PATCH 0/6] gpib: Add support for ines pci_xl board Dave Penkler
                   ` (3 preceding siblings ...)
  2026-04-11 17:25 ` [PATCH 4/6] gpib: Add ines_pci_xl_interface Dave Penkler
@ 2026-04-11 17:25 ` Dave Penkler
  2026-04-11 17:25 ` [PATCH 6/6] gpib; Add register and unregister calls Dave Penkler
  5 siblings, 0 replies; 7+ messages in thread
From: Dave Penkler @ 2026-04-11 17:25 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: stable, Dave Penkler

Add new attach routine for 72130 based boards.

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
 drivers/gpib/ines/ines_gpib.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index 118e6c7b0ff1..af9693c33b23 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -350,6 +350,7 @@ static irqreturn_t ines_interrupt(struct gpib_board *board)
 }
 
 static int ines_pci_attach(struct gpib_board *board, const struct gpib_board_config *config);
+static int ines_pci_xl_attach(struct gpib_board *board, const struct gpib_board_config *config);
 static int ines_pci_accel_attach(struct gpib_board *board, const struct gpib_board_config *config);
 static int ines_isa_attach(struct gpib_board *board, const struct gpib_board_config *config);
 
@@ -932,6 +933,24 @@ static int ines_pci_attach(struct gpib_board *board, const struct gpib_board_con
 	return 0;
 }
 
+static int ines_pci_xl_attach(struct gpib_board *board, const struct gpib_board_config *config)
+{
+	struct ines_priv *ines_priv;
+	struct nec7210_priv *nec_priv;
+	int retval;
+
+	retval = ines_common_pci_attach(board, config);
+	if (retval < 0)
+		return retval;
+
+	ines_priv = board->private_data;
+	ines_priv->pci_chip_type = PCI_CHIP_INES_72130;
+	nec_priv = &ines_priv->nec7210_priv;
+	nec7210_board_online(nec_priv, board);
+
+	return 0;
+}
+
 static int ines_pci_accel_attach(struct gpib_board *board, const struct gpib_board_config *config)
 {
 	struct ines_priv *ines_priv;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] gpib; Add register and unregister calls
  2026-04-11 17:25 [PATCH 0/6] gpib: Add support for ines pci_xl board Dave Penkler
                   ` (4 preceding siblings ...)
  2026-04-11 17:25 ` [PATCH 5/6] gpib: Add attach routine for pci_xl board Dave Penkler
@ 2026-04-11 17:25 ` Dave Penkler
  5 siblings, 0 replies; 7+ messages in thread
From: Dave Penkler @ 2026-04-11 17:25 UTC (permalink / raw)
  To: gregkh, linux-kernel; +Cc: stable, Dave Penkler

Register the driver for new 72130 based pci_xl board type with the
common driver on module initialisation.
Unregister the driver on registration error and module exit.

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
 drivers/gpib/ines/ines_gpib.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index af9693c33b23..3562f3184c28 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -1500,6 +1500,12 @@ static int __init ines_init_module(void)
 		goto err_pci_unaccel;
 	}
 
+	ret = gpib_register_driver(&ines_pci_xl_interface, THIS_MODULE);
+	if (ret) {
+		pr_err("gpib_register_driver failed: error = %d\n", ret);
+		goto err_pci_xl;
+	}
+
 	ret = gpib_register_driver(&ines_pci_accel_interface, THIS_MODULE);
 	if (ret) {
 		pr_err("gpib_register_driver failed: error = %d\n", ret);
@@ -1554,6 +1560,8 @@ static int __init ines_init_module(void)
 	gpib_unregister_driver(&ines_pci_accel_interface);
 err_pci_accel:
 	gpib_unregister_driver(&ines_pci_unaccel_interface);
+err_pci_xl:
+	gpib_unregister_driver(&ines_pci_xl_interface);
 err_pci_unaccel:
 	gpib_unregister_driver(&ines_pci_interface);
 err_pci:
@@ -1566,6 +1574,7 @@ static void __exit ines_exit_module(void)
 {
 	gpib_unregister_driver(&ines_pci_interface);
 	gpib_unregister_driver(&ines_pci_unaccel_interface);
+	gpib_unregister_driver(&ines_pci_xl_interface);
 	gpib_unregister_driver(&ines_pci_accel_interface);
 	gpib_unregister_driver(&ines_isa_interface);
 #ifdef CONFIG_GPIB_PCMCIA
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-04-11 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-11 17:25 [PATCH 0/6] gpib: Add support for ines pci_xl board Dave Penkler
2026-04-11 17:25 ` [PATCH 1/6] gpib: Add enums for INES 72130 based cards Dave Penkler
2026-04-11 17:25 ` [PATCH 2/6] gpib: Add ines 72130 line_status routine Dave Penkler
2026-04-11 17:25 ` [PATCH 3/6] gpib: Don't use extended registers Dave Penkler
2026-04-11 17:25 ` [PATCH 4/6] gpib: Add ines_pci_xl_interface Dave Penkler
2026-04-11 17:25 ` [PATCH 5/6] gpib: Add attach routine for pci_xl board Dave Penkler
2026-04-11 17:25 ` [PATCH 6/6] gpib; Add register and unregister calls Dave Penkler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox