aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch')
-rw-r--r--meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch
new file mode 100644
index 0000000..716bdbc
--- /dev/null
+++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/0017-can-rcar_can-add-device-tree-support.patch
@@ -0,0 +1,77 @@
+From a268de6c68e4933234e9ac62f2ab7ff8264ce0b4 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Fri, 1 Aug 2014 01:25:53 +0400
+Subject: [PATCH] can: rcar_can: add device tree support
+
+Add support of the device tree probing for the Renesas R-Car CAN controllers.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ drivers/net/can/rcar_can.c | 28 ++++++++++++++++++++++------
+ 1 file changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c
+index c02fcf3..1abe133 100644
+--- a/drivers/net/can/rcar_can.c
++++ b/drivers/net/can/rcar_can.c
+@@ -20,6 +20,7 @@
+ #include <linux/can/dev.h>
+ #include <linux/clk.h>
+ #include <linux/can/platform/rcar_can.h>
++#include <linux/of.h>
+
+ #define RCAR_CAN_DRV_NAME "rcar_can"
+
+@@ -738,16 +739,21 @@ static int rcar_can_probe(struct platform_device *pdev)
+ struct net_device *ndev;
+ struct resource *mem;
+ void __iomem *addr;
+- u32 clock_select;
++ u32 clock_select = CLKR_CLKP1;
+ int err = -ENODEV;
+ int irq;
+
+- pdata = dev_get_platdata(&pdev->dev);
+- if (!pdata) {
+- dev_err(&pdev->dev, "No platform data provided!\n");
+- goto fail;
++ if (pdev->dev.of_node) {
++ of_property_read_u32(pdev->dev.of_node,
++ "renesas,can-clock-select", &clock_select);
++ } else {
++ pdata = dev_get_platdata(&pdev->dev);
++ if (!pdata) {
++ dev_err(&pdev->dev, "No platform data provided!\n");
++ goto fail;
++ }
++ clock_select = pdata->clock_select;
+ }
+- clock_select = pdata->clock_select;
+
+ irq = platform_get_irq(pdev, 0);
+ if (!irq) {
+@@ -888,10 +894,20 @@ static int __maybe_unused rcar_can_resume(struct device *dev)
+
+ static SIMPLE_DEV_PM_OPS(rcar_can_pm_ops, rcar_can_suspend, rcar_can_resume);
+
++static const struct of_device_id rcar_can_of_table[] __maybe_unused = {
++ { .compatible = "renesas,can-r8a7778" },
++ { .compatible = "renesas,can-r8a7779" },
++ { .compatible = "renesas,can-r8a7790" },
++ { .compatible = "renesas,can-r8a7791" },
++ { }
++};
++MODULE_DEVICE_TABLE(of, rcar_can_of_table);
++
+ static struct platform_driver rcar_can_driver = {
+ .driver = {
+ .name = RCAR_CAN_DRV_NAME,
+ .owner = THIS_MODULE,
++ .of_match_table = of_match_ptr(rcar_can_of_table),
+ .pm = &rcar_can_pm_ops,
+ },
+ .probe = rcar_can_probe,
+--
+1.9.1
+