Port-arm archive

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

NetBSD on rpi0-2w



On Mon, 1 Apr 2024, Jun Ebihara wrote:
RPI0-2w: copy dtb from -current
  cp dtb/bcm2837-rpi-3-b-plus.dtb dtb/bcm2710-rpi-zero-2-w.dtb

I wrote a dts for the rpi0-2w, comparing the dts used in the latest
linux to see the different GPIOS used by this board and the rpi3.
I understand that updating all the dts to a new version is a major
effort, so you can see this as "backporting". You can put it in
/usr/src/sys/arch/arm/dts and compiled it with:

cpp -P -x assembler-with-cpp -I ../../../external/gpl2/dts/dist/include/ -include bcm2837-rpi-zero-2-w.dts /dev/null | dtc -I dts -O dtb -o bcm2710-rpi-zero-2-w.dtb

Some notes about this board:

*- It's a good idea to enable uart at early boot:
$ sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" bootcode.bin

*- As I've said before, you don't need to remove console=fb to get
the serial console, you'll just control the same console with both.

*- I can't make hdmi audio to work:
[ 533.1690757] audio0(vcaudio0): setting play.port=0 failed: errno=22
Which would be handy in my use case, using an hdmi->av adapter.

*- Bluetooth is not detected, I supposed it should be this:
[     1.799021] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not config
ured

Has someone got bluetooth working on any rpi board?

*- Using the latest firmware at
https://github.com/RPi-Distro/firmware-nonfree/tree/bookworm/debian/config/brcm80211

I can bring the wifi up, but it stops working shortly.

I don't understand how all these wifi drivers get into the netbsd
code. How many of them _really_ work?

PS. I'm not using Jun's image, just the current generic arm64.img
and sysinst custom installations.

Regards,
adr.

/usr/src/sys/arch/arm/dts/bcm2837-rpi-zero-2-w.dts
=======================================================
/dts-v1/;
#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/bcm2837.dtsi"
#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/bcm2836-rpi.dtsi"
#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi"
#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/bcm283x-rpi-usb-host.dtsi"

/ {
	compatible = "raspberrypi,model-zero-2-w", "brcm,bcm2837";
	model = "Raspberry Pi Zero 2 W";

	chosen {
		/* 8250 auxiliary UART instead of pl011 */
		stdout-path = "serial1:115200n8";
	};

	memory@0 {
		device_type = "memory";
		reg = <0 0x20000000>;
	};

	leds {
		led-act {
			gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
		};
	};

	wifi_pwrseq: wifi-pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
	};
};

&gpio {
	/*
	 * Taken from rpi_SCH_3b_1p2_reduced.pdf and
	 * the official GPU firmware DT blob.
	 *
	 * Legend:
	 * "NC" = not connected (no rail from the SoC)
	 * "FOO" = GPIO line named "FOO" on the schematic
	 * "FOO_N" = GPIO line named "FOO" on schematic, active low
	 */
	gpio-line-names = "ID_SDA",
			  "ID_SCL",
			  "SDA1",
			  "SCL1",
			  "GPIO_GCLK",
			  "GPIO5",
			  "GPIO6",
			  "SPI_CE1_N",
			  "SPI_CE0_N",
			  "SPI_MISO",
			  "SPI_MOSI",
			  "SPI_SCLK",
			  "GPIO12",
			  "GPIO13",
			  /* Serial port */
			  "TXD0",
			  "RXD0",
			  "GPIO16",
			  "GPIO17",
			  "GPIO18",
			  "GPIO19",
			  "GPIO20",
			  "GPIO21",
			  "GPIO22",
			  "GPIO23",
			  "GPIO24",
			  "GPIO25",
			  "GPIO26",
			  "GPIO27",
			  "HDMI_HPD_N",
			  "STATUS_LED_N",
			  "NC", /* GPIO30 */
			  "NC", /* GPIO31 */
			  "NC", /* GPIO32 */
			  "NC", /* GPIO33 */
			  "NC", /* GPIO34 */
			  "NC", /* GPIO35 */
			  "NC", /* GPIO36 */
			  "NC", /* GPIO37 */
			  "NC", /* GPIO38 */
			  "NC", /* GPIO39 */
			  "CAM_GPIO0", /* GPIO40 */
			  "WL_ON", /* GPIO41 */
			  "BT_ON", /* GPIO42 */
			  "WIFI_CLK", /* GPIO43 */
			  "SDA0", /* GPIO44 */
			  "SCL0", /* GPIO45 */
			  "SMPS_SCL",
			  "SMPS_SDA",
			  /* Used by SD Card */
			  "SD_CLK_R",
			  "SD_CMD_R",
			  "SD_DATA0_R",
			  "SD_DATA1_R",
			  "SD_DATA2_R",
			  "SD_DATA3_R";
};

&hdmi {
	hpd-gpios = <&gpio 28 GPIO_ACTIVE_LOW>;
	power-domains = <&power RPI_POWER_DOMAIN_HDMI>;
	status = "okay";
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>;
	status = "okay";

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

&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_gpio14>;
	status = "okay";
};

/* SDHCI is used to control the SDIO for wireless */
&sdhci {
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>;
	status = "okay";
	bus-width = <4>;
	non-removable;
	mmc-pwrseq = <&wifi_pwrseq>;

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
	};
};

/* SDHOST is used to drive the SD card */
&sdhost {
	pinctrl-names = "default";
	pinctrl-0 = <&sdhost_gpio48>;
	status = "okay";
	bus-width = <4>;
};

Attachment: bcm2837-rpi-zero-2-w.dts
Description: audio/vnd.dts



Home | Main Index | Thread Index | Old Index