ide: manage I/O resources in ide_legacy_init_one()

* Tell IDE layer to not manage resources by setting hwif->mmio flag.

* Use {request,release}_region() for resources management.

* Set ->name field of 'struct ide_port_info' instances in legacy VLB
  host drivers and use driver name for resources management.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent d9b819a0
...@@ -1648,12 +1648,26 @@ static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no, ...@@ -1648,12 +1648,26 @@ static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no,
irq = 15; irq = 15;
} }
if (!request_region(base, 8, d->name)) {
printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
d->name, base, base + 7);
return;
}
if (!request_region(ctl, 1, d->name)) {
printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
d->name, ctl);
release_region(base, 8);
return;
}
ide_std_init_ports(hw, base, ctl); ide_std_init_ports(hw, base, ctl);
hw->irq = irq; hw->irq = irq;
hwif = ide_find_port_slot(d); hwif = ide_find_port_slot(d);
if (hwif) { if (hwif) {
ide_init_port_hw(hwif, hw); ide_init_port_hw(hwif, hw);
hwif->mmio = 1;
if (config) if (config)
hwif->config_data = config; hwif->config_data = config;
idx[port_no] = hwif->index; idx[port_no] = hwif->index;
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include <asm/io.h> #include <asm/io.h>
#define DRV_NAME "ali14xx"
/* port addresses for auto-detection */ /* port addresses for auto-detection */
#define ALI_NUM_PORTS 4 #define ALI_NUM_PORTS 4
static const int ports[ALI_NUM_PORTS] __initdata = static const int ports[ALI_NUM_PORTS] __initdata =
...@@ -197,6 +199,7 @@ static const struct ide_port_ops ali14xx_port_ops = { ...@@ -197,6 +199,7 @@ static const struct ide_port_ops ali14xx_port_ops = {
}; };
static const struct ide_port_info ali14xx_port_info = { static const struct ide_port_info ali14xx_port_info = {
.name = DRV_NAME,
.chipset = ide_ali14xx, .chipset = ide_ali14xx,
.port_ops = &ali14xx_port_ops, .port_ops = &ali14xx_port_ops,
.host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE, .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <asm/io.h> #include <asm/io.h>
#define DRV_NAME "dtc2278"
/* /*
* Changing this #undef to #define may solve start up problems in some systems. * Changing this #undef to #define may solve start up problems in some systems.
*/ */
...@@ -91,6 +93,7 @@ static const struct ide_port_ops dtc2278_port_ops = { ...@@ -91,6 +93,7 @@ static const struct ide_port_ops dtc2278_port_ops = {
}; };
static const struct ide_port_info dtc2278_port_info __initdata = { static const struct ide_port_info dtc2278_port_info __initdata = {
.name = DRV_NAME,
.chipset = ide_dtc2278, .chipset = ide_dtc2278,
.port_ops = &dtc2278_port_ops, .port_ops = &dtc2278_port_ops,
.host_flags = IDE_HFLAG_SERIALIZE | .host_flags = IDE_HFLAG_SERIALIZE |
......
...@@ -335,6 +335,7 @@ static const struct ide_port_ops ht6560b_port_ops = { ...@@ -335,6 +335,7 @@ static const struct ide_port_ops ht6560b_port_ops = {
}; };
static const struct ide_port_info ht6560b_port_info __initdata = { static const struct ide_port_info ht6560b_port_info __initdata = {
.name = DRV_NAME,
.chipset = ide_ht6560b, .chipset = ide_ht6560b,
.port_ops = &ht6560b_port_ops, .port_ops = &ht6560b_port_ops,
.host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */ .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#define DRV_NAME "qd65xx"
#include "qd65xx.h" #include "qd65xx.h"
/* /*
...@@ -317,6 +319,7 @@ static const struct ide_port_ops qd6580_port_ops = { ...@@ -317,6 +319,7 @@ static const struct ide_port_ops qd6580_port_ops = {
}; };
static const struct ide_port_info qd65xx_port_info __initdata = { static const struct ide_port_info qd65xx_port_info __initdata = {
.name = DRV_NAME,
.chipset = ide_qd65xx, .chipset = ide_qd65xx,
.host_flags = IDE_HFLAG_IO_32BIT | .host_flags = IDE_HFLAG_IO_32BIT |
IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_DMA |
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#include <asm/io.h> #include <asm/io.h>
#define DRV_NAME "umc8672"
/* /*
* Default speeds. These can be changed with "auto-tune" and/or hdparm. * Default speeds. These can be changed with "auto-tune" and/or hdparm.
*/ */
...@@ -125,6 +127,7 @@ static const struct ide_port_ops umc8672_port_ops = { ...@@ -125,6 +127,7 @@ static const struct ide_port_ops umc8672_port_ops = {
}; };
static const struct ide_port_info umc8672_port_info __initdata = { static const struct ide_port_info umc8672_port_info __initdata = {
.name = DRV_NAME,
.chipset = ide_umc8672, .chipset = ide_umc8672,
.port_ops = &umc8672_port_ops, .port_ops = &umc8672_port_ops,
.host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE, .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment