[PATCH v2] mtd: spi-nor: Move XMC to manufacturer ID collisions driver

From: Tudor Ambarus
Date: Tue Mar 01 2022 - 01:48:16 EST


XMC manufacturer ID is defined in bank 10 of JEP106 standard. The XMC
flashes that are currently supported do not define the continuation codes
and will collide with flashes using the same manufacturer IDs,
STMicroelectronics being an example (defined in bank one without
continuation codes). Move XMC to manufacturer ID collisions driver as it
doesn't respect the JEP106 standard and collides with other manufacturers.

Suggested-by: Michael Walle <michael@xxxxxxxx>
Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>
---
v2:
- drop xmc from makefile
- order flash_info entries in alphabetical order in manuf-id-collisions
driver

drivers/mtd/spi-nor/Makefile | 1 -
drivers/mtd/spi-nor/core.c | 1 -
drivers/mtd/spi-nor/core.h | 1 -
drivers/mtd/spi-nor/manuf-id-collisions.c | 8 ++++++++
drivers/mtd/spi-nor/xmc.c | 25 -----------------------
5 files changed, 8 insertions(+), 28 deletions(-)
delete mode 100644 drivers/mtd/spi-nor/xmc.c

diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index 48763d10daad..3f2b431f9851 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -17,7 +17,6 @@ spi-nor-objs += spansion.o
spi-nor-objs += sst.o
spi-nor-objs += winbond.o
spi-nor-objs += xilinx.o
-spi-nor-objs += xmc.o
obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o

obj-$(CONFIG_MTD_SPI_NOR) += controllers/
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 80d6ce41122a..e2b388d12c6c 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1627,7 +1627,6 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
&spi_nor_sst,
&spi_nor_winbond,
&spi_nor_xilinx,
- &spi_nor_xmc,
};

static const struct flash_info *
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index f727e632c0ee..db042c40853f 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -517,7 +517,6 @@ extern const struct spi_nor_manufacturer spi_nor_spansion;
extern const struct spi_nor_manufacturer spi_nor_sst;
extern const struct spi_nor_manufacturer spi_nor_winbond;
extern const struct spi_nor_manufacturer spi_nor_xilinx;
-extern const struct spi_nor_manufacturer spi_nor_xmc;

extern const struct attribute_group *spi_nor_sysfs_groups[];

diff --git a/drivers/mtd/spi-nor/manuf-id-collisions.c b/drivers/mtd/spi-nor/manuf-id-collisions.c
index 0447e245f4b1..bcb80b779534 100644
--- a/drivers/mtd/spi-nor/manuf-id-collisions.c
+++ b/drivers/mtd/spi-nor/manuf-id-collisions.c
@@ -34,6 +34,14 @@ static const struct flash_info id_collision_parts[] = {
SPI_NOR_QUAD_READ)
.fixups = &boya_nor_fixups },

+ /* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */
+ { "XM25QH64A", INFO(0x207017, 0, 64 * 1024, 128)
+ NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
+ SPI_NOR_QUAD_READ) },
+ { "XM25QH128A", INFO(0x207018, 0, 64 * 1024, 256)
+ NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
+ SPI_NOR_QUAD_READ) },
+
/* XTX (XTX Technology Limited) */
{ "xt25f128b", INFO(0x0b4018, 0, 64 * 1024, 256)
PARSE_SFDP
diff --git a/drivers/mtd/spi-nor/xmc.c b/drivers/mtd/spi-nor/xmc.c
deleted file mode 100644
index 051411e86339..000000000000
--- a/drivers/mtd/spi-nor/xmc.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2005, Intec Automation Inc.
- * Copyright (C) 2014, Freescale Semiconductor, Inc.
- */
-
-#include <linux/mtd/spi-nor.h>
-
-#include "core.h"
-
-static const struct flash_info xmc_nor_parts[] = {
- /* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */
- { "XM25QH64A", INFO(0x207017, 0, 64 * 1024, 128)
- NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
- SPI_NOR_QUAD_READ) },
- { "XM25QH128A", INFO(0x207018, 0, 64 * 1024, 256)
- NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
- SPI_NOR_QUAD_READ) },
-};
-
-const struct spi_nor_manufacturer spi_nor_xmc = {
- .name = "xmc",
- .parts = xmc_nor_parts,
- .nparts = ARRAY_SIZE(xmc_nor_parts),
-};
--
2.25.1