[PATCH v2 4/9] memory: atmel-ebi: add Atmel EBI (External Bus Interface) driver

Balamanikandan Gunasundar balamanikandan.gunasundar at microchip.com
Mon Aug 29 08:19:23 CEST 2022


The EBI is used to access peripherals like NAND, SRAM, NOR etc. Add
this driver to probe the nand flash controller. This is a dummy driver
and not yet a complete device driver for EBI.

Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar at microchip.com>
---
 MAINTAINERS                |  1 +
 drivers/memory/Kconfig     |  7 +++++++
 drivers/memory/Makefile    |  1 +
 drivers/memory/atmel_ebi.c | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+)
 create mode 100644 drivers/memory/atmel_ebi.c

diff --git a/MAINTAINERS b/MAINTAINERS
index fa8c13fc7d..6d3f4c58a0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -386,6 +386,7 @@ T:	git https://source.denx.de/u-boot/custodians/u-boot-atmel.git
 F:	arch/arm/mach-at91/
 F:	board/atmel/
 F:	drivers/cpu/at91_cpu.c
+F:	drivers/memory/atmel-ebi.c
 F:	drivers/misc/microchip_flexcom.c
 F:	drivers/timer/atmel_tcb_timer.c
 F:	include/dt-bindings/mfd/atmel-flexcom.h
diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 7271892763..759151a452 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -24,4 +24,11 @@ config TI_AEMIF
 	  of 256M bytes of any of these memories can be accessed at a given
 	  time via four chip selects with 64M byte access per chip select.
 
+config ATMEL_EBI
+	bool "Support for Atmel EBI"
+	help
+	  Driver for Atmel EBI controller. This is a dummy
+	  driver. Doesn't provide an access to EBI controller. Select
+	  this option to enable the NAND flash controller driver
+
 endmenu
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index fec52efb60..1d24009e86 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -1,3 +1,4 @@
 
 obj-$(CONFIG_STM32_FMC2_EBI) += stm32-fmc2-ebi.o
+obj-$(CONFIG_ATMEL_EBI) += atmel_ebi.o
 obj-$(CONFIG_TI_AEMIF) += ti-aemif.o
diff --git a/drivers/memory/atmel_ebi.c b/drivers/memory/atmel_ebi.c
new file mode 100644
index 0000000000..4739eef1b7
--- /dev/null
+++ b/drivers/memory/atmel_ebi.c
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ */
+
+#include <dm/device.h>
+#include <dm/read.h>
+#include <dm/uclass.h>
+#include <fdtdec.h>
+
+static int atmel_ebi_probe(struct udevice *dev)
+{
+	int ret;
+	struct udevice *ndev;
+
+	ret = uclass_get_device_by_driver(UCLASS_MTD,
+					  DM_DRIVER_GET(atmel_nand_controller),
+					  &ndev);
+	if (ret)
+		printf("Failed to probe nand driver (err = %d)\n", ret);
+
+	return ret;
+}
+
+static const struct udevice_id atmel_ebi_match[] = {
+	{.compatible = "microchip,sam9x60-ebi"},
+	{.compatible = "atmel,sama5d3-ebi"},
+	{ /* Sentinel */ }
+};
+
+U_BOOT_DRIVER(atmel_ebi) = {
+	.name = "atmel_ebi",
+	.id = UCLASS_NOP,
+	.of_match = atmel_ebi_match,
+	.probe = atmel_ebi_probe,
+	.bind = dm_scan_fdt_dev,
+};
-- 
2.34.1



More information about the U-Boot mailing list