aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-tegra20-slink.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 80490cc11ce5..b2fb115df027 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -824,6 +824,20 @@ static int tegra_slink_setup(struct spi_device *spi)
824 return 0; 824 return 0;
825} 825}
826 826
827static int tegra_slink_prepare_transfer(struct spi_master *spi)
828{
829 struct tegra_slink_data *tspi = spi_master_get_devdata(spi);
830 int ret;
831
832 ret = pm_runtime_get_sync(tspi->dev);
833 if (ret < 0) {
834 dev_err(tspi->dev, "runtime PM get failed: %d\n", ret);
835 return ret;
836 }
837
838 return ret;
839}
840
827static int tegra_slink_transfer_one_message(struct spi_master *master, 841static int tegra_slink_transfer_one_message(struct spi_master *master,
828 struct spi_message *msg) 842 struct spi_message *msg)
829{ 843{
@@ -836,11 +850,6 @@ static int tegra_slink_transfer_one_message(struct spi_master *master,
836 850
837 msg->status = 0; 851 msg->status = 0;
838 msg->actual_length = 0; 852 msg->actual_length = 0;
839 ret = pm_runtime_get_sync(tspi->dev);
840 if (ret < 0) {
841 dev_err(tspi->dev, "runtime get failed: %d\n", ret);
842 goto done;
843 }
844 853
845 single_xfer = list_is_singular(&msg->transfers); 854 single_xfer = list_is_singular(&msg->transfers);
846 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 855 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
@@ -878,13 +887,20 @@ static int tegra_slink_transfer_one_message(struct spi_master *master,
878exit: 887exit:
879 tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND); 888 tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND);
880 tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2); 889 tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2);
881 pm_runtime_put(tspi->dev);
882done:
883 msg->status = ret; 890 msg->status = ret;
884 spi_finalize_current_message(master); 891 spi_finalize_current_message(master);
885 return ret; 892 return ret;
886} 893}
887 894
895static int tegra_slink_unprepare_transfer(struct spi_master *spi)
896{
897 struct tegra_slink_data *tspi = spi_master_get_devdata(spi);
898
899 pm_runtime_put(tspi->dev);
900
901 return 0;
902}
903
888static irqreturn_t handle_cpu_based_xfer(struct tegra_slink_data *tspi) 904static irqreturn_t handle_cpu_based_xfer(struct tegra_slink_data *tspi)
889{ 905{
890 struct spi_transfer *t = tspi->curr_xfer; 906 struct spi_transfer *t = tspi->curr_xfer;
@@ -1085,7 +1101,9 @@ static int tegra_slink_probe(struct platform_device *pdev)
1085 /* the spi->mode bits understood by this driver: */ 1101 /* the spi->mode bits understood by this driver: */
1086 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 1102 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1087 master->setup = tegra_slink_setup; 1103 master->setup = tegra_slink_setup;
1104 master->prepare_transfer_hardware = tegra_slink_prepare_transfer;
1088 master->transfer_one_message = tegra_slink_transfer_one_message; 1105 master->transfer_one_message = tegra_slink_transfer_one_message;
1106 master->unprepare_transfer_hardware = tegra_slink_unprepare_transfer;
1089 master->num_chipselect = MAX_CHIP_SELECT; 1107 master->num_chipselect = MAX_CHIP_SELECT;
1090 master->bus_num = -1; 1108 master->bus_num = -1;
1091 1109