aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/omap_uwire.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-09-04 09:07:22 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-05 12:02:30 -0400
commit55c381e4896be2611da87088acfad74b361239ab (patch)
tree1515420c29dbbfd987f0157f16d8bb8cac938c15 /drivers/spi/omap_uwire.c
parent690b5a13b27ba3bb2c9d61c1f4018c5074b591e6 (diff)
[ARM] omap: convert OMAP drivers to use ioremap()
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/spi/omap_uwire.c')
-rw-r--r--drivers/spi/omap_uwire.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index 5515eb97d7c5..bab6ff061e91 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -59,7 +59,6 @@
59 * and irqs should show there too... 59 * and irqs should show there too...
60 */ 60 */
61#define UWIRE_BASE_PHYS 0xFFFB3000 61#define UWIRE_BASE_PHYS 0xFFFB3000
62#define UWIRE_BASE ((void *__iomem)IO_ADDRESS(UWIRE_BASE_PHYS))
63 62
64/* uWire Registers: */ 63/* uWire Registers: */
65#define UWIRE_IO_SIZE 0x20 64#define UWIRE_IO_SIZE 0x20
@@ -103,16 +102,21 @@ struct uwire_state {
103}; 102};
104 103
105/* REVISIT compile time constant for idx_shift? */ 104/* REVISIT compile time constant for idx_shift? */
105/*
106 * Or, put it in a structure which is used throughout the driver;
107 * that avoids having to issue two loads for each bit of static data.
108 */
106static unsigned int uwire_idx_shift; 109static unsigned int uwire_idx_shift;
110static void __iomem *uwire_base;
107 111
108static inline void uwire_write_reg(int idx, u16 val) 112static inline void uwire_write_reg(int idx, u16 val)
109{ 113{
110 __raw_writew(val, UWIRE_BASE + (idx << uwire_idx_shift)); 114 __raw_writew(val, uwire_base + (idx << uwire_idx_shift));
111} 115}
112 116
113static inline u16 uwire_read_reg(int idx) 117static inline u16 uwire_read_reg(int idx)
114{ 118{
115 return __raw_readw(UWIRE_BASE + (idx << uwire_idx_shift)); 119 return __raw_readw(uwire_base + (idx << uwire_idx_shift));
116} 120}
117 121
118static inline void omap_uwire_configure_mode(u8 cs, unsigned long flags) 122static inline void omap_uwire_configure_mode(u8 cs, unsigned long flags)
@@ -492,6 +496,14 @@ static int __init uwire_probe(struct platform_device *pdev)
492 return -ENODEV; 496 return -ENODEV;
493 497
494 uwire = spi_master_get_devdata(master); 498 uwire = spi_master_get_devdata(master);
499
500 uwire_base = ioremap(UWIRE_BASE_PHYS, UWIRE_IO_SIZE);
501 if (!uwire_base) {
502 dev_dbg(&pdev->dev, "can't ioremap UWIRE\n");
503 spi_master_put(master);
504 return -ENOMEM;
505 }
506
495 dev_set_drvdata(&pdev->dev, uwire); 507 dev_set_drvdata(&pdev->dev, uwire);
496 508
497 uwire->ck = clk_get(&pdev->dev, "armxor_ck"); 509 uwire->ck = clk_get(&pdev->dev, "armxor_ck");
@@ -520,8 +532,10 @@ static int __init uwire_probe(struct platform_device *pdev)
520 uwire->bitbang.txrx_bufs = uwire_txrx; 532 uwire->bitbang.txrx_bufs = uwire_txrx;
521 533
522 status = spi_bitbang_start(&uwire->bitbang); 534 status = spi_bitbang_start(&uwire->bitbang);
523 if (status < 0) 535 if (status < 0) {
524 uwire_off(uwire); 536 uwire_off(uwire);
537 iounmap(uwire_base);
538 }
525 return status; 539 return status;
526} 540}
527 541
@@ -534,6 +548,7 @@ static int __exit uwire_remove(struct platform_device *pdev)
534 548
535 status = spi_bitbang_stop(&uwire->bitbang); 549 status = spi_bitbang_stop(&uwire->bitbang);
536 uwire_off(uwire); 550 uwire_off(uwire);
551 iounmap(uwire_base);
537 return status; 552 return status;
538} 553}
539 554