 +
 +EXPORT_SYMBOL(ox810_pci_register_semaphore_callbacks);
 +EXPORT_SYMBOL(ox810_pci_reset_semaphore_callbacks);
---- old/include/asm-arm/arch-hipox/smc.h	2011-05-16 11:00:09.165565000 +0200
-+++ new/include/asm-arm/arch-hipox/smc.h	2011-05-19 14:28:04.805564999 +0200
+diff -Nurd linux-2.6.24.orig//drivers/mtd/maps/physmap.c linux-2.6.24/drivers/mtd/maps/physmap.c
+--- linux-2.6.24.orig//drivers/mtd/maps/physmap.c	2011-06-15 08:54:14.204048457 +0200
++++ linux-2.6.24/drivers/mtd/maps/physmap.c	2011-06-15 09:12:40.775896237 +0200
+@@ -22,6 +22,7 @@
+ #include <linux/mtd/partitions.h>
+ #include <linux/mtd/physmap.h>
+ #include <asm/io.h>
++#include <asm/bug.h>
+ 
+ #if defined (CONFIG_ARCH_HIPOX)
+ #include <asm/arch/smc.h>
+@@ -87,11 +88,12 @@
+ 
+ 	// printk("%s:%d would wait for hipox_flash_mutex\n", __func__, __LINE__);
+ 	mutex_lock(&hipox_flash_mutex);
+-	hipox_smc_request_pci_ad_31_0();
++	if ( 0 != ox810_flash_acquire_bus() )
++		BUG();
+ 
+ 	ret = inline_map_read(map, ofs);
+ 
+-	hipox_smc_release_pci_ad_31_0();
++	ox810_flash_release_bus();
+ 	mutex_unlock(&hipox_flash_mutex);
+ 	// printk("%s:%d hipox_flash_mutex unlocked\n", __func__, __LINE__);
+ 
+@@ -102,11 +104,12 @@
+ {
+ 	// printk("%s:%d would wait for hipox_flash_mutex\n", __func__, __LINE__);
+ 	mutex_lock(&hipox_flash_mutex);
+-	hipox_smc_request_pci_ad_31_0();
++	if ( 0 != ox810_flash_acquire_bus() )
++		BUG();
+ 
+ 	inline_map_write(map, datum, ofs);
+ 
+-	hipox_smc_release_pci_ad_31_0();
++	ox810_flash_release_bus();
+ 	mutex_unlock(&hipox_flash_mutex);
+ 	// printk("%s:%d hipox_flash_mutex unlocked\n", __func__, __LINE__);
+ }
+@@ -115,11 +118,12 @@
+ {
+ 	// printk("%s:%d would wait for hipox_flash_mutex\n", __func__, __LINE__);
+ 	mutex_lock(&hipox_flash_mutex);
+-	hipox_smc_request_pci_ad_31_0();
++	if ( 0 != ox810_flash_acquire_bus() )
++		BUG();
+ 
+ 	inline_map_copy_from(map, to, from, len);
+ 
+-	hipox_smc_release_pci_ad_31_0();
++	ox810_flash_release_bus();
+ 	mutex_unlock(&hipox_flash_mutex);
+ 	// printk("%s:%d hipox_flash_mutex unlocked\n", __func__, __LINE__);
+ }
+@@ -128,11 +132,12 @@
+ {
+ 	// printk("%s:%d would wait for hipox_flash_mutex\n", __func__, __LINE__);
+ 	mutex_lock(&hipox_flash_mutex);
+-	hipox_smc_request_pci_ad_31_0();
++	if ( 0 != ox810_flash_acquire_bus() )
++		BUG();
+ 
+ 	inline_map_copy_to(map, to, from, len);
+ 
+-	hipox_smc_release_pci_ad_31_0();
++	ox810_flash_release_bus();
+ 	mutex_unlock(&hipox_flash_mutex);
+ 	// printk("%s:%d hipox_flash_mutex unlocked\n", __func__, __LINE__);
+ }
+diff -Nurd linux-2.6.24.orig//drivers/mtd/nand/hipox_nand.c linux-2.6.24/drivers/mtd/nand/hipox_nand.c
+--- linux-2.6.24.orig//drivers/mtd/nand/hipox_nand.c	2011-06-15 08:54:14.197048982 +0200
++++ linux-2.6.24/drivers/mtd/nand/hipox_nand.c	2011-06-15 09:07:11.675625433 +0200
+@@ -23,6 +23,7 @@
+ #include <linux/delay.h>
+ #include <linux/mutex.h>
+ #include <asm/io.h>
++#include <asm/bug.h>
+ #include <asm/arch/hardware.h>
+ #include <asm/arch/smc.h>
+ #include <asm/sizes.h>
+@@ -104,9 +105,10 @@
+ 
+ 	if (cmd != NAND_CMD_NONE)
+ 	{
+-		hipox_smc_request_pci_ad_31_0();
++		if ( ox810_flash_acquire_bus() )
++			BUG();
+ 		writeb(cmd, this->IO_ADDR_W);
+-		hipox_smc_release_pci_ad_31_0();
++		ox810_flash_release_bus();
+ 	}
+ }
+ 
+@@ -120,9 +122,13 @@
+ {
+ 	struct nand_chip *chip = mtd->priv;
+ 	uint8_t res;
+-	hipox_smc_request_pci_ad_31_0();
++
++	if ( ox810_flash_acquire_bus() )
++		BUG();
++
+ 	res = readb(chip->IO_ADDR_R);
+-	hipox_smc_release_pci_ad_31_0();
++
++	ox810_flash_release_bus();
+ 	return res;
+ }
+ 
+@@ -137,9 +143,13 @@
+ {
+ 	struct nand_chip *chip = mtd->priv;
+ 	u16 res;
+-	hipox_smc_request_pci_ad_31_0();
++
++	if ( ox810_flash_acquire_bus() )
++		BUG();
++
+ 	res = readw(chip->IO_ADDR_R);
+-	hipox_smc_release_pci_ad_31_0();
++
++	ox810_flash_release_bus();
+ 	return res;
+ }
+ 
+@@ -156,10 +166,13 @@
+ 	int i;
+ 	struct nand_chip *chip = mtd->priv;
+ 
+-	hipox_smc_request_pci_ad_31_0();
++	if ( ox810_flash_acquire_bus() )
++		BUG();
++
+ 	for (i = 0; i < len; i++)
+ 		buf[i] = readb(chip->IO_ADDR_R);
+-	hipox_smc_release_pci_ad_31_0();
++
++	ox810_flash_release_bus();
+ }
+ 
+ /**
+@@ -175,10 +188,13 @@
+ 	int i;
+ 	struct nand_chip *chip = mtd->priv;
+ 
+-	hipox_smc_request_pci_ad_31_0();
++	if ( ox810_flash_acquire_bus() )
++		BUG();
++
+ 	for (i = 0; i < len; i++)
+ 		writeb(buf[i], chip->IO_ADDR_W);
+-	hipox_smc_release_pci_ad_31_0();
++
++	ox810_flash_release_bus();
+ }
+ 
+ /**
+@@ -195,7 +211,9 @@
+ 	int ret = 0;
+ 	struct nand_chip *chip = mtd->priv;
+ 
+-	hipox_smc_request_pci_ad_31_0();
++	if ( ox810_flash_acquire_bus() )
++		BUG();
++
+ 	for (i = 0; i < len; i++)
+ 	{
+ 		if (buf[i] != readb(chip->IO_ADDR_R))
+@@ -204,7 +222,8 @@
+ 			break;
+ 		}
+ 	}
+-	hipox_smc_release_pci_ad_31_0();
++
++	ox810_flash_release_bus();
+ 
+ 	return ret;
+ }
+diff -Nurd linux-2.6.24.orig//include/asm-arm/arch-hipox/smc.h linux-2.6.24/include/asm-arm/arch-hipox/smc.h
+--- linux-2.6.24.orig//include/asm-arm/arch-hipox/smc.h	2011-06-15 08:54:17.548796712 +0200
++++ linux-2.6.24/include/asm-arm/arch-hipox/smc.h	2011-06-15 09:01:21.333880081 +0200
 @@ -15,14 +15,43 @@
   */
  extern struct mutex hipox_flash_mutex;

     pci_common_init(&hipox_pci);
 	return 0;
 }
--- old/arch/arm/mach-hipox/smc.c	2011-05-16 11:00:09.165565000 +0200
+++ new/arch/arm/mach-hipox/smc.c	2011-05-19 16:17:55.335565001 +0200
@@ -20,17 +20,17 @@
 
 #include <asm/io.h>
 #include <asm/hardware.h>

 #include <asm/arch/smc.h>
 #include <linux/delay.h>
 #include <linux/jiffies.h>
@@ -30,7 +31,7 @@
 /*
  * Request PCI_ARB to grant access to the STATIC core.
  */
