summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-tegra114.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-02-10 08:48:16 -0500
committerMark Brown <broonie@linaro.org>2014-02-11 07:07:34 -0500
commit383840d92f8e5e4c3ab4090e5d8f2ca5cf893802 (patch)
tree7cdc19b6e16f532d841bfac2d1575b52fee4f244 /drivers/spi/spi-tegra114.c
parent052eb2d49006fe53bc5f62a196dce23345d4a907 (diff)
spi: tegra114: Convert to use master->max_speed_hz
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>
Diffstat (limited to 'drivers/spi/spi-tegra114.c')
-rw-r--r--drivers/spi/spi-tegra114.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
index 413c71843492..d8c71b81165a 100644
--- a/drivers/spi/spi-tegra114.c
+++ b/drivers/spi/spi-tegra114.c
@@ -172,7 +172,6 @@ struct tegra_spi_data {
172 void __iomem *base; 172 void __iomem *base;
173 phys_addr_t phys; 173 phys_addr_t phys;
174 unsigned irq; 174 unsigned irq;
175 u32 spi_max_frequency;
176 u32 cur_speed; 175 u32 cur_speed;
177 176
178 struct spi_device *cur_spi; 177 struct spi_device *cur_spi;
@@ -763,9 +762,6 @@ static int tegra_spi_setup(struct spi_device *spi)
763 762
764 BUG_ON(spi->chip_select >= MAX_CHIP_SELECT); 763 BUG_ON(spi->chip_select >= MAX_CHIP_SELECT);
765 764
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); 765 ret = pm_runtime_get_sync(tspi->dev);
770 if (ret < 0) { 766 if (ret < 0) {
771 dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); 767 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)
1019 return IRQ_WAKE_THREAD; 1015 return IRQ_WAKE_THREAD;
1020} 1016}
1021 1017
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[] = { 1018static struct of_device_id tegra_spi_of_match[] = {
1033 { .compatible = "nvidia,tegra114-spi", }, 1019 { .compatible = "nvidia,tegra114-spi", },
1034 {} 1020 {}
@@ -1050,8 +1036,9 @@ static int tegra_spi_probe(struct platform_device *pdev)
1050 platform_set_drvdata(pdev, master); 1036 platform_set_drvdata(pdev, master);
1051 tspi = spi_master_get_devdata(master); 1037 tspi = spi_master_get_devdata(master);
1052 1038
1053 /* Parse DT */ 1039 if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency",
1054 tegra_spi_parse_dt(pdev, tspi); 1040 &master->max_speed_hz))
1041 master->max_speed_hz = 25000000; /* 25MHz */
1055 1042
1056 /* the spi->mode bits understood by this driver: */ 1043 /* the spi->mode bits understood by this driver: */
1057 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 1044 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;