Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93639
b: refs/heads/master
c: 7ebe593
h: refs/heads/master
i:
  93637: f38cd56
  93635: daa1f05
  93631: f8b55b1
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Apr 26, 2008
1 parent 16fd8b1 commit 6d6db23
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d92f1a2829dbe29c644569a3b64a021e4d90005d
refs/heads/master: 7ebe5936c214c656a1625abf9ec3b09e3d1bf34a
37 changes: 34 additions & 3 deletions trunk/drivers/ide/pci/cmd640.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@

#include <asm/io.h>

#define DRV_NAME "cmd640"

/*
* This flag is set in ide.c by the parameter: ide0=cmd640_vlb
*/
Expand Down Expand Up @@ -686,6 +688,24 @@ static const struct ide_port_info cmd640_port_info __initdata = {
#endif
};

static int cmd640x_init_one(unsigned long base, unsigned long ctl)
{
if (!request_region(base, 8, DRV_NAME)) {
printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
DRV_NAME, base, base + 7);
return -EBUSY;
}

if (!request_region(ctl, 1, DRV_NAME)) {
printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
DRV_NAME, ctl);
release_region(base, 8);
return -EBUSY;
}

return 0;
}

/*
* Probe for a cmd640 chipset, and initialize it if found.
*/
Expand All @@ -694,7 +714,7 @@ static int __init cmd640x_init(void)
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
int second_port_toggled = 0;
#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
int second_port_cmd640 = 0;
int second_port_cmd640 = 0, rc;
const char *bus_type, *port2;
unsigned int index;
u8 b, cfr;
Expand Down Expand Up @@ -738,6 +758,17 @@ static int __init cmd640x_init(void)
return 0;
}

rc = cmd640x_init_one(0x1f0, 0x3f6);
if (rc)
return rc;

rc = cmd640x_init_one(0x170, 0x376);
if (rc) {
release_region(0x3f6, 1);
release_region(0x1f0, 8);
return rc;
}

memset(&hw, 0, sizeof(hw));

ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
Expand All @@ -756,7 +787,7 @@ static int __init cmd640x_init(void)
*/
if (cmd_hwif0) {
ide_init_port_hw(cmd_hwif0, &hw[0]);

cmd_hwif0->mmio = 1;
idx[0] = cmd_hwif0->index;
}

Expand Down Expand Up @@ -809,7 +840,7 @@ static int __init cmd640x_init(void)
*/
if (second_port_cmd640 && cmd_hwif1) {
ide_init_port_hw(cmd_hwif1, &hw[1]);

cmd_hwif1->mmio = 1;
idx[1] = cmd_hwif1->index;
}
printk(KERN_INFO "cmd640: %sserialized, secondary interface %s\n",
Expand Down

0 comments on commit 6d6db23

Please sign in to comment.