aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-06-03 18:17:07 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-06-03 18:17:07 +0000
commitb8b3fe08cba0cb67cc7d1430a1b80da0c5780cf7 (patch)
treea347850a40ec9910f69fc0ecd0bdd1d0c252fda1 /target/linux
parentc5a5c25d0f4fe43b8443f2001d18f0d4e7193842 (diff)
downloadupstream-b8b3fe08cba0cb67cc7d1430a1b80da0c5780cf7.tar.gz
upstream-b8b3fe08cba0cb67cc7d1430a1b80da0c5780cf7.tar.bz2
upstream-b8b3fe08cba0cb67cc7d1430a1b80da0c5780cf7.zip
[ar71xx] add flash locking code
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16311 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c24
-rw-r--r--target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h4
2 files changed, 27 insertions, 1 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c
index f224e82c0c..ea7ae143bd 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c
@@ -1,7 +1,7 @@
/*
* AR71xx SoC routines
*
- * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify it
@@ -12,9 +12,13 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
+#include <linux/mutex.h>
#include <asm/mach-ar71xx/ar71xx.h>
+static DEFINE_MUTEX(ar71xx_flash_mutex);
+static int ar71xx_flash_lock_enabled;
+
void __iomem *ar71xx_ddr_base;
EXPORT_SYMBOL_GPL(ar71xx_ddr_base);
@@ -98,3 +102,21 @@ void ar71xx_ddr_flush(u32 reg)
}
EXPORT_SYMBOL_GPL(ar71xx_ddr_flush);
+void __init ar71xx_flash_lock_enable(void)
+{
+ ar71xx_flash_lock_enabled = 1;
+}
+
+void ar71xx_flash_acquire(void)
+{
+ if (ar71xx_flash_lock_enabled)
+ mutex_lock(&ar71xx_flash_mutex);
+}
+EXPORT_SYMBOL_GPL(ar71xx_flash_acquire);
+
+void ar71xx_flash_release(void)
+{
+ if (ar71xx_flash_lock_enabled)
+ mutex_unlock(&ar71xx_flash_mutex);
+}
+EXPORT_SYMBOL_GPL(ar71xx_flash_release);
diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
index 86272789bd..19a546e56e 100644
--- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
+++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
@@ -422,6 +422,10 @@ void ar71xx_device_start(u32 mask);
#define SPI_IOC_CS2 SPI_IOC_CS(2)
#define SPI_IOC_CS_ALL (SPI_IOC_CS0 | SPI_IOC_CS1 | SPI_IOC_CS2)
+void ar71xx_flash_lock_enable(void) __init;
+void ar71xx_flash_acquire(void);
+void ar71xx_flash_release(void);
+
/*
* MII_CTRL block
*/