linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: roylee17@gmail.com
To: linux-bluetooth@vger.kernel.org
Cc: Tzu-Jung Lee <roylee17@gmail.com>
Subject: [PATCH 2/3] tools: Use specified uart speed to load firmware for bcm43xx
Date: Mon,  8 Sep 2014 14:21:59 -0700	[thread overview]
Message-ID: <1410211320-16111-2-git-send-email-roylee@paypal.com> (raw)
In-Reply-To: <1410211320-16111-1-git-send-email-roylee@paypal.com>

From: Tzu-Jung Lee <roylee17@gmail.com>

---
 tools/hciattach_bcm43xx.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tools/hciattach_bcm43xx.c b/tools/hciattach_bcm43xx.c
index cb4bfb9..630220e 100644
--- a/tools/hciattach_bcm43xx.c
+++ b/tools/hciattach_bcm43xx.c
@@ -359,9 +359,27 @@ int bcm43xx_init(int fd, int speed, struct termios *ti, const char *bdaddr)
 	if (bcm43xx_locate_patch(FIRMWARE_DIR, chip_name, fw_path)) {
 		fprintf(stderr, "Patch not found, continue anyway\n");
 	} else {
+		/* Speed up firmware loading */
+		if (speed > 3000000 && bcm43xx_set_clock(fd, BCM43XX_CLOCK_48))
+			return -1;
+
+		if (bcm43xx_set_speed(fd, speed))
+			return -1;
+
+		if (set_speed(fd, ti, speed))
+			return -1;
+
 		if (bcm43xx_load_firmware(fd, fw_path))
 			return -1;
 
+		/*
+		 * The controller reset the uart speed to 115200 after
+		 * firmware loading, so we have to reset the terminal
+		 * correspondingly
+		 */
+		if (set_speed(fd, ti, 115200))
+			return -1;
+
 		if (bcm43xx_reset(fd))
 			return -1;
 	}
@@ -375,5 +393,9 @@ int bcm43xx_init(int fd, int speed, struct termios *ti, const char *bdaddr)
 	if (bcm43xx_set_speed(fd, speed))
 		return -1;
 
+	if (set_speed(fd, ti, speed))
+		return -1;
+
+
 	return 0;
 }
-- 
2.0.4


  reply	other threads:[~2014-09-08 21:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 21:21 [PATCH 1/3] tools: Fix usage for hciattach command roylee17
2014-09-08 21:21 ` roylee17 [this message]
2014-09-08 21:22 ` [PATCH 3/3] tools: Fix download mode delay for bcm43xx roylee17
2014-09-15  7:00 ` [PATCH 1/3] tools: Fix usage for hciattach command Luiz Augusto von Dentz
2014-09-15 18:23   ` Tzu-Jung Lee
2014-09-19 17:41     ` Tzu-Jung Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410211320-16111-2-git-send-email-roylee@paypal.com \
    --to=roylee17@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).