mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: "Robert Carnecky (Neopsis)" <robert@neopsis.com>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: Mini UART on RaspberryPi CM3/CM3+
Date: Tue, 20 Oct 2020 06:04:41 +0200	[thread overview]
Message-ID: <d1a23b4ae7220295690f763cb278e1ff27de6f8c.camel@pengutronix.de> (raw)
In-Reply-To: <6d2cf28bcdeecc2a139d8f704ef03ebd61e18501.camel@pengutronix.de>

[-- 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

  reply	other threads:[~2020-10-20  4:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 10:07 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 [this message]
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)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1a23b4ae7220295690f763cb278e1ff27de6f8c.camel@pengutronix.de \
    --to=r.czerwinski@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=robert@neopsis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox