Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / mtd / maps / sc520cdp.c
index d446d55..e8c130e 100644 (file)
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  *
- * $Id: sc520cdp.c,v 1.15 2003/05/21 12:45:20 dwmw2 Exp $
+ * $Id: sc520cdp.c,v 1.23 2005/11/17 08:20:27 dwmw2 Exp $
  *
  *
  * The SC520CDP is an evaluation board for the Elan SC520 processor available
@@ -90,24 +90,24 @@ static struct map_info sc520cdp_map[] = {
        {
                .name = "SC520CDP Flash Bank #0",
                .size = WINDOW_SIZE_0,
-               .buswidth = 4,
+               .bankwidth = 4,
                .phys = WINDOW_ADDR_0
        },
        {
                .name = "SC520CDP Flash Bank #1",
                .size = WINDOW_SIZE_1,
-               .buswidth = 4,
+               .bankwidth = 4,
                .phys = WINDOW_ADDR_1
        },
        {
                .name = "SC520CDP DIL Flash",
                .size = WINDOW_SIZE_2,
-               .buswidth = 1,
+               .bankwidth = 1,
                .phys = WINDOW_ADDR_2
        },
 };
 
-#define NUM_FLASH_BANKS        (sizeof(sc520cdp_map)/sizeof(struct map_info))
+#define NUM_FLASH_BANKS        ARRAY_SIZE(sc520cdp_map)
 
 static struct mtd_info *mymtd[NUM_FLASH_BANKS];
 static struct mtd_info *merged_mtd;
@@ -164,7 +164,7 @@ struct sc520_par_table
        unsigned long default_address;
 };
 
-static struct sc520_par_table par_table[NUM_FLASH_BANKS] =
+static const struct sc520_par_table par_table[NUM_FLASH_BANKS] =
 {
        {       /* Flash Bank #0: selected by ROMCS0 */
                SC520_PAR_ROMCS0,
@@ -186,12 +186,12 @@ static struct sc520_par_table par_table[NUM_FLASH_BANKS] =
 
 static void sc520cdp_setup_par(void)
 {
-       volatile unsigned long *mmcr;
+       volatile unsigned long __iomem *mmcr;
        unsigned long mmcr_val;
        int i, j;
 
        /* map in SC520's MMCR area */
-       mmcr = (unsigned long *)ioremap_nocache(SC520_MMCR_BASE, SC520_MMCR_EXTENT);
+       mmcr = ioremap_nocache(SC520_MMCR_BASE, SC520_MMCR_EXTENT);
        if(!mmcr) { /* ioremap_nocache failed: skip the PAR reprogramming */
                /* force physical address fields to BIOS defaults: */
                for(i = 0; i < NUM_FLASH_BANKS; i++)
@@ -223,7 +223,7 @@ static void sc520cdp_setup_par(void)
                        sc520cdp_map[i].phys = par_table[i].default_address;
                }
        }
-       iounmap((void *)mmcr);
+       iounmap(mmcr);
 }
 #endif
 
@@ -231,7 +231,7 @@ static void sc520cdp_setup_par(void)
 static int __init init_sc520cdp(void)
 {
        int i, devices_found = 0;
-       
+
 #ifdef REPROGRAM_PAR
        /* reprogram PAR registers so flash appears at the desired addresses */
        sc520cdp_setup_par();
@@ -241,7 +241,7 @@ static int __init init_sc520cdp(void)
                printk(KERN_NOTICE "SC520 CDP flash device: 0x%lx at 0x%lx\n",
                       sc520cdp_map[i].size, sc520cdp_map[i].phys);
 
-               sc520cdp_map[i].virt = (unsigned long)ioremap_nocache(sc520cdp_map[i].phys, sc520cdp_map[i].size);
+               sc520cdp_map[i].virt = ioremap_nocache(sc520cdp_map[i].phys, sc520cdp_map[i].size);
 
                if (!sc520cdp_map[i].virt) {
                        printk("Failed to ioremap_nocache\n");
@@ -261,7 +261,7 @@ static int __init init_sc520cdp(void)
                        ++devices_found;
                }
                else {
-                       iounmap((void *)sc520cdp_map[i].virt);
+                       iounmap(sc520cdp_map[i].virt);
                }
        }
        if(devices_found >= 2) {
@@ -278,7 +278,7 @@ static int __init init_sc520cdp(void)
 static void __exit cleanup_sc520cdp(void)
 {
        int i;
-       
+
        if (merged_mtd) {
                del_mtd_device(merged_mtd);
                mtd_concat_destroy(merged_mtd);
@@ -290,8 +290,8 @@ static void __exit cleanup_sc520cdp(void)
                if (mymtd[i])
                        map_destroy(mymtd[i]);
                if (sc520cdp_map[i].virt) {
-                       iounmap((void *)sc520cdp_map[i].virt);
-                       sc520cdp_map[i].virt = 0;
+                       iounmap(sc520cdp_map[i].virt);
+                       sc520cdp_map[i].virt = NULL;
                }
        }
 }