1 1
anthony.gelibert

Raw serial device on Olimex A10 Lime

Recommended Posts

Hi,

 

Firstly, congratulations for your amazing work… it's impressive.

 

I have a question regarding the SD image for A10 Lime (Linux 4.x)… 

Can I enable a raw serial device on /dev/ttyS1 which will use the uart0 of the FEX file?

 

If I understand the FEX documentation, the FEX is no longer used on this kind of image, in favor of DTB files.

 

So, how can I manage to modify the DTB file in order to customize my uart settings ?

And, finally, how can I obtain a raw serial device on /dev/ttyS1 which will use it ?   

 

Regards,

Anthony.

Share this post


Link to post
Share on other sites

It depends on the kernel you use. Igor currently provides both images with 3.4.x (fex/script.bin) and mainline (dts/dtb). Can you provide the ouput of

uname -a
dmesg | egrep "serial|uart"
sudo cat /proc/tty/driver/serial

Share this post


Link to post
Share on other sites

Hello,

 

Thank you for your quick answer.

We've executed your commands and these are the results :

uname -a :
Linux lime-a10 4.1.6-sunxi #20 SMP Mon Aug 24 09:27:58 CEST 2015 armv7l GNU/Linux

dmesg | egrep "serial|uart":
[    1.978936] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 28, base_baud = 1500000) is a U6_16550A
[    3.155880] systemd[1]: Starting system-serial\x2dgetty.slice.
[    3.156606] systemd[1]: Created slice system-serial\x2dgetty.slice.

sudo cat /proc/tty/driver/serial:
serinfo:1.0 driver revision:
0: uart:U6_16550A mmio:0x01C28000 irq:28 tx:56 rx:0 RTS|DTR
1: uart:unknown port:00000000 irq:0
2: uart:unknown port:00000000 irq:0
3: uart:unknown port:00000000 irq:0
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0

We've mistaken in the first Anthony's post, it's not uart0 that we want to enable, but uart2.

 

Regards,

Nathanaël.

Share this post


Link to post
Share on other sites

Sorry for the late answer.

 

We've already seen this solution but our syntax doesn't match with your exemples.

For exemple, for the UART0, we have this :

pinctrl@01c20800 {
...
uart0@0 {
	allwinner,pins = "PB22", "PB23";
	allwinner,function = "uart0";
	allwinner,drive = <0x0>;
	allwinner,pull = <0x0>;
	linux,phandle = <0x29>;
	phandle = <0x29>;
};
...
};
...
serial@01c28000 {
	compatible = "snps,dw-apb-uart";
	reg = <0x1c28000 0x400>;
	interrupts = <0x1>;
	reg-shift = <0x2>;
	reg-io-width = <0x4>;
	clocks = <0x28 0x10>;
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <0x29>;
};


instead of :

uart0: serial@01c28000 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_pins_a>;
        status = "okay";
};

So we tried to add this to enable the UART2, but it failed :

pinctrl@01c20800 {
...
uart2@0 {
	allwinner,pins = "PI18", "PI19";
	allwinner,function = "uart2";
	allwinner,drive = <0x0>;
	allwinner,pull = <0x0>;
	linux,phandle = <0x30>;
	phandle = <0x30>;
};
...
};
...
serial@01c28800 {
	compatible = "snps,dw-apb-uart";
	reg = <0x1c28800 0x400>;
	interrupts = <0x3>;
	reg-shift = <0x2>;
	reg-io-width = <0x4>;
	clocks = <0x28 0x12>;
	pinctrl-names = "default";
	pinctrl-0 = <0x30>;
	status = "okay";
};

When we try your exemple, we have this error during the compilation :

ERROR (phandle_references): Reference to non-existent node or label "uart2_pins_a"

ERROR: Input tree has errors, aborting (use -f to force output)

And when we replace "uart2_pins_a" by 0x30 (to match with the uart2 phandle), it compiles but doesn't work, and the previous command return the same things (dmesg and cat on /proc/tty/driver/serial).

Share this post


Link to post
Share on other sites

The example above was rather old and I would suspect some stuff has changed in the meantime. I just had a short look into the .dts file from kernel 4.1.x and there sun4i-a10.dtsi is included.

 

Maybe it helps to add the definition there:

			uart2_pins_a: uart2@0 {
				allwinner,pins = "PC18", "PC19";
				allwinner,function = "uart2";
				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
			};

And then reference it from the Lime's .dts as

uart2: {
  pinctrl-names = "default";
  pinctrl-0 = <&uart2_pins_a>;
  status = "okay";
};

?

Share this post


Link to post
Share on other sites

It doesn't work either.

In the first part, I replace "SUN4I_PINCTRL_10_MA" and "SUN4I_PINCTRL_NO_PULL" by  0x0 because the compiler doesn't know these references and raise an error.

I also add "serial@01c28800" after the alias "uart2:" and then it compiles without errors.

But when tested, the previous command (dmesg and the cat) return the same things again.

Share this post


Link to post
Share on other sites

Hi !

 

We finnaly find how to manage this.

I tried to boot with sun5i-a10s-olinuxino-micro.dtb in place of sun4i-a10-olinuxion-lime.dtb , because uart2 was defined in that file, but that doesn't work. So I picked those part in sun5i :

uart2@0 {
	allwinner,pins = "PC18", "PC19";
	allwinner,function = "uart2";
	allwinner,drive = <0x0>;
	allwinner,pull = <0x0>;
	linux,phandle = <0x24>;
	phandle = <0x24>;
};
...
serial@01c28800 {
	compatible = "snps,dw-apb-uart";
	reg = <0x1c28800 0x400>;
	interrupts = <0x3>;
	reg-shift = <0x2>;
	reg-io-width = <0x4>;
	clocks = <0x22 0x12>;
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <0x24>;
};

and put it in sun4i with the correct modifications to match with the other definitions :

uart2@0 {
	allwinner,pins = "PI18", "PI19";
	allwinner,function = "uart2";
	allwinner,drive = <0x0>;
	allwinner,pull = <0x0>;
	linux,phandle = <0x30>;
	phandle = <0x30>;
};
...
serial@01c28800 {
	compatible = "snps,dw-apb-uart";
	reg = <0x1c28800 0x400>;
	interrupts = <0x3>;
	reg-shift = <0x2>;
	reg-io-width = <0x4>;
	clocks = <0x28 0x12>;
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <0x30>;
};

And it works fine !

 

Thank you for your help on that problem,

Nathanaël.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
1 1