linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Will Newton <will.newton@gmail.com>
Cc: linux-arm-msm@vger.kernel.org
Subject: Re: wcnss_ctrl firmware loading
Date: Fri, 2 Feb 2018 10:30:57 -0800	[thread overview]
Message-ID: <20180202183057.GG12728@builder> (raw)
In-Reply-To: <CAFbHwiRQDt0zJzJfQ4aXK=YNFP17vok-r7_vSSuNWaNMVTtZnA@mail.gmail.com>

On Thu 04 Jan 02:44 PST 2018, Will Newton wrote:

> Hi,
> 
> I'm running into some issues with getting this driver running on an
> msm8909. The firmware loading code looks a little odd to me so I would
> just like to check it is doing the right thing:
> 

Sorry for not seeing your mail earlier Will.

> 
> 
>                                data = fw->data;
>         left = fw->size;
> 
>         req->hdr.type = WCNSS_DOWNLOAD_NV_REQ;
>         req->hdr.len = sizeof(*req) + NV_FRAGMENT_SIZE;
> 
>         req->last = 0;
>         req->frag_size = NV_FRAGMENT_SIZE;
> 
>         req->seq = 0;
>         do {
>                 if (left <= NV_FRAGMENT_SIZE) {
>                         req->last = 1;
>                         req->frag_size = left;
>                         req->hdr.len = sizeof(*req) + left;
>                 }
> 
>                 memcpy(req->fragment, data, req->frag_size);
> 
>                 ret = rpmsg_send(wcnss->channel, req, req->hdr.len);
>                 if (ret < 0) {
>                         dev_err(wcnss->dev, "failed to send smd packet\n");
>                         goto release_fw;
>                 }
> 
>                 /* Increment for next fragment */
>                 req->seq++;
> 
>                 data += req->hdr.len;

You're correct, this will skip 16 bytes of the firmware for every
fragment of 3072 bytes. I would expect that the download command would
notify us about this, but apparently not.

I still don't know what this NV blob does though, because you have to
upload it again to bring up WiFi (which the wcn36xx driver does).

>                 left -= NV_FRAGMENT_SIZE;
>         } while (left > 0);
> 
> data is incremented by req->hdr.len which includes sizeof(*req) which
> seems wrong, e.g. it should perhaps increment by req->frag_size. Or am
> I missing some subtlety here?
> 
> Strangely it doesn't seem to matter if I change that code, either way
> my firmware startup fails...

I'm unable to see any behavioral change on the db410c after fixing this
as well. But the code is wrong.


The issues that I remember having while working on wcnss was that it
will crash either if the SMD links aren't there, if the pinctrl for the
wcnss pins wasn't set correctly or if the iris configuration
(wcnss_configure_iris()) wasn't done - and make sure that you have the
right XO clock enabled.

As you have SMD I would recommend that you double check the two latter
pieces.

Regards,
Bjorn

      parent reply	other threads:[~2018-02-02 18:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 10:44 wcnss_ctrl firmware loading Will Newton
2018-01-04 11:36 ` Mario Kicherer
2018-01-04 11:41   ` Will Newton
2018-02-02 18:30 ` Bjorn Andersson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180202183057.GG12728@builder \
    --to=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=will.newton@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).