diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-06-11 21:09:03 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-06-19 18:49:55 +0200 |
commit | 466feef31e1fe7e98652be13a8ea3dc2171e3034 (patch) | |
tree | 7c704c29e09b22f0002d2b069efecf8f2117b02e /drivers | |
parent | 2093884040d799898c9931d5c4032b64a145c6c2 (diff) | |
download | barebox-466feef31e1fe7e98652be13a8ea3dc2171e3034.tar.gz barebox-466feef31e1fe7e98652be13a8ea3dc2171e3034.tar.xz |
ata: i.MX pata: Add devicetree probe support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata-imx.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c index 2e45c94aeb..78f2aa55ff 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 = NULL; 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, NULL); + 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); |