January 21, 2025

Antminer S9 board - U-boot - plan B NAND

My old U-boot looks this this when I fire it up in my board "C". I see exactly the same when I try it in board "A", so that board is fine with no hardware problem.
Xilinx First Stage Boot Loader
Release 2015.4	Mar 29 2018-17:25:31
.....
U-Boot 2014.01-gfb1d3e7-dirty (Mar 09 2018 - 19:36:04)
.....
---1 sys_sdram_size = 0x20000000
--- dram_init: sys_sdram_size = 512 MB

---3 gd->ram_size = 0x1f000000
Memory: ECC disabled
DRAM:  496 MiB
NAND:  256 MiB
MMC:   zynq_sdhci: 0
In:    serial
Out:   serial
Err:   serial
~~1 gd->ram_size = 0x1f000000
~~ board_late_init: ddr_size_type = 1
The important thing to note at present is the reported 256 MiB size for NAND. Also I see:
zynq-uboot> nand info

Device 0: nand0, sector size 128 KiB
  Page size      2048 b
  OOB size         64 b
  Erase size   131072 b

Another rebuild

I add this to the defconfig:
CONFIG_CMD_NAND=y
Then I look at some other defconfig files for NAND stuff. I see interesting things in zynq_zc770_xm011_defconfig, but I have them all already. I comment this out:
#CONFIG_NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS=y
This ends up failing to see NAND, we do have the "nand" commands now.

Our NAND chip is made by Micron, a 29F2G08ABxx. It is a 3.3 volt device with an 8 bit bus. It has what Micron calls an ONFI interface, which is "Open NAND flash interface".

This is still handled by the MTD driver in U-boot (and linux). See drivers/mtd/nand/raw. Some options to consider for future builds are:

CONFIG_SPL_NAND_SUPPORT=y
CONFIG_MTD_RAW_NAND=y
CONFIG_MTD=y
The place to look in the device tree is arch/arm/dts/zynq-7000.dtsi which has:
  nand0: flash@e1000000 {
                status = "disabled";
                compatible = "arm,pl353-nand-r2p1";
                reg = <0xe1000000 0x1000000>;
                #address-cells = <1>;
                #size-cells = <1>;
            };

First boot of Kyu using this u-boot build

We rebuild u-boot with the above changes:
make zztom_antminer_s9_defconfig
make
I try "nand info" with this build and get nothing.

I rebuild Kyu with a link address of 0, then try this new build. It is picking up the old load address of 0x10000000 from the uboot.env file! So I need to do:

setenv bootaddr 0x0
saveenv
boot
I see the message "Probing for amount of ram" and nothing more. We should see:
Probing for amount of ram
Found 512 M of ram
  ======================== We made it to kyu_startup!
....
So it is loading and launching Kyu, but Kyu has a problem in the business of probing for ram that doesn't play well with getting loaded at 0x0

This message comes from zynq/board.c in board_ram_init() which calls ram_probe(). This calls ram_probe() in armv7/ram.c -- and I will need to look this over. For now I can just set 512*MEG in board_ram_init(). This works and I now boot Kyu !!

I run the Dhrystone benchmark and get 33,311 Dhrystones per Second, which is still pretty miserable. My records indicate I got 1,092,000 Dhrystones per second on the BBB (running at 1Ghz).


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org