Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350772
b: refs/heads/master
c: beb96c2
h: refs/heads/master
v: v3
  • Loading branch information
Laxman Dewangan authored and Grant Likely committed Feb 5, 2013
1 parent 23f3974 commit b102d7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 059b8ffeee5b427949872bb6ed5db5ae0788054e
refs/heads/master: beb96c2ad4cd5012e39587b960aa7e41661c78ca
14 changes: 11 additions & 3 deletions trunk/drivers/spi/spi-tegra20-sflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi,
u32 speed;
unsigned long command;

speed = t->speed_hz ? t->speed_hz : spi->max_speed_hz;
if (!speed)
speed = tsd->spi_max_frequency;
speed = t->speed_hz;
if (speed != tsd->cur_speed) {
clk_set_rate(tsd->clk, speed);
tsd->cur_speed = speed;
Expand Down Expand Up @@ -319,6 +317,15 @@ static int tegra_sflash_start_transfer_one(struct spi_device *spi,
return tegra_sflash_start_cpu_based_transfer(tsd, t);
}

static int tegra_sflash_setup(struct spi_device *spi)
{
struct tegra_sflash_data *tsd = spi_master_get_devdata(spi->master);

/* Set speed to the spi max fequency if spi device has not set */
spi->max_speed_hz = spi->max_speed_hz ? : tsd->spi_max_frequency;
return 0;
}

static int tegra_sflash_transfer_one_message(struct spi_master *master,
struct spi_message *msg)
{
Expand Down Expand Up @@ -492,6 +499,7 @@ static int tegra_sflash_probe(struct platform_device *pdev)

/* the spi->mode bits understood by this driver: */
master->mode_bits = SPI_CPOL | SPI_CPHA;
master->setup = tegra_sflash_setup;
master->transfer_one_message = tegra_sflash_transfer_one_message;
master->num_chipselect = MAX_CHIP_SELECT;
master->bus_num = -1;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/spi/spi-tegra20-slink.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,7 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
unsigned long command2;

bits_per_word = t->bits_per_word;
speed = t->speed_hz ? t->speed_hz : spi->max_speed_hz;
if (!speed)
speed = tspi->spi_max_frequency;
speed = t->speed_hz;
if (speed != tspi->cur_speed) {
clk_set_rate(tspi->clk, speed * 4);
tspi->cur_speed = speed;
Expand Down Expand Up @@ -838,6 +836,8 @@ static int tegra_slink_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);
Expand Down

0 comments on commit b102d7a

Please sign in to comment.