Skip to content

uart5 (randomly?) becomes ttyAMA1 on kernel 6.1.y #5594

Closed

Description

Describe the bug

After switching our linux kernel to the 6.1 branch (currently on 6.1.46) we noticed that the ttyAMA numbering changed and now corresponds to the hardware uart number. I.e. uart3 -> ttyAMA3, uart5 -> ttyAMA5. (see https://forums.raspberrypi.com/viewtopic.php?t=347868 and #5436)

So far so good, but recently we noticed that uart5 gets enumerated as ttyAMA1 now, without any further software change.

Here's the dmesg excerpt:

dmesg | grep ttyAMA
[...]
[    0.181829] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 33, base_baud = 0) is a PL011 rev2
[    0.421900] printk: console [ttyAMA0] enabled
[    0.593863] fe201400.serial: ttyAMA2 at MMIO 0xfe201400 (irq = 33, base_baud = 0) is a PL011 rev2
[    0.602932] fe201600.serial: ttyAMA3 at MMIO 0xfe201600 (irq = 33, base_baud = 0) is a PL011 rev2
[    0.817135] fe201a00.serial: ttyAMA1 at MMIO 0xfe201a00 (irq = 33, base_baud = 0) is a PL011 rev2

0xfe201a00 is defnitely uart5 in the device tree:

$ dtc -I fs /sys/firmware/devicetree/base | grep serial@
		serial@7e201a00 {
		serial@7e201800 {
		serial@7e201400 {
		serial@7e215040 {
		serial@7e201000 {
		serial@7e201600 {
		serial5 = "/soc/serial@7e215040";
		uart4 = "/soc/serial@7e201800";
		serial3 = "/soc/serial@7e201600";
		uart2 = "/soc/serial@7e201400";
		serial1 = "/soc/serial@7e215040";
		uart0 = "/soc/serial@7e201000";
		bluetooth = "/soc/serial@7e201000/bluetooth";
		uart5 = "/soc/serial@7e201a00";
		serial4 = "/soc/serial@7e201800";
		uart3 = "/soc/serial@7e201600";
		serial2 = "/soc/serial@7e201400";
		uart1 = "/soc/serial@7e215040";
		serial0 = "/soc/serial@7e201000";
		bt = "/soc/serial@7e201000/bluetooth";
		uart4 = "/soc/serial@7e201800";
		minibt = "/soc/serial@7e215040/bluetooth";
		uart2 = "/soc/serial@7e201400";
		uart0 = "/soc/serial@7e201000";
		uart5 = "/soc/serial@7e201a00";
		uart3 = "/soc/serial@7e201600";
		uart1 = "/soc/serial@7e215040";

Any idea what could be going wrong here?

Steps to reproduce the behaviour

Unclear so far.

Device (s)

Raspberry Pi CM4

System

Custom OS built with buildroot.
firmware: raspberrypi/firmware@74ad049
kernel: 9ed4f05

Logs

No response

Additional context

No response

Activity

  1. pelwell commented on Sep 6, 2023

    @pelwell
    Contributor

    I've not figured out the how yet, but the what is fairly clear:

    		serial5 = "/soc/serial@7e215040";
    		serial1 = "/soc/serial@7e215040";
    		uart5 = "/soc/serial@7e201a00";
    		uart1 = "/soc/serial@7e215040";
    

    Notice that the serial5 alias is pointing to the same as uart1, not uart5 as it should.

    And that's not the case in the base dts file:

    		uart1 = &uart1;
    		uart5 = &uart5;
    		serial5 = &uart5;
    
  2. pelwell commented on Sep 6, 2023

    @pelwell
    Contributor

    It would have to be an overlay then...

  3. pelwell commented on Sep 7, 2023

    @pelwell
    Contributor

    ...unless it's a stupid firmware bug. Which it is.

    Grab the trial firmware from this link: https://drive.google.com/file/d/1xDBZfgwveKbmunzUzcLeVCmGIyqUjj_O/view?usp=sharing
    It just contains start4cd.elf and fixup4cd.dat. Copy them into /boot and reboot - the serial5 alias should be correct.

  4. pelwell commented on Sep 7, 2023

    @pelwell
    Contributor

    Cool - the fix has been merged, and will be in future firmware releases. For now you can continue to use that trial version.

  5. pelwell commented on Sep 7, 2023

    @pelwell
    Contributor

    All releases appear here (https://github.com/raspberrypi/rpi-firmware/commits/master), with stable releases here (https://github.com/raspberrypi/rpi-firmware/commits/stable) - significant changes are listed in the commit messages (click on the ...s).

  6. pelwell commented on Oct 5, 2023

    @pelwell
    Contributor

    If it contains the hat_map feature (which it does) then yes, it will have the fix mentioned about.

  7. ghost closed this as completedon Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions