Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1650037

[PATCH v4 1/5] mtd: mchp23k256: Add OF device ID table

From Chris Packham <chris.packham@alliedtelesis.co.nz>
Newsgroups linux.kernel
Subject [PATCH v4 1/5] mtd: mchp23k256: Add OF device ID table
Date 2017-05-25 02:00 +0200
Message-ID <tKOm7-tO-37@gated-at.bofh.it> (permalink)
References <tKOm5-tO-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This allows registering of this device via a Device Tree.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Andrew Lunn <andrew@lunn.ch>
---
Changes in v2:
- collect review/test from Andrew
Changes in v3:
- None
Changes in v4:
- None

 .../devicetree/bindings/mtd/microchip,mchp23k256.txt   | 18 ++++++++++++++++++
 drivers/mtd/devices/mchp23k256.c                       |  8 ++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt

diff --git a/Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt b/Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt
new file mode 100644
index 000000000000..25e5ad38b0f0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt
@@ -0,0 +1,18 @@
+* MTD SPI driver for Microchip 23K256 (and similar) serial SRAM
+
+Required properties:
+- #address-cells, #size-cells : Must be present if the device has sub-nodes
+  representing partitions.
+- compatible : Must be "microchip,mchp23k256"
+- reg : Chip-Select number
+- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at
+
+Example:
+
+	spi-sram@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "microchip,mchp23k256";
+		reg = <0>;
+		spi-max-frequency = <20000000>;
+	};
diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c
index e237db9f1bdb..9d8306a15833 100644
--- a/drivers/mtd/devices/mchp23k256.c
+++ b/drivers/mtd/devices/mchp23k256.c
@@ -19,6 +19,7 @@
 #include <linux/sizes.h>
 #include <linux/spi/flash.h>
 #include <linux/spi/spi.h>
+#include <linux/of_device.h>
 
 struct mchp23k256_flash {
 	struct spi_device	*spi;
@@ -166,9 +167,16 @@ static int mchp23k256_remove(struct spi_device *spi)
 	return mtd_device_unregister(&flash->mtd);
 }
 
+static const struct of_device_id mchp23k256_of_table[] = {
+	{ .compatible = "microchip,mchp23k256" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, mchp23k256_of_table);
+
 static struct spi_driver mchp23k256_driver = {
 	.driver = {
 		.name	= "mchp23k256",
+		.of_match_table = of_match_ptr(mchp23k256_of_table),
 	},
 	.probe		= mchp23k256_probe,
 	.remove		= mchp23k256_remove,
-- 
2.13.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/5] mtd: mchp23k256: device tree and mchp23lcv1024 Chris Packham <chris.packham@alliedtelesis.co.nz> - 2017-05-25 02:00 +0200
  [PATCH v4 3/5] mtd: handle partitioning on devices with 0 erasesize Chris Packham <chris.packham@alliedtelesis.co.nz> - 2017-05-25 02:00 +0200
    Re: [PATCH v4 3/5] mtd: handle partitioning on devices with 0  erasesize Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-29 11:20 +0200
  [PATCH v4 2/5] mtd: mchp23k256: switch to mtd_device_register() Chris Packham <chris.packham@alliedtelesis.co.nz> - 2017-05-25 02:00 +0200
    Re: [PATCH v4 2/5] mtd: mchp23k256: switch to mtd_device_register() Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-29 11:20 +0200
  [PATCH v4 5/5] mtd: mchp23k256: Add support for mchp23lcv1024 Chris Packham <chris.packham@alliedtelesis.co.nz> - 2017-05-25 02:00 +0200
    Re: [PATCH v4 5/5] mtd: mchp23k256: Add support for mchp23lcv1024 Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-29 11:20 +0200
    Re: [PATCH v4 5/5] mtd: mchp23k256: Add support for mchp23lcv1024 Rob Herring <robh@kernel.org> - 2017-05-31 20:00 +0200
  [PATCH v4 4/5] mtd: mchp23k256: add partitioning support Chris Packham <chris.packham@alliedtelesis.co.nz> - 2017-05-25 02:00 +0200
    Re: [PATCH v4 4/5] mtd: mchp23k256: add partitioning support Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-29 11:20 +0200
    Re: [PATCH v4 4/5] mtd: mchp23k256: add partitioning support Brian Norris <computersforpeace@gmail.com> - 2017-06-01 20:50 +0200
  [PATCH v4 1/5] mtd: mchp23k256: Add OF device ID table Chris Packham <chris.packham@alliedtelesis.co.nz> - 2017-05-25 02:00 +0200
    Re: [PATCH v4 1/5] mtd: mchp23k256: Add OF device ID table Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-29 11:20 +0200
    Re: [PATCH v4 1/5] mtd: mchp23k256: Add OF device ID table Rob Herring <robh@kernel.org> - 2017-05-31 20:00 +0200
  Re: [PATCH v4 0/5] mtd: mchp23k256: device tree and mchp23lcv1024 Brian Norris <computersforpeace@gmail.com> - 2017-06-01 20:50 +0200

csiph-web