Commit 7808755d authored by Linus Walleij's avatar Linus Walleij

gpio: pl061: proper error messages

This makes the PL061 driver print proper error messages
when probe fails, and also tell us when the chip is finally
registered.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 99adc059
...@@ -270,21 +270,27 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -270,21 +270,27 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
if (pdata) { if (pdata) {
chip->gc.base = pdata->gpio_base; chip->gc.base = pdata->gpio_base;
irq_base = pdata->irq_base; irq_base = pdata->irq_base;
if (irq_base <= 0) if (irq_base <= 0) {
dev_err(&adev->dev, "invalid IRQ base in pdata\n");
return -ENODEV; return -ENODEV;
}
} else { } else {
chip->gc.base = -1; chip->gc.base = -1;
irq_base = 0; irq_base = 0;
} }
if (!devm_request_mem_region(dev, adev->res.start, if (!devm_request_mem_region(dev, adev->res.start,
resource_size(&adev->res), "pl061")) resource_size(&adev->res), "pl061")) {
dev_err(&adev->dev, "no memory region\n");
return -EBUSY; return -EBUSY;
}
chip->base = devm_ioremap(dev, adev->res.start, chip->base = devm_ioremap(dev, adev->res.start,
resource_size(&adev->res)); resource_size(&adev->res));
if (!chip->base) if (!chip->base) {
dev_err(&adev->dev, "could not remap memory\n");
return -ENOMEM; return -ENOMEM;
}
spin_lock_init(&chip->lock); spin_lock_init(&chip->lock);
...@@ -309,16 +315,20 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -309,16 +315,20 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
*/ */
writeb(0, chip->base + GPIOIE); /* disable irqs */ writeb(0, chip->base + GPIOIE); /* disable irqs */
irq = adev->irq[0]; irq = adev->irq[0];
if (irq < 0) if (irq < 0) {
dev_err(&adev->dev, "invalid IRQ\n");
return -ENODEV; return -ENODEV;
}
irq_set_chained_handler(irq, pl061_irq_handler); irq_set_chained_handler(irq, pl061_irq_handler);
irq_set_handler_data(irq, chip); irq_set_handler_data(irq, chip);
chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR,
irq_base, &pl061_domain_ops, chip); irq_base, &pl061_domain_ops, chip);
if (!chip->domain) if (!chip->domain) {
dev_err(&adev->dev, "no irq domain\n");
return -ENODEV; return -ENODEV;
}
for (i = 0; i < PL061_GPIO_NR; i++) { for (i = 0; i < PL061_GPIO_NR; i++) {
if (pdata) { if (pdata) {
...@@ -331,6 +341,8 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -331,6 +341,8 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
} }
amba_set_drvdata(adev, chip); amba_set_drvdata(adev, chip);
dev_info(&adev->dev, "PL061 GPIO chip @%08x registered\n",
adev->res.start);
return 0; return 0;
} }
......
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