summaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards/mimc200/fram.c
diff options
context:
space:
mode:
authorMark Jackson <mpfj@mimc.co.uk>2008-10-13 13:14:50 +0000
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-10-13 16:36:25 +0200
commit5b50c166b79ffa0a2e3b0f3785fa5263685a81f2 (patch)
treef3dbd0082c413dccd3ed6cb5c0c9ac46cce2e4cc /arch/avr32/boards/mimc200/fram.c
parent198f29358a31cdca1a496d19da90bd5d6c8527ce (diff)
downloadblackbird-op-linux-5b50c166b79ffa0a2e3b0f3785fa5263685a81f2.tar.gz
blackbird-op-linux-5b50c166b79ffa0a2e3b0f3785fa5263685a81f2.zip
avr32: Add MIMC200 board support
Please consider the following patch which adds support for a new AVR32 based board. The board is closely based on Atmel's NGW100 reference board, but has an extra 8MByte FLASH and 128KByte FRAM. Signed-off-by: Mark Jackson <mpfj@mimc.co.uk> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/boards/mimc200/fram.c')
-rw-r--r--arch/avr32/boards/mimc200/fram.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/arch/avr32/boards/mimc200/fram.c b/arch/avr32/boards/mimc200/fram.c
new file mode 100644
index 000000000000..54fbd95cee9b
--- /dev/null
+++ b/arch/avr32/boards/mimc200/fram.c
@@ -0,0 +1,80 @@
+/*
+ * FRAM driver for MIMC200 board
+ *
+ * Copyright 2008 Mark Jackson <mpfj@mimc.co.uk>
+ *
+ * This module adds *very* simply support for the system's FRAM device.
+ * At the moment, this is hard-coded to the MIMC200 platform, and only
+ * supports mmap().
+ */
+
+#define FRAM_VERSION "1.0"
+
+#include <linux/miscdevice.h>
+#include <linux/proc_fs.h>
+#include <linux/mm.h>
+#include <linux/io.h>
+
+#define FRAM_BASE 0xac000000
+#define FRAM_SIZE 0x20000
+
+/*
+ * The are the file operation function for user access to /dev/fram
+ */
+
+static int fram_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+ int ret;
+
+ ret = remap_pfn_range(vma,
+ vma->vm_start,
+ virt_to_phys((void *)((unsigned long)FRAM_BASE)) >> PAGE_SHIFT,
+ vma->vm_end-vma->vm_start,
+ PAGE_SHARED);
+
+ if (ret != 0)
+ return -EAGAIN;
+
+ return 0;
+}
+
+static const struct file_operations fram_fops = {
+ .owner = THIS_MODULE,
+ .mmap = fram_mmap,
+};
+
+#define FRAM_MINOR 0
+
+static struct miscdevice fram_dev = {
+ FRAM_MINOR,
+ "fram",
+ &fram_fops
+};
+
+static int __init
+fram_init(void)
+{
+ int ret;
+
+ ret = misc_register(&fram_dev);
+ if (ret) {
+ printk(KERN_ERR "fram: can't misc_register on minor=%d\n",
+ FRAM_MINOR);
+ return ret;
+ }
+ printk(KERN_INFO "FRAM memory driver v" FRAM_VERSION "\n");
+ return 0;
+}
+
+static void __exit
+fram_cleanup_module(void)
+{
+ misc_deregister(&fram_dev);
+}
+
+module_init(fram_init);
+module_exit(fram_cleanup_module);
+
+MODULE_LICENSE("GPL");
+
+MODULE_ALIAS_MISCDEV(FRAM_MINOR);
OpenPOWER on IntegriCloud