Skip to content

Commit f471578

Browse files
Alexander WilhelmMani-Sadhasivam
authored andcommitted
bus: mhi: host: Fix endianness of BHI vector table
On big endian platform like PowerPC, the MHI bus (which is little endian) does not start properly. The following example shows the error messages by using QCN9274 WLAN device with ath12k driver: ath12k_pci 0001:01:00.0: BAR 0: assigned [mem 0xc00000000-0xc001fffff 64bit] ath12k_pci 0001:01:00.0: MSI vectors: 1 ath12k_pci 0001:01:00.0: Hardware name: qcn9274 hw2.0 ath12k_pci 0001:01:00.0: failed to set mhi state: POWER_ON(2) ath12k_pci 0001:01:00.0: failed to start mhi: -110 ath12k_pci 0001:01:00.0: failed to power up :-110 ath12k_pci 0001:01:00.0: failed to create soc core: -110 ath12k_pci 0001:01:00.0: failed to init core: -110 ath12k_pci: probe of 0001:01:00.0 failed with error -110 The issue seems to be with the incorrect DMA address/size used for transferring the firmware image over BHI. So fix it by converting the DMA address and size of the BHI vector table to little endian format before sending them to the device. Fixes: 6cd330a ("bus: mhi: core: Add support for ringing channel/event ring doorbells") Signed-off-by: Alexander Wilhelm <[email protected]> [mani: added stable tag and reworded commit message] Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Jeff Hugo <[email protected]> Reviewed-by: Krishna Chaitanya Chundru <[email protected]> Cc: [email protected] Link: https://patch.msgid.link/[email protected]
1 parent 0494cf9 commit f471578

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/bus/mhi/host/boot.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,
3131
int ret;
3232

3333
for (i = 0; i < img_info->entries - 1; i++, mhi_buf++, bhi_vec++) {
34-
bhi_vec->dma_addr = mhi_buf->dma_addr;
35-
bhi_vec->size = mhi_buf->len;
34+
bhi_vec->dma_addr = cpu_to_le64(mhi_buf->dma_addr);
35+
bhi_vec->size = cpu_to_le64(mhi_buf->len);
3636
}
3737

3838
dev_dbg(dev, "BHIe programming for RDDM\n");
@@ -431,8 +431,8 @@ static void mhi_firmware_copy_bhie(struct mhi_controller *mhi_cntrl,
431431
while (remainder) {
432432
to_cpy = min(remainder, mhi_buf->len);
433433
memcpy(mhi_buf->buf, buf, to_cpy);
434-
bhi_vec->dma_addr = mhi_buf->dma_addr;
435-
bhi_vec->size = to_cpy;
434+
bhi_vec->dma_addr = cpu_to_le64(mhi_buf->dma_addr);
435+
bhi_vec->size = cpu_to_le64(to_cpy);
436436

437437
buf += to_cpy;
438438
remainder -= to_cpy;

drivers/bus/mhi/host/internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ struct mhi_ctxt {
2525
};
2626

2727
struct bhi_vec_entry {
28-
u64 dma_addr;
29-
u64 size;
28+
__le64 dma_addr;
29+
__le64 size;
3030
};
3131

3232
enum mhi_fw_load_type {

0 commit comments

Comments
 (0)