Bug 58481 - [pandaboard] btwilink - st_register failed -22
Summary: [pandaboard] btwilink - st_register failed -22
Status: RESOLVED OBSOLETE
Alias: None
Product: Drivers
Classification: Unclassified
Component: Bluetooth (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: linux-bluetooth@vger.kernel.org
URL:
Keywords:
: 64751 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-05-18 22:18 UTC by Tobias Jakobi
Modified: 2015-04-10 06:08 UTC (History)
4 users (show)

See Also:
Kernel Version: 3.9.2
Subsystem:
Regression: No
Bisected commit-id:


Attachments
kernel config (63.94 KB, text/plain)
2013-05-18 22:20 UTC, Tobias Jakobi
Details

Description Tobias Jakobi 2013-05-18 22:18:24 UTC
Hello,

I was trying to get bluetooth running on a Pandaboard ES. I turns out that the board does some multiplexing to access WiFi/BT/FM on the same chip, or something.

The correct module for the chip seems to be btwilink, but it needs a userspace application to run (uim from http://gitorious.org/uim/uim).

Relevant dmesg output:
[ 5726.790222] (stc):  chnl_id list empty :4
[ 5726.794403] (stk) : st_kim_start
[ 5726.936126] (stk) :ldisc_install = 1
[ 5727.936859] (stk) :ldisc installation timeout
[ 5727.941497] (stk) :ldisc_install = 0
[ 5728.936859] (stk) : timed out waiting for ldisc to be un-installed
[ 5729.084136] (stk) :ldisc_install = 1
[ 5730.076843] (stk) :ldisc installation timeout
[ 5730.081451] (stk) :ldisc_install = 0
[ 5731.076843] (stk) : timed out waiting for ldisc to be un-installed
[ 5731.224487] (stk) :ldisc_install = 1
[ 5732.216888] (stk) :ldisc installation timeout
[ 5732.221496] (stk) :ldisc_install = 0
[ 5733.216857] (stk) : timed out waiting for ldisc to be un-installed
[ 5733.364471] (stk) :ldisc_install = 1
[ 5734.356872] (stk) :ldisc installation timeout
[ 5734.361480] (stk) :ldisc_install = 0
[ 5735.356872] (stk) : timed out waiting for ldisc to be un-installed
[ 5735.504425] (stk) :ldisc_install = 1
[ 5736.496856] (stk) :ldisc installation timeout
[ 5736.501464] (stk) :ldisc_install = 0
[ 5737.496887] (stk) : timed out waiting for ldisc to be un-installed
[ 5737.644470] (stk) :ldisc_install = 1
[ 5738.636840] (stk) :ldisc installation timeout
[ 5738.641479] (stk) :ldisc_install = 0
[ 5739.636871] (stk) : timed out waiting for ldisc to be un-installed
[ 5739.646026] Bluetooth: st_register failed -22

This is the output generated from inserting btwilink. Before insertion, I double-checked that uim was running.

This is the uim output:
uim:@ main
uim:begin polling...
uim:poll broke due to event 10(PRI:2/ERR:8)

uim:read 1 from install 

uim:@ st_uart_config
uim: signal received, opening /dev/ttyO1
uim:@ set_baud_rate
uim:set_baud_rate() done
uim:Setting speed to 3000000
uim:@ read_command_complete
uim: Command complete started
uim:@ read_hci_event
uim: read_hci_event
uim:Invalid response

--------------------------------------------

So, what seems to happen is the following:
In st_kim_start from drivers/misc/ti-st/st_kim.c, the module notifies uim through sysfs to take action. uim then fires up st_uart_config (in uim.c) which eventually tries to increase the baud rate. For this it sends a speed-set command. It fails when it gets an invalid response.

Greets,
Tobias
Comment 1 Tobias Jakobi 2013-05-18 22:20:08 UTC
Created attachment 101931 [details]
kernel config
Comment 2 Timo Mueller 2013-05-22 11:52:21 UTC
Hi Tobias,

have you installed the wilink chip's firmware? The shared transport driver tries to load it and it times out.

You can download the firmware for the PandaBoard ES here:
http://processors.wiki.ti.com/images/1/18/TIInit_7.6.15-XTAL.zip

On successful install you should get an output like this:
[  129.701354] (stc): st_register(4) 
[  129.705230] (stc):  chnl_id list empty :4 
[  129.709686] (stk) : st_kim_start
[  129.819732] (stk) :ldisc_install = 1
[  129.874694] (stc): st_tty_open 
[  129.878082] (stk) :line discipline installed
[  129.883117] (stk) :TIInit_7.6.15.bts

And in uim:
uim:@ main
uim:begin polling...
uim:poll broke due to event 10(PRI:2/ERR:8)

uim:read 1 from install 

uim:@ st_uart_config
uim: signal received, opening /dev/ttyO1
uim:@ set_baud_rate
uim:set_baud_rate() done
uim:Setting speed to 3000000
uim:@ read_command_complete
uim: Command complete started
uim:@ read_hci_event
uim: read_hci_event
uim:Command complete done
uim:Speed changing to 3000000, 1
uim:@ set_custom_baud_rate
uim:Installed N_TI_WL Line displine
uim:begin polling...
uim:poll broke due to event 10(PRI:2/ERR:8)

uim:read 0 from install 

uim:@ st_uart_config
uim:Un-Installed N_TI_WL Line displine
uim:begin polling...


I hope this helps.

Best regards,
Timo
Comment 3 Tobias Jakobi 2013-05-22 13:08:23 UTC
I can double-check this, but if I'm reading the code in st_kim.c correctly, then firmware loading comes _after_ the part that fails. It's not the firmware loading that times out, but the UART setup.
Comment 4 Tobias Jakobi 2013-05-22 21:42:18 UTC
No, this isn't related to the firmware loading at all.

The issue is here:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/misc/ti-st/st_kim.c?id=refs/tags/v3.9.3#n484

The line discipline installation times out. FW loading comes after that, but it'S never reached in my case.

Maybe this also related to me not using device tree booting?
Comment 5 eyalreizer 2013-05-23 10:39:50 UTC
Hi,

I understand that you are working without DT and your platform data initialization is done in the board file (arch/arm/mach-omap2/board-omap4panda.c
) ,right? 

It looks like you are not getting a response to the HCI command sent to the wilink chip over UART.
Can you make sure that the BT_Enable pin is also muxed correctly and you see it "high" when UART conversation starts?

Anyway for 3.9 the right thing to do would be to switch to using DT, however device tree support is still missing for the ti-st and btwilink driver and the device tree bindings for kim and btwilink are not yet in the .dtb files

I have just made the modifications to ti-st and btwilink and got bluetooth to work for omap5-uevm, but this is no up-streamed yet.

Best Regards,
Eyal Reizer
Comment 6 Tobias Jakobi 2013-05-23 13:20:57 UTC
(In reply to comment #5)
> It looks like you are not getting a response to the HCI command sent to the
> wilink chip over UART.
> Can you make sure that the BT_Enable pin is also muxed correctly and you see
> it
> "high" when UART conversation starts?
How would I do that? I can very well read the kernel sourcecode, but I know nothing about UART programming and stuff.

> Anyway for 3.9 the right thing to do would be to switch to using DT, however
> device tree support is still missing for the ti-st and btwilink driver and
> the
> device tree bindings for kim and btwilink are not yet in the .dtb files
I tried DT, but as you can see in bug #58611 it currently doesn't work for me, even with the 3.10 release candidate. But if I understand you correctly, in the current situation DT wouldn't really help me.

> I have just made the modifications to ti-st and btwilink and got bluetooth to
> work for omap5-uevm, but this is no up-streamed yet.
If you have some patches for the panda-es, I would be happy to test them!

Greets,
Tobias
Comment 7 Alan 2013-11-12 15:28:44 UTC
*** Bug 64751 has been marked as a duplicate of this bug. ***
Comment 8 Tobias Jakobi 2013-11-28 23:18:01 UTC
Since bug #64751 was closed, I think I'm supposed to post here.

Update with 3.13-rc1: No changes at all. kim node in /sys/devices/platform still not created.
Comment 9 Tobias Jakobi 2014-02-28 20:33:01 UTC
Update with 3.14-rc4: ti-st is still missing DT support, so no kim node created and therefore no working BT.
Comment 10 Tobias Jakobi 2014-05-01 11:46:13 UTC
Retested with 3.15.0-rc3 and the issue is still present.
Comment 11 Enric Balletbo i Serra 2014-07-18 11:42:23 UTC
I tested with 3.15.0 and the issue is still present.

Also I'm sure that BT Enable is muxed correctly and I see that it is "high" when UART conversation starts (checked with an oscilloscope).
Comment 12 Tobias Jakobi 2014-10-11 20:37:16 UTC
Abandoning, since I don't own the device anymore.
Comment 13 Youxin Su 2015-04-10 06:08:39 UTC
Fixed this bug by adding pads mux contorl settings. In case someone need it.

From dc8b041e2a99bc8aead49a7130b17a2f2ba9d231 Mon Sep 17 00:00:00 2001
From: Youxin Su <suyouxin@aiotec.co.nz>
Date: Fri, 10 Apr 2015 16:56:13 +1200
Subject: [PATCH 1/2] Add UART2 pads configuration, BT works fine

---
 arch/arm/boot/dts/omap4-panda-common.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi
index 1505135..02e9d21 100644
--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
+++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
@@ -351,6 +351,15 @@
 			0x112 (PIN_INPUT_PULLUP | MUX_MODE0)	/* sdmmc5_dat3.sdmmc5_dat3 */
 		>;
 	};
+
+	uart2_pins: pinmux_uart2_pins {
+		pinctrl-single,pins = <
+			0xd8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart2_cts.uart2_cts */
+			0xda (PIN_OUTPUT | MUX_MODE0)		/* uart2_rts.uart2_rts */
+			0xdc (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart2_rx.uart2_rx */
+			0xde (PIN_OUTPUT | MUX_MODE0)		/* uart2_tx.uart2_tx */
+		>;
+	};
 };
 
 &omap4_pmx_wkup {
@@ -481,6 +490,8 @@
 &uart2 {
 	interrupts-extended = <&gic GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH
 			       &omap4_pmx_core OMAP4_UART2_RX>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart2_pins>;
 };
 
 &uart3 {
-- 
1.9.1

Note You need to log in before you can comment on or make changes to this bug.