starfive-tech / Fedora_on_StarFive

62 stars 12 forks source link

Known issue: Reset does not work #25

Closed pdp7 closed 3 years ago

pdp7 commented 3 years ago

FYI - reset is not currently implemented.

@rvs reported seeing this error:

BeagleV # reset
resetting ...
Resetting BeagelV......
reset not supported yet
### ERROR ### Please RESET the board ###
pdp7 commented 3 years ago

@tekkamanninja how can I help with reset?

rvs commented 3 years ago

I mean, for the time being it would even be helpful to change the last message to say something like ### ERROR ### Please RESET the board by pressing reset button ###

pdp7 commented 3 years ago

Good idea... I'll track down where the error message lives in the code

MichaelZhuxx commented 3 years ago

@rvs it should be supported, please let me know the uboot version, I guess the uboot you are running is from freelight-u-sdk.

U-Boot 2021.04-g3f3ac01a29 (Apr 29 2021 - 15:26:27 +0800)

CPU:   rv64imafdc
DRAM:  8 GiB
MMC:   sdio0@10000000: 0, sdio1@10010000: 1
Net:   dwmac.10020000
Error: dwmac.10020000 address ff:ff:ff:ff:ff:ff illegal value

Autoboot in 2 seconds
BeagleV # reset
resetting ...
bootloader version:210430-44193cb
ddr 0x00000000, 1M test
ddr 0x00100000, 2M test
DDR clk 2133M,Version: 210501-a3eebc2
0 

Please ignore the version of ddrinit and bootloader.

rvs commented 3 years ago

Yup @MichaelZhuxx -- the default u-boot that came with the board:

U-Boot 2021.04-rc4-g5b63233bc6-dirty (Apr 08 2021 - 14:09:59 +0800)

CPU:   rv64imafdc
DRAM:  8 GiB
MMC:   sdio0@10000000: 0, sdio1@10010000: 1
Net:   dwmac.10020000
Autoboot in 2 seconds
MMC CD is 0x0, force to True.
MMC CD is 0x0, force to True.
switch to partitions #0, OK
mmc0 is current device

You saying I should just upgrade?

lbmeng commented 3 years ago

Yup @MichaelZhuxx -- the default u-boot that came with the board:

U-Boot 2021.04-rc4-g5b63233bc6-dirty (Apr 08 2021 - 14:09:59 +0800)

CPU:   rv64imafdc
DRAM:  8 GiB
MMC:   sdio0@10000000: 0, sdio1@10010000: 1
Net:   dwmac.10020000
Autoboot in 2 seconds
MMC CD is 0x0, force to True.
MMC CD is 0x0, force to True.
switch to partitions #0, OK
mmc0 is current device

You saying I should just upgrade?

I think so. The pre-flashed U-Boot does not support "reset" yet.

tgeek77 commented 3 years ago

Same issue here. This is what I see when rebooting (this is a repeating error. I never stops or reboots). I did a hardware reboot after 20 minutes.

[ 5527.919425] watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [systemd-shutdow:1]
[ 5527.957061] Modules linked in: xfs uas usb_storage nfsv3 nfs_acl rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace nfs_ssc fscache ip_set nfnetlink rfkill sunrpc [last unloaded: ip_tables]
[ 5528.005798] CPU: 0 PID: 1 Comm: systemd-shutdow Tainted: G        W    L    5.10.6+ #26
[ 5528.044619] epc: ffffffe000202908 ra : ffffffe000202908 sp : ffffffe080007d40
[ 5528.082647]  gp : ffffffe0018416a8 tp : ffffffe080011ac0 t0 : ffffffd004a6c110
[ 5528.120808]  t1 : 0000000000000000 t2 : ffffffe000ea9d88 s0 : ffffffe080007d60
[ 5528.159067]  s1 : 0000000000000000 a0 : 0000000000000000 a1 : 0000000200000022
[ 5528.197181]  a2 : 0000000000000001 a3 : 00000007cc45ad7b a4 : 0000000000001869
[ 5528.235032]  a5 : 0000000000000000 a6 : ffffffe000743172 a7 : ffffffffad55ad55
[ 5528.272488]  s2 : 0000000028121969 s3 : ffffffe001620820 s4 : fffffffffee1dead
[ 5528.309876]  s5 : ffffffe0018440c0 s6 : c26b0d3e623a1000 s7 : 0000003fed47d7f0
[ 5528.347192]  s8 : 0000000000000000 s9 : 00000000c138fd04 s10: fffffffffffff000
[ 5528.384566]  s11: 0000002ada6e7768 t3 : 0000000000000001 t4 : 0000000000000002
[ 5528.421601]  t5 : 0000000000000010 t6 : ffffffe080007a70
[ 5528.456772] status: 0000000200000120 badaddr: 0000000000000000 cause: 8000000000000005

I had a usb drive formatted with xfs and nfs mounted when I tried to reboot.

pdp7 commented 3 years ago

FYI - @Esmil has gotten TPS65086 restart working in their Linux 5.12 starlight branch working by configuring CONFIG_MFD_TPS65086 and CONFIG_POWER_RESET_TPS65086 along with:

See related linux issue: https://github.com/starfive-tech/linux/issues/8

jonathangray commented 3 years ago

Both U-Boot and OpenSBI attempt to use GPIO63 to do a reset. The device tree in U-Boot also describes using GPIO63 for restart and poweroff:

                gpio-restart {
                        compatible = "gpio-restart";
                        gpios = <0x0000000d 0x0000003f 0x00000000>;
                        phandle = <0x00000029>;
                };
                gpio-poweroff {
                        compatible = "gpio-poweroff";
                        gpios = <0x0000000d 0x0000003f 0x00000000>;
                        phandle = <0x0000002a>;
                };

but looking at https://github.com/beagleboard/beaglev-starlight/blob/main/BeagleV_v0.9.pdf there is GPIO63_GMAC_RESETN so the GPIO method was a holdout from a different design and doesn't work?

A watchdog is mentioned in https://github.com/starfive-tech/beaglev_doc/blob/main/JH7100%20Data%20Sheet%20V01.01.04-EN%20(4-21-2021).pdf as being located at 0x00_1248_0000 0x00_1248_FFFF but is not documented. That should be another option for reset if it were?

esmil commented 3 years ago

@jonathangray The way I made reboot work in the patches Drew linked above is that I simply tell the pmic to reset itself. The pmic has an output signal connected to the usb hub, ethernet phy and the soc reset lines, so resetting the pmic should pull those as well. Also the physical reset button already on the board is connected to "CTRL1" on the pmic, so I'm guessing this also just tells the pmic to reset itself.

mcd500 commented 3 years ago

FYI - @esmil has gotten TPS65086 restart working in their Linux 5.12 starlight branch working by configuring CONFIG_MFD_TPS65086 and CONFIG_POWER_RESET_TPS65086 along with:

* [riscv: dts: Add JH7100 and BeagleV Starlight support](https://github.com/esmil/linux/commit/792f73e655d52fd4db8041c94e59b6d11f8dab34)

* [power: reset: Add TPS65086 restart driver](https://github.com/esmil/linux/commit/4c4c1f23156d166d2eef87eec1b67e0a83a00eee)

* [[HACK] mfd: tps65086: make interrupt line optional](https://github.com/esmil/linux/commit/d3a76b14d14402a1b28e3a01b3c0b884c114bc68)

See related linux issue: starfive-tech/linux#8

It also require the new dts bellow for reboot working riscv: dts: Add JH7100 and BeagleV Starlight support

mcd500 commented 3 years ago

@tekkamanninja screenshot of when reboot working

[  172.914659] systemd-shutdown[1]: Detaching DM devices.
[  172.920474] systemd-shutdown[1]: All DM devices detached.
[  172.925998] systemd-shutdown[1]: All filesystems, swaps, loop devices and DM devices d.
[  173.284044] systemd-shutdown[1]: Syncing filesystems and block devices.
[  173.291311] systemd-shutdown[1]: Rebooting.
[  173.306069] reboot: Restarting system
[ bootloader version:210209-4547a8d
                                   ddr 0x00000000, 1M test
ddr 0x00100000, 2M test
DDR clk 2133M,Version: 210302-5aea32f
0 crc flash: 9a132612, crc ddr: 9a132612
                                        crc check PASSED

                                                        bootloader.

OpenSBI v0.9
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|
MichaelZhuxx commented 3 years ago

we found the reason why our board could reset and beta board couldnt is that the schmatic is updated. the beta board is remove the GPIO63 to trigger "CTRL1" on the pmic. Attached two version of schematic for your reference.

@esmil thanks. we will fix it.

BeagleV_v0.81.pdf BeagleV_v0.9.pdf

pdp7 commented 3 years ago

the PMIC restart driver is in https://github.com/starfive-tech/linux/issues/8 should be sufficient to allow the OS to reboot the board. the PCB issue is raised in https://github.com/beagleboard/beaglev-starlight/issues/16