W dniu 2018-11-15 o 11:14, Uwe Kleine-König pisze:
On Thu, Nov 15, 2018 at 10:28:02AM +0100, Adam Rudziński wrote:
W dniu 2018-11-15 o 10:08, Uwe Kleine-König pisze:
On Thu, Nov 15, 2018 at 09:30:40AM +0100, Adam Rudziński wrote:
W dniu 2018-11-15 o 08:36, Uwe Kleine-König pisze:
Hello,
On Wed, Nov 14, 2018 at 11:33:25PM +0100, Adam Rudziński wrote:
returning to our discussion on incorrect handling of CTSb used as "driver
enable" by SERIAL_IMX driver in RS485 mode, I've made the fix I was able to,
ie. the simple one with just keeping the receiver of the UART on. Eventually
this got tested in action and worked fine.
The kernel I used is a version of ancient 4.14.39, possibly with some
vendor-specific patches. I tried to compare it with the most recent
long-term 4.14.81, but there are changes which I can't interpret without
deeper studies (however, it seems to me that the original problem would
still be present). Newer kernels have even more differences.
If such fix could be useful, and somebody feels like undertaking the effort
to implement it in a proper way, the fix can be found under this address
(along with a short description):
http://arf.net.pl/iMX6/RS485fix.html
How does the relevant part of your dts look like? Did you try to use a
gpio instead of the hardware function "CTS" as rts?
Best regards
Uwe
It goes like this, first in dtsi:
&uart5 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart5>;
uart-has-rtscts;
status = "disabled";
};
and then in dts for the board:
&uart5 {
rs485-rts-active-high;
linux,rs485-enabled-at-boot-time;
status = "okay";
};
Then try adding
rts-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
to your board's dts and adapt the pinctrol accordingly to configure the
cts pin to it's GPIO function instead of CTS. There should be no need to
adapt the driver for that.
The driver controls the CTS pin by setting a field in one of UART-related
registers. To me it looks like it can't be just simply "reconfigured" to use
GPIO. Do I underestimate it?
No, but the driver does both, poking the UART register and drive a gpio.
See https://git.kernel.org/linus/58362d5be35216f196b4a4d16aa2c6ef938087f0
Best regards
Uwe
Oh, nice! I thought this only sets some "flags".
I'll check that at the next opportunity and let you know if it works.
Best regards,
Adam