aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/cs553x_nand.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-13 13:07:53 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-13 13:07:53 -0400
commite0c7d7675331140e5186d2d1a0efce1d3877d379 (patch)
tree45247eb5029382c64392aa641e8b0e5506ed152f /drivers/mtd/nand/cs553x_nand.c
parent6943f8af7d6583be57d67bba8b2644371f6a10ca (diff)
[MTD NAND] Indent all of drivers/mtd/nand/*.c.
It was just too painful to deal with. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/nand/cs553x_nand.c')
-rw-r--r--drivers/mtd/nand/cs553x_nand.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c
index 4f0b338f2f30..fba7be5cffe3 100644
--- a/drivers/mtd/nand/cs553x_nand.c
+++ b/drivers/mtd/nand/cs553x_nand.c
@@ -50,7 +50,7 @@
50 50
51/* Pin function selection MSR (IDE vs. flash on the IDE pins) */ 51/* Pin function selection MSR (IDE vs. flash on the IDE pins) */
52#define MSR_DIVIL_BALL_OPTS 0x51400015 52#define MSR_DIVIL_BALL_OPTS 0x51400015
53#define PIN_OPT_IDE (1<<0) /* 0 for flash, 1 for IDE */ 53#define PIN_OPT_IDE (1<<0) /* 0 for flash, 1 for IDE */
54 54
55/* Registers within the NAND flash controller BAR -- memory mapped */ 55/* Registers within the NAND flash controller BAR -- memory mapped */
56#define MM_NAND_DATA 0x00 /* 0 to 0x7ff, in fact */ 56#define MM_NAND_DATA 0x00 /* 0 to 0x7ff, in fact */
@@ -128,7 +128,7 @@ static void cs553x_write_byte(struct mtd_info *mtd, u_char byte)
128 udelay(1); 128 udelay(1);
129 i--; 129 i--;
130 } 130 }
131 writeb(byte, this->IO_ADDR_W+0x801); 131 writeb(byte, this->IO_ADDR_W + 0x801);
132} 132}
133 133
134static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd) 134static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd)
@@ -137,7 +137,7 @@ static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd)
137 void __iomem *mmio_base = this->IO_ADDR_R; 137 void __iomem *mmio_base = this->IO_ADDR_R;
138 unsigned char ctl; 138 unsigned char ctl;
139 139
140 switch(cmd) { 140 switch (cmd) {
141 case NAND_CTL_SETCLE: 141 case NAND_CTL_SETCLE:
142 ctl = CS_NAND_CTL_CLE; 142 ctl = CS_NAND_CTL_CLE;
143 break; 143 break;
@@ -160,17 +160,15 @@ static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd)
160 writeb(ctl, mmio_base + MM_NAND_CTL); 160 writeb(ctl, mmio_base + MM_NAND_CTL);
161} 161}
162 162
163
164static int cs553x_device_ready(struct mtd_info *mtd) 163static int cs553x_device_ready(struct mtd_info *mtd)
165{ 164{
166 struct nand_chip *this = mtd->priv; 165 struct nand_chip *this = mtd->priv;
167 void __iomem *mmio_base = this->IO_ADDR_R; 166 void __iomem *mmio_base = this->IO_ADDR_R;
168 unsigned char foo = readb(mmio_base + MM_NAND_STS); 167 unsigned char foo = readb(mmio_base + MM_NAND_STS);
169 168
170 return (foo & CS_NAND_STS_FLASH_RDY) && !(foo & CS_NAND_CTLR_BUSY); 169 return (foo & CS_NAND_STS_FLASH_RDY) && !(foo & CS_NAND_CTLR_BUSY);
171} 170}
172 171
173
174static void cs_enable_hwecc(struct mtd_info *mtd, int mode) 172static void cs_enable_hwecc(struct mtd_info *mtd, int mode)
175{ 173{
176 struct nand_chip *this = mtd->priv; 174 struct nand_chip *this = mtd->priv;
@@ -209,7 +207,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
209 } 207 }
210 208
211 /* Allocate memory for MTD device structure and private data */ 209 /* Allocate memory for MTD device structure and private data */
212 new_mtd = kmalloc(sizeof(struct mtd_info) + sizeof (struct nand_chip), GFP_KERNEL); 210 new_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
213 if (!new_mtd) { 211 if (!new_mtd) {
214 printk(KERN_WARNING "Unable to allocate CS553X NAND MTD device structure.\n"); 212 printk(KERN_WARNING "Unable to allocate CS553X NAND MTD device structure.\n");
215 err = -ENOMEM; 213 err = -ENOMEM;
@@ -217,7 +215,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
217 } 215 }
218 216
219 /* Get pointer to private data */ 217 /* Get pointer to private data */
220 this = (struct nand_chip *) (&new_mtd[1]); 218 this = (struct nand_chip *)(&new_mtd[1]);
221 219
222 /* Initialize structures */ 220 /* Initialize structures */
223 memset(new_mtd, 0, sizeof(struct mtd_info)); 221 memset(new_mtd, 0, sizeof(struct mtd_info));
@@ -286,16 +284,16 @@ int __init cs553x_init(void)
286 return -ENXIO; 284 return -ENXIO;
287 } 285 }
288 286
289 for (i=0; i<NR_CS553X_CONTROLLERS; i++) { 287 for (i = 0; i < NR_CS553X_CONTROLLERS; i++) {
290 rdmsrl(MSR_DIVIL_LBAR_FLSH0+i, val); 288 rdmsrl(MSR_DIVIL_LBAR_FLSH0 + i, val);
291 289
292 if ((val & (FLSH_LBAR_EN|FLSH_NOR_NAND)) == (FLSH_LBAR_EN|FLSH_NOR_NAND)) 290 if ((val & (FLSH_LBAR_EN|FLSH_NOR_NAND)) == (FLSH_LBAR_EN|FLSH_NOR_NAND))
293 err = cs553x_init_one(i, !!(val & FLSH_MEM_IO), val & 0xFFFFFFFF); 291 err = cs553x_init_one(i, !!(val & FLSH_MEM_IO), val & 0xFFFFFFFF);
294 } 292 }
295 293
296 /* Register all devices together here. This means we can easily hack it to 294 /* Register all devices together here. This means we can easily hack it to
297 do mtdconcat etc. if we want to. */ 295 do mtdconcat etc. if we want to. */
298 for (i=0; i<NR_CS553X_CONTROLLERS; i++) { 296 for (i = 0; i < NR_CS553X_CONTROLLERS; i++) {
299 if (cs553x_mtd[i]) { 297 if (cs553x_mtd[i]) {
300 add_mtd_device(cs553x_mtd[i]); 298 add_mtd_device(cs553x_mtd[i]);
301 299
@@ -306,13 +304,14 @@ int __init cs553x_init(void)
306 304
307 return err; 305 return err;
308} 306}
307
309module_init(cs553x_init); 308module_init(cs553x_init);
310 309
311static void __exit cs553x_cleanup (void) 310static void __exit cs553x_cleanup(void)
312{ 311{
313 int i; 312 int i;
314 313
315 for (i=0; i<NR_CS553X_CONTROLLERS; i++) { 314 for (i = 0; i < NR_CS553X_CONTROLLERS; i++) {
316 struct mtd_info *mtd = cs553x_mtd[i]; 315 struct mtd_info *mtd = cs553x_mtd[i];
317 struct nand_chip *this; 316 struct nand_chip *this;
318 void __iomem *mmio_base; 317 void __iomem *mmio_base;
@@ -324,7 +323,7 @@ static void __exit cs553x_cleanup (void)
324 mmio_base = this->IO_ADDR_R; 323 mmio_base = this->IO_ADDR_R;
325 324
326 /* Release resources, unregister device */ 325 /* Release resources, unregister device */
327 nand_release (cs553x_mtd[i]); 326 nand_release(cs553x_mtd[i]);
328 cs553x_mtd[i] = NULL; 327 cs553x_mtd[i] = NULL;
329 328
330 /* unmap physical adress */ 329 /* unmap physical adress */
@@ -334,6 +333,7 @@ static void __exit cs553x_cleanup (void)
334 kfree(mtd); 333 kfree(mtd);
335 } 334 }
336} 335}
336
337module_exit(cs553x_cleanup); 337module_exit(cs553x_cleanup);
338 338
339MODULE_LICENSE("GPL"); 339MODULE_LICENSE("GPL");