NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-evbarm/54941: Raspberry Pi Zero W serial console corrupted when CPU frequency changed



>Number:         54941
>Category:       port-evbarm
>Synopsis:       Raspberry Pi Zero W serial console corrupted when CPU frequency changed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 06 07:50:00 +0000 2020
>Originator:     Rin Okuyama
>Release:        9.99.45 (netbsd-9 is also affected)
>Organization:
Department of Physics, Meiji University
>Environment:
NetBSD rpi0w 9.99.45 NetBSD 9.99.45 (RPI) #4: Wed Feb  5 09:59:26 JST 2020  rin@latipes:/build/src/sys/arch/evbarm/compile/RPI evbarm
>Description:
Serial console (mini UART; com0) on Raspberry Pi Zero W (RPI0W) gets
corrupted when CPU frequency (machdep.cpu.frequency.target) is changed
from 700 to 1000 by sysctl(8).

This is because the baud rate of mini UART is linked to CPU frequency:

  https://www.raspberrypi.org/documentation/configuration/uart.md
>How-To-Repeat:
sudo sysctl -w machdep.cpu.frequency.target=1000
>Fix:
A lazy workaround is to copy /boot/bcm2835-rpi-zero.dtb into
/boot/bcm2835-rpi-zero-w.dtb, which forces firmware to configure the
system as a RPI0. Then, PL011 (plcom0) is used as console, which is
free from the core frequency. However, this workaround kills all the
enhancements made to RPI0W from RPI0.

The real fix should be to adjust the baud rate when CPU frequency is
changed in vcmbox_cpufreq_sysctl_helper():

  https://nxr.netbsd.org/xref/src/sys/arch/evbarm/rpi/rpi_vcmbox.c#vcmbox_cpufreq_sysctl_helper

But I'm currently not sure whether this is possible, especially when
console is opened from userland.



Home | Main Index | Thread Index | Old Index