diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 11:25:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 11:25:32 -0700 |
commit | 8ef50901d3c619127858b7d7f614fcab45e09d6b (patch) | |
tree | e75a0d48029d4a5857033e4edf1cd572a5a3fc62 /drivers/spi | |
parent | 435263702ef0fc9ffdc6301a71c03b1d9ac0f1e0 (diff) | |
parent | 2502991560dc8244dbe10e48473d85722c1e2ec1 (diff) | |
download | blackbird-op-linux-8ef50901d3c619127858b7d7f614fcab45e09d6b.tar.gz blackbird-op-linux-8ef50901d3c619127858b7d7f614fcab45e09d6b.zip |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (51 commits)
[ARM] 5308/1: Fix Viper ISA IRQ handling
[ARM] 5307/1: pxa: fix CM-X2XX PCMCIA build error
[ARM] 5306/1: pxa: fix build error on CM-X270
[ARM] 5302/1: ARM: OMAP: Revert omap3 WDT changes to avoid merge conflict
[ARM] 5305/1: ARM: OMAP: Fix compile of McBSP by removing unnecessary check
[ARM] 5301/1: ARM: OMAP: Add missing irq defines
ARM: OMAP3: Add default kernel config for OMAP LDP
ARM: OMAP3: Add basic board support for OMAP LDP
ARM: OMAP3: Defconfig for the Gumstix Overo board (rev 3)
ARM: OMAP3: Add support for the Gumstix Overo board (rev 3)
ARM: OMAP3: Add Beagle defconfig
ARM: OMAP3: Add minimal Beagle board support
ARM: OMAP3: Add minimal omap3430 support
ARM: OMAP2: Fix sparse, checkpatch warnings in OMAP2/3 IRQ code
ARM: OMAP: Fixes to omap_mcbsp_request function
ARM: OMAP: Add support for OMAP2430 in McBSP
ARM: OMAP: Add support for McBSP devices 3 - 5 on 34xx
ARM: OMAP: Allocate McBSP devices dynamically
Fix sections for omap-mcbsp platform driver
[ARM] S3C24XX: Additional include moves
...
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/omap2_mcspi.c | 18 | ||||
-rw-r--r-- | drivers/spi/omap_uwire.c | 23 |
2 files changed, 35 insertions, 6 deletions
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 9d2186fd74aa..454a2712e629 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c @@ -119,12 +119,14 @@ struct omap2_mcspi { struct clk *fck; /* Virtual base address of the controller */ void __iomem *base; + unsigned long phys; /* SPI1 has 4 channels, while SPI2 has 2 */ struct omap2_mcspi_dma *dma_channels; }; struct omap2_mcspi_cs { void __iomem *base; + unsigned long phys; int word_len; }; @@ -233,7 +235,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) c = count; word_len = cs->word_len; - base = (unsigned long) io_v2p(cs->base); + base = cs->phys; tx_reg = base + OMAP2_MCSPI_TX0; rx_reg = base + OMAP2_MCSPI_RX0; rx = xfer->rx_buf; @@ -633,6 +635,7 @@ static int omap2_mcspi_setup(struct spi_device *spi) if (!cs) return -ENOMEM; cs->base = mcspi->base + spi->chip_select * 0x14; + cs->phys = mcspi->phys + spi->chip_select * 0x14; spi->controller_state = cs; } @@ -1005,7 +1008,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) goto err1; } - mcspi->base = (void __iomem *) io_p2v(r->start); + mcspi->phys = r->start; + mcspi->base = ioremap(r->start, r->end - r->start + 1); + if (!mcspi->base) { + dev_dbg(&pdev->dev, "can't ioremap MCSPI\n"); + status = -ENOMEM; + goto err1aa; + } INIT_WORK(&mcspi->work, omap2_mcspi_work); @@ -1055,6 +1064,8 @@ err3: err2: clk_put(mcspi->ick); err1a: + iounmap(mcspi->base); +err1aa: release_mem_region(r->start, (r->end - r->start) + 1); err1: spi_master_put(master); @@ -1067,6 +1078,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) struct omap2_mcspi *mcspi; struct omap2_mcspi_dma *dma_channels; struct resource *r; + void __iomem *base; master = dev_get_drvdata(&pdev->dev); mcspi = spi_master_get_devdata(master); @@ -1078,7 +1090,9 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) r = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(r->start, (r->end - r->start) + 1); + base = mcspi->base; spi_unregister_master(master); + iounmap(base); kfree(dma_channels); return 0; 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 @@ * 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; } |