All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Molton <ian@mnementh.co.uk>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: "open list:BLUETOOTH DRIVERS" <linux-bluetooth@vger.kernel.org>,
	Loic Poulain <loic.poulain@gmail.com>,
	Rob Herring <robh@kernel.org>
Subject: Re: PATCH: RFC: Broadcom serdev driver
Date: Sat, 8 Jul 2017 10:46:01 +0100	[thread overview]
Message-ID: <a7a41abf-0dc2-03d7-a529-ade49f326bb5@mnementh.co.uk> (raw)
In-Reply-To: <A31E83F8-3A6E-49DC-BF1A-0FA1C6E10552@holtmann.org>

On 08/07/17 08:58, Marcel Holtmann wrote:
>> One oddity I've spotted is that the chip tries to go back to 115200 baud
>> after loading its firmware patch, which messes up the change to
>> oper_speed. I've worked around this by not using the set_baudrate hook,
>> just setting the operating speed after firmware loading in setup.
>
> I assume we addressed that in hci_uart. If not then we need to handle that there first.


In hci_uart_setup() in hci_serdev.c, there is the following:


        if (hu->init_speed)
                speed = hu->init_speed;
        else if (hu->proto->init_speed)
                speed = hu->proto->init_speed;
        else
                speed = 0;

        if (speed)
                serdev_device_set_baudrate(hu->serdev, speed);

        /* Operational speed if any */
        if (hu->oper_speed)
                speed = hu->oper_speed;
        else if (hu->proto->oper_speed)
                speed = hu->proto->oper_speed;
        else
                speed = 0;

        if (hu->proto->set_baudrate && speed) {
                err = hu->proto->set_baudrate(hu, speed);
                if (err)
                        BT_ERR("%s: failed to set baudrate", hdev->name);
                else
                        serdev_device_set_baudrate(hu->serdev, speed);
        }

        if (hu->proto->setup)
                return hu->proto->setup(hu);


The problem is that it attempts to set the baudrate to oper_speed
*prior* to calling the driver's setup() hook.

It *seems* simple enough that we could move the setup call to prior to
the change to oper_speed, but I am unsure how this might affect other
drivers.

I can test this on my driver (and implement the set_baudrate command
properly as a result.

I can send a patch to this effect if you want?

-Ian

  parent reply	other threads:[~2017-07-08  9:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 22:38 PATCH: RFC: Broadcom serdev driver Ian Molton
2017-07-08  7:58 ` Marcel Holtmann
2017-07-08  9:15   ` Ian Molton
2017-07-08 21:46     ` Sebastian Reichel
2017-07-09  8:07       ` Marcel Holtmann
2017-07-10 21:27         ` Ian Molton
2017-07-08  9:46   ` Ian Molton [this message]
2017-07-08 10:25     ` Marcel Holtmann
2017-07-08 13:27       ` Ian Molton

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=a7a41abf-0dc2-03d7-a529-ade49f326bb5@mnementh.co.uk \
    --to=ian@mnementh.co.uk \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=loic.poulain@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=robh@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.