Merge branch 'misc' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc...
[pandora-kernel.git] / arch / arm / common / scoop.c
index 0c3cbd9..314ebd3 100644 (file)
 
 #include <linux/device.h>
 #include <linux/string.h>
+#include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <asm/io.h>
 #include <asm/hardware/scoop.h>
 
+/* PCMCIA to Scoop linkage
+
+   There is no easy way to link multiple scoop devices into one
+   single entity for the pxa2xx_pcmcia device so this structure
+   is used which is setup by the platform code.
+
+   This file is never modular so this symbol is always
+   accessile to the board support files.
+*/
+struct scoop_pcmcia_config *platform_scoop_config;
+EXPORT_SYMBOL(platform_scoop_config);
+
 #define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr)))
 
 struct  scoop_dev {
@@ -33,7 +46,6 @@ void reset_scoop(struct device *dev)
 
        SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100;  // 00
        SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000;  // 04
-       SCOOP_REG(sdev->base,SCOOP_CPR) = 0x0000;  // 0C
        SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000;  // 10
        SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000;  // 18
        SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF;  // 14
@@ -132,12 +144,10 @@ int __init scoop_probe(struct platform_device *pdev)
        if (!mem)
                return -EINVAL;
 
-       devptr = kmalloc(sizeof(struct scoop_dev), GFP_KERNEL);
-
+       devptr = kzalloc(sizeof(struct scoop_dev), GFP_KERNEL);
        if (!devptr)
-               return  -ENOMEM;
+               return -ENOMEM;
 
-       memset(devptr, 0, sizeof(struct scoop_dev));
        spin_lock_init(&devptr->scoop_lock);
 
        inf = pdev->dev.platform_data;
@@ -154,6 +164,7 @@ int __init scoop_probe(struct platform_device *pdev)
 
        SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
        reset_scoop(&pdev->dev);
+       SCOOP_REG(devptr->base, SCOOP_CPR) = 0x0000;
        SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
        SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;