mediatek: snfi: FM35Q1GA is x4-only and needs 12mA pin drive strength#7
mediatek: snfi: FM35Q1GA is x4-only and needs 12mA pin drive strength#7dangowrt wants to merge 52 commits intomtk-openwrt:mtksocfrom
Conversation
Add MediaTek-specific ignore entries Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Enable debug symbols for release build which will be convenient for debugging over JTAG. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add support to use prebuilt libraries for BL2 and BL31 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
This utility is used for adding a BootROM readable header for BL2 image. The BL2 image is directly loaded by the BootROM and supports RSA signing for secure boot. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add tools to generate anti-rollback table with an example Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
There's a situation that ROT_KEY(private) does not exist in building
environment, and thus signing is impossible during build stage.
This tool is used to sign certificate without knowing ROT_KEY
Since ROT_KEY is used to sign trusted_key.cert, we only need to make sure
trusted_key.crt is signed correctly.
This tool does the first, and third actions within following flow:
1. Extract sign body from trusted_key.cert
2. Sign body using ROT_KEY [Done by user after build]
3. Use signature to assemble new trusted_key.cert
4. use fiptool to generate new FIP image
Usage:
Extract sign body from trusted_key.crt:
signoffline -p [fip_public_key] -c [trusted_key.crt] \
-m [message to be signed]
Use signature to assemble new trusted_key.crt:
signoffline -p [fip_public_key] -c [trusted_key.crt] \
-s [signature] -o [new trusted_key.crt]
Signed-off-by: Tim-cy Yang <Tim-cy.Yang@mediatek.com>
Add GPT editor for generate GPT table for SD/eMMC Add single image (ROM dump image) making tool Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Some eMMC chips have wrong value of field spec_vers in CSD register. spec_vers is not checked by both linux kernel and u-boot. So it better to remove this check. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add support to poll card busy state for R1b command Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add oob_size field for nand framework Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Support more 4-byte address flashes Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add interface for gpio driver to change gpio mode Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
This patch adds UBI loading support for BL2. The main UBI code comes from u-boot (drivers/mtd/ubispl.c) with modifications. The original code permits BSD-3-Clause license. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add support for patching MBR with correct number of LBAs Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
The APSoC platform includes mt7622, mt7629, filogic chips and future chips. These common files are shared between all chips list above. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
The pmuv3_init_el3() add recently causes mt7629 hang in booting in bl32. Just disable it. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add NAND mapping block management (NMBM) common library. This library acts as a translation layer to hide bad blocks of a raw NAND device. It's very useful for factory production where data may shift due to bad blocks. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add xz-embedded-20210201 from https://tukaani.org/xz/embedded.html Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add support to compress images using xz Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
This patch adds a new bootloader stage named BL2PL (aka. BL2 preloader) to support BL2 compression. This stage only implements XZ decompression for BL2 payload, and the BL2 payload must be compressed by XZ with crc32 checksum support. To make use of this stage, a BL2PL specific image header must be added to the compressed BL2 payload to record its load address and size. Then this payload with header should be directly appended to the end of BL2PL raw binary without any padding. ------------------------------- | BL2PL | Header | XZ payload | ------------------------------- On startup, BL2PL will first relocate itself to On-Chip SRAM and setup the C environment, and then decompress the real BL2 to its load address, and finally jump to the real BL2. --------------------------------------------------------------- | Stage | On-Chip SRAM | L2 shared SRAM | --------------------------------------------------------------- | 1 | | BL2PL | XZ payload | --------------------------------------------------------------- | 2 | BL2PL | XZ payload | --------------------------------------------------------------- | 3 | BL2PL | BL2 | XZ payload | --------------------------------------------------------------- Also, add a tool named bl2plimage to generate BL2PL image header for XZ compressed BL2 payload. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
This patch adds a simple build option dependency checking mechanism, which makes changes of build options to take effect immediately without a clean. Currently we have many C macros defined in gcc command line by build options passed from the make command line. However in ATF build framework, the macros defined in gcc command line will not be treated as dependency, which means changes in those macros will not take effect to C source files using those macros. This mechanism is done by adding a dependency rule explictly for a specific source file, and the dependency rule is a new header file. Everytime before building, the mechanism writes all registered build options of a file to the dependency rule file. Once the build option is changed, the content of the dependency rule file will also be changed, which will trigger a rebuild of the source file. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
The Anti-Rollback mechanism of MediaTek uses NV-counter for the minimum allowed version, and discard the original purpose of NV-counter. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
The FSEK is used to help decrypt rootfs data. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add initial BL2/BL31 support for mt7622. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add DDR initialization support for mt7622 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add eFuse prebuilt library and relative SIP services for BL31 to allow BL33 to manipulate the eFuse features (SecureBoot, Anti-Rollback, ...) Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add basic anti-rollback framework for mt7622 (PATCH-v3) - Add ar_table tool which support parsing customer's version control xml file to generate auto-config file, and embeded those information into atf code - Modify platform.mk that allow us feed customer's version control xml file and build anti-rollback atf image in one step Usage: Add following parameters to make input: ANTI_ROLLBACK=1 ANTI_ROLLBACK_CONF=./ar_table_example.xml Add following make target to make input: ar_table For example: make PLAT=mt7622 BOOT_DEVICE=snand BROM_SIGN_KEY=/path/to/key \ BL33=/path/to/u-boot-binary MBEDTLS_DIR=/path/to/mbedtls \ TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 ROT_KEY=/path/to/key \ ANTI_ROLLBACK=1 ANTI_ROLLBACK_CONF=path/to/version-xml \ ar_table all fip Change since v2: - Fix multiple cert_tool --tfw-nvctr and --ntfw-nvctr parameters exist in the CERT_ARGS variable - Remove duplicate ar_table make target in platform.mk Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add build option dependency rules to make sure option changes take effect on .o files immediately to avoid cleaning current build. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add initial BL2/BL32 support for mt7629. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Add DDR initialization support for mt7629 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
It seems like we might need to adjust the pin driver strength to 12mA for Fidelix SPI-NAND chip on MT7622 to avoid SPI data corruption on some devices. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
In addition to FM35X1GA, also change the driver strength to 12mA for all chips where this is done by the old/legacy U-Boot: * Winbond 512Mb * Winbond 1Gb * Winbond 2Gb * GD5F4GQ4UBYIG * GD5F4GQ4UAYIG * GD5F1GQ4UX * GD5F1GQ4UE * GD5F2GQ4UX * GD5F2GQ4UE Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
@hackpascal Does the change suggested here generally look acceptable to you? Handling this "properly" in pinctrl/gpio driver looks a bit more complicated... |
Actually I want to add a simple pinctrl layer to make it "generic" :p |
|
@dangowrt I managed to buy a spi-nand flash DS35Q1GA. It seems to use exactly the same die that FM35Q1GA is using. |
|
@dangowrt @981213 @hackpascal if you are looking at driver strength on the SOC's I/O side, I would also look how it's configured on the SPI-NAND side (usually, by default it should be set to 100%). |
|
...and another brick with full debug log here: |
|
Hi @dangowrt
Since we use 0x84/0x34 for x1/x4 program load random data in Linux(https://elixir.bootlin.com/linux/latest/source/include/linux/mtd/spinand.h#L138), issues occur with such combination: FM35Q1GA(DS35Q1GA)+Uboot/Linux spi-mem framework. We observed the same thing on Foresee's F35SQA001G. I'm not 100% sure if the above issue has something to do with this ticket. But it indeed causes serious problems when we program NAND flash, and impacts further reading behavior. Here's dirty fix you may try (apply both to Uboot & Linux): to this: This is pretty dirty because it makes SPI controller unable to send 0x84/0x34. This is a big problem for SPI controllers which can't send data of page size(2K or 4K bytes) in one transfer. For example, if the SPI controller is capable to transfer only 512bytes with one command, it needs to issue 0x84/0x34 command four times to transfer 2K bytes data onto NAND flash's cache. |
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
Summarizing all discoveries I've opened a PR for openwrt.git to add all of that, in the hope that we can rescue users from OKD asap: |
Will this potentially prevent OKD even for devices that haven’t been OKD’ed? |
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Import pending patches to set pinconf settings for SPI-NAND pins on MT7622 identical to what the old proprietary preloader did. Should further increase the reliability of some SNFI-attached SPI-NAND flash chips. Link: mtk-openwrt/arm-trusted-firmware#7 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
7cc6b76 to
e090770
Compare
Dont allow x2 read and cache read operations on FM35Q1GA as they seem to be unstable. Also the Linux drivers does not allow x2 ops:
https://github.com/openwrt/openwrt/blob/main/target/linux/mediatek/patches-6.1/340-mtd-spinand-Add-support-for-the-Fidelix-FM35X1GA.patch#L49
We may need a similar fix for the U-Boot driver, though problems have not been observed there. However, we sporadically see bl2 failing to load fip for no apparent reason (ie. after the device was powered-off and working fine before, or after a reboot). The error then persists.
Also using UBI apparently didn't help
@hackpascal @nbd168