Commit 3c604de4 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

spi: tegra20-slink: 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 052eb2d4 '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_slink_setup.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 44830b4c
...@@ -171,7 +171,6 @@ struct tegra_slink_data { ...@@ -171,7 +171,6 @@ struct tegra_slink_data {
void __iomem *base; void __iomem *base;
phys_addr_t phys; phys_addr_t phys;
unsigned irq; unsigned irq;
u32 spi_max_frequency;
u32 cur_speed; u32 cur_speed;
struct spi_device *cur_spi; struct spi_device *cur_spi;
...@@ -763,8 +762,6 @@ static int tegra_slink_setup(struct spi_device *spi) ...@@ -763,8 +762,6 @@ static int tegra_slink_setup(struct spi_device *spi)
BUG_ON(spi->chip_select >= MAX_CHIP_SELECT); 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); ret = pm_runtime_get_sync(tspi->dev);
if (ret < 0) { if (ret < 0) {
dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
...@@ -999,15 +996,6 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data) ...@@ -999,15 +996,6 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data)
return IRQ_WAKE_THREAD; return IRQ_WAKE_THREAD;
} }
static void tegra_slink_parse_dt(struct tegra_slink_data *tspi)
{
struct device_node *np = tspi->dev->of_node;
if (of_property_read_u32(np, "spi-max-frequency",
&tspi->spi_max_frequency))
tspi->spi_max_frequency = 25000000; /* 25MHz */
}
static const struct tegra_slink_chip_data tegra30_spi_cdata = { static const struct tegra_slink_chip_data tegra30_spi_cdata = {
.cs_hold_time = true, .cs_hold_time = true,
}; };
...@@ -1062,7 +1050,9 @@ static int tegra_slink_probe(struct platform_device *pdev) ...@@ -1062,7 +1050,9 @@ static int tegra_slink_probe(struct platform_device *pdev)
tspi->chip_data = cdata; tspi->chip_data = cdata;
spin_lock_init(&tspi->lock); spin_lock_init(&tspi->lock);
tegra_slink_parse_dt(tspi); if (of_property_read_u32(tspi->dev->of_node, "spi-max-frequency",
&master->max_speed_hz))
master->max_speed_hz = 25000000; /* 25MHz */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) { if (!r) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment