RE: [PATCH v2] Bluetooth: hci_uart: Support firmware download for Marvell

From: Amitkumar Karwar
Date: Tue Mar 01 2016 - 12:08:48 EST


Hi Marcel,

> > +
> > + kfree(skb);
> > + BT_INFO("leave dnld_fw\n");
> > +
> > + return ret;
> > +}
>
> I think it would help if you explain on how the firmware download for
> your UART devices work. I have the feeling we need a bit better core
> handling in this case and not end up hacking it in this way.
>
> > +

I have explained our firmware download mechanism in attached text file.
I will shortly send V3 patch which address your review comments. Let me know if you have any suggestions.

Regards,
Amit
Firmware download works on the feedback mechanism between
driver and the device. For every chunk of firmware downloaded,
the device will send an ACK and append the next length (in bytes)
to be downloaded. Driver will decode this info and download bytes
accordingly.

On power on, the device starts sending below heartbeat sequence:

heartbeat (5 bytes) : |HDR|XX|XX|XX|XX|

HDR 0xA5: Header indicating ACK

If HDR is ACK(0xA5) then rest of the bytes are decoded as below:

|0xA5|L1|L2|CL1|CL2|

L1 : LSB of length of the firmware bytes to be sent from the host
L2 : MSB of length of the firmware bytes to be sent from the host
CL1: Complement of L1
CL2: Complement of L2

Driver will decode the length from above sequence and download
bytes accordingly. Device will acknowledge the same and append
lenth to be downloaded in next transmission.

HDR 0xAA: Header indicating chip id and revision
If HDR is chip info(0xAA) then rest of the bytes are decoded as below:

|0xA5|CHIP_ID|CHIP_REV|CCHIP_ID|CCHIP_REV|

CHIP ID : Id of the chip
CHIP_REV : Chip revision
CCHIP_ID : Complement of chip id
CCHIP_REV: Complement of chip revision

The device will start sending above 0xAA sequence once helper
file gets downloaded. Helper file is needed to make device
work with higher baud rate.

After downloding the helper, driver will change the baudrate
in device and start downloading the firmware. This reduces the
time needed to download the firmware. For each baud rate there
exists different helper files. In the given patch we are
using helper file which enabled firmware download in 3MB speed.