[PATCH 1/2] spi: aspeed: Use "jedec,spi-nor" compatible to count devices

Cédric Le Goater clg at kaod.org
Wed Jun 8 16:14:54 AEST 2022


The SoC device trees use the "jedec,spi-nor" compatible property to
describe the flash devices and the board device trees override this
property with "spi-flash", "sst,w25q256". This comes from the initial
driver which was first written when spi-nor support had not been
merged in U-boot yet.

"jedec,spi-nor" should be preferred since it is used by Linux and the
latest U-boot. Use it to count devices. We will clean up the board
device trees later.

Cc: Chin-Ting Kuo <chin-ting_kuo at aspeedtech.com>
Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
 drivers/spi/aspeed_spi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/aspeed_spi.c b/drivers/spi/aspeed_spi.c
index 65d69105e8e8..45f6a8dd6850 100644
--- a/drivers/spi/aspeed_spi.c
+++ b/drivers/spi/aspeed_spi.c
@@ -1241,7 +1241,8 @@ static int aspeed_spi_count_flash_devices(struct udevice *bus)
 
 	dev_for_each_subnode(node, bus) {
 		if (ofnode_is_available(node) &&
-		    ofnode_device_is_compatible(node, "spi-flash"))
+		    (ofnode_device_is_compatible(node, "spi-flash") ||
+		     ofnode_device_is_compatible(node, "jedec,spi-nor")))
 			count++;
 	}
 
-- 
2.35.3



More information about the openbmc mailing list