39 39
constantius

Orangepi 3 h6 allwiner chip

Recommended Posts

4 minutes ago, @lex said:

Err... Just don't know how to do that... In a proper way I mean.

There is a ton of Google hits on this topic, but in short what I do:

1. Pull latest linux-next (updated every work day) and create new branch from it

2. Make small, incremental commits (meaning of a "small, incremental commit" is often a gray area)

3. Test changes

4. Run git format-patch on them and add a cover letter if there is more than one patch

5. Check patch(es) with "scripts/checkpatch.pl <patches>" and fix reported warnings/errors ("line over 80 characters" warning can be ignored for DT patches)

6. Send patch(es) with optional cover letter with "git send-email" to maintainers and mailing lists. E-mail addresses are provided by "scripts/get_maintainer.pl <patches>"

 

Be prepared that first revision of patches won't be accepted as-is. My average is 3-4 revisions, but simple DT patches are often merged directly or need only small revision.

 

Please search for tutorial as I skipped few details, like how commit message should look like. It might look hard now, but after two or so contributions you'll be well aware what to do next time. You'll be able to submit simple DT patches in 10 min after you tested them.

 

If you are unsure, you can still send patches to me first and I'll tell you what to fix before sending them to maintainers and mailing lists.

Share this post


Link to post
Share on other sites

Okay, I promise i will try to learn that.:lol:

 

Anyway, Your dma code seems to work for the SPI0 although the device is not connected yet and need some tests.

[    3.983705] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    3.990224] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
[    3.990921] fbtft_of_value: buswidth = 8
[    3.990929] fbtft_of_value: debug = 0
[    3.990932] fbtft_of_value: rotate = 90
[    3.990934] fbtft_of_value: fps = 60
[    3.990936] fbtft_of_value: txbuflen = 16384
[    4.273841] graphics fb0: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 16 KiB buffer memory, fps=62, spi0.0 at 50 MHz
[    4.276796] sun4i-drm display-engine: fb1: DRM emulated frame buffer device

 

Share this post


Link to post
Share on other sites

Hello Anybody developing this release, I've found in the Orangepi 3  4.9 kernel, a fix for the reboot issue and it works on their Ubuntu 16.04 release, the script/config is here  https://github.com/orangepi-xunlong/OrangePiH6_external/blob/master/sys_config/OrangePiH6_3_sys_config.fex

 

In addition seems to fix USB 3.0 speed issue, but only sees two cores in the ubuntu 16.04 release, early days I guess. I'll keep digging.
      

Share this post


Link to post
Share on other sites
17 hours ago, @lex said:

Anyway, Your dma code seems to work for the SPI0 although the device is not connected yet and need some tests.

Please let me know if it works for you. I plan to send DMA patches today.

Share this post


Link to post
Share on other sites
1 hour ago, FrancescoT said:

Do you have the OPi3 with eMMC?

Yes ! ... And I've just did a successful "nand-sata-install" ...

 

@krachlatte do you plan to send a PR for your recent work on OPi3 ?

 

I would like to work on the WiFi to see if I can get it working ?

 

BTW, from which other board did you use as a template to start this OPi3 ?

 

EDIT : I got WiFi working by decompiling/edit/recompiling your existing DTB ... :)

Share this post


Link to post
Share on other sites
5 hours ago, jernej said:

Please let me know if it works for you. I plan to send DMA patches today.

Sure, but sorry, no progress yet to test your code, I got stuck with the error below and i could not figure out where the mistake is.

The message is obvious, but the same setup works with others sbc with 4.18, 4.19 and 4.20.

[    3.455164] sun50i-h6-pinctrl 300b000.pinctrl: pin PC5 already requested by 5010000.spi; cannot claim for 300b000.pinctrl:69
[    3.444948] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    3.454515] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
[    3.454940] fbtft_of_value: buswidth = 8
[    3.454947] fbtft_of_value: debug = 0
[    3.454950] fbtft_of_value: rotate = 90
[    3.454953] fbtft_of_value: fps = 60
[    3.454955] fbtft_of_value: txbuflen = 16384
[    3.476347] fb_ili9341 spi0.0: gpio_request_one('cs-gpios'=69) failed with -22
[    3.483740] fb_ili9341: probe of spi0.0 failed with error -22
[    4.091824] sun4i-drm display-engine: fb0: DRM emulated frame buffer device
		dma: dma-controller@3002000 {
			compatible = "allwinner,sun50i-h6-dma";
			reg = <0x03002000 0x1000>;
			interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_DMA>, <&ccu CLK_MBUS_DMA>;
			clock-names = "bus", "mbus";
			dma-channels = <16>;
			dma-requests = <46>;
			resets = <&ccu RST_BUS_DMA>;
			#dma-cells = <1>;
		};

		pio: pinctrl@300b000 {
			.
			.
			spi0_pins: spi0 {
				pins = "PC0", "PC2", "PC3", "PC5";
				function = "spi0";
			};
		};
		spi0: spi@5010000 {
			compatible = "allwinner,sun8i-h3-spi";
			reg = <0x05010000 0x1000>;
			interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
			clock-names = "ahb", "mod";
			dmas = <&dma 23>, <&dma 23>;
			dma-names = "rx", "tx";
			pinctrl-names = "default";
			pinctrl-0 = <&spi0_pins>;
			resets = <&ccu RST_BUS_SPI0>;
			status = "disabled";
			num-cs = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
		};
              
&pio {
	spi0_cs_pins: spi0_cs_pins {
		pins = "PC5", "PH3";
        function = "gpio_out";
    };
};

&spi0 {
    #address-cells = <1>;
    #size-cells = <0>;
    status = "okay";
    pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
    cs-gpios = <&pio 2 5 GPIO_ACTIVE_HIGH>, <&pio 7 3 GPIO_ACTIVE_HIGH>;
    num-cs = <2>;
    
    pitft: pitft@0{
        compatible = "ilitek,ili9341";
        reg = <0>;
        status = "okay";

        spi-max-frequency = <50000000>;
        rotate = <90>;
        fps = <60>;
        bgr = <1>;
        buswidth = <8>;
        txbuflen = <16384>;
        dc-gpios = <&pio 2 9 GPIO_ACTIVE_HIGH>;     /* PC9 */
        reset-gpios = <&pio 2 8 GPIO_ACTIVE_HIGH>;  /* PC8 */
        led-gpios = <&pio 2 7 GPIO_ACTIVE_LOW>;     /* PC7 */        
        cs-gpios = <&pio 2 5 GPIO_ACTIVE_HIGH>;     /* PC5 */ <== kernel complain
        debug = <0x0>;
    };
};

 

 

Share this post


Link to post
Share on other sites
10 minutes ago, @lex said:

I got stuck with the error below and i could not figure out where the mistake is.

DMA channels for SPI0 are 22 and 22 (Rx, Tx).

 

BTW, I already sent patches, but I still want to know if it will work for you once you fix DT issues.

Share this post


Link to post
Share on other sites

@@lex Please be aware that H6 SPI has additional registers. Currently I can't say if they need to be set or not. If they has to be set, then SPI driver has to be extended with H6 support.

Share this post


Link to post
Share on other sites
2 minutes ago, jernej said:

H6 SPI has additional registers.

That seems to be the case here. Unfortunately, I have to wait for this support. Thanks anyway.

Share this post


Link to post
Share on other sites

@jernej

 

FYI, i just did a simple test on /dev/spidev.0.0  with a loop, not sure what should be the result, but here it is:

 

./spidev_test -v -D /dev/spidev0.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|

 

Share this post


Link to post
Share on other sites
1 hour ago, @lex said:

not sure what should be the result, but here it is

If you mean that you did some SPI loopback wire test, this result is a bit strange since "spidev_test" should display the following :

root@nanopct4:~# ./spidev_test
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF 
40 00 00 00 00 95 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
DE AD BE EF BA AD 
F0 0D 

 

Share this post


Link to post
Share on other sites
9 hours ago, martinayotte said:

If you mean that you did some SPI loopback wire test, this result is a bit strange since "spidev_test"

Yes, I guess this is a confirmation SPI is not working yet.

I used the -v to see some output (the spidev_test did not return anything).

I had some hope that TX would be the data sent and RX would be the receiving data which is the same. 

 

Share this post


Link to post
Share on other sites
54 minutes ago, @lex said:

I had some hope that TX would be the data sent and RX would be the receiving data which is the same.

You've got some of the bytes (first ones and few at the end), but missing the "DE AD BE EF BA AD" ones in the middle, so, maybe it is the DMA that didn't work properly ...

 

EDIT, on my recently received OPi3, I've added manually SPI1 along SPIDEV in the Main DT, and I got it working propery :

 

root@orangepi3:~# ./spidev_test 
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF 
40 00 00 00 00 95 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
FF FF FF FF FF FF 
DE AD BE EF BA AD 
F0 0D 

 

Share this post


Link to post
Share on other sites
(edited)

Using this code i got an output but similar to the previous one.

https://github.com/rm-hull/spidev-test

 

./spidev_test -D /dev/spidev0.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.

PS: the TX data:

uint8_t default_tx[] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xF0, 0x0D,
};

 

Edited by @lex
TX data

Share this post


Link to post
Share on other sites
2 hours ago, @lex said:

Using this code i got an output but similar to the previous one.

Oh ! You're right ! The "DE AD BE EF BA AD" has been removed even in Torvald's tree ...

https://github.com/torvalds/linux/blob/master/tools/spi/spidev_test.c

Probably for political/ethical reasons since "Dead Beef Bad Food" was there years ago, and only "Food" is still present ... :lol:

It will be difficult to create new Vegetarian phrase in HEX ... :o

 

EDIT : I've found almost a vegetarian one : CAFEF00D ... :P

https://en.wikipedia.org/wiki/Hexspeak

 

EDIT2 : Just for fun, I tried to find when it has been removed, probably between 3.10.y and 4.0.y, but I didn't found the commit itself ...

https://raw.githubusercontent.com/raspberrypi/linux/rpi-3.10.y/Documentation/spi/spidev_test.c

EDIT3: I found the commit in March 2015 : https://github.com/torvalds/linux/commit/30061915be6e3a2c2a4bc4f22a229d4eb7b7cc65#diff-cb4325e22952faf785e23bc6978e90ae :ph34r:

Share this post


Link to post
Share on other sites

Is it within the scope of Armbian to attempt support for the MiniPCIe port with the mainline kernel? I didn't give it much thought until I remembered hat there are MiniPCIe to SATA adapters.

 

My bandwidth and time are too low to have been much use for the early stages sorry. Someone else had always tried the newest iteration before I'd finished downloading it.

Share this post


Link to post
Share on other sites
13 minutes ago, ImmortanJoe said:

Is it within the scope of Armbian to attempt support for the MiniPCIe port with the mainline kernel? I didn't give it much thought until I remembered hat there are MiniPCIe to SATA adapters.

 

My bandwidth and time are too low to have been much use for the early stages sorry. Someone else had always tried the newest iteration before I'd finished downloading it.

 

Not for Opi3... defective by design.. http://linux-sunxi.org/H6#Errata

 

Check out espressobin if you need SATA and MiniPCIe

Share this post


Link to post
Share on other sites
5 hours ago, lanefu said:

Not for Opi3... defective by design.. http://linux-sunxi.org/H6#Errata

So that's what is wrong with it. Strange implementation coupled with difficulties doing some things with the Linux framework. 

Am I reading it correctly that the PCIe controller has either a banked interface or a potentially rolling window? Hm. Besides odd setup, DMA transactions would still function normally, right? 

Share this post


Link to post
Share on other sites
12 hours ago, martinayotte said:

Armbian has now the new OrangePi3 WIP ! ;)

WiFi and eMMC tested ...

 

Thank you!!

 

Just for my understanding / curiosity... is the reason the OPi3 is built using an older U-Boot version because of the HDMI issue mentioned earlier? And once we move to Kernel 5.x this should be resolved? I only ask because I'm eager for Kernel 5 for video acceleration!

Share this post


Link to post
Share on other sites
1 hour ago, alex.scott.961 said:

is the reason the OPi3 is built using an older U-Boot version

Current DEV is using U-Boot v2018.11 and Kernel 4.20.12, so this is no so old ... ;)

1 hour ago, alex.scott.961 said:

once we move to Kernel 5.x this should be resolved

5.0.y is in our plans, but it will take awhile since it is a tedious jobs of cleaning the useless patches without doing that blindly ...

Share this post


Link to post
Share on other sites
20 minutes ago, martinayotte said:

Current DEV is using U-Boot v2018.11 and Kernel 4.20.12, so this is no so old ...

That's true, but there were some H6 DRAM improvements in 2019.01 IIRC.

 

EDIT: I probably mixed up with 3GB memory support (previously was only possible to setup 2 or 4 GB, not 3).

Share this post


Link to post
Share on other sites
12 minutes ago, jernej said:

That's true, but there were some H6 DRAM improvements in 2019.01 IIRC.

Ok ! Since switching U-Boot is a less painful task than kernel itself, maybe we can switch sooner !

I will try this afternoon ...

Share this post


Link to post
Share on other sites
39 39