2020-06-09 05:05:36

by Anilkumar Kolli

[permalink] [raw]
Subject: [PATCH 7/8] ath11k: add ce services for IPQ6018

IPQ6018 does not support mac2, add a new ce service map.

Signed-off-by: Anilkumar Kolli <[email protected]>
---
drivers/net/wireless/ath/ath11k/ahb.c | 122 ++++++++++++++++++++++++++++++++--
1 file changed, 117 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
index b080ad8fab0a..25764f719db0 100644
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -155,7 +155,7 @@ static const struct ce_pipe_config target_ce_config_wlan[] = {
* This table is derived from the CE_PCI TABLE, above.
* It is passed to the Target at startup for use by firmware.
*/
-static const struct service_to_pipe target_service_to_ce_map_wlan[] = {
+static const struct service_to_pipe target_service_to_ce_map_wlan_ipq8074[] = {
{
.service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
.pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
@@ -267,6 +267,108 @@ static const struct service_to_pipe target_service_to_ce_map_wlan[] = {
{ /* terminator entry */ }
};

+static const struct service_to_pipe target_service_to_ce_map_wlan_ipq6018[] = {
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(3),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(2),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(3),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(2),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(3),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(2),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(3),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(2),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(3),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(2),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(7),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(2),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(0),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(1),
+ },
+ { /* not used */
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(0),
+ },
+ { /* not used */
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(1),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
+ .pipenum = __cpu_to_le32(4),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(1),
+ },
+ {
+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG),
+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
+ .pipenum = __cpu_to_le32(5),
+ },
+
+ /* (Additions here) */
+
+ { /* terminator entry */ }
+};
+
#define ATH11K_IRQ_CE0_OFFSET 4

static const char *irq_name[ATH11K_IRQ_NUM_MAX] = {
@@ -647,8 +749,15 @@ static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab)

cfg->tgt_ce_len = ARRAY_SIZE(target_ce_config_wlan) - 1;
cfg->tgt_ce = target_ce_config_wlan;
- cfg->svc_to_ce_map_len = ARRAY_SIZE(target_service_to_ce_map_wlan);
- cfg->svc_to_ce_map = target_service_to_ce_map_wlan;
+ if (ab->hw_params.dev_id == ATH11K_HW_IPQ6018) {
+ cfg->svc_to_ce_map_len =
+ ARRAY_SIZE(target_service_to_ce_map_wlan_ipq6018);
+ cfg->svc_to_ce_map = target_service_to_ce_map_wlan_ipq6018;
+ } else {
+ cfg->svc_to_ce_map_len =
+ ARRAY_SIZE(target_service_to_ce_map_wlan_ipq8074);
+ cfg->svc_to_ce_map = target_service_to_ce_map_wlan_ipq8074;
+ }
}

static void ath11k_ahb_free_ext_irq(struct ath11k_base *ab)
@@ -856,8 +965,11 @@ static int ath11k_ahb_map_service_to_pipe(struct ath11k_base *ab, u16 service_id
bool ul_set = false, dl_set = false;
int i;

- for (i = 0; i < ARRAY_SIZE(target_service_to_ce_map_wlan); i++) {
- entry = &target_service_to_ce_map_wlan[i];
+ for (i = 0; i < ab->qmi.ce_cfg.svc_to_ce_map_len; i++) {
+ if (ab->hw_params.dev_id == ATH11K_HW_IPQ6018)
+ entry = &target_service_to_ce_map_wlan_ipq6018[i];
+ else
+ entry = &target_service_to_ce_map_wlan_ipq8074[i];

if (__le32_to_cpu(entry->service_id) != service_id)
continue;
--
2.7.4


2020-06-09 07:11:05

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH 7/8] ath11k: add ce services for IPQ6018

Hi Anilkumar,

On Tue, Jun 9, 2020 at 3:07 PM Anilkumar Kolli <[email protected]> wrote:
>
> IPQ6018 does not support mac2, add a new ce service map.
>
> Signed-off-by: Anilkumar Kolli <[email protected]>
> ---
> drivers/net/wireless/ath/ath11k/ahb.c | 122 ++++++++++++++++++++++++++++++++--
> 1 file changed, 117 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
> index b080ad8fab0a..25764f719db0 100644
> --- a/drivers/net/wireless/ath/ath11k/ahb.c
> +++ b/drivers/net/wireless/ath/ath11k/ahb.c
> @@ -647,8 +749,15 @@ static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab)
>
> cfg->tgt_ce_len = ARRAY_SIZE(target_ce_config_wlan) - 1;
> cfg->tgt_ce = target_ce_config_wlan;
> - cfg->svc_to_ce_map_len = ARRAY_SIZE(target_service_to_ce_map_wlan);
> - cfg->svc_to_ce_map = target_service_to_ce_map_wlan;
> + if (ab->hw_params.dev_id == ATH11K_HW_IPQ6018) {
> + cfg->svc_to_ce_map_len =
> + ARRAY_SIZE(target_service_to_ce_map_wlan_ipq6018);
> + cfg->svc_to_ce_map = target_service_to_ce_map_wlan_ipq6018;
> + } else {
> + cfg->svc_to_ce_map_len =
> + ARRAY_SIZE(target_service_to_ce_map_wlan_ipq8074);
> + cfg->svc_to_ce_map = target_service_to_ce_map_wlan_ipq8074;
> + }

You could just have a pointer to this array in the "hw_params"
structure which would reduce this to something like:

cfg->svc_to_ce_map_len = ARRAY_SIZE(ab->hw_params.service_to_ce_map);
cfg->svc_to_ce_map = ab->hw_params.service_to_ce_map;

and make adding future hardware easier.

> }
>
> static void ath11k_ahb_free_ext_irq(struct ath11k_base *ab)
> @@ -856,8 +965,11 @@ static int ath11k_ahb_map_service_to_pipe(struct ath11k_base *ab, u16 service_id
> bool ul_set = false, dl_set = false;
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(target_service_to_ce_map_wlan); i++) {
> - entry = &target_service_to_ce_map_wlan[i];
> + for (i = 0; i < ab->qmi.ce_cfg.svc_to_ce_map_len; i++) {

Is this the same "svc_to_ce_map_len" as in the hunk above?

If so the code below could just be:

entry = &ab->qmi.ce_cfg.svc_to_ce_map[i];

> + if (ab->hw_params.dev_id == ATH11K_HW_IPQ6018)
> + entry = &target_service_to_ce_map_wlan_ipq6018[i];
> + else
> + entry = &target_service_to_ce_map_wlan_ipq8074[i];
>
> if (__le32_to_cpu(entry->service_id) != service_id)
> continue;
> --
> 2.7.4
>

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

2020-06-15 14:21:30

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 7/8] ath11k: add ce services for IPQ6018

Julian Calaby <[email protected]> writes:

> On Tue, Jun 9, 2020 at 3:07 PM Anilkumar Kolli <[email protected]> wrote:
>>
>> IPQ6018 does not support mac2, add a new ce service map.
>>
>> Signed-off-by: Anilkumar Kolli <[email protected]>
>> ---
>> drivers/net/wireless/ath/ath11k/ahb.c | 122 ++++++++++++++++++++++++++++++++--
>> 1 file changed, 117 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
>> index b080ad8fab0a..25764f719db0 100644
>> --- a/drivers/net/wireless/ath/ath11k/ahb.c
>> +++ b/drivers/net/wireless/ath/ath11k/ahb.c
>> @@ -647,8 +749,15 @@ static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab)
>>
>> cfg->tgt_ce_len = ARRAY_SIZE(target_ce_config_wlan) - 1;
>> cfg->tgt_ce = target_ce_config_wlan;
>> - cfg->svc_to_ce_map_len = ARRAY_SIZE(target_service_to_ce_map_wlan);
>> - cfg->svc_to_ce_map = target_service_to_ce_map_wlan;
>> + if (ab->hw_params.dev_id == ATH11K_HW_IPQ6018) {
>> + cfg->svc_to_ce_map_len =
>> + ARRAY_SIZE(target_service_to_ce_map_wlan_ipq6018);
>> + cfg->svc_to_ce_map = target_service_to_ce_map_wlan_ipq6018;
>> + } else {
>> + cfg->svc_to_ce_map_len =
>> + ARRAY_SIZE(target_service_to_ce_map_wlan_ipq8074);
>> + cfg->svc_to_ce_map = target_service_to_ce_map_wlan_ipq8074;
>> + }
>
> You could just have a pointer to this array in the "hw_params"
> structure which would reduce this to something like:
>
> cfg->svc_to_ce_map_len = ARRAY_SIZE(ab->hw_params.service_to_ce_map);
> cfg->svc_to_ce_map = ab->hw_params.service_to_ce_map;
>
> and make adding future hardware easier.

Yeah, that's a good idea.

--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches