Skip to contentSkip to conversation

Add Intel 8254 Counter support

PATCH RESEND Applied William Breathitt Gray 2 participants 5 messages Jul 20, 2023 – Jul 27, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add Intel 8254 Counter support

The Intel 8254 PIT first appeared in the early 1980s and was used initially in IBM PC compatibles. The popularity of the original Intel 825x family of chips led to many subsequent variants and clones of the interface in various chips and integrated circuits. Although still popular, interfaces compatible with the Intel 8254 PIT are nowdays typically found embedded in larger VLSI processing chips and FPGA components rather than as discrete ICs.

A library providing support for interfaces compatible with the venerable Intel 8254 Programmable Interval Timer (PIT) was merged in commit d428487471ba ("counter: i8254: Introduce the Intel 8254 interface library module").

Now that the necessary dependencies have been merged, this patchset adds support for the i8254 in two respective follow-up patches for the 104-dio-48e driver and stx104 driver whose devices feature i8254 compatible interfaces. The two patches are independent and may be taken each separately in their respective subsystem tree.

William Breathitt Gray (2):
gpio: 104-dio-48e: Add Counter/Timer support
iio: addac: stx104: Add 8254 Counter/Timer support

 drivers/gpio/Kconfig            |   1 +
 drivers/gpio/gpio-104-dio-48e.c | 127 ++++++++++++++++++++++++++++----
 drivers/iio/addac/Kconfig       |   1 +
 drivers/iio/addac/stx104.c      |  61 ++++++++++++++-
 4 files changed, 172 insertions(+), 18 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH RESEND 1/2 gpio: 104-dio-48e: Add Counter/Timer support

The 104-DIO-48E features an 8254 Counter/Timer chip providing three counter/timers which can be used for frequency measurement, frequency output, pulse width modulation, pulse width measurement, event count, etc. The counter/timers use the same addresses as PPI 0 (addresses 0x0 to 0x3), so a raw_spinlock_t is used to synchronize operations between the two regmap mappings to prevent clobbering.

---
 drivers/gpio/Kconfig            |   1 +
 drivers/gpio/gpio-104-dio-48e.c | 127 ++++++++++++++++++++++++++++----
 2 files changed, 112 insertions(+), 16 deletions(-)
drivers/gpio/Kconfig +1 -0
index e382dfebad7c..49466a148678 100644
@@ -858,6 +858,7 @@ config GPIO_104_DIO_48E
 	select REGMAP_IRQ
 	select GPIOLIB_IRQCHIP
 	select GPIO_I8255
+	select I8254
 	help
 	  Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E,
 	  104-DIO-24E). The base port addresses for the devices may be
drivers/gpio/gpio-104-dio-48e.c +111 -16

197 lines not on this page · raw message

Signature · 1 line
2.41.0
#2 lore raw

Re: [RESEND PATCH 1/2] gpio: 104-dio-48e: Add Counter/Timer support

Quoted 11 lines · William Breathitt Gray

The 104-DIO-48E features an 8254 Counter/Timer chip providing three counter/timers which can be used for frequency measurement, frequency output, pulse width modulation, pulse width measurement, event count, etc. The counter/timers use the same addresses as PPI 0 (addresses 0x0 to 0x3), so a raw_spinlock_t is used to synchronize operations between the two regmap mappings to prevent clobbering.

---

Applied, thanks!

Bart

#3 lore raw

PATCH RESEND 2/2 iio: addac: stx104: Add 8254 Counter/Timer support

In reply to William Breathitt Gray

The STX104 features an 8254 Counter/Timer chip providing three counter/timers which can be used for frequency measurement, frequency output, pulse width modulation, pulse width measurement, event count, etc. The STX104 provides a register bank selection to bank select between the 8254 Bank and the Indexed Register Array Bank; the Indexed Register Array is not utilized by this driver, so the 8254 Bank is selected unconditionally.

---
 drivers/iio/addac/Kconfig  |  1 +
 drivers/iio/addac/stx104.c | 61 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 60 insertions(+), 2 deletions(-)
drivers/iio/addac/Kconfig +1 -0
index 877f9124803c..b2623881f0ec 100644
@@ -38,6 +38,7 @@ config STX104
 	select REGMAP_MMIO
 	select GPIOLIB
 	select GPIO_REGMAP
+	select I8254
 	help
 	  Say yes here to build support for the Apex Embedded Systems STX104
 	  integrated analog PC/104 card.
drivers/iio/addac/stx104.c +59 -2

118 lines not on this page · raw message

Signature · 1 line
2.41.0
#4 lore raw

Re: [RESEND PATCH 2/2] iio: addac: stx104: Add 8254 Counter/Timer support

Quoted 9 lines · William Breathitt Gray

The STX104 features an 8254 Counter/Timer chip providing three counter/timers which can be used for frequency measurement, frequency output, pulse width modulation, pulse width measurement, event count, etc. The STX104 provides a register bank selection to bank select between the 8254 Bank and the Indexed Register Array Bank; the Indexed Register Array is not utilized by this driver, so the 8254 Bank is selected unconditionally.

Apologies Jonathan, I forgot to add you to the address list when I sent this patchset. If you would like me to resend it again to you, just let me know.

William Breathitt Gray