Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze
diff --git a/arch/microblaze/include/asm/bitops.h b/arch/microblaze/include/asm/bitops.h
index d24f2cf..2cab2ac 100644
--- a/arch/microblaze/include/asm/bitops.h
+++ b/arch/microblaze/include/asm/bitops.h
@@ -14,38 +14,14 @@
 
 #ifdef __KERNEL__
 /*
- * Function prototypes to keep gcc -Wall happy
- */
-
-/*
  * The __ functions are not atomic
  */
 
-extern void set_bit(int nr, volatile void * addr);
-extern void __set_bit(int nr, volatile void * addr);
-
-extern void clear_bit(int nr, volatile void * addr);
-#define __clear_bit(nr, addr) clear_bit(nr, addr)
-#define PLATFORM__CLEAR_BIT
-
-extern void change_bit(int nr, volatile void * addr);
-extern void __change_bit(int nr, volatile void * addr);
-extern int test_and_set_bit(int nr, volatile void * addr);
-extern int __test_and_set_bit(int nr, volatile void * addr);
-extern int test_and_clear_bit(int nr, volatile void * addr);
-extern int __test_and_clear_bit(int nr, volatile void * addr);
-extern int test_and_change_bit(int nr, volatile void * addr);
-extern int __test_and_change_bit(int nr, volatile void * addr);
-extern int __constant_test_bit(int nr, const volatile void * addr);
-extern int __test_bit(int nr, volatile void * addr);
-extern int find_first_zero_bit(void * addr, unsigned size);
-extern int find_next_zero_bit (void * addr, int size, int offset);
-
 /*
  * ffz = Find First Zero in word. Undefined if no zero exists,
  * so code should check against ~0UL first..
  */
-extern __inline__ unsigned long ffz(unsigned long word)
+static inline unsigned long ffz(unsigned long word)
 {
 	unsigned long result = 0;
 
@@ -57,7 +33,7 @@
 }
 
 
-extern __inline__ void set_bit(int nr, volatile void * addr)
+static inline void set_bit(int nr, volatile void *addr)
 {
 	int	* a = (int *) addr;
 	int	mask;
@@ -70,7 +46,7 @@
 	restore_flags(flags);
 }
 
-extern __inline__ void __set_bit(int nr, volatile void * addr)
+static inline void __set_bit(int nr, volatile void *addr)
 {
 	int	* a = (int *) addr;
 	int	mask;
@@ -87,7 +63,7 @@
 #define smp_mb__before_clear_bit()	barrier()
 #define smp_mb__after_clear_bit()	barrier()
 
-extern __inline__ void clear_bit(int nr, volatile void * addr)
+static inline void clear_bit(int nr, volatile void *addr)
 {
 	int	* a = (int *) addr;
 	int	mask;
@@ -100,7 +76,10 @@
 	restore_flags(flags);
 }
 
-extern __inline__ void change_bit(int nr, volatile void * addr)
+#define __clear_bit(nr, addr) clear_bit(nr, addr)
+#define PLATFORM__CLEAR_BIT
+
+static inline void change_bit(int nr, volatile void *addr)
 {
 	int mask;
 	unsigned long flags;
@@ -113,7 +92,7 @@
 	restore_flags(flags);
 }
 
-extern __inline__ void __change_bit(int nr, volatile void * addr)
+static inline void __change_bit(int nr, volatile void *addr)
 {
 	int mask;
 	unsigned long *ADDR = (unsigned long *) addr;
@@ -123,7 +102,7 @@
 	*ADDR ^= mask;
 }
 
-extern __inline__ int test_and_set_bit(int nr, volatile void * addr)
+static inline int test_and_set_bit(int nr, volatile void *addr)
 {
 	int	mask, retval;
 	volatile unsigned int *a = (volatile unsigned int *) addr;
@@ -139,7 +118,7 @@
 	return retval;
 }
 
-extern __inline__ int __test_and_set_bit(int nr, volatile void * addr)
+static inline int __test_and_set_bit(int nr, volatile void *addr)
 {
 	int	mask, retval;
 	volatile unsigned int *a = (volatile unsigned int *) addr;
@@ -151,7 +130,7 @@
 	return retval;
 }
 
-extern __inline__ int test_and_clear_bit(int nr, volatile void * addr)
+static inline int test_and_clear_bit(int nr, volatile void *addr)
 {
 	int	mask, retval;
 	volatile unsigned int *a = (volatile unsigned int *) addr;
@@ -167,7 +146,7 @@
 	return retval;
 }
 
-extern __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
+static inline int __test_and_clear_bit(int nr, volatile void *addr)
 {
 	int	mask, retval;
 	volatile unsigned int *a = (volatile unsigned int *) addr;
@@ -179,7 +158,7 @@
 	return retval;
 }
 
-extern __inline__ int test_and_change_bit(int nr, volatile void * addr)
+static inline int test_and_change_bit(int nr, volatile void *addr)
 {
 	int	mask, retval;
 	volatile unsigned int *a = (volatile unsigned int *) addr;
@@ -195,7 +174,7 @@
 	return retval;
 }
 
-extern __inline__ int __test_and_change_bit(int nr, volatile void * addr)
+static inline int __test_and_change_bit(int nr, volatile void *addr)
 {
 	int	mask, retval;
 	volatile unsigned int *a = (volatile unsigned int *) addr;
@@ -210,12 +189,12 @@
 /*
  * This routine doesn't need to be atomic.
  */
-extern __inline__ int __constant_test_bit(int nr, const volatile void * addr)
+static inline int __constant_test_bit(int nr, const volatile void *addr)
 {
 	return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
 }
 
-extern __inline__ int __test_bit(int nr, volatile void * addr)
+static inline int __test_bit(int nr, volatile void *addr)
 {
 	int	* a = (int *) addr;
 	int	mask;
@@ -233,7 +212,7 @@
 #define find_first_zero_bit(addr, size) \
 	find_next_zero_bit((addr), (size), 0)
 
-extern __inline__ int find_next_zero_bit (void * addr, int size, int offset)
+static inline int find_next_zero_bit(void *addr, int size, int offset)
 {
 	unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
 	unsigned long result = offset & ~31UL;
@@ -279,7 +258,7 @@
 #define hweight8(x) generic_hweight8(x)
 
 
-extern __inline__ int ext2_set_bit(int nr, volatile void * addr)
+static inline int ext2_set_bit(int nr, volatile void *addr)
 {
 	int		mask, retval;
 	unsigned long	flags;
@@ -294,7 +273,7 @@
 	return retval;
 }
 
-extern __inline__ int ext2_clear_bit(int nr, volatile void * addr)
+static inline int ext2_clear_bit(int nr, volatile void *addr)
 {
 	int		mask, retval;
 	unsigned long	flags;
@@ -309,7 +288,7 @@
 	return retval;
 }
 
-extern __inline__ int ext2_test_bit(int nr, const volatile void * addr)
+static inline int ext2_test_bit(int nr, const volatile void *addr)
 {
 	int			mask;
 	const volatile unsigned char	*ADDR = (const unsigned char *) addr;
diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h
index 0297a11..3107748 100644
--- a/arch/microblaze/include/asm/system.h
+++ b/arch/microblaze/include/asm/system.h
@@ -131,7 +131,7 @@
   ((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr))))
 #define tas(ptr) (xchg ((ptr), 1))
 
-extern inline unsigned long __xchg (unsigned long with,
+static inline unsigned long __xchg(unsigned long with,
 				    __volatile__ void *ptr, int size)
 {
 	unsigned long tmp, flags;
diff --git a/drivers/core/root.c b/drivers/core/root.c
index bdb394a..e7b1f24 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -59,6 +59,8 @@
 			entry->unbind += gd->reloc_off;
 		if (entry->ofdata_to_platdata)
 			entry->ofdata_to_platdata += gd->reloc_off;
+		if (entry->child_post_bind)
+			entry->child_post_bind += gd->reloc_off;
 		if (entry->child_pre_probe)
 			entry->child_pre_probe += gd->reloc_off;
 		if (entry->child_post_remove)
@@ -81,10 +83,16 @@
 			entry->post_bind += gd->reloc_off;
 		if (entry->pre_unbind)
 			entry->pre_unbind += gd->reloc_off;
+		if (entry->pre_probe)
+			entry->pre_probe += gd->reloc_off;
 		if (entry->post_probe)
 			entry->post_probe += gd->reloc_off;
 		if (entry->pre_remove)
 			entry->pre_remove += gd->reloc_off;
+		if (entry->child_post_bind)
+			entry->child_post_bind += gd->reloc_off;
+		if (entry->child_pre_probe)
+			entry->child_pre_probe += gd->reloc_off;
 		if (entry->init)
 			entry->init += gd->reloc_off;
 		if (entry->destroy)
diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c
index 350e21a..72e0f6b 100644
--- a/drivers/mtd/spi/sf-uclass.c
+++ b/drivers/mtd/spi/sf-uclass.c
@@ -11,6 +11,8 @@
 #include <dm/device-internal.h>
 #include "sf_internal.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 int spi_flash_read_dm(struct udevice *dev, u32 offset, size_t len, void *buf)
 {
 	return sf_get_ops(dev)->read(dev, offset, len, buf);
@@ -72,8 +74,29 @@
 	return device_remove(dev);
 }
 
+static int spi_flash_post_bind(struct udevice *dev)
+{
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+	struct dm_spi_flash_ops *ops = sf_get_ops(dev);
+	static int reloc_done;
+
+	if (!reloc_done) {
+		if (ops->read)
+			ops->read += gd->reloc_off;
+		if (ops->write)
+			ops->write += gd->reloc_off;
+		if (ops->erase)
+			ops->erase += gd->reloc_off;
+
+		reloc_done++;
+	}
+#endif
+	return 0;
+}
+
 UCLASS_DRIVER(spi_flash) = {
 	.id		= UCLASS_SPI_FLASH,
 	.name		= "spi_flash",
+	.post_bind	= spi_flash_post_bind,
 	.per_device_auto_alloc_size = sizeof(struct spi_flash),
 };
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 58388ef..3c7d64a 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -118,6 +118,26 @@
 	spi->max_hz = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
 				     "spi-max-frequency", 0);
 
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+	struct dm_spi_ops *ops = spi_get_ops(bus);
+
+
+	if (ops->claim_bus)
+		ops->claim_bus += gd->reloc_off;
+	if (ops->release_bus)
+		ops->release_bus += gd->reloc_off;
+	if (ops->set_wordlen)
+		ops->set_wordlen += gd->reloc_off;
+	if (ops->xfer)
+		ops->xfer += gd->reloc_off;
+	if (ops->set_speed)
+		ops->set_speed += gd->reloc_off;
+	if (ops->set_mode)
+		ops->set_mode += gd->reloc_off;
+	if (ops->cs_info)
+		ops->cs_info += gd->reloc_off;
+#endif
+
 	return 0;
 }