+#define MEM_STRIDE 0x4000000
+static u32 get_ram_size_stride_test(u32 *base, u32 maxsize)
+{
+ volatile u32 *addr;
+ u32 save[64];
+ u32 cnt;
+ u32 size;
+ int i = 0;
+
+ /* First save the data */
+ for (cnt = 0; cnt < maxsize; cnt += MEM_STRIDE) {
+ addr = (volatile u32 *)((u32)base + cnt); /* pointer arith! */
+ sync ();
+ save[i++] = *addr;
+ sync ();
+ }
+
+ /* First write a signature */
+ * (volatile u32 *)base = 0x12345678;
+ for (size = MEM_STRIDE; size < maxsize; size += MEM_STRIDE) {
+ * (volatile u32 *)((u32)base + size) = size;
+ sync ();
+ if (* (volatile u32 *)((u32)base) == size) { /* We reached the overlapping address */
+ break;
+ }
+ }
+
+ /* Restore the data */
+ for (cnt = (maxsize - MEM_STRIDE); i > 0; cnt -= MEM_STRIDE) {
+ addr = (volatile u32 *)((u32)base + cnt); /* pointer arith! */
+ sync ();
+ *addr = save[i--];
+ sync ();
+ }
+
+ return (size);
+}
+