Skip to content

Commit 8b522c4

Browse files
Merge tag 'spi-nor/for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux into mtd/next
SPI NOR core changes: - Print all JEDEC ID bytes on error - Fix comment of spi_nor_find_best_erase_type() - Add region locking flags for s25fl512s SPI NOR controller drivers changes: - intel-spi: * Avoid crossing 4K address boundary on read/write * Add support for Intel Comet Lake SPI serial flash
2 parents 1c7cbd6 + e43f53c commit 8b522c4

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎drivers/mtd/spi-nor/intel-spi-pci.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static void intel_spi_pci_remove(struct pci_dev *pdev)
6363
}
6464

6565
static const struct pci_device_id intel_spi_pci_ids[] = {
66+
{ PCI_VDEVICE(INTEL, 0x02a4), (unsigned long)&bxt_info },
6667
{ PCI_VDEVICE(INTEL, 0x18e0), (unsigned long)&bxt_info },
6768
{ PCI_VDEVICE(INTEL, 0x19e0), (unsigned long)&bxt_info },
6869
{ PCI_VDEVICE(INTEL, 0x34a4), (unsigned long)&bxt_info },

‎drivers/mtd/spi-nor/intel-spi.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,10 @@ static ssize_t intel_spi_read(struct spi_nor *nor, loff_t from, size_t len,
632632
while (len > 0) {
633633
block_size = min_t(size_t, len, INTEL_SPI_FIFO_SZ);
634634

635+
/* Read cannot cross 4K boundary */
636+
block_size = min_t(loff_t, from + block_size,
637+
round_up(from + 1, SZ_4K)) - from;
638+
635639
writel(from, ispi->base + FADDR);
636640

637641
val = readl(ispi->base + HSFSTS_CTL);
@@ -685,6 +689,10 @@ static ssize_t intel_spi_write(struct spi_nor *nor, loff_t to, size_t len,
685689
while (len > 0) {
686690
block_size = min_t(size_t, len, INTEL_SPI_FIFO_SZ);
687691

692+
/* Write cannot cross 4K boundary */
693+
block_size = min_t(loff_t, to + block_size,
694+
round_up(to + 1, SZ_4K)) - to;
695+
688696
writel(to, ispi->base + FADDR);
689697

690698
val = readl(ispi->base + HSFSTS_CTL);

‎drivers/mtd/spi-nor/spi-nor.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ spi_nor_find_best_erase_type(const struct spi_nor_erase_map *map,
744744
u8 erase_mask = region->offset & SNOR_ERASE_TYPE_MASK;
745745

746746
/*
747-
* Erase types are ordered by size, with the biggest erase type at
747+
* Erase types are ordered by size, with the smallest erase type at
748748
* index 0.
749749
*/
750750
for (i = SNOR_ERASE_TYPE_MAX - 1; i >= 0; i--) {
@@ -1905,7 +1905,9 @@ static const struct flash_info spi_nor_ids[] = {
19051905
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
19061906
{ "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, USE_CLSR) },
19071907
{ "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
1908-
{ "s25fl512s", INFO6(0x010220, 0x4d0080, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
1908+
{ "s25fl512s", INFO6(0x010220, 0x4d0080, 256 * 1024, 256,
1909+
SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
1910+
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | USE_CLSR) },
19091911
{ "s25fs512s", INFO6(0x010220, 0x4d0081, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) },
19101912
{ "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
19111913
{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
@@ -2071,8 +2073,8 @@ static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
20712073
return &spi_nor_ids[tmp];
20722074
}
20732075
}
2074-
dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
2075-
id[0], id[1], id[2]);
2076+
dev_err(nor->dev, "unrecognized JEDEC id bytes: %*ph\n",
2077+
SPI_NOR_MAX_ID_LEN, id);
20762078
return ERR_PTR(-ENODEV);
20772079
}
20782080

0 commit comments

Comments
 (0)