[PATCH v4 00/13] Support OF_UPSTREAM for StarFive JH7110

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Nov 14 19:36:39 CET 2024


Am 14. November 2024 18:37:10 MEZ schrieb E Shattow <lucent at gmail.com>:
>Hi Anand,
>
>On Wed, Nov 13, 2024 at 8:42 PM Anand Moon <linux.amoon at gmail.com> wrote:
>>
>> Hi Hal,
>>
>> On Mon, 11 Nov 2024 at 07:53, Hal Feng <hal.feng at starfivetech.com> wrote:
>> >
>> > This patchset add OF_UPSTREAM support for StarFive JH7110 based boards.
>> > All the JH7110 based boards can use the DT from upstreaming linux kernel.
>> > The v1.3b board device tree is set as the default device tree. Support
>> > CONFIG_MULTI_DTB_FIT and the SPL selects the correct U-Boot dtb using the
>> > EEPROM information.
>> >
>>
>> I am encountering an issue with my Milk-V CM. I am unable to use the
>> SD card with the CM4 IO board.
>> The onboard SPI switch does not support a boot configuration switch,
>> so the default boot is set to eMMC.
>
>Mars CM and Mars CM Lite are not able to boot from eMMC and SD Card.
>There is transistor logic on Mars CM and Mars CM Lite which only
>allows UART or SPI NOR Flash depending on the state of nRPIBOOT.
>
>Perhaps you are thinking of SPI NOR Flash boot of JH7110 which is
>jumping execution to SPI NOR Flash offset 0 where, presumed it is
>where you have U-Boot SPL?
>
>From then U-Boot SPL may load U-Boot Main payload depending on the
>state of configuration switch, so then UART for UART setting, or SPI
>NOR Flash at 0x100000 offset for SPI NOR Flash setting.

The switch controls from where SPL is loaded by the boot ROM. It is not difficult to let SPL try loading main U-Boot from multiple different sources like SD-card and NVMe should this be desired. Cf. https://docs.u-boot.org/en/latest/usage/spl_boot.html#target-binaries. But that is beyond the scope of this series.

Best regards

Heinrich

>
>U-Boot Main may then execute as normal including SD Card or eMMC. This
>is distinct from the concept of JH7110 zeroth boot loader in mask ROM
>loading from SD Card or eMMC.
>
>>
>> Please suggest a method to flash an image onto the eMMC on the CM board.
>
>This will not work with the OF_UPSTREAM patch set of topic (yet)
>because simply Mars CM and Mars CM Lite devicetree do not exist
>upstream.
>
>You may use U-Boot stable release v2024.10 as a recovery tool to flash
>U-Boot v2024.10 into SPI NOR Flash which, exclusive of this
>OF_UPSTREAM patch series, has some runtime fix-up adjusting the Milk-V
>Mars devicetree for Mars CM or Mars CM Lite depending on EEPROM
>content.
>
>For that to work you will also need to verify and perhaps adjust the
>EEPROM content of your Mars CM for accuracy per the advisory from
>Milk-V; from what information you have shared you may have a 4GB RAM
>model with 16GB eMMC and if that is accurate then no change to the
>EEPROM content is needed.
>
>When you have for example U-Boot v2024.10 installed to SPI NOR Flash
>and it does have the fix-up at runtime to allow functional eMMC, then
>you may use any of the methods available to that version of U-Boot:
>
>1. You can load data from TFTP to DRAM address for write operation
>onto the eMMC directly but you will have to invent some scripting to
>do the required math between byte counts and block unit offsets.
>2. You can load an OS from TFTP to DRAM and boot; for example the
>Debian debian-installer netinst Linux kernel and initial ramdisk.
>3. There is not any working JH7110 on-CPU USB driver in U-Boot
>v2024.10 so the use of USB (as a reasonable person would attempt) is
>not possible. Patches exist for this and is something that will be
>possible in future but not yet. You will note that if your Mars CM is
>installed to a carrier board that has additionally a VL805 USB
>controller on the PCI bus then USB may actually work because the
>VisionFive2 has this same PCI+VL805 for USB. It is not typical though
>for CM4 carrier boards... but I recall reading that they do exist so
>worth a mention here.
>
>>
>> I have tried the instructions to update the firmware using
>> [1] https://milkv.io/docs/mars/compute-module/boot
>
>Milk-V USB flash tool at the link loads a closed-source SPL binary via
>JH7110 UART configuration that postures as a USB endpoint (using the
>JH7110 on-CPU USB function) and the companion software that talks to
>it is "compiled" closed-source python. Make your own conclusion...
>mine is that U-Boot+TFTP is good enough and preferentially it is open
>source.
>
>See:
>
>https://docs.u-boot.org/en/v2024.10/board/starfive/milk-v_mars_cm.html
>
>https://github.com/geerlingguy/sbc-reviews/issues/22#issuecomment-1908676618
>
>https://milkv.io/docs/mars/compute-module/update-eeprom
>
>>
>> Thank you so much for your help.
>>
>> Thanks
>> -Anand
>>
>> --------EEPROM INFO--------
>> Vendor : MILK-V
>> Product full SN: MARC-V10-2340-D004E016-00000812
>> data version: 0x2
>> PCB revision: 0xc1
>> BOM revision: A
>> Ethernet MAC0 address: 6c:cf:39:00:85:6b
>> Ethernet MAC1 address: 6c:cf:39:00:85:6c
>> --------EEPROM INFO--------
>>
>> starfive_7110_pcie pcie at 940000000: Starfive PCIe bus probed.
>> starfive_7110_pcie pcie at 9c0000000: Starfive PCIe bus probed.
>> In:    serial at 10000000
>> Out:   serial at 10000000
>> Err:   serial at 10000000
>> Net:   Could not fetch index
>> Could not fetch index
>> eqos_probe_resources() failed: -22
>> Could not fetch index
>> eqos_probe_resources() failed: -22
>> eth1: ethernet at 16040000
>> starting USB...
>> Bus xhci_pci: Register 5000420 NbrPorts 5
>> Starting the controller
>> USB XHCI 1.00
>> scanning bus xhci_pci for devices... Resetting EP 0...
>> 3 USB Device(s) found
>>        scanning usb for storage devices... 1 Storage Device(s) found
>> Working FDT set to ff725a10
>> Hit any key to stop autoboot:  0
>> StarFive # mmc info
>> Device: mmc at 16010000
>> Manufacturer ID: 15
>> OEM: 0
>> Name: AJTD4R
>> Bus Speed: 45333334
>> Mode: MMC High Speed (52MHz)
>> Rd Block Len: 512
>> MMC version 5.1
>> High Capacity: Yes
>> Capacity: 14.6 GiB
>> Bus Width: 8-bit
>> Erase Group Size: 512 KiB
>> HC WP Group Size: 8 MiB
>> User Capacity: 14.6 GiB WRREL
>> Boot Capacity: 4 MiB ENH
>> RPMB Capacity: 4 MiB ENH
>> Boot area 0 is not write protected
>> Boot area 1 is not write protected
>> StarFive # mmc rescan
>> StarFive # mmc rescan
>> StarFive #
>> StarFive # mmc part
>> ## Unknown partition table type 0
>
>I will say on-topic that although it is a regression in functionality
>for U-Boot from the v2024.10 stable release to apply OF_UPSTREAM
>series, the absence of Mars CM and Mars CM Lite should not be blockers
>for OF_UPSTREAM patch set. It is time to submit these upstream (to
>Linux kernel) which is not our problem here, and besides this there
>are more JH7110 board support devicetree being accepted upstream which
>are not represented here now. The missing functionality will be
>restored after this is done.
>
>All users who want to have working Mars CM and Mars CM Lite should
>stay with U-Boot stable version v2024.10, and to focus on contributing
>with Linux upstream for these boards.
>
>-E



More information about the U-Boot mailing list