mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/4] ata: i.MX pata: Add devicetree probe support
Date: Mon, 17 Jun 2013 10:59:16 +0200	[thread overview]
Message-ID: <1371459556-24073-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1371459556-24073-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/ata/pata-imx.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
index 5d44883..1cff856 100644
--- a/drivers/ata/pata-imx.c
+++ b/drivers/ata/pata-imx.c
@@ -152,6 +152,7 @@ static int imx_pata_probe(struct device_d *dev)
 	struct clk *clk;
 	void __iomem *base;
 	int ret;
+	const char *devname;
 
 	io = xzalloc(sizeof(struct ata_ioports));
 	base = dev_request_mem_region(dev, 0);
@@ -172,7 +173,13 @@ static int imx_pata_probe(struct device_d *dev)
 
 	pata_imx_set_bus_timing(base, clk_get_rate(clk), 4);
 
-	ret= ide_port_register(dev, io);
+	if (IS_ENABLED(CONFIG_OFDEVICE)) {
+		devname = of_alias_get(dev->device_node);
+		if (devname)
+			devname = xstrdup(devname);
+	}
+
+	ret = ide_port_register(dev, io, devname);
 	if (ret) {
 		dev_err(dev, "Cannot register IDE interface: %s\n",
 				strerror(-ret));
@@ -190,8 +197,15 @@ out_free:
 	return ret;
 }
 
+static __maybe_unused struct of_device_id imx_pata_dt_ids[] = {
+	{
+		.compatible = "fsl,imx27-pata",
+	},
+};
+
 static struct driver_d imx_pata_driver = {
 	.name   = "imx-pata",
 	.probe  = imx_pata_probe,
+	.of_compatible = DRV_OF_COMPAT(imx_pata_dt_ids),
 };
 device_platform_driver(imx_pata_driver);
-- 
1.8.3.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2013-06-17  8:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17  8:59 [PATCH 1/4] ata: implement detect callback Sascha Hauer
2013-06-17  8:59 ` [PATCH 2/4] ata: Add detect callback for hardware device Sascha Hauer
2013-06-17  8:59 ` [PATCH 3/4] ata: ide: Allow to set the devicename Sascha Hauer
2013-06-17  8:59 ` Sascha Hauer [this message]

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=1371459556-24073-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@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