This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DRA829J: U-boot PWM clock for EHRPWM0_A not found

Part Number: DRA829J
Other Parts Discussed in Thread: DRA829

Hi
I work on a custom board using DRA829 and we need get a PWM out on ball nr V29.

This works on Linux but we also need it to work in U-boot as well. When I try to use the PWM on u-boot It seems like the clock driver is missing and I get the following error:

=> pwm config 0 0 100 50
drivers/clk/clk-uclass.c:91-clk_get_by_index_tail() get: returning err=-19
drivers/pwm/pwm-ti-ehrpwm.c:440- ti_ehrpwm_probe() ti_ehrpwm pwm@3000000: failed to get tbclk ck
pwm: '0' not found
Command 'pwm' failed: Error -19
=>

I added the following to my dts that I found in u-boot mainline and in Linux:
----------------------------
+++ b/arch/arm/dts/k3-j721e-main.dtsi
@@ -72,6 +72,22 @@
reg = <0x4044 0x20>;
#phy-cells = <1>;
};
+
+ ehrpwm_tbclk: clock-controller@4140 {
+ compatible = "ti,am654-ehrpwm-tbclk", "syscon";
+ reg = <0x4140 0x18>;
+ #clock-cells = <1>;
+ };
+ };
+
+ main_ehrpwm0: pwm@3000000 {
+ compatible = "ti,am654-ehrpwm", "ti,am3352-ehrpwm";
+ #pwm-cells = <3>;
+ reg = <0x00 0x3000000 0x00 0x100>;
+ power-domains = <&k3_pds 83 TI_SCI_PD_EXCLUSIVE>;
+ clocks = <&ehrpwm_tbclk 0>, <&k3_clks 83 0>;
+ clock-names = "tbclk", "fck";
+ status = "disabled";
};
...also som pinmuxing:

+ clk_pwm_pin_default: clk-pwm-pin-default {
+ pinctrl-single,pins = <
+ J721E_IOPAD(0x164, PIN_OUTPUT, 6) /* (V29) ehrpwm0_a */
>;
...and som configs:
+CONFIG_PWM_TI_EHRPWM=y
+CONFIG_DM_PWM=y
+CONFIG_CMD_PWM=y
CONFIG_CMD_SF_TEST=y
CONFIG_CMD_DM=y
CONFIG_DEVRES=y
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 6e79868d0e..63b0112803 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -114,7 +114,8 @@ config PWM_SUNXI

config PWM_TI_EHRPWM
bool "Enable support for EHRPWM PWM"
- depends on DM_PWM && ARCH_OMAP2PLUS
+ depends on DM_PWM
+ depends on ARCH_OMAP2PLUS || ARCH_K3
default y
help
PWM driver support for the EHRPWM controller found on TI SOCs.
----------------------------------------

Unfortunately I don't find any driver compatible with "ti,am654-ehrpwm-tbclk" in u-boot and I think that is the problem here.
Can you please advise on how to proceed? Is there any plans on porting the driver am654-ehrpwm-tbclk from Linux to U-boot?
Are there other ways to get this pwm working?

Thanks in advance.

  • Hi,

    Unfortunately I don't find any driver compatible with "ti,am654-ehrpwm-tbclk" in u-boot and I think that is the problem here.

    You are right. U-Boot does not support PWM in the SDK. Typical use cases are using PWM from kernel as U-Boot is just a transient phase and hence no plan to add support in U-Boot.

    Best Regards,
    Keerthy