aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-12-09 01:14:38 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-12-09 01:14:38 -0500
commitbcd6acd51f3d4d1ada201e9bc5c40a31d6d80c71 (patch)
tree2f6dffd2d3e4dd67355a224de7e7a960335a92fd /drivers/spi
parent11c34c7deaeeebcee342cbc35e1bb2a6711b2431 (diff)
parent3ff6a468b45b5dfeb0e903e56f4eb27d34b2437c (diff)
Merge commit 'origin/master' into next
Conflicts: include/linux/kvm.h
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/omap2_mcspi.c4
-rw-r--r--drivers/spi/omap_uwire.c10
-rw-r--r--drivers/spi/spi_txx9.c13
3 files changed, 13 insertions, 14 deletions
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index ba1a872b221e..bf5f95a19413 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -35,8 +35,8 @@
35 35
36#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
37 37
38#include <mach/dma.h> 38#include <plat/dma.h>
39#include <mach/clock.h> 39#include <plat/clock.h>
40 40
41 41
42#define OMAP2_MCSPI_MAX_FREQ 48000000 42#define OMAP2_MCSPI_MAX_FREQ 48000000
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index e75ba9b28898..6c3a8557db27 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -51,8 +51,8 @@
51#include <asm/io.h> 51#include <asm/io.h>
52#include <asm/mach-types.h> 52#include <asm/mach-types.h>
53 53
54#include <mach/mux.h> 54#include <plat/mux.h>
55#include <mach/omap730.h> /* OMAP730_IO_CONF registers */ 55#include <plat/omap7xx.h> /* OMAP7XX_IO_CONF registers */
56 56
57 57
58/* FIXME address is now a platform device resource, 58/* FIXME address is now a platform device resource,
@@ -504,7 +504,7 @@ static int __init uwire_probe(struct platform_device *pdev)
504 } 504 }
505 clk_enable(uwire->ck); 505 clk_enable(uwire->ck);
506 506
507 if (cpu_is_omap730()) 507 if (cpu_is_omap7xx())
508 uwire_idx_shift = 1; 508 uwire_idx_shift = 1;
509 else 509 else
510 uwire_idx_shift = 2; 510 uwire_idx_shift = 2;
@@ -573,8 +573,8 @@ static int __init omap_uwire_init(void)
573 } 573 }
574 if (machine_is_omap_perseus2()) { 574 if (machine_is_omap_perseus2()) {
575 /* configure pins: MPU_UW_nSCS1, MPU_UW_SDO, MPU_UW_SCLK */ 575 /* configure pins: MPU_UW_nSCS1, MPU_UW_SDO, MPU_UW_SCLK */
576 int val = omap_readl(OMAP730_IO_CONF_9) & ~0x00EEE000; 576 int val = omap_readl(OMAP7XX_IO_CONF_9) & ~0x00EEE000;
577 omap_writel(val | 0x00AAA000, OMAP730_IO_CONF_9); 577 omap_writel(val | 0x00AAA000, OMAP7XX_IO_CONF_9);
578 } 578 }
579 579
580 return platform_driver_probe(&uwire_driver, uwire_probe); 580 return platform_driver_probe(&uwire_driver, uwire_probe);
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c
index 96057de133ad..19f75627c3de 100644
--- a/drivers/spi/spi_txx9.c
+++ b/drivers/spi/spi_txx9.c
@@ -29,6 +29,8 @@
29 29
30 30
31#define SPI_FIFO_SIZE 4 31#define SPI_FIFO_SIZE 4
32#define SPI_MAX_DIVIDER 0xff /* Max. value for SPCR1.SER */
33#define SPI_MIN_DIVIDER 1 /* Min. value for SPCR1.SER */
32 34
33#define TXx9_SPMCR 0x00 35#define TXx9_SPMCR 0x00
34#define TXx9_SPCR0 0x04 36#define TXx9_SPCR0 0x04
@@ -193,11 +195,8 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m)
193 195
194 if (prev_speed_hz != speed_hz 196 if (prev_speed_hz != speed_hz
195 || prev_bits_per_word != bits_per_word) { 197 || prev_bits_per_word != bits_per_word) {
196 u32 n = (c->baseclk + speed_hz - 1) / speed_hz; 198 int n = DIV_ROUND_UP(c->baseclk, speed_hz) - 1;
197 if (n < 1) 199 n = clamp(n, SPI_MIN_DIVIDER, SPI_MAX_DIVIDER);
198 n = 1;
199 else if (n > 0xff)
200 n = 0xff;
201 /* enter config mode */ 200 /* enter config mode */
202 txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, 201 txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR,
203 TXx9_SPMCR); 202 TXx9_SPMCR);
@@ -370,8 +369,8 @@ static int __init txx9spi_probe(struct platform_device *dev)
370 goto exit; 369 goto exit;
371 } 370 }
372 c->baseclk = clk_get_rate(c->clk); 371 c->baseclk = clk_get_rate(c->clk);
373 c->min_speed_hz = (c->baseclk + 0xff - 1) / 0xff; 372 c->min_speed_hz = DIV_ROUND_UP(c->baseclk, SPI_MAX_DIVIDER + 1);
374 c->max_speed_hz = c->baseclk; 373 c->max_speed_hz = c->baseclk / (SPI_MIN_DIVIDER + 1);
375 374
376 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 375 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
377 if (!res) 376 if (!res)