>From 425adec71ae6dc55b4c8b046c07282eb51b4528c Mon Sep 17 00:00:00 2001
From: Tadas Slotkus <devtadas@gmail.com>
Date: Fri, 19 Aug 2011 15:27:33 +0300
Subject: [carFl mem 27/65] Globalisation pass 1: sst28sf040.c

This commit breaks builds until "Globalistation pass 1: fixes".

It does nothing more, just passes globals structure across function
calls.

Signed-off-by: Tadas Slotkus <devtadas@gmail.com>
---
 sst28sf040.c |   62 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/sst28sf040.c b/sst28sf040.c
index d621cc7..2972b5b 100644
--- a/sst28sf040.c
+++ b/sst28sf040.c
@@ -30,53 +30,53 @@
 #define RESET			0xFF
 #define READ_ID			0x90
 
-int protect_28sf040(struct flashchip *flash)
+int protect_28sf040(globals *g, struct flashchip *flash)
 {
 	chipaddr bios = flash->virtual_memory;
 
-	chip_readb(bios + 0x1823);
-	chip_readb(bios + 0x1820);
-	chip_readb(bios + 0x1822);
-	chip_readb(bios + 0x0418);
-	chip_readb(bios + 0x041B);
-	chip_readb(bios + 0x0419);
-	chip_readb(bios + 0x040A);
+	chip_readb(g, bios + 0x1823);
+	chip_readb(g, bios + 0x1820);
+	chip_readb(g, bios + 0x1822);
+	chip_readb(g, bios + 0x0418);
+	chip_readb(g, bios + 0x041B);
+	chip_readb(g, bios + 0x0419);
+	chip_readb(g, bios + 0x040A);
 
 	return 0;
 }
 
-int unprotect_28sf040(struct flashchip *flash)
+int unprotect_28sf040(globals *g, struct flashchip *flash)
 {
 	chipaddr bios = flash->virtual_memory;
 
-	chip_readb(bios + 0x1823);
-	chip_readb(bios + 0x1820);
-	chip_readb(bios + 0x1822);
-	chip_readb(bios + 0x0418);
-	chip_readb(bios + 0x041B);
-	chip_readb(bios + 0x0419);
-	chip_readb(bios + 0x041A);
+	chip_readb(g, bios + 0x1823);
+	chip_readb(g, bios + 0x1820);
+	chip_readb(g, bios + 0x1822);
+	chip_readb(g, bios + 0x0418);
+	chip_readb(g, bios + 0x041B);
+	chip_readb(g, bios + 0x0419);
+	chip_readb(g, bios + 0x041A);
 
 	return 0;
 }
 
-int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size)
+int erase_sector_28sf040(globals *g, struct flashchip *flash, unsigned int address, unsigned int sector_size)
 {
 	chipaddr bios = flash->virtual_memory;
 
 	/* This command sequence is very similar to erase_block_82802ab. */
-	chip_writeb(AUTO_PG_ERASE1, bios);
-	chip_writeb(AUTO_PG_ERASE2, bios + address);
+	chip_writeb(g, AUTO_PG_ERASE1, bios);
+	chip_writeb(g, AUTO_PG_ERASE2, bios + address);
 
 	/* wait for Toggle bit ready */
-	toggle_ready_jedec(bios);
+	toggle_ready_jedec(g, bios);
 
 	/* FIXME: Check the status register for errors. */
 	return 0;
 }
 
 /* chunksize is 1 */
-int write_28sf040(struct flashchip *flash, uint8_t *src, int start, int len)
+int write_28sf040(globals *g, struct flashchip *flash, uint8_t *src, int start, int len)
 {
 	int i;
 	chipaddr bios = flash->virtual_memory;
@@ -90,36 +90,36 @@ int write_28sf040(struct flashchip *flash, uint8_t *src, int start, int len)
 			continue;
 		}
 		/*issue AUTO PROGRAM command */
-		chip_writeb(AUTO_PGRM, dst);
-		chip_writeb(*src++, dst++);
+		chip_writeb(g, AUTO_PGRM, dst);
+		chip_writeb(g, *src++, dst++);
 
 		/* wait for Toggle bit ready */
-		toggle_ready_jedec(bios);
+		toggle_ready_jedec(g, bios);
 	}
 
 	return 0;
 }
 
-static int erase_28sf040(struct flashchip *flash)
+static int erase_28sf040(globals *g, struct flashchip *flash)
 {
 	chipaddr bios = flash->virtual_memory;
 
-	chip_writeb(CHIP_ERASE, bios);
-	chip_writeb(CHIP_ERASE, bios);
+	chip_writeb(g, CHIP_ERASE, bios);
+	chip_writeb(g, CHIP_ERASE, bios);
 
-	programmer_delay(10);
-	toggle_ready_jedec(bios);
+	programmer_delay(g, 10);
+	toggle_ready_jedec(g, bios);
 
 	/* FIXME: Check the status register for errors. */
 	return 0;
 }
 
-int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
+int erase_chip_28sf040(globals *g, struct flashchip *flash, unsigned int addr, unsigned int blocklen)
 {
 	if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
 		msg_cerr("%s called with incorrect arguments\n",
 			__func__);
 		return -1;
 	}
-	return erase_28sf040(flash);
+	return erase_28sf040(g, flash);
 }
-- 
1.7.6

