RZFive: Enable CAN and PWM on MTIOC4D interface

Hi,

We are testing RZFive based custom board and wanted to test MTIOC4D PWM hence did the dts changes but PWM is not getting registered after booting.

&mtu3 {
        pinctrl-0 = <&mtu3_pins>;
        pinctrl-names = "default";
        pwm_complementary = <4 1>, <4 0>;
        #pwm-cells = <2>;
        status = "okay";
};

        mtu3_pins: mtu3 {
                pinmux = <RZG2L_PORT_PINMUX(24, 0, 3)>; /* MTIOC4D */
        };

Below crash prints are seen when booting with this changes.

[    1.381926] i2c-riic 10058400.i2c: registered with 100000Hz bus speed
[    1.400563] renesas_sdhi_internal_dmac 11c10000.mmc: Got CD GPIO
[    1.417626] renesas_mtu3 10001200.timer: ch4 and ch3: used for complementary pwm output at pins MTIOC4B and D
[    1.439474] renesas_mtu3 10001200.timer:  used for pwm controller of mtu3
[    1.450064] usb usb4-port1: over-current condition
[    1.454929] ------------[ cut here ]------------
[    1.459555] kobject: ((____ptrval____)): attempted to be registered with empty name!
[    1.467367] renesas_mtu3 10001200.timer: ch0: used as clock source
[    1.473620] WARNING: CPU: 0 PID: 7 at lib/kobject.c:236 kobject_add_internal+0x1c2/0x20a
[    1.481719] clocksource: 10001200.timer: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 18664368 ns
[    1.490830] renesas_sdhi_internal_dmac 11c00000.mmc: mmc0 base at 0x0000000011c00000, max clock rate 100 MHz
[    1.500651] Modules linked in:
[    1.503701] CPU: 0 PID: 7 Comm: kworker/u2:0 Not tainted 5.10.175-cip29-yocto-standard #13
[    1.511957] renesas_mtu3 10001200.timer: ch1: used for clock events
[    1.518578] renesas_mtu3 10001200.timer: Renesas MTU3 driver probed
[    1.524859] Hardware name: RZFIVE-custom (DT)
[    1.530360] Workqueue: events_unbound async_run_entry_fn
[    1.538816] epc: ffffffe0004ae62e ra : ffffffe0004ae62e sp : ffffffe00129fa40
[    1.546308]  gp : ffffffe0010dbfa8 tp : ffffffe001273780 t0 : ffffffe0014efaa0
[    1.553661]  t1 : 0000000000000064 t2 : ffffffe001cc9f60 s0 : ffffffe00129fa90
[    1.560915]  s1 : ffffffe00205a808 a0 : 0000000000000048 a1 : ffffffe001273780
[    1.568218]  a2 : 0000000057d4978f a3 : 0000000000000000 a4 : 2ac5b7a07f1c2d00
[    1.575516]  a5 : 2ac5b7a07f1c2d00 a6 : 00000000000f2434 a7 : ffffffe001010b48
[    1.582835]  s2 : 0000000000000000 s3 : ffffffe0010dd088 s4 : ffffffe002067840
[    1.590118]  s5 : ffffffe00136e810 s6 : ffffffe00136e980 s7 : ffffffe00121cc00
[    1.597386]  s8 : ffffffe000a8acf8 s9 : ffffffe000a8a758 s10: ffffffffffffffff
[    1.604651]  s11: ffffffe00121c540 t3 : 2ac5b7a07f1c2d00 t4 : ffffffe000e00460
[    1.611971]  t5 : ffffffe00020b1c2 t6 : ffffffe001b8f7c8
[    1.617374] status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[    1.625353] ---[ end trace 39cd15cda0aec86c ]---
[    1.630160] ------------[ cut here ]------------
[    1.634819] unbalanced disables for SDHI1 VccQ
[    1.639351] WARNING: CPU: 0 PID: 7 at drivers/regulator/core.c:2776 _regulator_disable+0x98/0x128
[    1.648257] Modules linked in:
[    1.651402] CPU: 0 PID: 7 Comm: kworker/u2:0 Tainted: G        W         5.10.175-cip29-yocto-standard #13
[    1.661047] Hardware name: RZFIVE-custom (DT)
[    1.666565] Workqueue: events_unbound async_run_entry_fn
[    1.671878] epc: ffffffe000504ca0 ra : ffffffe000504ca0 sp : ffffffe00129fa10
[    1.679009]  gp : ffffffe0010dbfa8 tp : ffffffe001273780 t0 : ffffffe002037bb8
[    1.686285]  t1 : 0000000000000010 t2 : ffffffe001cc9f60 s0 : ffffffe00129fa40
[    1.693514]  s1 : ffffffe0013c2c00 a0 : 0000000000000022 a1 : ffffffe001273780
[    1.700736]  a2 : 0000000061b57f67 a3 : 0000000000000000 a4 : 2ac5b7a07f1c2d00
[    1.708050]  a5 : 2ac5b7a07f1c2d00 a6 : 00000000000f2434 a7 : 0000000000000001
[    1.715337]  s2 : ffffffe0010dd088 s3 : ffffffe001fc66c0 s4 : ffffffe00205a800
[    1.722574]  s5 : ffffffe00205ad00 s6 : ffffffe00136e980 s7 : ffffffe00121cc00
[    1.729796]  s8 : ffffffe000a8acf8 s9 : ffffffe000a8a758 s10: ffffffffffffffff
[    1.737066]  s11: ffffffe00121c540 t3 : 2ac5b7a07f1c2d00 t4 : 0000000000000402
[    1.744316]  t5 : ffffffe001219258 t6 : ffffffe00129f758
[    1.749703] status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[    1.757621] ---[ end trace 39cd15cda0aec86d ]---
[    1.785953] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000c8
[    1.794809] Oops [#1]
[    1.797071] Modules linked in:
[    1.800118] CPU: 0 PID: 7 Comm: kworker/u2:0 Tainted: G        W         5.10.175-cip29-yocto-standard #13
[    1.809722] Hardware name: RZFIVE-custom (DT)
[    1.815198] Workqueue: events_unbound async_run_entry_fn
[    1.820487] epc: ffffffe000573408 ra : ffffffe000573406 sp : ffffffe00129fad0
[    1.827587]  gp : ffffffe0010dbfa8 tp : ffffffe001273780 t0 : ffffffe00129fa70
[    1.834772]  t1 : 0000000000000000 t2 : 0000000000000009 s0 : ffffffe00129fb40
[    1.841959]  s1 : ffffffe00205a808 a0 : ffffffe00205a888 a1 : 000000000000000d
[    1.849145]  a2 : 0038fb66ffe42b00 a3 : 0000000000000001 a4 : 0000000000000000
[    1.856331]  a5 : 0000000000000000 a6 : 0000000008a19b67 a7 : ffffffe00205ab58
[    1.863516]  s2 : ffffffe00205a888 s3 : ffffffe00136e810 s4 : ffffffe00136e810
[    1.870702]  s5 : ffffffe0010dd088 s6 : ffffffe00136e980 s7 : ffffffe00121cc00
[    1.877887]  s8 : ffffffe000a8acf8 s9 : ffffffe000a8a758 s10: ffffffffffffffff
[    1.885072]  s11: ffffffe00121c540 t3 : 0000000000000002 t4 : 0000000000000402
[    1.892256]  t5 : ffffffe00100f370 t6 : 0000000000000040
[    1.897540] status: 0000000200000120 badaddr: 00000000000000c8 cause: 000000000000000d
[    1.905547] ---[ end trace 39cd15cda0aec86e ]---
[    1.937667] ravb 11c20000.ethernet eth0: Base address at 0x11c20000, 00:01:02:03:04:05, IRQ 105.
[    1.950604] mmc0: new HS200 MMC card at address 0001
[    1.956301] mmcblk0: mmc0:0001 DG4008 7.28 GiB
[    1.961108] mmcblk0boot0: mmc0:0001 DG4008 partition 1 4.00 MiB
[    1.967235] mmcblk0boot1: mmc0:0001 DG4008 partition 2 4.00 MiB
[    1.973470] mmcblk0rpmb: mmc0:0001 DG4008 partition 3 4.00 MiB, chardev (245:0)
[    2.300970] vddio: Bringing 1500000uV into 1800000-1800000uV
[    2.310857] ravb 11c30000.ethernet eth1: Base address at 0x11c30000, 00:01:02:03:04:aa, IRQ 108.
[    2.320675] ALSA device list:
[    2.323641]   No soundcards found.

Kindly advise how to configure the Pin as PWM. We are using vlp3.0.4 for this testing

  • Hi vinay,

    Similar to SCIF3-SCIF4 question, I think your pin mux setting is wrong.
    Your custom board has to connect device to a pin that can support MTU3 function. And you pinmux has to set to that pin.

  • Hi Hung,

    The pin is connected to OM_CS1_N/MTIOC4D pad of CPU.

    Is this configuration ok to enable it or any extra changes required to test this pad as PWM?

  • Hi Hung,

    PWM is connected from the Pin Number B2 of the CPU and as you can see in the attached image, the pin is from the P24 bank (P24-0).

    Thanks & regards,
    Rohith M Ravi

  • Hi

    After below configuration we are able to use PWM on MTIOC4D pad of CPU.

    &mtu3 {
            pinctrl-0 = <&mtu3_pins>;
            pinctrl-names = "default";
            pwm_mode1 = <2 0>;
            pwm_complementary = <4 1>;
            #pwm-cells = <2>;
            status = "okay";
    };

    We wanted to use both MTIOC3A and MTIOC4D at the same time by below condition in PWM driver fails to register complimentary PWM MTIOC4D.

            } else if ((ch_num == 4 || ch_num == 7) &&
                (mtu->channels[ch_num].function == MTU3_NORMAL &&
                mtu->channels[ch_num - 1].function == MTU3_NORMAL)) {

    Is there any limitation to use both MTIOC3A and MTIOC4D at a time?

    We use below configuration to enable both MTIOC3A and MTIOC4D but MTIOC4D did not get registered

    &mtu3 {
            pinctrl-0 = <&mtu3_pins>;
            pinctrl-names = "default";
            pwm_mode1 = <3 0>;
            pwm_complementary = <4 1>;
            #pwm-cells = <2>;
            status = "okay";
    };