linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support
@ 2017-06-07  9:08 Ulf Hansson
  2017-06-07  9:08 ` [PATCH 1/3] dt-bindings: net: Add binding for the external clock for TI WiLink Ulf Hansson
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Ulf Hansson @ 2017-06-07  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

The commit ea452678734e ("arm64: dts: hikey: Fix WiFi support") indeed managed
to fix the WiFi support for the Hikey board. However, it also caused the
Bluetooth to break.

The reason to the problem is because part of the fixes for WiFi, involved
explicitly to start manage the external clock for the TI WiLink chip, as it's
needed to properly power on/off WiFi. Then, because the Bluetooth driver,
hci_ll, don't manage the clock, it fails to initialize Bluetooth.

This small series add support and DT bindings for the external clock, now
properly managed by the hci_ll driver during power on/off. On top of that, the
external clock is added to the Bluetooth DT node in the Hikey DTS file.

The regression has been reported by John Stultz, running a Hikey board with
UEFI based boot. I have confirmed that there is no regressions with u-boot as
we still don't have bluetooth working on that set up. I intend to fix that as
well, although in second step and not being part of a fixup series.

John, can you please confirm/test this on your Hikey board using UEFI!?

Perhaps this can go in via the bluetooth git, when respective patches has got
an ack. Or whatever you think is best.

Ulf Hansson (3):
  dt-bindings: net: Add binding for the external clock for TI WiLink
  Bluetooth: hci_ll: Add support for the external clock
  arm64: dts: hikey: Add external clock to the Bluetooth node

 Documentation/devicetree/bindings/net/ti,wilink-st.txt |  6 ++++++
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts         |  2 ++
 drivers/bluetooth/hci_ll.c                             | 14 +++++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] dt-bindings: net: Add binding for the external clock for TI WiLink
  2017-06-07  9:08 [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support Ulf Hansson
@ 2017-06-07  9:08 ` Ulf Hansson
  2017-06-07  9:08 ` [PATCH 2/3] Bluetooth: hci_ll: Add support for the external clock Ulf Hansson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2017-06-07  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

The external clock is provided to the TI WiLink combo chip and it's needed
for any of the transport interfaces. However let's make it optional to
avoid breaking existing platforms that yet doesn't specify the clock.

Fixes: ea452678734e ("arm64: dts: hikey: Fix WiFi support")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 Documentation/devicetree/bindings/net/ti,wilink-st.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/ti,wilink-st.txt b/Documentation/devicetree/bindings/net/ti,wilink-st.txt
index cbad73a..3404a4a 100644
--- a/Documentation/devicetree/bindings/net/ti,wilink-st.txt
+++ b/Documentation/devicetree/bindings/net/ti,wilink-st.txt
@@ -22,6 +22,10 @@ Optional properties:
  - enable-gpios : GPIO signal controlling enabling of BT. Active high.
  - vio-supply : Vio input supply (1.8V)
  - vbat-supply : Vbat input supply (2.9-4.8V)
+ - clocks : Must contain an entry, for each entry in clock-names.
+   See ../clocks/clock-bindings.txt for details.
+ - clock-names : Must include the following entry:
+   "ext_clock" (External clock provided to the TI combo chip).
 
 Example:
 
@@ -31,5 +35,7 @@ Example:
 	bluetooth {
 		compatible = "ti,wl1835-st";
 		enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
+		clocks = <&clk32k_wl18xx>;
+		clock-names = "ext_clock";
 	};
 };
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] Bluetooth: hci_ll: Add support for the external clock
  2017-06-07  9:08 [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support Ulf Hansson
  2017-06-07  9:08 ` [PATCH 1/3] dt-bindings: net: Add binding for the external clock for TI WiLink Ulf Hansson
@ 2017-06-07  9:08 ` Ulf Hansson
  2017-06-07  9:08 ` [PATCH 3/3] arm64: dts: hikey: Add external clock to the Bluetooth node Ulf Hansson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2017-06-07  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

Add support to manage the external clock provided to the WiLink combo chip
as it's needed for any of the transport interfaces.

To avoid breaking platforms not yet specifying the external clock, we make
it optional. In case the clock is successfully fetched during ->probe(),
let's manage it via the ->open|close() callbacks, to make sure the device
get properly powered on/off.

Fixes: ea452678734e ("arm64: dts: hikey: Fix WiFi support")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/bluetooth/hci_ll.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index adc444f..68f3d16 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -48,6 +48,7 @@
 #include <linux/serdev.h>
 #include <linux/skbuff.h>
 #include <linux/ti_wilink_st.h>
+#include <linux/clk.h>
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
@@ -84,6 +85,7 @@ struct ll_device {
 	struct hci_uart hu;
 	struct serdev_device *serdev;
 	struct gpio_desc *enable_gpio;
+	struct clk *ext_clk;
 };
 
 struct ll_struct {
@@ -146,8 +148,12 @@ static int ll_open(struct hci_uart *hu)
 
 	hu->priv = ll;
 
-	if (hu->serdev)
+	if (hu->serdev) {
+		struct ll_device *lldev = serdev_device_get_drvdata(hu->serdev);
 		serdev_device_open(hu->serdev);
+		if (!IS_ERR(lldev->ext_clk))
+			clk_prepare_enable(lldev->ext_clk);
+	}
 
 	return 0;
 }
@@ -181,6 +187,8 @@ static int ll_close(struct hci_uart *hu)
 		struct ll_device *lldev = serdev_device_get_drvdata(hu->serdev);
 		gpiod_set_value_cansleep(lldev->enable_gpio, 0);
 
+		clk_disable_unprepare(lldev->ext_clk);
+
 		serdev_device_close(hu->serdev);
 	}
 
@@ -720,6 +728,10 @@ static int hci_ti_probe(struct serdev_device *serdev)
 	if (IS_ERR(lldev->enable_gpio))
 		return PTR_ERR(lldev->enable_gpio);
 
+	lldev->ext_clk = devm_clk_get(&serdev->dev, "ext_clock");
+	if (IS_ERR(lldev->ext_clk) && PTR_ERR(lldev->ext_clk) != -ENOENT)
+		return PTR_ERR(lldev->ext_clk);
+
 	of_property_read_u32(serdev->dev.of_node, "max-speed", &max_speed);
 	hci_uart_set_speeds(hu, 115200, max_speed);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] arm64: dts: hikey: Add external clock to the Bluetooth node
  2017-06-07  9:08 [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support Ulf Hansson
  2017-06-07  9:08 ` [PATCH 1/3] dt-bindings: net: Add binding for the external clock for TI WiLink Ulf Hansson
  2017-06-07  9:08 ` [PATCH 2/3] Bluetooth: hci_ll: Add support for the external clock Ulf Hansson
@ 2017-06-07  9:08 ` Ulf Hansson
  2017-06-07 19:07 ` [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support John Stultz
  2017-06-09  5:49 ` Marcel Holtmann
  4 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2017-06-07  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

To make the TI WiLink chip work again for Bluetooth, let's add the missing
external clock to the Bluetooth node, such the driver can deal properly
with it during power on/off.

Fixes: ea452678734e ("arm64: dts: hikey: Fix WiFi support")
Cc: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
index 49f6a62..5cdfe73 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
@@ -141,6 +141,8 @@
 			bluetooth {
 				compatible = "ti,wl1835-st";
 				enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
+				clocks = <&pmic>;
+				clock-names = "ext_clock";
 			};
 		};
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support
  2017-06-07  9:08 [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support Ulf Hansson
                   ` (2 preceding siblings ...)
  2017-06-07  9:08 ` [PATCH 3/3] arm64: dts: hikey: Add external clock to the Bluetooth node Ulf Hansson
@ 2017-06-07 19:07 ` John Stultz
  2017-06-07 19:14   ` Daniel Lezcano
  2017-06-09  5:49 ` Marcel Holtmann
  4 siblings, 1 reply; 7+ messages in thread
From: John Stultz @ 2017-06-07 19:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 7, 2017 at 2:08 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> The commit ea452678734e ("arm64: dts: hikey: Fix WiFi support") indeed managed
> to fix the WiFi support for the Hikey board. However, it also caused the
> Bluetooth to break.
>
> The reason to the problem is because part of the fixes for WiFi, involved
> explicitly to start manage the external clock for the TI WiLink chip, as it's
> needed to properly power on/off WiFi. Then, because the Bluetooth driver,
> hci_ll, don't manage the clock, it fails to initialize Bluetooth.
>
> This small series add support and DT bindings for the external clock, now
> properly managed by the hci_ll driver during power on/off. On top of that, the
> external clock is added to the Bluetooth DT node in the Hikey DTS file.
>
> The regression has been reported by John Stultz, running a Hikey board with
> UEFI based boot. I have confirmed that there is no regressions with u-boot as
> we still don't have bluetooth working on that set up. I intend to fix that as
> well, although in second step and not being part of a fixup series.
>
> John, can you please confirm/test this on your Hikey board using UEFI!?

Yes. This does resolve the issue! Bluetooth and wifi are now working
together again as they were before ea452678734e.

For the whole set:
Tested-by: John Stultz <john.stultz@linaro.org>

Thanks so much for working this out Ulf!

-john

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support
  2017-06-07 19:07 ` [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support John Stultz
@ 2017-06-07 19:14   ` Daniel Lezcano
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Lezcano @ 2017-06-07 19:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/06/2017 21:07, John Stultz wrote:
> On Wed, Jun 7, 2017 at 2:08 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> The commit ea452678734e ("arm64: dts: hikey: Fix WiFi support") indeed managed
>> to fix the WiFi support for the Hikey board. However, it also caused the
>> Bluetooth to break.
>>
>> The reason to the problem is because part of the fixes for WiFi, involved
>> explicitly to start manage the external clock for the TI WiLink chip, as it's
>> needed to properly power on/off WiFi. Then, because the Bluetooth driver,
>> hci_ll, don't manage the clock, it fails to initialize Bluetooth.
>>
>> This small series add support and DT bindings for the external clock, now
>> properly managed by the hci_ll driver during power on/off. On top of that, the
>> external clock is added to the Bluetooth DT node in the Hikey DTS file.
>>
>> The regression has been reported by John Stultz, running a Hikey board with
>> UEFI based boot. I have confirmed that there is no regressions with u-boot as
>> we still don't have bluetooth working on that set up. I intend to fix that as
>> well, although in second step and not being part of a fixup series.
>>
>> John, can you please confirm/test this on your Hikey board using UEFI!?
> 
> Yes. This does resolve the issue! Bluetooth and wifi are now working
> together again as they were before ea452678734e.
> 
> For the whole set:
> Tested-by: John Stultz <john.stultz@linaro.org>

Great ! Thanks John for testing.


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support
  2017-06-07  9:08 [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support Ulf Hansson
                   ` (3 preceding siblings ...)
  2017-06-07 19:07 ` [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support John Stultz
@ 2017-06-09  5:49 ` Marcel Holtmann
  4 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2017-06-09  5:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ulf,

> The commit ea452678734e ("arm64: dts: hikey: Fix WiFi support") indeed managed
> to fix the WiFi support for the Hikey board. However, it also caused the
> Bluetooth to break.
> 
> The reason to the problem is because part of the fixes for WiFi, involved
> explicitly to start manage the external clock for the TI WiLink chip, as it's
> needed to properly power on/off WiFi. Then, because the Bluetooth driver,
> hci_ll, don't manage the clock, it fails to initialize Bluetooth.
> 
> This small series add support and DT bindings for the external clock, now
> properly managed by the hci_ll driver during power on/off. On top of that, the
> external clock is added to the Bluetooth DT node in the Hikey DTS file.
> 
> The regression has been reported by John Stultz, running a Hikey board with
> UEFI based boot. I have confirmed that there is no regressions with u-boot as
> we still don't have bluetooth working on that set up. I intend to fix that as
> well, although in second step and not being part of a fixup series.
> 
> John, can you please confirm/test this on your Hikey board using UEFI!?
> 
> Perhaps this can go in via the bluetooth git, when respective patches has got
> an ack. Or whatever you think is best.
> 
> Ulf Hansson (3):
>  dt-bindings: net: Add binding for the external clock for TI WiLink
>  Bluetooth: hci_ll: Add support for the external clock
>  arm64: dts: hikey: Add external clock to the Bluetooth node
> 
> Documentation/devicetree/bindings/net/ti,wilink-st.txt |  6 ++++++
> arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts         |  2 ++
> drivers/bluetooth/hci_ll.c                             | 14 +++++++++++++-
> 3 files changed, 21 insertions(+), 1 deletion(-)

all 3 patches have been applied to bluetooth-next tree.

Regards

Marcel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-09  5:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07  9:08 [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support Ulf Hansson
2017-06-07  9:08 ` [PATCH 1/3] dt-bindings: net: Add binding for the external clock for TI WiLink Ulf Hansson
2017-06-07  9:08 ` [PATCH 2/3] Bluetooth: hci_ll: Add support for the external clock Ulf Hansson
2017-06-07  9:08 ` [PATCH 3/3] arm64: dts: hikey: Add external clock to the Bluetooth node Ulf Hansson
2017-06-07 19:07 ` [PATCH 0/3] arm64: hi6220-hikey: Fix Bluetooth support John Stultz
2017-06-07 19:14   ` Daniel Lezcano
2017-06-09  5:49 ` Marcel Holtmann

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).