Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'spi-nor/for-6.8' into mtd/next

SPI NOR comes with die erase support for multi die flashes, with new
octal protocols (1-1-8 and 1-8-8) parsed from SFDP and with an updated
documentation about what the contributors shall consider when proposing
flash additions or updates. Michael Walle stepped out from the reviewer
role to maintainer.

+422 -171
+3
Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
··· 25 25 Contact: linux-mtd@lists.infradead.org 26 26 Description: (RO) Part name of the SPI NOR flash. 27 27 28 + The attribute is optional. User space should not rely on 29 + it to be present or even correct. Instead, user space 30 + should read the jedec_id attribute. 28 31 29 32 What: /sys/bus/spi/devices/.../spi-nor/sfdp 30 33 Date: April 2021
+189 -49
Documentation/driver-api/mtd/spi-nor.rst
··· 2 2 SPI NOR framework 3 3 ================= 4 4 5 - Part I - Why do we need this framework? 6 - --------------------------------------- 5 + How to propose a new flash addition 6 + ----------------------------------- 7 7 8 - SPI bus controllers (drivers/spi/) only deal with streams of bytes; the bus 9 - controller operates agnostic of the specific device attached. However, some 10 - controllers (such as Freescale's QuadSPI controller) cannot easily handle 11 - arbitrary streams of bytes, but rather are designed specifically for SPI NOR. 8 + Most SPI NOR flashes comply with the JEDEC JESD216 9 + Serial Flash Discoverable Parameter (SFDP) standard. SFDP describes 10 + the functional and feature capabilities of serial flash devices in a 11 + standard set of internal read-only parameter tables. 12 12 13 - In particular, Freescale's QuadSPI controller must know the NOR commands to 14 - find the right LUT sequence. Unfortunately, the SPI subsystem has no notion of 15 - opcodes, addresses, or data payloads; a SPI controller simply knows to send or 16 - receive bytes (Tx and Rx). Therefore, we must define a new layering scheme under 17 - which the controller driver is aware of the opcodes, addressing, and other 18 - details of the SPI NOR protocol. 13 + The SPI NOR driver queries the SFDP tables in order to determine the 14 + flash's parameters and settings. If the flash defines the SFDP tables 15 + it's likely that you won't need a flash entry at all, and instead 16 + rely on the generic flash driver which probes the flash solely based 17 + on its SFDP data. All one has to do is to specify the "jedec,spi-nor" 18 + compatible in the device tree. 19 19 20 - Part II - How does the framework work? 21 - -------------------------------------- 20 + There are cases however where you need to define an explicit flash 21 + entry. This typically happens when the flash has settings or support 22 + that is not covered by the SFDP tables (e.g. Block Protection), or 23 + when the flash contains mangled SFDP data. If the later, one needs 24 + to implement the ``spi_nor_fixups`` hooks in order to amend the SFDP 25 + parameters with the correct values. 22 26 23 - This framework just adds a new layer between the MTD and the SPI bus driver. 24 - With this new layer, the SPI NOR controller driver does not depend on the 25 - m25p80 code anymore. 27 + Minimum testing requirements 28 + ----------------------------- 26 29 27 - Before this framework, the layer is like:: 30 + Do all the tests from below and paste them in the commit's comments 31 + section, after the ``---`` marker. 28 32 29 - MTD 30 - ------------------------ 31 - m25p80 32 - ------------------------ 33 - SPI bus driver 34 - ------------------------ 35 - SPI NOR chip 33 + 1) Specify the controller that you used to test the flash and specify 34 + the frequency at which the flash was operated, e.g.:: 36 35 37 - After this framework, the layer is like:: 36 + This flash is populated on the X board and was tested at Y 37 + frequency using the Z (put compatible) SPI controller. 38 38 39 - MTD 40 - ------------------------ 41 - SPI NOR framework 42 - ------------------------ 43 - m25p80 44 - ------------------------ 45 - SPI bus driver 46 - ------------------------ 47 - SPI NOR chip 39 + 2) Dump the sysfs entries and print the md5/sha1/sha256 SFDP checksum:: 48 40 49 - With the SPI NOR controller driver (Freescale QuadSPI), it looks like:: 41 + root@1:~# cat /sys/bus/spi/devices/spi0.0/spi-nor/partname 42 + sst26vf064b 43 + root@1:~# cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 44 + bf2643 45 + root@1:~# cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer 46 + sst 47 + root@1:~# xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 48 + 53464450060102ff00060110300000ff81000106000100ffbf0001180002 49 + 0001fffffffffffffffffffffffffffffffffd20f1ffffffff0344eb086b 50 + 083b80bbfeffffffffff00ffffff440b0c200dd80fd810d820914824806f 51 + 1d81ed0f773830b030b0f7ffffff29c25cfff030c080ffffffffffffffff 52 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 53 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 54 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 55 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 56 + ffffffffffffffffffffffffffffffffff0004fff37f0000f57f0000f9ff 57 + 7d00f57f0000f37f0000ffffffffffffffffffffffffffffffffffffffff 58 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 59 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 60 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 61 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 62 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 63 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 64 + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 65 + ffffbf2643ffb95ffdff30f260f332ff0a122346ff0f19320f1919ffffff 66 + ffffffff00669938ff05013506040232b03072428de89888a585c09faf5a 67 + ffff06ec060c0003080bffffffffff07ffff0202ff060300fdfd040700fc 68 + 0300fefe0202070e 69 + root@1:~# sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 70 + 428f34d0461876f189ac97f93e68a05fa6428c6650b3b7baf736a921e5898ed1 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 50 71 51 - MTD 52 - ------------------------ 53 - SPI NOR framework 54 - ------------------------ 55 - fsl-quadSPI 56 - ------------------------ 57 - SPI NOR chip 72 + Please dump the SFDP tables using ``xxd -p``. It enables us to do 73 + the reverse operation and convert the hexdump to binary with 74 + ``xxd -rp``. Dumping the SFDP data with ``hexdump -Cv`` is accepted, 75 + but less desirable. 58 76 59 - Part III - How can drivers use the framework? 60 - --------------------------------------------- 77 + 3) Dump debugfs data:: 61 78 62 - The main API is spi_nor_scan(). Before you call the hook, a driver should 63 - initialize the necessary fields for spi_nor{}. Please see 64 - drivers/mtd/spi-nor/spi-nor.c for detail. Please also refer to spi-fsl-qspi.c 65 - when you want to write a new driver for a SPI NOR controller. 79 + root@1:~# cat /sys/kernel/debug/spi-nor/spi0.0/capabilities 80 + Supported read modes by the flash 81 + 1S-1S-1S 82 + opcode 0x03 83 + mode cycles 0 84 + dummy cycles 0 85 + 1S-1S-1S (fast read) 86 + opcode 0x0b 87 + mode cycles 0 88 + dummy cycles 8 89 + 1S-1S-2S 90 + opcode 0x3b 91 + mode cycles 0 92 + dummy cycles 8 93 + 1S-2S-2S 94 + opcode 0xbb 95 + mode cycles 4 96 + dummy cycles 0 97 + 1S-1S-4S 98 + opcode 0x6b 99 + mode cycles 0 100 + dummy cycles 8 101 + 1S-4S-4S 102 + opcode 0xeb 103 + mode cycles 2 104 + dummy cycles 4 105 + 4S-4S-4S 106 + opcode 0x0b 107 + mode cycles 2 108 + dummy cycles 4 109 + 110 + Supported page program modes by the flash 111 + 1S-1S-1S 112 + opcode 0x02 113 + 114 + root@1:~# cat /sys/kernel/debug/spi-nor/spi0.0/params 115 + name sst26vf064b 116 + id bf 26 43 bf 26 43 117 + size 8.00 MiB 118 + write size 1 119 + page size 256 120 + address nbytes 3 121 + flags HAS_LOCK | HAS_16BIT_SR | SOFT_RESET | SWP_IS_VOLATILE 122 + 123 + opcodes 124 + read 0xeb 125 + dummy cycles 6 126 + erase 0x20 127 + program 0x02 128 + 8D extension none 129 + 130 + protocols 131 + read 1S-4S-4S 132 + write 1S-1S-1S 133 + register 1S-1S-1S 134 + 135 + erase commands 136 + 20 (4.00 KiB) [0] 137 + d8 (8.00 KiB) [1] 138 + d8 (32.0 KiB) [2] 139 + d8 (64.0 KiB) [3] 140 + c7 (8.00 MiB) 141 + 142 + sector map 143 + region (in hex) | erase mask | flags 144 + ------------------+------------+---------- 145 + 00000000-00007fff | [01 ] | 146 + 00008000-0000ffff | [0 2 ] | 147 + 00010000-007effff | [0 3] | 148 + 007f0000-007f7fff | [0 2 ] | 149 + 007f8000-007fffff | [01 ] | 150 + 151 + 4) Use `mtd-utils <https://git.infradead.org/mtd-utils.git>`__ 152 + and verify that erase, read and page program operations work fine:: 153 + 154 + root@1:~# dd if=/dev/urandom of=./spi_test bs=1M count=2 155 + 2+0 records in 156 + 2+0 records out 157 + 2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.848566 s, 2.5 MB/s 158 + 159 + root@1:~# mtd_debug erase /dev/mtd0 0 2097152 160 + Erased 2097152 bytes from address 0x00000000 in flash 161 + 162 + root@1:~# mtd_debug read /dev/mtd0 0 2097152 spi_read 163 + Copied 2097152 bytes from address 0x00000000 in flash to spi_read 164 + 165 + root@1:~# hexdump spi_read 166 + 0000000 ffff ffff ffff ffff ffff ffff ffff ffff 167 + * 168 + 0200000 169 + 170 + root@1:~# sha256sum spi_read 171 + 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 172 + 173 + root@1:~# mtd_debug write /dev/mtd0 0 2097152 spi_test 174 + Copied 2097152 bytes from spi_test to address 0x00000000 in flash 175 + 176 + root@1:~# mtd_debug read /dev/mtd0 0 2097152 spi_read 177 + Copied 2097152 bytes from address 0x00000000 in flash to spi_read 178 + 179 + root@1:~# sha256sum spi* 180 + c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8 spi_read 181 + c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8 spi_test 182 + 183 + If the flash comes erased by default and the previous erase was ignored, 184 + we won't catch it, thus test the erase again:: 185 + 186 + root@1:~# mtd_debug erase /dev/mtd0 0 2097152 187 + Erased 2097152 bytes from address 0x00000000 in flash 188 + 189 + root@1:~# mtd_debug read /dev/mtd0 0 2097152 spi_read 190 + Copied 2097152 bytes from address 0x00000000 in flash to spi_read 191 + 192 + root@1:~# sha256sum spi* 193 + 4bda3a28f4ffe603c0ec1258c0034d65a1a0d35ab7bd523a834608adabf03cc5 spi_read 194 + c444216a6ba2a4a66cccd60a0dd062bce4b865dd52b200ef5e21838c4b899ac8 spi_test 195 + 196 + Dump some other relevant data:: 197 + 198 + root@1:~# mtd_debug info /dev/mtd0 199 + mtd.type = MTD_NORFLASH 200 + mtd.flags = MTD_CAP_NORFLASH 201 + mtd.size = 8388608 (8M) 202 + mtd.erasesize = 4096 (4K) 203 + mtd.writesize = 1 204 + mtd.oobsize = 0 205 + regions = 0
+4 -4
MAINTAINERS
··· 9045 9045 F: tools/testing/selftests/gpio/ 9046 9046 9047 9047 GPIO REGMAP 9048 - M: Michael Walle <michael@walle.cc> 9048 + M: Michael Walle <mwalle@kernel.org> 9049 9049 S: Maintained 9050 9050 F: drivers/gpio/gpio-regmap.c 9051 9051 F: include/linux/gpio/regmap.h ··· 19901 19901 F: drivers/usb/misc/sisusbvga/ 19902 19902 19903 19903 SL28 CPLD MFD DRIVER 19904 - M: Michael Walle <michael@walle.cc> 19904 + M: Michael Walle <mwalle@kernel.org> 19905 19905 S: Maintained 19906 19906 F: Documentation/devicetree/bindings/gpio/kontron,sl28cpld-gpio.yaml 19907 19907 F: Documentation/devicetree/bindings/hwmon/kontron,sl28cpld-hwmon.yaml ··· 19916 19916 F: drivers/watchdog/sl28cpld_wdt.c 19917 19917 19918 19918 SL28 VPD NVMEM LAYOUT DRIVER 19919 - M: Michael Walle <michael@walle.cc> 19919 + M: Michael Walle <mwalle@kernel.org> 19920 19920 S: Maintained 19921 19921 F: Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml 19922 19922 F: drivers/nvmem/layouts/sl28vpd.c ··· 20426 20426 SPI NOR SUBSYSTEM 20427 20427 M: Tudor Ambarus <tudor.ambarus@linaro.org> 20428 20428 M: Pratyush Yadav <pratyush@kernel.org> 20429 - R: Michael Walle <michael@walle.cc> 20429 + M: Michael Walle <mwalle@kernel.org> 20430 20430 L: linux-mtd@lists.infradead.org 20431 20431 S: Maintained 20432 20432 W: http://www.linux-mtd.infradead.org/
+7 -9
drivers/mtd/spi-nor/atmel.c
··· 16 16 * is to unlock the whole flash array on startup. Therefore, we have to support 17 17 * exactly this operation. 18 18 */ 19 - static int at25fs_nor_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) 19 + static int at25fs_nor_lock(struct spi_nor *nor, loff_t ofs, u64 len) 20 20 { 21 21 return -EOPNOTSUPP; 22 22 } 23 23 24 - static int at25fs_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) 24 + static int at25fs_nor_unlock(struct spi_nor *nor, loff_t ofs, u64 len) 25 25 { 26 26 int ret; 27 27 ··· 37 37 return ret; 38 38 } 39 39 40 - static int at25fs_nor_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) 40 + static int at25fs_nor_is_locked(struct spi_nor *nor, loff_t ofs, u64 len) 41 41 { 42 42 return -EOPNOTSUPP; 43 43 } ··· 69 69 * Return: 0 on success, -error otherwise. 70 70 */ 71 71 static int atmel_nor_set_global_protection(struct spi_nor *nor, loff_t ofs, 72 - uint64_t len, bool is_protect) 72 + u64 len, bool is_protect) 73 73 { 74 74 int ret; 75 75 u8 sr; ··· 118 118 return spi_nor_write_sr(nor, nor->bouncebuf, 1); 119 119 } 120 120 121 - static int atmel_nor_global_protect(struct spi_nor *nor, loff_t ofs, 122 - uint64_t len) 121 + static int atmel_nor_global_protect(struct spi_nor *nor, loff_t ofs, u64 len) 123 122 { 124 123 return atmel_nor_set_global_protection(nor, ofs, len, true); 125 124 } 126 125 127 - static int atmel_nor_global_unprotect(struct spi_nor *nor, loff_t ofs, 128 - uint64_t len) 126 + static int atmel_nor_global_unprotect(struct spi_nor *nor, loff_t ofs, u64 len) 129 127 { 130 128 return atmel_nor_set_global_protection(nor, ofs, len, false); 131 129 } 132 130 133 131 static int atmel_nor_is_global_protected(struct spi_nor *nor, loff_t ofs, 134 - uint64_t len) 132 + u64 len) 135 133 { 136 134 int ret; 137 135
+96 -74
drivers/mtd/spi-nor/core.c
··· 1060 1060 } 1061 1061 1062 1062 /** 1063 - * spi_nor_erase_chip() - Erase the entire flash memory. 1063 + * spi_nor_erase_die() - Erase the entire die. 1064 1064 * @nor: pointer to 'struct spi_nor'. 1065 + * @addr: address of the die. 1066 + * @die_size: size of the die. 1065 1067 * 1066 1068 * Return: 0 on success, -errno otherwise. 1067 1069 */ 1068 - static int spi_nor_erase_chip(struct spi_nor *nor) 1070 + static int spi_nor_erase_die(struct spi_nor *nor, loff_t addr, size_t die_size) 1069 1071 { 1072 + bool multi_die = nor->mtd.size != die_size; 1070 1073 int ret; 1071 1074 1072 - dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd.size >> 10)); 1075 + dev_dbg(nor->dev, " %lldKiB\n", (long long)(die_size >> 10)); 1073 1076 1074 1077 if (nor->spimem) { 1075 - struct spi_mem_op op = SPI_NOR_CHIP_ERASE_OP; 1078 + struct spi_mem_op op = 1079 + SPI_NOR_DIE_ERASE_OP(nor->params->die_erase_opcode, 1080 + nor->addr_nbytes, addr, multi_die); 1076 1081 1077 1082 spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); 1078 1083 1079 1084 ret = spi_mem_exec_op(nor->spimem, &op); 1080 1085 } else { 1086 + if (multi_die) 1087 + return -EOPNOTSUPP; 1088 + 1081 1089 ret = spi_nor_controller_ops_write_reg(nor, 1082 1090 SPINOR_OP_CHIP_ERASE, 1083 1091 NULL, 0); ··· 1800 1792 return ret; 1801 1793 } 1802 1794 1795 + static int spi_nor_erase_dice(struct spi_nor *nor, loff_t addr, 1796 + size_t len, size_t die_size) 1797 + { 1798 + unsigned long timeout; 1799 + int ret; 1800 + 1801 + /* 1802 + * Scale the timeout linearly with the size of the flash, with 1803 + * a minimum calibrated to an old 2MB flash. We could try to 1804 + * pull these from CFI/SFDP, but these values should be good 1805 + * enough for now. 1806 + */ 1807 + timeout = max(CHIP_ERASE_2MB_READY_WAIT_JIFFIES, 1808 + CHIP_ERASE_2MB_READY_WAIT_JIFFIES * 1809 + (unsigned long)(nor->mtd.size / SZ_2M)); 1810 + 1811 + do { 1812 + ret = spi_nor_lock_device(nor); 1813 + if (ret) 1814 + return ret; 1815 + 1816 + ret = spi_nor_write_enable(nor); 1817 + if (ret) { 1818 + spi_nor_unlock_device(nor); 1819 + return ret; 1820 + } 1821 + 1822 + ret = spi_nor_erase_die(nor, addr, die_size); 1823 + 1824 + spi_nor_unlock_device(nor); 1825 + if (ret) 1826 + return ret; 1827 + 1828 + ret = spi_nor_wait_till_ready_with_timeout(nor, timeout); 1829 + if (ret) 1830 + return ret; 1831 + 1832 + addr += die_size; 1833 + len -= die_size; 1834 + 1835 + } while (len); 1836 + 1837 + return 0; 1838 + } 1839 + 1803 1840 /* 1804 1841 * Erase an address range on the nor chip. The address range may extend 1805 1842 * one or more erase sectors. Return an error if there is a problem erasing. ··· 1852 1799 static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) 1853 1800 { 1854 1801 struct spi_nor *nor = mtd_to_spi_nor(mtd); 1855 - u32 addr, len; 1856 - uint32_t rem; 1802 + u8 n_dice = nor->params->n_dice; 1803 + bool multi_die_erase = false; 1804 + u32 addr, len, rem; 1805 + size_t die_size; 1857 1806 int ret; 1858 1807 1859 1808 dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr, ··· 1870 1815 addr = instr->addr; 1871 1816 len = instr->len; 1872 1817 1818 + if (n_dice) { 1819 + die_size = div_u64(mtd->size, n_dice); 1820 + if (!(len & (die_size - 1)) && !(addr & (die_size - 1))) 1821 + multi_die_erase = true; 1822 + } else { 1823 + die_size = mtd->size; 1824 + } 1825 + 1873 1826 ret = spi_nor_prep_and_lock_pe(nor, instr->addr, instr->len); 1874 1827 if (ret) 1875 1828 return ret; 1876 1829 1877 - /* whole-chip erase? */ 1878 - if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) { 1879 - unsigned long timeout; 1880 - 1881 - ret = spi_nor_lock_device(nor); 1882 - if (ret) 1883 - goto erase_err; 1884 - 1885 - ret = spi_nor_write_enable(nor); 1886 - if (ret) { 1887 - spi_nor_unlock_device(nor); 1888 - goto erase_err; 1889 - } 1890 - 1891 - ret = spi_nor_erase_chip(nor); 1892 - spi_nor_unlock_device(nor); 1893 - if (ret) 1894 - goto erase_err; 1895 - 1896 - /* 1897 - * Scale the timeout linearly with the size of the flash, with 1898 - * a minimum calibrated to an old 2MB flash. We could try to 1899 - * pull these from CFI/SFDP, but these values should be good 1900 - * enough for now. 1901 - */ 1902 - timeout = max(CHIP_ERASE_2MB_READY_WAIT_JIFFIES, 1903 - CHIP_ERASE_2MB_READY_WAIT_JIFFIES * 1904 - (unsigned long)(mtd->size / SZ_2M)); 1905 - ret = spi_nor_wait_till_ready_with_timeout(nor, timeout); 1830 + /* chip (die) erase? */ 1831 + if ((len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) || 1832 + multi_die_erase) { 1833 + ret = spi_nor_erase_dice(nor, addr, len, die_size); 1906 1834 if (ret) 1907 1835 goto erase_err; 1908 1836 ··· 2184 2146 if (is_power_of_2(page_size)) { 2185 2147 page_offset = addr & (page_size - 1); 2186 2148 } else { 2187 - uint64_t aux = addr; 2149 + u64 aux = addr; 2188 2150 2189 2151 page_offset = do_div(aux, page_size); 2190 2152 } ··· 2888 2850 nor->flags |= SNOR_F_HAS_SR_BP3_BIT6; 2889 2851 } 2890 2852 2891 - if (flags & NO_CHIP_ERASE) 2892 - nor->flags |= SNOR_F_NO_OP_CHIP_ERASE; 2893 - 2894 2853 if (flags & SPI_NOR_RWW && nor->params->n_banks > 1 && 2895 2854 !nor->controller_ops) 2896 2855 nor->flags |= SNOR_F_RWW; ··· 2932 2897 return ret; 2933 2898 } 2934 2899 2900 + /* Needed by some flashes late_init hooks. */ 2901 + spi_nor_init_flags(nor); 2902 + 2935 2903 if (nor->info->fixups && nor->info->fixups->late_init) { 2936 2904 ret = nor->info->fixups->late_init(nor); 2937 2905 if (ret) 2938 2906 return ret; 2939 2907 } 2940 2908 2909 + if (!nor->params->die_erase_opcode) 2910 + nor->params->die_erase_opcode = SPINOR_OP_CHIP_ERASE; 2911 + 2941 2912 /* Default method kept for backward compatibility. */ 2942 2913 if (!params->set_4byte_addr_mode) 2943 2914 params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_brwr; 2944 2915 2945 - spi_nor_init_flags(nor); 2946 2916 spi_nor_init_fixup_flags(nor); 2947 2917 2948 2918 /* ··· 3185 3145 struct spi_nor_flash_parameter *params = nor->params; 3186 3146 int ret; 3187 3147 3148 + if (enable) { 3149 + /* 3150 + * If the RESET# pin isn't hooked up properly, or the system 3151 + * otherwise doesn't perform a reset command in the boot 3152 + * sequence, it's impossible to 100% protect against unexpected 3153 + * reboots (e.g., crashes). Warn the user (or hopefully, system 3154 + * designer) that this is bad. 3155 + */ 3156 + WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, 3157 + "enabling reset hack; may not recover from unexpected reboots\n"); 3158 + } 3159 + 3188 3160 ret = params->set_4byte_addr_mode(nor, enable); 3189 3161 if (ret && ret != -ENOTSUPP) 3190 3162 return ret; ··· 3245 3193 3246 3194 if (nor->addr_nbytes == 4 && 3247 3195 nor->read_proto != SNOR_PROTO_8_8_8_DTR && 3248 - !(nor->flags & SNOR_F_4B_OPCODES)) { 3249 - /* 3250 - * If the RESET# pin isn't hooked up properly, or the system 3251 - * otherwise doesn't perform a reset command in the boot 3252 - * sequence, it's impossible to 100% protect against unexpected 3253 - * reboots (e.g., crashes). Warn the user (or hopefully, system 3254 - * designer) that this is bad. 3255 - */ 3256 - WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, 3257 - "enabling reset hack; may not recover from unexpected reboots\n"); 3258 - err = spi_nor_set_4byte_addr_mode(nor, true); 3259 - if (err) 3260 - return err; 3261 - } 3196 + !(nor->flags & SNOR_F_4B_OPCODES)) 3197 + return spi_nor_set_4byte_addr_mode(nor, true); 3262 3198 3263 3199 return 0; 3264 3200 } ··· 3492 3452 { 3493 3453 const struct flash_info *info; 3494 3454 struct device *dev = nor->dev; 3495 - struct mtd_info *mtd = &nor->mtd; 3496 3455 int ret; 3497 - int i; 3498 3456 3499 3457 ret = spi_nor_check(nor); 3500 3458 if (ret) ··· 3556 3518 /* No mtd_info fields should be used up to this point. */ 3557 3519 spi_nor_set_mtd_info(nor); 3558 3520 3559 - dev_info(dev, "%s (%lld Kbytes)\n", info->name, 3560 - (long long)mtd->size >> 10); 3521 + dev_dbg(dev, "Manufacturer and device ID: %*phN\n", 3522 + SPI_NOR_MAX_ID_LEN, nor->id); 3561 3523 3562 - dev_dbg(dev, 3563 - "mtd .name = %s, .size = 0x%llx (%lldMiB), " 3564 - ".erasesize = 0x%.8x (%uKiB) .numeraseregions = %d\n", 3565 - mtd->name, (long long)mtd->size, (long long)(mtd->size >> 20), 3566 - mtd->erasesize, mtd->erasesize / 1024, mtd->numeraseregions); 3567 - 3568 - if (mtd->numeraseregions) 3569 - for (i = 0; i < mtd->numeraseregions; i++) 3570 - dev_dbg(dev, 3571 - "mtd.eraseregions[%d] = { .offset = 0x%llx, " 3572 - ".erasesize = 0x%.8x (%uKiB), " 3573 - ".numblocks = %d }\n", 3574 - i, (long long)mtd->eraseregions[i].offset, 3575 - mtd->eraseregions[i].erasesize, 3576 - mtd->eraseregions[i].erasesize / 1024, 3577 - mtd->eraseregions[i].numblocks); 3578 3524 return 0; 3579 3525 } 3580 3526 EXPORT_SYMBOL_GPL(spi_nor_scan);
+12 -12
drivers/mtd/spi-nor/core.h
··· 85 85 SPI_MEM_OP_NO_DUMMY, \ 86 86 SPI_MEM_OP_NO_DATA) 87 87 88 - #define SPI_NOR_CHIP_ERASE_OP \ 89 - SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_CHIP_ERASE, 0), \ 90 - SPI_MEM_OP_NO_ADDR, \ 88 + #define SPI_NOR_DIE_ERASE_OP(opcode, addr_nbytes, addr, dice) \ 89 + SPI_MEM_OP(SPI_MEM_OP_CMD(opcode, 0), \ 90 + SPI_MEM_OP_ADDR(dice ? addr_nbytes : 0, addr, 0), \ 91 91 SPI_MEM_OP_NO_DUMMY, \ 92 92 SPI_MEM_OP_NO_DATA) 93 93 ··· 293 293 * @is_locked: check if a region of the SPI NOR is completely locked 294 294 */ 295 295 struct spi_nor_locking_ops { 296 - int (*lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); 297 - int (*unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); 298 - int (*is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); 296 + int (*lock)(struct spi_nor *nor, loff_t ofs, u64 len); 297 + int (*unlock)(struct spi_nor *nor, loff_t ofs, u64 len); 298 + int (*is_locked)(struct spi_nor *nor, loff_t ofs, u64 len); 299 299 }; 300 300 301 301 /** ··· 362 362 * command in octal DTR mode. 363 363 * @n_banks: number of banks. 364 364 * @n_dice: number of dice in the flash memory. 365 + * @die_erase_opcode: die erase opcode. Defaults to SPINOR_OP_CHIP_ERASE. 365 366 * @vreg_offset: volatile register offset for each die. 366 367 * @hwcaps: describes the read and page program hardware 367 368 * capabilities. ··· 400 399 u8 rdsr_addr_nbytes; 401 400 u8 n_banks; 402 401 u8 n_dice; 402 + u8 die_erase_opcode; 403 403 u32 *vreg_offset; 404 404 405 405 struct spi_nor_hwcaps hwcaps; ··· 465 463 * struct flash_info - SPI NOR flash_info entry. 466 464 * @id: pointer to struct spi_nor_id or NULL, which means "no ID" (mostly 467 465 * older chips). 468 - * @name: the name of the flash. 466 + * @name: (obsolete) the name of the flash. Do not set it for new additions. 469 467 * @size: the size of the flash in bytes. 470 468 * @sector_size: (optional) the size listed here is what works with 471 469 * SPINOR_OP_SE, which isn't necessarily called a "sector" by ··· 489 487 * Usually these will power-up in a write-protected 490 488 * state. 491 489 * SPI_NOR_NO_ERASE: no erase command needed. 492 - * NO_CHIP_ERASE: chip does not support chip erase. 493 490 * SPI_NOR_NO_FR: can't do fastread. 494 491 * SPI_NOR_QUAD_PP: flash supports Quad Input Page Program. 495 492 * SPI_NOR_RWW: flash supports reads while write. ··· 538 537 #define SPI_NOR_BP3_SR_BIT6 BIT(4) 539 538 #define SPI_NOR_SWP_IS_VOLATILE BIT(5) 540 539 #define SPI_NOR_NO_ERASE BIT(6) 541 - #define NO_CHIP_ERASE BIT(7) 542 - #define SPI_NOR_NO_FR BIT(8) 543 - #define SPI_NOR_QUAD_PP BIT(9) 544 - #define SPI_NOR_RWW BIT(10) 540 + #define SPI_NOR_NO_FR BIT(7) 541 + #define SPI_NOR_QUAD_PP BIT(8) 542 + #define SPI_NOR_RWW BIT(9) 545 543 546 544 u8 no_sfdp_flags; 547 545 #define SPI_NOR_SKIP_SFDP BIT(0)
+1 -1
drivers/mtd/spi-nor/debugfs.c
··· 138 138 139 139 if (!(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) { 140 140 string_get_size(params->size, 1, STRING_UNITS_2, buf, sizeof(buf)); 141 - seq_printf(s, " %02x (%s)\n", SPINOR_OP_CHIP_ERASE, buf); 141 + seq_printf(s, " %02x (%s)\n", nor->params->die_erase_opcode, buf); 142 142 } 143 143 144 144 seq_puts(s, "\nsector map\n");
+55 -4
drivers/mtd/spi-nor/micron-st.c
··· 11 11 /* flash_info mfr_flag. Used to read proprietary FSR register. */ 12 12 #define USE_FSR BIT(0) 13 13 14 + #define SPINOR_OP_MT_DIE_ERASE 0xc4 /* Chip (die) erase opcode */ 14 15 #define SPINOR_OP_RDFSR 0x70 /* Read flag status register */ 15 16 #define SPINOR_OP_CLFSR 0x50 /* Clear flag status register */ 16 17 #define SPINOR_OP_MT_DTR_RD 0xfd /* Fast Read opcode in DTR mode */ ··· 193 192 .post_bfpt = mt25qu512a_post_bfpt_fixup, 194 193 }; 195 194 195 + static int st_nor_four_die_late_init(struct spi_nor *nor) 196 + { 197 + struct spi_nor_flash_parameter *params = nor->params; 198 + 199 + params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE; 200 + params->n_dice = 4; 201 + 202 + /* 203 + * Unfortunately the die erase opcode does not have a 4-byte opcode 204 + * correspondent for these flashes. The SFDP 4BAIT table fails to 205 + * consider the die erase too. We're forced to enter in the 4 byte 206 + * address mode in order to benefit of the die erase. 207 + */ 208 + return spi_nor_set_4byte_addr_mode(nor, true); 209 + } 210 + 211 + static int st_nor_two_die_late_init(struct spi_nor *nor) 212 + { 213 + struct spi_nor_flash_parameter *params = nor->params; 214 + 215 + params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE; 216 + params->n_dice = 2; 217 + 218 + /* 219 + * Unfortunately the die erase opcode does not have a 4-byte opcode 220 + * correspondent for these flashes. The SFDP 4BAIT table fails to 221 + * consider the die erase too. We're forced to enter in the 4 byte 222 + * address mode in order to benefit of the die erase. 223 + */ 224 + return spi_nor_set_4byte_addr_mode(nor, true); 225 + } 226 + 227 + static struct spi_nor_fixups n25q00_fixups = { 228 + .late_init = st_nor_four_die_late_init, 229 + }; 230 + 231 + static struct spi_nor_fixups mt25q01_fixups = { 232 + .late_init = st_nor_two_die_late_init, 233 + }; 234 + 235 + static struct spi_nor_fixups mt25q02_fixups = { 236 + .late_init = st_nor_four_die_late_init, 237 + }; 238 + 196 239 static const struct flash_info st_nor_parts[] = { 197 240 { 198 241 .name = "m25p05-nonjedec", ··· 411 366 .name = "n25q00", 412 367 .size = SZ_128M, 413 368 .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 414 - SPI_NOR_BP3_SR_BIT6 | NO_CHIP_ERASE, 369 + SPI_NOR_BP3_SR_BIT6, 415 370 .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 416 371 .mfr_flags = USE_FSR, 372 + .fixups = &n25q00_fixups, 417 373 }, { 418 374 .id = SNOR_ID(0x20, 0xba, 0x22), 419 375 .name = "mt25ql02g", 420 376 .size = SZ_256M, 421 - .flags = NO_CHIP_ERASE, 422 377 .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 423 378 .mfr_flags = USE_FSR, 379 + .fixups = &mt25q02_fixups, 424 380 }, { 425 381 .id = SNOR_ID(0x20, 0xbb, 0x15), 426 382 .name = "n25q016a", ··· 476 430 .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 477 431 .mfr_flags = USE_FSR, 478 432 }, { 433 + .id = SNOR_ID(0x20, 0xbb, 0x21, 0x10, 0x44, 0x00), 434 + .name = "mt25qu01g", 435 + .mfr_flags = USE_FSR, 436 + .fixups = &mt25q01_fixups, 437 + }, { 479 438 .id = SNOR_ID(0x20, 0xbb, 0x21), 480 439 .name = "n25q00a", 481 440 .size = SZ_128M, 482 - .flags = NO_CHIP_ERASE, 483 441 .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 484 442 .mfr_flags = USE_FSR, 443 + .fixups = &n25q00_fixups, 485 444 }, { 486 445 .id = SNOR_ID(0x20, 0xbb, 0x22), 487 446 .name = "mt25qu02g", 488 447 .size = SZ_256M, 489 - .flags = NO_CHIP_ERASE, 490 448 .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 491 449 .mfr_flags = USE_FSR, 450 + .fixups = &mt25q02_fixups, 492 451 } 493 452 }; 494 453
+29
drivers/mtd/spi-nor/sfdp.c
··· 446 446 u32 dword; 447 447 u16 half; 448 448 u8 erase_mask; 449 + u8 wait_states, mode_clocks, opcode; 449 450 450 451 /* JESD216 Basic Flash Parameter Table length is at least 9 DWORDs. */ 451 452 if (bfpt_header->length < BFPT_DWORD_MAX_JESD216) ··· 631 630 /* Stop here if not JESD216 rev C or later. */ 632 631 if (bfpt_header->length == BFPT_DWORD_MAX_JESD216B) 633 632 return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt); 633 + 634 + /* Parse 1-1-8 read instruction */ 635 + opcode = FIELD_GET(BFPT_DWORD17_RD_1_1_8_CMD, bfpt.dwords[SFDP_DWORD(17)]); 636 + if (opcode) { 637 + mode_clocks = FIELD_GET(BFPT_DWORD17_RD_1_1_8_MODE_CLOCKS, 638 + bfpt.dwords[SFDP_DWORD(17)]); 639 + wait_states = FIELD_GET(BFPT_DWORD17_RD_1_1_8_WAIT_STATES, 640 + bfpt.dwords[SFDP_DWORD(17)]); 641 + params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_8; 642 + spi_nor_set_read_settings(&params->reads[SNOR_CMD_READ_1_1_8], 643 + mode_clocks, wait_states, opcode, 644 + SNOR_PROTO_1_1_8); 645 + } 646 + 647 + /* Parse 1-8-8 read instruction */ 648 + opcode = FIELD_GET(BFPT_DWORD17_RD_1_8_8_CMD, bfpt.dwords[SFDP_DWORD(17)]); 649 + if (opcode) { 650 + mode_clocks = FIELD_GET(BFPT_DWORD17_RD_1_8_8_MODE_CLOCKS, 651 + bfpt.dwords[SFDP_DWORD(17)]); 652 + wait_states = FIELD_GET(BFPT_DWORD17_RD_1_8_8_WAIT_STATES, 653 + bfpt.dwords[SFDP_DWORD(17)]); 654 + params->hwcaps.mask |= SNOR_HWCAPS_READ_1_8_8; 655 + spi_nor_set_read_settings(&params->reads[SNOR_CMD_READ_1_8_8], 656 + mode_clocks, wait_states, opcode, 657 + SNOR_PROTO_1_8_8); 658 + } 634 659 635 660 /* 8D-8D-8D command extension. */ 636 661 switch (bfpt.dwords[SFDP_DWORD(18)] & BFPT_DWORD18_CMD_EXT_MASK) { ··· 995 968 { SNOR_HWCAPS_READ_1_1_1_DTR, BIT(13) }, 996 969 { SNOR_HWCAPS_READ_1_2_2_DTR, BIT(14) }, 997 970 { SNOR_HWCAPS_READ_1_4_4_DTR, BIT(15) }, 971 + { SNOR_HWCAPS_READ_1_1_8, BIT(20) }, 972 + { SNOR_HWCAPS_READ_1_8_8, BIT(21) }, 998 973 }; 999 974 static const struct sfdp_4bait programs[] = { 1000 975 { SNOR_HWCAPS_PP, BIT(6) },
+7
drivers/mtd/spi-nor/sfdp.h
··· 118 118 (BFPT_DWORD16_EN4B_EN4B | BFPT_DWORD16_EX4B_EX4B) 119 119 #define BFPT_DWORD16_SWRST_EN_RST BIT(12) 120 120 121 + #define BFPT_DWORD17_RD_1_1_8_CMD GENMASK(31, 24) 122 + #define BFPT_DWORD17_RD_1_1_8_MODE_CLOCKS GENMASK(23, 21) 123 + #define BFPT_DWORD17_RD_1_1_8_WAIT_STATES GENMASK(20, 16) 124 + #define BFPT_DWORD17_RD_1_8_8_CMD GENMASK(15, 8) 125 + #define BFPT_DWORD17_RD_1_8_8_MODE_CLOCKS GENMASK(7, 5) 126 + #define BFPT_DWORD17_RD_1_8_8_WAIT_STATES GENMASK(4, 0) 127 + 121 128 #define BFPT_DWORD18_CMD_EXT_MASK GENMASK(30, 29) 122 129 #define BFPT_DWORD18_CMD_EXT_REP (0x0UL << 29) /* Repeat */ 123 130 #define BFPT_DWORD18_CMD_EXT_INV (0x1UL << 29) /* Invert */
+2 -2
drivers/mtd/spi-nor/spansion.c
··· 17 17 18 18 #define SPINOR_OP_CLSR 0x30 /* Clear status register 1 */ 19 19 #define SPINOR_OP_CLPEF 0x82 /* Clear program/erase failure flags */ 20 + #define SPINOR_OP_CYPRESS_DIE_ERASE 0x61 /* Chip (die) erase */ 20 21 #define SPINOR_OP_RD_ANY_REG 0x65 /* Read any register */ 21 22 #define SPINOR_OP_WR_ANY_REG 0x71 /* Write any register */ 22 23 #define SPINOR_REG_CYPRESS_VREG 0x00800000 ··· 645 644 params->ready = cypress_nor_sr_ready_and_clear; 646 645 cypress_nor_ecc_init(nor); 647 646 647 + params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE; 648 648 return 0; 649 649 } 650 650 ··· 935 933 .id = SNOR_ID(0x34, 0x2a, 0x1c, 0x0f, 0x00, 0x90), 936 934 .name = "s25hl02gt", 937 935 .mfr_flags = USE_CLPEF, 938 - .flags = NO_CHIP_ERASE, 939 936 .fixups = &s25hx_t_fixups 940 937 }, { 941 938 .id = SNOR_ID(0x34, 0x2b, 0x19, 0x0f, 0x08, 0x90), ··· 955 954 .id = SNOR_ID(0x34, 0x2b, 0x1c, 0x0f, 0x00, 0x90), 956 955 .name = "s25hs02gt", 957 956 .mfr_flags = USE_CLPEF, 958 - .flags = NO_CHIP_ERASE, 959 957 .fixups = &s25hx_t_fixups 960 958 }, { 961 959 .id = SNOR_ID(0x34, 0x5a, 0x1a),
+3 -3
drivers/mtd/spi-nor/sst.c
··· 13 13 14 14 #define SST26VF_CR_BPNV BIT(3) 15 15 16 - static int sst26vf_nor_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) 16 + static int sst26vf_nor_lock(struct spi_nor *nor, loff_t ofs, u64 len) 17 17 { 18 18 return -EOPNOTSUPP; 19 19 } 20 20 21 - static int sst26vf_nor_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) 21 + static int sst26vf_nor_unlock(struct spi_nor *nor, loff_t ofs, u64 len) 22 22 { 23 23 int ret; 24 24 ··· 38 38 return spi_nor_global_block_unlock(nor); 39 39 } 40 40 41 - static int sst26vf_nor_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) 41 + static int sst26vf_nor_is_locked(struct spi_nor *nor, loff_t ofs, u64 len) 42 42 { 43 43 return -EOPNOTSUPP; 44 44 }
+12 -13
drivers/mtd/spi-nor/swp.c
··· 53 53 } 54 54 55 55 static void spi_nor_get_locked_range_sr(struct spi_nor *nor, u8 sr, loff_t *ofs, 56 - uint64_t *len) 56 + u64 *len) 57 57 { 58 58 struct mtd_info *mtd = &nor->mtd; 59 59 u64 min_prot_len; ··· 90 90 * (if @locked is false); false otherwise. 91 91 */ 92 92 static bool spi_nor_check_lock_status_sr(struct spi_nor *nor, loff_t ofs, 93 - uint64_t len, u8 sr, bool locked) 93 + u64 len, u8 sr, bool locked) 94 94 { 95 95 loff_t lock_offs, lock_offs_max, offs_max; 96 - uint64_t lock_len; 96 + u64 lock_len; 97 97 98 98 if (!len) 99 99 return true; ··· 111 111 return (ofs >= lock_offs_max) || (offs_max <= lock_offs); 112 112 } 113 113 114 - static bool spi_nor_is_locked_sr(struct spi_nor *nor, loff_t ofs, uint64_t len, 115 - u8 sr) 114 + static bool spi_nor_is_locked_sr(struct spi_nor *nor, loff_t ofs, u64 len, u8 sr) 116 115 { 117 116 return spi_nor_check_lock_status_sr(nor, ofs, len, sr, true); 118 117 } 119 118 120 - static bool spi_nor_is_unlocked_sr(struct spi_nor *nor, loff_t ofs, 121 - uint64_t len, u8 sr) 119 + static bool spi_nor_is_unlocked_sr(struct spi_nor *nor, loff_t ofs, u64 len, 120 + u8 sr) 122 121 { 123 122 return spi_nor_check_lock_status_sr(nor, ofs, len, sr, false); 124 123 } ··· 155 156 * 156 157 * Returns negative on errors, 0 on success. 157 158 */ 158 - static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) 159 + static int spi_nor_sr_lock(struct spi_nor *nor, loff_t ofs, u64 len) 159 160 { 160 161 struct mtd_info *mtd = &nor->mtd; 161 162 u64 min_prot_len; ··· 245 246 * 246 247 * Returns negative on errors, 0 on success. 247 248 */ 248 - static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) 249 + static int spi_nor_sr_unlock(struct spi_nor *nor, loff_t ofs, u64 len) 249 250 { 250 251 struct mtd_info *mtd = &nor->mtd; 251 252 u64 min_prot_len; ··· 330 331 * Returns 1 if entire region is locked, 0 if any portion is unlocked, and 331 332 * negative on errors. 332 333 */ 333 - static int spi_nor_sr_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) 334 + static int spi_nor_sr_is_locked(struct spi_nor *nor, loff_t ofs, u64 len) 334 335 { 335 336 int ret; 336 337 ··· 352 353 nor->params->locking_ops = &spi_nor_sr_locking_ops; 353 354 } 354 355 355 - static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) 356 + static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, u64 len) 356 357 { 357 358 struct spi_nor *nor = mtd_to_spi_nor(mtd); 358 359 int ret; ··· 367 368 return ret; 368 369 } 369 370 370 - static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) 371 + static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, u64 len) 371 372 { 372 373 struct spi_nor *nor = mtd_to_spi_nor(mtd); 373 374 int ret; ··· 382 383 return ret; 383 384 } 384 385 385 - static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) 386 + static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, u64 len) 386 387 { 387 388 struct spi_nor *nor = mtd_to_spi_nor(mtd); 388 389 int ret;
+2
drivers/mtd/spi-nor/sysfs.c
··· 78 78 79 79 if (attr == &dev_attr_manufacturer.attr && !nor->manufacturer) 80 80 return 0; 81 + if (attr == &dev_attr_partname.attr && !nor->info->name) 82 + return 0; 81 83 if (attr == &dev_attr_jedec_id.attr && !nor->info->id && !nor->id) 82 84 return 0; 83 85