[U-Boot] [PATCH v7 01/87] mtd: Add m25p80 driver
Jagan Teki
jteki at openedev.com
Tue Mar 22 08:37:13 CET 2016
This is MTD SPI-NOR driver for ST M25Pxx (and similar)
serial flash chips which is written as MTD_UCLASS.
More features will be adding on further patches.
Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Cc: Mugunthan V N <mugunthanvnm at ti.com>
Cc: Michal Simek <michal.simek at xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
Signed-off-by: Jagan Teki <jteki at openedev.com>
---
Makefile | 1 +
drivers/mtd/spi-nor/Makefile | 6 ++++++
drivers/mtd/spi-nor/m25p80.c | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
create mode 100644 drivers/mtd/spi-nor/Makefile
create mode 100644 drivers/mtd/spi-nor/m25p80.c
diff --git a/Makefile b/Makefile
index 53569e8..9830410 100644
--- a/Makefile
+++ b/Makefile
@@ -633,6 +633,7 @@ libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
libs-y += drivers/mtd/onenand/
libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
libs-y += drivers/mtd/spi/
+libs-y += drivers/mtd/spi-nor/
libs-y += drivers/net/
libs-y += drivers/net/phy/
libs-y += drivers/pci/
diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
new file mode 100644
index 0000000..a4c19e3
--- /dev/null
+++ b/drivers/mtd/spi-nor/Makefile
@@ -0,0 +1,6 @@
+#
+# Copyright (C) 2016 Jagan Teki <jteki at openedev.com>
+#
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-$(CONFIG_MTD_M25P80) += m25p80.o
diff --git a/drivers/mtd/spi-nor/m25p80.c b/drivers/mtd/spi-nor/m25p80.c
new file mode 100644
index 0000000..833a9c3
--- /dev/null
+++ b/drivers/mtd/spi-nor/m25p80.c
@@ -0,0 +1,37 @@
+/*
+ * MTD SPI-NOR driver for ST M25Pxx (and similar) serial flash chips
+ *
+ * Copyright (C) 2016 Jagan Teki <jteki at openedev.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <spi.h>
+#include <linux/mtd/mtd.h>
+
+static int m25p_probe(struct udevice *dev)
+{
+ struct spi_slave *spi = dev_get_parent_priv(dev);
+ struct mtd_info *mtd = dev_get_uclass_priv(dev);
+
+ return 0;
+}
+
+static const struct udevice_id m25p_ids[] = {
+ /*
+ * Generic compatibility for SPI NOR that can be identified by the
+ * JEDEC READ ID opcode (0x9F). Use this, if possible.
+ */
+ { .compatible = "jedec,spi-nor" },
+ { }
+};
+
+U_BOOT_DRIVER(m25p80) = {
+ .name = "m25p80",
+ .id = UCLASS_MTD,
+ .of_match = m25p_ids,
+ .probe = m25p_probe,
+};
--
1.9.1
More information about the U-Boot
mailing list