Add support for eCAP PWM and LCD pin mux
cover Add support for eCAP PWM and LCD pin mux
This patch series adds the support for
1. In am33xx SoC[1], enhanced capture (eCAP) supports auxiliary PWM (APWM). This series adds the PWM driver support for the APWM feature for eCAP on AM33xx. AM335X_ECAP0_IN_PWM0_OUT is used to enable the backlight.
2. Fix build warning in ti-ehrpwm driver in dev_deb().
3. Enable eCAP0 PWM and LCD pin muxing to support splash screen on AM335x EVM[2].
[1] AM335x TRM - https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
[2] AM335x EVM - https://www.ti.com/tool/TMDXEVM3358
per discussion on the earlier patch series,
https://lore.kernel.org/all/[email protected]/
dropping the device tree changes in this series due to OF_UPSTREAM conflict.
As we are dropping the DT patch, started with the new series instead of V2.
This series doesn't contain defconfig changes since we don't want to enable LCD, splash screen and PWM support by default. Enabling splash screen and PWM support in defconfig causes u-boot crash on AM335x based beaglebone black. This will be handled in a separate patch.
Sukrut Bellary (3):
pwm: ti: am33xx: Enable Auxiliary PWM using eCAP
pwm: ti: am33xx: Fix build warnings in dev_dbg()
board: ti: am335x: Enable eCAP0 PWM and LCD pin muxing
board/ti/am335x/mux.c | 47 +++++++++ drivers/pwm/Kconfig | 6 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-ti-ehrpwm.c | 2 +- drivers/pwm/pwm-tiecap.c | 198 ++++++++++++++++++++++++++++++++++++ 5 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 drivers/pwm/pwm-tiecap.c
Signature · 1 line
2.34.1
PATCH 1/3 pwm: ti: am33xx: Enable Auxiliary PWM using eCAP
In am33xx SoC[1], enhanced capture (eCAP) supports auxiliary PWM (APWM). This series adds the PWM driver support for the APWM feature for eCAP on AM33xx.
eCAP HW also supports the capture mode. Currently, this driver only supports APWM.
This is based on the Linux kernel driver -> drivers/pwm/pwm-tiecap.c
Version: v6.12
Tested on AM335x EVM[2].
[1] AM335x TRM - https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
[2] AM335x EVM - https://www.ti.com/tool/TMDXEVM3358
--- drivers/pwm/Kconfig | 6 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-tiecap.c | 198 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 drivers/pwm/pwm-tiecap.c
drivers/pwm/Kconfig +6 -0
@@ -126,3 +126,9 @@ config PWM_TI_EHRPWM default y help PWM driver support for the EHRPWM controller found on TI SOCs. + +config PWM_TI_ECAP + bool "Enable support for ECAP PWM" + depends on DM_PWM && ARCH_OMAP2PLUS + help + PWM driver support for the ECAP controller found on TI SOCs.
drivers/pwm/Makefile +1 -0
@@ -25,3 +25,4 @@ obj-$(CONFIG_PWM_TEGRA) += tegra_pwm.o obj-$(CONFIG_PWM_STM32) += pwm-stm32.o obj-$(CONFIG_PWM_SUNXI) += sunxi_pwm.o obj-$(CONFIG_PWM_TI_EHRPWM) += pwm-ti-ehrpwm.o +obj-$(CONFIG_PWM_TI_ECAP) += pwm-tiecap.o
drivers/pwm/pwm-tiecap.c new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/3 pwm: ti: am33xx: Fix build warnings in dev_dbg()
In reply to Sukrut BellaryIf CONFIG_PWM_TI_EHRPWM is enabled, it throws the build warning in dev_dbg() due to incorrect format specifier as,
"warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘fdt_addr_t’ {aka ‘unsigned int’}"
Fix this with the correct format specifier.
--- drivers/pwm/pwm-ti-ehrpwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-ti-ehrpwm.c +1 -1
@@ -399,7 +399,7 @@ static int ti_ehrpwm_of_to_plat(struct udevice *dev)return -EINVAL ; } -dev_dbg (dev,"regs=0x%08lx\n" , priv->regs); +dev_dbg (dev,"regs=0x%08x\n" , priv->regs);return 0 ; }
Signature · 1 line
2.34.1
PATCH 3/3 board: ti: am335x: Enable eCAP0 PWM and LCD pin muxing
In reply to Sukrut BellaryOn AM335x EVM[1],
1. pin AM335X_ECAP0_IN_PWM0_OUT is used to enable the backlight. ECAP0 can be configured in single channel PWM mode. If CONFIG_PWM_TI_ECAP is enabled, perform eCAP0 pin muxing.
2. Pins LCD_DATA0 - LCD_DATA15, gpmc_ad8 - gpmc_ad15 and lcd_vsync, lcd_sync, lcd_ac_bias_en, lcd_pclk are used for driving LCD. If CONFIG_AM335X_LCD is enabled, perform the LCD pin muxing.
This is required to enable splash screen support on AM335x EVM.
[1] AM335x EVM - https://www.ti.com/tool/TMDXEVM3358
--- board/ti/am335x/mux.c | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
board/ti/am335x/mux.c +47 -0
@@ -274,6 +274,47 @@ static struct module_pin_mux uart3_icev2_pin_mux[] = { {-1}, }; +#if (IS_ENABLED(CONFIG_AM335X_LCD)) +static struct module_pin_mux lcd_pin_mux[] = { + {OFFSET(lcd_data0), (MODE(0))}, /* LCD-Data(0) */ + {OFFSET(lcd_data1), (MODE(0))}, /* LCD-Data(1) */ + {OFFSET(lcd_data2), (MODE(0))}, /* LCD-Data(2) */ + {OFFSET(lcd_data3), (MODE(0))}, /* LCD-Data(3) */ + {OFFSET(lcd_data4), (MODE(0))}, /* LCD-Data(4) */ + {OFFSET(lcd_data5), (MODE(0))}, /* LCD-Data(5) */ + {OFFSET(lcd_data6), (MODE(0))}, /* LCD-Data(6) */ + {OFFSET(lcd_data7), (MODE(0))}, /* LCD-Data(7) */ + {OFFSET(lcd_data8), (MODE(0))}, /* LCD-Data(8) */ + {OFFSET(lcd_data9), (MODE(0))}, /* LCD-Data(9) */ + {OFFSET(lcd_data10), (MODE(0))}, /* LCD-Data(10) */ + {OFFSET(lcd_data11), (MODE(0))}, /* LCD-Data(11) */ + {OFFSET(lcd_data12), (MODE(0))}, /* LCD-Data(12) */ + {OFFSET(lcd_data13), (MODE(0))}, /* LCD-Data(13) */ + {OFFSET(lcd_data14), (MODE(0))}, /* LCD-Data(14) */ + {OFFSET(lcd_data15), (MODE(0))}, /* LCD-Data(15) */ + {OFFSET(gpmc_ad15), (MODE(1))}, /* LCD-Data(16) */ + {OFFSET(gpmc_ad14), (MODE(1))}, /* LCD-Data(17) */ + {OFFSET(gpmc_ad13), (MODE(1))}, /* LCD-Data(18) */ + {OFFSET(gpmc_ad12), (MODE(1))}, /* LCD-Data(19) */ + {OFFSET(gpmc_ad11), (MODE(1))}, /* LCD-Data(20) */ + {OFFSET(gpmc_ad10), (MODE(1))}, /* LCD-Data(21) */ + {OFFSET(gpmc_ad9), (MODE(1))}, /* LCD-Data(22) */ + {OFFSET(gpmc_ad8), (MODE(1))}, /* LCD-Data(23) */ + {OFFSET(lcd_vsync), (MODE(0))}, /* LCD-VSync */ + {OFFSET(lcd_hsync), (MODE(0))}, /* LCD-HSync */ + {OFFSET(lcd_ac_bias_en), (MODE(0))}, /* LCD-DE */ + {OFFSET(lcd_pclk), (MODE(0))}, /* LCD-CLK */ + {-1}, +}; +#endif + +#if (IS_ENABLED(CONFIG_PWM_TI_ECAP)) +static struct module_pin_mux ecap_pin_mux[] = { + {OFFSET(ecap0_in_pwm0_out), (MODE(0))}, /* ecap0_in_pwm0_out */ + {-1}, +}; +#endif + #if defined(CONFIG_NOR_BOOT) void enable_norboot_pin_mux(void) {
@@ -389,6 +430,12 @@ void enable_board_pin_mux(void)configure_module_pin_mux (mmc1_pin_mux);configure_module_pin_mux (spi0_pin_mux); } + +if (IS_ENABLED (CONFIG_AM335X_LCD )) +configure_module_pin_mux (lcd_pin_mux); + +if (IS_ENABLED (CONFIG_PWM_TI_ECAP )) +configure_module_pin_mux (ecap_pin_mux); }else if (board_is_idk ()) {/* Industrial Motor Control (IDK) */ configure_module_pin_mux (mii1_pin_mux);
Signature · 1 line
2.34.1
Quoted 32 lines · Sukrut Bellary
This patch series adds the support for
1. In am33xx SoC[1], enhanced capture (eCAP) supports auxiliary PWM (APWM). This series adds the PWM driver support for the APWM feature for eCAP on AM33xx.
AM335X_ECAP0_IN_PWM0_OUTis used to enable the backlight.2. Fix build warning in ti-ehrpwm driver in
dev_deb().3. Enable eCAP0 PWM and LCD pin muxing to support splash screen on AM335x EVM[2].
[1] AM335x TRM - https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
[2] AM335x EVM - https://www.ti.com/tool/TMDXEVM3358per discussion on the earlier patch series,
https://lore.kernel.org/all/[email protected]/
dropping the device tree changes in this series due toOF_UPSTREAMconflict.
As we are dropping the DT patch, started with the new series instead of V2.This series doesn't contain defconfig changes since we don't want to enable LCD, splash screen and PWM support by default. Enabling splash screen and PWM support in defconfig causes u-boot crash on AM335x based beaglebone black. This will be handled in a separate patch.
Sukrut Bellary (3):
pwm: ti: am33xx: Enable Auxiliary PWM using eCAP
pwm: ti: am33xx: Fix build warnings indev_dbg()
board: ti: am335x: Enable eCAP0 PWM and LCD pin muxing
Quoted 7 lines
board/ti/am335x/mux.c | 47 +++++++++ drivers/pwm/Kconfig | 6 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-ti-ehrpwm.c | 2 +- drivers/pwm/pwm-tiecap.c | 198 ++++++++++++++++++++++++++++++++++++ 5 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 drivers/pwm/pwm-tiecap.c
This currently introduces a failure to build on am335x_evm and other variants of the TI EVM:
arm: + am335x_evm +(am335x_evm) board/ti/am335x/mux.c: In function 'enable_board_pin_mux': +(am335x_evm) board/ti/am335x/mux.c:435:50: error: 'lcd_pin_mux' undeclared (first use in this function); did you mean 'nand_pin_mux'? +(am335x_evm) 435 | configure_module_pin_mux(lcd_pin_mux); +(am335x_evm) | ^~~~~~~~~~~ +(am335x_evm) | nand_pin_mux
+(am335x_evm) board/ti/am335x/mux.c:435:50: note: each undeclared identifier is reported only once for each function it appears in +(am335x_evm) board/ti/am335x/mux.c:438:50: error: 'ecap_pin_mux' undeclared (first use in this function); did you mean 'nand_pin_mux'?
+(am335x_evm) 438 | configure_module_pin_mux(ecap_pin_mux);
+(am335x_evm) | ^~~~~~~~~~~~
+(am335x_evm) make[3]: *** [scripts/Makefile.build:256: spl/board/ti/am335x/mux.o] Error 1
+(am335x_evm) make[2]: *** [scripts/Makefile.xpl:548: spl/board/ti/am335x] Error 2
+(am335x_evm) make[1]: *** [Makefile:2119: spl/u-boot-spl] Error 2
+(am335x_evm) make: *** [Makefile:177: sub-make] Error 2
Signature · 1 line
Tom
Quoted 49 lines · Tom Rini
Quoted 32 lines · Sukrut Bellary
This patch series adds the support for
1. In am33xx SoC[1], enhanced capture (eCAP) supports auxiliary PWM (APWM). This series adds the PWM driver support for the APWM feature for eCAP on AM33xx.
AM335X_ECAP0_IN_PWM0_OUTis used to enable the backlight.2. Fix build warning in ti-ehrpwm driver in
dev_deb().3. Enable eCAP0 PWM and LCD pin muxing to support splash screen on AM335x EVM[2].
[1] AM335x TRM - https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
[2] AM335x EVM - https://www.ti.com/tool/TMDXEVM3358per discussion on the earlier patch series,
https://lore.kernel.org/all/[email protected]/
dropping the device tree changes in this series due toOF_UPSTREAMconflict.
As we are dropping the DT patch, started with the new series instead of V2.This series doesn't contain defconfig changes since we don't want to enable LCD, splash screen and PWM support by default. Enabling splash screen and PWM support in defconfig causes u-boot crash on AM335x based beaglebone black. This will be handled in a separate patch.
Sukrut Bellary (3):
pwm: ti: am33xx: Enable Auxiliary PWM using eCAP
pwm: ti: am33xx: Fix build warnings indev_dbg()
board: ti: am335x: Enable eCAP0 PWM and LCD pin muxingQuoted 7 lines
board/ti/am335x/mux.c | 47 +++++++++ drivers/pwm/Kconfig | 6 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-ti-ehrpwm.c | 2 +- drivers/pwm/pwm-tiecap.c | 198 ++++++++++++++++++++++++++++++++++++ 5 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 drivers/pwm/pwm-tiecap.cThis currently introduces a failure to build on
am335x_evmand other variants of the TI EVM:arm: + am335x_evm(quoted diff) +3
-0+(am335x_evm) board/ti/am335x/mux.c: In function 'enable_board_pin_mux': +(am335x_evm) board/ti/am335x/mux.c:435:50: error: 'lcd_pin_mux' undeclared (first use in this function); did you mean 'nand_pin_mux'? +(am335x_evm) 435 | configure_module_pin_mux(lcd_pin_mux);
Review
Quoted 10 lines
(quoted diff) +10
-0+(am335x_evm) | ^~~~~~~~~~~ +(am335x_evm) | nand_pin_mux +(am335x_evm) board/ti/am335x/mux.c:435:50: note: each undeclared identifier is reported only once for each function it appears in +(am335x_evm) board/ti/am335x/mux.c:438:50: error: 'ecap_pin_mux' undeclared (first use in this function); did you mean 'nand_pin_mux'? +(am335x_evm) 438 | configure_module_pin_mux(ecap_pin_mux); +(am335x_evm) | ^~~~~~~~~~~~ +(am335x_evm) make[3]: *** [scripts/Makefile.build:256: spl/board/ti/am335x/mux.o] Error 1 +(am335x_evm) make[2]: *** [scripts/Makefile.xpl:548: spl/board/ti/am335x] Error 2 +(am335x_evm) make[1]: *** [Makefile:2119: spl/u-boot-spl] Error 2 +(am335x_evm) make: *** [Makefile:177: sub-make] Error 2
Sorry about this.
While fixing the checkpatch warning, I overlooked the CONFIG_AM335X_LCD not set case.
I will send v2 to fix this.
Quoted 2 lines
Signature · 1 line
Tom