diff --git a/board/esd/ar405/flash.c b/board/esd/ar405/flash.c
index a651b6f..89af119 100644
--- a/board/esd/ar405/flash.c
+++ b/board/esd/ar405/flash.c
@@ -33,18 +33,19 @@
 /*-----------------------------------------------------------------------
  * Functions
  */
-static ulong flash_get_size (vu_long *addr, flash_info_t *info);
-static void flash_get_offsets (ulong base, flash_info_t *info);
+static ulong flash_get_size (vu_long * addr, flash_info_t * info);
+static void flash_get_offsets (ulong base, flash_info_t * info);
 
 /*-----------------------------------------------------------------------
  */
 
 unsigned long flash_init (void)
 {
-	unsigned long size_b0, size_b1;
+	unsigned long size_b0;
 	int i;
 	uint pbcr;
-	unsigned long base_b0, base_b1;
+	unsigned long base_b0;
+	int size_val = 0;
 
 	/* Init: no FLASHes known */
 	for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
@@ -53,74 +54,48 @@
 
 	/* Static FLASH Bank configuration here - FIXME XXX */
 
-	base_b0 = FLASH_BASE0_PRELIM;
-	size_b0 = flash_get_size((vu_long *)base_b0, &flash_info[0]);
+	size_b0 = flash_get_size((vu_long *)FLASH_BASE0_PRELIM, &flash_info[0]);
 
 	if (flash_info[0].flash_id == FLASH_UNKNOWN) {
 		printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
 			size_b0, size_b0<<20);
 	}
 
-	base_b1 = FLASH_BASE1_PRELIM;
-	size_b1 = flash_get_size((vu_long *)base_b1, &flash_info[1]);
+	/* Setup offsets */
+	flash_get_offsets (-size_b0, &flash_info[0]);
 
 	/* Re-do sizing to get full correct info */
-
-	if (size_b1)
-	  {
-	    mtdcr(ebccfga, pb0cr);
-	    pbcr = mfdcr(ebccfgd);
-	    mtdcr(ebccfga, pb0cr);
-	    base_b1 = -size_b1;
-	    pbcr = (pbcr & 0x0001ffff) | base_b1 | (((size_b1/1024/1024)-1)<<17);
-	    mtdcr(ebccfgd, pbcr);
-	    /*          printf("pb1cr = %x\n", pbcr); */
-	  }
-
-	if (size_b0)
-	  {
-	    mtdcr(ebccfga, pb1cr);
-	    pbcr = mfdcr(ebccfgd);
-	    mtdcr(ebccfga, pb1cr);
-	    base_b0 = base_b1 - size_b0;
-	    pbcr = (pbcr & 0x0001ffff) | base_b0 | (((size_b0/1024/1024)-1)<<17);
-	    mtdcr(ebccfgd, pbcr);
-	    /*            printf("pb0cr = %x\n", pbcr); */
-	  }
-
-	size_b0 = flash_get_size((vu_long *)base_b0, &flash_info[0]);
-
-	flash_get_offsets (base_b0, &flash_info[0]);
+	mtdcr(ebccfga, pb0cr);
+	pbcr = mfdcr(ebccfgd);
+	mtdcr(ebccfga, pb0cr);
+	base_b0 = -size_b0;
+	switch (size_b0) {
+	case 1 << 20:
+		size_val = 0;
+		break;
+	case 2 << 20:
+		size_val = 1;
+		break;
+	case 4 << 20:
+		size_val = 2;
+		break;
+	case 8 << 20:
+		size_val = 3;
+		break;
+	case 16 << 20:
+		size_val = 4;
+		break;
+	}
+	pbcr = (pbcr & 0x0001ffff) | base_b0 | (size_val << 17);
+	mtdcr(ebccfgd, pbcr);
 
-	/* monitor protection ON by default */
+	/* Monitor protection ON by default */
 	(void)flash_protect(FLAG_PROTECT_SET,
-			    base_b0+size_b0-monitor_flash_len,
-			    base_b0+size_b0-1,
+			    -CFG_MONITOR_LEN,
+			    0xffffffff,
 			    &flash_info[0]);
 
-	if (size_b1) {
-		/* Re-do sizing to get full correct info */
-		size_b1 = flash_get_size((vu_long *)base_b1, &flash_info[1]);
-
-		flash_get_offsets (base_b1, &flash_info[1]);
-
-		/* monitor protection ON by default */
-		(void)flash_protect(FLAG_PROTECT_SET,
-				    base_b1+size_b1-monitor_flash_len,
-				    base_b1+size_b1-1,
-				    &flash_info[1]);
-		/* monitor protection OFF by default (one is enough) */
-		(void)flash_protect(FLAG_PROTECT_CLEAR,
-				    base_b0+size_b0-monitor_flash_len,
-				    base_b0+size_b0-1,
-				    &flash_info[0]);
-	} else {
-		flash_info[1].flash_id = FLASH_UNKNOWN;
-		flash_info[1].sector_count = -1;
-	}
-
 	flash_info[0].size = size_b0;
-	flash_info[1].size = size_b1;
 
-	return (size_b0 + size_b1);
+	return (size_b0);
 }
