#include <linux/bitops.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/sched.h>
 #include <linux/scatterlist.h>
                free_page((unsigned long)espi->zeropage);
 }
 
+#ifdef CONFIG_OF
+static struct ep93xx_spi_info dt_spi_info;
+
+static struct ep93xx_spi_info *ep93xx_spi_get_platdata(struct platform_device *pdev)
+{
+       struct device_node *np = pdev->dev.of_node;
+
+       if (np && of_property_read_bool(np, "use_dma"))
+               dt_spi_info.use_dma = 1;
+
+       return &dt_spi_info;
+}
+#else
+static struct ep93xx_spi_info *ep93xx_spi_get_platdata(struct platform_device *pdev)
+{
+       return dev_get_platdata(&pdev->dev);
+}
+#endif
+
 static int ep93xx_spi_probe(struct platform_device *pdev)
 {
        struct spi_master *master;
        int irq;
        int error;
 
-       info = dev_get_platdata(&pdev->dev);
+       info = ep93xx_spi_get_platdata(pdev);
        if (!info) {
                dev_err(&pdev->dev, "missing platform data\n");
                return -EINVAL;
        /* make sure that the hardware is disabled */
        writel(0, espi->mmio + SSPCR1);
 
+       master->dev.of_node = pdev->dev.of_node;
+
        error = devm_spi_register_master(&pdev->dev, master);
        if (error) {
                dev_err(&pdev->dev, "failed to register SPI master\n");
        ep93xx_spi_release_dma(espi);
 }
 
+static const struct of_device_id ep93xx_spi_of_ids[] = {
+       { .compatible = "cirrus,ep9301-spi" },
+       {},
+};
+MODULE_DEVICE_TABLE(of, ep93xx_spi_of_ids);
+
 static struct platform_driver ep93xx_spi_driver = {
        .driver         = {
                .name   = "ep93xx-spi",
+               .of_match_table = ep93xx_spi_of_ids,
        },
        .probe          = ep93xx_spi_probe,
        .remove_new     = ep93xx_spi_remove,