Re: Trying to get MTD_BLOCK to actually work
Heinrich Schuchardt <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
On 8/17/26 17:00, Mike Looijmans wrote: > What I'm trying to accomplish is to be able to read the kernel directly > from a squashfs partition in SPI NOR flash. > > This should have been simple, as SPI-NOR is an MTD device, and MTD_BLOCK > translates that to a block device, and squashfs needs a block device. > > The issue is that MTD_BLOCK adds some hooks, in particular "mtd_bind()" > but the only point where that ever gets called is from drivers/mtd/nand/ > spi/core.c > > So even though one activates CONFIG_MTD_BLOCK, no mtd device or > partition ever gets registered as a block device (unless you happen to > have a spi-nand controller, which, contrary to spi-nor, would be > unsuitable for a squashfs filesystem...) > > I tried doing the obvious, that is, copy and adapt the spi-nand code > into the spi-nor driver, see attached patch, but that doesn't have any > effect whatsoever. > > I tried similar things a few months ago, and also had a discussion here > on the list, but that sort of faded out without any further results... spi_flash_std_bind() is called before spi_flash_std_probe(). Setting plat->mtd in spi_flash_std_probe() will have no effect in the bind method. The mailing list has moved to [email protected]. Please, use scripts/get_maintainer.pl to find the maintainer of a specific U-Boot module. Best regards Heinrich > > Example session: > > zynq-uboot> mtd list > SF: Detected n25q256ax1 with page size 256 Bytes, erase size 64 KiB, > total 32 MiB > 0x000000000000-0x000000100000 : "qspi-boot-bin" > 0x000000100000-0x000002000000 : "qspi-rootfs" > List of MTD devices: > * nor0 > - device: flash@0 > - parent: spi@e000d000 > - driver: jedec_spi_nor > - path: /axi/spi@e000d000/flash@0 > - type: NOR flash > - block size: 0x10000 bytes > - min I/O: 0x1 bytes > - 0x000000000000-0x000002000000 : "nor0" > - 0x000000000000-0x000000100000 : "qspi-boot-bin" > - 0x000000100000-0x000002000000 : "qspi-rootfs" > zynq-uboot> lsblk > Block Driver Devices > ----------------------------- > mmc_blk : mmc 0 > mtd_blk : <none> > ubi_blk : <none> > usb_storage_blk : <none> > zynq-uboot> dm tree > Class Seq Probed Driver Name > ----------------------------------------------------------- > root 0 [ + ] root_driver root_driver > simple_bus 0 [ + ] simple_bus |-- axi > gpio 0 [ ] gpio_zynq | |-- gpio@e000a000 > i2c 0 [ ] i2c_cdns | |-- i2c@e0004000 > i2c 1 [ ] i2c_cdns | |-- i2c@e0005000 > gpio 1 [ ] pca953x | | `-- gpio@41 > serial 0 [ + ] serial_zynq | |-- serial@e0000000 > spi 0 [ + ] zynq_qspi | |-- spi@e000d000 > spi_flash 0 [ + ] jedec_spi_nor | | `-- flash@0 > mmc 0 [ + ] arasan_sdhci | |-- mmc@e0100000 > blk 0 [ ] mmc_blk | | |-- > [email protected] > bootdev 0 [ ] mmc_bootdev | | `-- > [email protected] > simple_bus 1 [ + ] simple_bus | |-- slcr@f8000000 > clk 0 [ + ] zynq_clk | | `-- clkc@100 > timer 0 [ + ] arm_twd_timer | |-- timer@f8f00600 > usb 0 [ ] ehci_zynq | `-- usb@e0002000 > bootstd 0 [ ] bootstd_drv `-- bootstd > bootmeth 0 [ ] bootmeth_extlinux `-- extlinux > >