Skip to contentSkip to conversation

dt and pinctrl support for at91_can

PATCH Superseded ludovic.desroches at atmel.com 4 participants 20 messages Mar 8, 2013 – Mar 11, 2013 3 messages not in the archive

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover dt and pinctrl support for at91_can

From: Ludovic Desroches <[email protected]>

Hi,

This set of patches add device tree and pinctrl support to the at91_can driver.

Regards

Ludovic Desroches (3):
can: at91_can: add dt support
can: at91_can: add pinctrl support
can: Kconfig: CAN_AT91 depends on ARCH_AT91

 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/Kconfig                            |  2 +-
 drivers/net/can/at91_can.c                         | 84 +++++++++++++++++-----
 3 files changed, 80 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Signature · 1 line
1.7.11.3
#1 lore raw

PATCH 1/3 can: at91_can: add dt support

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +14 -0
new file mode 100644
index 0000000..69381db
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"
+  - reg: Should contain RTC registers location and length
+  - interrupts: Should contain IRQ line for the CAN controller
+
+Example:
+
+	can0: can at f000c000 {
+		compatbile = "atmel,at91sam9x5-can";
+		reg = <0xf000c000 0x300>;
+		interrupts = <40 4 5>
+	};
drivers/net/can/at91_can.c +56 -19

122 lines not on this page · raw message

Signature · 1 line
1.7.11.3
#2 lore raw

PATCH 1/3 can: at91_can: add dt support

Quoted 17 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +0 -0
new file mode 100644
index 0000000..69381db

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

Documentation/devicetree/bindings/net/can/atmel-can.txt line 5

Quoted 1 line
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +1 -0
+  - reg: Should contain RTC registers location and length

RTC?

Quoted 34 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +9 -0
+  - interrupts: Should contain IRQ line for the CAN controller
+
+Example:
+
+	can0: can at f000c000 {
+		compatbile = "atmel,at91sam9x5-can";
+		reg = <0xf000c000 0x300>;
+		interrupts = <40 4 5>
+	};
drivers/net/can/at91_can.c +1 -9
index 44f3637..c7f70d4 100644
@@ -27,6 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -155,19 +156,20 @@ struct at91_priv {
 	canid_t mb0_id;
 };
 
-static const struct at91_devtype_data at91_devtype_data[] = {
-	[AT91_DEVTYPE_SAM9263] = {
-		.rx_first = 1,
-		.rx_split = 8,
-		.rx_last = 11,
-		.tx_shift = 2,
-	},
-	[AT91_DEVTYPE_SAM9X5] = {
-		.rx_first = 0,

drivers/net/can/at91_can.c struct at91_priv { · line 164

Quoted 10 lines
drivers/net/can/at91_can.c +6 -4
-		.rx_split = 4,
-		.rx_last = 5,
-		.tx_shift = 1,
-	},
+static struct at91_devtype_data at91_at91sam9263_data = {
+	.rx_first = 1,
+	.rx_split = 8,
+	.rx_last = 11,
+	.tx_shift = 2,
+	.type = AT91_DEVTYPE_SAM9263

nitpick:
can you add a trailing ","

drivers/net/can/at91_can.c struct at91_priv { · line 172

Quoted 8 lines
drivers/net/can/at91_can.c +8 -0
+};
+
+static struct at91_devtype_data at91_at91sam9x5_data = {
+	.rx_first = 0,
+	.rx_split = 4,
+	.rx_last = 5,
+	.tx_shift = 1,
+	.type = AT91_DEVTYPE_SAM9X5

dito

Quoted 16 lines
drivers/net/can/at91_can.c +9 -0
 };
 
 static const struct can_bittiming_const at91_bittiming_const = {
@@ -1249,10 +1251,41 @@ static struct attribute_group at91_sysfs_attr_group = {
 	.attrs = at91_sysfs_attrs,
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id at91_can_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9x5-can",
+		.data = &at91_at91sam9x5_data,
+	}, {
+		.compatible = "atmel,at91sam9263-can",
+		.data = &at91_at91sam9263_data,
+	}, {

drivers/net/can/at91_can.c static struct attribute_group at91_sysfs_attr_group = { · line 1272

Quoted 10 lines
drivers/net/can/at91_can.c +10 -0
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(of, at91_can_dt_ids);
+#else
+#define at91_can_dt_ids NULL
+#endif
+
+static struct at91_devtype_data* at91_can_get_driver_data(
+						struct platform_device *pdev)

I think it's okay to put this into one line.

Quoted 57 lines
drivers/net/can/at91_can.c +21 -6
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(at91_can_dt_ids, pdev->dev.of_node);
+		if (!match) {
+			dev_err(&pdev->dev, "no matching node found in dtb\n");
+			return NULL;
+		}
+		return (struct at91_devtype_data *)match->data;
+	}
+	return (struct at91_devtype_data *)platform_get_device_id(pdev)->driver_data;
+}
+
 static int at91_can_probe(struct platform_device *pdev)
 {
 	const struct at91_devtype_data *devtype_data;
-	enum at91_devtype devtype;
 	struct net_device *dev;
 	struct at91_priv *priv;
 	struct resource *res;
@@ -1260,8 +1293,12 @@ static int at91_can_probe(struct platform_device *pdev)
 	void __iomem *addr;
 	int err, irq;
 
-	devtype = pdev->id_entry->driver_data;
-	devtype_data = &at91_devtype_data[devtype];
+	devtype_data = at91_can_get_driver_data(pdev);
+	if (!devtype_data) {
+		dev_err(&pdev->dev, "no driver data\n");
+		err = -ENODEV;
+		goto exit;
+	}
 
 	clk = clk_get(&pdev->dev, "can_clk");
 	if (IS_ERR(clk)) {
@@ -1310,7 +1347,6 @@ static int at91_can_probe(struct platform_device *pdev)
 	priv->dev = dev;
 	priv->reg_base = addr;
 	priv->devtype_data = *devtype_data;
-	priv->devtype_data.type = devtype;
 	priv->clk = clk;
 	priv->pdata = pdev->dev.platform_data;
 	priv->mb0_id = 0x7ff;
@@ -1373,10 +1409,10 @@ static int at91_can_remove(struct platform_device *pdev)
 static const struct platform_device_id at91_can_id_table[] = {
 	{
 		.name = "at91_can",
-		.driver_data = AT91_DEVTYPE_SAM9263,
+		.driver_data = (unsigned long)&at91_at91sam9x5_data,
 	}, {
 		.name = "at91sam9x5_can",
-		.driver_data = AT91_DEVTYPE_SAM9X5,
+		.driver_data = (unsigned long)&at91_at91sam9263_data,
 	}, {
 		/* sentinel */
 	}

drivers/net/can/at91_can.c static struct platform_driver at91_can_driver = { · line 1431

Quoted 7 lines
drivers/net/can/at91_can.c +1 -0
@@ -1389,6 +1425,7 @@ static struct platform_driver at91_can_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.owner = THIS_MODULE,
+		.of_match_table = at91_can_dt_ids,
 	},
 	.id_table = at91_can_id_table,
 };

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130308/604f086e/attachment.sig>
#3 lore raw

PATCH 1/3 can: at91_can: add dt support

Quoted 12 lines · Marc Kleine-Budde
Quoted 11 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Quoted 14 lines

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
new file mode 100644
index 0000000..69381db
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

We are using the same strategy.

Quoted 4 lines

Documentation/devicetree/bindings/net/can/atmel-can.txt line 5

Quoted 1 line
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +1 -0
+  - reg: Should contain RTC registers location and length

RTC?

My mistake, I'll correct that, bad copy-paste.

Quoted 48 lines
Quoted 34 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +9 -0
+  - interrupts: Should contain IRQ line for the CAN controller
+
+Example:
+
+	can0: can at f000c000 {
+		compatbile = "atmel,at91sam9x5-can";
+		reg = <0xf000c000 0x300>;
+		interrupts = <40 4 5>
+	};
drivers/net/can/at91_can.c +1 -9
index 44f3637..c7f70d4 100644
@@ -27,6 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -155,19 +156,20 @@ struct at91_priv {
 	canid_t mb0_id;
 };
 
-static const struct at91_devtype_data at91_devtype_data[] = {
-	[AT91_DEVTYPE_SAM9263] = {
-		.rx_first = 1,
-		.rx_split = 8,
-		.rx_last = 11,
-		.tx_shift = 2,
-	},
-	[AT91_DEVTYPE_SAM9X5] = {
-		.rx_first = 0,

drivers/net/can/at91_can.c struct at91_priv { · line 164

Quoted 10 lines
drivers/net/can/at91_can.c +6 -4
-		.rx_split = 4,
-		.rx_last = 5,
-		.tx_shift = 1,
-	},
+static struct at91_devtype_data at91_at91sam9263_data = {
+	.rx_first = 1,
+	.rx_split = 8,
+	.rx_last = 11,
+	.tx_shift = 2,
+	.type = AT91_DEVTYPE_SAM9263

nitpick:
can you add a trailing ","

Quoted 11 lines

drivers/net/can/at91_can.c struct at91_priv { · line 172

Quoted 8 lines
drivers/net/can/at91_can.c +8 -0
+};
+
+static struct at91_devtype_data at91_at91sam9x5_data = {
+	.rx_first = 0,
+	.rx_split = 4,
+	.rx_last = 5,
+	.tx_shift = 1,
+	.type = AT91_DEVTYPE_SAM9X5

dito

ok

Quoted 20 lines
Quoted 20 lines
drivers/net/can/at91_can.c +13 -0
 };
 
 static const struct can_bittiming_const at91_bittiming_const = {
@@ -1249,10 +1251,41 @@ static struct attribute_group at91_sysfs_attr_group = {
 	.attrs = at91_sysfs_attrs,
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id at91_can_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9x5-can",
+		.data = &at91_at91sam9x5_data,
+	}, {
+		.compatible = "atmel,at91sam9263-can",
+		.data = &at91_at91sam9263_data,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(of, at91_can_dt_ids);
Quoted 9 lines

drivers/net/can/at91_can.c static struct attribute_group at91_sysfs_attr_group = { · line 1272

Quoted 6 lines
drivers/net/can/at91_can.c +6 -0
+#else
+#define at91_can_dt_ids NULL
+#endif
+
+static struct at91_devtype_data* at91_can_get_driver_data(
+						struct platform_device *pdev)

I think it's okay to put this into one line.

ok

Quoted 58 lines
Quoted 58 lines
drivers/net/can/at91_can.c +21 -6
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(at91_can_dt_ids, pdev->dev.of_node);
+		if (!match) {
+			dev_err(&pdev->dev, "no matching node found in dtb\n");
+			return NULL;
+		}
+		return (struct at91_devtype_data *)match->data;
+	}
+	return (struct at91_devtype_data *)platform_get_device_id(pdev)->driver_data;
+}
+
 static int at91_can_probe(struct platform_device *pdev)
 {
 	const struct at91_devtype_data *devtype_data;
-	enum at91_devtype devtype;
 	struct net_device *dev;
 	struct at91_priv *priv;
 	struct resource *res;
@@ -1260,8 +1293,12 @@ static int at91_can_probe(struct platform_device *pdev)
 	void __iomem *addr;
 	int err, irq;
 
-	devtype = pdev->id_entry->driver_data;
-	devtype_data = &at91_devtype_data[devtype];
+	devtype_data = at91_can_get_driver_data(pdev);
+	if (!devtype_data) {
+		dev_err(&pdev->dev, "no driver data\n");
+		err = -ENODEV;
+		goto exit;
+	}
 
 	clk = clk_get(&pdev->dev, "can_clk");
 	if (IS_ERR(clk)) {
@@ -1310,7 +1347,6 @@ static int at91_can_probe(struct platform_device *pdev)
 	priv->dev = dev;
 	priv->reg_base = addr;
 	priv->devtype_data = *devtype_data;
-	priv->devtype_data.type = devtype;
 	priv->clk = clk;
 	priv->pdata = pdev->dev.platform_data;
 	priv->mb0_id = 0x7ff;
@@ -1373,10 +1409,10 @@ static int at91_can_remove(struct platform_device *pdev)
 static const struct platform_device_id at91_can_id_table[] = {
 	{
 		.name = "at91_can",
-		.driver_data = AT91_DEVTYPE_SAM9263,
+		.driver_data = (unsigned long)&at91_at91sam9x5_data,
 	}, {
 		.name = "at91sam9x5_can",
-		.driver_data = AT91_DEVTYPE_SAM9X5,
+		.driver_data = (unsigned long)&at91_at91sam9263_data,
 	}, {
 		/* sentinel */
 	}
@@ -1389,6 +1425,7 @@ static struct platform_driver at91_can_driver = {
 	.driver = {
Quoted 8 lines

drivers/net/can/at91_can.c static struct platform_driver at91_can_driver = { · line 1431

Quoted 6 lines
drivers/net/can/at91_can.c +1 -0
 		.name = KBUILD_MODNAME,
 		.owner = THIS_MODULE,
+		.of_match_table = at91_can_dt_ids,
 	},
 	.id_table = at91_can_id_table,
 };

Marc

Thanks for your feedback

Regards

Ludovic

#4 lore raw

PATCH 1/3 can: at91_can: add dt support

Quoted 28 lines · Ludovic Desroches
Quoted 12 lines · Marc Kleine-Budde
Quoted 11 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Quoted 14 lines

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
new file mode 100644
index 0000000..69381db
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

Quoted 1 line

We are using the same strategy.

But "atmel,at91sam9x5-can" isn't a specific SoC, probably a SoC family. Or are you using "atmel,at91sam9x5-can" for the other devices in the DT, too.

I picked at91sam9x5-can for the non devicetree driver out of the blue, as there was no scheme established, yet. I'm not hanging on that name, I'd rather appreciate to follow the common at91 DT rules.

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130311/66c8e834/attachment.sig>
#5 lore raw

PATCH 1/3 can: at91_can: add dt support

Quoted 29 lines · Marc Kleine-Budde
Quoted 28 lines · Ludovic Desroches
Quoted 26 lines · Marc Kleine-Budde
Quoted 17 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +0 -0
new file mode 100644
index 0000000..69381db

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

Quoted 6 lines
Quoted 1 line

We are using the same strategy.

But "atmel,at91sam9x5-can" isn't a specific SoC, probably a SoC family. Or are you using "atmel,at91sam9x5-can" for the other devices in the DT, too.

You are right at91sam9x5 is not a specific SoC but a family of SoCs:
at91sam9g25, at91sam9g35, at91sam9x25 and at91sam9x35. This compatible string is used for all the devices from and after the at91sam9x5 family: at91sam9n12, samad3x, etc.

Quoted 3 lines

I picked at91sam9x5-can for the non devicetree driver out of the blue, as there was no scheme established, yet. I'm not hanging on that name, I'd rather appreciate to follow the common at91 DT rules.

It follows at91 Dt rules, we have atmel,at91sam9x5-i2c, atmel,at91sam9x5-gpio and others.

Regards

Ludovic

#6 lore raw

PATCH 1/3 can: at91_can: add dt support

Quoted 42 lines · Ludovic Desroches
Quoted 29 lines · Marc Kleine-Budde
Quoted 28 lines · Ludovic Desroches
Quoted 26 lines · Marc Kleine-Budde
Quoted 17 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +0 -0
new file mode 100644
index 0000000..69381db

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

Quoted 6 lines
Quoted 1 line

We are using the same strategy.

But "atmel,at91sam9x5-can" isn't a specific SoC, probably a SoC family. Or are you using "atmel,at91sam9x5-can" for the other devices in the DT, too.

You are right at91sam9x5 is not a specific SoC but a family of SoCs:
at91sam9g25, at91sam9g35, at91sam9x25 and at91sam9x35. This compatible string is used for all the devices from and after the at91sam9x5 family: at91sam9n12, samad3x, etc.

Quoted 6 lines
Quoted 3 lines

I picked at91sam9x5-can for the non devicetree driver out of the blue, as there was no scheme established, yet. I'm not hanging on that name, I'd rather appreciate to follow the common at91 DT rules.

It follows at91 Dt rules, we have atmel,at91sam9x5-i2c, atmel,at91sam9x5-gpio and others.

That's okay then, just wanted to clarify this. Can you send a v2, then I'll apply the patches.

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130311/abe11a34/attachment.sig>
#7 lore raw

Re: [PATCH 1/3] can: at91_can: add dt support

In reply to Marc Kleine-Budde
Quoted 29 lines · Marc Kleine-Budde
Quoted 28 lines · Ludovic Desroches
Quoted 26 lines · Marc Kleine-Budde
Quoted 17 lines · On 03/08/2013 06:30 PM, [email protected] wrote:

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +0 -0
new file mode 100644
index 0000000..69381db

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

Quoted 6 lines
Quoted 1 line

We are using the same strategy.

But "atmel,at91sam9x5-can" isn't a specific SoC, probably a SoC family. Or are you using "atmel,at91sam9x5-can" for the other devices in the DT, too.

You are right at91sam9x5 is not a specific SoC but a family of SoCs:
at91sam9g25, at91sam9g35, at91sam9x25 and at91sam9x35. This compatible string is used for all the devices from and after the at91sam9x5 family: at91sam9n12, samad3x, etc.

Quoted 3 lines

I picked at91sam9x5-can for the non devicetree driver out of the blue, as there was no scheme established, yet. I'm not hanging on that name, I'd rather appreciate to follow the common at91 DT rules.

It follows at91 Dt rules, we have atmel,at91sam9x5-i2c, atmel,at91sam9x5-gpio and others.

Regards

Ludovic

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH 1/3] can: at91_can: add dt support

Quoted 29 lines · Marc Kleine-Budde
Quoted 28 lines · Ludovic Desroches
Quoted 26 lines · Marc Kleine-Budde
Quoted 17 lines · On 03/08/2013 06:30 PM, [email protected]…

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +0 -0
new file mode 100644
index 0000000..69381db

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

Quoted 6 lines
Quoted 1 line

We are using the same strategy.

But "atmel,at91sam9x5-can" isn't a specific SoC, probably a SoC family. Or are you using "atmel,at91sam9x5-can" for the other devices in the DT, too.

You are right at91sam9x5 is not a specific SoC but a family of SoCs:
at91sam9g25, at91sam9g35, at91sam9x25 and at91sam9x35. This compatible string is used for all the devices from and after the at91sam9x5 family: at91sam9n12, samad3x, etc.

Quoted 3 lines

I picked at91sam9x5-can for the non devicetree driver out of the blue, as there was no scheme established, yet. I'm not hanging on that name, I'd rather appreciate to follow the common at91 DT rules.

It follows at91 Dt rules, we have atmel,at91sam9x5-i2c, atmel,at91sam9x5-gpio and others.

Regards

Ludovic

#10 lore raw

Re: [PATCH 1/3] can: at91_can: add dt support

In reply to Marc Kleine-Budde
Quoted 12 lines · Marc Kleine-Budde
Quoted 11 lines · On 03/08/2013 06:30 PM, [email protected] wrote:

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Quoted 14 lines

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
new file mode 100644
index 0000000..69381db
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

We are using the same strategy.

Quoted 4 lines

Documentation/devicetree/bindings/net/can/atmel-can.txt line 5

Quoted 1 line
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +1 -0
+  - reg: Should contain RTC registers location and length

RTC?

My mistake, I'll correct that, bad copy-paste.

Quoted 48 lines
Quoted 34 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +9 -0
+  - interrupts: Should contain IRQ line for the CAN controller
+
+Example:
+
+	can0: can@f000c000 {
+		compatbile = "atmel,at91sam9x5-can";
+		reg = <0xf000c000 0x300>;
+		interrupts = <40 4 5>
+	};
drivers/net/can/at91_can.c +1 -9
index 44f3637..c7f70d4 100644
@@ -27,6 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -155,19 +156,20 @@ struct at91_priv {
 	canid_t mb0_id;
 };
 
-static const struct at91_devtype_data at91_devtype_data[] = {
-	[AT91_DEVTYPE_SAM9263] = {
-		.rx_first = 1,
-		.rx_split = 8,
-		.rx_last = 11,
-		.tx_shift = 2,
-	},
-	[AT91_DEVTYPE_SAM9X5] = {
-		.rx_first = 0,

drivers/net/can/at91_can.c struct at91_priv { · line 164

Quoted 10 lines
drivers/net/can/at91_can.c +6 -4
-		.rx_split = 4,
-		.rx_last = 5,
-		.tx_shift = 1,
-	},
+static struct at91_devtype_data at91_at91sam9263_data = {
+	.rx_first = 1,
+	.rx_split = 8,
+	.rx_last = 11,
+	.tx_shift = 2,
+	.type = AT91_DEVTYPE_SAM9263

nitpick:
can you add a trailing ","

Quoted 11 lines

drivers/net/can/at91_can.c struct at91_priv { · line 172

Quoted 8 lines
drivers/net/can/at91_can.c +8 -0
+};
+
+static struct at91_devtype_data at91_at91sam9x5_data = {
+	.rx_first = 0,
+	.rx_split = 4,
+	.rx_last = 5,
+	.tx_shift = 1,
+	.type = AT91_DEVTYPE_SAM9X5

dito

ok

Quoted 20 lines
Quoted 20 lines
drivers/net/can/at91_can.c +13 -0
 };
 
 static const struct can_bittiming_const at91_bittiming_const = {
@@ -1249,10 +1251,41 @@ static struct attribute_group at91_sysfs_attr_group = {
 	.attrs = at91_sysfs_attrs,
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id at91_can_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9x5-can",
+		.data = &at91_at91sam9x5_data,
+	}, {
+		.compatible = "atmel,at91sam9263-can",
+		.data = &at91_at91sam9263_data,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(of, at91_can_dt_ids);
Quoted 9 lines

drivers/net/can/at91_can.c static struct attribute_group at91_sysfs_attr_group = { · line 1272

Quoted 6 lines
drivers/net/can/at91_can.c +6 -0
+#else
+#define at91_can_dt_ids NULL
+#endif
+
+static struct at91_devtype_data* at91_can_get_driver_data(
+						struct platform_device *pdev)

I think it's okay to put this into one line.

ok

Quoted 58 lines
Quoted 58 lines
drivers/net/can/at91_can.c +21 -6
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(at91_can_dt_ids, pdev->dev.of_node);
+		if (!match) {
+			dev_err(&pdev->dev, "no matching node found in dtb\n");
+			return NULL;
+		}
+		return (struct at91_devtype_data *)match->data;
+	}
+	return (struct at91_devtype_data *)platform_get_device_id(pdev)->driver_data;
+}
+
 static int at91_can_probe(struct platform_device *pdev)
 {
 	const struct at91_devtype_data *devtype_data;
-	enum at91_devtype devtype;
 	struct net_device *dev;
 	struct at91_priv *priv;
 	struct resource *res;
@@ -1260,8 +1293,12 @@ static int at91_can_probe(struct platform_device *pdev)
 	void __iomem *addr;
 	int err, irq;
 
-	devtype = pdev->id_entry->driver_data;
-	devtype_data = &at91_devtype_data[devtype];
+	devtype_data = at91_can_get_driver_data(pdev);
+	if (!devtype_data) {
+		dev_err(&pdev->dev, "no driver data\n");
+		err = -ENODEV;
+		goto exit;
+	}
 
 	clk = clk_get(&pdev->dev, "can_clk");
 	if (IS_ERR(clk)) {
@@ -1310,7 +1347,6 @@ static int at91_can_probe(struct platform_device *pdev)
 	priv->dev = dev;
 	priv->reg_base = addr;
 	priv->devtype_data = *devtype_data;
-	priv->devtype_data.type = devtype;
 	priv->clk = clk;
 	priv->pdata = pdev->dev.platform_data;
 	priv->mb0_id = 0x7ff;
@@ -1373,10 +1409,10 @@ static int at91_can_remove(struct platform_device *pdev)
 static const struct platform_device_id at91_can_id_table[] = {
 	{
 		.name = "at91_can",
-		.driver_data = AT91_DEVTYPE_SAM9263,
+		.driver_data = (unsigned long)&at91_at91sam9x5_data,
 	}, {
 		.name = "at91sam9x5_can",
-		.driver_data = AT91_DEVTYPE_SAM9X5,
+		.driver_data = (unsigned long)&at91_at91sam9263_data,
 	}, {
 		/* sentinel */
 	}
@@ -1389,6 +1425,7 @@ static struct platform_driver at91_can_driver = {
 	.driver = {
Quoted 8 lines

drivers/net/can/at91_can.c static struct platform_driver at91_can_driver = { · line 1431

Quoted 6 lines
drivers/net/can/at91_can.c +1 -0
 		.name = KBUILD_MODNAME,
 		.owner = THIS_MODULE,
+		.of_match_table = at91_can_dt_ids,
 	},
 	.id_table = at91_can_id_table,
 };

Marc

Thanks for your feedback

Regards

Ludovic

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [PATCH 1/3] can: at91_can: add dt support

Quoted 12 lines · Marc Kleine-Budde
Quoted 11 lines · On 03/08/2013 06:30 PM, [email protected]…

From: Ludovic Desroches <[email protected]>

Add device tree support.

---
 .../devicetree/bindings/net/can/atmel-can.txt      | 14 ++++
 drivers/net/can/at91_can.c                         | 75 ++++++++++++++++------
 2 files changed, 70 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/atmel-can.txt
Quoted 14 lines

Documentation/devicetree/bindings/net/can/atmel-can.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +4 -0
new file mode 100644
index 0000000..69381db
@@ -0,0 +1,14 @@
+* AT91 CAN *
+
+Required properties:
+  - compatible: Should be "atmel,at91sam9263-can" or "atmel,at91sam9x5-can"

On imx we use the oldest SoC with that IP available. Which strategy are you following on at91?

We are using the same strategy.

Quoted 4 lines

Documentation/devicetree/bindings/net/can/atmel-can.txt line 5

Quoted 1 line
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +1 -0
+  - reg: Should contain RTC registers location and length

RTC?

My mistake, I'll correct that, bad copy-paste.

Quoted 48 lines
Quoted 34 lines
Documentation/devicetree/bindings/net/can/atmel-can.txt new file +9 -0
+  - interrupts: Should contain IRQ line for the CAN controller
+
+Example:
+
+	can0: can@f000c000 {
+		compatbile = "atmel,at91sam9x5-can";
+		reg = <0xf000c000 0x300>;
+		interrupts = <40 4 5>
+	};
drivers/net/can/at91_can.c +1 -9
index 44f3637..c7f70d4 100644
@@ -27,6 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -155,19 +156,20 @@ struct at91_priv {
 	canid_t mb0_id;
 };
 
-static const struct at91_devtype_data at91_devtype_data[] = {
-	[AT91_DEVTYPE_SAM9263] = {
-		.rx_first = 1,
-		.rx_split = 8,
-		.rx_last = 11,
-		.tx_shift = 2,
-	},
-	[AT91_DEVTYPE_SAM9X5] = {
-		.rx_first = 0,

drivers/net/can/at91_can.c struct at91_priv { · line 164

Quoted 10 lines
drivers/net/can/at91_can.c +6 -4
-		.rx_split = 4,
-		.rx_last = 5,
-		.tx_shift = 1,
-	},
+static struct at91_devtype_data at91_at91sam9263_data = {
+	.rx_first = 1,
+	.rx_split = 8,
+	.rx_last = 11,
+	.tx_shift = 2,
+	.type = AT91_DEVTYPE_SAM9263

nitpick:
can you add a trailing ","

Quoted 11 lines

drivers/net/can/at91_can.c struct at91_priv { · line 172

Quoted 8 lines
drivers/net/can/at91_can.c +8 -0
+};
+
+static struct at91_devtype_data at91_at91sam9x5_data = {
+	.rx_first = 0,
+	.rx_split = 4,
+	.rx_last = 5,
+	.tx_shift = 1,
+	.type = AT91_DEVTYPE_SAM9X5

dito

ok

Quoted 20 lines
Quoted 20 lines
drivers/net/can/at91_can.c +13 -0
 };
 
 static const struct can_bittiming_const at91_bittiming_const = {
@@ -1249,10 +1251,41 @@ static struct attribute_group at91_sysfs_attr_group = {
 	.attrs = at91_sysfs_attrs,
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id at91_can_dt_ids[] = {
+	{
+		.compatible = "atmel,at91sam9x5-can",
+		.data = &at91_at91sam9x5_data,
+	}, {
+		.compatible = "atmel,at91sam9263-can",
+		.data = &at91_at91sam9263_data,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(of, at91_can_dt_ids);
Quoted 9 lines

drivers/net/can/at91_can.c static struct attribute_group at91_sysfs_attr_group = { · line 1272

Quoted 6 lines
drivers/net/can/at91_can.c +6 -0
+#else
+#define at91_can_dt_ids NULL
+#endif
+
+static struct at91_devtype_data* at91_can_get_driver_data(
+						struct platform_device *pdev)

I think it's okay to put this into one line.

ok

Quoted 58 lines
Quoted 58 lines
drivers/net/can/at91_can.c +21 -6
+{
+	if (pdev->dev.of_node) {
+		const struct of_device_id *match;
+		match = of_match_node(at91_can_dt_ids, pdev->dev.of_node);
+		if (!match) {
+			dev_err(&pdev->dev, "no matching node found in dtb\n");
+			return NULL;
+		}
+		return (struct at91_devtype_data *)match->data;
+	}
+	return (struct at91_devtype_data *)platform_get_device_id(pdev)->driver_data;
+}
+
 static int at91_can_probe(struct platform_device *pdev)
 {
 	const struct at91_devtype_data *devtype_data;
-	enum at91_devtype devtype;
 	struct net_device *dev;
 	struct at91_priv *priv;
 	struct resource *res;
@@ -1260,8 +1293,12 @@ static int at91_can_probe(struct platform_device *pdev)
 	void __iomem *addr;
 	int err, irq;
 
-	devtype = pdev->id_entry->driver_data;
-	devtype_data = &at91_devtype_data[devtype];
+	devtype_data = at91_can_get_driver_data(pdev);
+	if (!devtype_data) {
+		dev_err(&pdev->dev, "no driver data\n");
+		err = -ENODEV;
+		goto exit;
+	}
 
 	clk = clk_get(&pdev->dev, "can_clk");
 	if (IS_ERR(clk)) {
@@ -1310,7 +1347,6 @@ static int at91_can_probe(struct platform_device *pdev)
 	priv->dev = dev;
 	priv->reg_base = addr;
 	priv->devtype_data = *devtype_data;
-	priv->devtype_data.type = devtype;
 	priv->clk = clk;
 	priv->pdata = pdev->dev.platform_data;
 	priv->mb0_id = 0x7ff;
@@ -1373,10 +1409,10 @@ static int at91_can_remove(struct platform_device *pdev)
 static const struct platform_device_id at91_can_id_table[] = {
 	{
 		.name = "at91_can",
-		.driver_data = AT91_DEVTYPE_SAM9263,
+		.driver_data = (unsigned long)&at91_at91sam9x5_data,
 	}, {
 		.name = "at91sam9x5_can",
-		.driver_data = AT91_DEVTYPE_SAM9X5,
+		.driver_data = (unsigned long)&at91_at91sam9263_data,
 	}, {
 		/* sentinel */
 	}
@@ -1389,6 +1425,7 @@ static struct platform_driver at91_can_driver = {
 	.driver = {
Quoted 8 lines

drivers/net/can/at91_can.c static struct platform_driver at91_can_driver = { · line 1431

Quoted 6 lines
drivers/net/can/at91_can.c +1 -0
 		.name = KBUILD_MODNAME,
 		.owner = THIS_MODULE,
+		.of_match_table = at91_can_dt_ids,
 	},
 	.id_table = at91_can_id_table,
 };

Marc

Thanks for your feedback

Regards

Ludovic

#13 lore raw

PATCH 2/3 can: at91_can: add pinctrl support

In reply to ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

---
 drivers/net/can/at91_can.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/can/at91_can.c +9 -0
index c7f70d4..56fb2aa 100644
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -1292,6 +1293,7 @@ static int at91_can_probe(struct platform_device *pdev)
 	struct clk *clk;
 	void __iomem *addr;
 	int err, irq;
+	struct pinctrl *pinctrl;
 
 	devtype_data = at91_can_get_driver_data(pdev);
 	if (!devtype_data) {
@@ -1314,6 +1316,13 @@ static int at91_can_probe(struct platform_device *pdev)
 		goto exit_put;
 	}
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		dev_err(&pdev->dev, "Failed to request pinctrl\n");
+		err = PTR_ERR(pinctrl);
+		goto exit_put;
+	}
+
 	if (!request_mem_region(res->start,
 				resource_size(res),
 				pdev->name)) {
Signature · 1 line
1.7.11.3
#14 lore raw

PATCH 2/3 can: at91_can: add pinctrl support

Quoted 28 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

---
 drivers/net/can/at91_can.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/can/at91_can.c +2 -0
index c7f70d4..56fb2aa 100644
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -1292,6 +1293,7 @@ static int at91_can_probe(struct platform_device *pdev)
 	struct clk *clk;
 	void __iomem *addr;
 	int err, irq;
+	struct pinctrl *pinctrl;
 
 	devtype_data = at91_can_get_driver_data(pdev);
 	if (!devtype_data) {

drivers/net/can/at91_can.c static int at91_can_probe(struct platform_device *pdev) · line 1319

Quoted 4 lines
drivers/net/can/at91_can.c +1 -0
@@ -1314,6 +1316,13 @@ static int at91_can_probe(struct platform_device *pdev)
 		goto exit_put;
 	}
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);

Is this still needed? I think the pinctrl framework automatically enables the default pinctrl for a device if available.

Marc

Quoted 10 lines
drivers/net/can/at91_can.c +6 -0
+	if (IS_ERR(pinctrl)) {
+		dev_err(&pdev->dev, "Failed to request pinctrl\n");
+		err = PTR_ERR(pinctrl);
+		goto exit_put;
+	}
+
 	if (!request_mem_region(res->start,
 				resource_size(res),
 				pdev->name)) {
Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130308/43b96b2f/attachment.sig>
#15 lore raw

PATCH 2/3 can: at91_can: add pinctrl support

Quoted 32 lines · Marc Kleine-Budde
Quoted 31 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

---
 drivers/net/can/at91_can.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/can/at91_can.c +2 -0
index c7f70d4..56fb2aa 100644
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/of.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
@@ -1292,6 +1293,7 @@ static int at91_can_probe(struct platform_device *pdev)
 	struct clk *clk;
 	void __iomem *addr;
 	int err, irq;
+	struct pinctrl *pinctrl;
 
 	devtype_data = at91_can_get_driver_data(pdev);
 	if (!devtype_data) {
@@ -1314,6 +1316,13 @@ static int at91_can_probe(struct platform_device *pdev)
 		goto exit_put;
 	}
 
Quoted 4 lines

drivers/net/can/at91_can.c static int at91_can_probe(struct platform_device *pdev) · line 1319

Quoted 1 line
drivers/net/can/at91_can.c +1 -0
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);

Is this still needed? I think the pinctrl framework automatically enables the default pinctrl for a device if available.

yes this is useless

Best Regards,
J.

Quoted 21 lines

Marc

Quoted 10 lines
drivers/net/can/at91_can.c +6 -0
+	if (IS_ERR(pinctrl)) {
+		dev_err(&pdev->dev, "Failed to request pinctrl\n");
+		err = PTR_ERR(pinctrl);
+		goto exit_put;
+	}
+
 	if (!request_mem_region(res->start,
 				resource_size(res),
 				pdev->name)) {
Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#16 lore raw

PATCH 3/3 can: Kconfig: CAN_AT91 depends on ARCH_AT91

In reply to ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

SAMA5D3 devices also embed CAN feature. Moreover if we want to produce a single kernel image (at least for Atmel devices) it is not useful to be too restrictive.

---
 drivers/net/can/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/Kconfig +1 -1
index 9862b2e..27311c3 100644
@@ -65,7 +65,7 @@ config CAN_LEDS
 
 config CAN_AT91
 	tristate "Atmel AT91 onchip CAN controller"
-	depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9X5
+	depends on ARCH_AT91
 	---help---
 	  This is a driver for the SoC CAN controller in Atmel's AT91SAM9263
 	  and AT91SAM9X5 processors.
Signature · 1 line
1.7.11.3
#17 lore raw

PATCH 3/3 can: Kconfig: CAN_AT91 depends on ARCH_AT91

Quoted 5 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

SAMA5D3 devices also embed CAN feature. Moreover if we want to produce a single kernel image (at least for Atmel devices) it is not useful to be too restrictive.

If it compiles on other ARMs aswell we can make it depend on ARCH_ARM.

Marc

Quoted 20 lines
---
 drivers/net/can/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/Kconfig +1 -1
index 9862b2e..27311c3 100644
@@ -65,7 +65,7 @@ config CAN_LEDS
 
 config CAN_AT91
 	tristate "Atmel AT91 onchip CAN controller"
-	depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9X5
+	depends on ARCH_AT91
 	---help---
 	  This is a driver for the SoC CAN controller in Atmel's AT91SAM9263
 	  and AT91SAM9X5 processors.
Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130308/a5e3c9ec/attachment.sig>
#18 lore raw

PATCH 3/3 can: Kconfig: CAN_AT91 depends on ARCH_AT91

Quoted 9 lines · Marc Kleine-Budde
Quoted 5 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

SAMA5D3 devices also embed CAN feature. Moreover if we want to produce a single kernel image (at least for Atmel devices) it is not useful to be too restrictive.

If it compiles on other ARMs aswell we can make it depend on ARCH_ARM.

I was thinking about it but I am wondering if it makes sense. Should we have a non atmel device with atmel can?

I have no position about this point, if you think it's better to make it depending onto ARCH_ARM, I'll change it if there is no compilation issue.

Regards

Ludovic

Quoted 29 lines

Marc

Quoted 20 lines
---
 drivers/net/can/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/Kconfig +1 -1
index 9862b2e..27311c3 100644
@@ -65,7 +65,7 @@ config CAN_LEDS
 
 config CAN_AT91
 	tristate "Atmel AT91 onchip CAN controller"
-	depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9X5
+	depends on ARCH_AT91
 	---help---
 	  This is a driver for the SoC CAN controller in Atmel's AT91SAM9263
 	  and AT91SAM9X5 processors.
Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#19 lore raw

PATCH 3/3 can: Kconfig: CAN_AT91 depends on ARCH_AT91

Quoted 4 lines · Ludovic Desroches
Quoted 3 lines · Marc Kleine-Budde
Quoted 2 lines · ludovic.desroches at atmel.com

From: Ludovic Desroches <[email protected]>

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

SAMA5D3 devices also embed CAN feature. Moreover if we want to produce a single kernel image (at least for Atmel devices) it is not useful to be too restrictive.

If it compiles on other ARMs aswell we can make it depend on ARCH_ARM.

I was thinking about it but I am wondering if it makes sense. Should we have a non atmel device with atmel can?

I don't know if atmels sells the IP core separately, but ARM Linux is going towards a multi ARCH kernel anyways. So the can core should compile on non atmel and/or multi arch kernels.

Quoted 3 lines

I have no position about this point, if you think it's better to make it depending onto ARCH_ARM, I'll change it if there is no compilation issue.

Please make it so.

regards,
Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130311/1be12da8/attachment.sig>
#20 lore raw

Re: [PATCH 3/3] can: Kconfig: CAN_AT91 depends on ARCH_AT91

In reply to Marc Kleine-Budde
Quoted 9 lines · Marc Kleine-Budde
Quoted 5 lines · On 03/08/2013 06:30 PM, [email protected] wrote:

From: Ludovic Desroches <[email protected]>

SAMA5D3 devices also embed CAN feature. Moreover if we want to produce a single kernel image (at least for Atmel devices) it is not useful to be too restrictive.

If it compiles on other ARMs aswell we can make it depend on ARCH_ARM.

I was thinking about it but I am wondering if it makes sense. Should we have a non atmel device with atmel can?

I have no position about this point, if you think it's better to make it depending onto ARCH_ARM, I'll change it if there is no compilation issue.

Regards

Ludovic

Quoted 29 lines

Marc

Quoted 20 lines
---
 drivers/net/can/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/Kconfig +1 -1
index 9862b2e..27311c3 100644
@@ -65,7 +65,7 @@ config CAN_LEDS
 
 config CAN_AT91
 	tristate "Atmel AT91 onchip CAN controller"
-	depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9X5
+	depends on ARCH_AT91
 	---help---
 	  This is a driver for the SoC CAN controller in Atmel's AT91SAM9263
 	  and AT91SAM9X5 processors.
Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

A message that is not in the archive (sent off-list or not yet received): [email protected]

#22 lore raw

Re: [PATCH 3/3] can: Kconfig: CAN_AT91 depends on ARCH_AT91

Quoted 9 lines · Marc Kleine-Budde
Quoted 5 lines · On 03/08/2013 06:30 PM, [email protected]…

From: Ludovic Desroches <[email protected]>

SAMA5D3 devices also embed CAN feature. Moreover if we want to produce a single kernel image (at least for Atmel devices) it is not useful to be too restrictive.

If it compiles on other ARMs aswell we can make it depend on ARCH_ARM.

I was thinking about it but I am wondering if it makes sense. Should we have a non atmel device with atmel can?

I have no position about this point, if you think it's better to make it depending onto ARCH_ARM, I'll change it if there is no compilation issue.

Regards

Ludovic

Quoted 29 lines

Marc

Quoted 20 lines
---
 drivers/net/can/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/Kconfig +1 -1
index 9862b2e..27311c3 100644
@@ -65,7 +65,7 @@ config CAN_LEDS
 
 config CAN_AT91
 	tristate "Atmel AT91 onchip CAN controller"
-	depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9X5
+	depends on ARCH_AT91
 	---help---
 	  This is a driver for the SoC CAN controller in Atmel's AT91SAM9263
 	  and AT91SAM9X5 processors.
Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |