Finish base docs for uboot

This commit is contained in:
Blizzard Finnegan 2025-03-15 17:56:19 -04:00
parent 96a60b452d
commit 4cc75cc561
Signed by: blizzardfinnegan
GPG key ID: 61C1E13067E0018E

View file

@ -66,15 +66,15 @@ call `clrsetbits_le32` with args
- `CLK_PERH_ROOT_MASK` (`0x1000000`)
- `BIT(CLK_PERH_ROOT_SHIFT) & CLK_PERH_ROOT_MASK` (`0x1000000`)
[3 more clearset calls]
lots of bitmanip, not worth interpreting
> Improved GMAC0 TX I/O PAD compatibility
[4 more clearset calls]
lots of bitmanip, not worth interpreting
> Improved GMAC1 TX I/O PAD compatibility
[4 more clearset calls]
lots of bitmanip, not worth interpreting
> Set GPIO to 3.3v
@ -112,7 +112,7 @@ clear bits 23 and 24 at address `SYS_CRG_BASE + CLK_RSTN_3_OFFSET` (`0x13020000
declare GPIO 43 as digital input
set GPIO 43 digital output (???) to `0x4f`
set DS (???) for GPIO 43 to 3
set drive strength for GPIO 43 to 3 (12mA)
set GPIO 42 as digital input
set GPIO 42 digital input (???) to `62`
@ -124,46 +124,230 @@ get the rtos base address and the offset, and if they both eist, call `spl_enabl
### `starfive_visionfive2.c` Functions
#### `sys_reset_clear`
clear the passed reset bit at the address `SYS_CRG_BASE` (`0x13020000`) + the passed assert
wait for the status register to change
#### `jh7110_timer_init`
lots of bitmanip, not worth interpreting
Enable APB, Timer0-Timer3 clocks
reset all timers
#### `jh7110_gmac_init_1000M`
init the given ethernet port at the given speed. lots of bitmanip, not worth interpreting
#### `jh7110_gmac_init_100M`
init the given ethernet port at the given speed. lots of bitmanip, not worth interpreting
#### `jh7110_gmac_sel_tx_to_rgmii`
init the ethernet port for common sub-gigabit comms (RGMII is best documented by Intel in their Cyclone V and Arria V SoC design guidelines)
#### `set_uboot_fdt_addr_env`
set envvar `uboot_fdt_addr` from the devicetree blob
#### `get_chip_type`
call `get_data_from_eeprom` to get the chip revision, then set the `chip_vision` envvar accordingly (a->A, b->B, other -> unknown). Also return type
#### `get_board_type`
call `get_pcb_revision_from_eeprfom` to get the board revision. Check the masked information for one of the 3 board versions
#### `jh7110_gmac_init`
If the passed chip type is A, do nothing. otherwise, set up the ethernet for RGMII for both ports
If the board type is `BOARD_1000M_100M`, init ethernet for `1000M` on port 0 and `100M` on port 1. Otherwise, use `1000M` for both.
#### `jh7110_usb_init`
USB init; more bit manip
#### `get_cpu_voltage_type`
read the binning offset of the chip, and adjust envvar `cpu_max_vol` to `1000000`, `1060000`, `1020000`; map to `0x08f0`, `0x0ff0`, and `0x0ef0` respectively
#### `jh7110_jtag_init`
JTAG init; bit manip
#### `jh7110_i2c_init`
If passed id is 5, set stuff up. Otherwise, don't do anything
#### `get_boot_mode`
check bits 1 and 2 against the value in `AON_IOMUX_BASE + AON_GPIO_DIN_REG` (`0x17020000 + 0x2c` = `0x1702002c`)
|Boot version | encoding | `bootmode` envvar | `devnum` envvar|
|---|---|---|---|
|FLASH | 0 | flash | 1 |
| SD | 1 | sd | 1|
| EMMC | 2 | emmc | 0|
|default|default|uart|1|
#### `jh7110_gpio_init`
pin 57 set to output enable, GPO of 0 (???), DIN (???) of 9. Drive strength set to 3, and pullup resistors
pin 58 set to output enable, GPO of 0 (???), DIN (???) of 10. Drive strength set to 3, and pullup resistors
#### `board_init`
enable cache
jtag init
timer init
usb init, primarily USB2
i2c init
gpio init
#### `board_late_init`
Get boot mode, and init gmac based on chip and board type
update `memory_addr` and `memory_size` envvars accordingly
Get the `UCLASS_VIDEO` device, and return early if fail
Display the logo provided to the screen, return quietly but early if fail
get the `opmsg_shmem` object from the devicetree. If this is successful, get the base from the devicetree. and if this exists, set the eth0addr and eth1addr envvars according to read mac addresses
#### `misc_init_r`
hardcoded mac addresses of `6c:cf:39:6c:de:ad` and `6c:cf:39:7c:ae:5d`
If the build config includes OTP (one-time programmable memory), try to read the mac address from the OTP first, and overwrite the hardcoded mac addresses
set the eth0addr and eth1addr based on mac address
get the chip name
set the envvar for uboot fdt address
if OTP, get cpu voltage type as well
#### `check_eeprom_dram_info`
Only exists if `CONFIG_ID_EEPROM` is set
only allow valid values of 1, 2, 4, 8, and 16
#### `resize_ddr_from_eeprom`
Only has behaviour if `CONFIG_ID_EEPROM` is set
Get the i2c device, return early if it doesn't init properly
get the memory size info from the eeprom, and check then return the RAM size
#### `board_ddr_size`
wrapper for `resize_ddr_from_eeprom`
### `visionfive2-i2c-eeprom.c` Functions
#### `is_match_magic`
stringcompare passed hats to hats signature
#### `calculate_crc16`
well commented and documented
#### `update_crc`
update CRC of passed eeprom atom
#### `dump_raw_eeprom`
display raw hex from eeprom
#### `hats_atom_crc_check`
check atom crc
#### `hats_get_atom`
iterate over atoms listed in header, check them. return the atom we're looking for
#### `show_eeprom`
print formatted eeprom contents
#### `parse_eeprom_info`
if correct: has_been_read set to 1, then display info
else: has_been_read set to -1, dump hex data to output
Get the atom `HATS_ATOM_VENDOR`, and if it exists, save the serialnumber
get the atom `HATS_ATOM_CUSTOM`, and if it exists, save PCB rev, BOM rev, MAC0, and MAC1 addresses
#### `read_eeprom`
check `has_been_read`, return immediately if it's set already; comms over i2c using `dm_i2c_read`
#### `prog_eeprom`
write eeprom from memory; comm over i2c.
check match magit from the given buffer. If it matches magic properly, write to board using `dm_i2c_write`
#### `set_mac_address`
check the mac address and save to the RAM-saved EEPROM copy, including update crc
#### `set_pcb_revision`
edit in-RAM EEPROM copy; update crc
#### `set_bom_revision`
set uppercase BOM revision to the in-RAM EEPROM copy; update crc
#### `set_product_id`
set product ID as string to the in-RAM EEPROM copy; update crc
#### `init_local_copy`
init in-memory EEPROM with magic number. Must be done to init blank eeprom or overwrite corrupted magic number
#### `print_usage`
print statement; does what it says on the tin
#### `do_mac`
???
#### `mac_read_from_eeprom`
dump eeprom to buffer
setup ethaddr envvars
setup serial# from eeprom ptsr
#### `get_pcb_revision_from_eeprom`
read the eeprom, and print the pcb revision
#### `get_data_from_eeprom`
direct memcpy for some data
---
# K1-X