Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4db4d35e authored by Chris Packham's avatar Chris Packham Committed by Brian Norris
Browse files

mtd: mchp23k256: Add OF device ID table



This allows registering of this device via a Device Tree.

Signed-off-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Tested-by: default avatarAndrew Lunn <andrew@lunn.ch>
Acked-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent e3db1289
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
* 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>;
	};
+8 −0
Original line number Diff line number Diff line
@@ -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,