From: Arend van Spriel <arend@broadcom.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Ilya Faenson <ifaenson@broadcom.com>,
Frederic Danis <frederic.danis@linux.intel.com>,
"linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v6 4/5] Bluetooth: hci_uart: Update Broadcom UART setup
Date: Sat, 6 Jun 2015 09:12:40 +0200 [thread overview]
Message-ID: <55729D68.1050607@broadcom.com> (raw)
In-Reply-To: <D5EDC898-B451-4978-A13A-7BEBC9D093EB@holtmann.org>
On 06/06/15 08:18, Marcel Holtmann wrote:
> Hi Ilya,
>
>>>>>>> Use btbcm helpers to perform controller setup.
>>>>>>> Perform host UART reset to init speed between btbcm_patchram() and
>>>>>>> btbcm_finalize(). This may be need because firmware loading may have
>>>>>>> reseted controller UART to init speed.
>>>>>>>
>>>>>>> Signed-off-by: Frederic Danis<frederic.danis@linux.intel.com>
>>>>>>> ---
>>>>>>> drivers/bluetooth/hci_bcm.c | 19 ++++++++++++++++++-
>>>>>>> 1 file changed, 18 insertions(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
>>>>>>> index 1ec0b4a..cede445 100644
>>>>>>> --- a/drivers/bluetooth/hci_bcm.c
>>>>>>> +++ b/drivers/bluetooth/hci_bcm.c
>>>>>>> @@ -79,11 +79,28 @@ static int bcm_flush(struct hci_uart *hu)
>>>>>>>
>>>>>>> static int bcm_setup(struct hci_uart *hu)
>>>>>>> {
>>>>>>> + char fw_name[64];
>>>>>>> + int err;
>>>>>>> +
>>>>>>> BT_DBG("hu %p", hu);
>>>>>>>
>>>>>>> hu->hdev->set_bdaddr = btbcm_set_bdaddr;
>>>>>>>
>>>>>>> - return btbcm_setup_patchram(hu->hdev);
>>>>>>> + err = btbcm_initialize(hu->hdev, fw_name, sizeof(fw_name));
>>>>>>> + if (err)
>>>>>>> + return err;
>>>>>>> +
>>>>>>> + err = btbcm_patchram(hu->hdev, fw_name);
>>>>>>> + /* If there is no firmware (-ENOENT), discard the error and
>>>>>>> continue */
>>>>>>
>>>>>> I guess -ENOENT means no firmware is required and not a
>>>>>> request_firmware() failure. Not sure what is meant here.
>>>>>>
>>>>>> Regards,
>>>>>> Arend
>>>>>>
>>>>>>> + if (err == -ENOENT)
>>>>>>> + return 0;
>>>>>>> +
>>>>>>> + if (hu->proto->init_speed)
>>>>>>> + hci_uart_set_baudrate(hu, hu->proto->init_speed);
>>>>>>> +
>>>>>>> + err = btbcm_finalize(hu->hdev);
>>>>>>> +
>>>>>>> + return err;
>>>>>>> }
>>>>>>>
>>>>>>> static const struct h4_recv_pkt bcm_recv_pkts[] = {
>>>>>
>>>>> You're right, btbcm_patchram() return test does not work as I expected.
>>>>>
>>>>> I can change this by performing uart speed change only if it returns no
>>>>> error.
>>>>>
>>>>> err = btbcm_patchram(hu->hdev, fw_name);
>>>>> if (!err) {
>>>>> /* Firmware loading may have reseted controller UART to init speed */
>>>>> if (hu->proto->init_speed)
>>>>> hci_uart_set_baudrate(hu, hu->proto->init_speed);
>>>>> }
>>>>>
>>>>> err = btbcm_finalize(hu->hdev);
>>>>>
>>>>>
>>>>> Or I can move request_firmware() out of btbcm_patchram() and test it
>>>>> before calling btbcm_patchram(). This will imply to change
>>>>> btbcm_patchram() to accept a firmware instead of firmware name.
>>>>>
>>>>> err = request_firmware(&fw, fw_name,&hu->hdev->dev);
>>>>> if (err< 0) {
>>>>> BT_INFO("%s: BCM: patch %s not found", hu->hdev->name, fw_name);
>>>>> return 0;
>>>>> }
>>>>>
>>>>> err = btbcm_patchram(hu->hdev, fw);
>>>>> if (!err) {
>>>>> /* Firmware loading may have reseted controller UART to init speed */
>>>>> if (hu->proto->init_speed)
>>>>> hci_uart_set_baudrate(hu, hu->proto->init_speed);
>>>>> }
>>>>>
>>>>> err = btbcm_finalize(hu->hdev);
>>>>>
>>>>> Arend, Marcel, any advice regarding this ?
>>>>
>>>> Well, functionally it does not make a difference as the request_firmware
>>>> is the first call done in btbcm_patchram(). So if it solves your problem
>>>> I would go for option 2. Other question: is there a reason why the error
>>>> code from request_firmware is not returned?
>>>
>>> If an error is returned it will stop Bluetooth setup.
>>> So, when request_firmware() returns an error, the Bluetooth controller
>>> will be used with current firmware and 0 is returned as bcm_setup is
>>> completed.
>>>
>>> IF: There is generally no "current firmware" if the firmware download fails or not attempted. The device would run out of the ROM then which is not terribly useful if Bluetooth functionality is needed. Thanks, -Ilya
>>
>> The BCM4324B3 embedded in T100 is able to operate without firmware
>> loading, at least performing Bluetooth discovery.
>> I think it is better to run without firmware loading than not allowing
>> to use Bluetooth controller at all.
>>
>> IF: Broadcom software elsewhere generally fails device start in this case as every Bluetooth feature may or may not work afterwards, with no guarantees whatsoever. The decision here is obviously up to BlueZ maintainers.
>
> I am fine with actually doing exactly that once we have a bit better infrastructure in place. However this also requires a commitment from Broadcom to actually publish the firmware files in linux-firmware tree and maintain the manifest document I have been talking about.
Hi Marcel,
What is the added value of having the manifest file? I can see it keeps
mapping hardware info to firmware file out of the driver and as such
keeps the driver from growing in size for new device support. Just
wondering how big that issue is. It also poses other issues as it adds
another interaction with the firmware api, which in my opinion is still
a nasty api from driver perspective.
Regards,
Arend
next prev parent reply other threads:[~2015-06-06 7:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 15:46 [PATCH v6 0/5] Add baudrate management for Bluetooth UART Frederic Danis
2015-05-20 15:46 ` [PATCH v6 1/5] Bluetooth: btbcm: Add BCM4324B3 UART device Frederic Danis
2015-05-20 15:46 ` [PATCH v6 2/5] Bluetooth: hci_uart: Support operational speed during setup Frederic Danis
2015-05-20 15:46 ` [PATCH v6 3/5] Bluetooth: btbcm: Add helper functions for UART setup Frederic Danis
2015-05-20 15:46 ` [PATCH v6 4/5] Bluetooth: hci_uart: Update Broadcom " Frederic Danis
2015-05-21 13:50 ` Arend van Spriel
2015-05-22 12:50 ` Frederic Danis
2015-05-22 13:27 ` Arend van Spriel
2015-05-22 13:33 ` Arend van Spriel
2015-05-22 13:49 ` Frederic Danis
2015-05-22 13:55 ` Ilya Faenson
2015-05-26 12:41 ` Frederic Danis
2015-05-26 13:33 ` Ilya Faenson
2015-06-06 6:18 ` Marcel Holtmann
2015-06-06 7:12 ` Arend van Spriel [this message]
2015-06-06 7:24 ` Marcel Holtmann
2015-06-06 8:02 ` Arend van Spriel
2015-06-09 7:40 ` Marcel Holtmann
2015-05-20 15:46 ` [PATCH v6 5/5] Bluetooth: hci_uart: Add bcm_set_baudrate() Frederic Danis
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=55729D68.1050607@broadcom.com \
--to=arend@broadcom.com \
--cc=frederic.danis@linux.intel.com \
--cc=ifaenson@broadcom.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.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 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).