X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmtd%2Fmaps%2Fscx200_docflash.c;h=28b8a571a91a4ff60f133b5de4ed127684d5d78c;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=0ece3786d6ea5a179ebda4b43a8fbe0396653e73;hpb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;p=linux-2.6.git diff --git a/drivers/mtd/maps/scx200_docflash.c b/drivers/mtd/maps/scx200_docflash.c index 0ece3786d..28b8a571a 100644 --- a/drivers/mtd/maps/scx200_docflash.c +++ b/drivers/mtd/maps/scx200_docflash.c @@ -1,8 +1,8 @@ -/* linux/drivers/mtd/maps/scx200_docflash.c +/* linux/drivers/mtd/maps/scx200_docflash.c Copyright (c) 2001,2002 Christer Weinigel - $Id: scx200_docflash.c,v 1.10 2004/11/28 09:40:40 dwmw2 Exp $ + $Id: scx200_docflash.c,v 1.12 2005/11/07 11:14:28 gleixner Exp $ National Semiconductor SCx200 flash mapped with DOCCS */ @@ -49,28 +49,28 @@ static struct mtd_info *mymtd; #ifdef CONFIG_MTD_PARTITIONS static struct mtd_partition partition_info[] = { - { - .name = "DOCCS Boot kernel", - .offset = 0, + { + .name = "DOCCS Boot kernel", + .offset = 0, .size = 0xc0000 }, - { - .name = "DOCCS Low BIOS", - .offset = 0xc0000, + { + .name = "DOCCS Low BIOS", + .offset = 0xc0000, .size = 0x40000 }, - { - .name = "DOCCS File system", - .offset = 0x100000, + { + .name = "DOCCS File system", + .offset = 0x100000, .size = ~0 /* calculate from flash size */ }, - { - .name = "DOCCS High BIOS", + { + .name = "DOCCS High BIOS", .offset = ~0, /* calculate from flash size */ .size = 0x80000 }, }; -#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0])) +#define NUM_PARTITIONS ARRAY_SIZE(partition_info) #endif @@ -88,7 +88,7 @@ static int __init init_scx200_docflash(void) printk(KERN_DEBUG NAME ": NatSemi SCx200 DOCCS Flash Driver\n"); - if ((bridge = pci_find_device(PCI_VENDOR_ID_NS, + if ((bridge = pci_find_device(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE, NULL)) == NULL) return -ENODEV; @@ -134,28 +134,28 @@ static int __init init_scx200_docflash(void) printk(KERN_ERR NAME ": invalid size for flash mapping\n"); return -EINVAL; } - + if (width != 8 && width != 16) { printk(KERN_ERR NAME ": invalid bus width for flash mapping\n"); return -EINVAL; } - - if (allocate_resource(&iomem_resource, &docmem, + + if (allocate_resource(&iomem_resource, &docmem, size, - 0xc0000000, 0xffffffff, + 0xc0000000, 0xffffffff, size, NULL, NULL)) { printk(KERN_ERR NAME ": unable to allocate memory for flash mapping\n"); return -ENOMEM; } - + ctrl = 0x07000000 | ((size-1) >> 13); printk(KERN_INFO "DOCCS BASE=0x%08lx, CTRL=0x%08lx\n", (long)docmem.start, (long)ctrl); - + pci_write_config_dword(bridge, SCx200_DOCCS_BASE, docmem.start); pci_write_config_dword(bridge, SCx200_DOCCS_CTRL, ctrl); pmr = inl(scx200_cb_base + SCx200_PMR); - + if (width == 8) { pmr &= ~(1<<6); } else { @@ -163,8 +163,8 @@ static int __init init_scx200_docflash(void) } outl(pmr, scx200_cb_base + SCx200_PMR); } - - printk(KERN_INFO NAME ": DOCCS mapped at 0x%lx-0x%lx, width %d\n", + + printk(KERN_INFO NAME ": DOCCS mapped at 0x%lx-0x%lx, width %d\n", docmem.start, docmem.end, width); scx200_docflash_map.size = size;