aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/tx4938ide.c
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-11-02 15:40:09 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-11-02 15:40:09 -0500
commit9d4eb0a33e620a85e36f66cf895d2bea6d556eac (patch)
tree9eb73a85502085cd5bb0017a0bff28368e527774 /drivers/ide/tx4938ide.c
parent630a8b2500c8d04e87e597c4afa5e1fafff04591 (diff)
tx4938ide: Do not call devm_ioremap for whole 128KB
Call devm_ioremap() for CS0 and CS1 separetely. And some style cleanups. Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: ralf@linux-mips.org Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/tx4938ide.c')
-rw-r--r--drivers/ide/tx4938ide.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index 9c518e722707..796289cf97e0 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -235,7 +235,7 @@ static int __init tx4938ide_probe(struct platform_device *pdev)
235 struct resource *res; 235 struct resource *res;
236 struct tx4938ide_platform_info *pdata = pdev->dev.platform_data; 236 struct tx4938ide_platform_info *pdata = pdev->dev.platform_data;
237 int irq, ret, i; 237 int irq, ret, i;
238 unsigned long mapbase; 238 unsigned long mapbase, mapctl;
239 struct ide_port_info d = tx4938ide_port_info; 239 struct ide_port_info d = tx4938ide_port_info;
240 240
241 irq = platform_get_irq(pdev, 0); 241 irq = platform_get_irq(pdev, 0);
@@ -249,38 +249,43 @@ static int __init tx4938ide_probe(struct platform_device *pdev)
249 res->end - res->start + 1, "tx4938ide")) 249 res->end - res->start + 1, "tx4938ide"))
250 return -EBUSY; 250 return -EBUSY;
251 mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, 251 mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start,
252 res->end - res->start + 1); 252 8 << pdata->ioport_shift);
253 if (!mapbase) 253 mapctl = (unsigned long)devm_ioremap(&pdev->dev,
254 res->start + 0x10000 +
255 (6 << pdata->ioport_shift),
256 1 << pdata->ioport_shift);
257 if (!mapbase || !mapctl)
254 return -EBUSY; 258 return -EBUSY;
255 259
256 memset(&hw, 0, sizeof(hw)); 260 memset(&hw, 0, sizeof(hw));
257 if (pdata->ioport_shift) { 261 if (pdata->ioport_shift) {
258 unsigned long port = mapbase; 262 unsigned long port = mapbase;
263 unsigned long ctl = mapctl;
259 264
260 hw.io_ports_array[0] = port; 265 hw.io_ports_array[0] = port;
261#ifdef __BIG_ENDIAN 266#ifdef __BIG_ENDIAN
262 port++; 267 port++;
268 ctl++;
263#endif 269#endif
264 for (i = 1; i <= 7; i++) 270 for (i = 1; i <= 7; i++)
265 hw.io_ports_array[i] = 271 hw.io_ports_array[i] =
266 port + (i << pdata->ioport_shift); 272 port + (i << pdata->ioport_shift);
267 hw.io_ports.ctl_addr = 273 hw.io_ports.ctl_addr = ctl;
268 port + 0x10000 + (6 << pdata->ioport_shift);
269 } else 274 } else
270 ide_std_init_ports(&hw, mapbase, mapbase + 0x10006); 275 ide_std_init_ports(&hw, mapbase, mapctl);
271 hw.irq = irq; 276 hw.irq = irq;
272 hw.dev = &pdev->dev; 277 hw.dev = &pdev->dev;
273 278
274 pr_info("TX4938 IDE interface (base %#lx, irq %d)\n", mapbase, hw.irq); 279 pr_info("TX4938 IDE interface (base %#lx, ctl %#lx, irq %d)\n",
280 mapbase, mapctl, hw.irq);
275 if (pdata->gbus_clock) 281 if (pdata->gbus_clock)
276 tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0); 282 tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0);
277 else 283 else
278 d.port_ops = NULL; 284 d.port_ops = NULL;
279 ret = ide_host_add(&d, hws, &host); 285 ret = ide_host_add(&d, hws, &host);
280 if (ret) 286 if (!ret)
281 return ret; 287 platform_set_drvdata(pdev, host);
282 platform_set_drvdata(pdev, host); 288 return ret;
283 return 0;
284} 289}
285 290
286static int __exit tx4938ide_remove(struct platform_device *pdev) 291static int __exit tx4938ide_remove(struct platform_device *pdev)