mtd/drivers/mtd/maps sbc8240.c,1.1,1.2

Thayne Harbaugh tharbaugh at lnxi.com
Tue Sep 30 15:37:03 EDT 2003


Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv9359

Modified Files:
	sbc8240.c 
Log Message:
beautification: Id, KB -> KiB, MB -> MiB, C99 initializers

Index: sbc8240.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc8240.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sbc8240.c	30 Sep 2003 16:15:05 -0000	1.1
+++ sbc8240.c	30 Sep 2003 19:37:00 -0000	1.2
@@ -5,14 +5,16 @@
  *
  * This code is GPLed
  *
+ * $Id$
+ *
  */
 
 /*
  * The SBC8240 has 2 flash banks.
- * Bank 0 is a 512 KB AMD AM29F040B; 8 x 64 KB sectors.
+ * Bank 0 is a 512 KiB AMD AM29F040B; 8 x 64 KiB sectors.
  * It contains the U-Boot code (7 sectors) and the environment (1 sector).
- * Bank 1 is 4 x 1 MB AMD AM29LV800BT; 15 x 64 KB sectors, 1 x 32 KB sector,
- * 2 x 8 KB sectors, 1 x 16 KB sectors.
+ * Bank 1 is 4 x 1 MiB AMD AM29LV800BT; 15 x 64 KiB sectors, 1 x 32 KiB sector,
+ * 2 x 8 KiB sectors, 1 x 16 KiB sectors.
  * Both parts are JEDEC compatible.
  */
 
@@ -39,11 +41,11 @@
 #endif
 
 
-#define WINDOW_ADDR0	0xFFF00000		/* 512 KB */
+#define WINDOW_ADDR0	0xFFF00000		/* 512 KiB */
 #define WINDOW_SIZE0	0x00080000
 #define BUSWIDTH0	1
 
-#define WINDOW_ADDR1	0xFF000000		/* 4 MB */
+#define WINDOW_ADDR1	0xFF000000		/* 4 MiB */
 #define WINDOW_SIZE1	0x00400000
 #define BUSWIDTH1	8
 
@@ -70,57 +72,57 @@
 
 static __u64 sbc8240_read64 (struct map_info *map, unsigned long ofs)
 {
-    unsigned long flags, msr, saved_msr;
-    volatile long saved_fr[2];
-    volatile unsigned long long result;
-    volatile unsigned long *p;
+	unsigned long flags, msr, saved_msr;
+	volatile long saved_fr[2];
+	volatile unsigned long long result;
+	volatile unsigned long *p;
 
-    save_flags(flags);
-    cli();
+	save_flags(flags);
+	cli();
 
-    /* turn off floating point unavailable exceptions */
+	/* turn off floating point unavailable exceptions */
 
-    __asm__ __volatile__ (
-        "mfmsr %0" 
-	: "=r" (msr) :);
+	__asm__ __volatile__ (
+		"mfmsr %0" 
+		: "=r" (msr) :);
 
-    saved_msr = msr;
-    msr |= MSR_FP;
-    msr &= ~(MSR_FE0 | MSR_FE1);
+	saved_msr = msr;
+	msr |= MSR_FP;
+	msr &= ~(MSR_FE0 | MSR_FE1);
 
-    __asm__ __volatile__ (
-        "mtmsr %0\n"
-	"isync\n"
-	: : "r" (msr));
+	__asm__ __volatile__ (
+		"mtmsr %0\n"
+		"isync\n"
+		: : "r" (msr));
 
-    /* read the data via a floating point register */
+	/* read the data via a floating point register */
 
-    ofs = map->map_priv_1 + ofs;
-    p = (unsigned long *) &result64;
+	ofs = map->map_priv_1 + ofs;
+	p = (unsigned long *) &result64;
 
-    __asm__ __volatile__ (
-        "lfd  1,0(%1)\n"
-        "stfd 1,0(%0)\n"
-        : : "r" (p), "r" (ofs)
-    );
+	__asm__ __volatile__ (
+		"lfd  1,0(%1)\n"
+		"stfd 1,0(%0)\n"
+		: : "r" (p), "r" (ofs)
+		);
 
-    /* restore state */
+	/* restore state */
 
-    __asm__ __volatile__ (
-	"mtmsr %0\n"
-        "isync\n"
-	: : "r" (saved_msr));
+	__asm__ __volatile__ (
+		"mtmsr %0\n"
+		"isync\n"
+		: : "r" (saved_msr));
 
-    restore_flags(flags);
+	restore_flags(flags);
 
-    p = (unsigned long *) &result64;
-    debugk("sbc8240_read64 ofs 0x%x result 0x%08x%08x\n", ofs, *p, *(p+1));
+	p = (unsigned long *) &result64;
+	debugk("sbc8240_read64 ofs 0x%x result 0x%08x%08x\n", ofs, *p, *(p+1));
 
-    return result64;
+	return result64;
 }
 
 static void sbc8240_copy_from (struct map_info *map,
-			      void *to, unsigned long from, ssize_t len)
+			       void *to, unsigned long from, ssize_t len)
 {
 	memcpy_fromio (to, (void *) (map->map_priv_1 + from), len);
 }
@@ -132,107 +134,107 @@
 }
 
 static void sbc8240_write16 (struct map_info *map, __u16 d,
-			   unsigned long adr)
+			     unsigned long adr)
 {
 	__raw_writew(d, map->map_priv_1 + adr);
 	mb();
 }
 
 static void sbc8240_write32 (struct map_info *map, __u32 d,
-			   unsigned long adr)
+			     unsigned long adr)
 {
 	__raw_writel(d, map->map_priv_1 + adr);
 	mb();
 }
 
 static void sbc8240_write64 (struct map_info *map, __u64 data,
-			   unsigned long adr)
+			     unsigned long adr)
 {
-    unsigned long long tmp;
-    unsigned long flags, msr, saved_msr, *p;
-    volatile long saved_fr[2];
+	unsigned long long tmp;
+	unsigned long flags, msr, saved_msr, *p;
+	volatile long saved_fr[2];
 
-    save_flags(flags);
-    cli();
+	save_flags(flags);
+	cli();
 
-    /* turn off floating point unavailable exceptions */
+	/* turn off floating point unavailable exceptions */
 
-    __asm__ __volatile__ (
-        "mfmsr %0" 
-	: "=r" (msr) :);
+	__asm__ __volatile__ (
+		"mfmsr %0" 
+		: "=r" (msr) :);
 
-    saved_msr = msr;
-    msr |= MSR_FP;
-    msr &= ~(MSR_FE0 | MSR_FE1);
+	saved_msr = msr;
+	msr |= MSR_FP;
+	msr &= ~(MSR_FE0 | MSR_FE1);
 
-    __asm__ __volatile__ (
-        "mtmsr %0\n"
-	"isync\n"
-	: : "r" (msr));
+	__asm__ __volatile__ (
+		"mtmsr %0\n"
+		"isync\n"
+		: : "r" (msr));
 
 
-    /* write the data via a floating point register */
+	/* write the data via a floating point register */
 
-    tmp = data;
-    p = (unsigned long *) &tmp;
-    adr = map->map_priv_1 + adr;
-    debugk("sbc8240_write64 adr 0x%x data 0x%08x%08x\n", adr, *p, *(p+1));
+	tmp = data;
+	p = (unsigned long *) &tmp;
+	adr = map->map_priv_1 + adr;
+	debugk("sbc8240_write64 adr 0x%x data 0x%08x%08x\n", adr, *p, *(p+1));
 
-    __asm__ __volatile__ (
-	"stfd 1,0(%2)\n"
-        "lfd  1,0(%0)\n"
-        "stfd 1,0(%1)\n"
-	"lfd  1,0(%2)\n"
-        : : "r" (p), "r" (adr), "b" (saved_fr)
-    );
+	__asm__ __volatile__ (
+		"stfd 1,0(%2)\n"
+		"lfd  1,0(%0)\n"
+		"stfd 1,0(%1)\n"
+		"lfd  1,0(%2)\n"
+		: : "r" (p), "r" (adr), "b" (saved_fr)
+		);
 
-    /* restore state */
+	/* restore state */
 
-    __asm__ __volatile__ (
-	"mtmsr %0\n"
-        "isync\n"
-	: : "r" (saved_msr));
+	__asm__ __volatile__ (
+		"mtmsr %0\n"
+		"isync\n"
+		: : "r" (saved_msr));
 
-    restore_flags(flags);
+	restore_flags(flags);
 }
 
 static void sbc8240_copy_to (struct map_info *map,
-			   unsigned long to, const void *from, ssize_t len)
+			     unsigned long to, const void *from, ssize_t len)
 {
 	memcpy_toio ((void *) (map->map_priv_1 + to), from, len);
 }
 
 static struct map_info sbc8240_map[2] = {
-    {
-	name:	   "sbc8240 Flash Bank #0",
-	size:	   WINDOW_SIZE0,
-	buswidth:  BUSWIDTH0,
-	read8:	   sbc8240_read8,
-	read16:	   sbc8240_read16,
-	read32:	   sbc8240_read32,
-	read64:	   sbc8240_read64,
-	copy_from: sbc8240_copy_from,
-	write8:	   sbc8240_write8,
-	write16:   sbc8240_write16,
-	write32:   sbc8240_write32,
-	write64:   sbc8240_write64,
-	copy_to:   sbc8240_copy_to
-    },
-    {
-	name:	   "sbc8240 Flash Bank #1",
-	size:	   WINDOW_SIZE1,
-	buswidth:  BUSWIDTH1,
-	read8:	   sbc8240_read8,
-	read16:	   sbc8240_read16,
-	read32:	   sbc8240_read32,
-	read64:	   sbc8240_read64,
-	copy_from: sbc8240_copy_from,
-	write8:	   sbc8240_write8,
-	write16:   sbc8240_write16,
-	write32:   sbc8240_write32,
-	write64:   sbc8240_write64,
-	copy_to:   sbc8240_copy_to
-    }
+	{
+		.name           = "sbc8240 Flash Bank #0",
+		.size           = WINDOW_SIZE0,
+		.buswidth       = BUSWIDTH0,
+		.read8          = sbc8240_read8,
+		.read16         = sbc8240_read16,
+		.read32         = sbc8240_read32,
+		.read64         = sbc8240_read64,
+		.copy_from      = sbc8240_copy_from,
+		.write8         = sbc8240_write8,
+		.write16        = sbc8240_write16,
+		.write32        = sbc8240_write32,
+		.write64        = sbc8240_write64,
+		.copy_to        = sbc8240_copy_to
+	},
+	{
+		.name           = "sbc8240 Flash Bank #1",
+		.size           = WINDOW_SIZE1,
+		.buswidth       = BUSWIDTH1,
+		.read8          = sbc8240_read8,
+		.read16         = sbc8240_read16,
+		.read32         = sbc8240_read32,
+		.read64         = sbc8240_read64,
+		.copy_from      = sbc8240_copy_from,
+		.write8         = sbc8240_write8,
+		.write16        = sbc8240_write16,
+		.write32        = sbc8240_write32,
+		.write64        = sbc8240_write64,
+		.copy_to        = sbc8240_copy_to
+	}
 };
 
 #define NUM_FLASH_BANKS	(sizeof(sbc8240_map) / sizeof(struct map_info))
@@ -252,46 +254,46 @@
 #ifdef CONFIG_MTD_PARTITIONS
 
 static struct mtd_partition sbc8240_uboot_partitions [] = {
-  /* Bank 0 */
-    {
-	name:	"U-boot",			/* U-Boot Firmware	*/
-	offset:	0,
-	size:	0x00070000,			/*  7 x 64 KB sectors 	*/
-	mask_flags: MTD_WRITEABLE,		/*  force read-only	*/
-    },
-    {
-	name:	"environment",			/* U-Boot environment	*/
-	offset:	0x00070000,
-	size:	0x00010000,			/*  1 x 64 KB sector	*/
-    },
+	/* Bank 0 */
+	{
+		.name =	"U-boot",			/* U-Boot Firmware	*/
+		.offset =	0,
+		.size =	0x00070000,			/*  7 x 64 KiB sectors 	*/
+		.mask_flags = MTD_WRITEABLE,		/*  force read-only	*/
+	},
+	{
+		.name =	"environment",			/* U-Boot environment	*/
+		.offset =	0x00070000,
+		.size =	0x00010000,			/*  1 x 64 KiB sector	*/
+	},
 };
 
 static struct mtd_partition sbc8240_fs_partitions [] = {
-    {
-	name:	"jffs",				/* JFFS  filesystem	*/
-	offset:	0,
-	size:	0x003C0000,			/*  4 * 15 * 64KB	*/
-    },
-    {
-	name:	"tmp32",
-	offset:	0x003C0000,
-	size:	0x00020000,			/*  4 * 32KB		*/
-    },
-    {
-	name:	"tmp8a",
-	offset:	0x003E0000,
-	size:	0x00008000,			/*  4 * 8KB		*/
-    },
-    {
-	name:	"tmp8b",
-	offset:	0x003E8000,
-	size:	0x00008000,			/*  4 * 8KB		*/
-    },
-    {
-	name:	"tmp16",
-	offset:	0x003F0000,
-	size:	0x00010000,			/*  4 * 16KB		*/
-    }
+	{
+		.name =	"jffs",				/* JFFS  filesystem	*/
+		.offset =	0,
+		.size =	0x003C0000,			/*  4 * 15 * 64KiB	*/
+	},
+	{
+		.name =	"tmp32",
+		.offset =	0x003C0000,
+		.size =	0x00020000,			/*  4 * 32KiB		*/
+	},
+	{
+		.name =	"tmp8a",
+		.offset =	0x003E0000,
+		.size =	0x00008000,			/*  4 * 8KiB		*/
+	},
+	{
+		.name =	"tmp8b",
+		.offset =	0x003E8000,
+		.size =	0x00008000,			/*  4 * 8KiB		*/
+	},
+	{
+		.name =	"tmp16",
+		.offset =	0x003F0000,
+		.size =	0x00010000,			/*  4 * 16KiB		*/
+	}
 };
 
 #define NB_OF(x) (sizeof (x) / sizeof (x[0]))
@@ -317,8 +319,14 @@
 		u_long addr;
 		u_long size;
 	} pt[NUM_FLASH_BANKS] = {
-		{ WINDOW_ADDR0, WINDOW_SIZE0 },
-		{ WINDOW_ADDR1, WINDOW_SIZE1 },
+		{
+			.addr = WINDOW_ADDR0,
+			.size = WINDOW_SIZE0
+		},
+		{
+			.addr = WINDOW_ADDR1,
+			.size = WINDOW_SIZE1
+		},
 	};
 
 	int devicesfound = 0;
@@ -329,7 +337,7 @@
 			"Probing 0x%08lx at 0x%08lx\n", pt[i].size, pt[i].addr);
 
 		sbc8240_map[i].map_priv_1 =
-				(unsigned long) ioremap (pt[i].addr, pt[i].size);
+			(unsigned long) ioremap (pt[i].addr, pt[i].size);
 		if (!sbc8240_map[i].map_priv_1) {
 			printk (MSG_PREFIX "failed to ioremap\n");
 			return -EIO;
@@ -345,17 +353,17 @@
 
 	if (!devicesfound) {
 		printk(KERN_NOTICE MSG_PREFIX
-			"No suppported flash chips found!\n");
+		       "No suppported flash chips found!\n");
 		return -ENXIO;
 	}
 
 #ifdef CONFIG_MTD_PARTITIONS
-	sbc8240_part_banks[0].mtd_part = sbc8240_uboot_partitions;
-	sbc8240_part_banks[0].type = "static image";
-	sbc8240_part_banks[0].nums = NB_OF(sbc8240_uboot_partitions);
-	sbc8240_part_banks[1].mtd_part = sbc8240_fs_partitions;
-	sbc8240_part_banks[1].type = "static file system";
-	sbc8240_part_banks[1].nums = NB_OF(sbc8240_fs_partitions);
+	sbc8240_part_banks[0].mtd_part   = sbc8240_uboot_partitions;
+	sbc8240_part_banks[0].type       = "static image";
+	sbc8240_part_banks[0].nums       = NB_OF(sbc8240_uboot_partitions);
+	sbc8240_part_banks[1].mtd_part   = sbc8240_fs_partitions;
+	sbc8240_part_banks[1].type       = "static file system";
+	sbc8240_part_banks[1].nums       = NB_OF(sbc8240_fs_partitions);
 
 	for (i = 0; i < NUM_FLASH_BANKS; i++) {
 
@@ -368,13 +376,13 @@
 			printk (KERN_NOTICE MSG_PREFIX
 				"Using %s partition definition\n", sbc8240_part_banks[i].mtd_part->name);
 			add_mtd_partitions (sbc8240_mtd[i], 
-					sbc8240_part_banks[i].mtd_part,
-				       	sbc8240_part_banks[i].nums);
+					    sbc8240_part_banks[i].mtd_part,
+					    sbc8240_part_banks[i].nums);
 		}
 	}
 #else
 	printk(KERN_NOTICE MSG_PREFIX
-		"Registering %d flash banks at once\n", devicesfound);
+	       "Registering %d flash banks at once\n", devicesfound);
 
 	for (i = 0; i < devicesfound; i++) {
 		add_mtd_device(sbc8240_mtd[i]);




More information about the linux-mtd-cvs mailing list