IRC #olimex 2019-03-02

[20:59:49] <Antitrack> Tsvetan: I told you - we WOULD be very happy with the new 4.x kernel, PROVIDED that you help us to get /dev/ttyS1=uart2 to work, our hardware NEEDS it, as well as PB00 under /sys/class... etc.
[21:03:21] <Wizzup> if you just need more uarts to work on mainline, it should be a simple dts change.
[21:03:47] <Antitrack> yes but not simple for ME, I tried for 9 hrs and I could not get the uart to work
[21:04:26] <Antitrack> I edited the f* out of the darn*d dtb/dts file, recompiled it with dtc, rebooted, to no avail, uart2 kept being unusable
[21:05:59] <Wizzup>
[21:06:02] <Wizzup>
[21:06:47] <Wizzup> I am also not a dts hero, but try this at the bottom of the lime2 dts:
[21:06:49] <Wizzup> &uart2 {
[21:06:49] <Wizzup> pinctrl-names = "default";
[21:06:49] <Wizzup> pinctrl-0 = <&uart2_pi_pins>;
[21:06:49] <Wizzup> status = "okay";
[21:06:51] <Wizzup> };
[21:07:09] <Antitrack> okay
[21:07:24] <Antitrack> will try when my boss is back from cyprus
[21:07:28] <Wizzup> please check the pins against my first link
[21:07:47] <Wizzup> you might want uart3 or other instead
[21:07:53] <Antitrack> pb22,23... what to do if they are not pb22/23?
[21:07:53] <Wizzup> (just verify it)
[21:08:09] <Wizzup> well, what pins is your uart at
[21:08:23] <Wizzup> see also
[21:08:33] <lukas2511> Antitrack: also consider that uart2 might by under ttyS2, if you need it to be ttyS1 you can do that using udev
[21:09:08] <Antitrack> in the old script.fex/.bin it was simply |uart_para2] uart_used=1
[21:09:43] <Wizzup> then probably these pins are the same. you hae a lime2, right?
[21:10:09] <Antitrack> [uart_para2]
[21:10:11] <Antitrack> uart_used = 1
[21:10:13] <Antitrack> uart_port = 2
[21:10:15] <Antitrack> uart_type = 4
[21:10:17] <Antitrack> uart_tx = port:PI18<3><1><default><default>
[21:10:19] <Antitrack> uart_rx = port:PI19<3><1><default><default>
[21:10:21] <Antitrack> uart_rts = port:PI16<3><1><default><default>
[21:10:23] <Antitrack> uart_cts = port:PI17<3><1><default><default>
[21:10:25] <Antitrack> yep, lime2 emmc 5.1 rev k1
[21:10:31] <Wizzup> those are typically for spi
[21:10:39] <Wizzup> I think
[21:10:43] <Antitrack> thats why we disabled spi
[21:10:47] <Wizzup> but you can probably just look at the dts I linked above
[21:10:55] <Antitrack> [spi1_para] spi_used=0
[21:11:47] <Wizzup> this will be slightly more tricky than just adding the single line then, you need to add (or modify) the pin def for your uart, set the function, define them, and then use the right pinctrl-0
[21:11:53] <Wizzup>
[21:11:54] <lukas2511> Antitrack: well, the thing is, those fex/bin files were used in a customized fork of the linux kernel that was specially modified for the allwinner chips, but i think the newest version is something like Linux 3.10 and it was stuck a long time at 3.4... the normal linux kernel doesn't use those fex/bin files, it uses generalized device-tree files that work with basically all ARM and similar boards compatible
[21:11:56] <lukas2511> with the linux kernel. it might make it a bit harder to access those settings, but it's a lot better considering the whole picture. if you want a newer kernel version than 3.10 you don't really have any choice but to work with those device tree files
[21:11:59] <Wizzup> compare with uart below
[21:12:28] <Antitrack> lukas, correct, we are "stuck" at the kernel 3.4
[21:12:52] <Antitrack> I do want to use these devtree files but I have no clue :D
[21:13:03] <lukas2511> i can send you the patch i did to my device-tree file to get uart2 working
[21:13:14] <Wizzup> but he wants it on different pins
[21:13:41] <lukas2511> oh
[21:13:42] <Antitrack> yer welcome to send me the patch
[21:13:50] <Antitrack> att1 at gmx dot net
[21:14:29] <lukas2511> what pins do you need it on?
[21:15:04] <Antitrack> lukas2511: tx=pi18, rx=pi19, rts=pi16 cts=pi17
[21:15:07] <Antitrack> see above
[21:15:16] <Antitrack> I already copy pasted the script.fex
[21:15:48] <lukas2511> well those are the normal pins, so that shouldn't be a problem
[21:15:54] <Antitrack> good
[21:24:28] <lukas2511> Antitrack: that's my change for the lime with uart2 available as ttyS1 and using exactly those pins you mentioned earlier. should apply to lime2-emmc exactly the same, only pinctrl-0 might change, you can get the value from the uart2@0 block:
[21:24:30] <lukas2511>
[21:24:49] <Antitrack> thxxx
[21:25:36] <Antitrack> great help, will try whenever my boss is back. :D
[21:27:00] <lukas2511> and if you are building from original dts source (instead of recompiling the existing dtb) you can do it like this: