This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How do I get Bluetooth working on WL1835 on a board other than AM33?

Other Parts Discussed in Thread: WL1835MOD, WL1835

I have the following entries in my DTS file:

wlan_en_reg: fixedregulator@1 {
compatible = "regulator-fixed";
regulator-name = "wlan-en-regulator";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;

/* WLAN_EN GPIO for this board - Bank A, pin 4 */
gpio = <&pioA 4 0>;

/* WLAN card specific delay */
startup-delay-us = <70000>;
enable-active-high;
};

wlcore {
compatible = "wlcore";
gpio = <14>; /* Bank A, pin 14 connected to IRQ line of WL1835MOD */

/*
* TODO: use edge irqs for suspend/resume.
* in newer kerenls, we seem to miss interrupts when
* working with edge irqs, so revert back to level irqs.
*/
/*platform-quirks = <1>;*/

/* if a 12xx card is there, configure the clock to
WL12XX_REFCLOCK_38_XTAL */
/*
board-ref-clock = <4>;
*/

/* For WL1835MOD, WL12XX_REFCLOCK_26_XTAL */
board-ref-clock = <5>;
};

kim {
compatible = "kim";
nshutdown_gpio = <29>; /* Bank A, pin 29 */
dev_name = "/dev/ttyO1";
flow_cntrl = <1>;
baud_rate = <3000000>;
};

btwilink {
compatible = "btwilink";
};

I also installed the BTS file to /lib/firmware as described in another forum post (http://e2e.ti.com/support/wireless_connectivity/f/307/t/361507).

After the system is booted, I modprobe btwilink, and it loads successfully.

What else do I need to do before I can use our Bluez (v4.98) stack to bring up the hci0 device?

I've looked all over your wiki and forums, and it all seems to assume a TI board, and use of the Bluetopia stack, neither of which we will be using.

  • Hi,

    I hope you are using blueZ? make sure you have applied the first three patch from the below link
    http://processors.wiki.ti.com/index.php?title=WL18xx_AMxxx_platform_integration_guide#Kernel_integration_with_sdk7.0_Linux_3.12

    and make sure UIM is built and running, and latest ST patches are applied, see below similar discussion for Am335x, same applies for other platforms as well
    http://e2e.ti.com/support/wireless_connectivity/f/307/p/381933/1354602#pi239031348=2
  • Hi Sundeep,

    > I hope you are using blueZ?

    As I mentioned in my post, we are using BlueZ 4.98.

    > make sure you have applied the first three patch from the below link
    http://processors.wiki.ti.com/index.php?title=WL18xx_AMxxx_platform_integration_guide#Kernel_integration_with_sdk7.0_Linux_3.12

    The contents of the first patch in that table have already been taken care of by using DTS snippets taken from your wiki (http://processors.wiki.ti.com/index.php/WL18xx_Platform_Integration_Guide) and modified, as shown above. I applied the second patch (adding tty_hci functionality) to our kernel source. I also changed our corresponding defconfig to match the change in the third patch in that table.

    I also applied all of the patches that you described here:
    http://e2e.ti.com/support/wireless_connectivity/f/307/p/381933/1354602#1354602

    The system was booting normally, with the WiFi functionality operational. After adding all of the recommended patches, I can no longer boot successfully. I get pages of stack traces (attached), which seem to point to the btwilink changes.

    Am I missing something?

    Thanks,
    Bijoy
  • Hi,

    After adding the changes you are not able to boot normally, right? Do you have some logs that you can share?
  • Sandeep,

    I tried to attach my logs yesterday, but I couldn't find a menu option to add an attachment in your new forum.

    How do I attach files?

    Thanks,
    Bijoy
  • Hi,

    When you click on relay option, You should see the "Use rich formatting" option, click on it. and in the rich text format you will see "Insert/Edit Media" option, which can be used to attach the files.

  • boot_fail_after_applying_ti_patches.txt

    Ok, the log file should be attached now.  Previously when I tried to use the rich text editor, clicking the link did nothing for a long time, then finally dumped me out to a "page not found" error URL.

    Anyway, before I even try to get the whole system working, I'd like to simply get my hci0 interface up and running.

    To that end, here's what I've done so far (I backed out the patches for now):
    * I have an application that hooks sysfs and toggles GPIO lines for me, which I have confirmed (with a meter) is actually toggling BT_EN as expected.
    * After raising BT_EN, I modprobe btwilink (I understand that without the patches, there are no DT calls happening).
    * I confirm that TIInit_11.8.32.bts is in /lib/firmware as it should be.  Permissions are 0644.
    * I then execute "hciattach -s 115200 /dev/ttyS1 texas 3000000" which always fails with the error "Initialization timed out." after 10+ seconds.

    Do I need to use UIM if I am running our BlueZ 4.98 stack?  Or is that only for the Stonestreet stack?

    Please advise.

  • Hi,

    I did not see the device booting up, It is stopped, Please make sure you have applied the patches properly.
    just wanted to make sure you that you have enabled "CONFIG_BT_WILINK" in you config file.

    for BlueZ also you would require UIM. You can try "hciconfig hci0 up"
  • Sandeep,

    Yes, as I already said, it will not boot up completely with those patches applied.

    First, please comment on the steps I have already taken (which I described in my previous post).  If I have done anything incorrectly, or made any bad assumptions, I want to correct that now, before we move on.

    RE:  your questions -- yes, CONFIG_BT_WILINK is enabled, and "hciconfig hci0 up" results in this error:

    # hciconfig hci0 up
    Can't get device info: No such device

    I am attaching the actual patch set I applied (based on the 5 patches you suggested) to our 3.12.13 kernel.  Please comment on that as well.

    Thanks,
    Bijoy

    Index: linux-3.12.13/drivers/bluetooth/btwilink.c
    ===================================================================
    --- linux-3.12.13.orig/drivers/bluetooth/btwilink.c
    +++ linux-3.12.13/drivers/bluetooth/btwilink.c
    @@ -30,6 +30,7 @@
     
     #include <linux/ti_wilink_st.h>
     #include <linux/module.h>
    +#include <linux/of.h>
     
     /* Bluetooth Driver Version */
     #define VERSION               "1.0"
    @@ -291,6 +292,14 @@ static int ti_st_send_frame(struct sk_bu
     	return 0;
     }
     
    +static const struct of_device_id btwilink_of_match[] = {
    +{
    +	.compatible = "btwilink",
    +	},
    +	{}
    +};
    +MODULE_DEVICE_TABLE(of, btwilink_of_match);
    +
     static int bt_ti_probe(struct platform_device *pdev)
     {
     	static struct ti_st *hst;
    @@ -355,6 +364,7 @@ static struct platform_driver btwilink_d
     	.driver = {
     		.name = "btwilink",
     		.owner = THIS_MODULE,
    +		.of_match_table = of_match_ptr(btwilink_of_match),
     	},
     };
     
    Index: linux-3.12.13/drivers/misc/ti-st/st_kim.c
    ===================================================================
    --- linux-3.12.13.orig/drivers/misc/ti-st/st_kim.c
    +++ linux-3.12.13/drivers/misc/ti-st/st_kim.c
    @@ -36,7 +36,8 @@
     #include <linux/skbuff.h>
     #include <linux/ti_wilink_st.h>
     #include <linux/module.h>
    -
    +#include <linux/of.h>
    +#include <linux/of_device.h>
     
     #define MAX_ST_DEVICES	3	/* Imagine 1 on each UART for now */
     static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
    @@ -44,6 +45,9 @@ static struct platform_device *st_kim_de
     /**********************************************************************/
     /* internal functions */
     
    +struct ti_st_plat_data	*dt_pdata;
    +static struct ti_st_plat_data *get_platform_data(struct device *dev);
    +
     /**
      * st_get_plat_device -
      *	function which returns the reference to the platform device
    @@ -461,7 +465,12 @@ long st_kim_start(void *kim_data)
     	struct kim_data_s	*kim_gdata = (struct kim_data_s *)kim_data;
     
     	pr_info(" %s", __func__);
    -	pdata = kim_gdata->kim_pdev->dev.platform_data;
    +	if (kim_gdata->kim_pdev->dev.of_node) {
    +		pr_debug("use device tree data");
    +		pdata = dt_pdata;
    +	} else {
    +		pdata = kim_gdata->kim_pdev->dev.platform_data;
    +	}
     
     	do {
     		/* platform specific enabling code here */
    @@ -521,12 +530,18 @@ long st_kim_stop(void *kim_data)
     {
     	long err = 0;
     	struct kim_data_s	*kim_gdata = (struct kim_data_s *)kim_data;
    -	struct ti_st_plat_data	*pdata =
    -		kim_gdata->kim_pdev->dev.platform_data;
    +	struct ti_st_plat_data	*pdata;
     	struct tty_struct	*tty = kim_gdata->core_data->tty;
     
     	INIT_COMPLETION(kim_gdata->ldisc_installed);
     
    +	if (kim_gdata->kim_pdev->dev.of_node) {
    +		pr_debug("use device tree data");
    +		pdata = dt_pdata;
    +	} else
    +		pdata = kim_gdata->kim_pdev->dev.platform_data;
    +
    +
     	if (tty) {	/* can be called before ldisc is installed */
     		/* Flush any pending characters in the driver and discipline. */
     		tty_ldisc_flush(tty);
    @@ -715,13 +730,53 @@ static const struct file_operations list
      * board-*.c file
      */
     
    +static const struct of_device_id kim_of_match[] = {
    +{
    +	.compatible = "kim",
    +	},
    +	{}
    +};
    +MODULE_DEVICE_TABLE(of, kim_of_match);
    +
    +static struct ti_st_plat_data *get_platform_data(struct device *dev)
    +{
    +	struct device_node *np = dev->of_node;
    +	const u32 *dt_property;
    +	int len;
    +
    +	dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
    +
    +	if (!dt_pdata)
    +		pr_err("Can't allocate device_tree platform data\n");
    +
    +	dt_property = of_get_property(np, "dev_name", &len);
    +	if (dt_property)
    +		memcpy(&dt_pdata->dev_name, dt_property, len);
    +	of_property_read_u32(np, "nshutdown_gpio",
    +			     (u32 *)&dt_pdata->nshutdown_gpio);
    +	of_property_read_u32(np, "flow_cntrl", (u32 *)&dt_pdata->flow_cntrl);
    +	of_property_read_u32(np, "baud_rate", (u32 *)&dt_pdata->baud_rate);
    +
    +	return dt_pdata;
    +}
    +
     static struct dentry *kim_debugfs_dir;
     static int kim_probe(struct platform_device *pdev)
     {
     	struct kim_data_s	*kim_gdata;
    -	struct ti_st_plat_data	*pdata = pdev->dev.platform_data;
    +	struct ti_st_plat_data	*pdata;
     	int err;
     
    +	if (pdev->dev.of_node)
    +		pdata = get_platform_data(&pdev->dev);
    +	else
    +		pdata = pdev->dev.platform_data;
    +
    +	if (pdata == NULL) {
    +		dev_err(&pdev->dev, "Platform Data is missing\n");
    +		return -ENXIO;
    +	}
    +
     	if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) {
     		/* multiple devices could exist */
     		st_kim_devices[pdev->id] = pdev;
    @@ -807,9 +862,16 @@ err_core_init:
     static int kim_remove(struct platform_device *pdev)
     {
     	/* free the GPIOs requested */
    -	struct ti_st_plat_data	*pdata = pdev->dev.platform_data;
    +	struct ti_st_plat_data	*pdata;
     	struct kim_data_s	*kim_gdata;
     
    +	if (pdev->dev.of_node) {
    +		pr_debug("use device tree data");
    +		pdata = dt_pdata;
    +	} else {
    +		pdata = pdev->dev.platform_data;
    +	}
    +
     	kim_gdata = platform_get_drvdata(pdev);
     
     	/* Free the Bluetooth/FM/GPIO
    @@ -827,27 +889,44 @@ static int kim_remove(struct platform_de
     
     	kfree(kim_gdata);
     	kim_gdata = NULL;
    +	kfree(dt_pdata);
    +	dt_pdata = NULL;
    +
     	return 0;
     }
     
     static int kim_suspend(struct platform_device *pdev, pm_message_t state)
     {
    -	struct ti_st_plat_data	*pdata = pdev->dev.platform_data;
    +	struct ti_st_plat_data	*pdata;
    +
    +	if (pdev->dev.of_node) {
    +		pr_debug("use device tree data");
    +		pdata = dt_pdata;
    +	} else {
    +		pdata = pdev->dev.platform_data;
    +	}
     
     	if (pdata->suspend)
     		return pdata->suspend(pdev, state);
     
    -	return -EOPNOTSUPP;
    +	return 0;
     }
     
     static int kim_resume(struct platform_device *pdev)
     {
    -	struct ti_st_plat_data	*pdata = pdev->dev.platform_data;
    +	struct ti_st_plat_data	*pdata;
    +
    +	if (pdev->dev.of_node) {
    +		pr_debug("use device tree data");
    +		pdata = dt_pdata;
    +	} else {
    +		pdata = pdev->dev.platform_data;
    +	}
     
     	if (pdata->resume)
     		return pdata->resume(pdev);
     
    -	return -EOPNOTSUPP;
    +	return 0;
     }
     
     /**********************************************************************/
    @@ -860,6 +939,7 @@ static struct platform_driver kim_platfo
     	.driver = {
     		.name = "kim",
     		.owner = THIS_MODULE,
    +		.of_match_table = of_match_ptr(kim_of_match),
     	},
     };
     
    Index: linux-3.12.13/drivers/misc/ti-st/st_ll.c
    ===================================================================
    --- linux-3.12.13.orig/drivers/misc/ti-st/st_ll.c
    +++ linux-3.12.13/drivers/misc/ti-st/st_ll.c
    @@ -53,7 +53,13 @@ static void ll_device_want_to_sleep(stru
     
     	/* communicate to platform about chip asleep */
     	kim_data = st_data->kim_data;
    -	pdata = kim_data->kim_pdev->dev.platform_data;
    +	if (kim_data->kim_pdev->dev.of_node) {
    +		pr_debug("use device tree data");
    +		pdata = dt_pdata;
    +	} else {
    +		pdata = kim_data->kim_pdev->dev.platform_data;
    +	}
    +
     	if (pdata->chip_asleep)
     		pdata->chip_asleep(NULL);
     }
    @@ -86,7 +92,13 @@ static void ll_device_want_to_wakeup(str
     
     	/* communicate to platform about chip wakeup */
     	kim_data = st_data->kim_data;
    -	pdata = kim_data->kim_pdev->dev.platform_data;
    +	if (kim_data->kim_pdev->dev.of_node) {
    +		pr_debug("use device tree data");
    +		pdata = dt_pdata;
    +	} else {
    +			pdata = kim_data->kim_pdev->dev.platform_data;
    +	}
    +
     	if (pdata->chip_awake)
     		pdata->chip_awake(NULL);
     }
    Index: linux-3.12.13/include/linux/ti_wilink_st.h
    ===================================================================
    --- linux-3.12.13.orig/include/linux/ti_wilink_st.h
    +++ linux-3.12.13/include/linux/ti_wilink_st.h
    @@ -86,6 +86,7 @@ struct st_proto_s {
     extern long st_register(struct st_proto_s *);
     extern long st_unregister(struct st_proto_s *);
     
    +extern struct ti_st_plat_data   *dt_pdata;
     
     /*
      * header information used by st_core.c
    Index: linux-3.12.13/drivers/misc/ti-st/Kconfig
    ===================================================================
    --- linux-3.12.13.orig/drivers/misc/ti-st/Kconfig
    +++ linux-3.12.13/drivers/misc/ti-st/Kconfig
    @@ -14,4 +14,12 @@ config TI_ST
     	  are returned to relevant protocol drivers based on their
     	  packet types.
     
    +config ST_HCI
    +	tristate "HCI TTY emulation driver for Bluetooth"
    +	depends on TI_ST
    +	help
    +	  This enables the TTY device like emulation for HCI used by
    +	  user-space Bluetooth stacks.
    +	  It will provide a character device for user space Bluetooth stack to
    +	  send/receive data over shared transport.
     endmenu
    Index: linux-3.12.13/drivers/misc/ti-st/Makefile
    ===================================================================
    --- linux-3.12.13.orig/drivers/misc/ti-st/Makefile
    +++ linux-3.12.13/drivers/misc/ti-st/Makefile
    @@ -4,3 +4,4 @@
     #
     obj-$(CONFIG_TI_ST) 		+= st_drv.o
     st_drv-objs			:= st_core.o st_kim.o st_ll.o
    +obj-$(CONFIG_ST_HCI)		+= tty_hci.o
    Index: linux-3.12.13/drivers/misc/ti-st/tty_hci.c
    ===================================================================
    --- /dev/null
    +++ linux-3.12.13/drivers/misc/ti-st/tty_hci.c
    @@ -0,0 +1,547 @@
    +/*
    + *  TTY emulation for user-space Bluetooth stacks over HCI-H4
    + *  Copyright (C) 2011-2012 Texas Instruments
    + *  Author: Pavan Savoy <pavan_savoy@ti.com>
    + *
    + *  This program is free software; you can redistribute it and/or modify
    + *  it under the terms of the GNU General Public License version 2 as
    + *  published by the Free Software Foundation.
    + *
    + *  This program is distributed in the hope that it will be useful,
    + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + *  GNU General Public License for more details.
    + *
    + *  You should have received a copy of the GNU General Public License
    + *  along with this program; if not, write to the Free Software
    + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    + *
    + */
    +
    +/** define one of the following for debugging
    +#define DEBUG
    +#define VERBOSE
    +*/
    +
    +#define pr_fmt(fmt) "(hci_tty): " fmt
    +#include <linux/module.h>
    +#include <linux/cdev.h>
    +#include <linux/fs.h>
    +#include <linux/device.h>
    +
    +#include <linux/uaccess.h>
    +#include <linux/tty.h>
    +#include <linux/sched.h>
    +
    +#include <linux/delay.h>
    +#include <linux/firmware.h>
    +#include <linux/platform_device.h>
    +#include <linux/poll.h>
    +#include <linux/skbuff.h>
    +#include <linux/interrupt.h>
    +
    +#include <linux/ti_wilink_st.h>
    +
    +/* Number of seconds to wait for registration completion
    + * when ST returns PENDING status.
    + */
    +#define BT_REGISTER_TIMEOUT   6000	/* 6 sec */
    +
    +/**
    + * struct ti_st - driver operation structure
    + * @hdev: hci device pointer which binds to bt driver
    + * @reg_status: ST registration callback status
    + * @st_write: write function provided by the ST driver
    + *	to be used by the driver during send_frame.
    + * @wait_reg_completion - completion sync between ti_st_open
    + *	and st_reg_completion_cb.
    + */
    +struct ti_st {
    +	struct hci_dev *hdev;
    +	char reg_status;
    +	long (*st_write) (struct sk_buff *);
    +	struct completion wait_reg_completion;
    +	wait_queue_head_t data_q;
    +	struct sk_buff_head rx_list;
    +};
    +
    +#define DEVICE_NAME     "hci_tty"
    +
    +/***********Functions called from ST driver**********************************/
    +/* Called by Shared Transport layer when receive data is
    + * available */
    +static long st_receive(void *priv_data, struct sk_buff *skb)
    +{
    +	struct ti_st	*hst = (void *)priv_data;
    +
    +	pr_debug("@ %s", __func__);
    +#ifdef VERBOSE
    +	print_hex_dump(KERN_INFO, ">rx>", DUMP_PREFIX_NONE,
    +		       16, 1, skb->data, skb->len, 0);
    +#endif
    +	skb_queue_tail(&hst->rx_list, skb);
    +	wake_up_interruptible(&hst->data_q);
    +	return 0;
    +}
    +
    +/* Called by ST layer to indicate protocol registration completion
    + * status.ti_st_open() function will wait for signal from this
    + * API when st_register() function returns ST_PENDING.
    + */
    +static void st_reg_completion_cb(void *priv_data, char data)
    +{
    +	struct ti_st	*lhst = (void *)priv_data;
    +
    +	pr_info("@ %s\n", __func__);
    +	/* Save registration status for use in ti_st_open() */
    +	lhst->reg_status = data;
    +	/* complete the wait in ti_st_open() */
    +	complete(&lhst->wait_reg_completion);
    +}
    +
    +/* protocol structure registered with shared transport */
    +#define MAX_BT_CHNL_IDS 3
    +static struct st_proto_s ti_st_proto[MAX_BT_CHNL_IDS] = {
    +	{
    +		.chnl_id = 0x04, /* HCI Events */
    +		.hdr_len = 2,
    +		.offset_len_in_hdr = 1,
    +		.len_size = 1, /* sizeof(plen) in struct hci_event_hdr */
    +		.reserve = 8,
    +	},
    +	{
    +		.chnl_id = 0x02, /* ACL */
    +		.hdr_len = 4,
    +		.offset_len_in_hdr = 2,
    +		.len_size = 2,	/* sizeof(dlen) in struct hci_acl_hdr */
    +		.reserve = 8,
    +	},
    +	{
    +		.chnl_id = 0x03, /* SCO */
    +		.hdr_len = 3,
    +		.offset_len_in_hdr = 2,
    +		.len_size = 1, /* sizeof(dlen) in struct hci_sco_hdr */
    +		.reserve = 8,
    +	},
    +};
    +/** hci_tty_open Function
    + *  This function will perform an register on ST driver.
    + *
    + *  Parameters :
    + *  @file  : File pointer for BT char driver
    + *  @inod  :
    + *  Returns  0 -  on success
    + *           else suitable error code
    + */
    +int hci_tty_open(struct inode *inod, struct file *file)
    +{
    +	int i = 0, err = 0;
    +	unsigned long timeleft;
    +	struct ti_st *hst;
    +
    +	pr_info("inside %s (%p, %p)\n", __func__, inod, file);
    +
    +	hst = kzalloc(sizeof(*hst), GFP_KERNEL);
    +	file->private_data = hst;
    +	hst = file->private_data;
    +
    +	for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
    +		ti_st_proto[i].priv_data = hst;
    +		ti_st_proto[i].max_frame_size = 1026;
    +		ti_st_proto[i].recv = st_receive;
    +		ti_st_proto[i].reg_complete_cb = st_reg_completion_cb;
    +
    +		/* Prepare wait-for-completion handler */
    +		init_completion(&hst->wait_reg_completion);
    +		/* Reset ST registration callback status flag,
    +		 * this value will be updated in
    +		 * st_reg_completion_cb()
    +		 * function whenever it called from ST driver.
    +		 */
    +		hst->reg_status = -EINPROGRESS;
    +
    +		err = st_register(&ti_st_proto[i]);
    +		if (!err)
    +			goto done;
    +
    +		if (err != -EINPROGRESS) {
    +			pr_err("st_register failed %d", err);
    +			goto error;
    +		}
    +
    +		/* ST is busy with either protocol
    +		 * registration or firmware download.
    +		 */
    +		pr_debug("waiting for registration completion signal from ST");
    +		timeleft = wait_for_completion_timeout
    +			(&hst->wait_reg_completion,
    +			 msecs_to_jiffies(BT_REGISTER_TIMEOUT));
    +		if (!timeleft) {
    +			pr_err("Timeout(%d sec),didn't get reg completion signal from ST",
    +			       BT_REGISTER_TIMEOUT / 1000);
    +			err = -ETIMEDOUT;
    +			goto error;
    +		}
    +
    +		/* Is ST registration callback
    +		 * called with ERROR status? */
    +		if (hst->reg_status != 0) {
    +			pr_err("ST registration completed with invalid status %d",
    +			       hst->reg_status);
    +			err = -EAGAIN;
    +			goto error;
    +		}
    +
    +done:
    +		hst->st_write = ti_st_proto[i].write;
    +		if (!hst->st_write) {
    +			pr_err("undefined ST write function");
    +			for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
    +				/* Undo registration with ST */
    +				err = st_unregister(&ti_st_proto[i]);
    +				if (err)
    +					pr_err("st_unregister() failed with error %d",
    +					       err);
    +				hst->st_write = NULL;
    +			}
    +			return -EIO;
    +		}
    +	}
    +
    +	skb_queue_head_init(&hst->rx_list);
    +	init_waitqueue_head(&hst->data_q);
    +
    +	return 0;
    +
    +error:
    +	kfree(hst);
    +	return err;
    +}
    +
    +/** hci_tty_release Function
    + *  This function will un-registers from the ST driver.
    + *
    + *  Parameters :
    + *  @file  : File pointer for BT char driver
    + *  @inod  :
    + *  Returns  0 -  on success
    + *           else suitable error code
    + */
    +int hci_tty_release(struct inode *inod, struct file *file)
    +{
    +	int err, i;
    +	struct ti_st *hst = file->private_data;
    +
    +	pr_info("inside %s (%p, %p)\n", __func__, inod, file);
    +
    +	for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
    +		err = st_unregister(&ti_st_proto[i]);
    +		if (err)
    +			pr_err("st_unregister(%d) failed with error %d",
    +			       ti_st_proto[i].chnl_id, err);
    +	}
    +
    +	hst->st_write = NULL;
    +	skb_queue_purge(&hst->rx_list);
    +	kfree(hst);
    +	return err;
    +}
    +
    +/** hci_tty_read Function
    + *
    + *  Parameters :
    + *  @file  : File pointer for BT char driver
    + *  @data  : Data which needs to be passed to APP
    + *  @size  : Length of the data passesd
    + *  offset :
    + *  Returns  Size of packet received -  on success
    + *           else suitable error code
    + */
    +ssize_t hci_tty_read(struct file *file, char __user *data, size_t size,
    +		loff_t *offset)
    +{
    +	int len = 0, tout;
    +	struct sk_buff *skb = NULL, *rskb = NULL;
    +	struct ti_st	*hst;
    +
    +	pr_debug("inside %s (%p, %p, %u, %p)\n",
    +		 __func__, file, data, size, offset);
    +
    +	/* Validate input parameters */
    +	if ((NULL == file) || (((NULL == data) || (0 == size)))) {
    +		pr_err("Invalid input params passed to %s", __func__);
    +		return -EINVAL;
    +	}
    +
    +	hst = file->private_data;
    +
    +	/* cannot come here if poll-ed before reading
    +	 * if not poll-ed wait on the same wait_q
    +	 */
    +	tout = wait_event_interruptible_timeout(hst->data_q,
    +			!skb_queue_empty(&hst->rx_list),
    +				msecs_to_jiffies(1000));
    +	/* Check for timed out condition */
    +	if (0 == tout) {
    +		pr_err("Device Read timed out\n");
    +		return -ETIMEDOUT;
    +	}
    +
    +	/* hst->rx_list not empty skb already present */
    +	skb = skb_dequeue(&hst->rx_list);
    +	if (!skb) {
    +		pr_err("dequed skb is null?\n");
    +		return -EIO;
    +	}
    +
    +#ifdef VERBOSE
    +	print_hex_dump(KERN_INFO, ">in>", DUMP_PREFIX_NONE,
    +		       16, 1, skb->data, skb->len, 0);
    +#endif
    +
    +	/* Forward the data to the user */
    +	if (skb->len >= size) {
    +		pr_err("FIONREAD not done before read\n");
    +		return -ENOMEM;
    +	} else {
    +		/* returning skb */
    +		rskb = alloc_skb(size, GFP_KERNEL);
    +		if (!rskb) {
    +			pr_err("alloc_skb error\n");
    +			return -ENOMEM;
    +		}
    +
    +		/* cb[0] has the pkt_type 0x04 or 0x02 or 0x03 */
    +		memcpy(skb_put(rskb, 1), &skb->cb[0], 1);
    +		memcpy(skb_put(rskb, skb->len), skb->data, skb->len);
    +
    +		if (copy_to_user(data, rskb->data, rskb->len)) {
    +			pr_err("unable to copy to user space\n");
    +			/* Queue the skb back to head */
    +			skb_queue_head(&hst->rx_list, skb);
    +			kfree_skb(rskb);
    +			return -EIO;
    +		}
    +	}
    +
    +	len = rskb->len;	/* len of returning skb */
    +	kfree_skb(skb);
    +	kfree_skb(rskb);
    +	pr_debug("total size read= %d\n", len);
    +	return len;
    +}
    +
    +/* hci_tty_write Function
    + *
    + *  Parameters :
    + *  @file   : File pointer for BT char driver
    + *  @data   : packet data from BT application
    + *  @size   : Size of the packet data
    + *  @offset :
    + *  Returns  Size of packet on success
    + *           else suitable error code
    + */
    +ssize_t hci_tty_write(struct file *file, const char __user *data,
    +		size_t size, loff_t *offset)
    +{
    +	struct ti_st *hst = file->private_data;
    +	struct	sk_buff *skb;
    +
    +	pr_debug("inside %s (%p, %p, %u, %p)\n",
    +		 __func__, file, data, size, offset);
    +
    +	if (!hst->st_write) {
    +		pr_err(" Can't write to ST, hhci_tty->st_write null ?");
    +		return -EINVAL;
    +	}
    +
    +	skb = alloc_skb(size, GFP_KERNEL);
    +	/* Validate Created SKB */
    +	if (NULL == skb) {
    +		pr_err("Error aaloacting SKB");
    +		return -ENOMEM;
    +	}
    +
    +	/* Forward the data from the user space to ST core */
    +	if (copy_from_user(skb_put(skb, size), data, size)) {
    +		pr_err(" Unable to copy from user space");
    +		kfree_skb(skb);
    +		return -EIO;
    +	}
    +
    +#ifdef VERBOSE
    +	pr_debug("start data..");
    +	print_hex_dump(KERN_INFO, "<out<", DUMP_PREFIX_NONE,
    +		       16, 1, skb->data, size, 0);
    +	pr_debug("\n..end data");
    +#endif
    +
    +	hst->st_write(skb);
    +	return size;
    +}
    +
    +/** hci_tty_ioctl Function
    + *  This will peform the functions as directed by the command and command
    + *  argument.
    + *
    + *  Parameters :
    + *  @file  : File pointer for BT char driver
    + *  @cmd   : IOCTL Command
    + *  @arg   : Command argument for IOCTL command
    + *  Returns  0 on success
    + *           else suitable error code
    + */
    +static long hci_tty_ioctl(struct file *file,
    +		unsigned int cmd, unsigned long arg)
    +{
    +	struct sk_buff *skb = NULL;
    +	int		retcode = 0;
    +	struct ti_st	*hst;
    +
    +	pr_debug("inside %s (%p, %u, %lx)", __func__, file, cmd, arg);
    +
    +	/* Validate input parameters */
    +	if ((NULL == file) || (0 == cmd)) {
    +		pr_err("invalid input parameters passed to %s", __func__);
    +		return -EINVAL;
    +	}
    +
    +	hst = file->private_data;
    +
    +	switch (cmd) {
    +	case FIONREAD:
    +		/* Deque the SKB from the head if rx_list is not empty
    +		 * update the argument with skb->len to provide amount of data
    +		 * available in the available SKB +1 for the PKT_TYPE
    +		 * field not provided in data by TI-ST.
    +		 */
    +		skb = skb_dequeue(&hst->rx_list);
    +		if (skb != NULL) {
    +			*(unsigned int *)arg = skb->len + 1;
    +			/* Re-Store the SKB for furtur Read operations */
    +			skb_queue_head(&hst->rx_list, skb);
    +		} else {
    +			*(unsigned int *)arg = 0;
    +		}
    +		pr_debug("returning %d\n", *(unsigned int *)arg);
    +		break;
    +	default:
    +		pr_debug("Un-Identified IOCTL %d", cmd);
    +		retcode = 0;
    +		break;
    +	}
    +
    +	return retcode;
    +}
    +
    +/** hci_tty_poll Function
    + *  This function will wait till some data is received to the hci_tty driver from ST
    + *
    + *  Parameters :
    + *  @file  : File pointer for BT char driver
    + *  @wait  : POLL wait information
    + *  Returns  status of POLL on success
    + *           else suitable error code
    + */
    +static unsigned int hci_tty_poll(struct file *file, poll_table *wait)
    +{
    +	struct ti_st	*hst = file->private_data;
    +	unsigned long mask = 0;
    +
    +	pr_debug("@ %s\n", __func__);
    +
    +	/* wait to be completed by st_receive */
    +	poll_wait(file, &hst->data_q, wait);
    +	pr_debug("poll broke\n");
    +
    +	if (!skb_queue_empty(&hst->rx_list)) {
    +		pr_debug("rx list que !empty\n");
    +		mask |= POLLIN;	/* TODO: check app for mask */
    +	}
    +
    +	return mask;
    +}
    +
    +/* BT Char driver function pointers
    + * These functions are called from USER space by pefroming File Operations
    + * on /dev/hci_tty node exposed by this driver during init
    + */
    +const struct file_operations hci_tty_chrdev_ops = {
    +	.owner = THIS_MODULE,
    +	.open = hci_tty_open,
    +	.read = hci_tty_read,
    +	.write = hci_tty_write,
    +	.unlocked_ioctl = hci_tty_ioctl,
    +	.poll = hci_tty_poll,
    +	.release = hci_tty_release,
    +};
    +
    +/*********Functions called during insmod and delmod****************************/
    +
    +static int hci_tty_major;		/* major number */
    +static struct class *hci_tty_class;	/* class during class_create */
    +static struct device *hci_tty_dev;	/* dev during device_create */
    +/** hci_tty_init Function
    + *  This function Initializes the hci_tty driver parametes and exposes
    + *  /dev/hci_tty node to user space
    + *
    + *  Parameters : NULL
    + *  Returns  0 on success
    + *           else suitable error code
    + */
    +static int __init hci_tty_init(void)
    +{
    +	pr_info("inside %s\n", __func__);
    +
    +	/* Expose the device DEVICE_NAME to user space
    +	 * And obtain the major number for the device
    +	 */
    +	hci_tty_major = register_chrdev(0, DEVICE_NAME, &hci_tty_chrdev_ops);
    +
    +	if (0 > hci_tty_major) {
    +		pr_err("Error when registering to char dev");
    +		return hci_tty_major;
    +	}
    +
    +	/*  udev */
    +	hci_tty_class = class_create(THIS_MODULE, DEVICE_NAME);
    +	if (IS_ERR(hci_tty_class)) {
    +		pr_err("Something went wrong in class_create");
    +		unregister_chrdev(hci_tty_major, DEVICE_NAME);
    +		return -1;
    +	}
    +
    +	hci_tty_dev =
    +		device_create(hci_tty_class, NULL, MKDEV(hci_tty_major, 0),
    +			      NULL, DEVICE_NAME);
    +	if (IS_ERR(hci_tty_dev)) {
    +		pr_err("Error in device create");
    +		unregister_chrdev(hci_tty_major, DEVICE_NAME);
    +		class_destroy(hci_tty_class);
    +		return -1;
    +	}
    +	pr_info("allocated %d, %d\n", hci_tty_major, 0);
    +	return 0;
    +}
    +
    +/** hci_tty_exit Function
    + *  This function Destroys the hci_tty driver parametes and /dev/hci_tty node
    + *
    + *  Parameters : NULL
    + *  Returns   NULL
    + */
    +static void __exit hci_tty_exit(void)
    +{
    +	pr_info("inside %s\n", __func__);
    +	pr_info("bye.. freeing up %d\n", hci_tty_major);
    +
    +	device_destroy(hci_tty_class, MKDEV(hci_tty_major, 0));
    +	class_destroy(hci_tty_class);
    +	unregister_chrdev(hci_tty_major, DEVICE_NAME);
    +}
    +
    +module_init(hci_tty_init);
    +module_exit(hci_tty_exit);
    +
    +MODULE_AUTHOR("Pavan Savoy <pavan_savoy@ti.com>");
    +MODULE_LICENSE("GPL");
    

  • Hi,

    You steps are fine. can you return in the "kim_probe" function after removing the debugfs entries(below) when the "debugfs_create_dir" fails.

    err_debugfs_dir:

            sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);

    From the below it looks like hci0 interface is not created, could be because of BtWilink

    # hciconfig hci0 up

    Can't get device info: No such device

  • Sundeep,

    I'm having a hard time understanding what you are saying.

    In the st_kim.c source, are you suggesting that I

    [A] remove the highlighted code (and presumably the associated goto statement)

    [B] replace the sysfs_remove_group call with a return(some error value) statement

    [C] something else

    Please respond with A, B, or C (and if C, please explain clearly and in detail).

    Thanks,
    Bijoy

  • Hi,

    The code I have mentioned in the above post removing the debugfs entries when the "debugfs_create_dir" fails.

    from what you mentioned it will be option C.
    What I meant was to add a return statement after the code I have mentioned in the above post.
  • Sundeep,

    Thanks for the clarification.  Now I understand what you meant, but that change is unnecessary.  Why work around a debugfs error when it can be solved instead?  The problem (the reason for my crashes on boot) was that I didn't have CONFIG_DEBUG_FS enabled in my defconfig.  The need for this is not mentioned anywhere in your documentation.

    Once I solved that problem, I was able to boot without issue once again, with all of the necessary patches applied.  However, from what I can tell from my boot output (attached), it seems to be having trouble loading the firmware.

    Please reply with the appropriate Bluetooth firmware (BTS) file for WL1835 attached, along with any additional instructions necessary to bring hci0 up.

    Also please comment on the attached logs.  I am not sure what to make of the UIM-related output since there is no documentation about it at all.

    Thanks,
    Bijoy

    Uncompressing Linux... done, booting the kernel.
    Booting Linux on physical CPU 0x0
    Linux version 3.12.13 (banose@jeff) (gcc version 4.5.3 20110311 (prerelease) (GCC) ) #1 Fri Dec 26 11:42:30 CST 2014
    Machine: Atmel AT91SAM (Device Tree), model: Multi-Tech Systems MT200B2WE
    AT91: Detected soc type: at91sam9x5
    AT91: Detected soc subtype: at91sam9g25
    AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
    Kernel command line: mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .text : 0xc0008000 - 0xc05165a4   (5178 kB)
          .init : 0xc0517000 - 0xc053f3a4   ( 161 kB)
          .data : 0xc0540000 - 0xc0569a40   ( 167 kB)
           .bss : 0xc0569a40 - 0xc0588628   ( 123 kB)
    NR_IRQS:16 nr_irqs:16 16
    sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
    Calibrating delay loop... 199.06 BogoMIPS (lpj=995328)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 512
    Initializing cgroup subsys blkio
    CPU: Testing write buffer coherency: ok
    Setting up static identity map for 0xc03c4420 - 0xc03c4478
    devtmpfs: initialized
    pinctrl core: initialized pinctrl subsystem
    regulator-dummy: no parameters
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    AT91: Power Management (with slow clock mode)
    AT91: Starting after software reset
    gpio-at91 fffff400.gpio: at address fefff400
    gpio-at91 fffff600.gpio: at address fefff600
    gpio-at91 fffff800.gpio: at address fefff800
    gpio-at91 fffffa00.gpio: at address fefffa00
    pinctrl-at91 pinctrl.2: initialized AT91 pinctrl driver
    bio: create slab <bio-0> at 0
    at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 channels
    at_hdmac ffffee00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 channels
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    i2c-gpio i2c.3: using pins 30 (SDA) and 31 (SCL)
    Switched to clocksource tcb_clksrc
    NET: Registered protocol family 2
    TCP established hash table entries: 1024 (order: 1, 8192 bytes)
    TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
    TCP: Hash tables configured (established 1024 bind 1024)
    TCP: reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    NFS: Registering the id_resolver key type
    Key type id_resolver registered
    Key type id_legacy registered
    jffs2: version 2.2. (NAND) (SUMMARY)  �� 2001-2006 Red Hat, Inc.
    ROMFS MTD (C) 2007 Red Hat, Inc.
    fuse init (API version 7.22)
    msgmni has been set to 242
    Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
    io scheduler noop registered (default)
    io scheduler deadline registered
    io scheduler cfq registered
    fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 16, base_baud = 8333333) is a ATMEL_SERIAL
    console [ttyS0] enabled
    f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 24, base_baud = 8333333) is a ATMEL_SERIAL
    f8028000.serial: ttyS2 at MMIO 0xf8028000 (irq = 28, base_baud = 8333333) is a ATMEL_SERIAL
    brd: module loaded
    loop: module loaded
    ssc f0010000.ssc: Atmel SSC device at 0xc88b0000 (irq 22)
    at24_get_setup: found a match for eeprom at 56
    at24 0-0056: 512 byte 24c04 EEPROM, writable, 16 bytes/write
    sam9x5: read 512 bytes from id eeprom
    (stk) :sysfs entries created
    (stk) : debugfs entries created
    (hci_tty): inside hci_tty_init
    (hci_tty): allocated 251, 0
    atmel_nand 40000000.nand: Using dma0chan0 for DMA transfers.
    ONFI param page 0 valid
    ONFI flash detected
    NAND device: Manufacturer ID: 0x2c, Chip ID: 0xaa (Micron MT29F2G08ABBEAHC), 256MiB, page size: 2048, OOB size: 64
    atmel_nand 40000000.nand: ONFI params, minimum required ECC: 4 bits in 512 bytes
    atmel_nand 40000000.nand: Initialize PMECC params, cap: 4, sector: 512
    Scanning device for bad blocks
    Bad eraseblock 10 at 0x000000140000
    9 ofpart partitions found on MTD device atmel_nand
    Creating 9 MTD partitions on "atmel_nand":
    0x000000000000-0x000010000000 : "NANDFlash"
    0x000000000000-0x000000040000 : "at91bootstrap"
    0x000000040000-0x0000000c0000 : "u-Boot"
    0x0000000c0000-0x000000160000 : "u-Boot Config"
    0x000000160000-0x000000200000 : "u-Boot Redundant Config"
    0x000000200000-0x000000800000 : "uImage"
    0x000000800000-0x000001000000 : "Config"
    0x000001000000-0x000001800000 : "OEM Config"
    0x000001800000-0x000010000000 : "Rootfs"
    libphy: MACB_mii_bus: probed
    macb f802c000.ethernet eth0: Cadence MACB at 0xf802c000 irq 25 (00:08:00:88:ff:b6)
    macb f802c000.ethernet eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)
    PPP generic driver version 2.4.2
    PPP BSD Compression module registered
    PPP Deflate Compression module registered
    ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    ehci-atmel: EHCI Atmel driver
    atmel-ehci 700000.ehci: EHCI Host Controller
    atmel-ehci 700000.ehci: new USB bus registered, assigned bus number 1
    atmel-ehci 700000.ehci: irq 29, io mem 0x00700000
    atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
    usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb1: Product: EHCI Host Controller
    usb usb1: Manufacturer: Linux 3.12.13 ehci_hcd
    usb usb1: SerialNumber: 700000.ehci
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 3 ports detected
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    at91_ohci 600000.ohci: AT91 OHCI
    at91_ohci 600000.ohci: new USB bus registered, assigned bus number 2
    at91_ohci 600000.ohci: irq 29, io mem 0x00600000
    usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
    usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb2: Product: AT91 OHCI
    usb usb2: Manufacturer: Linux 3.12.13 ohci_hcd
    usb usb2: SerialNumber: at91
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 3 ports detected
    at91_rtc fffffeb0.rtc: rtc core: registered fffffeb0.rtc as rtc0
    at91_rtc fffffeb0.rtc: AT91 Real Time Clock driver.
    i2c /dev entries driver
    at91sam9_wdt: enabled (heartbeat=15 sec, nowayout=0)
    Netfilter messages via NETLINK v0.30.
    nf_conntrack version 0.5.0 (1940 buckets, 7760 max)
    ipip: IPv4 over IPv4 tunneling driver
    gre: GRE over IPv4 demultiplexor driver
    ip_gre: GRE over IPv4 tunneling driver
    ip_tables: (C) 2000-2006 Netfilter Core Team
    TCP: cubic registered
    NET: Registered protocol family 17
    l2tp_core: L2TP core driver, V2.0
    Key type dns_resolver registered
    at91_rtc fffffeb0.rtc: setting system clock to 2014-12-29 17:43:40 UTC (1419875020)
    atmel_nand 40000000.nand: Bit flip in data area, byte_pos: 236, bit_pos: 5, 0x24 -> 0x04
    jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
    VFS: Mounted root (jffs2 filesystem) readonly on device 31:8.
    devtmpfs: mounted
    Freeing unused kernel memory: 160K (c0517000 - c053f000)
    INIT: version 2.86 booting
    Please wait: booting...
    Starting udev
    wlan-en-regulator: 1800 mV
    atmel_mci f0008000.mmc: version: 0x504
    atmel_mci f0008000.mmc: using dma0chan1 for DMA transfers
    atmel_mci f0008000.mmc: Atmel MCI controller at 0xf0008000 irq 23, 1 slots
    mmc0: card claims to support voltages below the defined range. These will be ignored.
    atmel_usba_udc 500000.gadget: MMIO registers at 0xf803c000 mapped at c8966000
    atmel_usba_udc 500000.gadget: FIFO at 0x00500000 mapped at d9100000
    mmc0: queuing unknown CIS tuple 0x91 (3 bytes)
    Loading modules backported from Linux version 2.3.3-2-g31d288b
    Backport generated by backports.git 2.3.3-2-g31d288b
    mmc0: new high speed SDIO card at address 0001
    wl1271_sdio mmc0:0001:2: No platform data set
    Bluetooth: Core ver 2.16
    NET: Registered protocol family 31
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Bluetooth: L2CAP socket layer initialized
    Bluetooth: SCO socket layer initialized
    (stc):  chnl_id list empty :4
    (stk) : st_kim_start(stk) :ldisc_install = 1
    (stk) :ldisc installation timeout(stk) :ldisc_install = 0
    (stk) : timed out waiting for ldisc to be un-installed(stk) :ldisc_install = 1cfg80211: Calling CRDA to update world regulatory domain
    
    (stk) :ldisc installation timeout(stk) :ldisc_install = 0
    (stk) : timed out waiting for ldisc to be un-installed(stk) :ldisc_install = 1
    (stk) :ldisc installation timeout(stk) :ldisc_install = 0
    (stk) : timed out waiting for ldisc to be un-installed(stk) :ldisc_install = 1
    (stk) :ldisc installation timeout(stk) :ldisc_install = 0
    (stk) : timed out waiting for ldisc to be un-installed(stk) :ldisc_install = 1wlcore: ERROR could not get configuration binary ti-connectivity/wl18xx-conf.bin: -2
    wlcore: WARNING falling back to default config
    Remounting root file system...
    Caching udev devnodes
    wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
    wlcore: loaded
    wlcore: driver version: ol_r8.a9.14
    wlcore: compilation time: Thu Nov 20 16:31:13 2014
    Bluetooth: HIDP (Human Interface Emulation) ver 1.2
    Bluetooth: HIDP socket layer initialized
    
    (stk) :ldisc installation timeout(stk) :ldisc_install = 0Bluetooth: RFCOMM TTY layer initialized
    Bluetooth: RFCOMM socket layer initialized
    Bluetooth: RFCOMM ver 1.11
    Mounting /var/config
    mount: can't find /var/config in /etc/fstab or /etc/mtab
    Creating /var/config
    flash_eraseall has been replaced by `flash_erase <mtddev> 0 0`; please use it
    Erasing 128 Kibyte @ 0 --  0 % complete flash_erase:  Cleanmarker written at 0
    Erasing 128 Kibyte @ 20000 --  1 % complete flash_erase:  Cleanmarker written at 20000
    Erasing 128 Kibyte @ 40000 --  3 % complete flash_erase:  Cleanmarker written at 40000
    Erasing 128 Kibyte @ 60000 --  4 % complete flash_erase:  Cleanmarker written at 60000
    Erasing 128 Kibyte @ 80000 --  6 % complete flash_erase:  Cleanmarker written at 80000
    Erasing 128 Kibyte @ a0000 --  7 % complete flash_erase:  Cleanmarker written at a0000
    Erasing 128 Kibyte @ c0000 --  9 % complete flash_erase:  Cleanmarker written at c0000
    Erasing 128 Kibyte @ e0000 -- 10 % complete flash_erase:  Cleanmarker written at e0000
    Erasing 128 Kibyte @ 100000 -- 12 % complete flash_erase:  Cleanmarker written at 100000
    Erasing 128 Kibyte @ 120000 -- 14 % complete flash_erase:  Cleanmarker written at 120000
    Erasing 128 Kibyte @ 140000 -- 15 % complete flash_erase:  Cleanmarker written at 140000
    Erasing 128 Kibyte @ 160000 -- 17 % complete flash_erase:  Cleanmarker written at 160000
    Erasing 128 Kibyte @ 180000 -- 18 % complete flash_erase:  Cleanmarker written at 180000
    Erasing 128 Kibyte @ 1a0000 -- 20 % complete flash_erase:  Cleanmarker written at 1a0000
    Erasing 128 Kibyte @ 1c0000 -- 21 % complete flash_erase:  Cleanmarker written at 1c0000
    Erasing 128 Kibyte @ 1e0000 -- 23 % complete flash_erase:  Cleanmarker written at 1e0000
    Erasing 128 Kibyte @ 200000 -- 25 % complete flash_erase:  Cleanmarker written at 200000
    Erasing 128 Kibyte @ 220000 -- 26 % complete flash_erase:  Cleanmarker written at 220000
    Erasing 128 Kibyte @ 240000 -- 28 % complete flash_erase:  Cleanmarker written at 240000
    Erasing 128 Kibyte @ 260000 -- 29 % complete flash_erase:  Cleanmarker written at 260000
    Erasing 128 Kibyte @ 280000 -- 31 % complete flash_erase:  Cleanmarker written at 280000
    Erasing 128 Kibyte @ 2a0000 -- 32 % complete flash_erase:  Cleanmarker written at 2a0000
    Erasing 128 Kibyte @ 2c0000 -- 34 % complete flash_erase:  Cleanmarker written at 2c0000
    Erasing 128 Kibyte @ 2e0000 -- 35 % complete flash_erase:  Cleanmarker written at 2e0000
    Erasing 128 Kibyte @ 300000 -- 37 % complete flash_erase:  Cleanmarker written at 300000
    Erasing 128 Kibyte @ 320000 -- 39 % complete flash_erase:  Cleanmarker written at 320000
    Erasing 128 Kibyte @ 340000 -- 40 % complete flash_erase:  Cleanmarker written at 340000
    Erasing 128 Kibyte @ 360000 -- 42 % complete flash_erase:  Cleanmarker written at 360000
    Erasing 128 Kibyte @ 380000 -- 43 % complete flash_erase:  Cleanmarker written at 380000
    Erasing 128 Kibyte @ 3a0000 -- 45 % complete flash_erase:  Cleanmarker written at 3a0000
    Erasing 128 Kibyte @ 3c0000 -- 46 % complete flash_erase:  Cleanmarker written at 3c0000
    Erasing 128 Kibyte @ 3e0000 -- 48 % complete flash_erase:  Cleanmarker written at 3e0000
    Erasing 128 Kibyte @ 400000 -- 50 % complete flash_erase:  Cleanmarker written at 400000
    Erasing 128 Kibyte @ 420000 -- 51 % complete flash_erase:  Cleanmarker written at 420000
    Erasing 128 Kibyte @ 440000 -- 53 % complete flash_erase:  Cleanmarker written at 440000
    Erasing 128 Kibyte @ 460000 -- 54 % complete flash_erase:  Cleanmarker written at 460000
    Erasing 128 Kibyte @ 480000 -- 56 % complete flash_erase:  Cleanmarker written at 480000
    Erasing 128 Kibyte @ 4a0000 -- 57 % complete flash_erase:  Cleanmarker written at 4a0000
    Erasing 128 Kibyte @ 4c0000 -- 59 % complete flash_erase:  Cleanmarker written at 4c0000
    Erasing 128 Kibyte @ 4e0000 -- 60 % complete flash_erase:  Cleanmarker written at 4e0000
    Erasing 128 Kibyte @ 500000 -- 62 % complete flash_erase:  Cleanmarker written at 500000
    Erasing 128 Kibyte @ 520000 -- 64 % complete flash_erase:  Cleanmarker written at 520000
    Erasing 128 Kibyte @ 540000 -- 65 % complete flash_erase:  Cleanmarker written at 540000
    Erasing 128 Kibyte @ 560000 -- 67 % complete flash_erase:  Cleanmarker written at 560000
    Erasing 128 Kibyte @ 580000 -- 68 % complete flash_erase:  Cleanmarker written at 580000
    Erasing 128 Kibyte @ 5a0000 -- 70 % complete flash_erase:  Cleanmarker written at 5a0000
    Erasing 128 Kibyte @ 5c0000 -- 71 % complete flash_erase:  Cleanmarker written at 5c0000
    Erasing 128 Kibyte @ 5e0000 -- 73 % complete flash_erase:  Cleanmarker written at 5e0000
    Erasing 128 Kibyte @ 600000 -- 75 % complete flash_erase:  Cleanmarker written at 600000
    Erasing 128 Kibyte @ 620000 -- 76 % complete flash_erase:  Cleanmarker written at 620000
    Erasing 128 Kibyte @ 640000 -- 78 % complete flash_erase:  Cleanmarker written at 640000
    Erasing 128 Kibyte @ 660000 -- 79 % complete flash_erase:  Cleanmarker written at 660000
    Erasing 128 Kibyte @ 680000 -- 81 % complete flash_erase:  Cleanmarker written at 680000
    Erasing 128 Kibyte @ 6a0000 -- 82 % complete flash_erase:  Cleanmarker written at 6a0000
    Erasing 128 Kibyte @ 6c0000 -- 84 % complete flash_erase:  Cleanmarker written at 6c0000
    Erasing 128 Kibyte @ 6e0000 -- 85 % complete flash_erase:  Cleanmarker written at 6e0000
    Erasing 128 Kibyte @ 700000 -- 87 % complete flash_erase:  Cleanmarker written at 700000
    Erasing 128 Kibyte @ 720000 -- 89 % complete flash_erase:  Cleanmarker written at 720000
    Erasing 128 Kibyte @ 740000 -- 90 % complete flash_erase:  Cleanmarker written at 740000
    Erasing 128 Kibyte @ 760000 -- 92 % complete flash_erase:  Cleanmarker written at 760000
    Erasing 128 Kibyte @ 780000 -- 93 % complete flash_erase:  Cleanmarker written at 780000
    Erasing 128 Kibyte @ 7a0000 -- 95 % complete flash_erase:  Cleanmarker written at 7a0000
    Erasing 128 Kibyte @ 7c0000 -- 96 % complete flash_erase:  Cleanmarker written at 7c0000
    Erasing 128 Kibyte @ 7e0000 -- 98 % complete flash_erase:  Cleanmarker written at 7e0000
    Erasing 128 Kibyte @ 7e0000 -- 100 % complete
    mount: can't find /var/config in /etc/fstab or /etc/mtab
    root: mount: mount point /proc/bus/usb does not exist
    
    (stk) : timed out waiting for ldisc to be un-installed(stk) :ldisc_install = 1Loading mts-io module
    [INFO] mts-io:mts_io_init:608: init: v0.9.1
    [INFO] mts-io:mts_id_eeprom_load:552: detected board MT200B2WE-0.0
    [INFO] mts-io:mts_id_eeprom_load:566: sizeof: 512
    [INFO] mts-io:mts_id_eeprom_load:567: vendor-id: Multi-Tech Systems
    [INFO] mts-io:mts_id_eeprom_load:568: product-id: MT200B2WE
    [INFO] mts-io:mts_id_eeprom_load:569: device-id: 123456789
    [INFO] mts-io:mts_id_eeprom_load:570: hw-version: MT200B2WE-0.0
    [INFO] mts-io:mts_id_eeprom_load:577: mac-addr: 00:08:00:88:FF:B6
    [INFO] mts-io:mts_id_eeprom_load:578: imei:
    [INFO] mts-io:mts_id_eeprom_load:579: capa-gps: no
    [INFO] mts-io:mts_id_eeprom_load:580: capa-din: no
    [INFO] mts-io:mts_id_eeprom_load:581: capa-dout: no
    [INFO] mts-io:mts_id_eeprom_load:582: capa-adc: no
    [INFO] mts-io:mts_id_eeprom_load:583: capa-wifi: no
    [INFO] mts-io:mts_id_eeprom_load:584: capa-bluetooth: yes
    [INFO] mts-io:mts_id_eeprom_load:591: mac-bluetooth: 00:00:00:00:00:00
    [INFO] mts-io:mts_id_eeprom_load:598: mac-wifi: 00:00:00:00:00:00
    Configuring network interfaces...
    (stk) :ldisc installation timeout(stk) :ldisc_install = 0done.
    net.ipv4.ip_forward = 1
    INIT: Entering runlevel: 5
    Starting system message bus: dbus.
    
    (stk) : timed out waiting for ldisc to be un-installedBluetooth: st_register failed -22
    UIM SYSFS Node Found at /sys/./devices/kim.7/install
    Starting uim-sysfs daemon.
    uim:@ main
    uim:install = /sys/./devices/kim.7/install
    uim:dev_name = /sys/./devices/kim.7/dev_name
    uim:baud_rate = /sys/./devices/kim.7/baud_rate
    uim:flow_cntrl = /sys/./devices/kim.7/flow_cntrl
    uim:begin polling...
    Starting Dropbear SSH server: macb f802c000.ethernet eth0: link up (100/Full)
    dropbear.
    Starting syslogd/klogd: done
     * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
       ...done.
    atmel_nand 40000000.nand: Bit flip in data area, byte_pos: 236, bit_pos: 5, 0x24 -> 0x04
    Setting up bluetooth device...
    atmel_nand 40000000.nand: Bit flip in data area, byte_pos: 236, bit_pos: 5, 0x24 -> 0x04
    /usr/lib/mts-io-sysfs/mts-io-sysfs-inc.sh: line 54: /sys/devices/platform/mts-io/bt-reset: No such file or directory
    (stc):  chnl_id list empty :4
    (stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    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:Co
    (stc): st_tty_open mman(stk) :line discipline installedd complete done
    uim:Speed changing to 3000000, 1
    uim:@ set_custom_baud_rate
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    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:C
    (stc): st_tty_open omma(stk) :line discipline installednd complete done
    uim:Speed changing to 3000000, 1
    uim:@ set_custom_baud_rate
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    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:C
    (stc): st_tty_open ommand c(stk) :line discipline installedomplete done
    uim:Speed changing to 3000000, 1
    uim:@ set_custom_baud_rate
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:poll broke
    (stc): st_tty_close  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
    (stk) :ldisc_install = 1uim: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/ttyS1
    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:C
    (stc): st_tty_open ommand (stk) :line discipline installedcomplete done
    uim:Speed changing to 3000000, 1
    uim:@ set_custom_baud_rate
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    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:C
    (stc): st_tty_open ommand (stk) :line discipline installedcomplete done
    uim:Speed changing to 3000000, 1
    uim:@ set_custom_baud_rate
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    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:C
    (stc): st_tty_open ommand (stk) :line discipline installedcomplete done
    uim:Speed changing to 3000000, 1
    uim:@ set_custom_baud_rate
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l broke due to event 10(PRI:2/ERR:8)
    Bluetooth: st_register failed -22
    
    uim:read 0 from install
    
    uim:@ st_uart_config
    uim:Un-Installed N_TI_WL Line displine
    uim:begin polling...
    Bridge firewalling registered
    Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    Bluetooth: BNEP filters: protocol multicast
    Bluetooth: BNEP socket layer initialized
    
    Multi-Tech Systems B2E mt200b2we ttyS0
    CoreCDP 2.3.3 mt200b2we ttyS0
    
    mt200b2we login:
    

  • Hi,

    Looks like the GPIO (BT_EN) is not toggled properly.

    GPIO should be high before there is any communication with the chip.

    Could you please check if the connection with the chip is fine when you face this issue. Also if possible please check if the voltage on GPIO is driven high.

    you can also probe the UART lines to make sure that the UART configuration is correct.

    Also make sure that btwilink is running.

    You can get the latest BTS from here https://git.ti.com/wilink8-bt/ti-bt-firmware/trees/master

  • Sundeep,

    As I already mentioned earlier, I have verified (with a scope) that the GPIO connected to BT_EN is getting toggled as expected. Originally I was manipulating that GPIO pin with our own utility. Now it appears that it is getting toggled automatically when I attempt to run "hciconfig hci0 up" -- this tells me that the GPIO that I specified in the "kim" node of the DTS is being picked up by the st_kim driver and used properly.

    Yes, btwilink is running.

    # lsmod
    Module Size Used by
    bnep 9222 2
    bridge 74551 0
    stp 1347 1 bridge
    llc 3189 2 bridge,stp
    hci_uart 7345 0
    mts_io 27173 0
    rfcomm 28635 3
    hidp 12571 0
    wlcore_sdio 4406 0
    compat 1904 1 wlcore_sdio
    atmel_usba_udc 10279 0
    udc_core 6078 1 atmel_usba_udc
    fixed 2647 0
    btwilink 3492 0
    atmel_mci 15228 0
    bluetooth 196784 11 bnep,hci_uart,rfcomm,hidp,btwilink
    uio_pdrv_genirq 2661 0
    uio 6820 1 uio_pdrv_genirq

    > You can get the latest BTS from here https://git.ti.com/wilink8-bt/ti-bt-firmware/trees/master

    Yes, I know about that directory of undocumented files. Tell me exactly which file I should use. Based on the actual binary contents, they don't all seem to be valid for WL1835.

    Thanks,
    Bijoy
  • Hi,

    From the logs you have provided previously, I see that the GPIO is toggled and the first command (baud rate) is sent to the device and it was successful. But when we send the second command (read local version information) you are getting a time out waiting for the command.

    So I am suspecting if the GPIO is stable. One more thing is does your UART driver support 3M daudrate, Could you set it to 115200 (in the DTS file) and see if it solves your problem.

    Use the BTS from the root folder, It depends on the chip version, If the read local version information is successful and if you don't have the right file. you will see something like below in you logs

    Example:

    Found a Texas Instruments chip

    Firmware file: /lib/firmware/TIInit_11.8.32.bts

    can't open firmware file: No such file or directory

    Warning: cannot find BTS file: /lib/firmware/TIInit_11.8.32.bts

    NOTE : If you are using a WL183x then the appropriate script is "TIInit_11.8.32.bts", if you are using a WL185x then the appropriate script is "TIInit_12.8.32.bts". If you are not sure if you are using a WL183x or WL185x then download both scripts, the Bluetooth stack will query the radio and select the appropriate script automatically upon Bluetooth initialization.

  • Sundeep,

    I'm not sure how you are interpreting the output that way.  Your driver is not communicating anything to the wl18xx.  I've been probing the processor TX / WiLink RX line, and the only thing it sends are the bytes 0x01, 0x01, 0x10, 0x00.  WiLink does not respond at all.  This is with the baud rate set (in the DTS) to 115200.

    I am attaching the current output when I try to bring up hci0.

    Thanks,
    Bijoy

    # hciconfig hci0 up
    (stc):  chnl_id list empty :4
    (stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to
    (stc): st_tty_open event 10(stk) :line discipline installed(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ set_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to
    (stc): st_tty_open  event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ set_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    (stk) :line discipline installed
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to
    (stc): st_tty_open event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:(stk) :line discipline installed@ set_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:poll
    (stc): st_tty_close  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...
    (stk) :ldisc_install = 1uim:poll broke due to e
    (stc): st_tty_open vent 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ se(stk) :line discipline installedt_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to e
    (stc): st_tty_open vent 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ (stk) :line discipline installedset_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to e
    (stc): st_tty_open vent 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ se(stk) :line discipline installedt_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l broke due to event 10(PRI:2/ERR:8)
    Bluetooth: st_register failed -22
    
    uim:read 0 from install
    
    uim:@ st_uart_config
    uim:Un-Installed N_TI_WL Line displine
    uim:begin polling...
    Can't init device hci0: Input/output error (5)
    # sleep 3; hciconfig hci0 up
    (stc):  chnl_id list empty :4
    (stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to
    (stc): st_tty_open event 10(PRI:2/ERR:8)
    
    uim:read(stk) :line discipline installed 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ set_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to
    (stc): st_tty_open event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ set_baud_rate
    uim:set_baud_rate() done
    uim:Install(stk) :line discipline installeded N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to
    (stc): st_tty_open event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal r(stk) :line discipline installedeceived, opening /dev/ttyS1
    uim:@ set_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to e
    (stc): st_tty_open vent 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ set_baud_rate
    uim:set_baud_rate() done
    uim:Inst(stk) :line discipline installedalled N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to e
    (stc): st_tty_open vent 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ set_baud_rate
    uim:set_baud_rate() done
    uim:Installed N(stk) :line discipline installed_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l 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...
    (stk) :ldisc_install = 1uim:poll broke due to
    (stc): st_tty_open event 10(PRI:2/ERR:8)
    
    uim:read 1 from install
    
    uim:@ st_uart_config
    uim: signal received, opening /dev/ttyS1
    uim:@ set(stk) :line discipline installed_baud_rate
    uim:set_baud_rate() done
    uim:Installed N_TI_WL Line displine
    uim:begin polling...
    
    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver
    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol
    (stc): st_tty_close l broke due to event 10(PRI:2/ERR:8)
    Bluetooth: st_register failed -22
    
    uim:read 0 from install
    
    uim:@ st_uart_config
    uim:Un-Installed N_TI_WL Line displine
    uim:begin polling...
    Can't init device hci0: Input/output error (5)
    #

  • Hi,

    First when you are using ST, Baud rate is set from the DTS file (as you said, but also see the logs you have provided previously and now below). UIM takes it from here and sets it.

    kim {
    compatible = "kim";
    nshutdown_gpio = <29>; /* Bank A, pin 29 */
    dev_name = "/dev/ttyO1";
    flow_cntrl = <1>;
    baud_rate = <3000000>;
    };

    ST skips the baud rate command in the firmware(SP or BTS) as it is been set from the board file. So it does not matter if you have baud rate command in you BTS or not if we are using ST. 

    and now from the logs you have sent.

    From the logs provided earlier (uim_running_firmware_load_fails.txt)

    uim:@ st_uart_config

    uim: signal received, opening /dev/ttyS1

    //Baud rate is set successfully

    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

    (stc): st_tty_open (stk) :line discipline installed

    uim:Speed changing to 3000000, 1

    uim:@ set_custom_baud_rate

    uim:Installed N_TI_WL Line displine

    uim:begin polling...

    //read  local version in formation failed

    (stk) : waiting for ver info- timed out

    (stk) :kim: failed to read local ver

    (stk) :download firmware failed(stk) :ldisc_install = 0uim:pol

    and from the logs provided now (communication_not_happening.txt)

    hciconfig hci0 up

    (stc):  chnl_id list empty :4

    (stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to

    (stc): st_tty_open event 10(stk) :line discipline installed(PRI:2/ERR:8)

    uim:read 1 from install

    uim:@ st_uart_config

    uim: signal received, opening /dev/ttyS1

    //Baud rate is set successfully

    uim:@ set_baud_rate

    uim:set_baud_rate() done

    uim:Installed N_TI_WL Line displine

    uim:begin polling...

    (stk) : waiting for ver info- timed out (stk) :kim: failed to read local ver //read  local version in formation failed

    (stk) :download firmware failed

    Edit : I see from few other post that if  flow control is not enabled you might see similar failure's.