[U-Boot] [PATCH v9 21/21] dm: zynq: microzed: Enable MTD/SPI-NOR

Jagan Teki jagan at openedev.com
Sun Oct 30 19:23:53 CET 2016


- Enable MTD driver model
- Enable cmd/mtd.c
- Enable SPI-NOR
- Enable MTD_ZYNQ_QSPI
- Add mtd1 alias for qspinor node
- Disable SPI_FLASH

Log:
----
Zynq> mtd
mtd - MTD Sub-system

Usage:
mtd list                        - show list of MTD devices
mtd info                        - show current MTD device info
mtd probe devnum                - probe the 'devnum' MTD device
mtd erase offset len            - erase 'len' bytes from 'offset'
mtd write addr to len           - write 'len' bytes to 'to' from 'addr'
mtd read addr from len          - read 'len' bytes from 'from' to 'addr'
Zynq> mtd list
MTD 1:  spi-nor at e000d000
Zynq>
MTD 1:  spi-nor at e000d000
Zynq> mtd list
MTD 1:  spi-nor at e000d000
Zynq> mtd probe 0
failing to set MTD device 0
Zynq> mtd probe 1
SPI-NOR: detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Zynq> mtd info
MTD Device 1: s25fl128s_64k
 Page size:     256 B
 Erase size:    64 KiB
 Size:          16 MiB
Zynq> mtd list
MTD 1:  spi-nor at e000d000  (active 1)
Zynq> mtd erase 0xE00000 0x100000
MTD: 1048576 bytes @ 0xe00000 Erased: OK
Zynq> mw.b 0x100 0xaa 0x100000
Zynq> mtd write 0x100 0xE00000 0x100000
device 0 offset 0xe00000, size 0x100000
MTD: 1048576 bytes @ 0xe00000 Written: OK
Zynq> mtd read 0x3000000 0xE00000 0x100000
device 0 offset 0xe00000, size 0x100000
MTD: 1048576 bytes @ 0xe00000 Read: OK
Zynq> cmp.b 0x3000000 0x100 0x100000
Total of 1048576 byte(s) were the same

Signed-off-by: Jagan Teki <jagan at openedev.com>
---
 arch/arm/dts/zynq-microzed.dts  |  6 ++++++
 configs/zynq_microzed_defconfig | 14 +++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/dts/zynq-microzed.dts b/arch/arm/dts/zynq-microzed.dts
index cb238cd..8f56f44 100644
--- a/arch/arm/dts/zynq-microzed.dts
+++ b/arch/arm/dts/zynq-microzed.dts
@@ -15,6 +15,7 @@
 	aliases {
 		serial0 = &uart1;
 		spi0 = &qspi;
+		mtd1 = &qspinor;
 		mmc0 = &sdhci0;
 	};
 
@@ -43,6 +44,11 @@
 	status = "okay";
 };
 
+&qspinor {
+	u-boot,dm-pre-reloc;
+	status = "okay";
+};
+
 &uart1 {
 	u-boot,dm-pre-reloc;
 	status = "okay";
diff --git a/configs/zynq_microzed_defconfig b/configs/zynq_microzed_defconfig
index ad0da0b..87bcbbb 100644
--- a/configs/zynq_microzed_defconfig
+++ b/configs/zynq_microzed_defconfig
@@ -11,6 +11,7 @@ CONFIG_SYS_PROMPT="Zynq> "
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_DFU=y
@@ -31,13 +32,16 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_ZYNQ_SDHCI=y
-CONFIG_SPI_FLASH=y
-CONFIG_SPI_FLASH_BAR=y
-CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_ZYNQ_GEM=y
 CONFIG_ZYNQ_QSPI=y
+CONFIG_MTD=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_ZYNQ_QSPI=y
+CONFIG_SPI_NOR_STMICRO=y
+CONFIG_SPI_NOR_SPANSION=y
+CONFIG_SPI_NOR_SST=y
+CONFIG_SPI_NOR_WINBOND=y
+CONFIG_SPI_NOR_MACRONIX=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_ULPI_VIEWPORT=y
-- 
2.7.4



More information about the U-Boot mailing list