Skip to content

Bluetooth is not autodetected with device tree (bcm2837-rpi-3-b.dtb) on Raspberry Pi 3 #3675

@gentoo-root

Description

@gentoo-root

Is this the right place for my bug report?
I hope so, because it's kernel-related and Raspberry Pi-specific.

Describe the bug
The upstream device tree (bcm2837-rpi-3-b.dtb) attempts to configure Bluetooth:

/* uart0 communicates with the BT module */
&uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_gpio32 &gpclk2_gpio43>;
        status = "okay";

        bluetooth {
                compatible = "brcm,bcm43438-bt";
                max-speed = <2000000>;
                shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
        };
};

However, the code in drivers/of/platform.c skips the bluetooth subsection, because uart0 is defined in bcm283x.dtsi as follows:

                uart0: serial@7e201000 {
                        compatible = "arm,pl011", "arm,primecell";
                        reg = <0x7e201000 0x200>;
                        interrupts = <2 25>;
                        clocks = <&clocks BCM2835_CLOCK_UART>,
                                 <&clocks BCM2835_CLOCK_VPU>;
                        clock-names = "uartclk", "apb_pclk";
                        arm,primecell-periphid = <0x00241011>;
                };

It contains "arm,primecell" in compatible, which makes the enumeration code in drivers/of/platform.c to return early and skip enumerating children of uart0, i.e. the bluetooth node. As a result, hci_uart is not autoloaded by udev, and when loaded manually, it doesn't autodetect the Bluetooth hardware, so I need to run btattach or hciattach manually.

Tested on both this kernel (built from the 5.7.y branch) and the upstream kernel (5.7.2).

To reproduce

  1. Have bluez installed. Disable hciuart.service or any other scripts that run hciattach or btattach on boot.
  2. Set device_tree=dtbs/broadcom/bcm2837-rpi-3-b.dtb in /boot/config.txt.
  3. Boot the system.

Expected behaviour
Bluetooth adaptor is probed with device tree and is visible in the system (e.g., under /sys/class/bluetooth/hci0).

Actual behaviour
/sys/class/bluetooth is empty, bluetoothd doesn't autostart, no Bluetooth functionality in the system.

System
Sorry, I use a custom distribution, so I don't have many of the requested commands, but I believe the information below should be enough, the rest doesn't seem relevant.

Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:

  • Which model of Raspberry Pi? Pi3B.
  • Which OS and version (cat /etc/rpi-issue)? Custom Linux distribution.
  • Which firmware version (vcgencmd version)?
  • Which kernel version (uname -a)? Upstream kernel 5.7.2 and raspberry kernel from branch 5.7.y.

Logs
dmesg part with debug output enabled in drivers/of/platform.c:

[    0.105038] Serial: AMBA PL011 UART driver
[    0.105406] OF: of_platform_populate()
[    0.105428] OF:  starting at: 
[    0.105456] OF: of_platform_bus_create() - skipping /system, no compatible prop
[    0.105480] OF: of_platform_bus_create() - skipping /axi, no compatible prop
[    0.105505] OF: of_platform_bus_create() - skipping /aliases, no compatible prop
[    0.105805] OF: of_platform_bus_create() - skipping /reserved-memory, no compatible prop
[    0.105830] OF: of_platform_bus_create() - skipping /thermal-zones, no compatible prop
[    0.106069] OF:    create child: /soc/timer@7e003000
[    0.107054] OF:    create child: /soc/txp@7e004000
[    0.107617] OF:    create child: /soc/cprman@7e101000
[    0.108001] OF:    create child: /soc/mailbox@7e00b880
[    0.108578] OF:    create child: /soc/gpio@7e200000
[    0.109561] OF:    create child: /soc/serial@7e201000
[    0.109593] OF: Creating amba device /soc/serial@7e201000
[    0.110384] OF:    create child: /soc/mmc@7e202000
[    0.110945] OF:    create child: /soc/i2s@7e203000
[    0.110984] OF:    create child: /soc/spi@7e204000
[    0.111022] OF:    create child: /soc/i2c@7e205000
[    0.111578] OF:    create child: /soc/dpi@7e208000
[    0.111617] OF:    create child: /soc/dsi@7e209000
[    0.111655] OF:    create child: /soc/aux@7e215000
[    0.112049] OF:    create child: /soc/serial@7e215040
[    0.112617] OF:    create child: /soc/spi@7e215080
[    0.112656] OF:    create child: /soc/spi@7e2150c0
[    0.112694] OF:    create child: /soc/pwm@7e20c000
[    0.113089] OF:    create child: /soc/sdhci@7e300000
[    0.113647] OF:    create child: /soc/hvs@7e400000
[    0.114182] OF:    create child: /soc/dsi@7e700000
[    0.114222] OF:    create child: /soc/i2c@7e804000
[    0.114805] OF:    create child: /soc/vec@7e806000
[    0.115330] OF:    create child: /soc/usb@7e980000
[    0.115899] OF:    create child: /soc/dma@7e007000
[    0.118636] OF:    create child: /soc/interrupt-controller@7e00b200
[    0.118674] OF:    create child: /soc/watchdog@7e100000
[    0.119157] OF:    create child: /soc/rng@7e104000
[    0.119720] OF:    create child: /soc/pixelvalve@7e206000
[    0.120246] OF:    create child: /soc/pixelvalve@7e207000
[    0.120820] OF:    create child: /soc/thermal@7e212000
[    0.121205] OF:    create child: /soc/i2c@7e805000
[    0.121759] OF:    create child: /soc/pixelvalve@7e807000
[    0.122295] OF:    create child: /soc/hdmi@7e902000
[    0.123099] OF:    create child: /soc/v3d@7ec00000
[    0.123661] OF:    create child: /soc/gpu
[    0.123925] OF:    create child: /soc/local_intc@40000000
[    0.123965] OF:    create child: /soc/firmware
[    0.124249] OF:    create child: /soc/firmware/gpio
[    0.124546] OF:    create child: /soc/power
[    0.124865] OF:    create child: /soc/mailbox@7e00b840
[    0.125413] OF: of_platform_bus_create() - skipping /clocks, no compatible prop
[    0.126712] OF: of_platform_bus_create() - skipping /cpus, no compatible prop
[    0.126963] OF: of_platform_bus_create() - skipping /memory@0, no compatible prop

As we see, it doesn't traverse the children of /soc/serial@7e201000, instead it creates an AMBA device.

Additional context
It sounds weird that there is a guy who claims that device tree autoprobing of Bluetooth worked for him: https://gist.github.com/shenghaoyang/92e6dd65b9f0cc736a419f3e640663c2. He basically adds a part of the upstream device tree as an overlay for the raspberry device tree (bcm2710-rpi-3-b.dtb). This approach hasn't worked for me either, for the same reason explained above.

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