diff options
author | Len Brown <len.brown@intel.com> | 2008-10-22 23:57:26 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-23 00:11:07 -0400 |
commit | 057316cc6a5b521b332a1d7ccc871cd60c904c74 (patch) | |
tree | 4333e608da237c73ff69b10878025cca96dcb4c8 /drivers/spi/omap_uwire.c | |
parent | 3e2dab9a1c2deb03c311eb3f83466009147ed4d3 (diff) | |
parent | 2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4 (diff) |
Merge branch 'linus' into test
Conflicts:
MAINTAINERS
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/acpi/sleep.c
drivers/acpi/Kconfig
drivers/pnp/Makefile
drivers/pnp/quirks.c
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/spi/omap_uwire.c')
-rw-r--r-- | drivers/spi/omap_uwire.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c index 5515eb97d7c..bab6ff061e9 100644 --- a/drivers/spi/omap_uwire.c +++ b/drivers/spi/omap_uwire.c @@ -59,7 +59,6 @@ * and irqs should show there too... */ #define UWIRE_BASE_PHYS 0xFFFB3000 -#define UWIRE_BASE ((void *__iomem)IO_ADDRESS(UWIRE_BASE_PHYS)) /* uWire Registers: */ #define UWIRE_IO_SIZE 0x20 @@ -103,16 +102,21 @@ struct uwire_state { }; /* REVISIT compile time constant for idx_shift? */ +/* + * Or, put it in a structure which is used throughout the driver; + * that avoids having to issue two loads for each bit of static data. + */ static unsigned int uwire_idx_shift; +static void __iomem *uwire_base; static inline void uwire_write_reg(int idx, u16 val) { - __raw_writew(val, UWIRE_BASE + (idx << uwire_idx_shift)); + __raw_writew(val, uwire_base + (idx << uwire_idx_shift)); } static inline u16 uwire_read_reg(int idx) { - return __raw_readw(UWIRE_BASE + (idx << uwire_idx_shift)); + return __raw_readw(uwire_base + (idx << uwire_idx_shift)); } static inline void omap_uwire_configure_mode(u8 cs, unsigned long flags) @@ -492,6 +496,14 @@ static int __init uwire_probe(struct platform_device *pdev) return -ENODEV; uwire = spi_master_get_devdata(master); + + uwire_base = ioremap(UWIRE_BASE_PHYS, UWIRE_IO_SIZE); + if (!uwire_base) { + dev_dbg(&pdev->dev, "can't ioremap UWIRE\n"); + spi_master_put(master); + return -ENOMEM; + } + dev_set_drvdata(&pdev->dev, uwire); uwire->ck = clk_get(&pdev->dev, "armxor_ck"); @@ -520,8 +532,10 @@ static int __init uwire_probe(struct platform_device *pdev) uwire->bitbang.txrx_bufs = uwire_txrx; status = spi_bitbang_start(&uwire->bitbang); - if (status < 0) + if (status < 0) { uwire_off(uwire); + iounmap(uwire_base); + } return status; } @@ -534,6 +548,7 @@ static int __exit uwire_remove(struct platform_device *pdev) status = spi_bitbang_stop(&uwire->bitbang); uwire_off(uwire); + iounmap(uwire_base); return status; } |