diff options
author | Xinming Hu <huxm@marvell.com> | 2014-11-24 05:40:53 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-12-03 11:35:51 -0500 |
commit | dc759613b0247eb1658d3992f50ba3fad5b61d31 (patch) | |
tree | 5ae91a8d93f48204c9c3658b2eba00594c2fb689 /drivers/bluetooth/btmrvl_drv.h | |
parent | 7365d475bf6a0e2497ac4ef29474fffb91d024f1 (diff) |
Bluetooth: btmrvl add firmware dump support
This patch adds firmware dump support for marvell
bluetooth chipset. Currently only SD8897 is supported.
This is implemented based on dev_coredump, a new mechnism
introduced in kernel 3.18rc3
Firmware dump can be trigger by
echo 1 > /sys/kernel/debug/bluetooth/hci*/config/fw_dump
and when the dump operation is completed, data can be read by
cat /sys/class/devcoredump/devcd*/data
We have prepared following script to divide fw memory
dump data into multiple files based on memory type.
[root]# cat btmrvl_split_dump_data.sh
#!/bin/bash
# usage: ./btmrvl_split_dump_data.sh dump_data
fw_dump_data=$1
mem_type="ITCM DTCM SQRAM APU CIU ICU MAC EXT7 EXT8 EXT9 EXT10 EXT11 EXT12 EXT13 EXTLAST"
for name in ${mem_type[@]}
do
sed -n "/Start dump $name/,/End dump/p" $fw_dump_data > tmp.$name.log
if [ ! -s tmp.$name.log ]
then
rm -rf tmp.$name.log
else
# Remove the describle info "Start dump" and "End dump"
sed '1d' tmp.$name.log | sed '$d' > /data/$name.log
if [ -s /data/$name.log ]
then
echo "generate /data/$name.log"
else
sed '1d' tmp.$name.log | sed '$d' > /var/$name.log
echo "generate /var/$name.log"
fi
rm -rf tmp.$name.log
fi
done
Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btmrvl_drv.h')
-rw-r--r-- | drivers/bluetooth/btmrvl_drv.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h index 38ad66289ad6..330f8f84928d 100644 --- a/drivers/bluetooth/btmrvl_drv.h +++ b/drivers/bluetooth/btmrvl_drv.h | |||
@@ -32,6 +32,24 @@ | |||
32 | /* Time to wait for command response in millisecond */ | 32 | /* Time to wait for command response in millisecond */ |
33 | #define WAIT_UNTIL_CMD_RESP 5000 | 33 | #define WAIT_UNTIL_CMD_RESP 5000 |
34 | 34 | ||
35 | enum rdwr_status { | ||
36 | RDWR_STATUS_SUCCESS = 0, | ||
37 | RDWR_STATUS_FAILURE = 1, | ||
38 | RDWR_STATUS_DONE = 2 | ||
39 | }; | ||
40 | |||
41 | #define FW_DUMP_MAX_NAME_LEN 8 | ||
42 | #define FW_DUMP_HOST_READY 0xEE | ||
43 | #define FW_DUMP_DONE 0xFF | ||
44 | #define FW_DUMP_READ_DONE 0xFE | ||
45 | |||
46 | struct memory_type_mapping { | ||
47 | u8 mem_name[FW_DUMP_MAX_NAME_LEN]; | ||
48 | u8 *mem_ptr; | ||
49 | u32 mem_size; | ||
50 | u8 done_flag; | ||
51 | }; | ||
52 | |||
35 | struct btmrvl_thread { | 53 | struct btmrvl_thread { |
36 | struct task_struct *task; | 54 | struct task_struct *task; |
37 | wait_queue_head_t wait_q; | 55 | wait_queue_head_t wait_q; |
@@ -81,6 +99,7 @@ struct btmrvl_private { | |||
81 | u8 *payload, u16 nb); | 99 | u8 *payload, u16 nb); |
82 | int (*hw_wakeup_firmware) (struct btmrvl_private *priv); | 100 | int (*hw_wakeup_firmware) (struct btmrvl_private *priv); |
83 | int (*hw_process_int_status) (struct btmrvl_private *priv); | 101 | int (*hw_process_int_status) (struct btmrvl_private *priv); |
102 | void (*firmware_dump)(struct btmrvl_private *priv); | ||
84 | spinlock_t driver_lock; /* spinlock used by driver */ | 103 | spinlock_t driver_lock; /* spinlock used by driver */ |
85 | #ifdef CONFIG_DEBUG_FS | 104 | #ifdef CONFIG_DEBUG_FS |
86 | void *debugfs_data; | 105 | void *debugfs_data; |
@@ -151,6 +170,7 @@ int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv); | |||
151 | int btmrvl_enable_ps(struct btmrvl_private *priv); | 170 | int btmrvl_enable_ps(struct btmrvl_private *priv); |
152 | int btmrvl_prepare_command(struct btmrvl_private *priv); | 171 | int btmrvl_prepare_command(struct btmrvl_private *priv); |
153 | int btmrvl_enable_hs(struct btmrvl_private *priv); | 172 | int btmrvl_enable_hs(struct btmrvl_private *priv); |
173 | void btmrvl_firmware_dump(struct btmrvl_private *priv); | ||
154 | 174 | ||
155 | #ifdef CONFIG_DEBUG_FS | 175 | #ifdef CONFIG_DEBUG_FS |
156 | void btmrvl_debugfs_init(struct hci_dev *hdev); | 176 | void btmrvl_debugfs_init(struct hci_dev *hdev); |