From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi-orion: add device tree binding
Date: Mon, 23 Jul 2012 12:08:09 +0200 [thread overview]
Message-ID: <20120723100809.GC18778@lunn.ch> (raw)
In-Reply-To: <20120723093747.GD4435@opensource.wolfsonmicro.com>
>From 528a19e9eda968cc673331d566cbfe20962d3b32 Mon Sep 17 00:00:00 2001
From: Michael Walle <michael@walle.cc>
Date: Wed, 6 Jun 2012 19:16:28 +0200
Subject: [PATCHv3] spi-orion: add device tree binding
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@googlemail.com>
---
v2: Add interrupts properties as optional. Not used at the moment.
Add cell-index, since some SoCs have multiple SPI busses.
v3: Rebased onto 3.5-rc7 without the refactor patch.
---
Documentation/devicetree/bindings/spi/spi-orion.txt | 19 +++++++++++++++++++
drivers/spi/spi-orion.c | 17 +++++++++++++++++
2 files changed, 36 insertions(+)
create mode 100644 Documentation/devicetree/bindings/spi/spi-orion.txt
diff --git a/Documentation/devicetree/bindings/spi/spi-orion.txt b/Documentation/devicetree/bindings/spi/spi-orion.txt
new file mode 100644
index 0000000..a3ff50f
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-orion.txt
@@ -0,0 +1,19 @@
+Marvell Orion SPI device
+
+Required properties:
+- compatible : should be "marvell,orion-spi".
+- reg : offset and length of the register set for the device
+- cell-index : Which of multiple SPI controllers is this.
+Optional properties:
+- interrupts : Is currently not used.
+
+Example:
+ spi at 10600 {
+ compatible = "marvell,orion-spi";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <0>;
+ reg = <0x10600 0x28>;
+ interrupts = <23>;
+ status = "disabled";
+ };
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index dfd04e9..74312a8 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -17,6 +17,7 @@
#include <linux/io.h>
#include <linux/spi/spi.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/clk.h>
#include <asm/unaligned.h>
@@ -453,6 +454,8 @@ static int __init orion_spi_probe(struct platform_device *pdev)
struct orion_spi_info *spi_info;
unsigned long tclk_hz;
int status = 0;
+ const u32 *iprop;
+ int size;
spi_info = pdev->dev.platform_data;
@@ -464,6 +467,12 @@ static int __init orion_spi_probe(struct platform_device *pdev)
if (pdev->id != -1)
master->bus_num = pdev->id;
+ if (pdev->dev.of_node) {
+ iprop = of_get_property(pdev->dev.of_node, "cell-index",
+ &size);
+ if (iprop && size == sizeof(*iprop))
+ master->bus_num = *iprop;
+ }
/* we support only mode 0, and no options */
master->mode_bits = 0;
@@ -511,6 +520,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
if (orion_spi_reset(spi) < 0)
goto out_rel_mem;
+ master->dev.of_node = pdev->dev.of_node;
status = spi_register_master(master);
if (status < 0)
goto out_rel_mem;
@@ -552,10 +562,17 @@ static int __exit orion_spi_remove(struct platform_device *pdev)
MODULE_ALIAS("platform:" DRIVER_NAME);
+static const struct of_device_id orion_spi_of_match_table[] __devinitdata = {
+ { .compatible = "marvell,orion-spi", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, orion_spi_of_match_table);
+
static struct platform_driver orion_spi_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(orion_spi_of_match_table),
},
.remove = __exit_p(orion_spi_remove),
};
--
1.7.10.4
next prev parent reply other threads:[~2012-07-23 10:08 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-20 17:35 [PATCH 00/16] Orion DT conversions and fixes Andrew Lunn
2012-07-20 17:35 ` [PATCH 1/16] ARM: Orion: DT support for IRQ and GPIO Controllers Andrew Lunn
2012-07-20 17:35 ` [PATCH 2/16] SPI: Refactor spi-orion to use SPI framework queue Andrew Lunn
2012-07-22 7:22 ` Linus Walleij
2012-07-22 9:53 ` Andrew Lunn
2012-07-22 19:07 ` Mark Brown
2012-07-22 19:32 ` Andrew Lunn
2012-07-22 22:42 ` Mark Brown
2012-07-23 7:27 ` Andrew Lunn
2012-07-23 9:37 ` Mark Brown
2012-07-23 10:08 ` Andrew Lunn [this message]
2012-07-23 10:43 ` [PATCH] spi-orion: add device tree binding Mark Brown
2012-07-23 10:59 ` Andrew Lunn
2012-07-23 11:12 ` Mark Brown
2012-07-23 17:43 ` Arnd Bergmann
2012-07-23 10:44 ` Mark Brown
2012-07-23 10:50 ` Andrew Lunn
2012-07-23 10:16 ` [PATCH 2/16] SPI: Refactor spi-orion to use SPI framework queue Andrew Lunn
2012-07-23 10:23 ` Mark Brown
2012-07-23 10:49 ` Andrew Lunn
2012-07-23 11:11 ` Mark Brown
2012-07-23 10:53 ` Sergei Shtylyov
2012-07-23 11:02 ` Andrew Lunn
2012-07-20 17:35 ` [PATCH 3/16] ARM: Kirkwood: Ensure runit clock always ticks Andrew Lunn
2012-07-20 17:35 ` [PATCH 4/16] ARM: Orion: Add arch support needed for I2C via DT Andrew Lunn
2012-07-20 17:35 ` [PATCH 5/16] Kirkwood: Add basic device tree support for QNAP TS219 Andrew Lunn
2012-07-20 17:35 ` [PATCH 6/16] ARM: Orion: DTify the watchdog timer Andrew Lunn
2012-07-20 17:35 ` [PATCH 7/16] ATA: sata_mv: Add device tree support Andrew Lunn
2012-07-20 17:35 ` [PATCH 8/16] ARM: Kirkwood: Use DT to configure SATA device Andrew Lunn
2012-07-20 17:35 ` [PATCH 9/16] ARM: Kirkwood: Describe DNS325 temperature sensor in DT Andrew Lunn
2012-07-20 17:35 ` [PATCH 10/16] ARM: Kirkwood: Describe IB62x0 gpio-keys " Andrew Lunn
2012-07-20 17:35 ` [PATCH 11/16] ARM: Kirkwood: Describe iConnects temperature sensor " Andrew Lunn
2012-07-20 17:35 ` [PATCH 12/16] ARM: Kirkwood: Describe Dreamplug LEDs " Andrew Lunn
2012-07-20 17:35 ` [PATCH 13/16] ARM: Kirkwood: Describe GoFlex Net LEDs and SATA " Andrew Lunn
2012-07-20 17:35 ` [PATCH 14/16] ARM: Kirkwood: Describe ib62x0 LEDs " Andrew Lunn
2012-07-20 17:35 ` [PATCH 15/16] ARM: Kirkwood: Describe iConnect " Andrew Lunn
2012-07-30 21:35 ` Adam Baker
2012-07-31 6:36 ` Andrew Lunn
2012-07-31 7:08 ` Arnaud Patard (Rtp)
2012-07-31 7:20 ` Andrew Lunn
2012-07-31 8:59 ` Arnaud Patard (Rtp)
2012-07-20 17:35 ` [PATCH 16/16] ARM: Kirkwood: Replace mrvl with marvell Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120723100809.GC18778@lunn.ch \
--to=andrew@lunn.ch \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).