[PATCH RFC 13/15] sunxi: Implement spinand_ helpers

John Watts contact at jookia.org
Thu Apr 11 06:25:30 CEST 2024


These are used by NAND-aware loaders such as UBI.

Signed-off-by: John Watts <contact at jookia.org>
---
 arch/arm/mach-sunxi/spl_spi_sunxi.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c b/arch/arm/mach-sunxi/spl_spi_sunxi.c
index 602ebfe8c5..d6b03678d0 100644
--- a/arch/arm/mach-sunxi/spl_spi_sunxi.c
+++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c
@@ -450,6 +450,27 @@ static ulong spi_load_read_nand(struct spl_load_info *load, ulong sector,
 
 	return count;
 }
+
+void spinand_init(void)
+{
+	spi0_init();
+	spi0_nand_reset();
+}
+
+void spinand_deselect(void)
+{
+	spi0_deinit();
+}
+
+int spinand_spl_read_block(int block, int offset, int len, void *dst)
+{
+	ulong byte_offset = (block * CONFIG_SPL_SPINAND_BLOCK_SIZE) + offset;
+
+	spi_load_read_nand(NULL, byte_offset, len, dst);
+
+	return 0;
+}
+
 #endif
 
 /*****************************************************************************/

-- 
2.44.0



More information about the U-Boot mailing list