]> git.ipfire.org Git - u-boot.git/blobdiff - board/evb64260/memory.c
* Code cleanup:
[u-boot.git] / board / evb64260 / memory.c
index 9d301f86c57667592f6942162261560509f79568..e339854453ce5ebd5f76d17e2951ada987dc6678 100644 (file)
@@ -103,9 +103,9 @@ unsigned int memoryGetBankSize(MEMORY_BANK bank)
     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 @@ unsigned int memoryGetDeviceSize(DEVICE device)
     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 @@ unsigned int memoryGetDeviceWidth(DEVICE device)
     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 @@ unsigned int memoryGetInternalRegistersSpace(void)
 * 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 @@ bool memorySetProtectRegion(MEMORY_PROTECT_REGION region,
 * 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 @@ bool memorySetRegionSnoopMode(MEMORY_SNOOP_REGION region,
     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 @@ bool memoryGetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum)
     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 @@ bool memorySetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum)
 
     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;