]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
HDQ driver: use ioremap for HDQ base
authorMadhusudhan Chikkature <madhu.cr@ti.com>
Thu, 25 Sep 2008 06:56:17 +0000 (12:26 +0530)
committerTony Lindgren <tony@atomide.com>
Mon, 6 Oct 2008 09:14:57 +0000 (12:14 +0300)
This patch provides the ioremap related changes to the driver.

Signed-off-by: Madhusudhan Chikkature <madhu.cr@ti.com>
Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/w1/masters/omap_hdq.c

index 29137a1388132e10965aea6e806a9ee156ee1388..9a2f3d08bece01bc0a27b77a9815b60b1622de00 100644 (file)
@@ -54,7 +54,7 @@ static int w1_id;
 
 struct hdq_data {
        struct device           *dev;
-       resource_size_t         hdq_base;
+       void __iomem            *hdq_base;
        struct  semaphore       hdq_semlock;
        int                     hdq_usecount;
        struct  clk             *hdq_ick;
@@ -99,12 +99,12 @@ static struct w1_bus_master omap_w1_master = {
  */
 static inline u8 hdq_reg_in(struct hdq_data *hdq_data, u32 offset)
 {
-       return omap_readb(hdq_data->hdq_base + offset);
+       return __raw_readb(hdq_data->hdq_base + offset);
 }
 
 static inline u8 hdq_reg_out(struct hdq_data *hdq_data, u32 offset, u8 val)
 {
-       omap_writeb(val, hdq_data->hdq_base + offset);
+       __raw_writeb(val, hdq_data->hdq_base + offset);
 
        return val;
 }
@@ -112,9 +112,9 @@ static inline u8 hdq_reg_out(struct hdq_data *hdq_data, u32 offset, u8 val)
 static inline u8 hdq_reg_merge(struct hdq_data *hdq_data, u32 offset,
                        u8 val, u8 mask)
 {
-       u8 new_val = (omap_readb(hdq_data->hdq_base + offset) & ~mask)
+       u8 new_val = (__raw_readb(hdq_data->hdq_base + offset) & ~mask)
                        | (val & mask);
-       omap_writeb(new_val, hdq_data->hdq_base + offset);
+       __raw_writeb(new_val, hdq_data->hdq_base + offset);
 
        return new_val;
 }
@@ -589,7 +589,12 @@ static int __init omap_hdq_probe(struct platform_device *pdev)
                goto err_resource;
        }
 
-       hdq_data->hdq_base = res->start;
+       hdq_data->hdq_base = ioremap(res->start, SZ_4K);
+       if (!hdq_data->hdq_base) {
+               dev_dbg(&pdev->dev, "ioremap failed\n");
+               ret = -EINVAL;
+               goto err_ioremap;
+       }
 
        /* get interface & functional clock objects */
        hdq_data->hdq_ick = clk_get(&pdev->dev, "hdq_ick");
@@ -668,8 +673,9 @@ err_ick:
        clk_put(hdq_data->hdq_fck);
 
 err_clk:
-       hdq_data->hdq_base = NULL;
+       iounmap(hdq_data->hdq_base);
 
+err_ioremap:
 err_resource:
        platform_set_drvdata(pdev, NULL);
        kfree(hdq_data);
@@ -695,6 +701,7 @@ static int omap_hdq_remove(struct platform_device *pdev)
        clk_put(hdq_data->hdq_fck);
        free_irq(INT_24XX_HDQ_IRQ, hdq_data);
        platform_set_drvdata(pdev, NULL);
+       iounmap(hdq_data->hdq_base);
        kfree(hdq_data);
 
        return 0;