summaryrefslogtreecommitdiff
path: root/arch/arm/kernel/ecard.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel/ecard.c')
-rw-r--r--arch/arm/kernel/ecard.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index bdbd7da99286..f56d48c451ea 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -41,11 +41,11 @@
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/kthread.h>
+#include <linux/io.h>
#include <asm/dma.h>
#include <asm/ecard.h>
#include <asm/hardware.h>
-#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mmu_context.h>
#include <asm/mach/irq.h>
@@ -958,6 +958,31 @@ void ecard_release_resources(struct expansion_card *ec)
}
EXPORT_SYMBOL(ecard_release_resources);
+void ecard_setirq(struct expansion_card *ec, const struct expansion_card_ops *ops, void *irq_data)
+{
+ ec->irq_data = irq_data;
+ barrier();
+ ec->ops = ops;
+}
+EXPORT_SYMBOL(ecard_setirq);
+
+void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res,
+ unsigned long offset, unsigned long maxsize)
+{
+ unsigned long start = ecard_resource_start(ec, res);
+ unsigned long end = ecard_resource_end(ec, res);
+
+ if (offset > (end - start))
+ return NULL;
+
+ start += offset;
+ if (maxsize && end - start > maxsize)
+ end = start + maxsize;
+
+ return devm_ioremap(&ec->dev, start, end - start);
+}
+EXPORT_SYMBOL(ecardm_iomap);
+
/*
* Probe for an expansion card.
*
@@ -1133,6 +1158,14 @@ static int ecard_drv_remove(struct device *dev)
drv->remove(ec);
ecard_release(ec);
+ /*
+ * Restore the default operations. We ensure that the
+ * ops are set before we change the data.
+ */
+ ec->ops = &ecard_default_ops;
+ barrier();
+ ec->irq_data = NULL;
+
return 0;
}