Bug 219436 - awg Ethernet soft reset timeout on PINE64+ 2GB
Summary: awg Ethernet soft reset timeout on PINE64+ 2GB
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Some People
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-21 15:36 UTC by Henri Hennebert
Modified: 2018-08-21 08:15 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henri Hennebert 2017-05-21 15:36:19 UTC
ON my PINE64+ 2GB I can boot CURRENT r317181M and awg0 was functional.
But after a power failure, the Ethernet is not working.

The Ethernet is not initialized when booting:
FreeBSD 12.0-CURRENT #0 r317181M: Sun May 14 14:01:52 CEST 2017
    root@norquay.restart.bel:/usr/obj/usr/src/sys/NORQUAY arm64
FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0)

I try to boot with pine64-image-debianmate-310102bsp-2.img and the Ethernet work
fine.

I define AWG_DEBUG in if_awg.c:

awg0: <Allwinner Gigabit Ethernet> mem 0x1c30000-0x1c300ff,0x1c00030-0x1c00033 irq 21 on simplebus0
awg0: soft reset timed out
awg0:   BASIC_CTL_0          00000000
awg0:   BASIC_CTL_1          08000001
awg0:   INT_STA              40000000
awg0:   INT_EN               00000000
awg0:   TX_CTL_0             00000000
awg0:   TX_CTL_1             00000000
awg0:   TX_FLOW_CTL          00000000
awg0:   TX_DMA_LIST          00000000
awg0:   RX_CTL_0             00000000
awg0:   RX_CTL_1             00000000
awg0:   RX_DMA_LIST          00000000
awg0:   RX_FRM_FLT           00000000
awg0:   RX_HASH_0            00000000
awg0:   RX_HASH_1            00000000
awg0:   MII_CMD              00000000
awg0:   ADDR_HIGH0           0000ffff
awg0:   ADDR_LOW0            ffffffff
awg0:   TX_DMA_STA           0000ffff
awg0:   TX_DMA_CUR_DESC      ffffffff
awg0:   TX_DMA_CUR_BUF       0000ffff
awg0:   RX_DMA_STA           00000000
awg0:   RX_DMA_CUR_DESC      00000000
awg0:   RX_DMA_CUR_BUF       00000000
awg0:   RGMII_STA            00000000
device_attach: awg0 attach returned 60

I find someone with the same problem on on Banana PI M3:

https://lists.freebsd.org/pipermail/freebsd-arm/2016-December/015137.html

Henri
Comment 1 Mark Millard 2017-05-21 16:35:24 UTC
(In reply to hlh from comment #0)

I'm one of the ones from the exchange that you reference
for the BPI-M3 (see the prior and next messages by
thread from the one that you referenced). You referenced:

https://lists.freebsd.org/pipermail/freebsd-arm/2016-December/015137.html

I eventually solved my problem on the BPI-M3. That was now
months ago: I've not had such a problem in months.

Out of all the things that I tried what made the difference
was replacing the power supply that I was using to power the
BPI-M3. After that the BPI-M3 worked and had no more Ethernet
problems, both in the unusual environment that I was in back
then and in my usual environment when I returned. It still
works just fine.

This change was made and tested for a time without making
any other simultaneous changes. I eventually started updating
the BPI-M3 FreeBSD and ports again.

Note: I did not expect the power supply change to make the
difference based on the symptoms and other uses of the
power supply that I'd made. But I tried replacing it 
with a different model power supply anyway. (The
problem might be the individual power supply rather
than a model but I tried a different model.)

I've not done anything to examine the properties of the
output of the bad/odd power supply when powering the
BPI-M3 (or any other use). So I do not know what its
technical issue(s) are that a BPI-M3 might be sensitive
to.
Comment 2 Henri Hennebert 2017-05-21 16:57:26 UTC
I just try with another power supply (different model too) to no avail.

Henri
Comment 3 Mark Millard 2017-05-21 17:29:16 UTC
(In reply to hlh from comment #2)

I can not claim power-supplies/power-connection
are always the issue. I just note that they can
be. It might be that different ways of managing
the hardware in the software are somewhat more
or less sensitive to power supply issues when the
power supply does matter. So different operating
systems (or versions of the same operating
system) might get different results in marginal
power contexts.

I also have access to a Pine 64+ 2GB and use it.

For it I use an official RPI-3 power supply.
It worked better than the others that I tried.
It was obvious up front in my case that there
were power problems for the initial power
supply that I used for the Pine64+. (The RPI-3
power supply is 5.1V based as I remember,
designed to be somewhat less likely to have a
important, temporary voltage drop for a
micro-usb style of connection.)

On the BPI-M3 that I was using was a barrel
plug instead of a micro-usb connector. (They
have produced it both ways.) I doubt that
the micro-usb connector style would have been
reliable with any power supply using that
connector given what I observed with the better
barrel plug type of connection and various
devices using micro-usb connectors.
Comment 4 Henri Hennebert 2017-05-21 18:10:11 UTC
I just think that if debian work, FreeBSD can/must work with such a power supply.

By the way it work for me during 3 weeks. Does a power supply can be altered by a power fail?
Comment 5 Mark Millard 2017-05-21 19:23:15 UTC
(In reply to hlh from comment #4)

Power supplies do have failure modes.

For example for the one that I eventually
replaced for the BPI-M3: The BPI-M3 had
an uptime of something like 22 days where
it had been in use over Ethernet with that
power supply connected. The power supply
used to work well and was fairly new.

This was somewhat before I started having
problems. The 22 days only ended because
I decided to shut the BPI-M3 down
temporarily. It still worked when powered
back on. It was a few days later that I
started having problems as I remember.

But this sequence did not involve a power
loss to an area I was in. Odd power can
damage electronics. But as I understand
that is usually more tied to odd initial
power when power starts to be restored
to an area. I'm not sure how likely a
power supply is to be damaged by such.

I can not claim what your problem actually
is. I only report that, for the old BPI-M3
symptoms that you referenced, an odd power
supply can lead to similar symptoms for
a BPI-M3.

I have never seen such symptoms on the Pine
64+ 2GB. But the Pine 64+ 2G is running a
somewhat older vintage of FreeBSD than you
are running: I'd been focusing on aarch64
problems and now on 32-bit powerpc problems
recently and have not been updating some of
the various machines that I have access to.
Comment 6 Henri Hennebert 2017-05-24 13:49:52 UTC
I try  to boot with:

FreeBSD-aarch64-12.0-GENERIC-317973M.img.gz

from RaspBSD and now awg is detected and working.
Comment 7 Ed Maste freebsd_committer freebsd_triage 2017-05-27 01:38:24 UTC
> now awg is detected and working

In other words this problem is now solved?
Comment 8 Henri Hennebert 2017-05-27 12:20:11 UTC
I'm not sure.

I encounter another problem with CURRENT-r317181
(see https://lists.freebsd.org/pipermail/freebsd-current/2017-May/065875.html)
and to solve it I create a kernel config with only the devices detected at boot.
All seems working (root on zfs and awg0).

Then after a power failure awg show 'soft reset timed out'.

I try the image r317973 from RaspBSD with a GENERIC config and awg work.
I try with my slimmed kernel config and awg show the timeout again.

I added step by step the following devices:

104a105
> device		al_eth		# Annapurna Alpine Ethernet NIC
130a132
> device		dwcotg			# DWC OTG controller
143a146,147
> device		aw_rsb			# Allwinner Reduced Serial Bus
> device		bcm2835_bsc		# Broadcom BCM283x I2C bus
167a172,175
> # SPI
> device		spibus
> device		bcm2835_spi		# Broadcom BCM283x SPI bus
> 

and now awg is working. Strange!!!

But if I load zfs and opensolaris the kernel do not start:

>> FreeBSD EFI boot block
   Loader path: /boot/loader.efi

   Initializing modules: ZFS UFS
   Probing 3 block devices.....* done
    ZFS found no pools
    UFS found 1 partition
Consoles: EFI console  
Command line arguments: loader.efi
Image base: 0xb8dc5000
EFI version: 2.05
EFI Firmware: Das U-boot (rev 0.00)

FreeBSD/arm64 EFI loader, Revision 1.1
(Sat May 27 12:46:34 CEST 2017 hlh@chamonix.restart.bel)
EFI boot environment
Loading /boot/defaults/loader.conf
/boot/kernel/kernel text=0x71b148 data=0x9def8+0x39d87e syms=[0x8+0xf4b78+0x8+0xe95c1]
/boot/entropy size=0x1000

Hit [Enter] to boot immediately, or any other key for command prompt.


Type '?' for a list of commands, 'help' for more detailed help.
OK load zfs
/boot/kernel/zfs.ko text=0x9e3a0 text=0xe11f0 data=0x214d0+0x9eb78 syms=[0x8+0x1d760+0x8+0x1884c]
OK load opensolaris
/boot/kernel/opensolaris.ko text=0x1a00 text=0xda0 data=0x10178+0x125b8 syms=[0x8+0x1020+0x8+0x8ca]
OK boot
Booting...
Using DTB provided by EFI at 0x49000000.
... freeze here ...

At first I think that the DTB was smashed and I add to my kernel config:

options         FDT_DTB_STATIC          # Statically embed a DTB file into a kernel image
makeoptions     FDT_DTS_FILE=pine64_plus.dts

but this do not solve the boot problem with zfs.

Moreover if I don't add the previous devices another problem show up:

cpufreq_dt0: <Generic cpufreq driver> on cpu0
cpufreq_dt0: no regulator for cpu@0
device_attach: cpufreq_dt0 attach returned 6

and sysctl dev.cpu.0 do not show the freq_levels and freq

Thanks for your time

Henri
Comment 9 Emmanuel Vadot freebsd_committer freebsd_triage 2018-08-20 18:22:12 UTC
Is this problem still happening ?
Comment 10 Henri Hennebert 2018-08-21 05:59:43 UTC
(In reply to Emmanuel Vadot from comment #9)

Yes the problem is solved.

Just one strange thing, at the loader, when I load zfs, opensolaris is not automatically loaded as in other architecture. So I have in loader.conf.local:

...
zfs_load="YES"                          # Load ZFS module
opensolaris_load="YES"                  # Opensolaris not loaded automatically