Solved BananaPI M1 problem with ahci channel 0 FreeBSD 12.2

Fulda

New Member

Reaction score: 4
Messages: 10

Hi All,

Look like I'm last user of BananaPI M1 with Allwinner A20 and embeded SATA.
Somewhere between revisions 343862 (last working I have) and 370066 (not working I'm trying to use) is lost ahci channel 0.
I'm trying to report as much as possible in bug 251330 with no luck.

It look like some change in generic sys/dev/ahci/ require some additional enable/disable functionality for channel, that is not implemented in sys/arm/allwinner/ .

Working version:
Code:
ahci0: <Allwinner Integrated AHCI controller> mem 0x1c18000-0x1c18fff irq 25 on simplebus0
ahci0: AHCI v1.10 with 1 3Gbps ports, Port Multiplier not supported
ahci0: quirks=0x2<NOPMP>
ahci0: Caps: NCQ SNTF SS ALP AL CLO 3Gbps PMD SSC PSC 32cmd CCC 1ports
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich0: Caps:

Non working one:
Code:
ahci0: <Allwinner Integrated AHCI controller> mem 0x1c18000-0x1c18fff irq 26 on simplebus0
ahci0: AHCI v1.10 with 1 3Gbps ports, Port Multiplier not supported
ahci0: quirks=0x2<NOPMP>
ahci0: Caps: NCQ SNTF ALP AL CLO 3Gbps PMD SSC PSC 32cmd CCC 1ports
ahcich0: not probed (disabled)

Does anyone have any idea where to find changes?

Thank you
 

tingo

Son of Beastie

Reaction score: 633
Messages: 2,535

Aside from changes in the sources, it could be changes in the dtb files. Have you checked those?
 
OP
F

Fulda

New Member

Reaction score: 4
Messages: 10

Aside from changes in the sources, it could be changes in the dtb files. Have you checked those?
Hi tingo,
Thank you for reply. dtb files is big question for me. I do not understand the structure of them :(
I know, they source version in /usr/src/gnu/dts/arm/sun7i-a20-bananapi.dts , but have no glue, how they are compiled :(
As well browsing through https://svnweb.freebsd.org/base/head/sys/gnu/dts/arm/? showing me different files :(

Should find some more documentation.
 
OP
F

Fulda

New Member

Reaction score: 4
Messages: 10

From 13.0 onward (that includes -CURRENT) development is done in git, not subversion.


Thank you SirDice,

OK, that is answer, where files coming from.
Little problem is, I'm not able compare files used with 12.0. But I found last working version:
FreeBSD-13.0-CURRENT-arm-armv7-BANANAPI-20190207-r343862.img
... and I can open and check used dts. But does not see any problem.

Command ofwdump -a showing:
Code:
...
          Node 0x6ae4: endpoint@0
          Node 0x6b28: endpoint@1
  Node 0x6b7c: ahci-5v
  Node 0x6c38: usb0-vbus
  Node 0x6cec: usb1-vbus
...

Command ofwdump -p /ahci-5v showing on working one:
Code:
Node 0x6b7c: ahci-5v
  compatible:
    72 65 67 75 6c 61 74 6f 72 2d 66 69 78 65 64 00
    'regulator-fixed'
  regulator-name:
    61 68 63 69 2d 35 76 00
    'ahci-5v'
  regulator-min-microvolt:
    00 4c 4b 40
  regulator-max-microvolt:
    00 4c 4b 40
  regulator-boot-on:
  enable-active-high:
  gpio:
    00 00 00 39 00 00 00 01 00 00 00 08 00 00 00 00
  status:
    64 69 73 61 62 6c 65 64 00
    'disabled'
  phandle:
    00 00 00 aa

same command on non-working:
Code:
Node 0x652c: ahci-5v
  compatible:
    72 65 67 75 6c 61 74 6f 72 2d 66 69 78 65 64 00
    'regulator-fixed'
  regulator-name:
    61 68 63 69 2d 35 76 00
    'ahci-5v'
  regulator-min-microvolt:
    00 4c 4b 40
  regulator-max-microvolt:
    00 4c 4b 40
  regulator-boot-on:
  enable-active-high:
  gpio:
    00 00 00 3b 00 00 00 01 00 00 00 08 00 00 00 00
  status:
    64 69 73 61 62 6c 65 64 00
    'disabled'
  phandle:
    00 00 00 90
 
OP
F

Fulda

New Member

Reaction score: 4
Messages: 10

OK, I'm one step closer to solution.
Problem is not on FreeBSD level, but on u-Boot level.

when I try scsi info on working one, I get info about one unknown device. The same on non-working will return nothing (mean no device), but command scsi scan perform scan and starting from that point I'm getting my disk as well with scsi info. After that disk is detected on FreeBSD level.

Log from non-working one, that become working after scsi scan command:
Code:
=> scsi info
=> scsi scan
scanning bus for devices...
Target spinup took 0 ms.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst
  Device 0: (0:0) Vendor: ATA Prod.: KINGSTON SKC300S Rev: 507K
            Type: Hard Disk
            Capacity: 57241.8 MB = 55.9 GB (117231408 x 512)
=> scsi info
Device 0: (0:0) Vendor: ATA Prod.: KINGSTON SKC300S Rev: 507K
            Type: Hard Disk
            Capacity: 57241.8 MB = 55.9 GB (117231408 x 512)
=>

The main difference is u-Boot.

Working one - detect SCSI on line 20.
Code:
U-Boot SPL 2019.01 (Feb 07 2019 - 11:10:28 +0000)
DRAM: 1024 MiB
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from MMC1


U-Boot 2019.01 (Feb 07 2019 - 11:10:28 +0000) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: LeMaker Banana Pi
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Setting up a 720x576i composite-pal console (overscan 32x20)
In:    serial
Out:   vga
Err:   vga
SCSI:  Target spinup took 0 ms.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst

Net:   eth0: ethernet@1c50000
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
41905 bytes read in 6 ms (6.7 MiB/s)
Found EFI removable media binary efi/boot/bootarm.efi
7[r[999;999H[6n8Scanning disks on scsi...
Disk scsi0 not ready
Scanning disks on usb...
Disk usb0 not ready
Disk usb1 not ready
Disk usb2 not ready
Disk usb3 not ready
Scanning disks on mmc...
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Found 3 disks
600664 bytes read in 36 ms (15.9 MiB/s)
## Starting EFI application at 42000000 ...
[?25hConsoles: EFI console 


[?25h|/-FreeBSD/arm EFI loader, Revision 1.1





   Command line arguments: l


   EFI version: 2.70


   EFI Firmware: Das U-Boot (rev 8217.256)


   Console: efi (0)


   Load Path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USB(0x6,0x0)/HD(1,0x01,0,0x81f,0x18fa8)/\efi\boot\bootarm.efi


   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USB(0x6,0x0)/HD(1,0x01,0,0x81f,0x18fa8)


Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USB(0x6,0x0)/HD(1,0x01,0,0x81f,0x18fa8)


Setting currdev to disk0p1:


\|/-\|/-\|/-Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USB(0x6,0x0)/HD(2,0x01,0,0x197c7,0xe96839)


Setting currdev to disk0p2:


\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-Loading /boot/defaults/loader.conf

same log from non-working one - not detect disk, but configure lan
Code:
U-Boot SPL 2020.07 (Oct 23 2020 - 01:32:02 +0000)
DRAM: 1024 MiB
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from MMC1


U-Boot 2020.07 (Oct 23 2020 - 01:32:02 +0000) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: LeMaker Banana Pi
I2C:   ready
DRAM:  1 GiB
MMC:   mmc@1c0f000: 0
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Setting up a 720x576i composite-pal console (overscan 32x20)
In:    serial
Out:   vga
Err:   vga
Net:   eth0: ethernet@1c50000
starting USB...
Bus usb@1c14000: USB EHCI 1.00
Bus usb@1c14400: USB OHCI 1.0
Bus usb@1c1c000: USB EHCI 1.00
Bus usb@1c1c400: USB OHCI 1.0
scanning bus usb@1c14000 for devices... 1 USB Device(s) found
scanning bus usb@1c14400 for devices... 1 USB Device(s) found
scanning bus usb@1c1c000 for devices... 2 USB Device(s) found
scanning bus usb@1c1c400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
37488 bytes read in 4 ms (8.9 MiB/s)
Found EFI removable media binary efi/boot/bootarm.efi
Scanning disk mmc@1c0f000.blk...
** Unrecognized filesystem type **
Scanning disk usb_mass_storage.lun0...
** Unrecognized filesystem type **
Found 5 disks
7[r[999;999H[6n8BootOrder not defined
EFI boot manager: Cannot load any image
622632 bytes read in 37 ms (16 MiB/s)
[?25hConsoles: EFI console 


|/-\|    Reading loader env vars from /efi/freebsd/loader.env


Setting currdev to disk0p1:


/-\|/-FreeBSD/arm EFI loader, Revision 1.1





   Command line arguments: l


   EFI version: 2.80


   EFI Firmware: Das U-Boot (rev 8224.1792)


   Console: efi (0)


   Load Path: /efi\boot\bootarm.efi


   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,0x01,0,0x81f,0x18fa8)


Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,0x01,0,0x81f,0x18fa8)


Setting currdev to disk0p1:


\|/-\|/-\|/-Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(2,0x01,0,0x197c7,0x1d92839)


Setting currdev to disk0p2:


\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|Loading /boot/defaults/loader.conf


/-\|/-\Loading /boot/defaults/loader.conf
 
OP
F

Fulda

New Member

Reaction score: 4
Messages: 10

Hi,

I solved (workarounded) this problem for me.

The issue is not in FreeBSD, but in u-Boot SPL. I found, that boot with U-Boot SPL 2019.01 (Feb 07 2019 - 11:10:28 +0000) works fine, but with U-Boot SPL 2020.07 (Oct 23 2020 - 01:32:02 +0000) does not.

I have not enough knowledge, how to compile u-Boot on FreeBSD, but I found article on lemaker wiki, how bananapi understand u-boot: http://wiki.lemaker.org/BananaPro/Pi:Setting_up_the_bootable_SD_card

Then I created my new SD card by following way:
  1. copy image of version I want to have on card: dd if=FreeBSD-12.2-RELEASE-arm-armv7-BANANAPI.img of=/dev/mmcsd0 bs=512
  2. replace uBoot from image that works for me: dd if=FreeBSD-13.0-CURRENT-arm-armv7-BANANAPI-20190207-r343862.img of=/dev/mmcsd0 bs=512 count=2077

In step 2 I assume, both images have same partition information in sector 1. If not, then first sector should be skipped. (by lemaker wiki up to 16 sectors can be skipped).
 

tingo

Son of Beastie

Reaction score: 633
Messages: 2,535

If you haven't already, it would help if your reported this (both the problem and the workaround) on the freebsd-arm mailing list. That's where developers hang out.
 
OP
F

Fulda

New Member

Reaction score: 4
Messages: 10

If you haven't already, it would help if your reported this (both the problem and the workaround) on the freebsd-arm mailing list. That's where developers hang out.
Hi tingo,
Thank you, I did not reported it yet. Yes, you are right, it can be helpful to report it. Do it for me please.
Thank you.
 

tingo

Son of Beastie

Reaction score: 633
Messages: 2,535

Why? I'm firmly in the camp "do your own homework". So - if you have a problem - you need to report it. If you can't be bothered to do it (or can't be bothered to learn how to do it) there is no problem; only somebody who is complaining without any evidence to back it up.

Why it is important that the person / persons that have the problem report it? Because the developers might have questions and / or tests to run in order to figure out the nature of the problem and (hopefully) a fix.

Even for a small and easily reproduced problem it is helpful to FreeBSD (the project) that you (the person who sees / discovers the problem) report it; at a minimum it shows the number of people actually using FreeBSD, and that said people are not only interested in getting bugs fixed, but also that they are willing to help in this process by reporting the bugs.
 

Phishfry

Beastie's Twin

Reaction score: 2,646
Messages: 5,561

I have a BananaPi and it has been nothing but trouble on FreeBSD.
Many boards have a person who tends after a board. BananaPi has no one that I could find.
On top of that there are many BPI varients like Lemaker that are not supported. BPI-R2 router board is not either.

What will be interesting to see is what is going on with FreeBSD 13 and GENERICSD image.
How does it work on BPI-M1 ???
No sense didling with the past. On Arm you want to stay up to date. GenericSD image should work.
Have you tried it?
 
OP
F

Fulda

New Member

Reaction score: 4
Messages: 10

What will be interesting to see is what is going on with FreeBSD 13 and GENERICSD image.
How does it work on BPI-M1 ???
No sense didling with the past. On Arm you want to stay up to date. GenericSD image should work.
Have you tried it?
Yes and no.
I did a try where I simply dd image to sd card. It not boot at all. Screen remain black.
Then I decided, some more steps needs to happen as part of installation. Some adoption? I do not know.
Once dd from image to SD should be fine, then they does not work on my BPI-M1. If some more steps need to be done, then can anyone point me to some handbook? I will happily do some testing.

BTW: BPI is not listed as supported hardware for 13.0 https://www.freebsd.org/where/ oh here: https://www.freebsd.org/releases/13.0R/hardware/
 
Top