]> git.karo-electronics.de Git - linux-beck.git/commitdiff
spi: tegra114: Convert to use master->max_speed_hz
authorAxel Lin <axel.lin@ingics.com>
Mon, 10 Feb 2014 13:48:16 +0000 (21:48 +0800)
committerMark Brown <broonie@linaro.org>
Tue, 11 Feb 2014 12:07:34 +0000 (12:07 +0000)
Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
handle checking transfer speed.

In additional, since commit 052eb2d49006 'spi: core: Set max_speed_hz of
spi_device default to max_speed_hz of controller',
spi core will also set default spi->max_speed_hz if it is not set.
So remove the duplicate code in tegra_spi_setup.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-tegra114.c

index 413c718434927f0d3278c051d15040639a68237a..d8c71b81165afc8925fc616d1fe0eebe121dde9e 100644 (file)
@@ -172,7 +172,6 @@ struct tegra_spi_data {
        void __iomem                            *base;
        phys_addr_t                             phys;
        unsigned                                irq;
-       u32                                     spi_max_frequency;
        u32                                     cur_speed;
 
        struct spi_device                       *cur_spi;
@@ -763,9 +762,6 @@ static int tegra_spi_setup(struct spi_device *spi)
 
        BUG_ON(spi->chip_select >= MAX_CHIP_SELECT);
 
-       /* Set speed to the spi max fequency if spi device has not set */
-       spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency;
-
        ret = pm_runtime_get_sync(tspi->dev);
        if (ret < 0) {
                dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
@@ -1019,16 +1015,6 @@ static irqreturn_t tegra_spi_isr(int irq, void *context_data)
        return IRQ_WAKE_THREAD;
 }
 
-static void tegra_spi_parse_dt(struct platform_device *pdev,
-       struct tegra_spi_data *tspi)
-{
-       struct device_node *np = pdev->dev.of_node;
-
-       if (of_property_read_u32(np, "spi-max-frequency",
-                               &tspi->spi_max_frequency))
-               tspi->spi_max_frequency = 25000000; /* 25MHz */
-}
-
 static struct of_device_id tegra_spi_of_match[] = {
        { .compatible = "nvidia,tegra114-spi", },
        {}
@@ -1050,8 +1036,9 @@ static int tegra_spi_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, master);
        tspi = spi_master_get_devdata(master);
 
-       /* Parse DT */
-       tegra_spi_parse_dt(pdev, tspi);
+       if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency",
+                                &master->max_speed_hz))
+               master->max_speed_hz = 25000000; /* 25MHz */
 
        /* the spi->mode bits understood by this driver: */
        master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;