Merge branches 'x86-build-for-linus', 'x86-cleanups-for-linus' and 'x86-debug-for...
[cascardo/linux.git] / drivers / spi / spi.c
index 939edf4..22aa41c 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/mutex.h>
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
+#include <linux/clk/clk-conf.h>
 #include <linux/slab.h>
 #include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
@@ -259,6 +260,10 @@ static int spi_drv_probe(struct device *dev)
        const struct spi_driver         *sdrv = to_spi_driver(dev->driver);
        int ret;
 
+       ret = of_clk_set_defaults(dev->of_node, false);
+       if (ret)
+               return ret;
+
        acpi_dev_pm_attach(dev, true);
        ret = sdrv->probe(to_spi_device(dev));
        if (ret)
@@ -796,7 +801,7 @@ static int spi_transfer_one_message(struct spi_master *master,
                if (ret > 0) {
                        ret = 0;
                        ms = xfer->len * 8 * 1000 / xfer->speed_hz;
-                       ms += 10; /* some tolerance */
+                       ms += ms + 100; /* some tolerance */
 
                        ms = wait_for_completion_timeout(&master->xfer_completion,
                                                         msecs_to_jiffies(ms));
@@ -1255,6 +1260,8 @@ static void of_register_spi_devices(struct spi_master *master)
                        spi->mode |= SPI_CS_HIGH;
                if (of_find_property(nc, "spi-3wire", NULL))
                        spi->mode |= SPI_3WIRE;
+               if (of_find_property(nc, "spi-lsb-first", NULL))
+                       spi->mode |= SPI_LSB_FIRST;
 
                /* Device DUAL/QUAD mode */
                if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) {
@@ -1268,11 +1275,10 @@ static void of_register_spi_devices(struct spi_master *master)
                                spi->mode |= SPI_TX_QUAD;
                                break;
                        default:
-                               dev_err(&master->dev,
-                                       "spi-tx-bus-width %d not supported\n",
-                                       value);
-                               spi_dev_put(spi);
-                               continue;
+                               dev_warn(&master->dev,
+                                        "spi-tx-bus-width %d not supported\n",
+                                        value);
+                               break;
                        }
                }
 
@@ -1287,11 +1293,10 @@ static void of_register_spi_devices(struct spi_master *master)
                                spi->mode |= SPI_RX_QUAD;
                                break;
                        default:
-                               dev_err(&master->dev,
-                                       "spi-rx-bus-width %d not supported\n",
-                                       value);
-                               spi_dev_put(spi);
-                               continue;
+                               dev_warn(&master->dev,
+                                        "spi-rx-bus-width %d not supported\n",
+                                        value);
+                               break;
                        }
                }