34
34
#define FIRMWARE_W9098 "nxp/uartuart9098_bt_v1.bin"
35
35
#define FIRMWARE_IW416 "nxp/uartiw416_bt_v0.bin"
36
36
#define FIRMWARE_IW612 "nxp/uartspi_n61x_v1.bin.se"
37
+ #define FIRMWARE_IW624 "nxp/uartiw624_bt.bin"
38
+ #define FIRMWARE_SECURE_IW624 "nxp/uartiw624_bt.bin.se"
37
39
#define FIRMWARE_AW693 "nxp/uartaw693_bt.bin"
38
40
#define FIRMWARE_SECURE_AW693 "nxp/uartaw693_bt.bin.se"
39
41
#define FIRMWARE_HELPER "nxp/helper_uart_3000000.bin"
40
42
41
43
#define CHIP_ID_W9098 0x5c03
42
44
#define CHIP_ID_IW416 0x7201
43
45
#define CHIP_ID_IW612 0x7601
46
+ #define CHIP_ID_IW624a 0x8000
47
+ #define CHIP_ID_IW624c 0x8001
44
48
#define CHIP_ID_AW693 0x8200
45
49
46
50
#define FW_SECURE_MASK 0xc0
@@ -152,6 +156,7 @@ struct btnxpuart_dev {
152
156
u32 fw_v1_sent_bytes ;
153
157
u32 fw_v3_offset_correction ;
154
158
u32 fw_v1_expected_len ;
159
+ u32 boot_reg_offset ;
155
160
wait_queue_head_t fw_dnld_done_wait_q ;
156
161
wait_queue_head_t check_boot_sign_wait_q ;
157
162
@@ -538,6 +543,7 @@ static int nxp_download_firmware(struct hci_dev *hdev)
538
543
nxpdev -> fw_dnld_v1_offset = 0 ;
539
544
nxpdev -> fw_v1_sent_bytes = 0 ;
540
545
nxpdev -> fw_v1_expected_len = HDR_LEN ;
546
+ nxpdev -> boot_reg_offset = 0 ;
541
547
nxpdev -> fw_v3_offset_correction = 0 ;
542
548
nxpdev -> baudrate_changed = false;
543
549
nxpdev -> timeout_changed = false;
@@ -547,7 +553,7 @@ static int nxp_download_firmware(struct hci_dev *hdev)
547
553
serdev_device_set_flow_control (nxpdev -> serdev , false);
548
554
nxpdev -> current_baudrate = HCI_NXP_PRI_BAUDRATE ;
549
555
550
- /* Wait till FW is downloaded and CTS becomes low */
556
+ /* Wait till FW is downloaded */
551
557
err = wait_event_interruptible_timeout (nxpdev -> fw_dnld_done_wait_q ,
552
558
!test_bit (BTNXPUART_FW_DOWNLOADING ,
553
559
& nxpdev -> tx_state ),
@@ -586,6 +592,12 @@ static bool nxp_fw_change_baudrate(struct hci_dev *hdev, u16 req_len)
586
592
struct btnxpuart_dev * nxpdev = hci_get_drvdata (hdev );
587
593
struct nxp_bootloader_cmd nxp_cmd5 ;
588
594
struct uart_config uart_config ;
595
+ u32 clkdivaddr = CLKDIVADDR - nxpdev -> boot_reg_offset ;
596
+ u32 uartdivaddr = UARTDIVADDR - nxpdev -> boot_reg_offset ;
597
+ u32 uartmcraddr = UARTMCRADDR - nxpdev -> boot_reg_offset ;
598
+ u32 uartreinitaddr = UARTREINITADDR - nxpdev -> boot_reg_offset ;
599
+ u32 uarticraddr = UARTICRADDR - nxpdev -> boot_reg_offset ;
600
+ u32 uartfcraddr = UARTFCRADDR - nxpdev -> boot_reg_offset ;
589
601
590
602
if (req_len == sizeof (nxp_cmd5 )) {
591
603
nxp_cmd5 .header = __cpu_to_le32 (5 );
@@ -598,17 +610,17 @@ static bool nxp_fw_change_baudrate(struct hci_dev *hdev, u16 req_len)
598
610
serdev_device_write_buf (nxpdev -> serdev , (u8 * )& nxp_cmd5 , sizeof (nxp_cmd5 ));
599
611
nxpdev -> fw_v3_offset_correction += req_len ;
600
612
} else if (req_len == sizeof (uart_config )) {
601
- uart_config .clkdiv .address = __cpu_to_le32 (CLKDIVADDR );
613
+ uart_config .clkdiv .address = __cpu_to_le32 (clkdivaddr );
602
614
uart_config .clkdiv .value = __cpu_to_le32 (0x00c00000 );
603
- uart_config .uartdiv .address = __cpu_to_le32 (UARTDIVADDR );
615
+ uart_config .uartdiv .address = __cpu_to_le32 (uartdivaddr );
604
616
uart_config .uartdiv .value = __cpu_to_le32 (1 );
605
- uart_config .mcr .address = __cpu_to_le32 (UARTMCRADDR );
617
+ uart_config .mcr .address = __cpu_to_le32 (uartmcraddr );
606
618
uart_config .mcr .value = __cpu_to_le32 (MCR );
607
- uart_config .re_init .address = __cpu_to_le32 (UARTREINITADDR );
619
+ uart_config .re_init .address = __cpu_to_le32 (uartreinitaddr );
608
620
uart_config .re_init .value = __cpu_to_le32 (INIT );
609
- uart_config .icr .address = __cpu_to_le32 (UARTICRADDR );
621
+ uart_config .icr .address = __cpu_to_le32 (uarticraddr );
610
622
uart_config .icr .value = __cpu_to_le32 (ICR );
611
- uart_config .fcr .address = __cpu_to_le32 (UARTFCRADDR );
623
+ uart_config .fcr .address = __cpu_to_le32 (uartfcraddr );
612
624
uart_config .fcr .value = __cpu_to_le32 (FCR );
613
625
/* FW expects swapped CRC bytes */
614
626
uart_config .crc = __cpu_to_be32 (crc32_be (0UL , (char * )& uart_config ,
@@ -822,6 +834,7 @@ static int nxp_recv_fw_req_v1(struct hci_dev *hdev, struct sk_buff *skb)
822
834
static char * nxp_get_fw_name_from_chipid (struct hci_dev * hdev , u16 chipid ,
823
835
u8 loader_ver )
824
836
{
837
+ struct btnxpuart_dev * nxpdev = hci_get_drvdata (hdev );
825
838
char * fw_name = NULL ;
826
839
827
840
switch (chipid ) {
@@ -834,6 +847,16 @@ static char *nxp_get_fw_name_from_chipid(struct hci_dev *hdev, u16 chipid,
834
847
case CHIP_ID_IW612 :
835
848
fw_name = FIRMWARE_IW612 ;
836
849
break ;
850
+ case CHIP_ID_IW624a :
851
+ case CHIP_ID_IW624c :
852
+ nxpdev -> boot_reg_offset = 1 ;
853
+ if ((loader_ver & FW_SECURE_MASK ) == FW_OPEN )
854
+ fw_name = FIRMWARE_IW624 ;
855
+ else if ((loader_ver & FW_SECURE_MASK ) != FW_AUTH_ILLEGAL )
856
+ fw_name = FIRMWARE_SECURE_IW624 ;
857
+ else
858
+ bt_dev_err (hdev , "Illegal loader version %02x" , loader_ver );
859
+ break ;
837
860
case CHIP_ID_AW693 :
838
861
if ((loader_ver & FW_SECURE_MASK ) == FW_OPEN )
839
862
fw_name = FIRMWARE_AW693 ;
0 commit comments