mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 10:01:25 +00:00
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>
This commit is contained in:
parent
630a8b2500
commit
9d4eb0a33e
1 changed files with 16 additions and 11 deletions
|
@ -235,7 +235,7 @@ static int __init tx4938ide_probe(struct platform_device *pdev)
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct tx4938ide_platform_info *pdata = pdev->dev.platform_data;
|
struct tx4938ide_platform_info *pdata = pdev->dev.platform_data;
|
||||||
int irq, ret, i;
|
int irq, ret, i;
|
||||||
unsigned long mapbase;
|
unsigned long mapbase, mapctl;
|
||||||
struct ide_port_info d = tx4938ide_port_info;
|
struct ide_port_info d = tx4938ide_port_info;
|
||||||
|
|
||||||
irq = platform_get_irq(pdev, 0);
|
irq = platform_get_irq(pdev, 0);
|
||||||
|
@ -249,38 +249,43 @@ static int __init tx4938ide_probe(struct platform_device *pdev)
|
||||||
res->end - res->start + 1, "tx4938ide"))
|
res->end - res->start + 1, "tx4938ide"))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start,
|
mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start,
|
||||||
res->end - res->start + 1);
|
8 << pdata->ioport_shift);
|
||||||
if (!mapbase)
|
mapctl = (unsigned long)devm_ioremap(&pdev->dev,
|
||||||
|
res->start + 0x10000 +
|
||||||
|
(6 << pdata->ioport_shift),
|
||||||
|
1 << pdata->ioport_shift);
|
||||||
|
if (!mapbase || !mapctl)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
memset(&hw, 0, sizeof(hw));
|
memset(&hw, 0, sizeof(hw));
|
||||||
if (pdata->ioport_shift) {
|
if (pdata->ioport_shift) {
|
||||||
unsigned long port = mapbase;
|
unsigned long port = mapbase;
|
||||||
|
unsigned long ctl = mapctl;
|
||||||
|
|
||||||
hw.io_ports_array[0] = port;
|
hw.io_ports_array[0] = port;
|
||||||
#ifdef __BIG_ENDIAN
|
#ifdef __BIG_ENDIAN
|
||||||
port++;
|
port++;
|
||||||
|
ctl++;
|
||||||
#endif
|
#endif
|
||||||
for (i = 1; i <= 7; i++)
|
for (i = 1; i <= 7; i++)
|
||||||
hw.io_ports_array[i] =
|
hw.io_ports_array[i] =
|
||||||
port + (i << pdata->ioport_shift);
|
port + (i << pdata->ioport_shift);
|
||||||
hw.io_ports.ctl_addr =
|
hw.io_ports.ctl_addr = ctl;
|
||||||
port + 0x10000 + (6 << pdata->ioport_shift);
|
|
||||||
} else
|
} else
|
||||||
ide_std_init_ports(&hw, mapbase, mapbase + 0x10006);
|
ide_std_init_ports(&hw, mapbase, mapctl);
|
||||||
hw.irq = irq;
|
hw.irq = irq;
|
||||||
hw.dev = &pdev->dev;
|
hw.dev = &pdev->dev;
|
||||||
|
|
||||||
pr_info("TX4938 IDE interface (base %#lx, irq %d)\n", mapbase, hw.irq);
|
pr_info("TX4938 IDE interface (base %#lx, ctl %#lx, irq %d)\n",
|
||||||
|
mapbase, mapctl, hw.irq);
|
||||||
if (pdata->gbus_clock)
|
if (pdata->gbus_clock)
|
||||||
tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0);
|
tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0);
|
||||||
else
|
else
|
||||||
d.port_ops = NULL;
|
d.port_ops = NULL;
|
||||||
ret = ide_host_add(&d, hws, &host);
|
ret = ide_host_add(&d, hws, &host);
|
||||||
if (ret)
|
if (!ret)
|
||||||
return ret;
|
platform_set_drvdata(pdev, host);
|
||||||
platform_set_drvdata(pdev, host);
|
return ret;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __exit tx4938ide_remove(struct platform_device *pdev)
|
static int __exit tx4938ide_remove(struct platform_device *pdev)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue