diff --git a/board/evb64260/memory.c b/board/evb64260/memory.c
index 9d301f8..e339854 100644
--- a/board/evb64260/memory.c
+++ b/board/evb64260/memory.c
@@ -103,9 +103,9 @@
     GT_REG_READ(highAddress,&highValue);
     highValue = (highValue + 1) << 20;
     if(base > highValue)
-        size=0;
+	size=0;
     else
-        size = highValue - base;
+	size = highValue - base;
     return size;
 }
 
@@ -127,16 +127,16 @@
     GT_REG_READ(highAddress,&highValue);
     if (highValue == 0xfff)
     {
-        size = (~base) + 1;	/* what the heck is this? */
-        return size;
+	size = (~base) + 1;	/* what the heck is this? */
+	return size;
     }
     else
-        highValue = (highValue + 1) << 20;
+	highValue = (highValue + 1) << 20;
 
     if(base > highValue)
-        size=0;
+	size=0;
     else
-        size = highValue - base;
+	size = highValue - base;
     return size;
 }
 
@@ -159,16 +159,16 @@
     width =  (regValue & 0x00300000) >> 20;
     switch (width)
     {
-        case 0:
-            return 1;
-        case 1:
-            return 2;
-        case 2:
-            return 4;
-        case 3:
-            return 8;
-        default:
-            return 0;
+	case 0:
+	    return 1;
+	case 1:
+	    return 2;
+	case 2:
+	    return 4;
+	case 3:
+	    return 8;
+	default:
+	    return 0;
     }
 }
 
@@ -265,23 +265,23 @@
 * Returns: false if one of the parameters is wrong and true else
 *********************************************************************/
 bool memorySetProtectRegion(MEMORY_PROTECT_REGION region,
-                            MEMORY_ACCESS memAccess,
-                            MEMORY_ACCESS_WRITE memWrite,
-                            MEMORY_CACHE_PROTECT cacheProtection,
-                            unsigned int baseAddress,
-                            unsigned int regionLength)
+			    MEMORY_ACCESS memAccess,
+			    MEMORY_ACCESS_WRITE memWrite,
+			    MEMORY_CACHE_PROTECT cacheProtection,
+			    unsigned int baseAddress,
+			    unsigned int regionLength)
 {
     unsigned int protectHigh = baseAddress + regionLength;
 
     if(regionLength == 0) /* closing the region */
     {
-        GT_REG_WRITE(CPU_LOW_PROTECT_ADDRESS_0 + 0x10*region,0x0000ffff);
-        GT_REG_WRITE(CPU_HIGH_PROTECT_ADDRESS_0 + 0x10*region,0);
-        return true;
+	GT_REG_WRITE(CPU_LOW_PROTECT_ADDRESS_0 + 0x10*region,0x0000ffff);
+	GT_REG_WRITE(CPU_HIGH_PROTECT_ADDRESS_0 + 0x10*region,0);
+	return true;
     }
     baseAddress =  (baseAddress & 0xfff00000) >> 20;
     baseAddress = baseAddress | memAccess << 16 |  memWrite << 17
-                     | cacheProtection << 18;
+		     | cacheProtection << 18;
     GT_REG_WRITE(CPU_LOW_PROTECT_ADDRESS_0 + 0x10*region,baseAddress);
     protectHigh = (protectHigh & 0xfff00000) >> 20;
     GT_REG_WRITE(CPU_HIGH_PROTECT_ADDRESS_0 + 0x10*region,protectHigh - 1);
@@ -304,9 +304,9 @@
 * Returns: false if one of the parameters is wrong and true else
 *********************************************************************/
 bool memorySetRegionSnoopMode(MEMORY_SNOOP_REGION region,
-                              MEMORY_SNOOP_TYPE snoopType,
-                              unsigned int baseAddress,
-                              unsigned int regionLength)
+			      MEMORY_SNOOP_TYPE snoopType,
+			      unsigned int baseAddress,
+			      unsigned int regionLength)
 {
     unsigned int snoopXbaseAddress;
     unsigned int snoopXtopAddress;
@@ -314,14 +314,14 @@
     unsigned int snoopHigh = baseAddress + regionLength;
 
     if( (region > MEM_SNOOP_REGION3) || (snoopType > MEM_SNOOP_WB) )
-        return false;
+	return false;
     snoopXbaseAddress = SNOOP_BASE_ADDRESS_0 + 0x10 * region;
     snoopXtopAddress = SNOOP_TOP_ADDRESS_0 + 0x10 * region;
     if(regionLength == 0) /* closing the region */
     {
-        GT_REG_WRITE(snoopXbaseAddress,0x0000ffff);
-        GT_REG_WRITE(snoopXtopAddress,0);
-        return true;
+	GT_REG_WRITE(snoopXbaseAddress,0x0000ffff);
+	GT_REG_WRITE(snoopXtopAddress,0);
+	return true;
     }
     baseAddress = baseAddress & 0xffff0000;
     data = (baseAddress >> 16) | snoopType << 16;
@@ -385,20 +385,20 @@
     switch (calcData)
     {
     case 0:
-        deviceParam -> deviceWidth = 1;         /* one Byte - 8-bit */
-        break;
+	deviceParam -> deviceWidth = 1;         /* one Byte - 8-bit */
+	break;
     case 1:
-        deviceParam -> deviceWidth = 2;         /* two Bytes - 16-bit */
-        break;
+	deviceParam -> deviceWidth = 2;         /* two Bytes - 16-bit */
+	break;
     case 2:
-        deviceParam -> deviceWidth = 4;         /* four Bytes - 32-bit */
-        break;
+	deviceParam -> deviceWidth = 4;         /* four Bytes - 32-bit */
+	break;
     case 3:
-        deviceParam -> deviceWidth = 8;         /* eight Bytes - 64-bit */
-        break;
+	deviceParam -> deviceWidth = 8;         /* eight Bytes - 64-bit */
+	break;
     default:
-        deviceParam -> deviceWidth = 1;
-        break;
+	deviceParam -> deviceWidth = 1;
+	break;
     }
     return true;
 }
@@ -419,38 +419,38 @@
 
     if((deviceParam -> turnOff >= 0xf) || (deviceParam -> acc2First >= 0x1f) ||
        (deviceParam -> acc2Next >= 0x1f) || (deviceParam -> ale2Wr >= 0xf) ||
-        (deviceParam -> wrLow >= 0xf) || (deviceParam -> wrHigh >= 0xf))
-        return false;
+	(deviceParam -> wrLow >= 0xf) || (deviceParam -> wrHigh >= 0xf))
+	return false;
     valueForReg = (((deviceParam -> turnOff) & 0x7) |
-                   (((deviceParam -> turnOff) & 0x8) << 19) |
-                   (((deviceParam -> acc2First) & 0xf) << 3) |
-                   (((deviceParam -> acc2First) & 0x10) << 19) |
-                   (((deviceParam -> acc2Next) & 0xf) << 7) |
-                   (((deviceParam -> acc2Next) & 0x10) << 20) |
-                   (((deviceParam -> ale2Wr) & 0x7) << 11) |
-                   (((deviceParam -> ale2Wr) & 0xf) << 22) |
-                   (((deviceParam -> wrLow) & 0x7) << 14) |
-                   (((deviceParam -> wrLow) & 0xf) << 23) |
-                   (((deviceParam -> wrHigh) & 0x7) << 17) |
-                   (((deviceParam -> wrHigh) & 0xf) << 24));
+		   (((deviceParam -> turnOff) & 0x8) << 19) |
+		   (((deviceParam -> acc2First) & 0xf) << 3) |
+		   (((deviceParam -> acc2First) & 0x10) << 19) |
+		   (((deviceParam -> acc2Next) & 0xf) << 7) |
+		   (((deviceParam -> acc2Next) & 0x10) << 20) |
+		   (((deviceParam -> ale2Wr) & 0x7) << 11) |
+		   (((deviceParam -> ale2Wr) & 0xf) << 22) |
+		   (((deviceParam -> wrLow) & 0x7) << 14) |
+		   (((deviceParam -> wrLow) & 0xf) << 23) |
+		   (((deviceParam -> wrHigh) & 0x7) << 17) |
+		   (((deviceParam -> wrHigh) & 0xf) << 24));
     /* insert the device width: */
     switch(deviceParam->deviceWidth)
     {
     case 1:
-        valueForReg = valueForReg | _8BIT;
-        break;
+	valueForReg = valueForReg | _8BIT;
+	break;
     case 2:
-        valueForReg = valueForReg | _16BIT;
-        break;
+	valueForReg = valueForReg | _16BIT;
+	break;
     case 4:
-        valueForReg = valueForReg | _32BIT;
-        break;
+	valueForReg = valueForReg | _32BIT;
+	break;
     case 8:
-        valueForReg = valueForReg | _64BIT;
-        break;
+	valueForReg = valueForReg | _64BIT;
+	break;
     default:
-        valueForReg = valueForReg | _8BIT;
-        break;
+	valueForReg = valueForReg | _8BIT;
+	break;
     }
     GT_REG_WRITE(DEVICE_BANK0PARAMETERS + 4 * deviceNum, valueForReg);
     return true;
