mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 23:23:03 +00:00
gpio: loongson1: Add DT support
This patch adds DT support for Loongson-1 GPIO driver. Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
722cfe4ffa
commit
9bc167e27c
@ -68,25 +68,38 @@ static int ls1x_gpio_probe(struct platform_device *pdev)
|
|||||||
ls1x_gc->gc.owner = THIS_MODULE;
|
ls1x_gc->gc.owner = THIS_MODULE;
|
||||||
ls1x_gc->gc.request = ls1x_gpio_request;
|
ls1x_gc->gc.request = ls1x_gpio_request;
|
||||||
ls1x_gc->gc.free = ls1x_gpio_free;
|
ls1x_gc->gc.free = ls1x_gpio_free;
|
||||||
ls1x_gc->gc.base = pdev->id * 32;
|
/*
|
||||||
|
* Clear ngpio to let gpiolib get the correct number
|
||||||
|
* by reading ngpios property
|
||||||
|
*/
|
||||||
|
ls1x_gc->gc.ngpio = 0;
|
||||||
|
|
||||||
ret = devm_gpiochip_add_data(dev, &ls1x_gc->gc, ls1x_gc);
|
ret = devm_gpiochip_add_data(dev, &ls1x_gc->gc, ls1x_gc);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
platform_set_drvdata(pdev, ls1x_gc);
|
platform_set_drvdata(pdev, ls1x_gc);
|
||||||
dev_info(dev, "Loongson1 GPIO driver registered\n");
|
|
||||||
|
dev_info(dev, "GPIO controller registered with %d pins\n",
|
||||||
|
ls1x_gc->gc.ngpio);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
dev_err(dev, "failed to register GPIO device\n");
|
dev_err(dev, "failed to register GPIO controller\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id ls1x_gpio_dt_ids[] = {
|
||||||
|
{ .compatible = "loongson,ls1x-gpio" },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, ls1x_gpio_dt_ids);
|
||||||
|
|
||||||
static struct platform_driver ls1x_gpio_driver = {
|
static struct platform_driver ls1x_gpio_driver = {
|
||||||
.probe = ls1x_gpio_probe,
|
.probe = ls1x_gpio_probe,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "ls1x-gpio",
|
.name = "ls1x-gpio",
|
||||||
|
.of_match_table = ls1x_gpio_dt_ids,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user