Banana pi BPI-R3 can not control pwm fan

I saw it in openwrt/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi. But the firmware I used is being built with this patch. image

But the error kept here.

By the way, the kernel of firmware is 5.15.125.

Try to change first clock to

&infracfg CLK_INFRA_PWM_HCK

Modify it in line 250?

More 249,replace the top_pwm_sel

Ok,now it works.I replace top_pwm_sta.

[ 0.047861] pwm-mediatek 10048000.pwm: clock: top fail: -517 This still keeps.

What works if you still get the error? Maybe pwm is probed too early (517 should be eprobedefer) and second attempt works

Maybe you can try 6.1? In my tests (more recent versions) the openwrt clocks did not work for me. Do not know the cause

Kernel 6.x is bad, it has a lot of terrible bugs in kernel code, plenty of APIs, such as net, has been modifid. It means there are so many broken drivers as they can not build successfully with this kind of kernel.

By the way, may u help me solve this ?

[    2.182146] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[    7.514294] block ubiblock0_1: created from ubi0:1(rootfs)
[   16.570333] block: overlay filesystem in /dev/mmcblk0p66 has not been formatted yet
[   16.587361] block: attempting to load /etc/config/fstab
[   16.596501] block: unable to load configuration (fstab: Entry not found)
[   16.603244] block: no usable configuration
[   57.645098] /dev/ubiblock0_1: Can't open blockdev

AS u see, any modification of configuration would be lost after reboot. How to fix?

Maybe just create a valid filesystem in /dev/mmcblk0p66 based on your rootfs (below the overlay).

Ok,maybe 6.1 is not yet supported by openwrt. In theory it should be possible to boot openwrt with external kernel (to use my kernel) but it will be more work to get some special things like overlayfs working. Some time ago i used openwrt rootfs as initrd.

6.1 is supported as test kernel. I’m running openwrt with 6.1 for 2 days now

Does pwm work for you?

I haven’t checked. I’ll do that tomorrow

Have tried it? With original openwrt clock it was not working for me on mainline kernel…

edit: booted again 6.5-rc on my r3 and looked for the top-clock-error…do not have it

root@bpi-r3:~# uname -a
Linux bpi-r3 6.5.0-rc1-bpi-r3 #3 SMP Sat Aug 19 16:00:16 CEST 2023 aarch64 GNU/Linux
root@bpi-r3:~# dmesg | grep pwm
root@bpi-r3:~# cd /sys/class/pwm/pwmchip0
root@bpi-r3:/sys/class/pwm/pwmchip0# echo 1 > export                                                                                               
root@bpi-r3:/sys/class/pwm/pwmchip0# ls -l
total 0
lrwxrwxrwx 1 root root    0 Feb 28 11:17 device -> ../../../10048000.pwm
--w------- 1 root root 4096 Feb 28 11:17 export
-r--r--r-- 1 root root 4096 Feb 28 11:17 npwm
drwxr-xr-x 2 root root    0 Feb 28 11:17 power
drwxr-xr-x 3 root root    0 Feb 28 11:17 pwm1
lrwxrwxrwx 1 root root    0 Feb 28 11:15 subsystem -> ../../../../../../class/pwm
-rw-r--r-- 1 root root 4096 Feb 28 11:15 uevent
--w------- 1 root root 4096 Feb 28 11:17 unexport
root@bpi-r3:/sys/class/pwm/pwmchip0# 

i can se the same problem in 23.05.0 RC3

root@OpenWrt:/# dmesg |grep “pwm”

[ 0.049827] pwm-mediatek 10048000.pwm: clock: top fail: -517

root@OpenWrt:/#

quote and code tags are broken in this forum or what ? all the text is in sequence

Kernel 6.1 or 5.15?

I guess something is different between openwrt and mainline as pwm was not working in mainline for me with openwrt top clock

Kernel 5.15.127

OpenWrt 23.05.0-rc3 r23389-5deed175a5 / LuCI openwrt-23.05 branch git-23.219.80063-bece581

5.15 is known not working

I guess because backported pwm/clock support is different to mainline

The pwm node i upstreamed works for me in mainline kernel without openwrt. So we need someone who can test pwm with openwrt with kernel 6.1 which (hopefully) does not have any openwrt-specific backports for r3

1 Like