Skip to content

Commit

Permalink
arch/arm64/src/imx9: Flex-IO based PWM driver for imx9
Browse files Browse the repository at this point in the history
This is a high resolution PWM driver, utilizing one 16-bit Flex-IO timer for
generating PWM period and the rest of the timers to generate PWM duty cycles.

This means that the period has to be the same for every PWM generated from one
FLEXIO block, but this way we can get 16-bit resolution for the PWM signals.

For a typical IMX9 HW there are 8 timers for each Flex-IO block, which means
that by using this driver one can get 7 PWM outputs from one block.

This driver can be later extended to have configuration options to use all
8 channels per flex-io by either using 8+8 -bit timer (less resolution) or by
using an external trigger from an LPIT.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Apr 4, 2024
1 parent dc82342 commit fc9595a
Show file tree
Hide file tree
Showing 5 changed files with 1,728 additions and 0 deletions.
41 changes: 41 additions & 0 deletions arch/arm64/src/imx9/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,57 @@ config ARCH_CHIP_IMX93
select ARCH_HAVE_MULTICPU
select ARMV8A_HAVE_GICv3
select ARCH_CORTEX_A55
select ARCH_HAVE_PWM_MULTICHAN

endchoice # i.MX9 Chip Selection

endmenu # "i.MX9 Chip Selection"

config IMX9_FLEXIO_PWM
bool
select PWM_MULTICHAN
default n

menu "i.MX9 Peripheral Selection"
config IMX9_UART1
bool "UART1"
default n
select UART1_SERIALDRIVER

config IMX9_FLEXIO1_PWM
depends on PWM
bool "Enable FLEXIO1 based PWM generation"
select IMX9_FLEXIO_PWM
default n

config IMX9_FLEXIO2_PWM
depends on PWM
bool "Enable FLEXIO2 based PWM generation"
select IMX9_FLEXIO_PWM
default n

config IMX9_FLEXIO1_PWM_NCHANNELS
depends on IMX9_FLEXIO1_PWM
int "Number of channels for FLEXIO1"
default 4
range 1 7

config IMX9_FLEXIO1_PWM_CHANNEL_PINS
depends on IMX9_FLEXIO1_PWM
hex "FlexIO outputs used for FLEXIO1 timers"
default 0x0000000007060504

config IMX9_FLEXIO2_PWM_NCHANNELS
depends on IMX9_FLEXIO2_PWM
int "Number of channels for FLEXIO2"
default 1
range 1 7

config IMX9_FLEXIO2_PWM_CHANNEL_PINS
depends on IMX9_FLEXIO2_PWM
hex "FlexIO outputs used for FLEXIO2 timers"
default 0x0000000000000000

endmenu # iMX Peripheral Selection

config IMX9_GPIO_IRQ
Expand Down
4 changes: 4 additions & 0 deletions arch/arm64/src/imx9/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ endif
ifeq ($(CONFIG_IMX9_GPIO_IRQ),y)
CHIP_CSRCS += imx9_gpioirq.c
endif

ifeq ($(CONFIG_IMX9_FLEXIO_PWM),y)
CHIP_CSRCS += imx9_flexio_pwm.c
endif
Loading

0 comments on commit fc9595a

Please sign in to comment.