can: Allwinner A10/A20 CAN Controller support - Summary
Subsystems (6)
v8 cover can: Allwinner A10/A20 CAN Controller support - Summary
Hi,
please find attached the next version of my patch set. I have taken all remarks from Maxime Ripard into the new version
Please review, test and report bugs if exists.
The patchset applies to all recent Kernel versions (4.x, next etc.).
[PATCH v8 1/4] Device Tree Binding Documentation
[PATCH v8 2/4] Defconfig multi_v7
[PATCH v8 3/4] Defconfig sunxi
[PATCH v8 4/4] Kernel Module
History:
V8: sun4i_can.c: rename sunxi to sun4i
dt: use sun4i-a10-can as identifier
can_open: don't use shared IRQ
v7: set_normal_mode: stripped (code inserted in can_stop)
set_reset_mode: stripped (code inserted in can_start)
sunxi_can_start: reworked
sunxi_can_stop: function added
sunxi_can_err: don't skip if skb alloc fails
sunxican_bittiming_const: use netdev_dbg instead of netdev_info
sunxican_probe: CAN_CTRLMODE_PRESUME_ACK
v6: renamed the driver to sun4i as suggested by Maxime Ripard
removed module version
removed suspend and resume
moved clk enable from can_start into open / should be balanced
between enabling and disabling now
freeing resources on error
v5: fix license
modify prefix to mode select defines
enable and disable clock in sunxican_get_berr_counter delete set_normal_mode at the end of sunxi_can_start removed sunxican_id_table
use devm_clk_get instead of clk_get
use devm_ioremap_resource to simplify probe and remove make set-normal-mode and set-reset-mode more readable
v4: defines prefixed with SUNXI_
sunxi_can_write_cmdreg tweaked
loops in set_xxx_mode reworked
add return value to set_xxx_mode
sunxican_start_xmit reworked
struct platform_driver stripped
moved set_bittiming into open
moved clock start into open
add clock stop to close
suspend reworked
resume reworked
fixed double counting bug
v3: changed error state change handling (thx Andri for the hint)
use bittiming function correct (no need to call it) strip down priv (suggested by Marc) scripts/checkpatch.pl-> no matches anymore
sparse -> no errors or warnings anymore
v2: cleaning
v1: initial
---
.../devicetree/bindings/net/can/sun4i_can.txt | 38 + arch/arm/configs/multi_v7_defconfig | 1 + arch/arm/configs/sunxi_defconfig | 2 + drivers/net/can/Kconfig | 10 + drivers/net/can/Makefile | 1 + drivers/net/can/sun4i_can.c | 857 +++++++++++++++++++++ 6 files changed, 909 insertions(+)
PATCH v8 1/3 can: Allwinner A10/A20 CAN Controller support - Devicetree bindings
Devicetree bindings for Allwinner A10/A20 CAN
---
.../devicetree/bindings/net/can/sun4i_can.txt | 38 + 1 files changed, 389 insertions(+)
Documentation/devicetree/bindings/net/can/sun4i_can.txt new file +38 -0
@@ -0,0 +1,38 @@ +Allwinner A10/A20 CAN controller Device Tree Bindings +----------------------------------------------------- + +Required properties: +- compatible: "allwinner,sun4i-a10-can" +- reg: physical base address and size of the Allwinner A10/A20 CAN register map. +- interrupts: interrupt specifier for the sole interrupt. +- clock: phandle and clock specifier. + + +Example +------- + +SoC common .dtsi file: + + can0_pins_a: can0 at 0 { + allwinner,pins = "PH20","PH21"; + allwinner,function = "can"; + allwinner,drive = <0>; + allwinner,pull = <0>; + }; +... + can0: can at 01c2bc00 { + compatible = "allwinner,sun4i-a10-can"; + reg = <0x01c2bc00 0x400>; + interrupts = <0 26 4>; + clocks = <&apb1_gates 4>; + status = "disabled"; + }; + +Board specific .dts file: + + can0: can at 01c2bc00 { + pinctrl-names = "default"; + pinctrl-0 = <&can0_pins_a>; + status = "okay"; + }; +
Marc Kleine-Budde
maintainerRe: [PATCH v8 1/3] can: Allwinner A10/A20 CAN Controller support - Devicetree bindings
Quoted 34 lines · Gerhard Bertelsmann
Devicetree bindings for Allwinner A10/A20 CAN
Signed-off-by Gerhard Bertelsmann <[email protected]>---
.../devicetree/bindings/net/can/sun4i_can.txt | 38 + 1 files changed, 389 insertions(+)Documentation/devicetree/bindings/net/can/sun4i_can.txt new file +19
-0@@ -0,0 +1,38 @@ +Allwinner A10/A20 CAN controller Device Tree Bindings +----------------------------------------------------- + +Required properties: +- compatible: "allwinner,sun4i-a10-can" +- reg: physical base address and size of the Allwinner A10/A20 CAN register map. +- interrupts: interrupt specifier for the sole interrupt. +- clock: phandle and clock specifier. + + +Example +------- + +SoC common .dtsi file: + + can0_pins_a: can0 at 0 { + allwinner,pins = "PH20","PH21"; + allwinner,function = "can"; + allwinner,drive = <0>;
Documentation/devicetree/bindings/net/can/sun4i_can.txt line 29
Quoted 10 lines
Documentation/devicetree/bindings/net/can/sun4i_can.txt new file +10
-0+ allwinner,pull = <0>; + }; +... + can0: can at 01c2bc00 { + compatible = "allwinner,sun4i-a10-can"; + reg = <0x01c2bc00 0x400>; + interrupts = <0 26 4>; + clocks = <&apb1_gates 4>; + status = "disabled"; + };
What about adding this snippet to SoC where the CAN core is available? Maxime, what's the policy on sinxi? If you give me an Ack I'd like to take the series via linux-can-next (and to net-next) upstream.
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: 455 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/b503fac9/attachment.sig>
Re: [PATCH v8 1/3] can: Allwinner A10/A20 CAN Controller support - Devicetree bindings
Quoted 40 lines · Marc Kleine-Budde
Quoted 39 lines · Gerhard Bertelsmann
Devicetree bindings for Allwinner A10/A20 CAN
Signed-off-by Gerhard Bertelsmann <[email protected]>---
.../devicetree/bindings/net/can/sun4i_can.txt | 38 + 1 files changed, 389 insertions(+)Documentation/devicetree/bindings/net/can/sun4i_can.txt new file +24
-0@@ -0,0 +1,38 @@ +Allwinner A10/A20 CAN controller Device Tree Bindings +----------------------------------------------------- + +Required properties: +- compatible: "allwinner,sun4i-a10-can" +- reg: physical base address and size of the Allwinner A10/A20 CAN register map. +- interrupts: interrupt specifier for the sole interrupt. +- clock: phandle and clock specifier. + + +Example +------- + +SoC common .dtsi file: + + can0_pins_a: can0 at 0 { + allwinner,pins = "PH20","PH21"; + allwinner,function = "can"; + allwinner,drive = <0>; + allwinner,pull = <0>; + }; +... + can0: can at 01c2bc00 { + compatible = "allwinner,sun4i-a10-can";
Quoted 8 lines
Documentation/devicetree/bindings/net/can/sun4i_can.txt line 29
Quoted 5 lines
Documentation/devicetree/bindings/net/can/sun4i_can.txt new file +5
-0+ reg = <0x01c2bc00 0x400>; + interrupts = <0 26 4>; + clocks = <&apb1_gates 4>; + status = "disabled"; + };What about adding this snippet to SoC where the CAN core is available? Maxime, what's the policy on sinxi?
It would be great, but it can come as a second step.
Quoted 2 lines
If you give me an Ack I'd like to take the series via linux-can-next (and to net-next) upstream.
I just did so for this patch, I'll review the driver when I'll have a bit of time.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/97e96eb7/attachment.sig>
Re: [PATCH v8 1/3] can: Allwinner A10/A20 CAN Controller support - Devicetree bindings
Hello Marc,
I'm refering to this original patch.
I just upgraded my two BananaPis to Kernel 4.9.13 and apparently the correct Devicetree bindings are still missing in
arch/arm/boot/dts/sun7i-a20.dtsi
,so I added them manually.
I've done some basic tests and everything works as expected.
How is the policy?
May I write the DT Patch or is this the domain of the original Author?
Thanks and Best Regards,
Patrick
Am 17.09.2015 um 12:06 schrieb Maxime Ripard:
Quoted 61 lines · Marc Kleine-Budde
Quoted 40 lines · Gerhard Bertelsmann
Quoted 39 lines
Devicetree bindings for Allwinner A10/A20 CAN
Signed-off-by Gerhard Bertelsmann <[email protected]>---
.../devicetree/bindings/net/can/sun4i_can.txt | 38 + 1 files changed, 389 insertions(+)Documentation/devicetree/bindings/net/can/sun4i_can.txt new file +24
-0@@ -0,0 +1,38 @@ +Allwinner A10/A20 CAN controller Device Tree Bindings +----------------------------------------------------- + +Required properties: +- compatible: "allwinner,sun4i-a10-can" +- reg: physical base address and size of the Allwinner A10/A20 CAN register map. +- interrupts: interrupt specifier for the sole interrupt. +- clock: phandle and clock specifier. + + +Example +------- + +SoC common .dtsi file: + + can0_pins_a: can0@0 { + allwinner,pins = "PH20","PH21"; + allwinner,function = "can"; + allwinner,drive = <0>; + allwinner,pull = <0>; + }; +... + can0: can@01c2bc00 { + compatible = "allwinner,sun4i-a10-can";Quoted 8 lines
Documentation/devicetree/bindings/net/can/sun4i_can.txt line 29
Quoted 5 lines
Documentation/devicetree/bindings/net/can/sun4i_can.txt new file +5
-0+ reg = <0x01c2bc00 0x400>; + interrupts = <0 26 4>; + clocks = <&apb1_gates 4>; + status = "disabled"; + };What about adding this snippet to SoC where the CAN core is available? Maxime, what's the policy on sinxi?
It would be great, but it can come as a second step.
Quoted 2 lines
If you give me an Ack I'd like to take the series via linux-can-next (and to net-next) upstream.
I just did so for this patch, I'll review the driver when I'll have a bit of time.
Thanks!
Maxime
Marc Kleine-Budde
maintainerRe: [PATCH v8 1/3] can: Allwinner A10/A20 CAN Controller support - Devicetree bindings
Quoted 7 lines · Patrick Menschel
Hello Marc,
I'm refering to this original patch.
I just upgraded my two BananaPis to Kernel 4.9.13 and apparently the correct Devicetree bindings are still missing in
Quoted 8 lines
arch/arm/boot/dts/sun7i-a20.dtsi,so I added them manually.
I've done some basic tests and everything works as expected.
How is the policy?
May I write the DT Patch or is this the domain of the original Author?
Feel free to send a patch that adds the CAN devices to all SoCs that have one.
regrads,
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 |
Re: [PATCH v8 1/3] can: Allwinner A10/A20 CAN Controller support - Devicetree bindings
In reply to Gerhard BertelsmannQuoted 3 lines · Gerhard Bertelsmann
Devicetree bindings for Allwinner A10/A20 CAN
Signed-off-by Gerhard Bertelsmann <[email protected]>
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/388017d6/attachment.sig>
PATCH v8 2/4 can: Allwinner A10/A20 CAN Controller support - Defconfig
In reply to Gerhard BertelsmannDefconfig multi_v7 for Allwinner A10/A20 CAN driver
---
arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertions(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -153,6 +153,7 @@ CONFIG_CAN_DEV=y CONFIG_CAN_AT91=m CONFIG_CAN_XILINXCAN=y CONFIG_CAN_MCP251X=y +CONFIG_CAN_SUN4I=y CONFIG_BT=m CONFIG_BT_MRVL=m CONFIG_BT_MRVL_SDIO=m
PATCH v8 3/4 can: Allwinner A10/A20 CAN Controller support - Defconfig
In reply to Gerhard BertelsmannDefconfig sunxi for Allwinner A10/A20 CAN driver
---
arch/arm/configs/sunxi_defconfig | 2 + 1 file changed, 2 insertions(+)
arch/arm/configs/sunxi_defconfig +2 -0
@@ -31,6 +31,8 @@ CONFIG_IP_PNP_BOOTP=y # CONFIG_INET_LRO is not set # CONFIG_INET_DIAG is not set # CONFIG_IPV6 is not set +CONFIG_CAN=y +CONFIG_CAN_SUN4I=y # CONFIG_WIRELESS is not set CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
PATCH v8 4/4 can: Allwinner A10/A20 CAN Controller support - Kernel module
In reply to Gerhard BertelsmannKernel module for Allwinner A10/A20 CAN
---
drivers/net/can/Kconfig | 10 + drivers/net/can/Makefile | 1 + drivers/net/can/sun4i_can.c | 857 +++++++++++++++++++++ 3 files changed, 868 insertions(+)
drivers/net/can/Kconfig +10 -0
@@ -129,6 +129,16 @@ config CAN_RCAR To compile this driver as a module, choose M here: the module will be called rcar_can. +config CAN_SUN4I + tristate "Allwinner A10 CAN controller" + depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST + ---help--- + Say Y here if you want to use CAN controller found on Allwinner + A10/A20 SoCs. + + To compile this driver as a module, choose M here: the module will + be called sun4i_can. + config CAN_XILINXCAN tristate "Xilinx CAN" depends on ARCH_ZYNQ || ARM64 || MICROBLAZE || COMPILE_TEST
drivers/net/can/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_CAN_FLEXCAN) += flexcan.o obj-$(CONFIG_PCH_CAN) += pch_can.o obj-$(CONFIG_CAN_GRCAN) += grcan.o obj-$(CONFIG_CAN_RCAR) += rcar_can.o +obj-$(CONFIG_CAN_SUN4I) += sun4i_can.o obj-$(CONFIG_CAN_XILINXCAN) += xilinx_can.o subdir-ccflags-y += -D__CHECK_ENDIAN__
drivers/net/can/sun4i_can.c new file +857 -0
857 lines not on this page · raw message
Re: [PATCH v8 4/4] can: Allwinner A10/A20 CAN Controller support - Kernel module
Quoted 3 lines · Gerhard Bertelsmann
Kernel module for Allwinner A10/A20 CAN
Signed-off-by Gerhard Bertelsmann <[email protected]>
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/960852d9/attachment-0001.sig>
Quoted 5 lines · Gerhard Bertelsmann
Hi,
please find attached the next version of my patch set. I have taken all remarks from Maxime Ripard into the new version
Quoted 8 lines
Please review, test and report bugs if exists.
The patchset applies to all recent Kernel versions (4.x, next etc.).
[PATCH v8 1/4] Device Tree Binding Documentation
[PATCH v8 2/4] Defconfigmulti_v7
[PATCH v8 3/4] Defconfig sunxi
[PATCH v8 4/4] Kernel Module
Applied 3 and 4.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/d8901f97/attachment.sig>
Quoted 8 lines · Maxime Ripard
Quoted 7 lines · Gerhard Bertelsmann
Hi,
please find attached the next version of my patch set. I have taken all remarks from Maxime Ripard into the new version
Please review, test and report bugs if exists.
Quoted 8 lines
Quoted 6 lines
The patchset applies to all recent Kernel versions (4.x, next etc.).
[PATCH v8 1/4] Device Tree Binding Documentation
[PATCH v8 2/4] Defconfigmulti_v7
[PATCH v8 3/4] Defconfig sunxi
[PATCH v8 4/4] Kernel ModuleApplied 3 and 4.
Applied to what tree?
That's not the friendly way when Marc asks you about the documentation about the device tree (patch 1) and you commit the CAN driver and the sunxi defconfig (patch 3 & 4) that he mainly reviewed to whatever tree.
New CAN drivers go via can-next and net-next into mainline.
So please answer Marcs question and let him queue up the CAN driver via can-next himself.
Thanks,
Oliver
Quoted 22 lines · Oliver Hartkopp
Quoted 8 lines · Maxime Ripard
Quoted 7 lines · Gerhard Bertelsmann
Hi,
please find attached the next version of my patch set. I have taken all remarks from Maxime Ripard into the new version
Please review, test and report bugs if exists.
Quoted 8 lines
Quoted 6 lines
The patchset applies to all recent Kernel versions (4.x, next etc.).
[PATCH v8 1/4] Device Tree Binding Documentation
[PATCH v8 2/4] Defconfigmulti_v7
[PATCH v8 3/4] Defconfig sunxi
[PATCH v8 4/4] Kernel ModuleApplied 3 and 4.
Applied to what tree?
Quoted 8 lines
That's not the friendly way when Marc asks you about the documentation about the device tree (patch 1) and you commit the CAN driver and the sunxi defconfig (patch 3 & 4) that he mainly reviewed to whatever tree.
New CAN drivers go via can-next and net-next into mainline.
So please answer Marcs question and let him queue up the CAN driver via can-next himself.
Hmmm, actually, I meant 2 and 3, the two defconfig patches.
The driver and bindings should of course go through Marc's tree.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/a7dd44e1/attachment.sig>
Hi Maxime,
Quoted 9 lines · Maxime Ripard
Quoted 2 lines · Oliver Hartkopp
New CAN drivers go via can-next and net-next into mainline.
Hmmm, actually, I meant 2 and 3, the two defconfig patches.
The driver and bindings should of course go through Marc's tree.
Ok. Thanks for the fix :-)
Regards,
Oliver
Marc Kleine-Budde
maintainerQuoted 5 lines · Gerhard Bertelsmann
Hi,
please find attached the next version of my patch set. I have taken all remarks from Maxime Ripard into the new version
Quoted 8 lines
Please review, test and report bugs if exists.
The patchset applies to all recent Kernel versions (4.x, next etc.).
[PATCH v8 1/4] Device Tree Binding Documentation
[PATCH v8 2/4] Defconfigmulti_v7
[PATCH v8 3/4] Defconfig sunxi
[PATCH v8 4/4] Kernel Module
Applies 1 and 4 with maxime's Ack to linux-can-next.
Thanks,
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: 455 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/613d687c/attachment.sig>