vserver 1.9.5.x5
[linux-2.6.git] / arch / arm / common / sa1111.c
index acc7d1a..37a39f2 100644 (file)
@@ -53,7 +53,7 @@ struct sa1111 {
        unsigned long   phys;
        int             irq;
        spinlock_t      lock;
-       void            *base;
+       void __iomem    *base;
 };
 
 /*
@@ -141,15 +141,16 @@ static void
 sa1111_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
 {
        unsigned int stat0, stat1, i;
+       void __iomem *base = desc->data;
 
-       stat0 = sa1111_readl(desc->data + SA1111_INTSTATCLR0);
-       stat1 = sa1111_readl(desc->data + SA1111_INTSTATCLR1);
+       stat0 = sa1111_readl(base + SA1111_INTSTATCLR0);
+       stat1 = sa1111_readl(base + SA1111_INTSTATCLR1);
 
-       sa1111_writel(stat0, desc->data + SA1111_INTSTATCLR0);
+       sa1111_writel(stat0, base + SA1111_INTSTATCLR0);
 
        desc->chip->ack(irq);
 
-       sa1111_writel(stat1, desc->data + SA1111_INTSTATCLR1);
+       sa1111_writel(stat1, base + SA1111_INTSTATCLR1);
 
        if (stat0 == 0 && stat1 == 0) {
                do_bad_IRQ(irq, desc, regs);
@@ -177,7 +178,7 @@ static void sa1111_ack_irq(unsigned int irq)
 
 static void sa1111_mask_lowirq(unsigned int irq)
 {
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ie0;
 
        ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
@@ -187,7 +188,7 @@ static void sa1111_mask_lowirq(unsigned int irq)
 
 static void sa1111_unmask_lowirq(unsigned int irq)
 {
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ie0;
 
        ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
@@ -205,7 +206,7 @@ static void sa1111_unmask_lowirq(unsigned int irq)
 static int sa1111_retrigger_lowirq(unsigned int irq)
 {
        unsigned int mask = SA1111_IRQMASK_LO(irq);
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ip0;
        int i;
 
@@ -226,7 +227,7 @@ static int sa1111_retrigger_lowirq(unsigned int irq)
 static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
 {
        unsigned int mask = SA1111_IRQMASK_LO(irq);
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ip0;
 
        if (flags == IRQT_PROBE)
@@ -249,7 +250,7 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
 static int sa1111_wake_lowirq(unsigned int irq, unsigned int on)
 {
        unsigned int mask = SA1111_IRQMASK_LO(irq);
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long we0;
 
        we0 = sa1111_readl(mapbase + SA1111_WAKEEN0);
@@ -273,7 +274,7 @@ static struct irqchip sa1111_low_chip = {
 
 static void sa1111_mask_highirq(unsigned int irq)
 {
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ie1;
 
        ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
@@ -283,7 +284,7 @@ static void sa1111_mask_highirq(unsigned int irq)
 
 static void sa1111_unmask_highirq(unsigned int irq)
 {
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ie1;
 
        ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
@@ -301,7 +302,7 @@ static void sa1111_unmask_highirq(unsigned int irq)
 static int sa1111_retrigger_highirq(unsigned int irq)
 {
        unsigned int mask = SA1111_IRQMASK_HI(irq);
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ip1;
        int i;
 
@@ -322,7 +323,7 @@ static int sa1111_retrigger_highirq(unsigned int irq)
 static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
 {
        unsigned int mask = SA1111_IRQMASK_HI(irq);
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long ip1;
 
        if (flags == IRQT_PROBE)
@@ -345,7 +346,7 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
 static int sa1111_wake_highirq(unsigned int irq, unsigned int on)
 {
        unsigned int mask = SA1111_IRQMASK_HI(irq);
-       void *mapbase = get_irq_chipdata(irq);
+       void __iomem *mapbase = get_irq_chipdata(irq);
        unsigned long we1;
 
        we1 = sa1111_readl(mapbase + SA1111_WAKEEN1);
@@ -369,7 +370,7 @@ static struct irqchip sa1111_high_chip = {
 
 static void sa1111_setup_irq(struct sa1111 *sachip)
 {
-       void *irqbase = sachip->base + SA1111_INTC;
+       void __iomem *irqbase = sachip->base + SA1111_INTC;
        unsigned int irq;
 
        /*
@@ -723,7 +724,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
 static void __sa1111_remove(struct sa1111 *sachip)
 {
        struct list_head *l, *n;
-       void *irqbase = sachip->base + SA1111_INTC;
+       void __iomem *irqbase = sachip->base + SA1111_INTC;
 
        list_for_each_safe(l, n, &sachip->dev->children) {
                struct device *d = list_to_dev(l);
@@ -797,22 +798,23 @@ struct sa1111_save_data {
        unsigned int    wakeen1;
 };
 
+#ifdef CONFIG_PM
+
 static int sa1111_suspend(struct device *dev, u32 state, u32 level)
 {
        struct sa1111 *sachip = dev_get_drvdata(dev);
        struct sa1111_save_data *save;
        unsigned long flags;
        unsigned int val;
-       char *base;
+       void __iomem *base;
 
        if (level != SUSPEND_DISABLE)
                return 0;
 
-       dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
-       if (!dev->saved_state)
+       save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
+       if (!save)
                return -ENOMEM;
-
-       save = (struct sa1111_save_data *)dev->saved_state;
+       dev->power.saved_state = save;
 
        spin_lock_irqsave(&sachip->lock, flags);
 
@@ -865,12 +867,12 @@ static int sa1111_resume(struct device *dev, u32 level)
        struct sa1111 *sachip = dev_get_drvdata(dev);
        struct sa1111_save_data *save;
        unsigned long flags, id;
-       char *base;
+       void __iomem *base;
 
        if (level != RESUME_ENABLE)
                return 0;
 
-       save = (struct sa1111_save_data *)dev->saved_state;
+       save = (struct sa1111_save_data *)dev->power.saved_state;
        if (!save)
                return 0;
 
@@ -915,12 +917,17 @@ static int sa1111_resume(struct device *dev, u32 level)
 
        spin_unlock_irqrestore(&sachip->lock, flags);
 
-       dev->saved_state = NULL;
+       dev->power.saved_state = NULL;
        kfree(save);
 
        return 0;
 }
 
+#else
+#define sa1111_suspend NULL
+#define sa1111_resume  NULL
+#endif
+
 static int sa1111_probe(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
@@ -943,8 +950,10 @@ static int sa1111_remove(struct device *dev)
                __sa1111_remove(sachip);
                dev_set_drvdata(dev, NULL);
 
-               kfree(dev->saved_state);
-               dev->saved_state = NULL;
+#ifdef CONFIG_PM
+               kfree(dev->power.saved_state);
+               dev->power.saved_state = NULL;
+#endif
        }
 
        return 0;
@@ -1086,7 +1095,7 @@ void sa1111_set_io_dir(struct sa1111_dev *sadev,
        struct sa1111 *sachip = sa1111_chip_driver(sadev);
        unsigned long flags;
        unsigned int val;
-       void *gpio = sachip->base + SA1111_GPIO;
+       void __iomem *gpio = sachip->base + SA1111_GPIO;
 
 #define MODIFY_BITS(port, mask, dir)           \
        if (mask) {                             \
@@ -1112,7 +1121,7 @@ void sa1111_set_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v)
        struct sa1111 *sachip = sa1111_chip_driver(sadev);
        unsigned long flags;
        unsigned int val;
-       void *gpio = sachip->base + SA1111_GPIO;
+       void __iomem *gpio = sachip->base + SA1111_GPIO;
 
        spin_lock_irqsave(&sachip->lock, flags);
        MODIFY_BITS(gpio + SA1111_GPIO_PADWR, bits & 15, v);
@@ -1126,7 +1135,7 @@ void sa1111_set_sleep_io(struct sa1111_dev *sadev, unsigned int bits, unsigned i
        struct sa1111 *sachip = sa1111_chip_driver(sadev);
        unsigned long flags;
        unsigned int val;
-       void *gpio = sachip->base + SA1111_GPIO;
+       void __iomem *gpio = sachip->base + SA1111_GPIO;
 
        spin_lock_irqsave(&sachip->lock, flags);
        MODIFY_BITS(gpio + SA1111_GPIO_PASSR, bits & 15, v);
@@ -1185,7 +1194,7 @@ static int sa1111_match(struct device *_dev, struct device_driver *_drv)
        return dev->devid == drv->devid;
 }
 
-static int sa1111_bus_suspend(struct device *dev, u32 state)
+static int sa1111_bus_suspend(struct device *dev, pm_message_t state)
 {
        struct sa1111_dev *sadev = SA1111_DEV(dev);
        struct sa1111_driver *drv = SA1111_DRV(dev->driver);