Commit ad337074 authored by Magnus Damm's avatar Magnus Damm Committed by Wolfram Sang

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: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
parent 26f8d43d
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/of_i2c.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/clk.h> #include <linux/clk.h>
...@@ -653,6 +654,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) ...@@ -653,6 +654,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
adap->dev.parent = &dev->dev; adap->dev.parent = &dev->dev;
adap->retries = 5; adap->retries = 5;
adap->nr = dev->id; adap->nr = dev->id;
adap->dev.of_node = dev->dev.of_node;
strlcpy(adap->name, dev->name, sizeof(adap->name)); strlcpy(adap->name, dev->name, sizeof(adap->name));
...@@ -667,6 +669,8 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) ...@@ -667,6 +669,8 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n", dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
adap->nr, pd->bus_speed); adap->nr, pd->bus_speed);
of_i2c_register_devices(adap);
return 0; return 0;
err_all: err_all:
...@@ -710,11 +714,18 @@ static const struct dev_pm_ops sh_mobile_i2c_dev_pm_ops = { ...@@ -710,11 +714,18 @@ static const struct dev_pm_ops sh_mobile_i2c_dev_pm_ops = {
.runtime_resume = sh_mobile_i2c_runtime_nop, .runtime_resume = sh_mobile_i2c_runtime_nop,
}; };
static const struct of_device_id sh_mobile_i2c_dt_ids[] __devinitconst = {
{ .compatible = "renesas,rmobile-iic", },
{},
};
MODULE_DEVICE_TABLE(of, sh_mobile_i2c_dt_ids);
static struct platform_driver sh_mobile_i2c_driver = { static struct platform_driver sh_mobile_i2c_driver = {
.driver = { .driver = {
.name = "i2c-sh_mobile", .name = "i2c-sh_mobile",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &sh_mobile_i2c_dev_pm_ops, .pm = &sh_mobile_i2c_dev_pm_ops,
.of_match_table = sh_mobile_i2c_dt_ids,
}, },
.probe = sh_mobile_i2c_probe, .probe = sh_mobile_i2c_probe,
.remove = sh_mobile_i2c_remove, .remove = sh_mobile_i2c_remove,
......
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