aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-tegra114.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-tegra114.c')
-rw-r--r--drivers/spi/spi-tegra114.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
index 413c71843492..6be661e4c6e1 100644
--- a/drivers/spi/spi-tegra114.c
+++ b/drivers/spi/spi-tegra114.c
@@ -23,7 +23,6 @@
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/dmapool.h> 24#include <linux/dmapool.h>
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/init.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/io.h> 27#include <linux/io.h>
29#include <linux/kernel.h> 28#include <linux/kernel.h>
@@ -172,7 +171,6 @@ struct tegra_spi_data {
172 void __iomem *base; 171 void __iomem *base;
173 phys_addr_t phys; 172 phys_addr_t phys;
174 unsigned irq; 173 unsigned irq;
175 u32 spi_max_frequency;
176 u32 cur_speed; 174 u32 cur_speed;
177 175
178 struct spi_device *cur_spi; 176 struct spi_device *cur_spi;
@@ -761,11 +759,6 @@ static int tegra_spi_setup(struct spi_device *spi)
761 spi->mode & SPI_CPHA ? "" : "~", 759 spi->mode & SPI_CPHA ? "" : "~",
762 spi->max_speed_hz); 760 spi->max_speed_hz);
763 761
764 BUG_ON(spi->chip_select >= MAX_CHIP_SELECT);
765
766 /* Set speed to the spi max fequency if spi device has not set */
767 spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency;
768
769 ret = pm_runtime_get_sync(tspi->dev); 762 ret = pm_runtime_get_sync(tspi->dev);
770 if (ret < 0) { 763 if (ret < 0) {
771 dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); 764 dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
@@ -1019,16 +1012,6 @@ static irqreturn_t tegra_spi_isr(int irq, void *context_data)
1019 return IRQ_WAKE_THREAD; 1012 return IRQ_WAKE_THREAD;
1020} 1013}
1021 1014
1022static void tegra_spi_parse_dt(struct platform_device *pdev,
1023 struct tegra_spi_data *tspi)
1024{
1025 struct device_node *np = pdev->dev.of_node;
1026
1027 if (of_property_read_u32(np, "spi-max-frequency",
1028 &tspi->spi_max_frequency))
1029 tspi->spi_max_frequency = 25000000; /* 25MHz */
1030}
1031
1032static struct of_device_id tegra_spi_of_match[] = { 1015static struct of_device_id tegra_spi_of_match[] = {
1033 { .compatible = "nvidia,tegra114-spi", }, 1016 { .compatible = "nvidia,tegra114-spi", },
1034 {} 1017 {}
@@ -1050,15 +1033,15 @@ static int tegra_spi_probe(struct platform_device *pdev)
1050 platform_set_drvdata(pdev, master); 1033 platform_set_drvdata(pdev, master);
1051 tspi = spi_master_get_devdata(master); 1034 tspi = spi_master_get_devdata(master);
1052 1035
1053 /* Parse DT */ 1036 if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency",
1054 tegra_spi_parse_dt(pdev, tspi); 1037 &master->max_speed_hz))
1038 master->max_speed_hz = 25000000; /* 25MHz */
1055 1039
1056 /* the spi->mode bits understood by this driver: */ 1040 /* the spi->mode bits understood by this driver: */
1057 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 1041 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1058 master->setup = tegra_spi_setup; 1042 master->setup = tegra_spi_setup;
1059 master->transfer_one_message = tegra_spi_transfer_one_message; 1043 master->transfer_one_message = tegra_spi_transfer_one_message;
1060 master->num_chipselect = MAX_CHIP_SELECT; 1044 master->num_chipselect = MAX_CHIP_SELECT;
1061 master->bus_num = -1;
1062 master->auto_runtime_pm = true; 1045 master->auto_runtime_pm = true;
1063 1046
1064 tspi->master = master; 1047 tspi->master = master;