Commit ad33707417e4fa3dd4b12f9ed912e2349a984026
Committed by
Wolfram Sang
1 parent
26f8d43df7
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
i2c: sh_mobile: add device tree support
This patch enables DT support for the IIC driver used on SH-based SoCs such as sh7722 and sh7724 among others as well as SH-Mobile SoCs such as sh7367, sh7377, sh7372, sh73a0 and r8a7740. Tested with out-of-tree DT support code on the sh7372 Mackerel board. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Showing 1 changed file with 11 additions and 0 deletions Side-by-side Diff
drivers/i2c/busses/i2c-sh_mobile.c
... | ... | @@ -27,6 +27,7 @@ |
27 | 27 | #include <linux/platform_device.h> |
28 | 28 | #include <linux/interrupt.h> |
29 | 29 | #include <linux/i2c.h> |
30 | +#include <linux/of_i2c.h> | |
30 | 31 | #include <linux/err.h> |
31 | 32 | #include <linux/pm_runtime.h> |
32 | 33 | #include <linux/clk.h> |
... | ... | @@ -653,6 +654,7 @@ |
653 | 654 | adap->dev.parent = &dev->dev; |
654 | 655 | adap->retries = 5; |
655 | 656 | adap->nr = dev->id; |
657 | + adap->dev.of_node = dev->dev.of_node; | |
656 | 658 | |
657 | 659 | strlcpy(adap->name, dev->name, sizeof(adap->name)); |
658 | 660 | |
... | ... | @@ -667,6 +669,8 @@ |
667 | 669 | |
668 | 670 | dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n", |
669 | 671 | adap->nr, pd->bus_speed); |
672 | + | |
673 | + of_i2c_register_devices(adap); | |
670 | 674 | return 0; |
671 | 675 | |
672 | 676 | err_all: |
673 | 677 | |
... | ... | @@ -710,11 +714,18 @@ |
710 | 714 | .runtime_resume = sh_mobile_i2c_runtime_nop, |
711 | 715 | }; |
712 | 716 | |
717 | +static const struct of_device_id sh_mobile_i2c_dt_ids[] __devinitconst = { | |
718 | + { .compatible = "renesas,rmobile-iic", }, | |
719 | + {}, | |
720 | +}; | |
721 | +MODULE_DEVICE_TABLE(of, sh_mobile_i2c_dt_ids); | |
722 | + | |
713 | 723 | static struct platform_driver sh_mobile_i2c_driver = { |
714 | 724 | .driver = { |
715 | 725 | .name = "i2c-sh_mobile", |
716 | 726 | .owner = THIS_MODULE, |
717 | 727 | .pm = &sh_mobile_i2c_dev_pm_ops, |
728 | + .of_match_table = sh_mobile_i2c_dt_ids, | |
718 | 729 | }, |
719 | 730 | .probe = sh_mobile_i2c_probe, |
720 | 731 | .remove = sh_mobile_i2c_remove, |