net, can, ti_hecc: add DT support for the ti,hecc controller
Subsystems (4)
PATCH 1/1 net, can, ti_hecc: add DT support for the ti,hecc controller
add DT support for the ti hecc controller, used on am3517 SoCs.
---
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/can/ti_hecc-can.txt
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +20 -0
@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc" + - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controller + +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>; + };
arch/arm/boot/dts/am3517.dtsi +13 -0
@@ -25,6 +25,19 @@ interrupt-names = "mc"; }; + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>; + status = "disabled"; + }; + davinci_emac: ethernet@0x5c000000 { compatible = "ti,am3517-emac"; ti,hwmods = "davinci_emac";
drivers/net/can/ti_hecc.c +43 -2
65 lines not on this page · raw message
Signature · 1 line
2.1.0
Marc Kleine-Budde
maintainerQuoted 2 lines · Heiko Schocher
add DT support for the ti hecc controller, used on am3517 SoCs.
A similar patch was posted a few days ago, see
http://comments.gmane.org/gmane.linux.can/8616 and my comments.
Please coordinate with Anton Glukhov (Cc'ed) and/or pick up his patches as they are in better shape.
Marc
Quoted 16 lines
Signed-off-by Heiko Schocher <[email protected]>---
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/can/ti_hecc-can.txtDocumentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +0
-0
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc"
We usually put the name of the first SoC this IP core appears in to the compatible.
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 6
Quoted 2 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +2
-0+ - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controller
I'm missing the description of the ti,* properties. I think they are required, too. Although the code doesn't enforce it.
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 19
Quoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +13
-0+ +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>;
Versioning in the OF world is done via the compatible. Are the offsets a per SoC parameter? I'm not sure if it's better to put
the offsets into the driver.
Quoted 33 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +1
-0+ };arch/arm/boot/dts/am3517.dtsi +13
-0@@ -25,6 +25,19 @@ interrupt-names = "mc"; }; + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>; + status = "disabled"; + }; + davinci_emac: ethernet@0x5c000000 { compatible = "ti,am3517-emac"; ti,hwmods = "davinci_emac";drivers/net/can/ti_hecc.c +0
-0@@ -875,16 +875,56 @@ static const struct net_device_ops ti_hecc_netdev_ops = { .ndo_change_mtu = can_change_mtu, };
drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 887
Quoted 10 lines
drivers/net/can/ti_hecc.c +10
-0+#if defined(CONFIG_OF ) +static const struct of_device_id ti_hecc_can_dt_ids[] = { + { + .compatible ="ti,hecc" , + }, { +/* sentinel */ + } +}; +MODULE_DEVICE_TABLE (of, ti_hecc_can_dt_ids); +#endif
Please remove the ifdef, use __maybe_unused instead.
Quoted 14 lines
drivers/net/can/ti_hecc.c +14
-0+ +static const struct ti_hecc_platform_data +*ti_hecc_can_get_driver_data (struct platform_device *pdev) +{ +if (pdev->dev.of_node) { +struct ti_hecc_platform_data *data; +struct device_node *np = pdev->dev.of_node; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return NULL ; + +of_property_read_u32 (np,"ti,hecc_scc_offset" , + &data->scc_hecc_offset);
drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 911
Quoted 10 lines
drivers/net/can/ti_hecc.c +10
-0+of_property_read_u32 (np,"ti,hecc_scc_ram_offset" , + &data->scc_ram_offset); +of_property_read_u32 (np,"ti,hecc_ram_offset" , + &data->hecc_ram_offset); +of_property_read_u32 (np,"ti,hecc_mbx_offset" , + &data->mbx_offset); +of_property_read_u32 (np,"ti,hecc_int_line" , + &data->int_line); +of_property_read_u32 (np,"ti,hecc_version" , + &data->version);
I'm missing error handling here.
drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 915
Quoted 4 lines
drivers/net/can/ti_hecc.c +4
-0+return data; + } +return (const struct ti_hecc_platform_data *) +dev_get_platdata (&pdev->dev);
Is this cast needed?
Quoted 19 lines
drivers/net/can/ti_hecc.c +4
-2+} +static int ti_hecc_probe (struct platform_device *pdev) {struct net_device *ndev = (struct net_device *)0 ;struct ti_hecc_priv *priv; -struct ti_hecc_platform_data *pdata; +const struct ti_hecc_platform_data *pdata;struct resource *mem, *irq;void __iomem *addr;int err = -ENODEV ; - pdata =dev_get_platdata (&pdev->dev); + pdata =ti_hecc_can_get_driver_data (pdev);if (!pdata) {dev_err (&pdev->dev,"No platform data\n" ); goto probe_exit;
drivers/net/can/ti_hecc.c static int ti_hecc_resume(struct platform_device *pdev) · line 1086
Quoted 7 lines
drivers/net/can/ti_hecc.c +1
-0@@ -1040,6 +1080,7 @@ static int ti_hecc_resume(struct platform_device *pdev)static struct platform_driver ti_hecc_driver = { .driver = { .name =DRV_NAME , + .of_match_table =of_match_ptr (ti_hecc_can_dt_ids), }, .probe = ti_hecc_probe, .remove = ti_hecc_remove,
Marc
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 |
Hello Marc,
Am 19.10.2015 um 08:58 schrieb Marc Kleine-Budde:
Quoted 6 lines · Heiko Schocher
Quoted 2 lines
add DT support for the ti hecc controller, used on am3517 SoCs.
A similar patch was posted a few days ago, see
http://comments.gmane.org/gmane.linux.can/8616 and my comments.
Uh, sorry! Seems I missed them ...
Quoted 2 lines
Please coordinate with Anton Glukhov (Cc'ed) and/or pick up his patches as they are in better shape.
Yes, I try the patchset from Anton ... thanks for pointing to them.
@Anton: Do you have a newer version, which contains the comments
from Marc?
bye,
Heiko
Quoted 12 lines
Marc
Quoted 10 lines
Signed-off-by Heiko Schocher <[email protected]>---
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-)create mode 100644
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt
Quoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc"We usually put the name of the first SoC this IP core appears in to the compatible.
Ok, so "ti,am335xx-hecc" would be OK? @Anton: you used "am35x" ... it should be "am35xx"
Quoted 5 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 6
Quoted 2 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +2
-0+ - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controllerI'm missing the description of the ti,* properties. I think they are required, too. Although the code doesn't enforce it.
Ok.
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +9
-0+ +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>;
Quoted 8 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 19
Quoted 4 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0+ ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>;Versioning in the OF world is done via the compatible. Are the offsets a per SoC parameter? I'm not sure if it's better to put
the offsets into the driver.
I am unsure here too..
Quoted 109 lines
Quoted 33 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +1
-0+ };arch/arm/boot/dts/am3517.dtsi +13
-0@@ -25,6 +25,19 @@ interrupt-names = "mc"; }; + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>; + status = "disabled"; + }; + davinci_emac: ethernet@0x5c000000 { compatible = "ti,am3517-emac"; ti,hwmods = "davinci_emac";drivers/net/can/ti_hecc.c +0
-0@@ -875,16 +875,56 @@ static const struct net_device_ops ti_hecc_netdev_ops = { .ndo_change_mtu = can_change_mtu, };drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 887
Quoted 10 lines
drivers/net/can/ti_hecc.c +10
-0+#if defined(CONFIG_OF ) +static const struct of_device_id ti_hecc_can_dt_ids[] = { + { + .compatible ="ti,hecc" , + }, { +/* sentinel */ + } +}; +MODULE_DEVICE_TABLE (of, ti_hecc_can_dt_ids); +#endif Please remove the ifdef, use
__maybe_unusedinstead.Quoted 14 lines
drivers/net/can/ti_hecc.c +14
-0+ +static const struct ti_hecc_platform_data +*ti_hecc_can_get_driver_data (struct platform_device *pdev) +{ +if (pdev->dev.of_node) { +struct ti_hecc_platform_data *data; +struct device_node *np = pdev->dev.of_node; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return NULL ; + +of_property_read_u32 (np,"ti,hecc_scc_offset" , + &data->scc_hecc_offset);drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 911
Quoted 10 lines
drivers/net/can/ti_hecc.c +10
-0+of_property_read_u32 (np,"ti,hecc_scc_ram_offset" , + &data->scc_ram_offset); +of_property_read_u32 (np,"ti,hecc_ram_offset" , + &data->hecc_ram_offset); +of_property_read_u32 (np,"ti,hecc_mbx_offset" , + &data->mbx_offset); +of_property_read_u32 (np,"ti,hecc_int_line" , + &data->int_line); +of_property_read_u32 (np,"ti,hecc_version" , + &data->version);I'm missing error handling here.
drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 915
Quoted 4 lines
drivers/net/can/ti_hecc.c +4
-0+return data; + } +return (const struct ti_hecc_platform_data *) +dev_get_platdata (&pdev->dev);Is this cast needed?
Quoted 19 lines
drivers/net/can/ti_hecc.c +4
-2+} +static int ti_hecc_probe (struct platform_device *pdev) {struct net_device *ndev = (struct net_device *)0 ;struct ti_hecc_priv *priv; -struct ti_hecc_platform_data *pdata; +const struct ti_hecc_platform_data *pdata;struct resource *mem, *irq;void __iomem *addr;int err = -ENODEV ; - pdata =dev_get_platdata (&pdev->dev); + pdata =ti_hecc_can_get_driver_data (pdev);if (!pdata) {dev_err (&pdev->dev,"No platform data\n" ); goto probe_exit;drivers/net/can/ti_hecc.c static int ti_hecc_resume(struct platform_device *pdev) · line 1086
Quoted 7 lines
drivers/net/can/ti_hecc.c +1
-0@@ -1040,6 +1080,7 @@ static int ti_hecc_resume(struct platform_device *pdev)static struct platform_driver ti_hecc_driver = { .driver = { .name =DRV_NAME , + .of_match_table =of_match_ptr (ti_hecc_can_dt_ids), }, .probe = ti_hecc_probe, .remove = ti_hecc_remove,Marc
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Marc Kleine-Budde
maintainerQuoted 20 lines · Heiko Schocher
Quoted 6 lines
Quoted 6 lines
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-)create mode 100644
Documentation/devicetree/bindings/net/can/ti_hecc-can.txtQuoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc"We usually put the name of the first SoC this IP core appears in to the compatible.
Quoted 2 lines
Ok, so "ti,am335xx-hecc" would be OK? @Anton: you used "am35x" ... it should be "am35xx"
The "xx" is not okay. Give precisely the first SoC Version this IP core was implemented in.
Quoted 27 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 6
Quoted 3 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +2
-0+ - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controllerI'm missing the description of the ti,* properties. I think they are required, too. Although the code doesn't enforce it.
Ok.
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +9
-0+ +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>;Quoted 8 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 19
Quoted 4 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0+ ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>;Versioning in the OF world is done via the compatible. Are the offsets a per SoC parameter? I'm not sure if it's better to put
the offsets into the driver.
Quoted 1 line
I am unsure here too..
The devicetree people will hopefully help here.
regards,
Marc
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 |
Hello Marc, Heiko!
I'm sorry for the delay!
Quoted 21 lines · Marc Kleine-Budde
Quoted 20 lines · Heiko Schocher
Quoted 19 lines
Quoted 12 lines
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-)create mode 100644
Documentation/devicetree/bindings/net/can/ti_hecc-can.txtDocumentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +0
-0Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc"We usually put the name of the first SoC this IP core appears in to the compatible.
Quoted 6 lines
Quoted 2 lines
Ok, so "ti,am335xx-hecc" would be OK? @Anton: you used "am35x" ... it should be "am35xx"
The "xx" is not okay. Give precisely the first SoC Version this IP core was implemented in.
It's OMAP3 based arch, but HECC is implemented only in AM3505 and AM3517 SoCs. So, I'm confused about what's "name" should I use.
Quoted 27 lines
Quoted 27 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 6
Quoted 3 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +2
-0+ - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controllerI'm missing the description of the ti,* properties. I think they are required, too. Although the code doesn't enforce it.
Ok.
Quoted 17 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 19
Quoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +13
-0+ +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>;Versioning in the OF world is done via the compatible. Are the offsets a per SoC parameter? I'm not sure if it's better to put
the offsets into the driver.
Quoted 4 lines
Quoted 1 line
I am unsure here too..
The devicetree people will hopefully help here.
I added offsets here just make it consistent with platform data in machine file. Actually it seems that it's not necessary to put offsets in DT file and I can move it to driver. But again, it was added to keep consistency.
Quoted 3 lines
regards,
Marc
regards,
Anton
Marc Kleine-Budde
maintainerQuoted 28 lines · Anton.Glukhov
Hello Marc, Heiko!
I'm sorry for the delay!Quoted 24 lines · Marc Kleine-Budde
Quoted 22 lines · Heiko Schocher
Quoted 6 lines
Quoted 6 lines
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-)create mode 100644
Documentation/devicetree/bindings/net/can/ti_hecc-can.txtQuoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc"We usually put the name of the first SoC this IP core appears in to the compatible.
Ok, so "ti,am335xx-hecc" would be OK? @Anton: you used "am35x" ... it should be "am35xx"
Quoted 6 lines
Quoted 3 lines
The "xx" is not okay. Give precisely the first SoC Version this IP core was implemented in.
It's OMAP3 based arch, but HECC is implemented only in AM3505 and AM3517 SoCs. So, I'm confused about what's "name" should I use.
Which SoC was available first? Pick that.
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 5 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 6
Quoted 2 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +2
-0+ - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controllerI'm missing the description of the ti,* properties. I think they are required, too. Although the code doesn't enforce it.
Ok.
Quoted 17 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 19
Quoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +13
-0+ +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>;Versioning in the OF world is done via the compatible. Are the offsets a per SoC parameter? I'm not sure if it's better to put
the offsets into the driver.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
I am unsure here too..
The devicetree people will hopefully help here.
I added offsets here just make it consistent with platform data in machine file. Actually it seems that it's not necessary to put offsets in DT file and I can move it to driver. But again, it was added to keep consistency.
The DT is supposed to be OS independent, copying from platform data to DT is sometimes not the best way to go. Make yourself heard on the devicetree mailinglist and figure out what's the best way to go here.
Are the offsets for the AM3505 and AM3517 identical?
Marc
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 |
Quoted 29 lines · Marc Kleine-Budde
Quoted 28 lines · Anton.Glukhov
Hello Marc, Heiko!
I'm sorry for the delay!Quoted 24 lines · Marc Kleine-Budde
Quoted 22 lines · Heiko Schocher
Quoted 6 lines
Quoted 6 lines
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-)create mode 100644
Documentation/devicetree/bindings/net/can/ti_hecc-can.txtQuoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc"We usually put the name of the first SoC this IP core appears in to the compatible.
Ok, so "ti,am335xx-hecc" would be OK? @Anton: you used "am35x" ... it should be "am35xx"
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
The "xx" is not okay. Give precisely the first SoC Version this IP core was implemented in.
It's OMAP3 based arch, but HECC is implemented only in AM3505 and AM3517 SoCs. So, I'm confused about what's "name" should I use.
Which SoC was available first? Pick that.
What do you mean available? I know only that HECC appear in AM3505 and AM3517. Nowhere else.
Quoted 35 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 5 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 6
Quoted 2 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +2
-0+ - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controllerI'm missing the description of the ti,* properties. I think they are required, too. Although the code doesn't enforce it.
Ok.
Quoted 17 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 19
Quoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +13
-0+ +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>;Versioning in the OF world is done via the compatible. Are the offsets a per SoC parameter? I'm not sure if it's better to put
the offsets into the driver.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
I am unsure here too..
The devicetree people will hopefully help here.
I added offsets here just make it consistent with platform data in machine file. Actually it seems that it's not necessary to put offsets in DT file and I can move it to driver. But again, it was added to keep consistency.
Quoted 5 lines
The DT is supposed to be OS independent, copying from platform data to DT is sometimes not the best way to go. Make yourself heard on the devicetree mailinglist and figure out what's the best way to go here.
Are the offsets for the AM3505 and AM3517 identical?
Yes, absolutely, and there is no HECC module in another SoCs. Ok, anyway I'll try to figure out what should we use here.
Quoted 3 lines
Marc
Marc Kleine-Budde
maintainerQuoted 6 lines · Anton.Glukhov
Quoted 4 lines
Quoted 2 lines
It's OMAP3 based arch, but HECC is implemented only in AM3505 and AM3517 SoCs. So, I'm confused about what's "name" should I use.
Which SoC was available first? Pick that.
What do you mean available? I know only that HECC appear in AM3505 and AM3517. Nowhere else.
Available on the market. Which one was produced first or was soldered first to some PCB?
Marc
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 |
Marc Kleine-Budde
maintainerQuoted 10 lines · Marc Kleine-Budde
Quoted 6 lines · Anton.Glukhov
Quoted 4 lines
Quoted 2 lines
It's OMAP3 based arch, but HECC is implemented only in AM3505 and AM3517 SoCs. So, I'm confused about what's "name" should I use.
Which SoC was available first? Pick that.
What do you mean available? I know only that HECC appear in AM3505 and AM3517. Nowhere else.
Available on the market. Which one was produced first or was soldered first to some PCB?
A colleague just looked it up, a AM3517 is a AM3505 with 3d graphics. So pick AM3505.
Marc
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 |
Quoted 7 lines · Marc Kleine-Budde
Quoted 6 lines · Marc Kleine-Budde
Quoted 4 lines · Anton.Glukhov
Quoted 4 lines
Quoted 2 lines
It's OMAP3 based arch, but HECC is implemented only in AM3505 and AM3517 SoCs. So, I'm confused about what's "name" should I use.
Which SoC was available first? Pick that.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
What do you mean available? I know only that HECC appear in AM3505 and AM3517. Nowhere else.
Available on the market. Which one was produced first or was soldered first to some PCB?
A colleague just looked it up, a AM3517 is a AM3505 with 3d graphics. So pick AM3505.
Ok, thank you for help!
Quoted 3 lines
Marc
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
maintainerQuoted 6 lines · Marc Kleine-Budde
Quoted 2 lines · Heiko Schocher
add DT support for the ti hecc controller, used on am3517 SoCs.
A similar patch was posted a few days ago, see
http://comments.gmane.org/gmane.linux.can/8616 and my comments.
I don't seem to have that in my inbox. Please send DT bindings to the DT list and maintainers.
Rob
Quoted 168 lines
Please coordinate with Anton Glukhov (Cc'ed) and/or pick up his patches as they are in better shape.
Marc
Quoted 16 lines
Signed-off-by Heiko Schocher <[email protected]>---
.../devicetree/bindings/net/can/ti_hecc-can.txt | 20 ++++++++++ arch/arm/boot/dts/am3517.dtsi | 13 +++++++ drivers/net/can/ti_hecc.c | 45 +++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/can/ti_hecc-can.txtDocumentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +0
-0Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +4
-0@@ -0,0 +1,20 @@ +* TI HECC CAN * + +Required properties: + - compatible: Should be "ti,hecc"We usually put the name of the first SoC this IP core appears in to the compatible.
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 6
Quoted 2 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +2
-0+ - reg: Should contain CAN controller registers location and length + - interrupts: Should contain IRQ line for the CAN controllerI'm missing the description of the ti,* properties. I think they are required, too. Although the code doesn't enforce it.
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt line 19
Quoted 13 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +13
-0+ +Example: + + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>;Versioning in the OF world is done via the compatible. Are the offsets a per SoC parameter? I'm not sure if it's better to put
the offsets into the driver.Quoted 33 lines
Documentation/devicetree/bindings/net/can/ti_hecc-can.txt new file +1
-0+ };arch/arm/boot/dts/am3517.dtsi +13
-0@@ -25,6 +25,19 @@ interrupt-names = "mc"; }; + can0: hecc@5c050000 { + compatible = "ti,hecc"; + reg = <0x5c050000 0x4000>; + interrupts = <24>; + ti,hecc_scc_offset = <0>; + ti,hecc_scc_ram_offset = <0x3000>; + ti,hecc_ram_offset = <0x3000>; + ti,hecc_mbx_offset = <0x2000>; + ti,hecc_int_line = <0>; + ti,hecc_version = <1>; + status = "disabled"; + }; + davinci_emac: ethernet@0x5c000000 { compatible = "ti,am3517-emac"; ti,hwmods = "davinci_emac";drivers/net/can/ti_hecc.c +0
-0@@ -875,16 +875,56 @@ static const struct net_device_ops ti_hecc_netdev_ops = { .ndo_change_mtu = can_change_mtu, };drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 887
Quoted 10 lines
drivers/net/can/ti_hecc.c +10
-0+#if defined(CONFIG_OF ) +static const struct of_device_id ti_hecc_can_dt_ids[] = { + { + .compatible ="ti,hecc" , + }, { +/* sentinel */ + } +}; +MODULE_DEVICE_TABLE (of, ti_hecc_can_dt_ids); +#endif Please remove the ifdef, use
__maybe_unusedinstead.Quoted 14 lines
drivers/net/can/ti_hecc.c +14
-0+ +static const struct ti_hecc_platform_data +*ti_hecc_can_get_driver_data (struct platform_device *pdev) +{ +if (pdev->dev.of_node) { +struct ti_hecc_platform_data *data; +struct device_node *np = pdev->dev.of_node; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return NULL ; + +of_property_read_u32 (np,"ti,hecc_scc_offset" , + &data->scc_hecc_offset);drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 911
Quoted 10 lines
drivers/net/can/ti_hecc.c +10
-0+of_property_read_u32 (np,"ti,hecc_scc_ram_offset" , + &data->scc_ram_offset); +of_property_read_u32 (np,"ti,hecc_ram_offset" , + &data->hecc_ram_offset); +of_property_read_u32 (np,"ti,hecc_mbx_offset" , + &data->mbx_offset); +of_property_read_u32 (np,"ti,hecc_int_line" , + &data->int_line); +of_property_read_u32 (np,"ti,hecc_version" , + &data->version);I'm missing error handling here.
drivers/net/can/ti_hecc.c static const struct net_device_ops ti_hecc_netdev_ops = { · line 915
Quoted 4 lines
drivers/net/can/ti_hecc.c +4
-0+return data; + } +return (const struct ti_hecc_platform_data *) +dev_get_platdata (&pdev->dev);Is this cast needed?
Quoted 19 lines
drivers/net/can/ti_hecc.c +4
-2+} +static int ti_hecc_probe (struct platform_device *pdev) {struct net_device *ndev = (struct net_device *)0 ;struct ti_hecc_priv *priv; -struct ti_hecc_platform_data *pdata; +const struct ti_hecc_platform_data *pdata;struct resource *mem, *irq;void __iomem *addr;int err = -ENODEV ; - pdata =dev_get_platdata (&pdev->dev); + pdata =ti_hecc_can_get_driver_data (pdev);if (!pdata) {dev_err (&pdev->dev,"No platform data\n" ); goto probe_exit;drivers/net/can/ti_hecc.c static int ti_hecc_resume(struct platform_device *pdev) · line 1086
Quoted 7 lines
drivers/net/can/ti_hecc.c +1
-0@@ -1040,6 +1080,7 @@ static int ti_hecc_resume(struct platform_device *pdev)static struct platform_driver ti_hecc_driver = { .driver = { .name =DRV_NAME , + .of_match_table =of_match_ptr (ti_hecc_can_dt_ids), }, .probe = ti_hecc_probe, .remove = ti_hecc_remove,Marc
--
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 |