Dear all, I am trying to understand how to change the default pin of the u-boot (2020.01) console for the Raspberry pi CM3+ board.
I am using yocto with meta-raspberrypi on the dunfell branch and how everything works between the first stage bootloader, u-boot, u-boot internal device tree and the kernel device tree is not really clear to me. Here is what I would like to achieve: 1. Get UART0 or UART1 as the standard console for u-boot and the linux kernel on pins 32 and 33 2. Make u-boot pass my device tree (stored in the boot partition) to the kernel and not the device tree generated by the first stage bootloader Regarding the first point, I already created a new device tree within u-boot and set it as the default bootloader in my default config (see attached files). Here is the different things I tried: * Use UART0 on pins 32 and 33 * In the u-boot device tree: chosen { stdout-path = "serial0:115200n8"; } ... &uart0 { pinctrl-names= "default"; pinctrl-0 = <&uart0_gpio32>; status = "okay"; } * In the config.txt: enable_uart=1 dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 * This works but only for the kernel, I don't get any output from u-boot and can't stop the boot process. * Use UART1 on pins 32 and 33: more or less the same modification but with different values I would like to know if there is an other file I should modify to get this working. When I use the uart0 or uart1 on pin 14 and 15 everything works properly. The second point seems pretty clear to me. I will change the bootscript and load the file with the fatload command and pass it to the kernel. However I wonder if it might create some problems if the first stage bootloader has already reserved the pins. Finally when u-boot is starting correctly I have the following warning and I was not able to find any explanation on it: U-Boot 2020.01 (Jan 06 2020 - 20:56:31 +0000) DRAM: 948 MiB RPI Compute Module 3+ (0xa02100) MMC: mmc@7e202000: 0 Loading Environment from FAT... WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()! WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()! *** Warning - bad CRC, using default environment In: serial Out: vidconsole Err: vidconsole Net: No ethernet found. starting USB... Bus usb@7e980000: scanning bus usb@7e980000 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()! WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()! switch to partitions #0, OK mmc0(part 0) is current device Scanning mmc 0:1... Found U-Boot script /boot.scr Should I simply ignore it ? Thank you in advance for your time. Best regards Romain ________________________________ Romain Crausaz Development DIGI SENS Switzerland AG Freiburgstr. 65 CH-3280 Murten Telefon: +41 26 672 9876 Email: romain.crau...@digisens.ch<mailto:romain.crau...@digisens.ch> [cid:digisens_34df8dfe-0639-4acb-9e8d-0efd75e7b3a8.png] www.digisens.ch<http://www.digisens.ch>
diff --git a/configs/rpi_cm3_digisens_defconfig b/configs/rpi_cm3_digisens_defconfig index e69de29bb2..c4f5538af1 100644 --- a/configs/rpi_cm3_digisens_defconfig +++ b/configs/rpi_cm3_digisens_defconfig @@ -0,0 +1,48 @@ +CONFIG_ARM=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_BCM283X=y +CONFIG_SYS_TEXT_BASE=0x00008000 +CONFIG_TARGET_RPI_3_32B=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_ENV_SIZE=0x4000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="usb start" +CONFIG_MISC_INIT_R=y +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_SYS_PROMPT="U-Boot> " +CONFIG_CMD_GPIO=y +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_FS_UUID=y +CONFIG_OF_EMBED=y +CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-cm3-digisens" +CONFIG_ENV_FAT_INTERFACE="mmc" +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_DM_KEYBOARD=y +CONFIG_DM_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_BCM2835=y +CONFIG_PHYLIB=y +CONFIG_DM_ETH=y +CONFIG_PINCTRL=y +# CONFIG_PINCTRL_GENERIC is not set +# CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_DWC2=y +CONFIG_USB_KEYBOARD=y +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_LAN78XX=y +CONFIG_USB_ETHER_SMSC95XX=y +CONFIG_DM_VIDEO=y +CONFIG_VIDEO_BPP32=y +CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_CONSOLE_SCROLL_LINES=10 +CONFIG_PHYS_TO_BUS=y +CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/arch/arm/dts/bcm2837-rpi-cm3-digisens.dts b/arch/arm/dts/bcm2837-rpi-cm3-digisens.dts index e69de29bb2..f6c0efd18d 100644 --- a/arch/arm/dts/bcm2837-rpi-cm3-digisens.dts +++ b/arch/arm/dts/bcm2837-rpi-cm3-digisens.dts @@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2837.dtsi" +#include "bcm2836-rpi.dtsi" +#include "bcm283x-rpi-smsc9514.dtsi" +#include "bcm283x-rpi-usb-host.dtsi" + +/ { + compatible = "raspberrypi,3-compute-module", "brcm,bcm2837"; + model = "Raspberry Pi Compute Module 3 DIGI-SENS baseboard"; + + memory@0 { + reg = <0 0x40000000>; + }; + + leds { + act { + gpios = <&expgpio 2 GPIO_ACTIVE_HIGH>; + }; + }; + + chosen { + /* 8250 auxiliary UART instead of pl011 */ + stdout-path = "serial1:115200n8"; + }; + + reg_3v3: fixed-regulator { + compatible = "regulator-fixed"; + regulator-name = "3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + reg_1v8: fixed-regulator { + compatible = "regulator-fixed"; + regulator-name = "1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; +}; + +&gpio { + /* + * This is based on 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 = + /* I2C0 */ + "00-I2C0_SDA", + "01-I2C0_SCL", + + /* GPIO */ + "02-GPIO2", + "03-GPIO3", + "04-GPIO4", + "05-GPIO5", + "06-GPIO6", + + /* SPI0 */ + "07-SPI0_CE1", + "08-SPI0_CE2", + "09-SPI0_MISO", + "10-SPI0_MOSI", + "11-SPI0_SCLK", + + /* GPIO */ + "12-GPIO12", + "13-GPIO13", + "14-GPIO14", + "15-GPIO15", + "16-GPIO16", + + /* MRST */ + "17-MRST", + + /* SC16IS752 */ + "18-SC16IS752_IRQ", + "19-SC16IS752_RESET", + + /* RTC */ + "20-RTC_PF0", + + /* GPIO */ + "21-GPIO21", + + /* SDCARD0 */ + "22-SD0_CLK", + "23-SD0_CMD", + "24-SD0_DATA0", + "25-SD0_DATA1", + "26-SD0_DATA2", + "27-SD0_DATA3", + + /* GPIO */ + "28-GPIO28", + "29-GPIO29", + + /* UART0 */ + "30-UART0_CTS", + "31-UART0_RTS", + "32-UART0_TXD", + "33-UART0_RXD", + + /* SDCARD1 */ + "34-SD1_CLK", + "35-SD1_CMD", + "36-SD1_DATA0", + "37-SD1_DATA1", + "38-SD1_DATA2", + "39-SD1_DATA3", + + /* SPI2 */ + "40-SPI2_MISO", + "41-SPI2_MOSI", + "42-SPI2_SCLK", + "43-SPI2_CE0", + "44-SPI2_CE1", + "45-SPI2_CE2", + + /* UNKNOWN */ + "GPIO46", + "GPIO47", + /* Used by eMMC */ + "SD_CLK_R", + "SD_CMD_R", + "SD_DATA0_R", + "SD_DATA1_R", + "SD_DATA2_R", + "SD_DATA3_R"; + + pinctrl-0 = <&gpioout &alt0>; +}; + +&firmware { + expgpio: gpio { + compatible = "raspberrypi,firmware-gpio"; + gpio-controller; + #gpio-cells = <2>; + gpio-line-names = "HDMI_HPD_N", + "EMMC_EN_N", + "NC", + "NC", + "NC", + "NC", + "NC", + "NC"; + status = "okay"; + }; +}; + +&hdmi { + hpd-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_gpio32>; + status = "okay"; +}; + + +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; + vmmc-supply = <®_3v3>; + vqmmc-supply = <®_1v8>; + status = "okay"; +};