diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2015-03-24 11:43:21 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-24 12:32:48 -0400 |
commit | 025ffe88ee605acb03dba0d920908dff5ec15dd0 (patch) | |
tree | b7be19cbb5b42d13996dfc48dc1f9a503fc3e747 /drivers/spi/spi-pxa2xx.c | |
parent | 22d1b94d4b04878a6d1514a21af04699bd27e0ce (diff) |
spi: pxa2xx: shift clk_div in one place
This patch refactors ssp_get_clk_div() and pxa2xx_ssp_get_clk_div() to align
clk_div calculations, i.e. ssp_get_clk_div() and quark_x1000_set_clk_regvals()
will return plain clk_div and it will be shifted to proper position in
pxa2xx_ssp_get_clk_div().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-pxa2xx.c')
-rw-r--r-- | drivers/spi/spi-pxa2xx.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 74342d167324..6d6473427432 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -726,23 +726,23 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) | |||
726 | rate = min_t(int, ssp_clk, rate); | 726 | rate = min_t(int, ssp_clk, rate); |
727 | 727 | ||
728 | if (ssp->type == PXA25x_SSP || ssp->type == CE4100_SSP) | 728 | if (ssp->type == PXA25x_SSP || ssp->type == CE4100_SSP) |
729 | return ((ssp_clk / (2 * rate) - 1) & 0xff) << 8; | 729 | return (ssp_clk / (2 * rate) - 1) & 0xff; |
730 | else | 730 | else |
731 | return ((ssp_clk / rate - 1) & 0xfff) << 8; | 731 | return (ssp_clk / rate - 1) & 0xfff; |
732 | } | 732 | } |
733 | 733 | ||
734 | static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, | 734 | static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, |
735 | struct chip_data *chip, int rate) | 735 | struct chip_data *chip, int rate) |
736 | { | 736 | { |
737 | u32 clk_div; | 737 | unsigned int clk_div; |
738 | 738 | ||
739 | switch (drv_data->ssp_type) { | 739 | switch (drv_data->ssp_type) { |
740 | case QUARK_X1000_SSP: | 740 | case QUARK_X1000_SSP: |
741 | quark_x1000_set_clk_regvals(rate, &chip->dds_rate, &clk_div); | 741 | quark_x1000_set_clk_regvals(rate, &chip->dds_rate, &clk_div); |
742 | return clk_div << 8; | ||
743 | default: | 742 | default: |
744 | return ssp_get_clk_div(drv_data, rate); | 743 | clk_div = ssp_get_clk_div(drv_data, rate); |
745 | } | 744 | } |
745 | return clk_div << 8; | ||
746 | } | 746 | } |
747 | 747 | ||
748 | static void pump_transfers(unsigned long data) | 748 | static void pump_transfers(unsigned long data) |