diff options
author | Barry Song <barry.song@analog.com> | 2009-11-18 09:43:21 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-10-18 02:49:37 -0400 |
commit | b052fd0a44354c655eb98fd715ef52857631dfef (patch) | |
tree | 31f852bed15cd4ab35c9e4932476ca58d928d3d2 /drivers/spi | |
parent | d3cc71f71ae13596cb988e16bfa2b15f09fb7347 (diff) | |
download | kernel_goldelico_gta04-b052fd0a44354c655eb98fd715ef52857631dfef.zip kernel_goldelico_gta04-b052fd0a44354c655eb98fd715ef52857631dfef.tar.gz kernel_goldelico_gta04-b052fd0a44354c655eb98fd715ef52857631dfef.tar.bz2 |
spi/bfin_spi: save/restore state when suspending/resuming
We can't rely on the SPI_CTL/SPI_FLG registers retaining their state when
suspending, so save/restore their entire values.
Signed-off-by: Barry Song <barry.song@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 278fe0a..c23ac3b 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -101,6 +101,9 @@ struct master_data { size_t rx_map_len; size_t tx_map_len; u8 n_bytes; + u16 ctrl_reg; + u16 flag_reg; + int cs_change; const struct transfer_ops *ops; }; @@ -1426,8 +1429,14 @@ static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state) if (status != 0) return status; - /* stop hardware */ - bfin_spi_disable(drv_data); + drv_data->ctrl_reg = read_CTRL(drv_data); + drv_data->flag_reg = read_FLAG(drv_data); + + /* + * reset SPI_CTL and SPI_FLG registers + */ + write_CTRL(drv_data, BIT_CTL_CPHA | BIT_CTL_MASTER); + write_FLAG(drv_data, 0xFF00); return 0; } @@ -1437,8 +1446,8 @@ static int bfin_spi_resume(struct platform_device *pdev) struct master_data *drv_data = platform_get_drvdata(pdev); int status = 0; - /* Enable the SPI interface */ - bfin_spi_enable(drv_data); + write_CTRL(drv_data, drv_data->ctrl_reg); + write_FLAG(drv_data, drv_data->flag_reg); /* Start the queue running */ status = bfin_spi_start_queue(drv_data); |