[PATCH 2/3] tools: Use specified uart speed to load firmware for bcm43xx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tzu-Jung Lee <roylee17@xxxxxxxxx>

---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux