Bino Oetomo Posted November 2, 2015 Posted November 2, 2015 Dear AllI Need to implement : http://www.bananapi.com/index.php/forum/interfacing/1575-socketcan-dirver-for-a10-a20Based on http://forum.armbian.com/index.php/topic/379-learning-device-tree/I have to do patch to arch/arm/boot/dts/sun7i-a20.dtsi (to add can port) and arch/arm/boot/dts/sun7i-a20-cubieboard2.dts (to move led pins to another PE04/PE05)I take copies of dts and dtsi files from my previous build (so it's touched by igor's script), and make some modification and create a patch1. cb2can-dtsi.patch : patch to activate can0 at PH20 and PH21 --- a/arch/arm/boot/dts/sun7i-a20.dtsi 2015-11-02 13:10:58.000000000 +0700 +++ b/arch/arm/boot/dts/sun7i-a20.dtsi 2015-11-02 14:09:28.321016044 +0700 @@ -875,6 +875,13 @@ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>; }; + can0_pins_a: can0@0 { + allwinner,pins = "PH20","PH21"; + allwinner,function = "can"; + allwinner,drive = <SUN4I_PINCTRL_10_MA>; + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>; + }; + i2c0_pins_a: i2c0@0 { allwinner,pins = "PB0", "PB1"; allwinner,function = "i2c0"; @@ -1281,6 +1288,16 @@ status = "disabled"; #address-cells = <1>; #size-cells = <0>; + }; + + can0: can@01c2bc00 { + compatible = "allwinner,sun4i-a10-can"; + reg = <0x01c2bc00 0x400>; + interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&apb1_gates 4>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; }; i2c4: i2c@01c2c000 { 2. cb2can-dts.patch : dts patch to move leds pins to PE04 and PE 05 --- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 2015-11-02 13:10:58.000000000 +0700 +++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 2015-11-02 14:13:50.941004577 +0700 @@ -69,12 +69,12 @@ blue { label = "cubieboard2:blue:usr"; - gpios = <&pio 7 21 GPIO_ACTIVE_HIGH>; + gpios = <&pio 4 5 GPIO_ACTIVE_HIGH>; }; green { label = "cubieboard2:green:usr"; - gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>; + gpios = <&pio 4 4 GPIO_ACTIVE_HIGH>; }; }; }; @@ -162,7 +162,7 @@ &pio { led_pins_cubieboard2: led_pins@0 { - allwinner,pins = "PH20", "PH21"; + allwinner,pins = "PE04", "PE05"; allwinner,function = "gpio_out"; allwinner,drive = <SUN4I_PINCTRL_10_MA>; allwinner,pull = <SUN4I_PINCTRL_NO_PULL>; ---------------My question is :1. Is that a proper patches ? since I could not try it yet.2. Where is the safest place to place patching proces in the build script ?What if I insert : if [[ $BOARD == cubieboard2 ]] ; then isCAN=`cat .config |grep CONFIG_CAN= |cut -f2 -d"="` if [ "$isCAN" != "n" ]; then echo "WE NEED CAN" patchme "Add CAN port to dtsi" "cb2can-dtsi.patch" "default" "kernel" patchme "Move LED to PE04/PE05 in dts" "cb2can-dts.patch" "default" "kernel" fi fi Start at line 134 of patching.sh ?Sincerely-bino-
zador.blood.stained Posted November 2, 2015 Posted November 2, 2015 Current CAN patch (version 8) consists of 4 parts (driver itself, kernel configs, DT config) and can be found in follow-ups to this message: http://www.spinics.net/lists/netdev/msg343137.html You'll need all 4 parts, and DT config also needs CAN section in device-specific sun7i-a20-cubieboard2.dts file, as by default in dtsi file CAN controller is disabled. By the way, mainline kernel just updated from 4.2.5 to 4.3, so right now build process most likely will fail due to outdated kernel config. 1
Igor Posted November 2, 2015 Posted November 2, 2015 @Bino This patch implementation is o.k. at the current script setup. if [[ $BOARD == cubieboard2 ]] ; then However I have no idea if those patches are operational. If you succeed we can add them to default building. @Zador I just fixed broken patches and update configuration. 4.3 can be built and older 4.x kernels also works. 1
Bino Oetomo Posted November 3, 2015 Author Posted November 3, 2015 @Bino This patch implementation is o.k. at the current script setup. if [[ $BOARD == cubieboard2 ]] ; then However I have no idea if those patches are operational. If you succeed we can add them to default building. That patch is not good enough tobe added to default building. If the source is fresh downloaded (untouched yet) , it will do the work. But when I re do the build process, it double what it did .... causing a naming conflict when compiling DTB. Sincerely -bino-
Igor Posted November 3, 2015 Posted November 3, 2015 I added CAN patch v8 to the source by default so you only need to deal with DT.
Recommended Posts