aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/autcpu12.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/autcpu12.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/autcpu12.c')
-rw-r--r--drivers/mtd/nand/autcpu12.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c
index a3c7fea404d0..9c9f21b0d260 100644
--- a/drivers/mtd/nand/autcpu12.c
+++ b/drivers/mtd/nand/autcpu12.c
@@ -47,7 +47,7 @@ static int autcpu12_io_base = CS89712_VIRT_BASE;
47static int autcpu12_fio_pbase = AUTCPU12_PHYS_SMC; 47static int autcpu12_fio_pbase = AUTCPU12_PHYS_SMC;
48static int autcpu12_fio_ctrl = AUTCPU12_SMC_SELECT_OFFSET; 48static int autcpu12_fio_ctrl = AUTCPU12_SMC_SELECT_OFFSET;
49static int autcpu12_pedr = AUTCPU12_SMC_PORT_OFFSET; 49static int autcpu12_pedr = AUTCPU12_SMC_PORT_OFFSET;
50static void __iomem * autcpu12_fio_base; 50static void __iomem *autcpu12_fio_base;
51 51
52/* 52/*
53 * Define partitions for flash devices 53 * Define partitions for flash devices
@@ -95,10 +95,10 @@ static struct mtd_partition partition_info128k[] = {
95/* 95/*
96 * hardware specific access to control-lines 96 * hardware specific access to control-lines
97*/ 97*/
98
98static void autcpu12_hwcontrol(struct mtd_info *mtd, int cmd) 99static void autcpu12_hwcontrol(struct mtd_info *mtd, int cmd)
99{ 100{
100 101 switch (cmd) {
101 switch(cmd){
102 102
103 case NAND_CTL_SETCLE: (*(volatile unsigned char *) (autcpu12_io_base + autcpu12_pedr)) |= AUTCPU12_SMC_CLE; break; 103 case NAND_CTL_SETCLE: (*(volatile unsigned char *) (autcpu12_io_base + autcpu12_pedr)) |= AUTCPU12_SMC_CLE; break;
104 case NAND_CTL_CLRCLE: (*(volatile unsigned char *) (autcpu12_io_base + autcpu12_pedr)) &= ~AUTCPU12_SMC_CLE; break; 104 case NAND_CTL_CLRCLE: (*(volatile unsigned char *) (autcpu12_io_base + autcpu12_pedr)) &= ~AUTCPU12_SMC_CLE; break;
@@ -117,41 +117,40 @@ static void autcpu12_hwcontrol(struct mtd_info *mtd, int cmd)
117int autcpu12_device_ready(struct mtd_info *mtd) 117int autcpu12_device_ready(struct mtd_info *mtd)
118{ 118{
119 119
120 return ( (*(volatile unsigned char *) (autcpu12_io_base + autcpu12_pedr)) & AUTCPU12_SMC_RDY) ? 1 : 0; 120 return ((*(volatile unsigned char *)(autcpu12_io_base + autcpu12_pedr)) & AUTCPU12_SMC_RDY) ? 1 : 0;
121 121
122} 122}
123 123
124/* 124/*
125 * Main initialization routine 125 * Main initialization routine
126 */ 126 */
127int __init autcpu12_init (void) 127int __init autcpu12_init(void)
128{ 128{
129 struct nand_chip *this; 129 struct nand_chip *this;
130 int err = 0; 130 int err = 0;
131 131
132 /* Allocate memory for MTD device structure and private data */ 132 /* Allocate memory for MTD device structure and private data */
133 autcpu12_mtd = kmalloc (sizeof(struct mtd_info) + sizeof (struct nand_chip), 133 autcpu12_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
134 GFP_KERNEL);
135 if (!autcpu12_mtd) { 134 if (!autcpu12_mtd) {
136 printk ("Unable to allocate AUTCPU12 NAND MTD device structure.\n"); 135 printk("Unable to allocate AUTCPU12 NAND MTD device structure.\n");
137 err = -ENOMEM; 136 err = -ENOMEM;
138 goto out; 137 goto out;
139 } 138 }
140 139
141 /* map physical adress */ 140 /* map physical adress */
142 autcpu12_fio_base = ioremap(autcpu12_fio_pbase,SZ_1K); 141 autcpu12_fio_base = ioremap(autcpu12_fio_pbase, SZ_1K);
143 if(!autcpu12_fio_base){ 142 if (!autcpu12_fio_base) {
144 printk("Ioremap autcpu12 SmartMedia Card failed\n"); 143 printk("Ioremap autcpu12 SmartMedia Card failed\n");
145 err = -EIO; 144 err = -EIO;
146 goto out_mtd; 145 goto out_mtd;
147 } 146 }
148 147
149 /* Get pointer to private data */ 148 /* Get pointer to private data */
150 this = (struct nand_chip *) (&autcpu12_mtd[1]); 149 this = (struct nand_chip *)(&autcpu12_mtd[1]);
151 150
152 /* Initialize structures */ 151 /* Initialize structures */
153 memset((char *) autcpu12_mtd, 0, sizeof(struct mtd_info)); 152 memset(autcpu12_mtd, 0, sizeof(struct mtd_info));
154 memset((char *) this, 0, sizeof(struct nand_chip)); 153 memset(this, 0, sizeof(struct nand_chip));
155 154
156 /* Link the private data with the MTD structure */ 155 /* Link the private data with the MTD structure */
157 autcpu12_mtd->priv = this; 156 autcpu12_mtd->priv = this;
@@ -167,35 +166,34 @@ int __init autcpu12_init (void)
167 166
168 /* Enable the following for a flash based bad block table */ 167 /* Enable the following for a flash based bad block table */
169 /* 168 /*
170 this->options = NAND_USE_FLASH_BBT; 169 this->options = NAND_USE_FLASH_BBT;
171 */ 170 */
172 this->options = NAND_USE_FLASH_BBT; 171 this->options = NAND_USE_FLASH_BBT;
173 172
174 /* Scan to find existance of the device */ 173 /* Scan to find existance of the device */
175 if (nand_scan (autcpu12_mtd, 1)) { 174 if (nand_scan(autcpu12_mtd, 1)) {
176 err = -ENXIO; 175 err = -ENXIO;
177 goto out_ior; 176 goto out_ior;
178 } 177 }
179 178
180 /* Register the partitions */ 179 /* Register the partitions */
181 switch(autcpu12_mtd->size){ 180 switch (autcpu12_mtd->size) {
182 case SZ_16M: add_mtd_partitions(autcpu12_mtd, partition_info16k, NUM_PARTITIONS16K); break; 181 case SZ_16M: add_mtd_partitions(autcpu12_mtd, partition_info16k, NUM_PARTITIONS16K); break;
183 case SZ_32M: add_mtd_partitions(autcpu12_mtd, partition_info32k, NUM_PARTITIONS32K); break; 182 case SZ_32M: add_mtd_partitions(autcpu12_mtd, partition_info32k, NUM_PARTITIONS32K); break;
184 case SZ_64M: add_mtd_partitions(autcpu12_mtd, partition_info64k, NUM_PARTITIONS64K); break; 183 case SZ_64M: add_mtd_partitions(autcpu12_mtd, partition_info64k, NUM_PARTITIONS64K); break;
185 case SZ_128M: add_mtd_partitions(autcpu12_mtd, partition_info128k, NUM_PARTITIONS128K); break; 184 case SZ_128M: add_mtd_partitions(autcpu12_mtd, partition_info128k, NUM_PARTITIONS128K); break;
186 default: { 185 default:
187 printk ("Unsupported SmartMedia device\n"); 186 printk("Unsupported SmartMedia device\n");
188 err = -ENXIO; 187 err = -ENXIO;
189 goto out_ior; 188 goto out_ior;
190 }
191 } 189 }
192 goto out; 190 goto out;
193 191
194out_ior: 192 out_ior:
195 iounmap((void *)autcpu12_fio_base); 193 iounmap((void *)autcpu12_fio_base);
196out_mtd: 194 out_mtd:
197 kfree (autcpu12_mtd); 195 kfree(autcpu12_mtd);
198out: 196 out:
199 return err; 197 return err;
200} 198}
201 199
@@ -205,17 +203,18 @@ module_init(autcpu12_init);
205 * Clean up routine 203 * Clean up routine
206 */ 204 */
207#ifdef MODULE 205#ifdef MODULE
208static void __exit autcpu12_cleanup (void) 206static void __exit autcpu12_cleanup(void)
209{ 207{
210 /* Release resources, unregister device */ 208 /* Release resources, unregister device */
211 nand_release (autcpu12_mtd); 209 nand_release(autcpu12_mtd);
212 210
213 /* unmap physical adress */ 211 /* unmap physical adress */
214 iounmap((void *)autcpu12_fio_base); 212 iounmap((void *)autcpu12_fio_base);
215 213
216 /* Free the MTD device structure */ 214 /* Free the MTD device structure */
217 kfree (autcpu12_mtd); 215 kfree(autcpu12_mtd);
218} 216}
217
219module_exit(autcpu12_cleanup); 218module_exit(autcpu12_cleanup);
220#endif 219#endif
221 220