[PATCH v2 2/2] ath11k: Use reserved host DDR addresses from DT for PCI devices
Kalle Valo
kvalo at codeaurora.org
Fri Nov 19 05:08:17 PST 2021
Anilkumar Kolli <akolli at codeaurora.org> writes:
> On 2021-11-17 13:35, Kalle Valo wrote:
>> Anilkumar Kolli <akolli at codeaurora.org> writes:
>>
>>> 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 <akolli at codeaurora.org>
[...]
>>> + 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?
>
>>> + 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
More information about the ath11k
mailing list