aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/hw_random/omap-rng.c33
-rw-r--r--drivers/i2c/busses/i2c-omap.c12
-rw-r--r--drivers/mmc/host/omap.c7
-rw-r--r--drivers/spi/omap2_mcspi.c12
-rw-r--r--drivers/spi/omap_uwire.c23
-rw-r--r--drivers/usb/host/ohci-omap.c14
-rw-r--r--drivers/video/omap/dispc.c15
-rw-r--r--drivers/video/omap/rfbi.c9
-rw-r--r--drivers/video/omap/sossi.c8
9 files changed, 107 insertions, 26 deletions
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 51738bdd834e..d4e7dca06e4f 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -118,18 +118,21 @@ static int __init omap_rng_probe(struct platform_device *pdev)
118 118
119 mem = request_mem_region(res->start, res->end - res->start + 1, 119 mem = request_mem_region(res->start, res->end - res->start + 1,
120 pdev->name); 120 pdev->name);
121 if (mem == NULL) 121 if (mem == NULL) {
122 return -EBUSY; 122 ret = -EBUSY;
123 goto err_region;
124 }
123 125
124 dev_set_drvdata(&pdev->dev, mem); 126 dev_set_drvdata(&pdev->dev, mem);
125 rng_base = (u32 __force __iomem *)io_p2v(res->start); 127 rng_base = ioremap(res->start, res->end - res->start + 1);
128 if (!rng_base) {
129 ret = -ENOMEM;
130 goto err_ioremap;
131 }
126 132
127 ret = hwrng_register(&omap_rng_ops); 133 ret = hwrng_register(&omap_rng_ops);
128 if (ret) { 134 if (ret)
129 release_resource(mem); 135 goto err_register;
130 rng_base = NULL;
131 return ret;
132 }
133 136
134 dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", 137 dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n",
135 omap_rng_read_reg(RNG_REV_REG)); 138 omap_rng_read_reg(RNG_REV_REG));
@@ -138,6 +141,18 @@ static int __init omap_rng_probe(struct platform_device *pdev)
138 rng_dev = pdev; 141 rng_dev = pdev;
139 142
140 return 0; 143 return 0;
144
145err_register:
146 iounmap(rng_base);
147 rng_base = NULL;
148err_ioremap:
149 release_resource(mem);
150err_region:
151 if (cpu_is_omap24xx()) {
152 clk_disable(rng_ick);
153 clk_put(rng_ick);
154 }
155 return ret;
141} 156}
142 157
143static int __exit omap_rng_remove(struct platform_device *pdev) 158static int __exit omap_rng_remove(struct platform_device *pdev)
@@ -148,6 +163,8 @@ static int __exit omap_rng_remove(struct platform_device *pdev)
148 163
149 omap_rng_write_reg(RNG_MASK_REG, 0x0); 164 omap_rng_write_reg(RNG_MASK_REG, 0x0);
150 165
166 iounmap(rng_base);
167
151 if (cpu_is_omap24xx()) { 168 if (cpu_is_omap24xx()) {
152 clk_disable(rng_ick); 169 clk_disable(rng_ick);
153 clk_put(rng_ick); 170 clk_put(rng_ick);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index e7eb7bf9ddec..608038d64f81 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -589,11 +589,16 @@ omap_i2c_probe(struct platform_device *pdev)
589 589
590 dev->dev = &pdev->dev; 590 dev->dev = &pdev->dev;
591 dev->irq = irq->start; 591 dev->irq = irq->start;
592 dev->base = (void __iomem *) IO_ADDRESS(mem->start); 592 dev->base = ioremap(mem->start, mem->end - mem->start + 1);
593 if (!dev->base) {
594 r = -ENOMEM;
595 goto err_free_mem;
596 }
597
593 platform_set_drvdata(pdev, dev); 598 platform_set_drvdata(pdev, dev);
594 599
595 if ((r = omap_i2c_get_clocks(dev)) != 0) 600 if ((r = omap_i2c_get_clocks(dev)) != 0)
596 goto err_free_mem; 601 goto err_iounmap;
597 602
598 omap_i2c_unidle(dev); 603 omap_i2c_unidle(dev);
599 604
@@ -640,6 +645,8 @@ err_unuse_clocks:
640 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); 645 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
641 omap_i2c_idle(dev); 646 omap_i2c_idle(dev);
642 omap_i2c_put_clocks(dev); 647 omap_i2c_put_clocks(dev);
648err_iounmap:
649 iounmap(dev->base);
643err_free_mem: 650err_free_mem:
644 platform_set_drvdata(pdev, NULL); 651 platform_set_drvdata(pdev, NULL);
645 kfree(dev); 652 kfree(dev);
@@ -661,6 +668,7 @@ omap_i2c_remove(struct platform_device *pdev)
661 i2c_del_adapter(&dev->adapter); 668 i2c_del_adapter(&dev->adapter);
662 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); 669 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
663 omap_i2c_put_clocks(dev); 670 omap_i2c_put_clocks(dev);
671 iounmap(dev->base);
664 kfree(dev); 672 kfree(dev);
665 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 673 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
666 release_mem_region(mem->start, (mem->end - mem->start) + 1); 674 release_mem_region(mem->start, (mem->end - mem->start) + 1);
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c16028872bbb..1e50bf56c2ce 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1455,7 +1455,9 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
1455 1455
1456 host->irq = irq; 1456 host->irq = irq;
1457 host->phys_base = host->mem_res->start; 1457 host->phys_base = host->mem_res->start;
1458 host->virt_base = (void __iomem *) IO_ADDRESS(host->phys_base); 1458 host->virt_base = ioremap(res->start, res->end - res->start + 1);
1459 if (!host->virt_base)
1460 goto err_ioremap;
1459 1461
1460 if (cpu_is_omap24xx()) { 1462 if (cpu_is_omap24xx()) {
1461 host->iclk = clk_get(&pdev->dev, "mmc_ick"); 1463 host->iclk = clk_get(&pdev->dev, "mmc_ick");
@@ -1510,6 +1512,8 @@ err_free_iclk:
1510 clk_put(host->iclk); 1512 clk_put(host->iclk);
1511 } 1513 }
1512err_free_mmc_host: 1514err_free_mmc_host:
1515 iounmap(host->virt_base);
1516err_ioremap:
1513 kfree(host); 1517 kfree(host);
1514err_free_mem_region: 1518err_free_mem_region:
1515 release_mem_region(res->start, res->end - res->start + 1); 1519 release_mem_region(res->start, res->end - res->start + 1);
@@ -1536,6 +1540,7 @@ static int mmc_omap_remove(struct platform_device *pdev)
1536 if (host->fclk && !IS_ERR(host->fclk)) 1540 if (host->fclk && !IS_ERR(host->fclk))
1537 clk_put(host->fclk); 1541 clk_put(host->fclk);
1538 1542
1543 iounmap(host->virt_base);
1539 release_mem_region(pdev->resource[0].start, 1544 release_mem_region(pdev->resource[0].start,
1540 pdev->resource[0].end - pdev->resource[0].start + 1); 1545 pdev->resource[0].end - pdev->resource[0].start + 1);
1541 1546
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 576ae29c39d8..454a2712e629 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1009,7 +1009,12 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
1009 } 1009 }
1010 1010
1011 mcspi->phys = r->start; 1011 mcspi->phys = r->start;
1012 mcspi->base = (void __iomem *) io_p2v(r->start); 1012 mcspi->base = ioremap(r->start, r->end - r->start + 1);
1013 if (!mcspi->base) {
1014 dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
1015 status = -ENOMEM;
1016 goto err1aa;
1017 }
1013 1018
1014 INIT_WORK(&mcspi->work, omap2_mcspi_work); 1019 INIT_WORK(&mcspi->work, omap2_mcspi_work);
1015 1020
@@ -1059,6 +1064,8 @@ err3:
1059err2: 1064err2:
1060 clk_put(mcspi->ick); 1065 clk_put(mcspi->ick);
1061err1a: 1066err1a:
1067 iounmap(mcspi->base);
1068err1aa:
1062 release_mem_region(r->start, (r->end - r->start) + 1); 1069 release_mem_region(r->start, (r->end - r->start) + 1);
1063err1: 1070err1:
1064 spi_master_put(master); 1071 spi_master_put(master);
@@ -1071,6 +1078,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
1071 struct omap2_mcspi *mcspi; 1078 struct omap2_mcspi *mcspi;
1072 struct omap2_mcspi_dma *dma_channels; 1079 struct omap2_mcspi_dma *dma_channels;
1073 struct resource *r; 1080 struct resource *r;
1081 void __iomem *base;
1074 1082
1075 master = dev_get_drvdata(&pdev->dev); 1083 master = dev_get_drvdata(&pdev->dev);
1076 mcspi = spi_master_get_devdata(master); 1084 mcspi = spi_master_get_devdata(master);
@@ -1082,7 +1090,9 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
1082 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1090 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1083 release_mem_region(r->start, (r->end - r->start) + 1); 1091 release_mem_region(r->start, (r->end - r->start) + 1);
1084 1092
1093 base = mcspi->base;
1085 spi_unregister_master(master); 1094 spi_unregister_master(master);
1095 iounmap(base);
1086 kfree(dma_channels); 1096 kfree(dma_channels);
1087 1097
1088 return 0; 1098 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 @@
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
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 95b3ec89c126..522185629624 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -344,7 +344,12 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver,
344 goto err1; 344 goto err1;
345 } 345 }
346 346
347 hcd->regs = (void __iomem *) (int) IO_ADDRESS(hcd->rsrc_start); 347 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
348 if (!hcd->regs) {
349 dev_err(&pdev->dev, "can't ioremap OHCI HCD\n");
350 retval = -ENOMEM;
351 goto err2;
352 }
348 353
349 ohci = hcd_to_ohci(hcd); 354 ohci = hcd_to_ohci(hcd);
350 ohci_hcd_init(ohci); 355 ohci_hcd_init(ohci);
@@ -355,11 +360,11 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver,
355 irq = platform_get_irq(pdev, 0); 360 irq = platform_get_irq(pdev, 0);
356 if (irq < 0) { 361 if (irq < 0) {
357 retval = -ENXIO; 362 retval = -ENXIO;
358 goto err2; 363 goto err3;
359 } 364 }
360 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED); 365 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
361 if (retval) 366 if (retval)
362 goto err2; 367 goto err3;
363 368
364 host_initialized = 1; 369 host_initialized = 1;
365 370
@@ -367,6 +372,8 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver,
367 omap_ohci_clock_power(0); 372 omap_ohci_clock_power(0);
368 373
369 return 0; 374 return 0;
375err3:
376 iounmap(hcd->regs);
370err2: 377err2:
371 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 378 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
372err1: 379err1:
@@ -401,6 +408,7 @@ usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev)
401 } 408 }
402 if (machine_is_omap_osk()) 409 if (machine_is_omap_osk())
403 omap_free_gpio(9); 410 omap_free_gpio(9);
411 iounmap(hcd->regs);
404 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 412 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
405 usb_put_hcd(hcd); 413 usb_put_hcd(hcd);
406 clk_put(usb_dc_ck); 414 clk_put(usb_dc_ck);
diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index 6efcf89e7fbe..58f624bd22e9 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -156,7 +156,7 @@ struct resmap {
156}; 156};
157 157
158static struct { 158static struct {
159 u32 base; 159 void __iomem *base;
160 160
161 struct omapfb_mem_desc mem_desc; 161 struct omapfb_mem_desc mem_desc;
162 struct resmap *res_map[DISPC_MEMTYPE_NUM]; 162 struct resmap *res_map[DISPC_MEMTYPE_NUM];
@@ -1349,14 +1349,19 @@ static int omap_dispc_init(struct omapfb_device *fbdev, int ext_mode,
1349 1349
1350 memset(&dispc, 0, sizeof(dispc)); 1350 memset(&dispc, 0, sizeof(dispc));
1351 1351
1352 dispc.base = io_p2v(DISPC_BASE); 1352 dispc.base = ioremap(DISPC_BASE, SZ_1K);
1353 if (!dispc.base) {
1354 dev_err(fbdev->dev, "can't ioremap DISPC\n");
1355 return -ENOMEM;
1356 }
1357
1353 dispc.fbdev = fbdev; 1358 dispc.fbdev = fbdev;
1354 dispc.ext_mode = ext_mode; 1359 dispc.ext_mode = ext_mode;
1355 1360
1356 init_completion(&dispc.frame_done); 1361 init_completion(&dispc.frame_done);
1357 1362
1358 if ((r = get_dss_clocks()) < 0) 1363 if ((r = get_dss_clocks()) < 0)
1359 return r; 1364 goto fail0;
1360 1365
1361 enable_interface_clocks(1); 1366 enable_interface_clocks(1);
1362 enable_lcd_clocks(1); 1367 enable_lcd_clocks(1);
@@ -1464,7 +1469,8 @@ fail1:
1464 enable_lcd_clocks(0); 1469 enable_lcd_clocks(0);
1465 enable_interface_clocks(0); 1470 enable_interface_clocks(0);
1466 put_dss_clocks(); 1471 put_dss_clocks();
1467 1472fail0:
1473 iounmap(dispc.base);
1468 return r; 1474 return r;
1469} 1475}
1470 1476
@@ -1481,6 +1487,7 @@ static void omap_dispc_cleanup(void)
1481 free_irq(INT_24XX_DSS_IRQ, dispc.fbdev); 1487 free_irq(INT_24XX_DSS_IRQ, dispc.fbdev);
1482 enable_interface_clocks(0); 1488 enable_interface_clocks(0);
1483 put_dss_clocks(); 1489 put_dss_clocks();
1490 iounmap(dispc.base);
1484} 1491}
1485 1492
1486const struct lcd_ctrl omap2_int_ctrl = { 1493const struct lcd_ctrl omap2_int_ctrl = {
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c
index 4a6f13d3facf..a13c8dcad2a8 100644
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -59,7 +59,7 @@
59#define DISPC_CONTROL 0x0040 59#define DISPC_CONTROL 0x0040
60 60
61static struct { 61static struct {
62 u32 base; 62 void __iomem *base;
63 void (*lcdc_callback)(void *data); 63 void (*lcdc_callback)(void *data);
64 void *lcdc_callback_data; 64 void *lcdc_callback_data;
65 unsigned long l4_khz; 65 unsigned long l4_khz;
@@ -518,7 +518,11 @@ static int rfbi_init(struct omapfb_device *fbdev)
518 int r; 518 int r;
519 519
520 rfbi.fbdev = fbdev; 520 rfbi.fbdev = fbdev;
521 rfbi.base = io_p2v(RFBI_BASE); 521 rfbi.base = ioremap(RFBI_BASE, SZ_1K);
522 if (!rfbi.base) {
523 dev_err(fbdev->dev, "can't ioremap RFBI\n");
524 return -ENOMEM;
525 }
522 526
523 if ((r = rfbi_get_clocks()) < 0) 527 if ((r = rfbi_get_clocks()) < 0)
524 return r; 528 return r;
@@ -566,6 +570,7 @@ static void rfbi_cleanup(void)
566{ 570{
567 omap_dispc_free_irq(); 571 omap_dispc_free_irq();
568 rfbi_put_clocks(); 572 rfbi_put_clocks();
573 iounmap(rfbi.base);
569} 574}
570 575
571const struct lcd_ctrl_extif omap2_ext_if = { 576const struct lcd_ctrl_extif omap2_ext_if = {
diff --git a/drivers/video/omap/sossi.c b/drivers/video/omap/sossi.c
index 6359353c2c67..a76946220249 100644
--- a/drivers/video/omap/sossi.c
+++ b/drivers/video/omap/sossi.c
@@ -574,7 +574,12 @@ static int sossi_init(struct omapfb_device *fbdev)
574 struct clk *dpll1out_ck; 574 struct clk *dpll1out_ck;
575 int r; 575 int r;
576 576
577 sossi.base = (void __iomem *)IO_ADDRESS(OMAP_SOSSI_BASE); 577 sossi.base = ioremap(OMAP_SOSSI_BASE, SZ_1K);
578 if (!sossi.base) {
579 dev_err(fbdev->dev, "can't ioremap SoSSI\n");
580 return -ENOMEM;
581 }
582
578 sossi.fbdev = fbdev; 583 sossi.fbdev = fbdev;
579 spin_lock_init(&sossi.lock); 584 spin_lock_init(&sossi.lock);
580 585
@@ -665,6 +670,7 @@ static void sossi_cleanup(void)
665{ 670{
666 omap_lcdc_free_dma_callback(); 671 omap_lcdc_free_dma_callback();
667 clk_put(sossi.fck); 672 clk_put(sossi.fck);
673 iounmap(sossi.base);
668} 674}
669 675
670struct lcd_ctrl_extif omap1_ext_if = { 676struct lcd_ctrl_extif omap1_ext_if = {