Thread (1 message) 1 message, 1 author, 2021-11-19

Re: [PATCH v2 2/2] ath11k: Use reserved host DDR addresses from DT for PCI devices

From: Kalle Valo <hidden>
Date: 2021-11-19 13:08:26
Also in: ath11k, linux-wireless

Anilkumar Kolli [off-list ref] writes:
On 2021-11-17 13:35, Kalle Valo wrote:
quoted
Anilkumar Kolli [off-list ref] writes:
quoted
Host DDR memory (contiguous 45 MB in mode-0 or 15 MB in mode-2)
is reserved through DT entries for firmware usage. Send the base
address and size from DT entries.

If DT entry is available, PCI devices work with
fixed_mem_region else host allocates multiple segments.

IPQ8074 on HK10 board supports multiple PCI devices.
IPQ8074 + QCN9074 is tested with this patch.

Tested-on: QCN9074 hw1.0 PCI
WLAN.HK.2.4.0.1-01838-QCAHKSWPL_SILICONZ-1

Signed-off-by: Anilkumar Kolli <redacted>
[...]
quoted
quoted
+		goto no_dt_entry;
+	}
+
+	reg_end = reg + len / (aw * sw);
+
+	do {
+		start = of_read_number(reg, aw);
+		reg += aw;
+		size = of_read_number(reg, sw);
of_read_number() takes 'const __be32 *cell' but reg is 'u32 *'?
Yes.
My point here was that doesn't this mixing of __be32 and u32 when cause
a sparse warning?
quoted
quoted
+		reg += sw;
+	} while (reg < reg_end);
+
+no_dt_entry:
+	if (no_dt_entry) {
+		mhi_ctrl->iova_start = 0;
+		mhi_ctrl->iova_stop = 0xFFFFFFFF;
+	} else {
+		mhi_ctrl->iova_start = (dma_addr_t)(start + 0x1000000);
+		mhi_ctrl->iova_stop = (dma_addr_t)(start + size);
I don't like casts, they hide bugs like the const issue above. Is there
any way to do this without casts?
u64 start, size;

    if (of_property_read_u32_array(np, "reg", reg, 4)) {
         ath11k_dbg(ab, ATH11K_DBG_QMI,
                    "qmi fail to get reg from hremote\n");
         return 0;
    }
    start = reg[0] + reg[1];
    size = reg[2] + reg[3];

I will this code in next patch. still needs typecast form u64 to
dma_addr_t. no ?
I suspect that a cast is not needed, but not sure. No time to check either.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help