diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-stu300.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index 0a6f941133f6..d1a6b204af00 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/of_i2c.h> | ||
20 | 21 | ||
21 | /* the name of this kernel module */ | 22 | /* the name of this kernel module */ |
22 | #define NAME "stu300" | 23 | #define NAME "stu300" |
@@ -867,7 +868,6 @@ stu300_probe(struct platform_device *pdev) | |||
867 | struct resource *res; | 868 | struct resource *res; |
868 | int bus_nr; | 869 | int bus_nr; |
869 | int ret = 0; | 870 | int ret = 0; |
870 | char clk_name[] = "I2C0"; | ||
871 | 871 | ||
872 | dev = devm_kzalloc(&pdev->dev, sizeof(struct stu300_dev), GFP_KERNEL); | 872 | dev = devm_kzalloc(&pdev->dev, sizeof(struct stu300_dev), GFP_KERNEL); |
873 | if (!dev) { | 873 | if (!dev) { |
@@ -876,8 +876,7 @@ stu300_probe(struct platform_device *pdev) | |||
876 | } | 876 | } |
877 | 877 | ||
878 | bus_nr = pdev->id; | 878 | bus_nr = pdev->id; |
879 | clk_name[3] += (char)bus_nr; | 879 | dev->clk = devm_clk_get(&pdev->dev, NULL); |
880 | dev->clk = devm_clk_get(&pdev->dev, clk_name); | ||
881 | if (IS_ERR(dev->clk)) { | 880 | if (IS_ERR(dev->clk)) { |
882 | dev_err(&pdev->dev, "could not retrieve i2c bus clock\n"); | 881 | dev_err(&pdev->dev, "could not retrieve i2c bus clock\n"); |
883 | return PTR_ERR(dev->clk); | 882 | return PTR_ERR(dev->clk); |
@@ -923,6 +922,7 @@ stu300_probe(struct platform_device *pdev) | |||
923 | adap->nr = bus_nr; | 922 | adap->nr = bus_nr; |
924 | adap->algo = &stu300_algo; | 923 | adap->algo = &stu300_algo; |
925 | adap->dev.parent = &pdev->dev; | 924 | adap->dev.parent = &pdev->dev; |
925 | adap->dev.of_node = pdev->dev.of_node; | ||
926 | i2c_set_adapdata(adap, dev); | 926 | i2c_set_adapdata(adap, dev); |
927 | 927 | ||
928 | /* i2c device drivers may be active on return from add_adapter() */ | 928 | /* i2c device drivers may be active on return from add_adapter() */ |
@@ -934,6 +934,10 @@ stu300_probe(struct platform_device *pdev) | |||
934 | } | 934 | } |
935 | 935 | ||
936 | platform_set_drvdata(pdev, dev); | 936 | platform_set_drvdata(pdev, dev); |
937 | dev_info(&pdev->dev, "ST DDC I2C @ %p, irq %d\n", | ||
938 | dev->virtbase, dev->irq); | ||
939 | of_i2c_register_devices(adap); | ||
940 | |||
937 | return 0; | 941 | return 0; |
938 | } | 942 | } |
939 | 943 | ||
@@ -978,11 +982,17 @@ stu300_remove(struct platform_device *pdev) | |||
978 | return 0; | 982 | return 0; |
979 | } | 983 | } |
980 | 984 | ||
985 | static const struct of_device_id stu300_dt_match[] = { | ||
986 | { .compatible = "st,ddci2c" }, | ||
987 | {}, | ||
988 | }; | ||
989 | |||
981 | static struct platform_driver stu300_i2c_driver = { | 990 | static struct platform_driver stu300_i2c_driver = { |
982 | .driver = { | 991 | .driver = { |
983 | .name = NAME, | 992 | .name = NAME, |
984 | .owner = THIS_MODULE, | 993 | .owner = THIS_MODULE, |
985 | .pm = STU300_I2C_PM, | 994 | .pm = STU300_I2C_PM, |
995 | .of_match_table = stu300_dt_match, | ||
986 | }, | 996 | }, |
987 | .remove = __exit_p(stu300_remove), | 997 | .remove = __exit_p(stu300_remove), |
988 | 998 | ||