* Mini UART on RaspberryPi CM3/CM3+ @ 2020-10-05 10:07 Robert Carnecky (Neopsis) 2020-10-05 11:16 ` Ahmad Fatoum 0 siblings, 1 reply; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-05 10:07 UTC (permalink / raw) To: barebox Did anybody successfully configured Raspberry CM3/CM3+ mini-UART as the Barebox console? I found a thread on this list discussing the issue (https://www.mail-archive.com/barebox@lists.infradead.org/msg35235.html), unfortunately without any solution. What I need: * UART0 on pins 32/33 (technology access over rs-485) * UART1 (miniUART) on pins 14/15 (console) My current config.txt boots fine my raspberry kernel (zImage built using builroot): kernel=zImage enable_uart=1 dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 Now I would like to switch to Barebox as a bootloader. I compiled the barebox image with * CONSOLE_ACTIVATE_NONE = Y * 'stdout-path=&uart1;' in 'arch/arm/dts/bcm2837-rpi-cm3.dts' . and changed my kernel in config.txt kernel=barebox.img I cannot see any output on pins 14/15 e.g. UART1, no barebox console, no kernel console. Any idea what's wrong here? Robert _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-05 10:07 Mini UART on RaspberryPi CM3/CM3+ Robert Carnecky (Neopsis) @ 2020-10-05 11:16 ` Ahmad Fatoum 2020-10-09 12:30 ` Robert Carnecky (Neopsis) 0 siblings, 1 reply; 15+ messages in thread From: Ahmad Fatoum @ 2020-10-05 11:16 UTC (permalink / raw) To: Robert Carnecky (Neopsis), barebox Hello Robert, On 10/5/20 12:07 PM, Robert Carnecky (Neopsis) wrote: > Did anybody successfully configured Raspberry CM3/CM3+ mini-UART as > the Barebox console? I found a thread > on this list discussing the issue > (https://www.mail-archive.com/barebox@lists.infradead.org/msg35235.html), > unfortunately without any solution. > > What I need: > > * UART0 on pins 32/33 (technology access over rs-485) > * UART1 (miniUART) on pins 14/15 (console) > > My current config.txt boots fine my raspberry kernel (zImage built > using builroot): > > kernel=zImage > enable_uart=1 > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > Now I would like to switch to Barebox as a bootloader. I compiled the > barebox image with > > * CONSOLE_ACTIVATE_NONE = Y > * 'stdout-path=&uart1;' in 'arch/arm/dts/bcm2837-rpi-cm3.dts' . I don't have a CM3, but are you sure uart1 is enabled? Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_gpio14>; status = "okay"; }; If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen on UART0 before the RS-485 transceiver and paste the dmesg and devinfo input you get. Cheers, Ahmad > > and changed my kernel in config.txt > > kernel=barebox.img > > I cannot see any output on pins 14/15 e.g. UART1, no barebox console, > no kernel console. > Any idea what's wrong here? > > Robert > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-05 11:16 ` Ahmad Fatoum @ 2020-10-09 12:30 ` Robert Carnecky (Neopsis) 2020-10-09 14:18 ` Ahmad Fatoum 0 siblings, 1 reply; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-09 12:30 UTC (permalink / raw) To: barebox > Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: > > &uart1 { > pinctrl-names = "default"; > pinctrl-0 = <&uart1_gpio14>; > status = "okay"; > }; I extended arch/arm/dts/bcm2837-rpi-cm3.dts as advised + additionally I set UART0 to pins 32/33. &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio32>; status = "okay"; }; I still cannot see Barebox console on boot, however, the Barebox loader starts in 3 seconds my kernel and I get the Linux console output on UART1/ttyS0. Now my Linux boots as expected, unfortunately without visible Barebox console. I tried all Barebox console setting (NONE/ALL/FIRST), same result, no Barebox console output on UART0 or UART1. > If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen > on UART0 before the RS-485 transceiver and paste the > dmesg and devinfo input you get. # dmesg | grep tty [ 0.000000] Kernel command line: console=ttyS0,115200 coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:C5:7D:E3 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 root=/dev/mmcblk0p2 console=ttyS0,115200 rootfstype=ext4 elevator=deadline rootwait [ 1.289058] printk: console [ttyS0] disabled [ 1.289175] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 50000000) is a 16550 [ 1.945483] printk: console [ttyS0] enabled [ 2.432604] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2 # stty -F /dev/ttyAMA0 115200 # cat /etc/inittab > /dev/ttyAMA0 <- OK Robert On Mon, Oct 5, 2020 at 1:16 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > > Hello Robert, > > On 10/5/20 12:07 PM, Robert Carnecky (Neopsis) wrote: > > Did anybody successfully configured Raspberry CM3/CM3+ mini-UART as > > the Barebox console? I found a thread > > on this list discussing the issue > > (https://www.mail-archive.com/barebox@lists.infradead.org/msg35235.html), > > unfortunately without any solution. > > > > What I need: > > > > * UART0 on pins 32/33 (technology access over rs-485) > > * UART1 (miniUART) on pins 14/15 (console) > > > > My current config.txt boots fine my raspberry kernel (zImage built > > using builroot): > > > > kernel=zImage > > enable_uart=1 > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > Now I would like to switch to Barebox as a bootloader. I compiled the > > barebox image with > > > > * CONSOLE_ACTIVATE_NONE = Y > > * 'stdout-path=&uart1;' in 'arch/arm/dts/bcm2837-rpi-cm3.dts' . > > I don't have a CM3, but are you sure uart1 is enabled? > > Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: > > &uart1 { > pinctrl-names = "default"; > pinctrl-0 = <&uart1_gpio14>; > status = "okay"; > }; > > If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen > on UART0 before the RS-485 transceiver and paste the > dmesg and devinfo input you get. > > Cheers, > Ahmad > > > > > > and changed my kernel in config.txt > > > > kernel=barebox.img > > > > I cannot see any output on pins 14/15 e.g. UART1, no barebox console, > > no kernel console. > > Any idea what's wrong here? > > > > Robert > > > > _______________________________________________ > > barebox mailing list > > barebox@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/barebox > > > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-09 12:30 ` Robert Carnecky (Neopsis) @ 2020-10-09 14:18 ` Ahmad Fatoum 2020-10-17 11:31 ` Robert Carnecky (Neopsis) 0 siblings, 1 reply; 15+ messages in thread From: Ahmad Fatoum @ 2020-10-09 14:18 UTC (permalink / raw) To: Robert Carnecky (Neopsis), barebox Hello Robert, On 10/9/20 2:30 PM, Robert Carnecky (Neopsis) wrote: >> Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: >> >> &uart1 { >> pinctrl-names = "default"; >> pinctrl-0 = <&uart1_gpio14>; >> status = "okay"; >> }; > > I extended arch/arm/dts/bcm2837-rpi-cm3.dts as advised + > additionally I set UART0 to pins 32/33. > > &uart0 { > pinctrl-names = "default"; > pinctrl-0 = <&uart0_gpio32>; > status = "okay"; > }; > > I still cannot see Barebox console on boot, however, the Barebox loader > starts in 3 seconds my kernel and I get the Linux console output on > UART1/ttyS0. Strange that this made the kernel boot now. Maybe somewhere an unclocked peripheral was being accessed before? > Now my Linux boots as expected, unfortunately without > visible Barebox console. I tried all Barebox console setting > (NONE/ALL/FIRST), same result, no Barebox console output on UART0 > or UART1. Huh, you did listen at the UART0 _before_ the RS-485 transceiver? UART0 should work, at least it apparently did when the CM3 support was added. >> If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen >> on UART0 before the RS-485 transceiver and paste the >> dmesg and devinfo input you get. > > # dmesg | grep tty > [ 0.000000] Kernel command line: console=ttyS0,115200 > coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 > snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 > 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 > bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 > smsc95xx.macaddr=B8:27:EB:C5:7D:E3 vc_mem.mem_base=0x3ec00000 > vc_mem.mem_size=0x40000000 root=/dev/mmcblk0p2 console=ttyS0,115200 > rootfstype=ext4 elevator=deadline rootwait > [ 1.289058] printk: console [ttyS0] disabled > [ 1.289175] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud > = 50000000) is a 16550 > [ 1.945483] printk: console [ttyS0] enabled > [ 2.432604] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, > base_baud = 0) is a PL011 rev2 > > # stty -F /dev/ttyAMA0 115200 > # cat /etc/inittab > /dev/ttyAMA0 <- OK I meant dmesg under barebox, if UART1 fails to output, but UART0 can be read before the transceiver. On 10/6/20 1:32 AM, Robert Carnecky (Neopsis) wrote: > I played a bit more with the config.txt settings and when I activated the flag > > uart_2ndstage=1 > > I got the barebox console! Here a snippet from the 2stage while > logging the UART lading. Oh. That would indicate that there is some sort of initialization missing. uart_2ndstage=1 initializes the UART for VideoCore use apparently and from there on, it works. > What I do not understand: how the loaded /mfs/sd/bcm2710-rpi-cm3.dtb > and the overlays > cooperate with the Barebox device tree? Does it mean we have two sets > of device tree > files? Yes. The VideoCore device tree is available in barebox as /vc.dtb, see e390c8799d91 ("ARM: rpi: save fdt that was passed from VideoCore") Hope this helps, Ahmad -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-09 14:18 ` Ahmad Fatoum @ 2020-10-17 11:31 ` Robert Carnecky (Neopsis) 2020-10-17 21:29 ` Ahmad Fatoum 0 siblings, 1 reply; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-17 11:31 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox Finally, I managed to boot into barebox menu using UART1 (/dev/ttyS0) as the console. The solution was to remove all UART related overlays from config.txt and only activate UART1. enable_uart=1 Anyway, another problem occurred. When booting via barebox the CPU serial number is wrong. Obviously, barebox somehow manipulates the internal structures and cat /proc/cpuinfo returns always Hardware : BCM2835 Revision : 0000 Serial : 0000000000000000 Model : Raspberry Pi Compute Module 3 IO board V3.0 When I boot the same image directly without barebox boot loader, the info is OK. I found some discussions about U-Boot and wrong serial number here https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 maybe that's barebox related too. Anyway, that is a definitive no go with barebox for us because parts of our software are expecting the unique serial number. Robert On Fri, Oct 9, 2020 at 4:18 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > > Hello Robert, > > On 10/9/20 2:30 PM, Robert Carnecky (Neopsis) wrote: > >> Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: > >> > >> &uart1 { > >> pinctrl-names = "default"; > >> pinctrl-0 = <&uart1_gpio14>; > >> status = "okay"; > >> }; > > > > I extended arch/arm/dts/bcm2837-rpi-cm3.dts as advised + > > additionally I set UART0 to pins 32/33. > > > > &uart0 { > > pinctrl-names = "default"; > > pinctrl-0 = <&uart0_gpio32>; > > status = "okay"; > > }; > > > > I still cannot see Barebox console on boot, however, the Barebox loader > > starts in 3 seconds my kernel and I get the Linux console output on > > UART1/ttyS0. > > Strange that this made the kernel boot now. Maybe somewhere an unclocked > peripheral was being accessed before? > > > Now my Linux boots as expected, unfortunately without > > visible Barebox console. I tried all Barebox console setting > > (NONE/ALL/FIRST), same result, no Barebox console output on UART0 > > or UART1. > > Huh, you did listen at the UART0 _before_ the RS-485 transceiver? > UART0 should work, at least it apparently did when the CM3 support > was added. > > >> If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen > >> on UART0 before the RS-485 transceiver and paste the > >> dmesg and devinfo input you get. > > > > # dmesg | grep tty > > [ 0.000000] Kernel command line: console=ttyS0,115200 > > coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 > > snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 > > 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 > > bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 > > smsc95xx.macaddr=B8:27:EB:C5:7D:E3 vc_mem.mem_base=0x3ec00000 > > vc_mem.mem_size=0x40000000 root=/dev/mmcblk0p2 console=ttyS0,115200 > > rootfstype=ext4 elevator=deadline rootwait > > [ 1.289058] printk: console [ttyS0] disabled > > [ 1.289175] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud > > = 50000000) is a 16550 > > [ 1.945483] printk: console [ttyS0] enabled > > [ 2.432604] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, > > base_baud = 0) is a PL011 rev2 > > > > # stty -F /dev/ttyAMA0 115200 > > # cat /etc/inittab > /dev/ttyAMA0 <- OK > > I meant dmesg under barebox, if UART1 fails to output, but UART0 can be > read before the transceiver. > > On 10/6/20 1:32 AM, Robert Carnecky (Neopsis) wrote: > > I played a bit more with the config.txt settings and when I activated the flag > > > > uart_2ndstage=1 > > > > I got the barebox console! Here a snippet from the 2stage while > > logging the UART lading. > > Oh. That would indicate that there is some sort of initialization missing. > uart_2ndstage=1 initializes the UART for VideoCore use apparently and from > there on, it works. > > > What I do not understand: how the loaded /mfs/sd/bcm2710-rpi-cm3.dtb > > and the overlays > > cooperate with the Barebox device tree? Does it mean we have two sets > > of device tree > > files? > > Yes. The VideoCore device tree is available in barebox as /vc.dtb, > see e390c8799d91 ("ARM: rpi: save fdt that was passed from VideoCore") > > > Hope this helps, > Ahmad > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-17 11:31 ` Robert Carnecky (Neopsis) @ 2020-10-17 21:29 ` Ahmad Fatoum 2020-10-17 23:17 ` Robert Carnecky (Neopsis) 0 siblings, 1 reply; 15+ messages in thread From: Ahmad Fatoum @ 2020-10-17 21:29 UTC (permalink / raw) To: Robert Carnecky (Neopsis); +Cc: barebox Hi, On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > Finally, I managed to boot into barebox menu using UART1 (/dev/ttyS0) > as the console. The solution was to remove all UART related overlays > from config.txt and only activate UART1. > > enable_uart=1 > > Anyway, another problem occurred. When booting via barebox the CPU > serial number is wrong. Obviously, barebox somehow manipulates the > internal structures and > > cat /proc/cpuinfo > > returns always > > Hardware : BCM2835 > Revision : 0000 > Serial : 0000000000000000 > Model : Raspberry Pi Compute Module 3 IO board V3.0 > > When I boot the same image directly without barebox boot loader, the > info is OK. I found some discussions about U-Boot and wrong serial > number here > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > maybe that's barebox related too. Anyway, that is a definitive no go > with barebox for us because parts of our software are expecting the > unique serial number. I believe you can boot Linux with /vc.dtb and you'll get the same device tree passed to Linux as if you booted without passing through barebox. > > Robert > > > On Fri, Oct 9, 2020 at 4:18 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: >> >> Hello Robert, >> >> On 10/9/20 2:30 PM, Robert Carnecky (Neopsis) wrote: >>>> Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: >>>> >>>> &uart1 { >>>> pinctrl-names = "default"; >>>> pinctrl-0 = <&uart1_gpio14>; >>>> status = "okay"; >>>> }; >>> >>> I extended arch/arm/dts/bcm2837-rpi-cm3.dts as advised + >>> additionally I set UART0 to pins 32/33. >>> >>> &uart0 { >>> pinctrl-names = "default"; >>> pinctrl-0 = <&uart0_gpio32>; >>> status = "okay"; >>> }; >>> >>> I still cannot see Barebox console on boot, however, the Barebox loader >>> starts in 3 seconds my kernel and I get the Linux console output on >>> UART1/ttyS0. >> >> Strange that this made the kernel boot now. Maybe somewhere an unclocked >> peripheral was being accessed before? >> >>> Now my Linux boots as expected, unfortunately without >>> visible Barebox console. I tried all Barebox console setting >>> (NONE/ALL/FIRST), same result, no Barebox console output on UART0 >>> or UART1. >> >> Huh, you did listen at the UART0 _before_ the RS-485 transceiver? >> UART0 should work, at least it apparently did when the CM3 support >> was added. >> >>>> If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen >>>> on UART0 before the RS-485 transceiver and paste the >>>> dmesg and devinfo input you get. >>> >>> # dmesg | grep tty >>> [ 0.000000] Kernel command line: console=ttyS0,115200 >>> coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 >>> snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 >>> 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 >>> bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 >>> smsc95xx.macaddr=B8:27:EB:C5:7D:E3 vc_mem.mem_base=0x3ec00000 >>> vc_mem.mem_size=0x40000000 root=/dev/mmcblk0p2 console=ttyS0,115200 >>> rootfstype=ext4 elevator=deadline rootwait >>> [ 1.289058] printk: console [ttyS0] disabled >>> [ 1.289175] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud >>> = 50000000) is a 16550 >>> [ 1.945483] printk: console [ttyS0] enabled >>> [ 2.432604] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, >>> base_baud = 0) is a PL011 rev2 >>> >>> # stty -F /dev/ttyAMA0 115200 >>> # cat /etc/inittab > /dev/ttyAMA0 <- OK >> >> I meant dmesg under barebox, if UART1 fails to output, but UART0 can be >> read before the transceiver. >> >> On 10/6/20 1:32 AM, Robert Carnecky (Neopsis) wrote: >>> I played a bit more with the config.txt settings and when I activated the flag >>> >>> uart_2ndstage=1 >>> >>> I got the barebox console! Here a snippet from the 2stage while >>> logging the UART lading. >> >> Oh. That would indicate that there is some sort of initialization missing. >> uart_2ndstage=1 initializes the UART for VideoCore use apparently and from >> there on, it works. >> >>> What I do not understand: how the loaded /mfs/sd/bcm2710-rpi-cm3.dtb >>> and the overlays >>> cooperate with the Barebox device tree? Does it mean we have two sets >>> of device tree >>> files? >> >> Yes. The VideoCore device tree is available in barebox as /vc.dtb, >> see e390c8799d91 ("ARM: rpi: save fdt that was passed from VideoCore") >> >> >> Hope this helps, >> Ahmad >> >> -- >> Pengutronix e.K. | | >> Steuerwalder Str. 21 | http://www.pengutronix.de/ | >> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-17 21:29 ` Ahmad Fatoum @ 2020-10-17 23:17 ` Robert Carnecky (Neopsis) 2020-10-19 9:28 ` Ahmad Fatoum 0 siblings, 1 reply; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-17 23:17 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > > Hi, > > On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > > Finally, I managed to boot into barebox menu using UART1 (/dev/ttyS0) > > as the console. The solution was to remove all UART related overlays > > from config.txt and only activate UART1. > > > > enable_uart=1 > > > > Anyway, another problem occurred. When booting via barebox the CPU > > serial number is wrong. Obviously, barebox somehow manipulates the > > internal structures and > > > > cat /proc/cpuinfo > > > > returns always > > > > Hardware : BCM2835 > > Revision : 0000 > > Serial : 0000000000000000 > > Model : Raspberry Pi Compute Module 3 IO board V3.0 > > > > When I boot the same image directly without barebox boot loader, the > > info is OK. I found some discussions about U-Boot and wrong serial > > number here > > > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > > > maybe that's barebox related too. Anyway, that is a definitive no go > > with barebox for us because parts of our software are expecting the > > unique serial number. > > I believe you can boot Linux with /vc.dtb and you'll get the same > device tree passed to Linux as if you booted without passing through > barebox. Yes, but then I lose my Linux console! A summary, in all cases Barebox device tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated following your hint, e.g. / { chosen { stdout-path = "&uart1"; }; }; &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_gpio14>; status = "okay"; }; &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio32>; status = "okay"; }; 1. Booting kernel direct, works as expected (console on uart1), expected behavior kernel=zImage enable_uart=1 dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 2. With Barebox loader. The same config.txt as in case 1), - no Barebox console - kernel boots with the console on uart1 kernel=barebox-raspberry-pi-cm3.img enable_uart=1 dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 3. With Barebox loader, no uart overlays in config.txt. - Barebox console on uart1 ok, - kernel console on uart1 - almost done), but ... no cpuinfo kernel=barebox-raspberry-pi-cm3.img enable_uart=1 4. With Barebox loader, no uart overlays in config.txt, Linux boots with vc.dtb. - Barebox console on uart1 ok - no Linux console, Linux boots with cpuinfo ok kernel=barebox-raspberry-pi-cm3.img enable_uart=1 I did not found any combination when I get the Barebox console and Linux console on uart1 and with cpuinfo ok. If the serial number is not needed, case 3) should be ok. Robert > > > > > Robert > > > > > > On Fri, Oct 9, 2020 at 4:18 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > >> > >> Hello Robert, > >> > >> On 10/9/20 2:30 PM, Robert Carnecky (Neopsis) wrote: > >>>> Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: > >>>> > >>>> &uart1 { > >>>> pinctrl-names = "default"; > >>>> pinctrl-0 = <&uart1_gpio14>; > >>>> status = "okay"; > >>>> }; > >>> > >>> I extended arch/arm/dts/bcm2837-rpi-cm3.dts as advised + > >>> additionally I set UART0 to pins 32/33. > >>> > >>> &uart0 { > >>> pinctrl-names = "default"; > >>> pinctrl-0 = <&uart0_gpio32>; > >>> status = "okay"; > >>> }; > >>> > >>> I still cannot see Barebox console on boot, however, the Barebox loader > >>> starts in 3 seconds my kernel and I get the Linux console output on > >>> UART1/ttyS0. > >> > >> Strange that this made the kernel boot now. Maybe somewhere an unclocked > >> peripheral was being accessed before? > >> > >>> Now my Linux boots as expected, unfortunately without > >>> visible Barebox console. I tried all Barebox console setting > >>> (NONE/ALL/FIRST), same result, no Barebox console output on UART0 > >>> or UART1. > >> > >> Huh, you did listen at the UART0 _before_ the RS-485 transceiver? > >> UART0 should work, at least it apparently did when the CM3 support > >> was added. > >> > >>>> If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen > >>>> on UART0 before the RS-485 transceiver and paste the > >>>> dmesg and devinfo input you get. > >>> > >>> # dmesg | grep tty > >>> [ 0.000000] Kernel command line: console=ttyS0,115200 > >>> coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 > >>> snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 > >>> 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 > >>> bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 > >>> smsc95xx.macaddr=B8:27:EB:C5:7D:E3 vc_mem.mem_base=0x3ec00000 > >>> vc_mem.mem_size=0x40000000 root=/dev/mmcblk0p2 console=ttyS0,115200 > >>> rootfstype=ext4 elevator=deadline rootwait > >>> [ 1.289058] printk: console [ttyS0] disabled > >>> [ 1.289175] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud > >>> = 50000000) is a 16550 > >>> [ 1.945483] printk: console [ttyS0] enabled > >>> [ 2.432604] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, > >>> base_baud = 0) is a PL011 rev2 > >>> > >>> # stty -F /dev/ttyAMA0 115200 > >>> # cat /etc/inittab > /dev/ttyAMA0 <- OK > >> > >> I meant dmesg under barebox, if UART1 fails to output, but UART0 can be > >> read before the transceiver. > >> > >> On 10/6/20 1:32 AM, Robert Carnecky (Neopsis) wrote: > >>> I played a bit more with the config.txt settings and when I activated the flag > >>> > >>> uart_2ndstage=1 > >>> > >>> I got the barebox console! Here a snippet from the 2stage while > >>> logging the UART lading. > >> > >> Oh. That would indicate that there is some sort of initialization missing. > >> uart_2ndstage=1 initializes the UART for VideoCore use apparently and from > >> there on, it works. > >> > >>> What I do not understand: how the loaded /mfs/sd/bcm2710-rpi-cm3.dtb > >>> and the overlays > >>> cooperate with the Barebox device tree? Does it mean we have two sets > >>> of device tree > >>> files? > >> > >> Yes. The VideoCore device tree is available in barebox as /vc.dtb, > >> see e390c8799d91 ("ARM: rpi: save fdt that was passed from VideoCore") > >> > >> > >> Hope this helps, > >> Ahmad > >> > >> -- > >> Pengutronix e.K. | | > >> Steuerwalder Str. 21 | http://www.pengutronix.de/ | > >> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > >> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > > > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-17 23:17 ` Robert Carnecky (Neopsis) @ 2020-10-19 9:28 ` Ahmad Fatoum 2020-10-19 22:29 ` Robert Carnecky (Neopsis) 0 siblings, 1 reply; 15+ messages in thread From: Ahmad Fatoum @ 2020-10-19 9:28 UTC (permalink / raw) To: Robert Carnecky (Neopsis); +Cc: barebox Hello, On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: >> >> Hi, >> >> On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: >>> Finally, I managed to boot into barebox menu using UART1 (/dev/ttyS0) >>> as the console. The solution was to remove all UART related overlays >>> from config.txt and only activate UART1. >>> >>> enable_uart=1 >>> >>> Anyway, another problem occurred. When booting via barebox the CPU >>> serial number is wrong. Obviously, barebox somehow manipulates the >>> internal structures and >>> >>> cat /proc/cpuinfo >>> >>> returns always >>> >>> Hardware : BCM2835 >>> Revision : 0000 >>> Serial : 0000000000000000 >>> Model : Raspberry Pi Compute Module 3 IO board V3.0 >>> >>> When I boot the same image directly without barebox boot loader, the >>> info is OK. I found some discussions about U-Boot and wrong serial >>> number here >>> >>> https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 >>> >>> maybe that's barebox related too. Anyway, that is a definitive no go >>> with barebox for us because parts of our software are expecting the >>> unique serial number. >> >> I believe you can boot Linux with /vc.dtb and you'll get the same >> device tree passed to Linux as if you booted without passing through >> barebox. > > Yes, but then I lose my Linux console! A summary, in all cases Barebox device > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated following your hint, e.g. > > / { > chosen { > stdout-path = "&uart1"; > }; > }; > > &uart1 { > pinctrl-names = "default"; > pinctrl-0 = <&uart1_gpio14>; > status = "okay"; > }; > > &uart0 { > pinctrl-names = "default"; > pinctrl-0 = <&uart0_gpio32>; > status = "okay"; > }; > > 1. Booting kernel direct, works as expected (console on uart1), > expected behavior > > kernel=zImage > enable_uart=1 > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > 2. With Barebox loader. The same config.txt as in case 1), > - no Barebox console > - kernel boots with the console on uart1 > > kernel=barebox-raspberry-pi-cm3.img > enable_uart=1 > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > 3. With Barebox loader, no uart overlays in config.txt. > - Barebox console on uart1 ok, > - kernel console on uart1 > - almost done), but ... no cpuinfo > > kernel=barebox-raspberry-pi-cm3.img > enable_uart=1 > > 4. With Barebox loader, no uart overlays in config.txt, Linux boots with vc.dtb. > - Barebox console on uart1 ok > - no Linux console, Linux boots with cpuinfo ok > > kernel=barebox-raspberry-pi-cm3.img > enable_uart=1 > > I did not found any combination when I get the Barebox console and > Linux console on uart1 > and with cpuinfo ok. If the serial number is not needed, case 3) should be ok. What happens if you combine 2. and 4. ? So you have enable_uart=1, the uart overlays _and_ Linux boots with vc.dtb? > > Robert > >> >>> >>> Robert >>> >>> >>> On Fri, Oct 9, 2020 at 4:18 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: >>>> >>>> Hello Robert, >>>> >>>> On 10/9/20 2:30 PM, Robert Carnecky (Neopsis) wrote: >>>>>> Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: >>>>>> >>>>>> &uart1 { >>>>>> pinctrl-names = "default"; >>>>>> pinctrl-0 = <&uart1_gpio14>; >>>>>> status = "okay"; >>>>>> }; >>>>> >>>>> I extended arch/arm/dts/bcm2837-rpi-cm3.dts as advised + >>>>> additionally I set UART0 to pins 32/33. >>>>> >>>>> &uart0 { >>>>> pinctrl-names = "default"; >>>>> pinctrl-0 = <&uart0_gpio32>; >>>>> status = "okay"; >>>>> }; >>>>> >>>>> I still cannot see Barebox console on boot, however, the Barebox loader >>>>> starts in 3 seconds my kernel and I get the Linux console output on >>>>> UART1/ttyS0. >>>> >>>> Strange that this made the kernel boot now. Maybe somewhere an unclocked >>>> peripheral was being accessed before? >>>> >>>>> Now my Linux boots as expected, unfortunately without >>>>> visible Barebox console. I tried all Barebox console setting >>>>> (NONE/ALL/FIRST), same result, no Barebox console output on UART0 >>>>> or UART1. >>>> >>>> Huh, you did listen at the UART0 _before_ the RS-485 transceiver? >>>> UART0 should work, at least it apparently did when the CM3 support >>>> was added. >>>> >>>>>> If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen >>>>>> on UART0 before the RS-485 transceiver and paste the >>>>>> dmesg and devinfo input you get. >>>>> >>>>> # dmesg | grep tty >>>>> [ 0.000000] Kernel command line: console=ttyS0,115200 >>>>> coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 >>>>> snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 >>>>> 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 >>>>> bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 >>>>> smsc95xx.macaddr=B8:27:EB:C5:7D:E3 vc_mem.mem_base=0x3ec00000 >>>>> vc_mem.mem_size=0x40000000 root=/dev/mmcblk0p2 console=ttyS0,115200 >>>>> rootfstype=ext4 elevator=deadline rootwait >>>>> [ 1.289058] printk: console [ttyS0] disabled >>>>> [ 1.289175] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud >>>>> = 50000000) is a 16550 >>>>> [ 1.945483] printk: console [ttyS0] enabled >>>>> [ 2.432604] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, >>>>> base_baud = 0) is a PL011 rev2 >>>>> >>>>> # stty -F /dev/ttyAMA0 115200 >>>>> # cat /etc/inittab > /dev/ttyAMA0 <- OK >>>> >>>> I meant dmesg under barebox, if UART1 fails to output, but UART0 can be >>>> read before the transceiver. >>>> >>>> On 10/6/20 1:32 AM, Robert Carnecky (Neopsis) wrote: >>>>> I played a bit more with the config.txt settings and when I activated the flag >>>>> >>>>> uart_2ndstage=1 >>>>> >>>>> I got the barebox console! Here a snippet from the 2stage while >>>>> logging the UART lading. >>>> >>>> Oh. That would indicate that there is some sort of initialization missing. >>>> uart_2ndstage=1 initializes the UART for VideoCore use apparently and from >>>> there on, it works. >>>> >>>>> What I do not understand: how the loaded /mfs/sd/bcm2710-rpi-cm3.dtb >>>>> and the overlays >>>>> cooperate with the Barebox device tree? Does it mean we have two sets >>>>> of device tree >>>>> files? >>>> >>>> Yes. The VideoCore device tree is available in barebox as /vc.dtb, >>>> see e390c8799d91 ("ARM: rpi: save fdt that was passed from VideoCore") >>>> >>>> >>>> Hope this helps, >>>> Ahmad >>>> >>>> -- >>>> Pengutronix e.K. | | >>>> Steuerwalder Str. 21 | http://www.pengutronix.de/ | >>>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >>>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | >>> >> >> -- >> Pengutronix e.K. | | >> Steuerwalder Str. 21 | http://www.pengutronix.de/ | >> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-19 9:28 ` Ahmad Fatoum @ 2020-10-19 22:29 ` Robert Carnecky (Neopsis) 2020-10-20 3:59 ` Rouven Czerwinski 0 siblings, 1 reply; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-19 22:29 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox On Mon, Oct 19, 2020 at 11:28 AM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > > Hello, > > On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > >> > >> Hi, > >> > >> On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > >>> Finally, I managed to boot into barebox menu using UART1 (/dev/ttyS0) > >>> as the console. The solution was to remove all UART related overlays > >>> from config.txt and only activate UART1. > >>> > >>> enable_uart=1 > >>> > >>> Anyway, another problem occurred. When booting via barebox the CPU > >>> serial number is wrong. Obviously, barebox somehow manipulates the > >>> internal structures and > >>> > >>> cat /proc/cpuinfo > >>> > >>> returns always > >>> > >>> Hardware : BCM2835 > >>> Revision : 0000 > >>> Serial : 0000000000000000 > >>> Model : Raspberry Pi Compute Module 3 IO board V3.0 > >>> > >>> When I boot the same image directly without barebox boot loader, the > >>> info is OK. I found some discussions about U-Boot and wrong serial > >>> number here > >>> > >>> https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > >>> > >>> maybe that's barebox related too. Anyway, that is a definitive no go > >>> with barebox for us because parts of our software are expecting the > >>> unique serial number. > >> > >> I believe you can boot Linux with /vc.dtb and you'll get the same > >> device tree passed to Linux as if you booted without passing through > >> barebox. > > > > Yes, but then I lose my Linux console! A summary, in all cases Barebox device > > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated following your hint, e.g. > > > > / { > > chosen { > > stdout-path = "&uart1"; > > }; > > }; > > > > &uart1 { > > pinctrl-names = "default"; > > pinctrl-0 = <&uart1_gpio14>; > > status = "okay"; > > }; > > > > &uart0 { > > pinctrl-names = "default"; > > pinctrl-0 = <&uart0_gpio32>; > > status = "okay"; > > }; > > > > 1. Booting kernel direct, works as expected (console on uart1), > > expected behavior > > > > kernel=zImage > > enable_uart=1 > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > 2. With Barebox loader. The same config.txt as in case 1), > > - no Barebox console > > - kernel boots with the console on uart1 > > > > kernel=barebox-raspberry-pi-cm3.img > > enable_uart=1 > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > 3. With Barebox loader, no uart overlays in config.txt. > > - Barebox console on uart1 ok, > > - kernel console on uart1 > > - almost done), but ... no cpuinfo > > > > kernel=barebox-raspberry-pi-cm3.img > > enable_uart=1 > > > > 4. With Barebox loader, no uart overlays in config.txt, Linux boots with vc.dtb. > > - Barebox console on uart1 ok > > - no Linux console, Linux boots with cpuinfo ok > > > > kernel=barebox-raspberry-pi-cm3.img > > enable_uart=1 > > > > I did not found any combination when I get the Barebox console and > > Linux console on uart1 > > and with cpuinfo ok. If the serial number is not needed, case 3) should be ok. > > What happens if you combine 2. and 4. ? > So you have enable_uart=1, the uart overlays _and_ Linux boots with vc.dtb? Negativ. Whenever I enable overlays in the config.txt that map uart0 to pin32/33 and uart1 to pin 14/15 (console), I do not get Barebox console. It does not depend on the device tree passed to the kernel. This interaction between Barebox device tree and Raspberry config.txt overlays is a bit strange for me. Just an idea - does Barebox fully support this hardware? From the 2835 ARM Peripherals Guide, chapter 2.2 miniUART : > The implemented UART is not a 16650 compatible UART However as far as possible > the first 8 control and status registers are laid out like a 16550 UART. Al 16550 register > bits which are not supported can be written but will be ignored and read back as 0. > All control bits for simple UART receive/transmit operations are available. Barebox has support for NS16650 ( CONFIG_DRIVER_SERIAL_NS16550) but not for Raspberry miniUART. Anyway, I am giving up. I am sure I tested all combinations of overlays, I have written my own dts, nothing works as I need (console=uart1, incl. proper serial number handling). There is no problem to get the console on uart0/ttyAMA0, but not on uart1/ttyS0. The Raspberry way how they are handling uarts lacks all logic and is completely unclear. Robert Robert > > > > > Robert > > > >> > >>> > >>> Robert > >>> > >>> > >>> On Fri, Oct 9, 2020 at 4:18 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > >>>> > >>>> Hello Robert, > >>>> > >>>> On 10/9/20 2:30 PM, Robert Carnecky (Neopsis) wrote: > >>>>>> Try adding to arch/arm/dts/bcm2837-rpi-cm3.dts: > >>>>>> > >>>>>> &uart1 { > >>>>>> pinctrl-names = "default"; > >>>>>> pinctrl-0 = <&uart1_gpio14>; > >>>>>> status = "okay"; > >>>>>> }; > >>>>> > >>>>> I extended arch/arm/dts/bcm2837-rpi-cm3.dts as advised + > >>>>> additionally I set UART0 to pins 32/33. > >>>>> > >>>>> &uart0 { > >>>>> pinctrl-names = "default"; > >>>>> pinctrl-0 = <&uart0_gpio32>; > >>>>> status = "okay"; > >>>>> }; > >>>>> > >>>>> I still cannot see Barebox console on boot, however, the Barebox loader > >>>>> starts in 3 seconds my kernel and I get the Linux console output on > >>>>> UART1/ttyS0. > >>>> > >>>> Strange that this made the kernel boot now. Maybe somewhere an unclocked > >>>> peripheral was being accessed before? > >>>> > >>>>> Now my Linux boots as expected, unfortunately without > >>>>> visible Barebox console. I tried all Barebox console setting > >>>>> (NONE/ALL/FIRST), same result, no Barebox console output on UART0 > >>>>> or UART1. > >>>> > >>>> Huh, you did listen at the UART0 _before_ the RS-485 transceiver? > >>>> UART0 should work, at least it apparently did when the CM3 support > >>>> was added. > >>>> > >>>>>> If that doesn't help, use CONSOLE_ACTIVATE_ALL and listen > >>>>>> on UART0 before the RS-485 transceiver and paste the > >>>>>> dmesg and devinfo input you get. > >>>>> > >>>>> # dmesg | grep tty > >>>>> [ 0.000000] Kernel command line: console=ttyS0,115200 > >>>>> coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 > >>>>> snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 > >>>>> 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 > >>>>> bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 > >>>>> smsc95xx.macaddr=B8:27:EB:C5:7D:E3 vc_mem.mem_base=0x3ec00000 > >>>>> vc_mem.mem_size=0x40000000 root=/dev/mmcblk0p2 console=ttyS0,115200 > >>>>> rootfstype=ext4 elevator=deadline rootwait > >>>>> [ 1.289058] printk: console [ttyS0] disabled > >>>>> [ 1.289175] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud > >>>>> = 50000000) is a 16550 > >>>>> [ 1.945483] printk: console [ttyS0] enabled > >>>>> [ 2.432604] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, > >>>>> base_baud = 0) is a PL011 rev2 > >>>>> > >>>>> # stty -F /dev/ttyAMA0 115200 > >>>>> # cat /etc/inittab > /dev/ttyAMA0 <- OK > >>>> > >>>> I meant dmesg under barebox, if UART1 fails to output, but UART0 can be > >>>> read before the transceiver. > >>>> > >>>> On 10/6/20 1:32 AM, Robert Carnecky (Neopsis) wrote: > >>>>> I played a bit more with the config.txt settings and when I activated the flag > >>>>> > >>>>> uart_2ndstage=1 > >>>>> > >>>>> I got the barebox console! Here a snippet from the 2stage while > >>>>> logging the UART lading. > >>>> > >>>> Oh. That would indicate that there is some sort of initialization missing. > >>>> uart_2ndstage=1 initializes the UART for VideoCore use apparently and from > >>>> there on, it works. > >>>> > >>>>> What I do not understand: how the loaded /mfs/sd/bcm2710-rpi-cm3.dtb > >>>>> and the overlays > >>>>> cooperate with the Barebox device tree? Does it mean we have two sets > >>>>> of device tree > >>>>> files? > >>>> > >>>> Yes. The VideoCore device tree is available in barebox as /vc.dtb, > >>>> see e390c8799d91 ("ARM: rpi: save fdt that was passed from VideoCore") > >>>> > >>>> > >>>> Hope this helps, > >>>> Ahmad > >>>> > >>>> -- > >>>> Pengutronix e.K. | | > >>>> Steuerwalder Str. 21 | http://www.pengutronix.de/ | > >>>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > >>>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > >>> > >> > >> -- > >> Pengutronix e.K. | | > >> Steuerwalder Str. 21 | http://www.pengutronix.de/ | > >> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > >> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > > > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-19 22:29 ` Robert Carnecky (Neopsis) @ 2020-10-20 3:59 ` Rouven Czerwinski 2020-10-20 4:04 ` Rouven Czerwinski 0 siblings, 1 reply; 15+ messages in thread From: Rouven Czerwinski @ 2020-10-20 3:59 UTC (permalink / raw) To: Robert Carnecky (Neopsis), Ahmad Fatoum; +Cc: barebox On Tue, 2020-10-20 at 00:29 +0200, Robert Carnecky (Neopsis) wrote: > On Mon, Oct 19, 2020 at 11:28 AM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > > Hello, > > > > On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > > > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote: > > > > Hi, > > > > > > > > On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > > > > > Finally, I managed to boot into barebox menu using UART1 (/dev/ttyS0) > > > > > as the console. The solution was to remove all UART related overlays > > > > > from config.txt and only activate UART1. > > > > > > > > > > enable_uart=1 > > > > > > > > > > Anyway, another problem occurred. When booting via barebox the CPU > > > > > serial number is wrong. Obviously, barebox somehow manipulates the > > > > > internal structures and > > > > > > > > > > cat /proc/cpuinfo > > > > > > > > > > returns always > > > > > > > > > > Hardware : BCM2835 > > > > > Revision : 0000 > > > > > Serial : 0000000000000000 > > > > > Model : Raspberry Pi Compute Module 3 IO board V3.0 > > > > > > > > > > When I boot the same image directly without barebox boot loader, the > > > > > info is OK. I found some discussions about U-Boot and wrong serial > > > > > number here > > > > > > > > > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > > > > > > > > > maybe that's barebox related too. Anyway, that is a definitive no go > > > > > with barebox for us because parts of our software are expecting the > > > > > unique serial number. > > > > > > > > I believe you can boot Linux with /vc.dtb and you'll get the same > > > > device tree passed to Linux as if you booted without passing through > > > > barebox. > > > > > > Yes, but then I lose my Linux console! A summary, in all cases Barebox device > > > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated following your hint, e.g. > > > > > > / { > > > chosen { > > > stdout-path = "&uart1"; > > > }; > > > }; > > > > > > &uart1 { > > > pinctrl-names = "default"; > > > pinctrl-0 = <&uart1_gpio14>; > > > status = "okay"; > > > }; > > > > > > &uart0 { > > > pinctrl-names = "default"; > > > pinctrl-0 = <&uart0_gpio32>; > > > status = "okay"; > > > }; > > > > > > 1. Booting kernel direct, works as expected (console on uart1), > > > expected behavior > > > > > > kernel=zImage > > > enable_uart=1 > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > 2. With Barebox loader. The same config.txt as in case 1), > > > - no Barebox console > > > - kernel boots with the console on uart1 > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > enable_uart=1 > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > 3. With Barebox loader, no uart overlays in config.txt. > > > - Barebox console on uart1 ok, > > > - kernel console on uart1 > > > - almost done), but ... no cpuinfo > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > enable_uart=1 > > > > > > 4. With Barebox loader, no uart overlays in config.txt, Linux boots with vc.dtb. > > > - Barebox console on uart1 ok > > > - no Linux console, Linux boots with cpuinfo ok > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > enable_uart=1 > > > > > > I did not found any combination when I get the Barebox console and > > > Linux console on uart1 > > > and with cpuinfo ok. If the serial number is not needed, case 3) should be ok. > > > > What happens if you combine 2. and 4. ? > > So you have enable_uart=1, the uart overlays _and_ Linux boots with vc.dtb? > > Negativ. Whenever I enable overlays in the config.txt that map uart0 > to pin32/33 and > uart1 to pin 14/15 (console), I do not get Barebox console. It does > not depend on the device > tree passed to the kernel. This interaction between Barebox device > tree and Raspberry config.txt > overlays is a bit strange for me. > > Just an idea - does Barebox fully support this hardware? From the 2835 > ARM Peripherals Guide, > chapter 2.2 miniUART : > > > The implemented UART is not a 16650 compatible UART However as far as possible > > the first 8 control and status registers are laid out like a 16550 UART. Al 16550 register > > bits which are not supported can be written but will be ignored and read back as 0. > > All control bits for simple UART receive/transmit operations are available. > > Barebox has support for NS16650 ( CONFIG_DRIVER_SERIAL_NS16550) but not for > Raspberry miniUART. > > Anyway, I am giving up. I am sure I tested all combinations of > overlays, I have written my > own dts, nothing works as I need (console=uart1, incl. proper serial > number handling). > There is no problem to get the console on uart0/ttyAMA0, but not on uart1/ttyS0. > The Raspberry way how they are handling uarts lacks all logic and is completely > unclear. Hi, looking into arch/arm/dts/bcm2837-rpi-cm3.dts: / { chosen { stdout-path = &uart0; }; }; The CM3 module is currently default configured to use uart0 as the stdout path, while bcm2837-rpi-3.dts is configured for uart1. This was done in ab76f9d09d3b7b77fc00d84bc2fac6bfbf82c69c after the miniuart support was added to the NS16550 driver in 77de547cd179b910cdcb8530df15d77a0fc66a3c. Changing the stdout-path for the barebox internal device tree should output barebox correctly on the miniuart console. Regards, Rouven Czerwinski _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-20 3:59 ` Rouven Czerwinski @ 2020-10-20 4:04 ` Rouven Czerwinski 2020-10-20 12:22 ` Robert Carnecky (Neopsis) 0 siblings, 1 reply; 15+ messages in thread From: Rouven Czerwinski @ 2020-10-20 4:04 UTC (permalink / raw) To: Robert Carnecky (Neopsis), Ahmad Fatoum; +Cc: barebox [-- Attachment #1: Type: text/plain, Size: 6333 bytes --] On Tue, 2020-10-20 at 05:59 +0200, Rouven Czerwinski wrote: > On Tue, 2020-10-20 at 00:29 +0200, Robert Carnecky (Neopsis) wrote: > > On Mon, Oct 19, 2020 at 11:28 AM Ahmad Fatoum < > > a.fatoum@pengutronix.de> wrote: > > > Hello, > > > > > > On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > > > > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum < > > > > a.fatoum@pengutronix.de> wrote: > > > > > Hi, > > > > > > > > > > On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > > > > > > Finally, I managed to boot into barebox menu using UART1 > > > > > > (/dev/ttyS0) > > > > > > as the console. The solution was to remove all UART related > > > > > > overlays > > > > > > from config.txt and only activate UART1. > > > > > > > > > > > > enable_uart=1 > > > > > > > > > > > > Anyway, another problem occurred. When booting via barebox > > > > > > the CPU > > > > > > serial number is wrong. Obviously, barebox somehow > > > > > > manipulates the > > > > > > internal structures and > > > > > > > > > > > > cat /proc/cpuinfo > > > > > > > > > > > > returns always > > > > > > > > > > > > Hardware : BCM2835 > > > > > > Revision : 0000 > > > > > > Serial : 0000000000000000 > > > > > > Model : Raspberry Pi Compute Module 3 IO > > > > > > board V3.0 > > > > > > > > > > > > When I boot the same image directly without barebox boot > > > > > > loader, the > > > > > > info is OK. I found some discussions about U-Boot and > > > > > > wrong serial > > > > > > number here > > > > > > > > > > > > > > > > > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > > > > > > > > > > > maybe that's barebox related too. Anyway, that is a > > > > > > definitive no go > > > > > > with barebox for us because parts of our software are > > > > > > expecting the > > > > > > unique serial number. > > > > > > > > > > I believe you can boot Linux with /vc.dtb and you'll get the > > > > > same > > > > > device tree passed to Linux as if you booted without passing > > > > > through > > > > > barebox. > > > > > > > > Yes, but then I lose my Linux console! A summary, in all cases > > > > Barebox device > > > > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated following > > > > your hint, e.g. > > > > > > > > / { > > > > chosen { > > > > stdout-path = "&uart1"; > > > > }; > > > > }; > > > > > > > > &uart1 { > > > > pinctrl-names = "default"; > > > > pinctrl-0 = <&uart1_gpio14>; > > > > status = "okay"; > > > > }; > > > > > > > > &uart0 { > > > > pinctrl-names = "default"; > > > > pinctrl-0 = <&uart0_gpio32>; > > > > status = "okay"; > > > > }; > > > > > > > > 1. Booting kernel direct, works as expected (console on uart1), > > > > expected behavior > > > > > > > > kernel=zImage > > > > enable_uart=1 > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > 2. With Barebox loader. The same config.txt as in case 1), > > > > - no Barebox console > > > > - kernel boots with the console on uart1 > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > enable_uart=1 > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > 3. With Barebox loader, no uart overlays in config.txt. > > > > - Barebox console on uart1 ok, > > > > - kernel console on uart1 > > > > - almost done), but ... no cpuinfo > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > enable_uart=1 > > > > > > > > 4. With Barebox loader, no uart overlays in config.txt, Linux > > > > boots with vc.dtb. > > > > - Barebox console on uart1 ok > > > > - no Linux console, Linux boots with cpuinfo ok > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > enable_uart=1 > > > > > > > > I did not found any combination when I get the Barebox console > > > > and > > > > Linux console on uart1 > > > > and with cpuinfo ok. If the serial number is not needed, case > > > > 3) should be ok. > > > > > > What happens if you combine 2. and 4. ? > > > So you have enable_uart=1, the uart overlays _and_ Linux boots > > > with vc.dtb? > > > > Negativ. Whenever I enable overlays in the config.txt that map > > uart0 > > to pin32/33 and > > uart1 to pin 14/15 (console), I do not get Barebox console. It does > > not depend on the device > > tree passed to the kernel. This interaction between Barebox device > > tree and Raspberry config.txt > > overlays is a bit strange for me. > > > > Just an idea - does Barebox fully support this hardware? From the > > 2835 > > ARM Peripherals Guide, > > chapter 2.2 miniUART : > > > > > The implemented UART is not a 16650 compatible UART However as > > > far as possible > > > the first 8 control and status registers are laid out like a > > > 16550 UART. Al 16550 register > > > bits which are not supported can be written but will be ignored > > > and read back as 0. > > > All control bits for simple UART receive/transmit operations are > > > available. > > > > Barebox has support for NS16650 ( CONFIG_DRIVER_SERIAL_NS16550) but > > not for > > Raspberry miniUART. > > > > Anyway, I am giving up. I am sure I tested all combinations of > > overlays, I have written my > > own dts, nothing works as I need (console=uart1, incl. proper > > serial > > number handling). > > There is no problem to get the console on uart0/ttyAMA0, but not on > > uart1/ttyS0. > > The Raspberry way how they are handling uarts lacks all logic and > > is completely > > unclear. > > Hi, > > looking into arch/arm/dts/bcm2837-rpi-cm3.dts: > / { > chosen { > stdout-path = &uart0; > }; > }; > > The CM3 module is currently default configured to use uart0 as the > stdout path, while bcm2837-rpi-3.dts is configured for uart1. > This was done in ab76f9d09d3b7b77fc00d84bc2fac6bfbf82c69c after the > miniuart support was added to the NS16550 driver > in 77de547cd179b910cdcb8530df15d77a0fc66a3c. Disregard this, I didn't read the whole thread. There however was another user who tried to use the miniuart and had failures on probe on the CM3. Unfortunately the barebox archives don't have these mails, I'll attach an mbox which has the whole thread. Regards, Rouven Czerwinski [-- Attachment #2: Mini_UART_support_for_Raspberry_Pi_CM3_?.mbox --] [-- Type: application/mbox, Size: 50845 bytes --] [-- Attachment #3: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-20 4:04 ` Rouven Czerwinski @ 2020-10-20 12:22 ` Robert Carnecky (Neopsis) 2020-10-20 12:45 ` Rouven Czerwinski 0 siblings, 1 reply; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-20 12:22 UTC (permalink / raw) To: Rouven Czerwinski; +Cc: barebox, Ahmad Fatoum On Tue, Oct 20, 2020 at 6:04 AM Rouven Czerwinski <r.czerwinski@pengutronix.de> wrote: > > On Tue, 2020-10-20 at 05:59 +0200, Rouven Czerwinski wrote: > > On Tue, 2020-10-20 at 00:29 +0200, Robert Carnecky (Neopsis) wrote: > > > On Mon, Oct 19, 2020 at 11:28 AM Ahmad Fatoum < > > > a.fatoum@pengutronix.de> wrote: > > > > Hello, > > > > > > > > On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > > > > > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum < > > > > > a.fatoum@pengutronix.de> wrote: > > > > > > Hi, > > > > > > > > > > > > On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > > > > > > > Finally, I managed to boot into barebox menu using UART1 > > > > > > > (/dev/ttyS0) > > > > > > > as the console. The solution was to remove all UART related > > > > > > > overlays > > > > > > > from config.txt and only activate UART1. > > > > > > > > > > > > > > enable_uart=1 > > > > > > > > > > > > > > Anyway, another problem occurred. When booting via barebox > > > > > > > the CPU > > > > > > > serial number is wrong. Obviously, barebox somehow > > > > > > > manipulates the > > > > > > > internal structures and > > > > > > > > > > > > > > cat /proc/cpuinfo > > > > > > > > > > > > > > returns always > > > > > > > > > > > > > > Hardware : BCM2835 > > > > > > > Revision : 0000 > > > > > > > Serial : 0000000000000000 > > > > > > > Model : Raspberry Pi Compute Module 3 IO > > > > > > > board V3.0 > > > > > > > > > > > > > > When I boot the same image directly without barebox boot > > > > > > > loader, the > > > > > > > info is OK. I found some discussions about U-Boot and > > > > > > > wrong serial > > > > > > > number here > > > > > > > > > > > > > > > > > > > > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > > > > > > > > > > > > > maybe that's barebox related too. Anyway, that is a > > > > > > > definitive no go > > > > > > > with barebox for us because parts of our software are > > > > > > > expecting the > > > > > > > unique serial number. > > > > > > > > > > > > I believe you can boot Linux with /vc.dtb and you'll get the > > > > > > same > > > > > > device tree passed to Linux as if you booted without passing > > > > > > through > > > > > > barebox. > > > > > > > > > > Yes, but then I lose my Linux console! A summary, in all cases > > > > > Barebox device > > > > > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated following > > > > > your hint, e.g. > > > > > > > > > > / { > > > > > chosen { > > > > > stdout-path = "&uart1"; > > > > > }; > > > > > }; > > > > > > > > > > &uart1 { > > > > > pinctrl-names = "default"; > > > > > pinctrl-0 = <&uart1_gpio14>; > > > > > status = "okay"; > > > > > }; > > > > > > > > > > &uart0 { > > > > > pinctrl-names = "default"; > > > > > pinctrl-0 = <&uart0_gpio32>; > > > > > status = "okay"; > > > > > }; > > > > > > > > > > 1. Booting kernel direct, works as expected (console on uart1), > > > > > expected behavior > > > > > > > > > > kernel=zImage > > > > > enable_uart=1 > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > 2. With Barebox loader. The same config.txt as in case 1), > > > > > - no Barebox console > > > > > - kernel boots with the console on uart1 > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > enable_uart=1 > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > 3. With Barebox loader, no uart overlays in config.txt. > > > > > - Barebox console on uart1 ok, > > > > > - kernel console on uart1 > > > > > - almost done), but ... no cpuinfo > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > enable_uart=1 > > > > > > > > > > 4. With Barebox loader, no uart overlays in config.txt, Linux > > > > > boots with vc.dtb. > > > > > - Barebox console on uart1 ok > > > > > - no Linux console, Linux boots with cpuinfo ok > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > enable_uart=1 > > > > > > > > > > I did not found any combination when I get the Barebox console > > > > > and > > > > > Linux console on uart1 > > > > > and with cpuinfo ok. If the serial number is not needed, case > > > > > 3) should be ok. > > > > > > > > What happens if you combine 2. and 4. ? > > > > So you have enable_uart=1, the uart overlays _and_ Linux boots > > > > with vc.dtb? > > > > > > Negativ. Whenever I enable overlays in the config.txt that map > > > uart0 > > > to pin32/33 and > > > uart1 to pin 14/15 (console), I do not get Barebox console. It does > > > not depend on the device > > > tree passed to the kernel. This interaction between Barebox device > > > tree and Raspberry config.txt > > > overlays is a bit strange for me. > > > > > > Just an idea - does Barebox fully support this hardware? From the > > > 2835 > > > ARM Peripherals Guide, > > > chapter 2.2 miniUART : > > > > > > > The implemented UART is not a 16650 compatible UART However as > > > > far as possible > > > > the first 8 control and status registers are laid out like a > > > > 16550 UART. Al 16550 register > > > > bits which are not supported can be written but will be ignored > > > > and read back as 0. > > > > All control bits for simple UART receive/transmit operations are > > > > available. > > > > > > Barebox has support for NS16650 ( CONFIG_DRIVER_SERIAL_NS16550) but > > > not for > > > Raspberry miniUART. > > > > > > Anyway, I am giving up. I am sure I tested all combinations of > > > overlays, I have written my > > > own dts, nothing works as I need (console=uart1, incl. proper > > > serial > > > number handling). > > > There is no problem to get the console on uart0/ttyAMA0, but not on > > > uart1/ttyS0. > > > The Raspberry way how they are handling uarts lacks all logic and > > > is completely > > > unclear. > > > > Hi, > > > > looking into arch/arm/dts/bcm2837-rpi-cm3.dts: > > / { > > chosen { > > stdout-path = &uart0; > > }; > > }; > > > > The CM3 module is currently default configured to use uart0 as the > > stdout path, while bcm2837-rpi-3.dts is configured for uart1. > > This was done in ab76f9d09d3b7b77fc00d84bc2fac6bfbf82c69c after the > > miniuart support was added to the NS16550 driver > > in 77de547cd179b910cdcb8530df15d77a0fc66a3c. > > Disregard this, I didn't read the whole thread. There however was > another user who tried to use the miniuart and had failures on probe on > the CM3. Unfortunately the barebox archives don't have these mails, > I'll attach an mbox which has the whole thread. > > > Regards, > Rouven Czerwinski > The thread sent by Rouven describes really the same issue and, like me, without a solution. As I wrote in my summary, there is one combination of config.txt and barebox device tree booting into barebox console on uart1 and kernel console on uart1: barebox device tree: / { chosen { stdout-path = "&uart1"; }; }; &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_gpio14>; status = "okay"; }; &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_gpio32>; status = "okay"; }; config.txt: kernel=barebox-raspberry-pi-cm3.img enable_uart=1 Unfortunately, in this case the content of /proc/cpuinfo in Linux is wrong, which is in my opinion barebox bug. Robert _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-20 12:22 ` Robert Carnecky (Neopsis) @ 2020-10-20 12:45 ` Rouven Czerwinski 2020-10-20 17:04 ` Robert Carnecky (Neopsis) 0 siblings, 1 reply; 15+ messages in thread From: Rouven Czerwinski @ 2020-10-20 12:45 UTC (permalink / raw) To: Robert Carnecky (Neopsis); +Cc: barebox, Ahmad Fatoum On Tue, 2020-10-20 at 14:22 +0200, Robert Carnecky (Neopsis) wrote: > On Tue, Oct 20, 2020 at 6:04 AM Rouven Czerwinski > <r.czerwinski@pengutronix.de> wrote: > > On Tue, 2020-10-20 at 05:59 +0200, Rouven Czerwinski wrote: > > > On Tue, 2020-10-20 at 00:29 +0200, Robert Carnecky (Neopsis) > > > wrote: > > > > On Mon, Oct 19, 2020 at 11:28 AM Ahmad Fatoum < > > > > a.fatoum@pengutronix.de> wrote: > > > > > Hello, > > > > > > > > > > On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > > > > > > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum < > > > > > > a.fatoum@pengutronix.de> wrote: > > > > > > > Hi, > > > > > > > > > > > > > > On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > > > > > > > > Finally, I managed to boot into barebox menu using > > > > > > > > UART1 > > > > > > > > (/dev/ttyS0) > > > > > > > > as the console. The solution was to remove all UART > > > > > > > > related > > > > > > > > overlays > > > > > > > > from config.txt and only activate UART1. > > > > > > > > > > > > > > > > enable_uart=1 > > > > > > > > > > > > > > > > Anyway, another problem occurred. When booting via > > > > > > > > barebox > > > > > > > > the CPU > > > > > > > > serial number is wrong. Obviously, barebox somehow > > > > > > > > manipulates the > > > > > > > > internal structures and > > > > > > > > > > > > > > > > cat /proc/cpuinfo > > > > > > > > > > > > > > > > returns always > > > > > > > > > > > > > > > > Hardware : BCM2835 > > > > > > > > Revision : 0000 > > > > > > > > Serial : 0000000000000000 > > > > > > > > Model : Raspberry Pi Compute Module 3 > > > > > > > > IO > > > > > > > > board V3.0 > > > > > > > > > > > > > > > > When I boot the same image directly without barebox > > > > > > > > boot > > > > > > > > loader, the > > > > > > > > info is OK. I found some discussions about U-Boot and > > > > > > > > wrong serial > > > > > > > > number here > > > > > > > > > > > > > > > > > > > > > > > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > > > > > > > > > > > > > > > maybe that's barebox related too. Anyway, that is a > > > > > > > > definitive no go > > > > > > > > with barebox for us because parts of our software are > > > > > > > > expecting the > > > > > > > > unique serial number. > > > > > > > > > > > > > > I believe you can boot Linux with /vc.dtb and you'll get > > > > > > > the > > > > > > > same > > > > > > > device tree passed to Linux as if you booted without > > > > > > > passing > > > > > > > through > > > > > > > barebox. > > > > > > > > > > > > Yes, but then I lose my Linux console! A summary, in all > > > > > > cases > > > > > > Barebox device > > > > > > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated > > > > > > following > > > > > > your hint, e.g. > > > > > > > > > > > > / { > > > > > > chosen { > > > > > > stdout-path = "&uart1"; > > > > > > }; > > > > > > }; > > > > > > > > > > > > &uart1 { > > > > > > pinctrl-names = "default"; > > > > > > pinctrl-0 = <&uart1_gpio14>; > > > > > > status = "okay"; > > > > > > }; > > > > > > > > > > > > &uart0 { > > > > > > pinctrl-names = "default"; > > > > > > pinctrl-0 = <&uart0_gpio32>; > > > > > > status = "okay"; > > > > > > }; > > > > > > > > > > > > 1. Booting kernel direct, works as expected (console on > > > > > > uart1), > > > > > > expected behavior > > > > > > > > > > > > kernel=zImage > > > > > > enable_uart=1 > > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > > > 2. With Barebox loader. The same config.txt as in case 1), > > > > > > - no Barebox console > > > > > > - kernel boots with the console on uart1 > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > enable_uart=1 > > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > > > 3. With Barebox loader, no uart overlays in config.txt. > > > > > > - Barebox console on uart1 ok, > > > > > > - kernel console on uart1 > > > > > > - almost done), but ... no cpuinfo > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > enable_uart=1 > > > > > > > > > > > > 4. With Barebox loader, no uart overlays in config.txt, > > > > > > Linux > > > > > > boots with vc.dtb. > > > > > > - Barebox console on uart1 ok > > > > > > - no Linux console, Linux boots with cpuinfo ok > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > enable_uart=1 > > > > > > > > > > > > I did not found any combination when I get the Barebox > > > > > > console > > > > > > and > > > > > > Linux console on uart1 > > > > > > and with cpuinfo ok. If the serial number is not needed, > > > > > > case > > > > > > 3) should be ok. > > > > > > > > > > What happens if you combine 2. and 4. ? > > > > > So you have enable_uart=1, the uart overlays _and_ Linux > > > > > boots > > > > > with vc.dtb? > > > > > > > > Negativ. Whenever I enable overlays in the config.txt that map > > > > uart0 > > > > to pin32/33 and > > > > uart1 to pin 14/15 (console), I do not get Barebox console. It > > > > does > > > > not depend on the device > > > > tree passed to the kernel. This interaction between Barebox > > > > device > > > > tree and Raspberry config.txt > > > > overlays is a bit strange for me. > > > > > > > > Just an idea - does Barebox fully support this hardware? From > > > > the > > > > 2835 > > > > ARM Peripherals Guide, > > > > chapter 2.2 miniUART : > > > > > > > > > The implemented UART is not a 16650 compatible UART However > > > > > as > > > > > far as possible > > > > > the first 8 control and status registers are laid out like a > > > > > 16550 UART. Al 16550 register > > > > > bits which are not supported can be written but will be > > > > > ignored > > > > > and read back as 0. > > > > > All control bits for simple UART receive/transmit operations > > > > > are > > > > > available. > > > > > > > > Barebox has support for NS16650 ( CONFIG_DRIVER_SERIAL_NS16550) > > > > but > > > > not for > > > > Raspberry miniUART. > > > > > > > > Anyway, I am giving up. I am sure I tested all combinations of > > > > overlays, I have written my > > > > own dts, nothing works as I need (console=uart1, incl. proper > > > > serial > > > > number handling). > > > > There is no problem to get the console on uart0/ttyAMA0, but > > > > not on > > > > uart1/ttyS0. > > > > The Raspberry way how they are handling uarts lacks all logic > > > > and > > > > is completely > > > > unclear. > > > > > > Hi, > > > > > > looking into arch/arm/dts/bcm2837-rpi-cm3.dts: > > > / { > > > chosen { > > > stdout-path = &uart0; > > > }; > > > }; > > > > > > The CM3 module is currently default configured to use uart0 as > > > the > > > stdout path, while bcm2837-rpi-3.dts is configured for uart1. > > > This was done in ab76f9d09d3b7b77fc00d84bc2fac6bfbf82c69c after > > > the > > > miniuart support was added to the NS16550 driver > > > in 77de547cd179b910cdcb8530df15d77a0fc66a3c. > > > > Disregard this, I didn't read the whole thread. There however was > > another user who tried to use the miniuart and had failures on > > probe on > > the CM3. Unfortunately the barebox archives don't have these mails, > > I'll attach an mbox which has the whole thread. > > > > > > Regards, > > Rouven Czerwinski > > > > The thread sent by Rouven describes really the same issue and, like > me, without a solution. > As I wrote in my summary, there is one combination of config.txt and > barebox > device tree booting into barebox console on uart1 and kernel console > on uart1: > > barebox device tree: > > / { > chosen { > stdout-path = "&uart1"; > }; > }; > > &uart1 { > pinctrl-names = "default"; > pinctrl-0 = <&uart1_gpio14>; > status = "okay"; > }; > > &uart0 { > pinctrl-names = "default"; > pinctrl-0 = <&uart0_gpio32>; > status = "okay"; > }; > > > config.txt: > kernel=barebox-raspberry-pi-cm3.img > enable_uart=1 > > Unfortunately, in this case the content of /proc/cpuinfo in Linux > is wrong, > which is in my opinion barebox bug. According to [1], the serial number is directly read from the device tree, this node is not populated by barebox. This leaves the following possible options: 1) Fix the barebox NS16550 driver to probe on the rpi3 CM3 miniuart. Then boot with the vc.dtb file. 2) Read the serial-number from the vc.dtb file and fixup the serial number before booting with the barebox device tree 3) Find out if the RPI serial number can be read using the mailbox communication interface to the VC core, retrieve the number and fix it up into the device tree before boot. A quick google says this could be the case, see [2]. [1]: https://elixir.bootlin.com/linux/latest/source/arch/arm/kernel/setup.c#L951 [2]: https://github.com/Terminus-IMRC/mailbox/blob/b96aa3cc8dfee2be2c8f835e09e812000910a5ff/src/wrap_ours.c#L114 Regards, Rouven _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-20 12:45 ` Rouven Czerwinski @ 2020-10-20 17:04 ` Robert Carnecky (Neopsis) 2020-10-21 8:21 ` Robert Carnecky (Neopsis) 0 siblings, 1 reply; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-20 17:04 UTC (permalink / raw) To: Rouven Czerwinski; +Cc: barebox, Ahmad Fatoum On Tue, Oct 20, 2020 at 2:45 PM Rouven Czerwinski <r.czerwinski@pengutronix.de> wrote: > > On Tue, 2020-10-20 at 14:22 +0200, Robert Carnecky (Neopsis) wrote: > > On Tue, Oct 20, 2020 at 6:04 AM Rouven Czerwinski > > <r.czerwinski@pengutronix.de> wrote: > > > On Tue, 2020-10-20 at 05:59 +0200, Rouven Czerwinski wrote: > > > > On Tue, 2020-10-20 at 00:29 +0200, Robert Carnecky (Neopsis) > > > > wrote: > > > > > On Mon, Oct 19, 2020 at 11:28 AM Ahmad Fatoum < > > > > > a.fatoum@pengutronix.de> wrote: > > > > > > Hello, > > > > > > > > > > > > On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > > > > > > > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum < > > > > > > > a.fatoum@pengutronix.de> wrote: > > > > > > > > Hi, > > > > > > > > > > > > > > > > On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > > > > > > > > > Finally, I managed to boot into barebox menu using > > > > > > > > > UART1 > > > > > > > > > (/dev/ttyS0) > > > > > > > > > as the console. The solution was to remove all UART > > > > > > > > > related > > > > > > > > > overlays > > > > > > > > > from config.txt and only activate UART1. > > > > > > > > > > > > > > > > > > enable_uart=1 > > > > > > > > > > > > > > > > > > Anyway, another problem occurred. When booting via > > > > > > > > > barebox > > > > > > > > > the CPU > > > > > > > > > serial number is wrong. Obviously, barebox somehow > > > > > > > > > manipulates the > > > > > > > > > internal structures and > > > > > > > > > > > > > > > > > > cat /proc/cpuinfo > > > > > > > > > > > > > > > > > > returns always > > > > > > > > > > > > > > > > > > Hardware : BCM2835 > > > > > > > > > Revision : 0000 > > > > > > > > > Serial : 0000000000000000 > > > > > > > > > Model : Raspberry Pi Compute Module 3 > > > > > > > > > IO > > > > > > > > > board V3.0 > > > > > > > > > > > > > > > > > > When I boot the same image directly without barebox > > > > > > > > > boot > > > > > > > > > loader, the > > > > > > > > > info is OK. I found some discussions about U-Boot and > > > > > > > > > wrong serial > > > > > > > > > number here > > > > > > > > > > > > > > > > > > > > > > > > > > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > > > > > > > > > > > > > > > > > maybe that's barebox related too. Anyway, that is a > > > > > > > > > definitive no go > > > > > > > > > with barebox for us because parts of our software are > > > > > > > > > expecting the > > > > > > > > > unique serial number. > > > > > > > > > > > > > > > > I believe you can boot Linux with /vc.dtb and you'll get > > > > > > > > the > > > > > > > > same > > > > > > > > device tree passed to Linux as if you booted without > > > > > > > > passing > > > > > > > > through > > > > > > > > barebox. > > > > > > > > > > > > > > Yes, but then I lose my Linux console! A summary, in all > > > > > > > cases > > > > > > > Barebox device > > > > > > > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated > > > > > > > following > > > > > > > your hint, e.g. > > > > > > > > > > > > > > / { > > > > > > > chosen { > > > > > > > stdout-path = "&uart1"; > > > > > > > }; > > > > > > > }; > > > > > > > > > > > > > > &uart1 { > > > > > > > pinctrl-names = "default"; > > > > > > > pinctrl-0 = <&uart1_gpio14>; > > > > > > > status = "okay"; > > > > > > > }; > > > > > > > > > > > > > > &uart0 { > > > > > > > pinctrl-names = "default"; > > > > > > > pinctrl-0 = <&uart0_gpio32>; > > > > > > > status = "okay"; > > > > > > > }; > > > > > > > > > > > > > > 1. Booting kernel direct, works as expected (console on > > > > > > > uart1), > > > > > > > expected behavior > > > > > > > > > > > > > > kernel=zImage > > > > > > > enable_uart=1 > > > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > > > > > 2. With Barebox loader. The same config.txt as in case 1), > > > > > > > - no Barebox console > > > > > > > - kernel boots with the console on uart1 > > > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > > enable_uart=1 > > > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > > > > > 3. With Barebox loader, no uart overlays in config.txt. > > > > > > > - Barebox console on uart1 ok, > > > > > > > - kernel console on uart1 > > > > > > > - almost done), but ... no cpuinfo > > > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > > enable_uart=1 > > > > > > > > > > > > > > 4. With Barebox loader, no uart overlays in config.txt, > > > > > > > Linux > > > > > > > boots with vc.dtb. > > > > > > > - Barebox console on uart1 ok > > > > > > > - no Linux console, Linux boots with cpuinfo ok > > > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > > enable_uart=1 > > > > > > > > > > > > > > I did not found any combination when I get the Barebox > > > > > > > console > > > > > > > and > > > > > > > Linux console on uart1 > > > > > > > and with cpuinfo ok. If the serial number is not needed, > > > > > > > case > > > > > > > 3) should be ok. > > > > > > > > > > > > What happens if you combine 2. and 4. ? > > > > > > So you have enable_uart=1, the uart overlays _and_ Linux > > > > > > boots > > > > > > with vc.dtb? > > > > > > > > > > Negativ. Whenever I enable overlays in the config.txt that map > > > > > uart0 > > > > > to pin32/33 and > > > > > uart1 to pin 14/15 (console), I do not get Barebox console. It > > > > > does > > > > > not depend on the device > > > > > tree passed to the kernel. This interaction between Barebox > > > > > device > > > > > tree and Raspberry config.txt > > > > > overlays is a bit strange for me. > > > > > > > > > > Just an idea - does Barebox fully support this hardware? From > > > > > the > > > > > 2835 > > > > > ARM Peripherals Guide, > > > > > chapter 2.2 miniUART : > > > > > > > > > > > The implemented UART is not a 16650 compatible UART However > > > > > > as > > > > > > far as possible > > > > > > the first 8 control and status registers are laid out like a > > > > > > 16550 UART. Al 16550 register > > > > > > bits which are not supported can be written but will be > > > > > > ignored > > > > > > and read back as 0. > > > > > > All control bits for simple UART receive/transmit operations > > > > > > are > > > > > > available. > > > > > > > > > > Barebox has support for NS16650 ( CONFIG_DRIVER_SERIAL_NS16550) > > > > > but > > > > > not for > > > > > Raspberry miniUART. > > > > > > > > > > Anyway, I am giving up. I am sure I tested all combinations of > > > > > overlays, I have written my > > > > > own dts, nothing works as I need (console=uart1, incl. proper > > > > > serial > > > > > number handling). > > > > > There is no problem to get the console on uart0/ttyAMA0, but > > > > > not on > > > > > uart1/ttyS0. > > > > > The Raspberry way how they are handling uarts lacks all logic > > > > > and > > > > > is completely > > > > > unclear. > > > > > > > > Hi, > > > > > > > > looking into arch/arm/dts/bcm2837-rpi-cm3.dts: > > > > / { > > > > chosen { > > > > stdout-path = &uart0; > > > > }; > > > > }; > > > > > > > > The CM3 module is currently default configured to use uart0 as > > > > the > > > > stdout path, while bcm2837-rpi-3.dts is configured for uart1. > > > > This was done in ab76f9d09d3b7b77fc00d84bc2fac6bfbf82c69c after > > > > the > > > > miniuart support was added to the NS16550 driver > > > > in 77de547cd179b910cdcb8530df15d77a0fc66a3c. > > > > > > Disregard this, I didn't read the whole thread. There however was > > > another user who tried to use the miniuart and had failures on > > > probe on > > > the CM3. Unfortunately the barebox archives don't have these mails, > > > I'll attach an mbox which has the whole thread. > > > > > > > > > Regards, > > > Rouven Czerwinski > > > > > > > The thread sent by Rouven describes really the same issue and, like > > me, without a solution. > > As I wrote in my summary, there is one combination of config.txt and > > barebox > > device tree booting into barebox console on uart1 and kernel console > > on uart1: > > > > barebox device tree: > > > > / { > > chosen { > > stdout-path = "&uart1"; > > }; > > }; > > > > &uart1 { > > pinctrl-names = "default"; > > pinctrl-0 = <&uart1_gpio14>; > > status = "okay"; > > }; > > > > &uart0 { > > pinctrl-names = "default"; > > pinctrl-0 = <&uart0_gpio32>; > > status = "okay"; > > }; > > > > > > config.txt: > > kernel=barebox-raspberry-pi-cm3.img > > enable_uart=1 > > > > Unfortunately, in this case the content of /proc/cpuinfo in Linux > > is wrong, > > which is in my opinion barebox bug. > > According to [1], the serial number is directly read from the device > tree, this node is not populated by barebox. This leaves the following > possible options: > > 1) Fix the barebox NS16550 driver to probe on the rpi3 CM3 miniuart. > Then boot with the vc.dtb file. > > 2) Read the serial-number from the vc.dtb file and fixup the serial > number before booting with the barebox device tree > > 3) Find out if the RPI serial number can be read using the mailbox > communication interface to the VC core, retrieve the number and fix it > up into the device tree before boot. A quick google says this could be > the case, see [2]. > > [1]: > https://elixir.bootlin.com/linux/latest/source/arch/arm/kernel/setup.c#L951 > [2]: > https://github.com/Terminus-IMRC/mailbox/blob/b96aa3cc8dfee2be2c8f835e09e812000910a5ff/src/wrap_ours.c#L114 > > Regards, > Rouven > OK, I did not know that barebox do not populate the serial number. I will do it in my app from the mailbox. FYI I found various ways how to read the S/N here https://github.com/AndrewFromMelbourne/raspi_serialnumber Robert _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Mini UART on RaspberryPi CM3/CM3+ 2020-10-20 17:04 ` Robert Carnecky (Neopsis) @ 2020-10-21 8:21 ` Robert Carnecky (Neopsis) 0 siblings, 0 replies; 15+ messages in thread From: Robert Carnecky (Neopsis) @ 2020-10-21 8:21 UTC (permalink / raw) To: Rouven Czerwinski; +Cc: barebox, Ahmad Fatoum On Tue, Oct 20, 2020 at 7:04 PM Robert Carnecky (Neopsis) <robert@neopsis.com> wrote: > > On Tue, Oct 20, 2020 at 2:45 PM Rouven Czerwinski > <r.czerwinski@pengutronix.de> wrote: > > > > On Tue, 2020-10-20 at 14:22 +0200, Robert Carnecky (Neopsis) wrote: > > > On Tue, Oct 20, 2020 at 6:04 AM Rouven Czerwinski > > > <r.czerwinski@pengutronix.de> wrote: > > > > On Tue, 2020-10-20 at 05:59 +0200, Rouven Czerwinski wrote: > > > > > On Tue, 2020-10-20 at 00:29 +0200, Robert Carnecky (Neopsis) > > > > > wrote: > > > > > > On Mon, Oct 19, 2020 at 11:28 AM Ahmad Fatoum < > > > > > > a.fatoum@pengutronix.de> wrote: > > > > > > > Hello, > > > > > > > > > > > > > > On 10/18/20 1:17 AM, Robert Carnecky (Neopsis) wrote: > > > > > > > > On Sat, Oct 17, 2020 at 11:29 PM Ahmad Fatoum < > > > > > > > > a.fatoum@pengutronix.de> wrote: > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > On 10/17/20 1:31 PM, Robert Carnecky (Neopsis) wrote: > > > > > > > > > > Finally, I managed to boot into barebox menu using > > > > > > > > > > UART1 > > > > > > > > > > (/dev/ttyS0) > > > > > > > > > > as the console. The solution was to remove all UART > > > > > > > > > > related > > > > > > > > > > overlays > > > > > > > > > > from config.txt and only activate UART1. > > > > > > > > > > > > > > > > > > > > enable_uart=1 > > > > > > > > > > > > > > > > > > > > Anyway, another problem occurred. When booting via > > > > > > > > > > barebox > > > > > > > > > > the CPU > > > > > > > > > > serial number is wrong. Obviously, barebox somehow > > > > > > > > > > manipulates the > > > > > > > > > > internal structures and > > > > > > > > > > > > > > > > > > > > cat /proc/cpuinfo > > > > > > > > > > > > > > > > > > > > returns always > > > > > > > > > > > > > > > > > > > > Hardware : BCM2835 > > > > > > > > > > Revision : 0000 > > > > > > > > > > Serial : 0000000000000000 > > > > > > > > > > Model : Raspberry Pi Compute Module 3 > > > > > > > > > > IO > > > > > > > > > > board V3.0 > > > > > > > > > > > > > > > > > > > > When I boot the same image directly without barebox > > > > > > > > > > boot > > > > > > > > > > loader, the > > > > > > > > > > info is OK. I found some discussions about U-Boot and > > > > > > > > > > wrong serial > > > > > > > > > > number here > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > https://www.raspberrypi.org/forums/viewtopic.php?t=183474#p1162778 > > > > > > > > > > > > > > > > > > > > maybe that's barebox related too. Anyway, that is a > > > > > > > > > > definitive no go > > > > > > > > > > with barebox for us because parts of our software are > > > > > > > > > > expecting the > > > > > > > > > > unique serial number. > > > > > > > > > > > > > > > > > > I believe you can boot Linux with /vc.dtb and you'll get > > > > > > > > > the > > > > > > > > > same > > > > > > > > > device tree passed to Linux as if you booted without > > > > > > > > > passing > > > > > > > > > through > > > > > > > > > barebox. > > > > > > > > > > > > > > > > Yes, but then I lose my Linux console! A summary, in all > > > > > > > > cases > > > > > > > > Barebox device > > > > > > > > tree in arch/arm/dts/bcm2837-rpi-cm3.dts was updated > > > > > > > > following > > > > > > > > your hint, e.g. > > > > > > > > > > > > > > > > / { > > > > > > > > chosen { > > > > > > > > stdout-path = "&uart1"; > > > > > > > > }; > > > > > > > > }; > > > > > > > > > > > > > > > > &uart1 { > > > > > > > > pinctrl-names = "default"; > > > > > > > > pinctrl-0 = <&uart1_gpio14>; > > > > > > > > status = "okay"; > > > > > > > > }; > > > > > > > > > > > > > > > > &uart0 { > > > > > > > > pinctrl-names = "default"; > > > > > > > > pinctrl-0 = <&uart0_gpio32>; > > > > > > > > status = "okay"; > > > > > > > > }; > > > > > > > > > > > > > > > > 1. Booting kernel direct, works as expected (console on > > > > > > > > uart1), > > > > > > > > expected behavior > > > > > > > > > > > > > > > > kernel=zImage > > > > > > > > enable_uart=1 > > > > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > > > > > > > 2. With Barebox loader. The same config.txt as in case 1), > > > > > > > > - no Barebox console > > > > > > > > - kernel boots with the console on uart1 > > > > > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > > > enable_uart=1 > > > > > > > > dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 > > > > > > > > dtoverlay=uart1,txd1_pin=14,rxd1_pin=15 > > > > > > > > > > > > > > > > 3. With Barebox loader, no uart overlays in config.txt. > > > > > > > > - Barebox console on uart1 ok, > > > > > > > > - kernel console on uart1 > > > > > > > > - almost done), but ... no cpuinfo > > > > > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > > > enable_uart=1 > > > > > > > > > > > > > > > > 4. With Barebox loader, no uart overlays in config.txt, > > > > > > > > Linux > > > > > > > > boots with vc.dtb. > > > > > > > > - Barebox console on uart1 ok > > > > > > > > - no Linux console, Linux boots with cpuinfo ok > > > > > > > > > > > > > > > > kernel=barebox-raspberry-pi-cm3.img > > > > > > > > enable_uart=1 > > > > > > > > > > > > > > > > I did not found any combination when I get the Barebox > > > > > > > > console > > > > > > > > and > > > > > > > > Linux console on uart1 > > > > > > > > and with cpuinfo ok. If the serial number is not needed, > > > > > > > > case > > > > > > > > 3) should be ok. > > > > > > > > > > > > > > What happens if you combine 2. and 4. ? > > > > > > > So you have enable_uart=1, the uart overlays _and_ Linux > > > > > > > boots > > > > > > > with vc.dtb? > > > > > > > > > > > > Negativ. Whenever I enable overlays in the config.txt that map > > > > > > uart0 > > > > > > to pin32/33 and > > > > > > uart1 to pin 14/15 (console), I do not get Barebox console. It > > > > > > does > > > > > > not depend on the device > > > > > > tree passed to the kernel. This interaction between Barebox > > > > > > device > > > > > > tree and Raspberry config.txt > > > > > > overlays is a bit strange for me. > > > > > > > > > > > > Just an idea - does Barebox fully support this hardware? From > > > > > > the > > > > > > 2835 > > > > > > ARM Peripherals Guide, > > > > > > chapter 2.2 miniUART : > > > > > > > > > > > > > The implemented UART is not a 16650 compatible UART However > > > > > > > as > > > > > > > far as possible > > > > > > > the first 8 control and status registers are laid out like a > > > > > > > 16550 UART. Al 16550 register > > > > > > > bits which are not supported can be written but will be > > > > > > > ignored > > > > > > > and read back as 0. > > > > > > > All control bits for simple UART receive/transmit operations > > > > > > > are > > > > > > > available. > > > > > > > > > > > > Barebox has support for NS16650 ( CONFIG_DRIVER_SERIAL_NS16550) > > > > > > but > > > > > > not for > > > > > > Raspberry miniUART. > > > > > > > > > > > > Anyway, I am giving up. I am sure I tested all combinations of > > > > > > overlays, I have written my > > > > > > own dts, nothing works as I need (console=uart1, incl. proper > > > > > > serial > > > > > > number handling). > > > > > > There is no problem to get the console on uart0/ttyAMA0, but > > > > > > not on > > > > > > uart1/ttyS0. > > > > > > The Raspberry way how they are handling uarts lacks all logic > > > > > > and > > > > > > is completely > > > > > > unclear. > > > > > > > > > > Hi, > > > > > > > > > > looking into arch/arm/dts/bcm2837-rpi-cm3.dts: > > > > > / { > > > > > chosen { > > > > > stdout-path = &uart0; > > > > > }; > > > > > }; > > > > > > > > > > The CM3 module is currently default configured to use uart0 as > > > > > the > > > > > stdout path, while bcm2837-rpi-3.dts is configured for uart1. > > > > > This was done in ab76f9d09d3b7b77fc00d84bc2fac6bfbf82c69c after > > > > > the > > > > > miniuart support was added to the NS16550 driver > > > > > in 77de547cd179b910cdcb8530df15d77a0fc66a3c. > > > > > > > > Disregard this, I didn't read the whole thread. There however was > > > > another user who tried to use the miniuart and had failures on > > > > probe on > > > > the CM3. Unfortunately the barebox archives don't have these mails, > > > > I'll attach an mbox which has the whole thread. > > > > > > > > > > > > Regards, > > > > Rouven Czerwinski > > > > > > > > > > The thread sent by Rouven describes really the same issue and, like > > > me, without a solution. > > > As I wrote in my summary, there is one combination of config.txt and > > > barebox > > > device tree booting into barebox console on uart1 and kernel console > > > on uart1: > > > > > > barebox device tree: > > > > > > / { > > > chosen { > > > stdout-path = "&uart1"; > > > }; > > > }; > > > > > > &uart1 { > > > pinctrl-names = "default"; > > > pinctrl-0 = <&uart1_gpio14>; > > > status = "okay"; > > > }; > > > > > > &uart0 { > > > pinctrl-names = "default"; > > > pinctrl-0 = <&uart0_gpio32>; > > > status = "okay"; > > > }; > > > > > > > > > config.txt: > > > kernel=barebox-raspberry-pi-cm3.img > > > enable_uart=1 > > > > > > Unfortunately, in this case the content of /proc/cpuinfo in Linux > > > is wrong, > > > which is in my opinion barebox bug. > > > > According to [1], the serial number is directly read from the device > > tree, this node is not populated by barebox. This leaves the following > > possible options: > > > > 1) Fix the barebox NS16550 driver to probe on the rpi3 CM3 miniuart. > > Then boot with the vc.dtb file. > > > > 2) Read the serial-number from the vc.dtb file and fixup the serial > > number before booting with the barebox device tree > > > > 3) Find out if the RPI serial number can be read using the mailbox > > communication interface to the VC core, retrieve the number and fix it > > up into the device tree before boot. A quick google says this could be > > the case, see [2]. > > > > [1]: > > https://elixir.bootlin.com/linux/latest/source/arch/arm/kernel/setup.c#L951 > > [2]: > > https://github.com/Terminus-IMRC/mailbox/blob/b96aa3cc8dfee2be2c8f835e09e812000910a5ff/src/wrap_ours.c#L114 > > > > Regards, > > Rouven > > > > > OK, I did not know that barebox do not populate the serial number. > I will do it in my app from the mailbox. > > FYI I found various ways how to read the S/N here > > https://github.com/AndrewFromMelbourne/raspi_serialnumber > > Robert I can confirm, that this piece of code returns the right serial number. Now I have the barebox and Linux console on uart1/ttyS0 and the application can use uart0/ttyAMA0. Thank you for your help. uint32_t get_serial_number() { int fd = open("/dev/vcio", 0); if (fd == -1) { log_error("open /dev/vcio"); exit(EXIT_FAILURE); } uint32_t property[32] = { 0x00000000, 0x00000000, 0x00010004, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; property[0] = 10 * sizeof(property[0]); if (ioctl(fd, _IOWR(100, 0, char *), property) == -1) { log_error("ioctl"); exit(EXIT_FAILURE); } close(fd); return property[5]; } _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-10-21 8:22 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-10-05 10:07 Mini UART on RaspberryPi CM3/CM3+ Robert Carnecky (Neopsis) 2020-10-05 11:16 ` Ahmad Fatoum 2020-10-09 12:30 ` Robert Carnecky (Neopsis) 2020-10-09 14:18 ` Ahmad Fatoum 2020-10-17 11:31 ` Robert Carnecky (Neopsis) 2020-10-17 21:29 ` Ahmad Fatoum 2020-10-17 23:17 ` Robert Carnecky (Neopsis) 2020-10-19 9:28 ` Ahmad Fatoum 2020-10-19 22:29 ` Robert Carnecky (Neopsis) 2020-10-20 3:59 ` Rouven Czerwinski 2020-10-20 4:04 ` Rouven Czerwinski 2020-10-20 12:22 ` Robert Carnecky (Neopsis) 2020-10-20 12:45 ` Rouven Czerwinski 2020-10-20 17:04 ` Robert Carnecky (Neopsis) 2020-10-21 8:21 ` Robert Carnecky (Neopsis)
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox