diff options
Diffstat (limited to 'drivers/ide/mips/swarm.c')
-rw-r--r-- | drivers/ide/mips/swarm.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index 52fee3d2771a..9f1212cc4aed 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c | |||
@@ -61,6 +61,11 @@ static struct resource swarm_ide_resource = { | |||
61 | 61 | ||
62 | static struct platform_device *swarm_ide_dev; | 62 | static struct platform_device *swarm_ide_dev; |
63 | 63 | ||
64 | static const struct ide_port_info swarm_port_info = { | ||
65 | .name = DRV_NAME, | ||
66 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, | ||
67 | }; | ||
68 | |||
64 | /* | 69 | /* |
65 | * swarm_ide_probe - if the board header indicates the existence of | 70 | * swarm_ide_probe - if the board header indicates the existence of |
66 | * Generic Bus IDE, allocate a HWIF for it. | 71 | * Generic Bus IDE, allocate a HWIF for it. |
@@ -77,12 +82,6 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
77 | if (!SIBYTE_HAVE_IDE) | 82 | if (!SIBYTE_HAVE_IDE) |
78 | return -ENODEV; | 83 | return -ENODEV; |
79 | 84 | ||
80 | hwif = ide_find_port(); | ||
81 | if (hwif == NULL) { | ||
82 | printk(KERN_ERR DRV_NAME ": no free slot for interface\n"); | ||
83 | return -ENOMEM; | ||
84 | } | ||
85 | |||
86 | base = ioremap(A_IO_EXT_BASE, 0x800); | 85 | base = ioremap(A_IO_EXT_BASE, 0x800); |
87 | offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); | 86 | offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); |
88 | size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); | 87 | size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); |
@@ -109,10 +108,6 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
109 | 108 | ||
110 | base = ioremap(offset, size); | 109 | base = ioremap(offset, size); |
111 | 110 | ||
112 | /* Setup MMIO ops. */ | ||
113 | hwif->host_flags = IDE_HFLAG_MMIO; | ||
114 | default_hwif_mmiops(hwif); | ||
115 | |||
116 | for (i = 0; i <= 7; i++) | 111 | for (i = 0; i <= 7; i++) |
117 | hw.io_ports_array[i] = | 112 | hw.io_ports_array[i] = |
118 | (unsigned long)(base + ((0x1f0 + i) << 5)); | 113 | (unsigned long)(base + ((0x1f0 + i) << 5)); |
@@ -121,15 +116,26 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
121 | hw.irq = K_INT_GB_IDE; | 116 | hw.irq = K_INT_GB_IDE; |
122 | hw.chipset = ide_generic; | 117 | hw.chipset = ide_generic; |
123 | 118 | ||
119 | hwif = ide_find_port_slot(&swarm_port_info); | ||
120 | if (hwif == NULL) | ||
121 | goto err; | ||
122 | |||
124 | ide_init_port_hw(hwif, &hw); | 123 | ide_init_port_hw(hwif, &hw); |
125 | 124 | ||
125 | /* Setup MMIO ops. */ | ||
126 | default_hwif_mmiops(hwif); | ||
127 | |||
126 | idx[0] = hwif->index; | 128 | idx[0] = hwif->index; |
127 | 129 | ||
128 | ide_device_add(idx, NULL); | 130 | ide_device_add(idx, &swarm_port_info); |
129 | 131 | ||
130 | dev_set_drvdata(dev, hwif); | 132 | dev_set_drvdata(dev, hwif); |
131 | 133 | ||
132 | return 0; | 134 | return 0; |
135 | err: | ||
136 | release_resource(&swarm_ide_resource); | ||
137 | iounmap(base); | ||
138 | return -ENOMEM; | ||
133 | } | 139 | } |
134 | 140 | ||
135 | static struct device_driver swarm_ide_driver = { | 141 | static struct device_driver swarm_ide_driver = { |