From: Marcel Holtmann <marcel@holtmann.org>
To: Rob Herring <robherring2@gmail.com>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>,
"ksummit-discuss@lists.linuxfoundation.org"
<ksummit-discuss@lists.linuxfoundation.org>,
Greg KH <gregkh@linuxfoundation.org>,
"kyungmin.park@samsung.com" <kyungmin.park@samsung.com>,
John Stultz <john.stultz@linaro.org>, Pavel Machek <pavel@ucw.cz>
Subject: Re: [Ksummit-discuss] [CORE TOPIC] Mainline kernel on a cellphone
Date: Wed, 5 Aug 2015 10:00:22 -0700 [thread overview]
Message-ID: <BA8B014B-CBDD-4A9B-A9E2-A95BEA539ECF@holtmann.org> (raw)
In-Reply-To: <55C2337A.9010500@gmail.com>
Hi Rob,
>>>>> The WiFi side is actually in better shape than BT. With BT, we
>>>>> have Bluedroid vs. BlueZ, no real DT bindings to describe BT
>>>>> chips (plenty of examples of how not to do it[1]), and chip
>>>>> specific userspace initialization (firmware loading, baudrate
>>>>> setup, power mgt).
>>>>
>>>> I was looking at it at one point and couldn't wrap my head around
>>>> how the BT support was devised from a kernel point of view.
>>>>
>>>> It seems BT chips more often than not sit on a UART connection
>>>> (often very high speed) and since there is no "uart bus" or
>>>> "serial bus" akin to what we have for I2C or SPI, it is actually
>>>> impossible to instantiate them properly in the driver model.
>>>> Instead BT drivers are poked and peeked from userspace using the
>>>> line discipline as if they were some kind of modem, just
>>>> in-kernel.
>>>
>>> Yes, but then there's always some side band signals for regulator
>>> control, reset, clocks, wake-up, rf-kill, etc. that needs a glue
>>> driver. There's been some work by Neil Brown to create a UART
>>> slave bus[1] and I've gotten several other UART device bindings
>>> recently, but they all suffer from being one off device bindings
>>> done in different ways and I want to see something common here.
>>>
>>> It also seems the BT folks are working on moving more of the setup
>>> into the kernel and creating a proper subsystem. I'm not sure
>>> about the details on that.
>>
>> we are indeed moving a lot of the initialization and handling of the
>> Bluetooth controller into the kernel. So that this can also be shared
>> between USB and UART based controllers.
>>
>> The work on UART slaves (or whatever it will be called eventually) is
>> important for Bluetooth and most likely GPS and NFC in the future. It
>> then allows to define all the nasty behind the curtain details of
>> that UART via DT or ACPI in vendor drivers.
>>
>> The Bluetooth driver in theory should not care at all and generally
>> speaking it doesn't since the Bluetooth SIG has defined a Host
>> Controller Interface (HCI) that is standard. Meaning all operation
>> are well defined. Just the transport over UART has many vendor
>> specific tweaks. The two most obvious ones are deep sleep modes and
>> running the UART at high speeds.
>>
>> In a perfect world I would prefer we are not using the Bluetooth HCI
>> line discipline at all. The problem right now is that everybody wants
>> to enable the UART as /dev/ttyFOO and then move on. However in
>> reality they are not general purpose TTY devices. The only thing you
>> can ever do with them is tell the Bluetooth subsystem that there is a
>> TTY device and attach its line discipline to it.
>>
>> The majority of these high speed UARTs in phones, tablets and also
>> laptops with Bluetooth chips attached to it should just expose a
>> special bus that we can then enumerate. Pretending to a general
>> purpose UART is actually cumbersome and you will just see more and
>> more of these.
>
> Hardware-wise, the UARTs on SOCs I've seen are no different whether used
> for console or BT device. Of course, running UARTs at 3-4Mbps means
> things like hooking up external DMA controllers which are kind of
> pointless for normal tty use.
>
> Perhaps BT and other UART devices could interface directly to the
> serial_core/uart_port layer rather than the tty layer? I've got no idea
> if that would buy us anything though. I'm guessing part of the problem
> here is the requirements for a character based interface are different
> from a more packet based interface (HCI) even if the h/w is the same.
interfacing directly with the serial / UART layer would be beneficial. For example ACPI already describes if the UART is used for Bluetooth operation and what settings it expects. That means that there is really no point in hooking it up as /dev/ttyFOO and then expect userspace to discover it again and attach a line discipline to it.
However for this to work, the UART layer would have to have some smarts to turn the extra ACPI provided information into a decision between /dev/ttyFOO and the creation of platform device. If such a platform device is present, we can then easily enumerate from a simple Bluetooth H:4 or 3-Wire driver. It just bind it it similar to what USB and SDIO is doing.
And of course exposing the same via DT instead of ACPI should be possible as well. I just know that ACPI has this since on Intel platforms it has been exposed like this for a while now. The main problem is that non of this is available easily to userspace to make the same smart decision on what TTY device node is for Bluetooth and what is the actual vendor of the Bluetooth chip. We need that as well to drive different firmware loading strategies.
Instead of a platform device, the TTY / UART layer could also turn into its own bus for these kind of things. I just don't know if bus vs platform device is the right solution here.
>> While Bluetooth supports USB and SDIO as well, the most common other
>> low power interface is the UART (using H:4 or 3-Wire Bluetooth
>> transports). The usage of PCI or SPI or I2C as interface to Bluetooth
>> never really happened.
>>
>> Current Bluetooth/WiFi chips usually come in these flavors. WiFi on
>> PCIe + Bluetooth on USB, WiFi + Bluetooth on USB, WiFi + Bluetooth on
>> SDIO and WiFi on SDIO + Bluetooth on UART. Now if you are building a
>> mobile phone, you can choose the low power version you like. And this
>> often turns into SDIO for WiFi and UART for Bluetooth.
>
> SDIO is such a pain. The hosts and devices have so many quirks as there
> is no interoperability testing.
What I have found is that the quirks are in the host controller for SDIO. Once that is working, the drivers have less quirks to handle. Then again, the number of Bluetooth based SDIO devices is limited. The majority of them are UART based in embedded devices.
> Do you ever see interdependencies between the BT and WiFi portions of
> the combo chips which have different host interfaces? They seem to be
> fairly well separated AFAICT. Some things like shared irq, clocks or
> regulators can be dealt with easily, but if you had things like the WiFi
> firmware has to be loaded and running before BT can work or vice-versa
> that would be a pain to deal with. That would impact how we do DT
> bindings as well.
In the combo chips the vendor normally has figured this out. So I have not heard about large. I can speak about some funky stuff from the past that never made it to the market, but lets not go there.
Regards
Marcel
next prev parent reply other threads:[~2015-08-05 17:00 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 10:57 Pavel Machek
2015-07-23 11:21 ` Linus Walleij
2015-07-23 12:14 ` Pavel Machek
2015-07-23 12:42 ` Steven Rostedt
2015-07-23 15:40 ` Mark Brown
2015-07-28 22:09 ` Tim Bird
2015-07-28 23:07 ` Bjorn Andersson
2015-07-31 16:18 ` Rob Herring
2015-07-31 16:56 ` Bjorn Andersson
2015-08-11 9:34 ` Johannes Berg
2015-07-31 17:25 ` Tim Bird
2015-08-03 15:29 ` John W. Linville
2015-08-03 7:42 ` Linus Walleij
2015-08-03 21:34 ` Rob Herring
2015-08-03 22:36 ` Marcel Holtmann
2015-08-05 8:40 ` Linus Walleij
2015-08-05 8:46 ` Linus Walleij
2015-08-05 9:11 ` Samuel Ortiz
2015-08-05 11:54 ` Pavel Machek
2015-08-05 9:09 ` Samuel Ortiz
2015-08-05 17:19 ` Marcel Holtmann
2015-08-05 16:02 ` Rob Herring
2015-08-05 17:00 ` Marcel Holtmann [this message]
2015-08-07 12:40 ` Linus Walleij
2015-07-29 0:45 ` Krzysztof Kozlowski
2015-07-29 6:12 ` Laurent Pinchart
2015-07-29 7:40 ` Pavel Machek
2015-08-25 18:59 ` Tim Bird
2015-08-26 1:22 ` Krzysztof Kozlowski
2015-08-26 4:25 ` Sudip Mukherjee
2015-08-26 4:52 ` Krzysztof Kozlowski
2015-08-26 5:30 ` Laurent Pinchart
2015-08-26 5:33 ` Krzysztof Kozlowski
2015-08-26 6:15 ` Josh Triplett
2015-08-26 7:23 ` Heiko Stuebner
2015-08-26 8:05 ` Krzysztof Kozlowski
2015-08-28 8:20 ` Nicolas Ferre
2015-08-26 11:33 ` Mark Brown
2015-08-26 12:56 ` Jason Cooper
2015-08-26 13:35 ` Geert Uytterhoeven
2015-08-26 13:58 ` Sudip Mukherjee
2015-08-26 14:51 ` Jason Cooper
2015-08-26 17:13 ` Sudip Mukherjee
2015-08-26 20:09 ` Greg Kroah-Hartman
2015-08-28 7:44 ` Pavel Machek
2015-08-28 8:42 ` Heiko Stuebner
2015-08-29 15:47 ` Sudip Mukherjee
2015-07-29 8:18 ` Heiko Stübner
2015-07-29 0:56 ` Rafael J. Wysocki
2015-07-29 6:43 ` Daniel Vetter
2015-07-29 17:42 ` Tim Bird
2015-07-29 7:14 ` Bintian
2015-07-29 18:07 ` Tim Bird
2015-07-31 1:50 ` Bintian
2015-07-23 20:29 ` Pavel Machek
2015-07-23 20:34 ` Pavel Machek
2015-07-24 4:34 ` NeilBrown
2015-07-24 6:00 ` Tony Lindgren
2015-07-24 22:26 ` Rafael J. Wysocki
2015-07-28 22:03 ` NeilBrown
2015-07-29 0:51 ` Rafael J. Wysocki
2015-07-29 23:23 ` Rafael J. Wysocki
2015-07-29 23:59 ` NeilBrown
2015-07-30 0:57 ` Rafael J. Wysocki
2015-07-31 17:55 ` Mark Brown
2015-08-01 0:08 ` Rafael J. Wysocki
2015-07-23 21:00 ` josh
2015-07-23 21:29 ` Pavel Machek
2015-07-29 13:32 ` Mark Brown
2015-07-31 12:22 ` Pavel Machek
2015-07-31 17:52 ` Mark Brown
2015-07-31 22:03 ` Pavel Machek
2015-08-01 10:55 ` Mark Brown
2015-08-01 19:03 ` Pavel Machek
2015-08-04 17:17 ` Mark Brown
2015-08-03 5:33 ` Tony Lindgren
2015-07-23 13:23 ` Krzysztof Kozlowski
2015-07-23 21:56 ` Pavel Machek
2015-07-24 1:37 ` Krzysztof Kozlowski
2015-07-24 4:40 ` Kyungmin Park
2015-07-23 14:48 ` Shuah Khan
2015-07-23 15:08 ` Heiko Stübner
2015-08-04 19:39 ` Pavel Machek
2015-08-05 7:05 ` Bintian
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=BA8B014B-CBDD-4A9B-A9E2-A95BEA539ECF@holtmann.org \
--to=marcel@holtmann.org \
--cc=bjorn.andersson@sonymobile.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=ksummit-discuss@lists.linuxfoundation.org \
--cc=kyungmin.park@samsung.com \
--cc=pavel@ucw.cz \
--cc=robherring2@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