All of lore.kernel.org
 help / color / mirror / Atom feed
* Unable to lock flash
@ 2020-07-20 21:08 Michael Sander
  0 siblings, 0 replies; only message in thread
From: Michael Sander @ 2020-07-20 21:08 UTC (permalink / raw)
  To: linux-mtd

I am seeing the following failure:

root@localhost:~#  flash_unlock -i /dev/mtd0
flash_unlock: error!: could not check lock status device: /dev/mtd0

              error 95 (Operation not supported)

I can read and write the flash without any problems.

The kernel version is: 4.14.0-xilinx-v2018.3
I am using Petalinux on a Xilinx Zynq 7000 family SOC

dmesg is not showing any kernel errors associated with the call.

The MTD version is:
root@localhost:~# flash_unlock -V
flash_unlock (mtd-utils) 2.0.0

Looking at the source, it appears that the "95" error is from the
library call to the driver, and in the driver I see:

int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
    if (!mtd->_is_locked)
        return -EOPNOTSUPP;
    if (ofs < 0 || ofs >= mtd->size || len > mtd->size - ofs)
        return -EINVAL;
    if (!len)
        return 0;
    return mtd->_is_locked(mtd, ofs, len);
}
EXPORT_SYMBOL_GPL(mtd_is_locked);

So the driver appears to think the locking functionality is not supported.

The flash chip is a MT25QL128ABA8E12-1SIT which appears to support locking.

The device tree is as follows

&qspi {
        #address-cells = <1>;
        #size-cells = <0>;
        flash0: flash@0 {
                compatible = "n25q512a","micron,m25p80";
                reg = <0x0>;
                #address-cells = <1>;
                #size-cells = <1>;
                spi-max-frequency = <50000000>;
                /delete-node/ partition@qspi-fsbl-uboot;
                /delete-node/ partition@qspi-linux;
                /delete-node/ partition@qspi-device-tree;
                /delete-node/ partition@qspi-rootfs;
                /delete-node/ partition@qspi-bitstream;
                partition@0x00000000 {
                        label = "fs-boot";
                        reg = <0x00000000 0x00120000>;
                };
                partition@0x00120000 {
                        label = "fs-bootenv";
                        reg = <0x00120000 0x00020000>;
                };
                partition@0x00140000 {
                        label = "fs-kernel";
                        reg = <0x00140000 0x00d00000>;
                };
                partition@0x00e40000 {
                        label = "boot";
                        reg = <0x00e40000 0x00120000>;
                };
                partition@0x00f60000 {
                        label = "bootenv";
                        reg = <0x00f60000 0x00020000>;
                };
                partition@0x00f80000 {
                        label = "envshare";
                        reg = <0x00f80000 0x00010000>;
                };
                partition@0x00f90000 {
                        label = "spare";
                        reg = <0x00f90000 0x00070000>;
                };
        };
};

And mtdinfo is as follows, apologies, we have a few partitions set up.

root@localhost:~# mtdinfo -a
Count of MTD devices:           7
Present MTD devices:            mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6
Sysfs interface supported:      yes

mtd0
Name:                           fs-boot
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          18 (1179648 bytes, 1.1 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true

mtd1
Name:                           fs-bootenv
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          2 (131072 bytes, 128.0 KiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:2
Bad blocks are allowed:         false
Device is writable:             true

mtd2
Name:                           fs-kernel
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          208 (13631488 bytes, 13.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:4
Bad blocks are allowed:         false
Device is writable:             true

mtd3
Name:                           boot
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          18 (1179648 bytes, 1.1 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:6
Bad blocks are allowed:         false
Device is writable:             true

mtd4
Name:                           bootenv
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          2 (131072 bytes, 128.0 KiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:8
Bad blocks are allowed:         false
Device is writable:             true

mtd5
Name:                           envshare
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          1 (65536 bytes, 64.0 KiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:10
Bad blocks are allowed:         false
Device is writable:             true

mtd6
Name:                           spare
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          7 (458752 bytes, 448.0 KiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:12
Bad blocks are allowed:         false
Device is writable:             true

thanks,
-- 
Michael Sander
www.appliedlogix.com

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-20 21:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 21:08 Unable to lock flash Michael Sander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.